pxt-core 7.5.42 → 7.5.43

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
@@ -113450,7 +113450,7 @@ var ts;
113450
113450
  return r;
113451
113451
  }
113452
113452
  pxtc.emptyExtInfo = emptyExtInfo;
113453
- const numberAttributes = ["weight", "imageLiteral", "topblockWeight"];
113453
+ const numberAttributes = ["weight", "imageLiteral", "topblockWeight", "inlineInputModeLimit"];
113454
113454
  const booleanAttributes = [
113455
113455
  "advanced",
113456
113456
  "handlerStatement",
@@ -10911,7 +10911,13 @@ var pxt;
10911
10911
  const totalOptions = def.parameters.length;
10912
10912
  const buttonDelta = toggle ? totalOptions : 1;
10913
10913
  const variableInlineInputs = info.blocksById[b.type].attributes.inlineInputMode === "variable";
10914
+ const inlineInputModeLimit = info.blocksById[b.type].attributes.inlineInputModeLimit || 4;
10914
10915
  const compileHiddenArguments = info.blocksById[b.type].attributes.compileHiddenArguments;
10916
+ const breakString = info.blocksById[b.type].attributes.expandableArgumentBreaks;
10917
+ let breaks;
10918
+ if (breakString) {
10919
+ breaks = breakString.split(/[;,]/).map(s => parseInt(s));
10920
+ }
10915
10921
  const state = new MutationState(b);
10916
10922
  state.setEventsEnabled(false);
10917
10923
  state.setValue(numVisibleAttr, 0);
@@ -11019,7 +11025,7 @@ var pxt;
11019
11025
  }
11020
11026
  updateButtons();
11021
11027
  if (variableInlineInputs)
11022
- b.setInputsInline(visibleOptions < 4);
11028
+ b.setInputsInline(visibleOptions < inlineInputModeLimit);
11023
11029
  if (!skipRender)
11024
11030
  b.render();
11025
11031
  }
@@ -11066,7 +11072,28 @@ var pxt;
11066
11072
  updateButtons();
11067
11073
  }
11068
11074
  function addDelta(delta) {
11069
- return Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
11075
+ const newValue = Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
11076
+ if (breaks) {
11077
+ if (delta >= 0) {
11078
+ if (newValue === 0)
11079
+ return 0;
11080
+ for (const breakpoint of breaks) {
11081
+ if (breakpoint >= newValue) {
11082
+ return breakpoint;
11083
+ }
11084
+ }
11085
+ return totalOptions;
11086
+ }
11087
+ else {
11088
+ for (let i = 0; i < breaks.length; i++) {
11089
+ if (breaks[i] >= newValue) {
11090
+ return i > 0 ? breaks[i - 1] : 0;
11091
+ }
11092
+ }
11093
+ return breaks[breaks.length - 1];
11094
+ }
11095
+ }
11096
+ return newValue;
11070
11097
  }
11071
11098
  function setInputVisible(input, visible) {
11072
11099
  // If the block isn't rendered, Blockly will crash
@@ -7349,7 +7349,13 @@ var pxt;
7349
7349
  const totalOptions = def.parameters.length;
7350
7350
  const buttonDelta = toggle ? totalOptions : 1;
7351
7351
  const variableInlineInputs = info.blocksById[b.type].attributes.inlineInputMode === "variable";
7352
+ const inlineInputModeLimit = info.blocksById[b.type].attributes.inlineInputModeLimit || 4;
7352
7353
  const compileHiddenArguments = info.blocksById[b.type].attributes.compileHiddenArguments;
7354
+ const breakString = info.blocksById[b.type].attributes.expandableArgumentBreaks;
7355
+ let breaks;
7356
+ if (breakString) {
7357
+ breaks = breakString.split(/[;,]/).map(s => parseInt(s));
7358
+ }
7353
7359
  const state = new MutationState(b);
7354
7360
  state.setEventsEnabled(false);
7355
7361
  state.setValue(numVisibleAttr, 0);
@@ -7457,7 +7463,7 @@ var pxt;
7457
7463
  }
7458
7464
  updateButtons();
7459
7465
  if (variableInlineInputs)
7460
- b.setInputsInline(visibleOptions < 4);
7466
+ b.setInputsInline(visibleOptions < inlineInputModeLimit);
7461
7467
  if (!skipRender)
7462
7468
  b.render();
7463
7469
  }
@@ -7504,7 +7510,28 @@ var pxt;
7504
7510
  updateButtons();
7505
7511
  }
7506
7512
  function addDelta(delta) {
7507
- return Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
7513
+ const newValue = Math.min(Math.max(state.getNumber(numVisibleAttr) + delta, 0), totalOptions);
7514
+ if (breaks) {
7515
+ if (delta >= 0) {
7516
+ if (newValue === 0)
7517
+ return 0;
7518
+ for (const breakpoint of breaks) {
7519
+ if (breakpoint >= newValue) {
7520
+ return breakpoint;
7521
+ }
7522
+ }
7523
+ return totalOptions;
7524
+ }
7525
+ else {
7526
+ for (let i = 0; i < breaks.length; i++) {
7527
+ if (breaks[i] >= newValue) {
7528
+ return i > 0 ? breaks[i - 1] : 0;
7529
+ }
7530
+ }
7531
+ return breaks[breaks.length - 1];
7532
+ }
7533
+ }
7534
+ return newValue;
7508
7535
  }
7509
7536
  function setInputVisible(input, visible) {
7510
7537
  // If the block isn't rendered, Blockly will crash
package/built/pxtlib.js CHANGED
@@ -15764,7 +15764,7 @@ var ts;
15764
15764
  return r;
15765
15765
  }
15766
15766
  pxtc.emptyExtInfo = emptyExtInfo;
15767
- const numberAttributes = ["weight", "imageLiteral", "topblockWeight"];
15767
+ const numberAttributes = ["weight", "imageLiteral", "topblockWeight", "inlineInputModeLimit"];
15768
15768
  const booleanAttributes = [
15769
15769
  "advanced",
15770
15770
  "handlerStatement",