pxt-core 7.4.26 → 7.4.29

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.
@@ -511,6 +511,52 @@ declare namespace pxtblockly {
511
511
  dropdownCreate(): any;
512
512
  }
513
513
  }
514
+ declare namespace pxtblockly {
515
+ interface FieldTextDropdownOptions extends Blockly.FieldCustomOptions {
516
+ values: any;
517
+ }
518
+ class FieldTextDropdown extends Blockly.FieldTextDropdown implements Blockly.FieldCustom {
519
+ isFieldCustom_: boolean;
520
+ constructor(text: string, options: FieldTextDropdownOptions, opt_validator?: Function);
521
+ }
522
+ }
523
+ declare namespace Blockly {
524
+ interface FieldTextDropdown {
525
+ showDropdown_(): void;
526
+ isTextValid_: boolean;
527
+ }
528
+ }
529
+ declare namespace pxtblockly {
530
+ interface FieldAutoCompleteOptions extends Blockly.FieldCustomOptions {
531
+ key: string;
532
+ }
533
+ class FieldAutoComplete extends Blockly.FieldTextDropdown implements Blockly.FieldCustom {
534
+ isFieldCustom_: boolean;
535
+ protected key: string;
536
+ protected parsedValue: string;
537
+ protected quoteSize_: number;
538
+ protected quoteWidth_: number;
539
+ protected quoteLeftX_: number;
540
+ protected quoteRightX_: number;
541
+ protected quoteY_: number;
542
+ protected quoteLeft_: SVGTextElement;
543
+ protected quoteRight_: SVGTextElement;
544
+ constructor(text: string, options: FieldAutoCompleteOptions, opt_validator?: Function);
545
+ isOptionListDynamic(): boolean;
546
+ getDisplayText_(): string;
547
+ doValueUpdate_(newValue: string): void;
548
+ getValue(): string;
549
+ getOptions(): [string, string][];
550
+ showDropdown_(): void;
551
+ getKey(): string;
552
+ initView(): void;
553
+ updateSize_(): void;
554
+ positionRight(x: number): number;
555
+ positionLeft(x: number): number;
556
+ createSVGArrow_(): void;
557
+ showPromptEditor_(): void;
558
+ }
559
+ }
514
560
  declare namespace pxtblockly {
515
561
  class FieldBreakpoint extends Blockly.FieldNumber implements Blockly.FieldCustom {
516
562
  isFieldCustom_: boolean;
@@ -1193,15 +1239,6 @@ declare namespace pxtblockly {
1193
1239
  constructor(value: string, options?: StyleOptions, opt_validator?: Function);
1194
1240
  }
1195
1241
  }
1196
- declare namespace pxtblockly {
1197
- interface FieldTextDropdownOptions extends Blockly.FieldCustomOptions {
1198
- values: any;
1199
- }
1200
- class FieldTextDropdown extends Blockly.FieldTextDropdown implements Blockly.FieldCustom {
1201
- isFieldCustom_: boolean;
1202
- constructor(text: string, options: FieldTextDropdownOptions, opt_validator?: Function);
1203
- }
1204
- }
1205
1242
  declare namespace pxtblockly {
1206
1243
  class FieldTextInput extends Blockly.FieldTextInput implements Blockly.FieldCustom {
1207
1244
  isFieldCustom_: boolean;
@@ -1431,6 +1468,7 @@ declare namespace pxtblockly {
1431
1468
  function getAllBlocksWithTilesets(ws: Blockly.Workspace): FieldEditorReference<FieldTileset>[];
1432
1469
  function needsTilemapUpgrade(ws: Blockly.Workspace): boolean;
1433
1470
  function upgradeTilemapsInWorkspace(ws: Blockly.Workspace, proj: pxt.TilemapProject): void;
1471
+ function getAllFields<U extends Blockly.Field>(ws: Blockly.Workspace, predicate: (field: Blockly.Field) => boolean): FieldEditorReference<U>[];
1434
1472
  function getAllReferencedTiles(workspace: Blockly.Workspace, excludeBlockID?: string): pxt.Tile[];
1435
1473
  function getTemporaryAssets(workspace: Blockly.Workspace, type: pxt.AssetType): pxt.Asset[];
1436
1474
  }
@@ -2329,6 +2329,7 @@ var pxt;
2329
2329
  registerFieldEditor('protractor', pxtblockly.FieldProtractor);
2330
2330
  registerFieldEditor('position', pxtblockly.FieldPosition);
2331
2331
  registerFieldEditor('melody', pxtblockly.FieldCustomMelody);
2332
+ registerFieldEditor('autocomplete', pxtblockly.FieldAutoComplete);
2332
2333
  }
2333
2334
  blocks.initFieldEditors = initFieldEditors;
2334
2335
  function registerFieldEditor(selector, field, validator) {
@@ -3908,11 +3909,10 @@ var pxt;
3908
3909
  block.appendChild(createShadowValue(info, t, t.shadowBlockId || "variables_get", t.defaultValue || t.definitionName));
3909
3910
  }
3910
3911
  if (fn.parameters) {
3911
- comp.parameters.filter(pr => !pr.isOptional &&
3912
- (primitiveTypeRegex.test(pr.type)
3913
- || primitiveTypeRegex.test(isArrayType(pr.type))
3914
- || pr.shadowBlockId
3915
- || pr.defaultValue))
3912
+ comp.parameters.filter(pr => primitiveTypeRegex.test(pr.type)
3913
+ || primitiveTypeRegex.test(isArrayType(pr.type))
3914
+ || pr.shadowBlockId
3915
+ || pr.defaultValue)
3916
3916
  .forEach(pr => {
3917
3917
  block.appendChild(createShadowValue(info, pr));
3918
3918
  });
@@ -7246,18 +7246,27 @@ var pxt;
7246
7246
  // by BlocklyLoader. The number makes it an invalid JS identifier
7247
7247
  const buttonAddName = "0_add_button";
7248
7248
  const buttonRemName = "0_rem_button";
7249
+ const buttonAddRemName = "0_add_rem_button";
7249
7250
  const numVisibleAttr = "_expanded";
7250
7251
  const inputInitAttr = "_input_init";
7251
7252
  const optionNames = def.parameters.map(p => p.name);
7252
7253
  const totalOptions = def.parameters.length;
7253
7254
  const buttonDelta = toggle ? totalOptions : 1;
7255
+ const variableInlineInputs = info.blocksById[b.type].attributes.inlineInputMode === "variable";
7256
+ const inlineInputModeLimit = info.blocksById[b.type].attributes.inlineInputModeLimit || 4;
7257
+ const breakString = info.blocksById[b.type].attributes.expandableArgumentBreaks;
7258
+ let breaks;
7259
+ if (breakString) {
7260
+ breaks = breakString.split(/[;,]/).map(s => parseInt(s));
7261
+ }
7254
7262
  const state = new MutationState(b);
7255
7263
  state.setEventsEnabled(false);
7256
7264
  state.setValue(numVisibleAttr, 0);
7257
7265
  state.setValue(inputInitAttr, false);
7258
7266
  state.setEventsEnabled(true);
7259
7267
  Blockly.Extensions.apply('inline-svgs', b, false);
7260
- addPlusButton();
7268
+ let updatingInputs = false;
7269
+ let firstRender = true;
7261
7270
  appendMutation(b, {
7262
7271
  mutationToDom: (el) => {
7263
7272
  // The reason we store the inputsInitialized variable separately from visibleOptions
@@ -7272,8 +7281,8 @@ var pxt;
7272
7281
  state.setEventsEnabled(false);
7273
7282
  if (saved.hasAttribute(inputInitAttr) && saved.getAttribute(inputInitAttr) == "true" && !state.getBoolean(inputInitAttr)) {
7274
7283
  state.setValue(inputInitAttr, true);
7275
- initOptionalInputs();
7276
7284
  }
7285
+ initOptionalInputs();
7277
7286
  if (saved.hasAttribute(numVisibleAttr)) {
7278
7287
  const val = parseInt(saved.getAttribute(numVisibleAttr));
7279
7288
  if (!isNaN(val)) {
@@ -7284,6 +7293,7 @@ var pxt;
7284
7293
  }
7285
7294
  else {
7286
7295
  state.setValue(numVisibleAttr, addDelta(delta));
7296
+ updateButtons();
7287
7297
  }
7288
7298
  }
7289
7299
  else {
@@ -7294,14 +7304,18 @@ var pxt;
7294
7304
  state.setEventsEnabled(true);
7295
7305
  }
7296
7306
  });
7297
- // Blockly only lets you hide an input once it is rendered, so we can't
7298
- // hide the inputs in init() or domToMutation(). This will get executed after
7299
- // the block is rendered
7300
- setTimeout(() => {
7301
- if (b.rendered && !b.workspace.isDragging()) {
7307
+ initOptionalInputs();
7308
+ b.render = (opt_bubble) => {
7309
+ if (updatingInputs)
7310
+ return;
7311
+ if (firstRender) {
7312
+ firstRender = false;
7313
+ updatingInputs = true;
7302
7314
  updateShape(0, undefined, true);
7315
+ updatingInputs = false;
7303
7316
  }
7304
- }, 1);
7317
+ Blockly.BlockSvg.prototype.render.call(b, opt_bubble);
7318
+ };
7305
7319
  // Set skipRender to true if the block is still initializing. Otherwise
7306
7320
  // the inputs will render before their shadow blocks are created and
7307
7321
  // leave behind annoying artifacts
@@ -7331,25 +7345,14 @@ var pxt;
7331
7345
  setInputVisible(input, visible);
7332
7346
  if (visible && input.connection && !input.connection.isConnected() && !b.isInsertionMarker()) {
7333
7347
  const param = comp.definitionNameToParam[def.parameters[optIndex].name];
7334
- let shadow = blocks.createShadowValue(info, param);
7335
- if (shadow.tagName.toLowerCase() === "value") {
7336
- // Unwrap the block
7337
- shadow = shadow.firstElementChild;
7338
- }
7339
- Blockly.Events.disable();
7340
- try {
7341
- const nb = Blockly.Xml.domToBlock(shadow, b.workspace);
7342
- if (nb) {
7343
- input.connection.connect(nb.outputConnection);
7344
- }
7345
- }
7346
- catch (e) { }
7347
- Blockly.Events.enable();
7348
+ attachShadowBlock(input, param);
7348
7349
  }
7349
7350
  ++optIndex;
7350
7351
  }
7351
7352
  }
7352
7353
  updateButtons();
7354
+ if (variableInlineInputs)
7355
+ b.setInputsInline(visibleOptions < inlineInputModeLimit);
7353
7356
  if (!skipRender)
7354
7357
  b.render();
7355
7358
  }
@@ -7358,31 +7361,32 @@ var pxt;
7358
7361
  .appendField(new Blockly.FieldImage(uri, 24, 24, alt, () => updateShape(delta), false));
7359
7362
  }
7360
7363
  function updateButtons() {
7364
+ if (updatingInputs)
7365
+ return;
7361
7366
  const visibleOptions = state.getNumber(numVisibleAttr);
7362
7367
  const showPlus = visibleOptions !== totalOptions;
7363
7368
  const showMinus = visibleOptions !== 0;
7364
- const hasMinus = !!b.getInput(buttonRemName);
7365
- const hasPlus = !!b.getInput(buttonAddName);
7366
- if (!showPlus) {
7369
+ if (b.inputList.some(i => i.name === buttonAddName))
7367
7370
  b.removeInput(buttonAddName, true);
7368
- }
7369
- if (!showMinus) {
7371
+ if (b.inputList.some(i => i.name === buttonRemName))
7370
7372
  b.removeInput(buttonRemName, true);
7373
+ if (b.inputList.some(i => i.name === buttonAddRemName))
7374
+ b.removeInput(buttonAddRemName, true);
7375
+ if (showPlus && showMinus) {
7376
+ addPlusAndMinusButtons();
7371
7377
  }
7372
- if (showMinus && !hasMinus) {
7373
- addMinusButton();
7378
+ else if (showPlus) {
7379
+ addPlusButton();
7374
7380
  }
7375
- if (showPlus) {
7376
- // make sure plus button is last in line.
7377
- if (hasPlus && b.inputList.findIndex(el => el.name === buttonAddName) !== b.inputList.length - 1) {
7378
- b.removeInput(buttonAddName, true);
7379
- addPlusButton();
7380
- }
7381
- else if (!hasPlus) {
7382
- addPlusButton();
7383
- }
7381
+ else if (showMinus) {
7382
+ addMinusButton();
7384
7383
  }
7385
7384
  }
7385
+ function addPlusAndMinusButtons() {
7386
+ b.appendDummyInput(buttonAddRemName)
7387
+ .appendField(new Blockly.FieldImage(b.REMOVE_IMAGE_DATAURI, 24, 24, lf("Hide optional arguments"), () => updateShape(-1 * buttonDelta), false))
7388
+ .appendField(new Blockly.FieldImage(b.ADD_IMAGE_DATAURI, 24, 24, lf("Reveal optional arguments"), () => updateShape(buttonDelta), false));
7389
+ }
7386
7390
  function addPlusButton() {
7387
7391
  addButton(buttonAddName, b.ADD_IMAGE_DATAURI, lf("Reveal optional arguments"), buttonDelta);
7388
7392
  }
@@ -7395,16 +7399,48 @@ var pxt;
7395
7399
  updateButtons();
7396
7400
  }
7397
7401
  function addDelta(delta) {
7398
- return Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
7402
+ const newValue = Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
7403
+ if (breaks) {
7404
+ if (delta >= 0) {
7405
+ if (newValue === 0)
7406
+ return 0;
7407
+ for (const breakpoint of breaks) {
7408
+ if (breakpoint >= newValue) {
7409
+ return breakpoint;
7410
+ }
7411
+ }
7412
+ return totalOptions;
7413
+ }
7414
+ else {
7415
+ for (let i = 0; i < breaks.length; i++) {
7416
+ if (breaks[i] >= newValue) {
7417
+ return i > 0 ? breaks[i - 1] : 0;
7418
+ }
7419
+ }
7420
+ return breaks[breaks.length - 1];
7421
+ }
7422
+ }
7423
+ return newValue;
7399
7424
  }
7400
7425
  function setInputVisible(input, visible) {
7401
7426
  // If the block isn't rendered, Blockly will crash
7402
- if (b.rendered) {
7403
- let renderList = input.setVisible(visible);
7404
- renderList.forEach((block) => {
7405
- block.render();
7406
- });
7427
+ input.setVisible(visible);
7428
+ }
7429
+ function attachShadowBlock(input, param) {
7430
+ let shadow = blocks.createShadowValue(info, param);
7431
+ if (shadow.tagName.toLowerCase() === "value") {
7432
+ // Unwrap the block
7433
+ shadow = shadow.firstElementChild;
7434
+ }
7435
+ Blockly.Events.disable();
7436
+ try {
7437
+ const nb = Blockly.Xml.domToBlock(shadow, b.workspace);
7438
+ if (nb) {
7439
+ input.connection.connect(nb.outputConnection);
7440
+ }
7407
7441
  }
7442
+ catch (e) { }
7443
+ Blockly.Events.enable();
7408
7444
  }
7409
7445
  }
7410
7446
  blocks.initExpandableBlock = initExpandableBlock;
@@ -8328,6 +8364,162 @@ var pxtblockly;
8328
8364
  }
8329
8365
  pxtblockly.FieldArgumentVariable = FieldArgumentVariable;
8330
8366
  })(pxtblockly || (pxtblockly = {}));
