pxt-core 8.5.18 → 8.5.20

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.
package/built/pxt.js CHANGED
@@ -103216,7 +103216,7 @@ var pxt;
103216
103216
  }
103217
103217
  static createAsync() {
103218
103218
  function openAsync() {
103219
- const idbWrapper = new pxt.BrowserUtils.IDBWrapper(TutorialInfoIndexedDb.dbName(), 3, (ev, r) => {
103219
+ const idbWrapper = new pxt.BrowserUtils.IDBWrapper(TutorialInfoIndexedDb.dbName(), 2, (ev, r) => {
103220
103220
  const db = r.result;
103221
103221
  db.createObjectStore(TutorialInfoIndexedDb.TABLE, { keyPath: TutorialInfoIndexedDb.KEYPATH });
103222
103222
  }, () => {
@@ -109707,6 +109707,24 @@ var pxt;
109707
109707
  }
109708
109708
  }
109709
109709
  pxt.ImageConverter = ImageConverter;
109710
+ function convertUint8BufferToPngUri(palette, icon) {
109711
+ const imgConv = new pxt.ImageConverter();
109712
+ const paletteAsTripletArray = [];
109713
+ for (let i = 0; i < 16; i++) {
109714
+ paletteAsTripletArray.push([
109715
+ palette[i * 3 + 2],
109716
+ palette[i * 3 + 1],
109717
+ palette[i * 3 + 0],
109718
+ 255,
109719
+ ]);
109720
+ }
109721
+ imgConv.setPalette(paletteAsTripletArray);
109722
+ const stringifiedRefBuffer = String.fromCharCode.apply(null, icon);
109723
+ const jresFormattedIconBuffer = `data:image/x-mkcd-f4;base64,${btoa(stringifiedRefBuffer)}`;
109724
+ const iconPngDataUri = imgConv.convert(jresFormattedIconBuffer);
109725
+ return iconPngDataUri;
109726
+ }
109727
+ pxt.convertUint8BufferToPngUri = convertUint8BufferToPngUri;
109710
109728
  })(pxt || (pxt = {}));
109711
109729
  var pxt;
109712
109730
  (function (pxt) {
@@ -111532,12 +111550,38 @@ var pxt;
111532
111550
  MultiplayerDevBackendType[MultiplayerDevBackendType["LOCAL"] = 2] = "LOCAL";
111533
111551
  })(MultiplayerDevBackendType || (MultiplayerDevBackendType = {}));
111534
111552
  let MULTIPLAYER_DEV_BACKEND_TYPE = MultiplayerDevBackendType.STAGING;
111553
+ multiplayer.ABSOLUTE_LINKS = {
111554
+ PROD_BETA: "https://arcade.makecode.com/beta--multiplayer",
111555
+ STAGING_BETA: "https://arcade.staging.pxt.io/beta--multiplayer",
111556
+ LOCAL: "http://localhost:3000",
111557
+ };
111558
+ multiplayer.RELATIVE_LINKS = {
111559
+ PROD: "/--multiplayer",
111560
+ BETA: "/beta--multiplayer",
111561
+ };
111535
111562
  multiplayer.SHORT_LINKS = {
111536
111563
  PROD: "https://aka.ms/a9",
111537
111564
  PROD_BETA: "https://aka.ms/a9b",
111538
111565
  STAGING: "https://aka.ms/a9s",
111539
111566
  STAGING_BETA: "https://aka.ms/a9sb",
111540
- LOCAL: "http://localhost:3000"
111567
+ };
111568
+ multiplayer.RELATIVE_LINK = () => {
111569
+ if (pxt.BrowserUtils.isLocalHostDev()) {
111570
+ switch (MULTIPLAYER_DEV_BACKEND_TYPE) {
111571
+ case MultiplayerDevBackendType.PROD:
111572
+ return multiplayer.ABSOLUTE_LINKS.PROD_BETA;
111573
+ case MultiplayerDevBackendType.STAGING:
111574
+ return multiplayer.ABSOLUTE_LINKS.STAGING_BETA;
111575
+ case MultiplayerDevBackendType.LOCAL:
111576
+ return multiplayer.ABSOLUTE_LINKS.LOCAL;
111577
+ }
111578
+ }
111579
+ if (window.location.pathname.startsWith("/beta")) {
111580
+ return multiplayer.RELATIVE_LINKS.BETA;
111581
+ }
111582
+ else {
111583
+ return multiplayer.RELATIVE_LINKS.PROD;
111584
+ }
111541
111585
  };
111542
111586
  multiplayer.SHORT_LINK = () => {
111543
111587
  if (pxt.BrowserUtils.isLocalHostDev()) {
@@ -111547,7 +111591,7 @@ var pxt;
111547
111591
  case MultiplayerDevBackendType.STAGING:
111548
111592
  return multiplayer.SHORT_LINKS.STAGING_BETA;
111549
111593
  case MultiplayerDevBackendType.LOCAL:
111550
- return multiplayer.SHORT_LINKS.LOCAL;
111594
+ return multiplayer.ABSOLUTE_LINKS.LOCAL;
111551
111595
  }
111552
111596
  }
111553
111597
  if (window.location.host.endsWith(".staging.pxt.io")) {
@@ -111565,12 +111609,12 @@ var pxt;
111565
111609
  return multiplayer.SHORT_LINKS.PROD;
111566
111610
  }
111567
111611
  };
111568
- function makeHostLink(shareUrlOrCode) {
111569
- return `${multiplayer.SHORT_LINK()}?host=${encodeURIComponent(shareUrlOrCode)}`;
111612
+ function makeHostLink(shareUrlOrCode, shortLink) {
111613
+ return `${shortLink ? multiplayer.SHORT_LINK() : multiplayer.RELATIVE_LINK()}?host=${encodeURIComponent(shareUrlOrCode)}`;
111570
111614
  }
111571
111615
  multiplayer.makeHostLink = makeHostLink;
111572
- function makeJoinLink(joinCode) {
111573
- return `${multiplayer.SHORT_LINK()}?join=${encodeURIComponent(joinCode)}`;
111616
+ function makeJoinLink(joinCode, shortLink) {
111617
+ return `${shortLink ? multiplayer.SHORT_LINK() : multiplayer.RELATIVE_LINK()}?join=${encodeURIComponent(joinCode)}`;
111574
111618
  }
111575
111619
  multiplayer.makeJoinLink = makeJoinLink;
111576
111620
  })(multiplayer = pxt.multiplayer || (pxt.multiplayer = {}));
@@ -114445,6 +114489,7 @@ var ts;
114445
114489
  fnArgs: compileResult.usedArguments,
114446
114490
  parts: pxtc.computeUsedParts(compileResult, "ignorebuiltin"),
114447
114491
  usedBuiltinParts: pxtc.computeUsedParts(compileResult, "onlybuiltin"),
114492
+ allParts: pxtc.computeUsedParts(compileResult, undefined, true),
114448
114493
  breakpoints: (_a = compileResult.breakpoints) === null || _a === void 0 ? void 0 : _a.map(bp => bp.id),
114449
114494
  };
