pxt-core 10.0.9 → 10.0.10

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
@@ -111104,11 +111104,12 @@ var pxt;
111104
111104
  return result;
111105
111105
  }
111106
111106
  sprite_1.resizeTilemap = resizeTilemap;
111107
- function imageLiteralToBitmap(text) {
111107
+ function imageLiteralToBitmap(text, templateLiteral = "img") {
111108
111108
  // Strip the tagged template string business and the whitespace. We don't have to exhaustively
111109
111109
  // replace encoded characters because the compiler will catch any disallowed characters and throw
111110
111110
  // an error before the decompilation happens. 96 is backtick and 9 is tab
111111
111111
  text = text.replace(/[ `]|(?:`)|(?:	)|(?:img)/g, "").trim();
111112
+ text = text.replaceAll(templateLiteral, "");
111112
111113
  text = text.replace(/^["`\(\)]*/, '').replace(/["`\(\)]*$/, '');
111113
111114
  text = text.replace(/
/g, "\n");
111114
111115
  const rows = text.split("\n");
@@ -111270,14 +111271,14 @@ var pxt;
111270
111271
  pxt.sprite.trimTilemapTileset(result);
111271
111272
  }
111272
111273
  sprite_1.updateTilemapReferencesFromResult = updateTilemapReferencesFromResult;
111273
- function imageLiteralPrologue(fileType) {
111274
+ function imageLiteralPrologue(fileType, templateLiteral = "img") {
111274
111275
  let res = '';
111275
111276
  switch (fileType) {
111276
111277
  case "python":
111277
- res = "img(\"\"\"";
111278
+ res = `${templateLiteral}("""`;
111278
111279
  break;
111279
111280
  default:
111280
- res = "img`";
111281
+ res = `${templateLiteral}\``;
111281
111282
  break;
111282
111283
  }
111283
111284
  return res;
@@ -111308,10 +111309,10 @@ var pxt;
111308
111309
  return res;
111309
111310
  }
111310
111311
  sprite_1.imageLiteralFromDimensions = imageLiteralFromDimensions;
111311
- function bitmapToImageLiteral(bitmap, fileType) {
111312
+ function bitmapToImageLiteral(bitmap, fileType, templateLiteral = "img") {
111312
111313
  if (!bitmap || bitmap.height === 0 || bitmap.width === 0)
111313
111314
  return "";
111314
- let res = imageLiteralPrologue(fileType);
111315
+ let res = imageLiteralPrologue(fileType, templateLiteral);
111315
111316
  if (bitmap) {
111316
111317
  const paddingBetweenPixels = (bitmap.width * bitmap.height > 300) ? "" : " ";
111317
111318
  for (let r = 0; r < bitmap.height; r++) {
@@ -114228,6 +114229,9 @@ var pxt;
114228
114229
  opts.jres = this.getJRes();
114229
114230
  const functionOpts = pxt.appTarget.runtime && pxt.appTarget.runtime.functionsOptions;
114230
114231
  opts.allowedArgumentTypes = functionOpts && functionOpts.extraFunctionEditorTypes && functionOpts.extraFunctionEditorTypes.map(info => info.typeName).concat("number", "boolean", "string");
114232
+ for (const dep of this.sortedDeps()) {
114233
+ dep.patchAppTargetPalette();
114234
+ }
114231
114235
  this.patchAppTargetPalette();
114232
114236
  return opts;
114233
114237
  }
@@ -8,6 +8,7 @@ export interface FieldAnimationOptions {
8
8
  disableResize: string;
9
9
  filter?: string;
10
10
  lightMode: boolean;
11
+ taggedTemplate?: string;
11
12
  }
12
13
  export interface ParsedFieldAnimationOptions {
13
14
  initWidth: number;
@@ -15,6 +16,7 @@ export interface ParsedFieldAnimationOptions {
15
16
  disableResize: boolean;
16
17
  filter?: string;
17
18
  lightMode: boolean;
19
+ taggedTemplate?: string;
18
20
  }
19
21
  export declare class FieldAnimationEditor extends FieldAssetEditor<FieldAnimationOptions, ParsedFieldAnimationOptions> {
20
22
  protected frames: string[];
@@ -8,6 +8,7 @@ export interface FieldSpriteEditorOptions {
8
8
  disableResize: string;
9
9
  filter?: string;
10
10
  lightMode: boolean;
11
+ taggedTemplate?: string;
11
12
  }
12
13
  interface ParsedSpriteEditorOptions {
13
14
  initColor: number;
@@ -16,6 +17,7 @@ interface ParsedSpriteEditorOptions {
16
17
  disableResize: boolean;
17
18
  filter?: string;
18
19
  lightMode: boolean;
20
+ taggedTemplate?: string;
19
21
  }
20
22
  export declare class FieldSpriteEditor extends FieldAssetEditor<FieldSpriteEditorOptions, ParsedSpriteEditorOptions> {
21
23
  protected getAssetType(): pxt.AssetType;
@@ -1,13 +1,10 @@
1
1
  import * as Blockly from "blockly";
2
- export declare class ConnectionPreviewer implements Blockly.IConnectionPreviewer {
2
+ export declare class ConnectionPreviewer extends Blockly.InsertionMarkerPreviewer {
3
3
  static CONNECTION_INDICATOR_RADIUS: number;
4
4
  protected connectionLine: SVGLineElement;
5
- protected staticConnectionIndicator: SVGElement;
6
5
  protected draggedConnectionIndicator: SVGElement;
7
6
  protected staticConnection: Blockly.RenderedConnection;
8
7
  previewReplacement(draggedConn: Blockly.RenderedConnection, staticConn: Blockly.RenderedConnection, replacedBlock: Blockly.BlockSvg): void;
9
- previewConnection(draggedConn: Blockly.RenderedConnection, staticConn: Blockly.RenderedConnection): void;
10
8
  hidePreview(): void;
11
- dispose(): void;
12
9
  protected createConnectionIndicator(connection: Blockly.RenderedConnection): SVGElement;
13
10
  }
@@ -1,12 +1,16 @@
1
1
  import * as Blockly from "blockly";
2
2
  export declare class PathObject extends Blockly.zelos.PathObject {
3
+ static CONNECTION_INDICATOR_RADIUS: number;
3
4
  protected svgPathHighlighted: SVGElement;
4
5
  protected hasError: boolean;
5
6
  protected hasDottedOutlineOnHover: boolean;
6
7
  protected mouseOverData: Blockly.browserEvents.Data;
7
8
  protected mouseLeaveData: Blockly.browserEvents.Data;
9
+ protected connectionPointIndicators: WeakMap<Blockly.RenderedConnection, SVGElement>;
8
10
  updateHighlighted(enable: boolean): void;
9
11
  updateSelected(enable: boolean): void;
12
+ addConnectionHighlight(connection: Blockly.RenderedConnection, connectionPath: string, offset: Blockly.utils.Coordinate, rtl: boolean): void;
13
+ removeConnectionHighlight(connection: Blockly.RenderedConnection): void;
10
14
  setHasDottedOutllineOnHover(enabled: boolean): void;
11
15
  setHasError(hasError: boolean): void;
12
16
  isHighlighted(): boolean;
package/built/pxtlib.d.ts CHANGED
@@ -1778,12 +1778,12 @@ declare namespace pxt.sprite {
1778
1778
  function formatByte(value: number, bytes: number): string;
1779
1779
  function resizeBitmap(img: Bitmap, width: number, height: number): Bitmap;
1780
1780
  function resizeTilemap(img: Tilemap, width: number, height: number): Tilemap;
1781
- function imageLiteralToBitmap(text: string): Bitmap;
1781
+ function imageLiteralToBitmap(text: string, templateLiteral?: string): Bitmap;
1782
1782
  function encodeAnimationString(frames: BitmapData[], interval: number): string;
1783
1783
  function addMissingTilemapTilesAndReferences(project: TilemapProject, asset: ProjectTilemap): void;
1784
1784
  function updateTilemapReferencesFromResult(project: TilemapProject, assetResult: ProjectTilemap): void;
1785
1785
  function imageLiteralFromDimensions(width: number, height: number, color: number, fileType: "typescript" | "python"): string;
1786
- function bitmapToImageLiteral(bitmap: Bitmap, fileType: "typescript" | "python"): string;
1786
+ function bitmapToImageLiteral(bitmap: Bitmap, fileType: "typescript" | "python", templateLiteral?: string): string;
1787
1787
  function bitmapEquals(a: pxt.sprite.BitmapData, b: pxt.sprite.BitmapData): boolean;
1788
1788
  function tileWidthToTileScale(tileWidth: number): string;
1789
1789
  function tileScaleToTileWidth(tileScale: string): number;
@@ -1938,7 +1938,7 @@ declare namespace pxt {
1938
1938
  */
1939
1939
  packageLocalizationStringsAsync(lang: string): Promise<Map<string>>;
1940
1940
  bundledStringsForFile(lang: string, filename: string): Map<string>;
1941
- protected patchAppTargetPalette(): void;
1941
+ patchAppTargetPalette(): void;
1942
1942
  }
1943
1943
  class MainPackage extends Package {
1944
1944
  _host: Host;
package/built/pxtlib.js CHANGED
@@ -13418,11 +13418,12 @@ var pxt;
13418
13418
  return result;
13419
13419
  }
13420
13420
  sprite_1.resizeTilemap = resizeTilemap;
13421
- function imageLiteralToBitmap(text) {
13421
+ function imageLiteralToBitmap(text, templateLiteral = "img") {
13422
13422
  // Strip the tagged template string business and the whitespace. We don't have to exhaustively
13423
13423
  // replace encoded characters because the compiler will catch any disallowed characters and throw
13424
13424
  // an error before the decompilation happens. 96 is backtick and 9 is tab
13425
13425
  text = text.replace(/[ `]|(?:&#96;)|(?:&#9;)|(?:img)/g, "").trim();
13426
+ text = text.replaceAll(templateLiteral, "");
13426
13427
  text = text.replace(/^["`\(\)]*/, '').replace(/["`\(\)]*$/, '');
13427
13428
  text = text.replace(/&#10;/g, "\n");
13428
13429
  const rows = text.split("\n");
@@ -13584,14 +13585,14 @@ var pxt;
13584
13585
  pxt.sprite.trimTilemapTileset(result);
13585
13586
  }
13586
13587
  sprite_1.updateTilemapReferencesFromResult = updateTilemapReferencesFromResult;
13587
- function imageLiteralPrologue(fileType) {
13588
+ function imageLiteralPrologue(fileType, templateLiteral = "img") {
13588
13589
  let res = '';
13589
13590
  switch (fileType) {
13590
13591
  case "python":
13591
- res = "img(\"\"\"";
13592
+ res = `${templateLiteral}("""`;
13592
13593
  break;
13593
13594
  default:
13594
- res = "img`";
13595
+ res = `${templateLiteral}\``;
13595
13596
  break;
13596
13597
  }
13597
13598
  return res;
@@ -13622,10 +13623,10 @@ var pxt;
13622
13623
  return res;
13623
13624
  }
13624
13625
  sprite_1.imageLiteralFromDimensions = imageLiteralFromDimensions;
13625
- function bitmapToImageLiteral(bitmap, fileType) {
13626
+ function bitmapToImageLiteral(bitmap, fileType, templateLiteral = "img") {
13626
13627
  if (!bitmap || bitmap.height === 0 || bitmap.width === 0)
13627
13628
  return "";
13628
- let res = imageLiteralPrologue(fileType);
13629
+ let res = imageLiteralPrologue(fileType, templateLiteral);
13629
13630
  if (bitmap) {
13630
13631
  const paddingBetweenPixels = (bitmap.width * bitmap.height > 300) ? "" : " ";
13631
13632
  for (let r = 0; r < bitmap.height; r++) {
@@ -16542,6 +16543,9 @@ var pxt;
16542
16543
  opts.jres = this.getJRes();
16543
16544
  const functionOpts = pxt.appTarget.runtime && pxt.appTarget.runtime.functionsOptions;
16544
16545
  opts.allowedArgumentTypes = functionOpts && functionOpts.extraFunctionEditorTypes && functionOpts.extraFunctionEditorTypes.map(info => info.typeName).concat("number", "boolean", "string");
16546
+ for (const dep of this.sortedDeps()) {
16547
+ dep.patchAppTargetPalette();
16548
+ }
16545
16549
  this.patchAppTargetPalette();
16546
16550
  return opts;
16547
16551
  }