pxt-core 8.6.12 → 8.6.13

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
@@ -103551,9 +103551,9 @@ var pxt;
103551
103551
  ["localEdits"]: {
103552
103552
  value: "localEdits",
103553
103553
  icon: "cloud-saving-b",
103554
- tooltip: lf("Saving project to the cloud..."),
103555
- shortStatus: lf("saving..."),
103556
- longStatus: lf("Saving to cloud..."),
103554
+ tooltip: lf("Project has local changes and will save to cloud soon."),
103555
+ shortStatus: "",
103556
+ longStatus: "",
103557
103557
  indicator: "*"
103558
103558
  },
103559
103559
  };
@@ -114038,7 +114038,8 @@ var pxt;
114038
114038
  mimeType,
114039
114039
  tilemapTile: v.tilemapTile,
114040
114040
  displayName: v.displayName,
114041
- tileset: v.tileset
114041
+ tileset: v.tileset,
114042
+ tags: v.tags
114042
114043
  };
114043
114044
  }
114044
114045
  return allres;
@@ -117731,13 +117732,28 @@ var pxt;
117731
117732
  }
117732
117733
  }
117733
117734
  }
117735
+ clone() {
117736
+ var _a;
117737
+ const clone = new TilemapProject();
117738
+ clone.committedState = cloneSnapshot(this.committedState);
117739
+ clone.state = cloneSnapshot(this.state);
117740
+ clone.gallery = cloneSnapshot(this.gallery);
117741
+ clone.extensionTileSets = (_a = this.extensionTileSets) === null || _a === void 0 ? void 0 : _a.map(t => (Object.assign(Object.assign({}, t), { tileSets: t.tileSets.map(ts => (Object.assign(Object.assign({}, ts), { tiles: ts.tiles.map(tl => cloneAsset(tl)) }))) })));
117742
+ clone.needsRebuild = this.needsRebuild;
117743
+ clone.nextID = this.nextID;
117744
+ clone.nextInternalID = this.nextInternalID;
117745
+ clone.undoStack = this.undoStack.map(u => cloneSnapshotDiff(u));
117746
+ clone.redoStack = this.undoStack.map(r => cloneSnapshotDiff(r));
117747
+ return clone;
117748
+ }
117734
117749
  generateImage(entry, type) {
117735
117750
  return {
117736
117751
  internalID: this.getNewInternalId(),
117737
117752
  type: type,
117738
117753
  id: entry.id,
117739
117754
  meta: {
117740
- displayName: entry.displayName
117755
+ displayName: entry.displayName,
117756
+ tags: entry.tags,
117741
117757
  },
117742
117758
  jresData: entry.data,
117743
117759
  bitmap: pxt.sprite.getBitmapFromJResURL(`data:${pxt.IMAGE_MIME_TYPE};base64,${entry.data}`).data()
@@ -117749,7 +117765,8 @@ var pxt;
117749
117765
  type: "song" /* AssetType.Song */,
117750
117766
  id: entry.id,
117751
117767
  meta: {
117752
- displayName: entry.displayName
117768
+ displayName: entry.displayName,
117769
+ tags: entry.tags
117753
117770
  },
117754
117771
  song: pxt.assets.music.decodeSongFromHex(entry.data)
117755
117772
  };
@@ -117767,7 +117784,8 @@ var pxt;
117767
117784
  internalID: this.getNewInternalId(),
117768
117785
  type: "animation" /* AssetType.Animation */,
117769
117786
  meta: {
117770
- displayName: entry.displayName
117787
+ displayName: entry.displayName,
117788
+ tags: entry.tags
117771
117789
  },
117772
117790
  id: entry.id,
117773
117791
  frames: [],
@@ -117999,27 +118017,51 @@ var pxt;
117999
118017
  }
118000
118018
  }
118001
118019
  pxt.cloneAsset = cloneAsset;
