From eaa5335e4fac445a75b1eed1e64c7af9bf00bc19 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Wed, 11 Sep 2024 14:13:46 -0700 Subject: [PATCH 1/8] don't run local builds in parallel (#10169) --- cli/cli.ts | 19 ++++++++++++++++--- cli/prepYotta.ts | 4 ++-- pxtlib/package.ts | 2 ++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cli/cli.ts b/cli/cli.ts index 98fc295b056c..5ba851aea3bf 100644 --- a/cli/cli.ts +++ b/cli/cli.ts @@ -3030,6 +3030,7 @@ class SnippetHost implements pxt.Host { class Host implements pxt.Host { fileOverrides: Map = {} + queue = new pxt.Util.PromiseQueue(); resolve(module: pxt.Package, filename: string) { //pxt.debug(`resolving ${module.level}:${module.id} -- ${filename} in ${path.resolve(".")}`) @@ -3165,10 +3166,22 @@ class Host if (useCompileServiceDocker) { return build.compileWithLocalCompileService(extInfo); } + return this.queue.enqueue("getHexInfoAsync", async () => { + const prevVariant = pxt.appTargetVariant; - setBuildEngine() - return build.buildHexAsync(build.thisBuild, mainPkg, extInfo, forceBuild) - .then(() => build.thisBuild.patchHexInfo(extInfo)) + if (extInfo.appVariant && extInfo.appVariant !== prevVariant) { + pxt.setAppTargetVariant(extInfo.appVariant, { temporary: true }); + } + setBuildEngine() + await build.buildHexAsync(build.thisBuild, mainPkg, extInfo, forceBuild) + const res = build.thisBuild.patchHexInfo(extInfo); + + if (extInfo.appVariant && extInfo.appVariant !== prevVariant) { + pxt.setAppTargetVariant(prevVariant); + } + + return res; + }); } cacheStoreAsync(id: string, val: string): Promise { diff --git a/cli/prepYotta.ts b/cli/prepYotta.ts index 43775ac04155..5309d10d9b52 100644 --- a/cli/prepYotta.ts +++ b/cli/prepYotta.ts @@ -7,8 +7,8 @@ const os = require("os"); const path = require("path"); const fs = require("fs"); -const token = process.env["GH_ACCESS_TOKEN"]; -if (process.env["GH_ACCESS_TOKEN"]) { +const token = process.env["GITHUB_ACCESS_TOKEN"]; +if (process.env["GITHUB_ACCESS_TOKEN"]) { console.log("Writing .netrc and .yotta/config.json") const home = os.homedir(); diff --git a/pxtlib/package.ts b/pxtlib/package.ts index 0c2b303b48df..6a0d2d0d85e5 100644 --- a/pxtlib/package.ts +++ b/pxtlib/package.ts @@ -1187,6 +1187,8 @@ namespace pxt { } } + einfo.appVariant = variant; + const inf = target.isNative ? await this.host().getHexInfoAsync(einfo) : null einfo = U.flatClone(einfo) From c6917fbd16e9e133bd84a663236932ef40390199 Mon Sep 17 00:00:00 2001 From: Abhijith Chatra Date: Thu, 12 Sep 2024 09:55:54 -0700 Subject: [PATCH 2/8] 10.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d19187dbba40..c3196be08855 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-core", - "version": "10.3.5", + "version": "10.3.6", "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors", "keywords": [ "TypeScript", From 905a999d758de7e0ca5ec1a36f4cd366bc862554 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Thu, 12 Sep 2024 11:04:09 -0700 Subject: [PATCH 3/8] patch projects with top-level shadow blocks (#10177) --- pxtblocks/importer.ts | 80 +++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/pxtblocks/importer.ts b/pxtblocks/importer.ts index 41d83a3f7e34..d7db241d2e4e 100644 --- a/pxtblocks/importer.ts +++ b/pxtblocks/importer.ts @@ -382,6 +382,14 @@ function promoteShadow(shadow: Element) { shadow.remove(); return undefined; } + const newBlock = createBlockFromShadow(shadow); + shadow.parentElement.appendChild(newBlock); + shadow.remove(); + + return newBlock; +}; + +function createBlockFromShadow(shadow: Element) { const newBlock = Blockly.utils.xml.createElement("block"); for (const attr of shadow.getAttributeNames()) { @@ -392,45 +400,59 @@ function promoteShadow(shadow: Element) { newBlock.appendChild(child.cloneNode(true)); } - shadow.parentElement.appendChild(newBlock); - shadow.remove(); - return newBlock; -}; +} export function patchShadows(root: Element, inShadow: boolean) { if (root.tagName === "shadow") { - const type = root.getAttribute("type"); - let shouldPatch = false; - - switch (type) { - case "variables_get_reporter": - case "argument_reporter_boolean": - case "argument_reporter_number": - case "argument_reporter_string": - case "argument_reporter_array": - case "argument_reporter_custom": - shouldPatch = true; - break; + if (root.parentElement?.tagName === "xml") { + console.warn(`Shadow block of type '${root.getAttribute("type")}' found at top level. Converting to non-shadow block`); + pxt.tickEvent(`blocks.import.topLevelShadow`, { blockId: root.getAttribute("type") }); + + const newBlock = createBlockFromShadow(root); + root.parentElement.insertBefore(newBlock, root); + root.remove(); + root = newBlock; + + const mutation = getDirectChildren(root, "mutation")[0]; + if (mutation?.hasAttribute("dupliacteondrag")) { + mutation.removeAttribute("dupliacteondrag"); + } } + else { + const type = root.getAttribute("type"); + let shouldPatch = false; + + switch (type) { + case "variables_get_reporter": + case "argument_reporter_boolean": + case "argument_reporter_number": + case "argument_reporter_string": + case "argument_reporter_array": + case "argument_reporter_custom": + shouldPatch = true; + break; + } - if (shouldPatch) { - root = promoteShadow(root) - if (!root) return; - let mutation = getDirectChildren(root, "mutation")[0]; + if (shouldPatch) { + root = promoteShadow(root) + if (!root) return; + let mutation = getDirectChildren(root, "mutation")[0]; - if (mutation) { - mutation.setAttribute("duplicateondrag", "true"); + if (mutation) { + mutation.setAttribute("duplicateondrag", "true"); + } + else { + mutation = Blockly.utils.xml.createElement("mutation"); + mutation.setAttribute("duplicateondrag", "true"); + root.appendChild(mutation); + } } - else { - mutation = Blockly.utils.xml.createElement("mutation"); - mutation.setAttribute("duplicateondrag", "true"); - root.appendChild(mutation); + else if (type === "variables_get" || hasNonShadowChild(root)) { + root = promoteShadow(root); } } - else if (type === "variables_get" || hasNonShadowChild(root)) { - root = promoteShadow(root); - } + } if (!root) return; From bb44cc1f398d49b1900d7a1789893c72441c5e2d Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Thu, 12 Sep 2024 11:07:56 -0700 Subject: [PATCH 4/8] use getDate not getDay and simplify date logic (#10178) --- webapp/src/timeMachine.tsx | 39 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/webapp/src/timeMachine.tsx b/webapp/src/timeMachine.tsx index d6c038a12731..b3c9e87c6bb8 100644 --- a/webapp/src/timeMachine.tsx +++ b/webapp/src/timeMachine.tsx @@ -362,21 +362,31 @@ function formatTime(time: number) { } function formatDate(time: number) { + const oneDay = 1000 * 60 * 60 * 24; + const now = new Date(); const nowYear = now.getFullYear(); const nowMonth = now.getMonth(); const nowDay = now.getDate(); - const date = new Date(time); - const year = date.getFullYear(); - const month = date.getMonth(); - const day = date.getDate(); + const today = new Date(nowYear, nowMonth, nowDay); + const yesterday = new Date(today.getTime() - oneDay); + const oneWeekAgo = new Date(today.getTime() - oneDay * 7); - const diff = Date.now() - time; - const oneDay = 1000 * 60 * 60 * 24; + const editTime = new Date(time); + const editDay = new Date(editTime.getFullYear(), editTime.getMonth(), editTime.getDate()); - if (year !== nowYear) { - return date.toLocaleDateString( + if (time >= today.getTime()) { + return lf("Today"); + } + else if (time >= yesterday.getTime()) { + return lf("Yesterday") + } + else if (time >= oneWeekAgo.getTime()) { + return lf("{0} days ago", Math.floor((today.getTime() - editDay.getTime()) / oneDay)); + } + else if (editDay.getFullYear() !== today.getFullYear()) { + return editTime.toLocaleDateString( pxt.U.userLanguage(), { year: "numeric", @@ -385,17 +395,8 @@ function formatDate(time: number) { } ); } - else if (nowMonth === month && nowDay === day) { - return lf("Today"); - } - else if (diff < oneDay * 2) { - return lf("Yesterday") - } - else if (diff < oneDay * 8) { - return lf("{0} days ago", Math.floor(diff / oneDay)) - } else { - return date.toLocaleDateString( + return editTime.toLocaleDateString( pxt.U.userLanguage(), { month: "short", @@ -439,7 +440,7 @@ function getTimelineEntries(history: HistoryFile): TimelineEntry[] { const createTimeEntry = (timestamp: number, kind: "snapshot" | "diff" | "share") => { const date = new Date(timestamp); - const key = new Date(date.getFullYear(), date.getMonth(), date.getDay()).getTime(); + const key = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime(); if (!buckets[key]) { buckets[key] = []; From b5e1a4da5cd87bbe0081d4ac1d3497ae49486100 Mon Sep 17 00:00:00 2001 From: Abhijith Chatra Date: Thu, 12 Sep 2024 11:31:41 -0700 Subject: [PATCH 5/8] 10.3.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c3196be08855..fca464024f46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-core", - "version": "10.3.6", + "version": "10.3.7", "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors", "keywords": [ "TypeScript", From 76e269fa8ed5de449393ccef0c7340710b869786 Mon Sep 17 00:00:00 2001 From: Richard Knoll Date: Thu, 12 Sep 2024 14:48:58 -0700 Subject: [PATCH 6/8] re-enable scroll to zoom (#10181) --- webapp/src/blocks.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/src/blocks.tsx b/webapp/src/blocks.tsx index 2ab17e7a9aa8..8dd3435eacf4 100644 --- a/webapp/src/blocks.tsx +++ b/webapp/src/blocks.tsx @@ -1268,7 +1268,8 @@ export class Editor extends toolboxeditor.ToolboxEditor { minScale: .2, scaleSpeed: 1.5, startScale: pxt.BrowserUtils.isMobile() ? 0.7 : 0.9, - pinch: true + pinch: true, + wheel: true }, rtl: Util.isUserLanguageRtl() }; From 78d3016966903b8650a856ae53c7d23dba58a051 Mon Sep 17 00:00:00 2001 From: Thomas Sparks <69657545+thsparks@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:13:01 -0700 Subject: [PATCH 7/8] Teacher Tool: Assorted Small UI Fixes (#10180) This change makes a few small UI fixes: Fixes width of criteria on firefox (webkit not supported) Remove "Max" and display a permanent check instead when the user reaches the max allowed count for a criteria. Fix line wrapping for criteria --- teachertool/src/components/CatalogOverlay.tsx | 10 ++++++---- .../styling/CriteriaInstanceDisplay.module.scss | 4 +++- .../components/styling/EvalResultDisplay.module.scss | 11 +++++++---- teachertool/src/constants.ts | 2 +- teachertool/src/services/backendRequests.ts | 1 - 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/teachertool/src/components/CatalogOverlay.tsx b/teachertool/src/components/CatalogOverlay.tsx index ebd5ddf8af15..ecd99ea0ff92 100644 --- a/teachertool/src/components/CatalogOverlay.tsx +++ b/teachertool/src/components/CatalogOverlay.tsx @@ -40,26 +40,28 @@ interface CatalogItemLabelProps { recentlyAdded: boolean; } const CatalogItemLabel: React.FC = ({ catalogCriteria, isMaxed, recentlyAdded }) => { - const showRecentlyAddedIndicator = recentlyAdded && !isMaxed; return (
{isMaxed ? ( - {Strings.Max} + ) : ( <> diff --git a/teachertool/src/components/styling/CriteriaInstanceDisplay.module.scss b/teachertool/src/components/styling/CriteriaInstanceDisplay.module.scss index 33d69c603588..342f6d81b962 100644 --- a/teachertool/src/components/styling/CriteriaInstanceDisplay.module.scss +++ b/teachertool/src/components/styling/CriteriaInstanceDisplay.module.scss @@ -28,6 +28,7 @@ .segment-container { display: flex; + flex-wrap: wrap; flex-direction: row; align-items: flex-start; justify-content: flex-start; @@ -158,7 +159,8 @@ .criteria-description { color: var(--pxt-page-foreground-light); margin-top: 0.2rem; - width: -webkit-fill-available; + width: 100%; // For non-webkit browsers + width: -webkit-fill-available; // Webkit browsers &.for-print { font-style: italic; diff --git a/teachertool/src/components/styling/EvalResultDisplay.module.scss b/teachertool/src/components/styling/EvalResultDisplay.module.scss index d10805a8f03b..f3227fad8a29 100644 --- a/teachertool/src/components/styling/EvalResultDisplay.module.scss +++ b/teachertool/src/components/styling/EvalResultDisplay.module.scss @@ -80,7 +80,8 @@ gap: 0.5rem; align-items: center; justify-content: flex-start; - width: -webkit-fill-available; + width: 100%; // For non-webkit browsers + width: -webkit-fill-available; // Webkit browsers padding: 0.5rem; } @@ -89,7 +90,8 @@ flex-direction: column; align-items: center; justify-content: flex-start; - width: -webkit-fill-available; + width: 100%; // For non-webkit browsers + width: -webkit-fill-available; // Webkit browsers min-height: 9rem; gap: 0.5rem; @@ -163,7 +165,8 @@ .separator { border-bottom: solid 1px var(--pxt-content-accent); margin-top: 0.5rem; - width: -webkit-fill-available; + width: 100%; // For non-webkit browsers + width: -webkit-fill-available; // Webkit browsers } .result-details { @@ -302,4 +305,4 @@ display: flex; flex-direction: column; margin-top: 0.5rem; -} \ No newline at end of file +} diff --git a/teachertool/src/constants.ts b/teachertool/src/constants.ts index 3e8155896e94..ee07e962d639 100644 --- a/teachertool/src/constants.ts +++ b/teachertool/src/constants.ts @@ -32,7 +32,6 @@ export namespace Strings { export const Continue = lf("Continue"); export const Loading = lf("Loading..."); export const Close = lf("Close"); - export const Max = lf("Max"); export const AddToChecklist = lf("Add to Checklist"); export const SelectCriteriaDescription = lf("Select the criteria you'd like to include"); export const Checklist = lf("Checklist"); @@ -53,6 +52,7 @@ export namespace Strings { export const EvaluationComplete = lf("Evaluation complete"); export const UnableToEvaluatePartial = lf("Unable to evaluate some criteria"); export const GiveFeedback = lf("Give Feedback"); + export const MaxReached = lf("Maximum count reached for this item"); } export namespace Ticks { diff --git a/teachertool/src/services/backendRequests.ts b/teachertool/src/services/backendRequests.ts index a153bb8e2ed9..31c3991c3a4b 100644 --- a/teachertool/src/services/backendRequests.ts +++ b/teachertool/src/services/backendRequests.ts @@ -1,4 +1,3 @@ -import { Strings } from "../constants"; import { stateAndDispatch } from "../state"; import { ErrorCode } from "../types/errorCode"; import { logError } from "./loggingService"; From 477b1fedc6236687d6078e5771442fec2a91548e Mon Sep 17 00:00:00 2001 From: Abhijith Chatra Date: Fri, 13 Sep 2024 09:13:05 -0700 Subject: [PATCH 8/8] 10.3.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fca464024f46..b033a3580fe0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-core", - "version": "10.3.7", + "version": "10.3.8", "description": "Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors", "keywords": [ "TypeScript",