@uniformdev/canvas 19.181.2 → 19.182.0

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/dist/index.d.mts CHANGED
@@ -26474,6 +26474,11 @@ type WalkNodeTreeOptions<TContext> = {
26474
26474
  * The visitor can use an action to change this value for descendants of the current node.
26475
26475
  */
26476
26476
  initialContext?: TContext;
26477
+ /**
26478
+ * Throws BlockFormatError when attempting to traverse into blocks that have invalid values
26479
+ * When false/unspecified, invalid block values will be ignored and traversal continues through valid data.
26480
+ */
26481
+ throwForInvalidBlockValues?: boolean;
26477
26482
  };
26478
26483
  /** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
26479
26484
  declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | EntryData | Array<NodeLocationReference>, visitor: (info: TreeNodeInfoTypes<TContext>) => void, options?: WalkNodeTreeOptions<TContext>): void;
package/dist/index.d.ts CHANGED
@@ -26474,6 +26474,11 @@ type WalkNodeTreeOptions<TContext> = {
26474
26474
  * The visitor can use an action to change this value for descendants of the current node.
26475
26475
  */
26476
26476
  initialContext?: TContext;
26477
+ /**
26478
+ * Throws BlockFormatError when attempting to traverse into blocks that have invalid values
26479
+ * When false/unspecified, invalid block values will be ignored and traversal continues through valid data.
26480
+ */
26481
+ throwForInvalidBlockValues?: boolean;
26477
26482
  };
26478
26483
  /** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
26479
26484
  declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | EntryData | Array<NodeLocationReference>, visitor: (info: TreeNodeInfoTypes<TContext>) => void, options?: WalkNodeTreeOptions<TContext>): void;
package/dist/index.esm.js CHANGED
@@ -1261,11 +1261,17 @@ function walkNodeTree(node, visitor, options) {
1261
1261
  continue;
1262
1262
  }
1263
1263
  if (!Array.isArray(propObject.value)) {
1264
- throw new BlockFormatError(
1264
+ const error = new BlockFormatError(
1265
1265
  `${getComponentPath(currentQueueEntry.ancestorsAndSelf)}`,
1266
1266
  propKey,
1267
1267
  propObject.value
1268
1268
  );
1269
+ if (options == null ? void 0 : options.throwForInvalidBlockValues) {
1270
+ throw error;
1271
+ } else {
1272
+ console.warn(`Skipped invalid block value: ${error.message}}`);
1273
+ continue;
1274
+ }
1269
1275
  }
1270
1276
  const blocks = (_b = propObject.value) != null ? _b : [];
1271
1277
  for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
@@ -1305,7 +1311,7 @@ function getBlockValue(component, parameterName) {
1305
1311
  var BlockFormatError = class _BlockFormatError extends Error {
1306
1312
  constructor(componentPath, propertyId, blockValue) {
1307
1313
  super(
1308
- `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${typeof blockValue}`
1314
+ `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${blockValue === null ? "null" : typeof blockValue}`
1309
1315
  );
1310
1316
  this.componentPath = componentPath;
1311
1317
  this.propertyId = propertyId;
package/dist/index.js CHANGED
@@ -1416,11 +1416,17 @@ function walkNodeTree(node, visitor, options) {
1416
1416
  continue;
1417
1417
  }
1418
1418
  if (!Array.isArray(propObject.value)) {
1419
- throw new BlockFormatError(
1419
+ const error = new BlockFormatError(
1420
1420
  `${getComponentPath(currentQueueEntry.ancestorsAndSelf)}`,
1421
1421
  propKey,
1422
1422
  propObject.value
1423
1423
  );
1424
+ if (options == null ? void 0 : options.throwForInvalidBlockValues) {
1425
+ throw error;
1426
+ } else {
1427
+ console.warn(`Skipped invalid block value: ${error.message}}`);
1428
+ continue;
1429
+ }
1424
1430
  }
1425
1431
  const blocks = (_b = propObject.value) != null ? _b : [];
1426
1432
  for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
@@ -1460,7 +1466,7 @@ function getBlockValue(component, parameterName) {
1460
1466
  var BlockFormatError = class _BlockFormatError extends Error {
1461
1467
  constructor(componentPath, propertyId, blockValue) {
1462
1468
  super(
1463
- `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${typeof blockValue}`
1469
+ `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${blockValue === null ? "null" : typeof blockValue}`
1464
1470
  );
1465
1471
  this.componentPath = componentPath;
1466
1472
  this.propertyId = propertyId;
package/dist/index.mjs CHANGED
@@ -1261,11 +1261,17 @@ function walkNodeTree(node, visitor, options) {
1261
1261
  continue;
1262
1262
  }
1263
1263
  if (!Array.isArray(propObject.value)) {
1264
- throw new BlockFormatError(
1264
+ const error = new BlockFormatError(
1265
1265
  `${getComponentPath(currentQueueEntry.ancestorsAndSelf)}`,
1266
1266
  propKey,
1267
1267
  propObject.value
1268
1268
  );
1269
+ if (options == null ? void 0 : options.throwForInvalidBlockValues) {
1270
+ throw error;
1271
+ } else {
1272
+ console.warn(`Skipped invalid block value: ${error.message}}`);
1273
+ continue;
1274
+ }
1269
1275
  }
1270
1276
  const blocks = (_b = propObject.value) != null ? _b : [];
1271
1277
  for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
@@ -1305,7 +1311,7 @@ function getBlockValue(component, parameterName) {
1305
1311
  var BlockFormatError = class _BlockFormatError extends Error {
1306
1312
  constructor(componentPath, propertyId, blockValue) {
1307
1313
  super(
1308
- `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${typeof blockValue}`
1314
+ `${componentPath} has an invalid block property value on ${propertyId}. Block values must be arrays of blocks (BlockValue type), but received ${blockValue === null ? "null" : typeof blockValue}`
1309
1315
  );
1310
1316
  this.componentPath = componentPath;
1311
1317
  this.propertyId = propertyId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.181.2",
3
+ "version": "19.182.0",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,9 +38,9 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/assets": "19.181.2",
42
- "@uniformdev/context": "19.181.2",
43
- "@uniformdev/richtext": "19.181.2",
41
+ "@uniformdev/assets": "19.182.0",
42
+ "@uniformdev/context": "19.182.0",
43
+ "@uniformdev/richtext": "19.182.0",
44
44
  "immer": "10.1.1"
45
45
  },
46
46
  "files": [
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "89ffb2d1ab09ac3cb09b3928194352e358ef7f07"
52
+ "gitHead": "138d94ac9eff7221b6357095578380edf30cdb27"
53
53
  }