8367
+ /// <reference path="../../localtypings/pxtblockly.d.ts" />
8368
+ var pxtblockly;
8369
+ (function (pxtblockly) {
8370
+ class FieldTextDropdown extends Blockly.FieldTextDropdown {
8371
+ constructor(text, options, opt_validator) {
8372
+ super(text, options.values, opt_validator);
8373
+ this.isFieldCustom_ = true;
8374
+ }
8375
+ }
8376
+ pxtblockly.FieldTextDropdown = FieldTextDropdown;
8377
+ })(pxtblockly || (pxtblockly = {}));
8378
+ /// <reference path="../../localtypings/pxtblockly.d.ts" />
8379
+ /// <reference path="./field_textdropdown.ts" />
8380
+ var pxtblockly;
8381
+ (function (pxtblockly) {
8382
+ class FieldAutoComplete extends Blockly.FieldTextDropdown {
8383
+ constructor(text, options, opt_validator) {
8384
+ super(text, () => [], opt_validator);
8385
+ this.isFieldCustom_ = true;
8386
+ this.key = options.key;
8387
+ this.isTextValid_ = true;
8388
+ }
8389
+ isOptionListDynamic() {
8390
+ return true;
8391
+ }
8392
+ getDisplayText_() {
8393
+ return this.parsedValue || "";
8394
+ }
8395
+ doValueUpdate_(newValue) {
8396
+ if (newValue === null)
8397
+ return;
8398
+ if (/['"`].*['"`]/.test(newValue)) {
8399
+ this.parsedValue = JSON.parse(newValue);
8400
+ }
8401
+ else {
8402
+ this.parsedValue = newValue;
8403
+ }
8404
+ this.value_ = this.parsedValue;
8405
+ }
8406
+ getValue() {
8407
+ if (this.parsedValue) {
8408
+ return JSON.stringify(this.parsedValue);
8409
+ }
8410
+ else
8411
+ return '""';
8412
+ }
8413
+ getOptions() {
8414
+ var _a;
8415
+ const workspace = (_a = this.sourceBlock_) === null || _a === void 0 ? void 0 : _a.workspace;
8416
+ if (!workspace)
8417
+ return [];
8418
+ const res = [];
8419
+ const fields = pxtblockly.getAllFields(workspace, field => field instanceof FieldAutoComplete && field.getKey() === this.key);
8420
+ const options = fields.map(field => field.ref.getDisplayText_());
8421
+ for (const option of options) {
8422
+ if (!option.trim() || res.some(tuple => tuple[0] === option))
8423
+ continue;
8424
+ res.push([option, option]);
8425
+ }
8426
+ res.sort((a, b) => a[0].localeCompare(b[0]));
8427
+ return res;
8428
+ }
8429
+ showDropdown_() {
8430
+ const options = this.getOptions();
8431
+ if (options.length)
8432
+ super.showDropdown_();
8433
+ }
8434
+ getKey() {
8435
+ if (this.key)
8436
+ return this.key;
8437
+ if (this.sourceBlock_)
8438
+ return this.sourceBlock_.type;
8439
+ return undefined;
8440
+ }
8441
+ // Copied from field_string in pxt-blockly
8442
+ initView() {
8443
+ // Add quotes around the string
8444
+ // Positioned on updatSize, after text size is calculated.
8445
+ this.quoteSize_ = 16;
8446
+ this.quoteWidth_ = 8;
8447
+ this.quoteLeftX_ = 0;
8448
+ this.quoteRightX_ = 0;
8449
+ this.quoteY_ = 10;
8450
+ if (this.quoteLeft_)
8451
+ this.quoteLeft_.parentNode.removeChild(this.quoteLeft_);
8452
+ this.quoteLeft_ = Blockly.utils.dom.createSvgElement('text', {
8453
+ 'font-size': this.quoteSize_ + 'px',
8454
+ 'class': 'field-text-quote'
8455
+ }, this.fieldGroup_);
8456
+ super.initView();
8457
+ if (this.quoteRight_)
8458
+ this.quoteRight_.parentNode.removeChild(this.quoteRight_);
8459
+ this.quoteRight_ = Blockly.utils.dom.createSvgElement('text', {
8460
+ 'font-size': this.quoteSize_ + 'px',
8461
+ 'class': 'field-text-quote'
8462
+ }, this.fieldGroup_);
8463
+ this.quoteLeft_.appendChild(document.createTextNode('"'));
8464
+ this.quoteRight_.appendChild(document.createTextNode('"'));
8465
+ }
8466
+ // Copied from field_string in pxt-blockly
8467
+ updateSize_() {
8468
+ super.updateSize_();
8469
+ const sWidth = Math.max(this.size_.width, 1);
8470
+ const xPadding = 3;
8471
+ let addedWidth = this.positionLeft(sWidth + xPadding);
8472
+ this.textElement_.setAttribute('x', addedWidth.toString());
8473
+ addedWidth += this.positionRight(addedWidth + sWidth + xPadding);
8474
+ this.size_.width = sWidth + addedWidth;
8475
+ }
8476
+ // Copied from field_string in pxt-blockly
8477
+ positionRight(x) {
8478
+ if (!this.quoteRight_) {
8479
+ return 0;
8480
+ }
8481
+ let addedWidth = 0;
8482
+ if (this.sourceBlock_.RTL) {
8483
+ this.quoteRightX_ = Blockly.FieldString.quotePadding;
8484
+ addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
8485
+ }
8486
+ else {
8487
+ this.quoteRightX_ = x + Blockly.FieldString.quotePadding;
8488
+ addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
8489
+ }
8490
+ this.quoteRight_.setAttribute('transform', 'translate(' + this.quoteRightX_ + ',' + this.quoteY_ + ')');
8491
+ return addedWidth;
8492
+ }
8493
+ // Copied from field_string in pxt-blockly
8494
+ positionLeft(x) {
8495
+ if (!this.quoteLeft_) {
8496
+ return 0;
8497
+ }
8498
+ let addedWidth = 0;
8499
+ if (this.sourceBlock_.RTL) {
8500
+ this.quoteLeftX_ = x + this.quoteWidth_ + Blockly.FieldString.quotePadding * 2;
8501
+ addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
8502
+ }
8503
+ else {
8504
+ this.quoteLeftX_ = 0;
8505
+ addedWidth = this.quoteWidth_ + Blockly.FieldString.quotePadding;
8506
+ }
8507
+ this.quoteLeft_.setAttribute('transform', 'translate(' + this.quoteLeftX_ + ',' + this.quoteY_ + ')');
8508
+ return addedWidth;
8509
+ }
8510
+ createSVGArrow_() {
8511
+ // This creates the little arrow for dropdown fields. Intentionally
8512
+ // do nothing
8513
+ }
8514
+ showPromptEditor_() {
8515
+ Blockly.prompt(Blockly.Msg['CHANGE_VALUE_TITLE'], this.parsedValue, (newValue) => {
8516
+ this.setValue(this.getValueFromEditorText_(newValue));
8517
+ this.forceRerender();
8518
+ });
8519
+ }
8520
+ }
8521
+ pxtblockly.FieldAutoComplete = FieldAutoComplete;
8522
+ })(pxtblockly || (pxtblockly = {}));
8331
8523
  /// <reference path="../../localtypings/blockly.d.ts" />
8332
8524
  /// <reference path="../../built/pxtsim.d.ts" />
8333
8525
  var pxtblockly;
@@ -11670,17 +11862,6 @@ var pxtblockly;
11670
11862
  })(pxtblockly || (pxtblockly = {}));
