pxt-core 7.4.12 → 7.4.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.
@@ -3606,7 +3606,7 @@ var pxt;
3606
3606
  var pxt;
3607
3607
  (function (pxt) {
3608
3608
  var blocks;
3609
- (function (blocks) {
3609
+ (function (blocks_4) {
3610
3610
  const typeDefaults = {
3611
3611
  "string": {
3612
3612
  field: "TEXT",
@@ -3630,8 +3630,8 @@ var pxt;
3630
3630
  }
3631
3631
  };
3632
3632
  // Add numbers before input names to prevent clashes with the ones added by BlocklyLoader
3633
- blocks.optionalDummyInputPrefix = "0_optional_dummy";
3634
- blocks.optionalInputWithFieldPrefix = "0_optional_field";
3633
+ blocks_4.optionalDummyInputPrefix = "0_optional_dummy";
3634
+ blocks_4.optionalInputWithFieldPrefix = "0_optional_field";
3635
3635
  // Matches arrays
3636
3636
  function isArrayType(type) {
3637
3637
  const arrayTypeRegex = /^(?:Array<(.+)>)|(?:(.+)\[\])|(?:\[.+\])$/;
@@ -3652,7 +3652,7 @@ var pxt;
3652
3652
  return undefined;
3653
3653
  }
3654
3654
  }
3655
- blocks.isArrayType = isArrayType;
3655
+ blocks_4.isArrayType = isArrayType;
3656
3656
  // Matches tuples
3657
3657
  function isTupleType(type) {
3658
3658
  const tupleTypeRegex = /^\[(.+)\]$/;
@@ -3666,7 +3666,7 @@ var pxt;
3666
3666
  return undefined;
3667
3667
  }
3668
3668
  }
3669
- blocks.isTupleType = isTupleType;
3669
+ blocks_4.isTupleType = isTupleType;
3670
3670
  const primitiveTypeRegex = /^(string|number|boolean)$/;
3671
3671
  // list of built-in blocks, should be touched.
3672
3672
  let _builtinBlocks;
@@ -3678,8 +3678,8 @@ var pxt;
3678
3678
  }
3679
3679
  return _builtinBlocks;
3680
3680
  }
3681
- blocks.builtinBlocks = builtinBlocks;
3682
- blocks.buildinBlockStatements = {
3681
+ blocks_4.builtinBlocks = builtinBlocks;
3682
+ blocks_4.buildinBlockStatements = {
3683
3683
  "controls_if": true,
3684
3684
  "controls_for": true,
3685
3685
  "pxt_controls_for": true,
@@ -3698,7 +3698,7 @@ var pxt;
3698
3698
  let b = cachedBlocks[type];
3699
3699
  return b ? b.fn : undefined;
3700
3700
  }
3701
- blocks.blockSymbol = blockSymbol;
3701
+ blocks_4.blockSymbol = blockSymbol;
3702
3702
  function createShadowValue(info, p, shadowId, defaultV) {
3703
3703
  defaultV = defaultV || p.defaultValue;
3704
3704
  shadowId = shadowId || p.shadowBlockId;
@@ -3823,7 +3823,7 @@ var pxt;
3823
3823
  }
3824
3824
  return value;
3825
3825
  }
3826
- blocks.createShadowValue = createShadowValue;
3826
+ blocks_4.createShadowValue = createShadowValue;
3827
3827
  function buildArrayShadow(shadow, blockType, fieldName, fieldValues) {
3828
3828
  const itemCount = fieldValues ? fieldValues.length : 2;
3829
3829
  const mut = document.createElement('mutation');
@@ -3852,7 +3852,7 @@ var pxt;
3852
3852
  headingLabel.setAttribute('web-class', 'blocklyFlyoutHeading');
3853
3853
  return headingLabel;
3854
3854
  }
3855
- blocks.createFlyoutHeadingLabel = createFlyoutHeadingLabel;
3855
+ blocks_4.createFlyoutHeadingLabel = createFlyoutHeadingLabel;
3856
3856
  function createFlyoutGroupLabel(name, icon, labelLineWidth, helpCallback) {
3857
3857
  const groupLabel = createFlyoutLabel(name, undefined, icon);
3858
3858
  groupLabel.setAttribute('web-class', 'blocklyFlyoutGroup');
@@ -3865,7 +3865,7 @@ var pxt;
3865
3865
  }
3866
3866
  return groupLabel;
3867
3867
  }
3868
- blocks.createFlyoutGroupLabel = createFlyoutGroupLabel;
3868
+ blocks_4.createFlyoutGroupLabel = createFlyoutGroupLabel;
3869
3869
  function createFlyoutLabel(name, color, icon, iconClass) {
3870
3870
  // Add the Heading label
3871
3871
  let headingLabel = Blockly.utils.xml.createElement('label');
@@ -3891,7 +3891,7 @@ var pxt;
3891
3891
  button.setAttribute('callbackKey', callbackKey);
3892
3892
  return button;
3893
3893
  }
3894
- blocks.createFlyoutButton = createFlyoutButton;
3894
+ blocks_4.createFlyoutButton = createFlyoutButton;
3895
3895
  function createToolboxBlock(info, fn, comp) {
3896
3896
  //
3897
3897
  // toolbox update
@@ -3960,14 +3960,14 @@ var pxt;
3960
3960
  }
3961
3961
  return block;
3962
3962
  }