118020
+ function cloneSnapshot(toClone) {
118021
+ return {
118022
+ revision: toClone.revision,
118023
+ tilemaps: toClone.tilemaps.clone(),
118024
+ images: toClone.images.clone(),
118025
+ animations: toClone.animations.clone(),
118026
+ songs: toClone.songs.clone(),
118027
+ tiles: toClone.tiles.clone()
118028
+ };
118029
+ }
118030
+ function cloneSnapshotDiff(toClone) {
118031
+ return Object.assign(Object.assign({}, toClone), { animations: cloneAssetCollectionDiff(toClone.animations), tiles: cloneAssetCollectionDiff(toClone.tiles), images: cloneAssetCollectionDiff(toClone.images), tilemaps: cloneAssetCollectionDiff(toClone.tilemaps), songs: cloneAssetCollectionDiff(toClone.songs) });
118032
+ }
118033
+ function cloneAssetCollectionDiff(toClone) {
118034
+ return Object.assign(Object.assign({}, toClone), { before: toClone.before.map(entry => cloneAsset(entry)), after: toClone.after.map(entry => cloneAsset(entry)) });
118035
+ }
118002
118036
  function addAssetToJRes(asset, allJRes) {
118003
118037
  // Get the last part of the fully qualified name
118004
118038
  const id = asset.id.substr(asset.id.lastIndexOf(".") + 1);
118039
+ const tags = asset.meta.tags;
118005
118040
  switch (asset.type) {
118006
118041
  case "image" /* AssetType.Image */:
118007
118042
  allJRes[id] = asset.jresData;
118008
- if (asset.meta.displayName) {
118009
- allJRes[id] = {
118043
+ if (asset.meta.displayName || (tags === null || tags === void 0 ? void 0 : tags.length)) {
118044
+ const imgJres = {
118010
118045
  data: asset.jresData,
118011
118046
  mimeType: pxt.IMAGE_MIME_TYPE,
118012
- displayName: asset.meta.displayName
118013
118047
  };
118048
+ if (asset.meta.displayName)
118049
+ imgJres.displayName = asset.meta.displayName;
118050
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
118051
+ imgJres.tags = tags;
118052
+ allJRes[id] = imgJres;
118014
118053
  }
118015
118054
  break;
118016
118055
  case "tile" /* AssetType.Tile */:
118017
- allJRes[id] = {
118056
+ const tileJres = {
118018
118057
  data: asset.jresData,
118019
118058
  mimeType: pxt.IMAGE_MIME_TYPE,
118020
118059
  tilemapTile: true,
118021
118060
  displayName: asset.meta.displayName
118022
118061
  };
118062
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
118063
+ tileJres.tags = tags;
118064
+ allJRes[id] = tileJres;
118023
118065
  break;
118024
118066
  case "tilemap" /* AssetType.Tilemap */:
118025
118067
  // we include the full ID for tilemaps
@@ -118030,11 +118072,15 @@ var pxt;
118030
118072
  allJRes[id] = serializeAnimation(asset);
118031
118073
  break;
118032
118074
  case "song" /* AssetType.Song */:
118033
- allJRes[id] = {
118075
+ const songJres = {
118034
118076
  data: pxt.assets.music.encodeSongToHex(asset.song),
118035
118077
  mimeType: pxt.SONG_MIME_TYPE,
118036
- displayName: asset.meta.displayName
118078
+ displayName: asset.meta.displayName,
118079
+ namespace: pxt.sprite.SONG_NAMESPACE + "."
118037
118080
  };
118081
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
118082
+ songJres.tags = tags;
118083
+ allJRes[id] = songJres;
118038
118084
  break;
118039
118085
  }
118040
118086
  }
@@ -118204,13 +118250,17 @@ var pxt;
118204
118250
  };
118205
118251
  }
118206
118252
  function serializeAnimation(asset) {
118207
- return {
118253
+ var _a;
118254
+ const animationJres = {
118208
118255
  namespace: asset.id.substr(0, asset.id.lastIndexOf(".")),
118209
118256
  id: asset.id.substr(asset.id.lastIndexOf(".") + 1),
118210
118257
  mimeType: pxt.ANIMATION_MIME_TYPE,
118211
118258
  data: pxt.sprite.encodeAnimationString(asset.frames, asset.interval),
118212
- displayName: asset.meta.displayName
118259
+ displayName: asset.meta.displayName,
118213
118260
  };
118261
+ if ((_a = asset.meta.tags) === null || _a === void 0 ? void 0 : _a.length)
118262
+ animationJres.tags = asset.meta.tags;
118263
+ return animationJres;
118214
118264
  }
118215
118265
  function decodeAnimation(jres) {
118216
118266
  const hex = atob(jres.data);
@@ -118245,7 +118295,8 @@ var pxt;
118245
118295
  interval,
118246
118296
  frames: decodedFrames,
118247
118297
  meta: {
118248
- displayName: jres.displayName
118298
+ displayName: jres.displayName,
118299
+ tags: jres.tags
118249
118300
  }
118250
118301
  };
118251
118302
  }
@@ -90,6 +90,7 @@ declare namespace pxt.editor {
90
90
  screenshoting?: boolean;
91
91
  extensionsVisible?: boolean;
92
92
  isMultiplayerGame?: boolean;
93
+ onboarding?: boolean;
93
94
  }
94
95
  interface EditorState {
95
96
  filters?: pxt.editor.ProjectFilters;
@@ -314,6 +315,8 @@ declare namespace pxt.editor {
314
315
  startActivity(options: StartActivityOptions): void;
315
316
  showLightbox(): void;
316
317
  hideLightbox(): void;
318
+ showOnboarding(): void;
319
+ hideOnboarding(): void;
317
320
  showKeymap(show: boolean): void;
318
321
  toggleKeymap(): void;
319
322
  showReportAbuse(): void;
package/built/pxtlib.d.ts CHANGED
@@ -2911,6 +2911,7 @@ declare namespace pxt {
2911
2911
  loadTilemapJRes(jres: Map<JRes>, skipDuplicates?: boolean, gallery?: boolean): void;
2912
2912
  loadAssetsJRes(jres: Map<JRes>, gallery?: boolean): void;
2913
2913
  removeInactiveBlockAssets(activeBlockIDs: string[]): void;
2914
+ clone(): TilemapProject;
2914
2915
  protected generateImage(entry: JRes, type: AssetType.Image): ProjectImage;
2915
2916
  protected generateImage(entry: JRes, type: AssetType.Tile): Tile;
2916
2917
  protected generateSong(entry: JRes): Song;
package/built/pxtlib.js CHANGED
@@ -5865,9 +5865,9 @@ var pxt;
5865
5865
  ["localEdits"]: {
5866
5866
  value: "localEdits",
5867
5867
  icon: "cloud-saving-b",
5868
- tooltip: lf("Saving project to the cloud..."),
5869
- shortStatus: lf("saving..."),
5870
- longStatus: lf("Saving to cloud..."),
5868
+ tooltip: lf("Project has local changes and will save to cloud soon."),
5869
+ shortStatus: "",
5870
+ longStatus: "",
5871
5871
  indicator: "*"
5872
5872
  },
5873
5873
  };
@@ -16352,7 +16352,8 @@ var pxt;
16352
16352
  mimeType,
16353
16353
  tilemapTile: v.tilemapTile,
16354
16354
  displayName: v.displayName,
16355
- tileset: v.tileset
16355
+ tileset: v.tileset,
16356
+ tags: v.tags
16356
16357
  };
16357
16358
  }
16358
16359
  return allres;
@@ -20045,13 +20046,28 @@ var pxt;
20045
20046
  }
20046
20047
  }