11671
11863
  /// <reference path="../../localtypings/pxtblockly.d.ts" />
11672
11864
  var pxtblockly;
11673
- (function (pxtblockly) {
11674
- class FieldTextDropdown extends Blockly.FieldTextDropdown {
11675
- constructor(text, options, opt_validator) {
11676
- super(text, options.values, opt_validator);
11677
- this.isFieldCustom_ = true;
11678
- }
11679
- }
11680
- pxtblockly.FieldTextDropdown = FieldTextDropdown;
11681
- })(pxtblockly || (pxtblockly = {}));
11682
- /// <reference path="../../localtypings/pxtblockly.d.ts" />
11683
- var pxtblockly;
11684
11865
  (function (pxtblockly) {
11685
11866
  class FieldTextInput extends Blockly.FieldTextInput {
11686
11867
  constructor(value, options, opt_validator) {
@@ -12792,11 +12973,11 @@ var pxtblockly;
12792
12973
  }
12793
12974
  }
12794
12975
  function getAllBlocksWithTilemaps(ws) {
12795
- return getAllFieldsCore(ws, f => f instanceof pxtblockly.FieldTilemap && !f.isGreyBlock);
12976
+ return getAllFields(ws, f => f instanceof pxtblockly.FieldTilemap && !f.isGreyBlock);
12796
12977
  }
12797
12978
  pxtblockly.getAllBlocksWithTilemaps = getAllBlocksWithTilemaps;
12798
12979
  function getAllBlocksWithTilesets(ws) {
12799
- return getAllFieldsCore(ws, f => f instanceof pxtblockly.FieldTileset);
12980
+ return getAllFields(ws, f => f instanceof pxtblockly.FieldTileset);
12800
12981
  }
12801
12982
  pxtblockly.getAllBlocksWithTilesets = getAllBlocksWithTilesets;
12802
12983
  function needsTilemapUpgrade(ws) {
@@ -12852,7 +13033,7 @@ var pxtblockly;
12852
13033
  }
12853
13034
  }
12854
13035
  pxtblockly.upgradeTilemapsInWorkspace = upgradeTilemapsInWorkspace;
12855
- function getAllFieldsCore(ws, predicate) {
13036
+ function getAllFields(ws, predicate) {
12856
13037
  const result = [];
12857
13038
  const top = ws.getTopBlocks(false);
12858
13039
  top.forEach(block => getAllFieldsRecursive(block));
@@ -12873,6 +13054,7 @@ var pxtblockly;
12873
13054
  }
12874
13055
  }
12875
13056
  }
