pxt-core 8.1.10 → 8.1.12

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
@@ -126319,7 +126319,7 @@ ${output}</xml>`;
126319
126319
  const res = mkStmt(attributes.blockId, node);
126320
126320
  res.fields = [];
126321
126321
  const leds = (arg.text || '').replace(/\s+/g, '');
126322
- const nc = (attributes.imageLiteralColumns || 5) * attributes.imageLiteral;
126322
+ const nc = (attributes.imageLiteralColumns || 5) * (attributes.imageLiteral || attributes.gridLiteral);
126323
126323
  const nr = attributes.imageLiteralRows || 5;
126324
126324
  const nleds = nc * nr;
126325
126325
  if (nleds != leds.length) {
@@ -126708,7 +126708,7 @@ ${output}</xml>`;
126708
126708
  }
126709
126709
  attributes.blockId = builtin.blockId;
126710
126710
  }
126711
- if (attributes.imageLiteral) {
126711
+ if (attributes.imageLiteral || attributes.gridLiteral) {
126712
126712
  return getImageLiteralStatement(node, info);
126713
126713
  }
126714
126714
  if (ts.isFunctionLike(info.decl)) {
@@ -127352,7 +127352,7 @@ ${output}</xml>`;
127352
127352
  const api = env.blocks.apis.byQName[info.qName];
127353
127353
  const comp = pxt.blocks.compileInfo(api);
127354
127354
  const totalDecompilableArgs = comp.parameters.length + (comp.thisParameter ? 1 : 0);
127355
- if (attributes.imageLiteral) {
127355
+ if (attributes.imageLiteral || attributes.gridLiteral) {
127356
127356
  // Image literals do not show up in the block string, so it won't be in comp
127357
127357
  if (info.args.length - totalDecompilableArgs > 1) {
127358
127358
  return pxtc.Util.lf("Function call has more arguments than are supported by its block");
@@ -127363,7 +127363,7 @@ ${output}</xml>`;
127363
127363
  }
127364
127364
  const leds = (arg.text || '').replace(/\s+/g, '');
127365
127365
  const nr = attributes.imageLiteralRows || 5;
127366
- const nc = (attributes.imageLiteralColumns || 5) * attributes.imageLiteral;
127366
+ const nc = (attributes.imageLiteralColumns || 5) * (attributes.imageLiteral || attributes.gridLiteral);
127367
127367
  const nleds = nc * nr;
127368
127368
  if (nc * nr != leds.length) {
127369
127369
  return pxtc.Util.lf("Invalid image pattern ({0} expected vs {1} actual)", nleds, leds.length);
@@ -5080,7 +5080,7 @@ var pxt;
5080
5080
  attrs: fn.attributes,
5081
5081
  isExtensionMethod: instance,
5082
5082
  isExpression: fn.retType && fn.retType !== "void",
5083
- imageLiteral: fn.attributes.imageLiteral,
5083
+ imageLiteral: fn.attributes.imageLiteral || fn.attributes.gridLiteral,
5084
5084
  imageLiteralColumns: fn.attributes.imageLiteralColumns,
5085
5085
  imageLiteralRows: fn.attributes.imageLiteralRows,
5086
5086
  hasHandler: pxt.blocks.hasHandler(fn),
@@ -7811,8 +7811,9 @@ var pxt;
7811
7811
  });
7812
7812
  }
7813
7813
  });
7814
- if (fn.attributes.imageLiteral) {
7815
- const columns = (fn.attributes.imageLiteralColumns || 5) * fn.attributes.imageLiteral;
7814
+ const gridTemplateString = fn.attributes.imageLiteral || fn.attributes.gridLiteral;
7815
+ if (gridTemplateString) {
7816
+ const columns = (fn.attributes.imageLiteralColumns || 5) * gridTemplateString;
7816
7817
  const rows = fn.attributes.imageLiteralRows || 5;
7817
7818
  const scale = fn.attributes.imageLiteralScale;
7818
7819
  let ri = block.appendDummyInput();
@@ -7825,7 +7826,7 @@ var pxt;
7825
7826
  block.setInputsInline(true);
7826
7827
  }
7827
7828
  else {
7828
- block.setInputsInline(!fn.parameters || (fn.parameters.length < 4 && !fn.attributes.imageLiteral));
7829
+ block.setInputsInline(!fn.parameters || (fn.parameters.length < 4 && !gridTemplateString));
7829
7830
  }
7830
7831
  const body = (_a = fn.parameters) === null || _a === void 0 ? void 0 : _a.find(pr => pxtc.parameterTypeIsArrowFunction(pr));
7831
7832
  if (body || hasHandler) {
@@ -1518,7 +1518,7 @@ var pxt;
1518
1518
  attrs: fn.attributes,
1519
1519
  isExtensionMethod: instance,
1520
1520
  isExpression: fn.retType && fn.retType !== "void",
1521
- imageLiteral: fn.attributes.imageLiteral,
1521
+ imageLiteral: fn.attributes.imageLiteral || fn.attributes.gridLiteral,
1522
1522
  imageLiteralColumns: fn.attributes.imageLiteralColumns,
1523
1523
  imageLiteralRows: fn.attributes.imageLiteralRows,
1524
1524
  hasHandler: pxt.blocks.hasHandler(fn),
@@ -4249,8 +4249,9 @@ var pxt;
4249
4249
  });