20047
20048
  }
20049
+ clone() {
20050
+ var _a;
20051
+ const clone = new TilemapProject();
20052
+ clone.committedState = cloneSnapshot(this.committedState);
20053
+ clone.state = cloneSnapshot(this.state);
20054
+ clone.gallery = cloneSnapshot(this.gallery);
20055
+ clone.extensionTileSets = (_a = this.extensionTileSets) === null || _a === void 0 ? void 0 : _a.map(t => (Object.assign(Object.assign({}, t), { tileSets: t.tileSets.map(ts => (Object.assign(Object.assign({}, ts), { tiles: ts.tiles.map(tl => cloneAsset(tl)) }))) })));
20056
+ clone.needsRebuild = this.needsRebuild;
20057
+ clone.nextID = this.nextID;
20058
+ clone.nextInternalID = this.nextInternalID;
20059
+ clone.undoStack = this.undoStack.map(u => cloneSnapshotDiff(u));
20060
+ clone.redoStack = this.undoStack.map(r => cloneSnapshotDiff(r));
20061
+ return clone;
20062
+ }
20048
20063
  generateImage(entry, type) {
20049
20064
  return {
20050
20065
  internalID: this.getNewInternalId(),
20051
20066
  type: type,
20052
20067
  id: entry.id,
20053
20068
  meta: {
20054
- displayName: entry.displayName
20069
+ displayName: entry.displayName,
20070
+ tags: entry.tags,
20055
20071
  },
20056
20072
  jresData: entry.data,
20057
20073
  bitmap: pxt.sprite.getBitmapFromJResURL(`data:${pxt.IMAGE_MIME_TYPE};base64,${entry.data}`).data()
@@ -20063,7 +20079,8 @@ var pxt;
20063
20079
  type: "song" /* AssetType.Song */,
20064
20080
  id: entry.id,
20065
20081
  meta: {
20066
- displayName: entry.displayName
20082
+ displayName: entry.displayName,
20083
+ tags: entry.tags
20067
20084
  },
20068
20085
  song: pxt.assets.music.decodeSongFromHex(entry.data)
20069
20086
  };
@@ -20081,7 +20098,8 @@ var pxt;
20081
20098
  internalID: this.getNewInternalId(),
20082
20099
  type: "animation" /* AssetType.Animation */,
20083
20100
  meta: {
20084
- displayName: entry.displayName
20101
+ displayName: entry.displayName,
20102
+ tags: entry.tags
20085
20103
  },
20086
20104
  id: entry.id,
20087
20105
  frames: [],
@@ -20313,27 +20331,51 @@ var pxt;
20313
20331
  }
