pxt-core 12.2.9 → 12.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/built/pxt.js +11 -1
  2. package/built/pxtlib.d.ts +1 -0
  3. package/built/pxtlib.js +10 -1
  4. package/built/pxtsim.js +1 -0
  5. package/built/server.js +14 -5
  6. package/built/target.js +1 -1
  7. package/built/targetlight.js +1 -1
  8. package/built/web/main.js +31 -31
  9. package/built/web/multiplayer/js/{main.0899d3d0.js → main.37ae3a7b.js} +2 -2
  10. package/built/web/pxtapp.js +1 -1
  11. package/built/web/pxtasseteditor.js +1 -1
  12. package/built/web/pxtembed.js +4 -4
  13. package/built/web/pxtlib.js +1 -1
  14. package/built/web/pxtsim.js +1 -1
  15. package/built/web/pxtworker.js +1 -1
  16. package/built/web/react-common-authcode.css +1 -1
  17. package/built/web/react-common-multiplayer.css +1 -1
  18. package/built/web/react-common-skillmap.css +1 -1
  19. package/built/web/rtlreact-common-authcode.css +1 -1
  20. package/built/web/rtlreact-common-multiplayer.css +1 -1
  21. package/built/web/rtlreact-common-skillmap.css +1 -1
  22. package/built/web/rtlsemantic.css +1 -1
  23. package/built/web/runnerembed.js +5 -5
  24. package/built/web/semantic.css +1 -1
  25. package/built/web/skillmap/js/{main.ea2351fc.js → main.45790a33.js} +2 -2
  26. package/built/web/teachertool/js/{main.53fbf888.js → main.6e24f397.js} +2 -2
  27. package/common-docs/teachertool/catalog-shared.json +19 -1
  28. package/docfiles/script.html +2 -2
  29. package/package.json +1 -1
  30. package/react-common/components/controls/Input.tsx +24 -5
  31. package/react-common/styles/controls/Input.less +41 -0
  32. package/theme/tutorial-sidebar.less +1 -1
  33. package/theme/tutorial.less +1 -2
  34. package/webapp/public/multiplayer.html +1 -1
  35. package/webapp/public/skillmap.html +1 -1
  36. package/webapp/public/teachertool.html +1 -1
package/built/pxt.js CHANGED
@@ -119050,6 +119050,15 @@ var pxt;
119050
119050
  return this.generateNewIDInternal("json" /* AssetType.Json */, pxt.sprite.JSON_PREFIX, pxt.sprite.JSON_NAMESPACE);
119051
119051
  }
119052
119052
  }
119053
+ generateNewName(type, name) {
119054
+ const defaultName = name || pxt.getDefaultAssetDisplayName(type);
119055
+ let newName = defaultName;
119056
+ let index = 0;
119057
+ while (this.isNameTaken(type, newName)) {
119058
+ newName = defaultName + (index++);
119059
+ }
119060
+ return newName;
119061
+ }
119053
119062
  generateNewIDInternal(type, varPrefix, namespaceString) {
119054
119063
  varPrefix = varPrefix.replace(/\d+$/, "");
119055
119064
  const prefix = namespaceString ? namespaceString + "." + varPrefix : varPrefix;
@@ -119540,7 +119549,7 @@ var pxt;
119540
119549
  }
119541
119550
  pxt.getTSReferenceForAsset = getTSReferenceForAsset;
119542
119551
  function parseAssetTSReference(ts) {
119543
- const match = /^\s*(?:(?:assets\s*\.\s*(image|tile|animation|tilemap|song))|(tilemap))\s*(?:`|\(""")([^`"]+)(?:`|"""\))\s*$/m.exec(ts);
119552
+ const match = /^\s*(?:(?:assets\s*\.\s*(image|tile|animation|tilemap|song))|(tilemap))\s*(?:`|\(""")([^`"]*)(?:`|"""\))\s*$/m.exec(ts);
119544
119553
  if (match) {
119545
119554
  const type = match[1] || match[2];
119546
119555
  const name = match[3].trim();
@@ -157569,6 +157578,7 @@ var pxsim;
157569
157578
  var _a;
157570
157579
  const wrapper = document.createElement("div");
157571
157580
  wrapper.className = `simframe ui embed`;
157581
+ wrapper.setAttribute('tabindex', '0');
157572
157582
  const frame = document.createElement('iframe');
157573
157583
  frame.id = 'sim-frame-' + this.nextId();
157574
157584
  frame.title = pxsim.localization.lf("Simulator");
package/built/pxtlib.d.ts CHANGED
@@ -3206,6 +3206,7 @@ declare namespace pxt {
3206
3206
  protected generateAnimation(entry: JRes): [Animation, boolean];
3207
3207
  protected inflateAnimation(animation: Animation, assets: (Tile | ProjectImage | Animation | Song | JsonAsset)[]): Animation;
3208
3208
  generateNewID(type: AssetType): string;
3209
+ generateNewName(type: AssetType, name?: string): string;
3209
3210
  protected generateNewIDInternal(type: AssetType, varPrefix: string, namespaceString?: string): string;
3210
3211
  protected onChange(): void;
3211
3212
  protected readImages(allJRes: Map<JRes>, isProjectFile?: boolean): (Tile | ProjectImage | Animation | Song | JsonAsset)[];
package/built/pxtlib.js CHANGED
@@ -21329,6 +21329,15 @@ var pxt;
21329
21329
  return this.generateNewIDInternal("json" /* AssetType.Json */, pxt.sprite.JSON_PREFIX, pxt.sprite.JSON_NAMESPACE);
21330
21330
  }
21331
21331
  }