3963
- blocks.createToolboxBlock = createToolboxBlock;
3963
+ blocks_4.createToolboxBlock = createToolboxBlock;
3964
3964
  function injectBlocks(blockInfo) {
3965
3965
  cachedBlockInfo = blockInfo;
3966
3966
  Blockly.pxtBlocklyUtils.whitelistDraggableBlockTypes(blockInfo.blocks.filter(fn => fn.attributes.duplicateShadowOnDrag).map(fn => fn.attributes.blockId));
3967
3967
  // inject Blockly with all block definitions
3968
3968
  return blockInfo.blocks
3969
3969
  .map(fn => {
3970
- const comp = blocks.compileInfo(fn);
3970
+ const comp = blocks_4.compileInfo(fn);
3971
3971
  const block = createToolboxBlock(blockInfo, fn, comp);
3972
3972
  if (fn.attributes.blockBuiltin) {
3973
3973
  pxt.Util.assert(!!builtinBlocks()[fn.attributes.blockId]);
@@ -3981,7 +3981,7 @@ var pxt;
3981
3981
  return fn;
3982
3982
  });
3983
3983
  }
3984
- blocks.injectBlocks = injectBlocks;
3984
+ blocks_4.injectBlocks = injectBlocks;
3985
3985
  function injectBlockDefinition(info, fn, comp, blockXml) {
3986
3986
  let id = fn.attributes.blockId;
3987
3987
  if (builtinBlocks()[id]) {
@@ -4102,14 +4102,14 @@ var pxt;
4102
4102
  buildBlockFromDef(fn.attributes._def);
4103
4103
  let hasHandler = false;
4104
4104
  if (fn.attributes.mutate) {
4105
- blocks.addMutation(block, fn, fn.attributes.mutate);
4105
+ blocks_4.addMutation(block, fn, fn.attributes.mutate);
4106
4106
  }
4107
4107
  else if (fn.attributes.defaultInstance) {
4108
- blocks.addMutation(block, fn, blocks.MutatorTypes.DefaultInstanceMutator);
4108
+ blocks_4.addMutation(block, fn, blocks_4.MutatorTypes.DefaultInstanceMutator);
4109
4109
  }
4110
4110
  else if (fn.attributes._expandedDef && fn.attributes.expandableArgumentMode !== "disabled") {
4111
4111
  const shouldToggle = fn.attributes.expandableArgumentMode === "toggle";
4112
- blocks.initExpandableBlock(info, block, fn.attributes._expandedDef, comp, shouldToggle, () => buildBlockFromDef(fn.attributes._expandedDef, true));
4112
+ blocks_4.initExpandableBlock(info, block, fn.attributes._expandedDef, comp, shouldToggle, () => buildBlockFromDef(fn.attributes._expandedDef, true));
4113
4113
  }
4114
4114
  else if (comp.handlerArgs.length) {
4115
4115
  /**
@@ -4119,7 +4119,7 @@ var pxt;
4119
4119
  */
4120
4120
  hasHandler = true;
4121
4121
  if (fn.attributes.optionalVariableArgs) {
4122
- blocks.initVariableArgsBlock(block, comp.handlerArgs);
4122
+ blocks_4.initVariableArgsBlock(block, comp.handlerArgs);
4123
4123
  }
4124
4124
  else if (fn.attributes.draggableParameters) {
4125
4125
  comp.handlerArgs.filter(a => !a.inBlockDef).forEach(arg => {
@@ -4140,7 +4140,7 @@ var pxt;
4140
4140
  }
4141
4141
  }
4142
4142
  // Add mutation to save and restore custom field settings
4143
- blocks.appendMutation(block, {
4143
+ blocks_4.appendMutation(block, {
4144
4144
  mutationToDom: (el) => {
4145
4145
  block.inputList.forEach(input => {
4146
4146
  input.fieldRow.forEach((fieldRow) => {
@@ -4318,7 +4318,7 @@ var pxt;
4318
4318
  blocksInfo: info
4319
4319
  };
4320
4320
  pxt.Util.jsonMergeFrom(options, fn.attributes.paramFieldEditorOptions && fn.attributes.paramFieldEditorOptions[actName] || {});
4321
- fields.push(namedField(blocks.createFieldEditor(customField, defl, options), defName));
4321
+ fields.push(namedField(blocks_4.createFieldEditor(customField, defl, options), defName));
4322
4322
  }
4323
4323
  else
4324
4324
  fields.push(namedField(new Blockly.FieldDropdown(dd), defName));
@@ -4332,7 +4332,7 @@ var pxt;
4332
4332
  blocksInfo: info
4333
4333
  };
4334
4334
  pxt.Util.jsonMergeFrom(options, fn.attributes.paramFieldEditorOptions && fn.attributes.paramFieldEditorOptions[pr.actualName] || {});
4335
- fields.push(namedField(blocks.createFieldEditor(customField, defl, options), pr.definitionName));
4335
+ fields.push(namedField(blocks_4.createFieldEditor(customField, defl, options), pr.definitionName));
4336
4336
  }
4337
4337
  else {
4338
4338
  inputName = defName;
@@ -4358,7 +4358,7 @@ var pxt;
4358
4358
  input.setAlign(Blockly.ALIGN_LEFT);
4359
4359
  }
4360
4360
  else if (expanded) {
4361
- const prefix = hasParameter ? blocks.optionalInputWithFieldPrefix : blocks.optionalDummyInputPrefix;
4361
+ const prefix = hasParameter ? blocks_4.optionalInputWithFieldPrefix : blocks_4.optionalDummyInputPrefix;
4362
4362
  input = block.appendDummyInput(prefix + (anonIndex++));
4363
4363
  }
4364
4364
  else {
@@ -4397,13 +4397,13 @@ var pxt;
4397
4397
  var _a;
4398
4398
  return !!((_a = fn.parameters) === null || _a === void 0 ? void 0 : _a.some(pr => pxtc.parameterTypeIsArrowFunction(pr)));
4399
4399
  }
4400
- blocks.hasArrowFunction = hasArrowFunction;
4400
+ blocks_4.hasArrowFunction = hasArrowFunction;
4401
4401
  function cleanBlocks() {
4402
4402
  pxt.debug('removing all custom blocks');
4403
4403
  for (const b in cachedBlocks)
4404
4404
  removeBlock(cachedBlocks[b].fn);
4405
4405
  }
4406
- blocks.cleanBlocks = cleanBlocks;
4406
+ blocks_4.cleanBlocks = cleanBlocks;
4407
4407
  /**
4408
4408
  * Used by pxtrunner to initialize blocks in the docs
4409
4409
  */
@@ -4411,7 +4411,7 @@ var pxt;
4411
4411
  init();
4412
4412
  injectBlocks(blockInfo);
4413
4413
  }
4414
- blocks.initializeAndInject = initializeAndInject;
4414
+ blocks_4.initializeAndInject = initializeAndInject;
4415
4415
  /**
4416
4416
  * Used by main app to initialize blockly blocks.
4417
4417
  * Blocks are injected separately by called injectBlocks
@@ -4420,7 +4420,7 @@ var pxt;
4420
4420
  init();
4421
4421
  initJresIcons(blockInfo);
4422
4422
  }
4423
- blocks.initialize = initialize;
4423
+ blocks_4.initialize = initialize;
4424
4424
  let blocklyInitialized = false;
4425
4425
  function init() {
4426
4426
  if (blocklyInitialized)
@@ -4430,7 +4430,7 @@ var pxt;
4430
4430
  goog.require('Blockly.Blocks');
4431
4431
  Blockly.FieldCheckbox.CHECK_CHAR = '■';
4432
4432
  Blockly.Constants.ADD_START_HATS = !!pxt.appTarget.appTheme.blockHats;
4433
- blocks.initFieldEditors();
4433
+ blocks_4.initFieldEditors();
4434
4434
  initContextMenu();
4435
4435
  initOnStart();
4436
4436
  initMath();
@@ -4536,7 +4536,7 @@ var pxt;
4536
4536
  if (undeletable)
4537
4537
  block.setDeletable(false);
4538
4538
  let tb = document.getElementById('blocklyToolboxDefinition');
4539
- let xml = tb ? blocks.getFirstChildWithAttr(tb, "block", "type", id) : undefined;
4539
+ let xml = tb ? blocks_4.getFirstChildWithAttr(tb, "block", "type", id) : undefined;
4540
4540
  block.codeCard = {
4541
4541
  header: name,
4542
4542
  name: name,
@@ -4572,7 +4572,7 @@ var pxt;
4572
4572
  setHelpResources(this, id, name, tooltip, url, colour, colourSecondary, colourTertiary);
4573
4573
  };
4574
4574
  }
4575
- blocks.installHelpResources = installHelpResources;
4575
+ blocks_4.installHelpResources = installHelpResources;
4576
4576
  function initLists() {
4577
4577
  const msg = Blockly.Msg;
4578
4578
  // lists_create_with
@@ -4819,7 +4819,7 @@ var pxt;
4819
4819
  }
4820
4820
  };
4821
4821
  }
4822
- blocks.onShowContextMenu = undefined;
4822
+ blocks_4.onShowContextMenu = undefined;
4823
4823
  /**
4824
4824
  * The following patch to blockly is to add the Trash icon on top of the toolbox,
4825
4825
  * the trash icon should only show when a user drags a block that is already in the workspace.
@@ -5018,8 +5018,8 @@ var pxt;
5018
5018
  options.push(screenshotOption);
5019
5019
  }
5020
5020
  // custom options...
5021
- if (blocks.onShowContextMenu)
5022
- blocks.onShowContextMenu(this, options);
5021
+ if (blocks_4.onShowContextMenu)
5022
+ blocks_4.onShowContextMenu(this, options);
5023
5023
  };
5024
5024
  // Get rid of bumping behavior
5025
5025
  Blockly.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN.onchange = function () { };
@@ -5369,8 +5369,8 @@ var pxt;
5369
5369
  const mathModuloDef = pxt.blocks.getBlockDefinition(mathModuloId);
5370
5370
  msg.MATH_MODULO_TITLE = mathModuloDef.block["MATH_MODULO_TITLE"];
5371
5371
  installBuiltinHelpInfo(mathModuloId);
5372
- blocks.initMathOpBlock();
5373
- blocks.initMathRoundBlock();
5372
+ blocks_4.initMathOpBlock();
5373
+ blocks_4.initMathRoundBlock();
5374
5374
  }
5375
5375
  function initVariables() {
5376
5376
  // We only give types to "special" variables like enum members and we don't
@@ -5714,7 +5714,7 @@ var pxt;
5714
5714
  const functionReturnId = "function_return";
5715
5715
  Blockly.Blocks[functionReturnId] = {
5716
5716
  init: function () {
5717
- blocks.initReturnStatement(this);
5717
+ blocks_4.initReturnStatement(this);
5718
5718
  },
5719
5719
  onchange: function (event) {
5720
5720
  const block = this;
@@ -6127,7 +6127,7 @@ var pxt;
6127
6127
  value.appendChild(shadow);
6128
6128
  return block;
6129
6129
  }
6130
- blocks.mkPredicateBlock = mkPredicateBlock;
6130
+ blocks_4.mkPredicateBlock = mkPredicateBlock;
6131
6131
  function mkFieldBlock(type, fieldName, fieldValue, isShadow) {
6132
6132
  const fieldBlock = document.createElement(isShadow ? "shadow" : "block");
6133
6133
  fieldBlock.setAttribute("type", pxt.Util.htmlEscape(type));
@@ -6137,7 +6137,7 @@ var pxt;
6137
6137
  fieldBlock.appendChild(field);
6138
6138
  return fieldBlock;
6139
6139
  }
6140
- blocks.mkFieldBlock = mkFieldBlock;
6140
+ blocks_4.mkFieldBlock = mkFieldBlock;
6141
6141
  function mkReturnStatementBlock() {
6142
6142
  const block = document.createElement("block");
6143
6143
  block.setAttribute("type", "function_return");
@@ -6148,7 +6148,7 @@ var pxt;
6148
6148
  value.appendChild(shadow);
6149
6149
  return block;
6150
6150
  }
6151
- blocks.mkReturnStatementBlock = mkReturnStatementBlock;
6151
+ blocks_4.mkReturnStatementBlock = mkReturnStatementBlock;
6152
6152
  let jresIconCache = {};
6153
6153
  function iconToFieldImage(id) {
6154
6154
  let url = jresIconCache[id];
@@ -6207,7 +6207,7 @@ var pxt;
6207
6207
  && sym.attributes.fixedInstance
6208
6208
  && isSubtype(apis, sym.retType, qName));
6209
6209
  }
6210
- blocks.getFixedInstanceDropdownValues = getFixedInstanceDropdownValues;
6210
+ blocks_4.getFixedInstanceDropdownValues = getFixedInstanceDropdownValues;
6211
6211
  function generateIcons(instanceSymbols) {
6212
6212
  const imgConv = new pxt.ImageConverter();
6213
6213
  instanceSymbols.forEach(v => {
@@ -6216,7 +6216,7 @@ var pxt;
6216
6216
  }
6217
6217
  });
6218
6218
  }
6219
- blocks.generateIcons = generateIcons;
6219
+ blocks_4.generateIcons = generateIcons;
6220
6220
  function getConstantDropdownValues(apis, qName) {
6221
6221
  return pxt.Util.values(apis.byQName).filter(sym => sym.attributes.blockIdentity === qName);
6222
6222
  }
@@ -6260,7 +6260,7 @@ var pxt;
6260
6260
  varField.setValue(model.getId());
6261
6261
  }
6262
6262
  }
6263
- blocks.setVarFieldValue = setVarFieldValue;
6263
+ blocks_4.setVarFieldValue = setVarFieldValue;
6264
6264
  function getBlockData(block) {
6265
6265
  if (!block.data) {
6266
6266
  return {
@@ -6276,21 +6276,52 @@ var pxt;
6276
6276
  }
6277
6277
  return JSON.parse(block.data);
6278
6278
  }
6279
- blocks.getBlockData = getBlockData;
6279
+ blocks_4.getBlockData = getBlockData;
6280
6280
  function setBlockData(block, data) {
6281
6281
  block.data = JSON.stringify(data);
6282
6282
  }
6283
- blocks.setBlockData = setBlockData;
6283
+ blocks_4.setBlockData = setBlockData;
6284
6284
  function setBlockDataForField(block, field, data) {
6285
6285
  const blockData = getBlockData(block);
6286
6286
  blockData.fieldData[field] = data;
6287
6287
  setBlockData(block, blockData);
6288
6288
  }
6289
- blocks.setBlockDataForField = setBlockDataForField;
6289
+ blocks_4.setBlockDataForField = setBlockDataForField;
6290
6290
  function getBlockDataForField(block, field) {
6291
6291
  return getBlockData(block).fieldData[field];
6292
6292
  }
6293
- blocks.getBlockDataForField = getBlockDataForField;
6293
+ blocks_4.getBlockDataForField = getBlockDataForField;
6294
+ class PxtWorkspaceSearch extends WorkspaceSearch {
6295
+ createDom_() {
6296
+ super.createDom_();
6297
+ this.addEvent_(this.workspace_.getInjectionDiv(), "click", this, (e) => {
6298
+ if (!this.htmlDiv_.contains(e.target)) {
6299
+ this.close();
6300
+ }
6301
+ });
6302
+ }
6303
+ highlightSearchGroup_(blocks) {
6304
+ blocks.forEach((block) => {
6305
+ const blockPath = block.pathObject.svgPath;
6306
+ Blockly.utils.dom.addClass(blockPath, 'blockly-ws-search-highlight-pxt');
6307
+ });
6308
+ }
6309
+ unhighlightSearchGroup_(blocks) {
6310
+ blocks.forEach((block) => {
6311
+ const blockPath = block.pathObject.svgPath;
6312
+ Blockly.utils.dom.removeClass(blockPath, 'blockly-ws-search-highlight-pxt');
6313
+ });
6314
+ }
6315
+ open() {
6316
+ super.open();
6317
+ Blockly.utils.dom.addClass(this.workspace_.getInjectionDiv(), 'blockly-ws-searching');
6318
+ }
6319
+ close() {
6320
+ super.close();
6321
+ Blockly.utils.dom.removeClass(this.workspace_.getInjectionDiv(), 'blockly-ws-searching');
6322
+ }
6323
+ }
6324
+ blocks_4.PxtWorkspaceSearch = PxtWorkspaceSearch;
6294
6325
  })(blocks = pxt.blocks || (pxt.blocks = {}));
6295
6326
  })(pxt || (pxt = {}));
6296
6327
  var pxt;
@@ -6786,7 +6817,7 @@ var pxt;
6786
6817
  var pxt;
6787
6818
  (function (pxt) {
6788
6819
  var blocks;
6789
- (function (blocks_4) {
6820
+ (function (blocks_5) {
6790
6821
  let workspace;
6791
6822
  let blocklyDiv;
6792
6823
  let BlockLayout;
@@ -6796,7 +6827,7 @@ var pxt;
6796
6827
  // Shuffle deprecated
6797
6828
  BlockLayout[BlockLayout["Clean"] = 3] = "Clean";
6798
6829
  BlockLayout[BlockLayout["Flow"] = 4] = "Flow";
6799
- })(BlockLayout = blocks_4.BlockLayout || (blocks_4.BlockLayout = {}));
6830
+ })(BlockLayout = blocks_5.BlockLayout || (blocks_5.BlockLayout = {}));
6800
6831
  function initRenderingWorkspace() {
6801
6832
  if (!workspace) {
6802
6833
  blocklyDiv = document.createElement("div");
@@ -6820,7 +6851,7 @@ var pxt;
6820
6851
  pxt.blocks.clearWithoutEvents(workspace);
6821
6852
  return workspace;
6822
6853
  }
6823
- blocks_4.initRenderingWorkspace = initRenderingWorkspace;
6854
+ blocks_5.initRenderingWorkspace = initRenderingWorkspace;
6824
6855
  function cleanRenderingWorkspace() {
6825
6856
  // We re-use the workspace across renders, catch any errors so we know to
6826
6857
  // create a new workspace if there was an error
@@ -6828,7 +6859,7 @@ var pxt;
6828
6859
  workspace.dispose();
6829
6860
  workspace = undefined;
6830
6861
  }
6831
- blocks_4.cleanRenderingWorkspace = cleanRenderingWorkspace;
6862
+ blocks_5.cleanRenderingWorkspace = cleanRenderingWorkspace;
6832
6863
  function renderWorkspace(options = { emPixels: 18, layout: BlockLayout.Align }) {
6833
6864
  const layout = options.splitSvg ? BlockLayout.Align : (options.layout || BlockLayout.Flow);
6834
6865
  switch (layout) {
@@ -6859,7 +6890,7 @@ var pxt;
6859
6890
  ? pxt.blocks.layout.splitSvg(svg, workspace, options.emPixels)
6860
6891
  : svg;
6861
6892
  }
6862
- blocks_4.renderWorkspace = renderWorkspace;
6893
+ blocks_5.renderWorkspace = renderWorkspace;
6863
6894
  function render(blocksXml, options = { emPixels: 18, layout: BlockLayout.Align }) {
6864
6895
  initRenderingWorkspace();
6865
6896
  try {
@@ -6876,7 +6907,7 @@ var pxt;
6876
6907
  cleanRenderingWorkspace();
6877
6908
  }
6878
6909
  }
6879
- blocks_4.render = render;
6910
+ blocks_5.render = render;
6880
6911
  function blocksMetrics(ws) {
6881
6912
  const blocks = ws.getTopBlocks(false);
6882
6913
  if (!blocks.length)
@@ -6898,7 +6929,7 @@ var pxt;
6898
6929
  height: m.b - m.t
6899
6930
  };
6900
6931
  }
6901
- blocks_4.blocksMetrics = blocksMetrics;
6932
+ blocks_5.blocksMetrics = blocksMetrics;
6902
6933
  })(blocks = pxt.blocks || (pxt.blocks = {}));
6903
6934
  })(pxt || (pxt = {}));
6904
6935
  /// <reference path="../localtypings/blockly.d.ts" />
@@ -6906,7 +6937,7 @@ var pxt;
6906
6937
  var pxt;
6907
6938
  (function (pxt) {
6908
6939
  var blocks;
6909
- (function (blocks_5) {
6940
+ (function (blocks_6) {
6910
6941
  function findRootBlocks(xmlDOM, type) {
6911
6942
  let blocks = [];
6912
6943
  for (const child in xmlDOM.children) {
@@ -6931,14 +6962,14 @@ var pxt;
6931
6962
  }
6932
6963
  return blocks;
6933
6964
  }
6934
- blocks_5.findRootBlocks = findRootBlocks;
6965
+ blocks_6.findRootBlocks = findRootBlocks;
6935
6966
  function findRootBlock(xmlDOM, type) {
6936
6967
  let blks = findRootBlocks(xmlDOM, type);
6937
6968
  if (blks.length)
6938
6969
  return blks[0];
6939
6970
  return null;
6940
6971
  }
6941
- blocks_5.findRootBlock = findRootBlock;
6972
+ blocks_6.findRootBlock = findRootBlock;
6942
6973
  })(blocks = pxt.blocks || (pxt.blocks = {}));
6943
6974
  })(pxt || (pxt = {}));
6944
6975
  var pxt;
@@ -10052,7 +10083,8 @@ var pxtblockly;
10052
10083
  }
10053
10084
  // The height of the preview on the block itself
10054
10085
  getPreviewHeight() {
10055
- return this.constants_.FIELD_BORDER_RECT_HEIGHT;
10086
+ var _a;
10087
+ return ((_a = this.getConstants()) === null || _a === void 0 ? void 0 : _a.FIELD_BORDER_RECT_HEIGHT) || 16;
10056
10088
  }
10057
10089
  getDropdownBackgroundColour() {
10058
10090
  if (this.sourceBlock_.parentBlock_) {
@@ -12297,7 +12329,8 @@ var pxtblockly;
12297
12329
  return this.pythonMode ? pxt.Util.lf("<python code>") : this.getValue();
12298
12330
  }
12299
12331
  applyColour() {
12300
- if (this.sourceBlock_ && this.constants_.FULL_BLOCK_FIELDS) {
12332
+ var _a;
12333
+ if (this.sourceBlock_ && ((_a = this.getConstants()) === null || _a === void 0 ? void 0 : _a.FULL_BLOCK_FIELDS)) {
12301
12334
  if (this.borderRect_) {
12302
12335
  this.borderRect_.setAttribute('stroke', this.sourceBlock_.style.colourTertiary);
12303
12336
  }