4250
4250
  }
4251
4251
  });
4252
- if (fn.attributes.imageLiteral) {
4253
- const columns = (fn.attributes.imageLiteralColumns || 5) * fn.attributes.imageLiteral;
4252
+ const gridTemplateString = fn.attributes.imageLiteral || fn.attributes.gridLiteral;
4253
+ if (gridTemplateString) {
4254
+ const columns = (fn.attributes.imageLiteralColumns || 5) * gridTemplateString;
4254
4255
  const rows = fn.attributes.imageLiteralRows || 5;
4255
4256
  const scale = fn.attributes.imageLiteralScale;
4256
4257
  let ri = block.appendDummyInput();
@@ -4263,7 +4264,7 @@ var pxt;
4263
4264
  block.setInputsInline(true);
4264
4265
  }
4265
4266
  else {
4266
- block.setInputsInline(!fn.parameters || (fn.parameters.length < 4 && !fn.attributes.imageLiteral));
4267
+ block.setInputsInline(!fn.parameters || (fn.parameters.length < 4 && !gridTemplateString));
4267
4268
  }
4268
4269
  const body = (_a = fn.parameters) === null || _a === void 0 ? void 0 : _a.find(pr => pxtc.parameterTypeIsArrowFunction(pr));
4269
4270
  if (body || hasHandler) {
@@ -5256,7 +5256,7 @@ ${output}</xml>`;
5256
5256
  const res = mkStmt(attributes.blockId, node);
5257
5257
  res.fields = [];
5258
5258
  const leds = (arg.text || '').replace(/\s+/g, '');
5259
- const nc = (attributes.imageLiteralColumns || 5) * attributes.imageLiteral;
5259
+ const nc = (attributes.imageLiteralColumns || 5) * (attributes.imageLiteral || attributes.gridLiteral);
5260
5260
  const nr = attributes.imageLiteralRows || 5;
5261
5261
  const nleds = nc * nr;
5262
5262
  if (nleds != leds.length) {
@@ -5645,7 +5645,7 @@ ${output}</xml>`;
5645
5645
  }
5646
5646
  attributes.blockId = builtin.blockId;
5647
5647
  }
5648
- if (attributes.imageLiteral) {
5648
+ if (attributes.imageLiteral || attributes.gridLiteral) {
5649
5649
  return getImageLiteralStatement(node, info);
5650
5650
  }
5651
5651
  if (ts.isFunctionLike(info.decl)) {
@@ -6289,7 +6289,7 @@ ${output}</xml>`;
6289
6289
  const api = env.blocks.apis.byQName[info.qName];
6290
6290
  const comp = pxt.blocks.compileInfo(api);
6291
6291
  const totalDecompilableArgs = comp.parameters.length + (comp.thisParameter ? 1 : 0);
6292
- if (attributes.imageLiteral) {
6292
+ if (attributes.imageLiteral || attributes.gridLiteral) {
6293
6293
  // Image literals do not show up in the block string, so it won't be in comp
6294
6294
  if (info.args.length - totalDecompilableArgs > 1) {
6295
6295
  return pxtc.Util.lf("Function call has more arguments than are supported by its block");
@@ -6300,7 +6300,7 @@ ${output}</xml>`;
6300
6300
  }
6301
6301
  const leds = (arg.text || '').replace(/\s+/g, '');
6302
6302
  const nr = attributes.imageLiteralRows || 5;
6303
- const nc = (attributes.imageLiteralColumns || 5) * attributes.imageLiteral;
6303
+ const nc = (attributes.imageLiteralColumns || 5) * (attributes.imageLiteral || attributes.gridLiteral);
6304
6304
  const nleds = nc * nr;
6305
6305
  if (nc * nr != leds.length) {
6306
6306
  return pxtc.Util.lf("Invalid image pattern ({0} expected vs {1} actual)", nleds, leds.length);