21332
+ generateNewName(type, name) {
21333
+ const defaultName = name || pxt.getDefaultAssetDisplayName(type);
21334
+ let newName = defaultName;
21335
+ let index = 0;
21336
+ while (this.isNameTaken(type, newName)) {
21337
+ newName = defaultName + (index++);
21338
+ }
21339
+ return newName;
21340
+ }
21332
21341
  generateNewIDInternal(type, varPrefix, namespaceString) {
21333
21342
  varPrefix = varPrefix.replace(/\d+$/, "");
21334
21343
  const prefix = namespaceString ? namespaceString + "." + varPrefix : varPrefix;
@@ -21819,7 +21828,7 @@ var pxt;
21819
21828
  }
21820
21829
  pxt.getTSReferenceForAsset = getTSReferenceForAsset;
21821
21830
  function parseAssetTSReference(ts) {
21822
- const match = /^\s*(?:(?:assets\s*\.\s*(image|tile|animation|tilemap|song))|(tilemap))\s*(?:`|\(""")([^`"]+)(?:`|"""\))\s*$/m.exec(ts);
21831
+ const match = /^\s*(?:(?:assets\s*\.\s*(image|tile|animation|tilemap|song))|(tilemap))\s*(?:`|\(""")([^`"]*)(?:`|"""\))\s*$/m.exec(ts);
21823
21832
  if (match) {
21824
21833
  const type = match[1] || match[2];
21825
21834
  const name = match[3].trim();
package/built/pxtsim.js CHANGED
@@ -6833,6 +6833,7 @@ var pxsim;
6833
6833
  var _a;
6834
6834
  const wrapper = document.createElement("div");
6835
6835
  wrapper.className = `simframe ui embed`;
6836
+ wrapper.setAttribute('tabindex', '0');
6836
6837
  const frame = document.createElement('iframe');
6837
6838
  frame.id = 'sim-frame-' + this.nextId();
6838
6839
  frame.title = pxsim.localization.lf("Simulator");
package/built/server.js CHANGED
@@ -964,6 +964,10 @@ function serveAsync(options) {
964
964
  }
965
965
  // Rebuild pathname without leading version number
966
966
  pathname = "/" + elts.join("/");
967
+ const originalRouteSegment = (elts[0] || "");
968
+ const hyphenPrefixMatch = originalRouteSegment.match(/^-+/);
969
+ const hyphenPrefix = hyphenPrefixMatch ? hyphenPrefixMatch[0] : "";
970
+ const normalizedRouteSegment = originalRouteSegment.replace(/^-+/, "").toLowerCase();
967
971
  const expandWebappHtml = (appname, html) => {
968
972
  // Expand templates
969
973
  html = expandHtml(html);
@@ -1009,12 +1013,17 @@ function serveAsync(options) {
1009
1013
  error(500, e.message);
1010
1014
  });
1011
1015
  };
1012
- const webappNames = subwebapp_1.SUB_WEBAPPS.filter(w => w.localServeEndpoint).map(w => w.localServeEndpoint);
1013
- const webappIdx = webappNames.findIndex(s => new RegExp(`^-{0,3}${s}$`).test(elts[0] || ''));
1014
- if (webappIdx >= 0) {
1015
- const webappName = webappNames[webappIdx];
1016
+ const devSubapp = subwebapp_1.SUB_WEBAPPS.find(w => !!w.localServeEndpoint && w.localServeEndpoint.toLowerCase() === normalizedRouteSegment);
1017
+ if (devSubapp) {
1016
1018
  const webappPath = pathname.split("/").slice(2).join('/'); // remove /<webappName>/ from path
1017
- return serveWebappFile(webappName, webappPath);
1019
+ elts[0] = `${hyphenPrefix}${devSubapp.name}`;
1020
+ const escapedEndpoint = devSubapp.localServeEndpoint.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1021
+ const aliasRegex = new RegExp(`^/(-{0,3})${escapedEndpoint}(?=/|$)`, "i");
1022
+ pathname = pathname.replace(aliasRegex, (_match, hyphens) => `/${hyphens}${devSubapp.name}`);
1023
+ if (normalizedRouteSegment === devSubapp.name.toLowerCase()) {
1024
+ serveWebappFile(devSubapp.name, webappPath);
1025
+ return;
1026
+ }
1018
1027
  }
1019
1028
  if (elts[0] == "api") {
1020
1029
  if (elts[1] == "streams") {