114450
114495
  }
@@ -116954,6 +116999,7 @@ var pxt;
116954
116999
  return this.nextInternalID++;
116955
117000
  }
116956
117001
  createNewImage(width = 16, height = 16) {
117002
+ this.onChange();
116957
117003
  const id = this.generateNewID("image" /* AssetType.Image */);
116958
117004
  const bitmap = new pxt.sprite.Bitmap(width, height).data();
116959
117005
  const newImage = {
@@ -116967,6 +117013,7 @@ var pxt;
116967
117013
  return this.state.images.add(newImage);
116968
117014
  }
116969
117015
  createNewAnimation(width = 16, height = 16) {
117016
+ this.onChange();
116970
117017
  const id = this.generateNewID("animation" /* AssetType.Animation */);
116971
117018
  const bitmap = new pxt.sprite.Bitmap(width, height).data();
116972
117019
  const newAnimation = {
@@ -116980,6 +117027,7 @@ var pxt;
116980
117027
  return this.state.animations.add(newAnimation);
116981
117028
  }
116982
117029
  createNewAnimationFromData(frames, interval = 500, displayName) {
117030
+ this.onChange();
116983
117031
  const id = this.generateNewID("animation" /* AssetType.Animation */);
116984
117032
  const newAnimation = {
116985
117033
  internalID: this.getNewInternalId(),
@@ -155230,7 +155278,8 @@ var pxsim;
155230
155278
  storedState: opts.storedState,
155231
155279
  ipc: opts.ipc,
155232
155280
  single: opts.single,
155233
- dependencies: opts.dependencies
155281
+ dependencies: opts.dependencies,
155282
+ activePlayer: opts.activePlayer,
155234
155283
  };
155235
155284
  this.start();
155236
155285
  }
package/built/pxtlib.d.ts CHANGED
@@ -1542,6 +1542,7 @@ declare namespace pxt {
1542
1542
  genMonochrome(data: string, w: number, h: number): string;
1543
1543
  genColor(data: string, width: number, height: number, intScale: number): string;
1544
1544
  }
1545
+ function convertUint8BufferToPngUri(palette: Uint8Array, icon: Uint8Array): string;
1545
1546
  }
1546
1547
  declare namespace pxt.template {
1547
1548
  const TS_CONFIG = "{\n \"compilerOptions\": {\n \"target\": \"ES5\",\n \"noImplicitAny\": true,\n \"outDir\": \"built\",\n \"rootDir\": \".\"\n },\n \"exclude\": [\"pxt_modules/**/*test.ts\"]\n}\n";
@@ -1794,16 +1795,25 @@ declare namespace pxt {
1794
1795
  function getSectionsFromMarkdownMetadata(text: string): MarkdownSection[];
1795
1796
  }
1796
1797
  declare namespace pxt.multiplayer {
1798
+ const ABSOLUTE_LINKS: {
1799
+ PROD_BETA: string;
1800
+ STAGING_BETA: string;
1801
+ LOCAL: string;
1802
+ };
1803
+ const RELATIVE_LINKS: {
1804
+ PROD: string;
1805
+ BETA: string;
1806
+ };
1797
1807
  const SHORT_LINKS: {
1798
1808
  PROD: string;
1799
1809
  PROD_BETA: string;
1800
1810
  STAGING: string;
1801
1811
  STAGING_BETA: string;
1802
- LOCAL: string;
1803
1812
  };
1813
+ const RELATIVE_LINK: () => string;
1804
1814
  const SHORT_LINK: () => string;
1805
- function makeHostLink(shareUrlOrCode: string): string;
1806
- function makeJoinLink(joinCode: string): string;
1815
+ function makeHostLink(shareUrlOrCode: string, shortLink: boolean): string;
1816
+ function makeJoinLink(joinCode: string, shortLink: boolean): string;
1807
1817
  }
1808
1818
  declare namespace pxt.assets.music {
1809
1819
  interface Instrument {
package/built/pxtlib.js CHANGED
@@ -5530,7 +5530,7 @@ var pxt;
5530
5530
  }
5531
5531
  static createAsync() {
5532
5532
  function openAsync() {
5533
- const idbWrapper = new pxt.BrowserUtils.IDBWrapper(TutorialInfoIndexedDb.dbName(), 3, (ev, r) => {
5533
+ const idbWrapper = new pxt.BrowserUtils.IDBWrapper(TutorialInfoIndexedDb.dbName(), 2, (ev, r) => {
5534
5534
  const db = r.result;
5535
5535
  db.createObjectStore(TutorialInfoIndexedDb.TABLE, { keyPath: TutorialInfoIndexedDb.KEYPATH });
5536
5536
  }, () => {
@@ -12021,6 +12021,24 @@ var pxt;
12021
12021
  }
12022
12022
  }
12023
12023
  pxt.ImageConverter = ImageConverter;
12024
+ function convertUint8BufferToPngUri(palette, icon) {
12025
+ const imgConv = new pxt.ImageConverter();
12026
+ const paletteAsTripletArray = [];
12027
+ for (let i = 0; i < 16; i++) {
12028
+ paletteAsTripletArray.push([
12029
+ palette[i * 3 + 2],
12030
+ palette[i * 3 + 1],
12031
+ palette[i * 3 + 0],
12032
+ 255,
12033
+ ]);
12034
+ }
12035
+ imgConv.setPalette(paletteAsTripletArray);
12036
+ const stringifiedRefBuffer = String.fromCharCode.apply(null, icon);
12037
+ const jresFormattedIconBuffer = `data:image/x-mkcd-f4;base64,${btoa(stringifiedRefBuffer)}`;
12038
+ const iconPngDataUri = imgConv.convert(jresFormattedIconBuffer);
12039
+ return iconPngDataUri;
12040
+ }
12041
+ pxt.convertUint8BufferToPngUri = convertUint8BufferToPngUri;
12024
12042
  })(pxt || (pxt = {}));
12025
12043
  var pxt;
12026
12044
  (function (pxt) {
@@ -13846,12 +13864,38 @@ var pxt;
13846
13864
  MultiplayerDevBackendType[MultiplayerDevBackendType["LOCAL"] = 2] = "LOCAL";
13847
13865
  })(MultiplayerDevBackendType || (MultiplayerDevBackendType = {}));
13848
13866
  let MULTIPLAYER_DEV_BACKEND_TYPE = MultiplayerDevBackendType.STAGING;
13867
+ multiplayer.ABSOLUTE_LINKS = {
13868
+ PROD_BETA: "https://arcade.makecode.com/beta--multiplayer",
13869
+ STAGING_BETA: "https://arcade.staging.pxt.io/beta--multiplayer",
13870
+ LOCAL: "http://localhost:3000",
13871
+ };
13872
+ multiplayer.RELATIVE_LINKS = {
13873
+ PROD: "/--multiplayer",
13874
+ BETA: "/beta--multiplayer",
13875
+ };
13849
13876
  multiplayer.SHORT_LINKS = {
13850
13877
  PROD: "https://aka.ms/a9",
13851
13878
  PROD_BETA: "https://aka.ms/a9b",
13852
13879
  STAGING: "https://aka.ms/a9s",
13853
13880
  STAGING_BETA: "https://aka.ms/a9sb",
13854
- LOCAL: "http://localhost:3000"
13881
+ };
13882
+ multiplayer.RELATIVE_LINK = () => {
13883
+ if (pxt.BrowserUtils.isLocalHostDev()) {
13884
+ switch (MULTIPLAYER_DEV_BACKEND_TYPE) {
13885
+ case MultiplayerDevBackendType.PROD:
13886
+ return multiplayer.ABSOLUTE_LINKS.PROD_BETA;
13887
+ case MultiplayerDevBackendType.STAGING:
13888
+ return multiplayer.ABSOLUTE_LINKS.STAGING_BETA;
13889
+ case MultiplayerDevBackendType.LOCAL:
13890
+ return multiplayer.ABSOLUTE_LINKS.LOCAL;
13891
+ }
13892
+ }
13893
+ if (window.location.pathname.startsWith("/beta")) {
13894
+ return multiplayer.RELATIVE_LINKS.BETA;
13895
+ }
13896
+ else {
13897
+ return multiplayer.RELATIVE_LINKS.PROD;
13898
+ }
13855
13899
  };
13856
13900
  multiplayer.SHORT_LINK = () => {
13857
13901
  if (pxt.BrowserUtils.isLocalHostDev()) {
@@ -13861,7 +13905,7 @@ var pxt;
13861
13905
  case MultiplayerDevBackendType.STAGING:
13862
13906
  return multiplayer.SHORT_LINKS.STAGING_BETA;
13863
13907
  case MultiplayerDevBackendType.LOCAL:
13864
- return multiplayer.SHORT_LINKS.LOCAL;
13908
+ return multiplayer.ABSOLUTE_LINKS.LOCAL;
13865
13909
  }
13866
13910
  }
13867
13911
  if (window.location.host.endsWith(".staging.pxt.io")) {
@@ -13879,12 +13923,12 @@ var pxt;
13879
13923
  return multiplayer.SHORT_LINKS.PROD;
13880
13924
  }
13881
13925
  };
13882
- function makeHostLink(shareUrlOrCode) {
13883
- return `${multiplayer.SHORT_LINK()}?host=${encodeURIComponent(shareUrlOrCode)}`;
13926
+ function makeHostLink(shareUrlOrCode, shortLink) {
13927
+ return `${shortLink ? multiplayer.SHORT_LINK() : multiplayer.RELATIVE_LINK()}?host=${encodeURIComponent(shareUrlOrCode)}`;
13884
13928
  }
13885
13929
  multiplayer.makeHostLink = makeHostLink;
13886
- function makeJoinLink(joinCode) {
13887
- return `${multiplayer.SHORT_LINK()}?join=${encodeURIComponent(joinCode)}`;
13930
+ function makeJoinLink(joinCode, shortLink) {
13931
+ return `${shortLink ? multiplayer.SHORT_LINK() : multiplayer.RELATIVE_LINK()}?join=${encodeURIComponent(joinCode)}`;
13888
13932
  }
13889
13933
  multiplayer.makeJoinLink = makeJoinLink;
13890
13934
  })(multiplayer = pxt.multiplayer || (pxt.multiplayer = {}));
@@ -16759,6 +16803,7 @@ var ts;
16759
16803
  fnArgs: compileResult.usedArguments,
16760
16804
  parts: pxtc.computeUsedParts(compileResult, "ignorebuiltin"),
16761
16805
  usedBuiltinParts: pxtc.computeUsedParts(compileResult, "onlybuiltin"),
16806
+ allParts: pxtc.computeUsedParts(compileResult, undefined, true),
16762
16807
  breakpoints: (_a = compileResult.breakpoints) === null || _a === void 0 ? void 0 : _a.map(bp => bp.id),
16763
16808
  };
16764
16809
  }
@@ -19268,6 +19313,7 @@ var pxt;
19268
19313
  return this.nextInternalID++;
19269
19314
  }
19270
19315
  createNewImage(width = 16, height = 16) {
19316
+ this.onChange();
19271
19317
  const id = this.generateNewID("image" /* AssetType.Image */);
19272
19318
  const bitmap = new pxt.sprite.Bitmap(width, height).data();
19273
19319
  const newImage = {
@@ -19281,6 +19327,7 @@ var pxt;
19281
19327
  return this.state.images.add(newImage);
19282
19328
  }
19283
19329
  createNewAnimation(width = 16, height = 16) {
19330
+ this.onChange();
19284
19331
  const id = this.generateNewID("animation" /* AssetType.Animation */);
19285
19332
  const bitmap = new pxt.sprite.Bitmap(width, height).data();
19286
19333
  const newAnimation = {
@@ -19294,6 +19341,7 @@ var pxt;
19294
19341
  return this.state.animations.add(newAnimation);
19295
19342
  }
19296
19343
  createNewAnimationFromData(frames, interval = 500, displayName) {
19344
+ this.onChange();
19297
19345
  const id = this.generateNewID("animation" /* AssetType.Animation */);
19298
19346
  const newAnimation = {
19299
19347
  internalID: this.getNewInternalId(),
package/built/pxtsim.d.ts CHANGED
@@ -339,6 +339,7 @@ declare namespace pxsim {
339
339
  dependencies?: Map<string>;
340
340
  single?: boolean;
341
341
  traceDisabled?: boolean;
342
+ activePlayer?: 1 | 2 | 3 | 4 | undefined;
342
343
  }
343
344
  interface SimulatorInstructionsMessage extends SimulatorMessage {
344
345
  type: "instructions";
@@ -544,6 +545,15 @@ declare namespace pxsim {
544
545
  uri?: string;
545
546
  error?: string;
546
547
  }
548
+ interface SetActivePlayerMessage extends SimulatorMessage {
549
+ type: "setactiveplayer";
550
+ playerNumber: 1 | 2 | 3 | 4 | undefined;
551
+ }
552
+ interface SetSimThemeMessage extends SimulatorMessage {
553
+ type: "setsimthemecolor";
554
+ part: "background-color" | "button-stroke" | "text-color" | "button-fill" | "dpad-fill";
555
+ color: string;
556
+ }
547
557
  function print(delay?: number): void;
548
558
  namespace Embed {
549
559
  let frameid: string;
@@ -1282,6 +1292,7 @@ declare namespace pxsim {
1282
1292
  autofocus?: boolean;
1283
1293
  queryParameters?: string;
1284
1294
  mpRole?: "server" | "client";
1295
+ activePlayer?: 1 | 2 | 3 | 4 | undefined;
1285
1296
  }
1286
1297
  interface HwDebugger {
1287
1298
  postMessage: (msg: pxsim.SimulatorMessage) => void;
package/built/pxtsim.js CHANGED
@@ -6562,7 +6562,8 @@ var pxsim;
6562
6562
  storedState: opts.storedState,
6563
6563
  ipc: opts.ipc,
6564
6564
  single: opts.single,
6565
- dependencies: opts.dependencies
6565
+ dependencies: opts.dependencies,
6566
+ activePlayer: opts.activePlayer,
6566
6567
  };
6567
6568
  this.start();
6568
6569
  }