13057
+ pxtblockly.getAllFields = getAllFields;
12876
13058
  function getAllReferencedTiles(workspace, excludeBlockID) {
12877
13059
  var _a;
12878
13060
  let all = {};
@@ -12911,10 +13093,10 @@ var pxtblockly;
12911
13093
  function getTemporaryAssets(workspace, type) {
12912
13094
  switch (type) {
12913
13095
  case "image" /* Image */:
12914
- return getAllFieldsCore(workspace, field => field instanceof pxtblockly.FieldSpriteEditor && field.isTemporaryAsset())
13096
+ return getAllFields(workspace, field => field instanceof pxtblockly.FieldSpriteEditor && field.isTemporaryAsset())
12915
13097
  .map(f => f.ref.getAsset());
12916
13098
  case "animation" /* Animation */:
12917
- return getAllFieldsCore(workspace, field => field instanceof pxtblockly.FieldAnimationEditor && field.isTemporaryAsset())
13099
+ return getAllFields(workspace, field => field instanceof pxtblockly.FieldAnimationEditor && field.isTemporaryAsset())
12918
13100
  .map(f => f.ref.getAsset());
12919
13101
  default: return [];
12920
13102
  }
@@ -18375,6 +18375,7 @@ var ts;
18375
18375
  let snippet;
18376
18376
  if (preDefinedSnippet) {
18377
18377
  snippet = [preDefinedSnippet];
18378
+ snippetPrefix = undefined;
18378
18379
  }
18379
18380
  else {
18380
18381
  snippet = [fnName];
@@ -1048,8 +1048,8 @@ var pxt;
1048
1048
  let proj;
1049
1049
  let id;
1050
1050
  if (name) {
1051
- let id = ts.pxtc.escapeIdentifier(name);
1052
- proj = project.getTilemap(id);
1051
+ id = ts.pxtc.escapeIdentifier(name);
1052
+ proj = project.getTilemap(id) || project.lookupAssetByName("tilemap" /* Tilemap */, name);
1053
1053
  }
1054
1054
  if (!proj) {
1055
1055
  let tileWidth = 16;
package/built/pxtlib.js CHANGED
@@ -15791,7 +15791,7 @@ var ts;
15791
15791
  return r;
15792
15792
  }
15793
15793
  pxtc.emptyExtInfo = emptyExtInfo;
15794
- const numberAttributes = ["weight", "imageLiteral", "topblockWeight"];
15794
+ const numberAttributes = ["weight", "imageLiteral", "topblockWeight", "inlineInputModeLimit"];
15795
15795
  const booleanAttributes = [
15796
15796
  "advanced",
15797
15797
  "handlerStatement",
@@ -17842,7 +17842,7 @@ var pxt;
17842
17842
  id,
17843
17843
  type: "tilemap" /* Tilemap */,
17844
17844
  meta: {
17845
- displayName: id
17845
+ displayName: name || id
17846
17846
  },
17847
17847
  data: data
17848
17848
  });