20314
20332
  }
20315
20333
  pxt.cloneAsset = cloneAsset;
20334
+ function cloneSnapshot(toClone) {
20335
+ return {
20336
+ revision: toClone.revision,
20337
+ tilemaps: toClone.tilemaps.clone(),
20338
+ images: toClone.images.clone(),
20339
+ animations: toClone.animations.clone(),
20340
+ songs: toClone.songs.clone(),
20341
+ tiles: toClone.tiles.clone()
20342
+ };
20343
+ }
20344
+ function cloneSnapshotDiff(toClone) {
20345
+ return Object.assign(Object.assign({}, toClone), { animations: cloneAssetCollectionDiff(toClone.animations), tiles: cloneAssetCollectionDiff(toClone.tiles), images: cloneAssetCollectionDiff(toClone.images), tilemaps: cloneAssetCollectionDiff(toClone.tilemaps), songs: cloneAssetCollectionDiff(toClone.songs) });
20346
+ }
20347
+ function cloneAssetCollectionDiff(toClone) {
20348
+ return Object.assign(Object.assign({}, toClone), { before: toClone.before.map(entry => cloneAsset(entry)), after: toClone.after.map(entry => cloneAsset(entry)) });
20349
+ }
20316
20350
  function addAssetToJRes(asset, allJRes) {
20317
20351
  // Get the last part of the fully qualified name
20318
20352
  const id = asset.id.substr(asset.id.lastIndexOf(".") + 1);
20353
+ const tags = asset.meta.tags;
20319
20354
  switch (asset.type) {
20320
20355
  case "image" /* AssetType.Image */:
20321
20356
  allJRes[id] = asset.jresData;
20322
- if (asset.meta.displayName) {
20323
- allJRes[id] = {
20357
+ if (asset.meta.displayName || (tags === null || tags === void 0 ? void 0 : tags.length)) {
20358
+ const imgJres = {
20324
20359
  data: asset.jresData,
20325
20360
  mimeType: pxt.IMAGE_MIME_TYPE,
20326
- displayName: asset.meta.displayName
20327
20361
  };
20362
+ if (asset.meta.displayName)
20363
+ imgJres.displayName = asset.meta.displayName;
20364
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
20365
+ imgJres.tags = tags;
20366
+ allJRes[id] = imgJres;
20328
20367
  }
20329
20368
  break;
20330
20369
  case "tile" /* AssetType.Tile */:
20331
- allJRes[id] = {
20370
+ const tileJres = {
20332
20371
  data: asset.jresData,
20333
20372
  mimeType: pxt.IMAGE_MIME_TYPE,
20334
20373
  tilemapTile: true,
20335
20374
  displayName: asset.meta.displayName
20336
20375
  };
20376
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
20377
+ tileJres.tags = tags;
20378
+ allJRes[id] = tileJres;
20337
20379
  break;
20338
20380
  case "tilemap" /* AssetType.Tilemap */:
20339
20381
  // we include the full ID for tilemaps
@@ -20344,11 +20386,15 @@ var pxt;
20344
20386
  allJRes[id] = serializeAnimation(asset);
20345
20387
  break;
20346
20388
  case "song" /* AssetType.Song */:
20347
- allJRes[id] = {
20389
+ const songJres = {
20348
20390
  data: pxt.assets.music.encodeSongToHex(asset.song),
20349
20391
  mimeType: pxt.SONG_MIME_TYPE,
20350
- displayName: asset.meta.displayName
20392
+ displayName: asset.meta.displayName,
20393
+ namespace: pxt.sprite.SONG_NAMESPACE + "."
20351
20394
  };
20395
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
20396
+ songJres.tags = tags;
20397
+ allJRes[id] = songJres;
20352
20398
  break;
20353
20399
  }
20354
20400
  }
@@ -20518,13 +20564,17 @@ var pxt;
20518
20564
  };
20519
20565
  }
20520
20566
  function serializeAnimation(asset) {
20521
- return {
20567
+ var _a;
20568
+ const animationJres = {
20522
20569
  namespace: asset.id.substr(0, asset.id.lastIndexOf(".")),
20523
20570
  id: asset.id.substr(asset.id.lastIndexOf(".") + 1),
20524
20571
  mimeType: pxt.ANIMATION_MIME_TYPE,
20525
20572
  data: pxt.sprite.encodeAnimationString(asset.frames, asset.interval),
20526
- displayName: asset.meta.displayName
20573
+ displayName: asset.meta.displayName,
20527
20574
  };
20575
+ if ((_a = asset.meta.tags) === null || _a === void 0 ? void 0 : _a.length)
20576
+ animationJres.tags = asset.meta.tags;
20577
+ return animationJres;
20528
20578
  }
20529
20579
  function decodeAnimation(jres) {
20530
20580
  const hex = atob(jres.data);
@@ -20559,7 +20609,8 @@ var pxt;
20559
20609
  interval,
20560
20610
  frames: decodedFrames,
20561
20611
  meta: {
20562
- displayName: jres.displayName
20612
+ displayName: jres.displayName,
20613
+ tags: jres.tags
20563
20614
  }
20564
20615
  };
20565
20616
  }