@contentful/experiences-visual-editor-react 3.8.2 → 3.8.3-beta.1

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/renderApp.js CHANGED
@@ -43244,6 +43244,63 @@ const calculateNodeDefaultHeight = ({ blockId, children, value, }) => {
43244
43244
  return EMPTY_CONTAINER_SIZE$1;
43245
43245
  };
43246
43246
 
43247
+ const getDataFromTree = (tree) => {
43248
+ let dataSource = {};
43249
+ let unboundValues = {};
43250
+ const queue = [...tree.root.children];
43251
+ while (queue.length) {
43252
+ const node = queue.shift();
43253
+ if (!node) {
43254
+ continue;
43255
+ }
43256
+ dataSource = { ...dataSource, ...node.data.dataSource };
43257
+ unboundValues = { ...unboundValues, ...node.data.unboundValues };
43258
+ if (node.children.length) {
43259
+ queue.push(...node.children);
43260
+ }
43261
+ }
43262
+ return {
43263
+ dataSource,
43264
+ unboundValues,
43265
+ };
43266
+ };
43267
+ function parseCSSValue(input) {
43268
+ const regex = /^(\d+(\.\d+)?)(px|em|rem)$/;
43269
+ const match = input.match(regex);
43270
+ if (match) {
43271
+ return {
43272
+ value: parseFloat(match[1]),
43273
+ unit: match[3],
43274
+ };
43275
+ }
43276
+ return null;
43277
+ }
43278
+ function getTargetValueInPixels(targetWidthObject) {
43279
+ switch (targetWidthObject.unit) {
43280
+ case 'px':
43281
+ return targetWidthObject.value;
43282
+ case 'em':
43283
+ return targetWidthObject.value * 16;
43284
+ case 'rem':
43285
+ return targetWidthObject.value * 16;
43286
+ default:
43287
+ return targetWidthObject.value;
43288
+ }
43289
+ }
43290
+ /**
43291
+ * Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,
43292
+ * all should be registered via this function.
43293
+ */
43294
+ const createAssemblyDefinition = (definitionId) => {
43295
+ return {
43296
+ id: definitionId,
43297
+ name: 'Component',
43298
+ variables: {},
43299
+ children: true,
43300
+ category: ASSEMBLY_DEFAULT_CATEGORY,
43301
+ };
43302
+ };
43303
+
43247
43304
  function getOptimizedImageUrl(url, width, quality, format) {
43248
43305
  if (url.startsWith('//')) {
43249
43306
  url = 'https:' + url;
@@ -43599,63 +43656,6 @@ function treeVisit(initialNode, onNode) {
43599
43656
  _treeVisit(initialNode, 0, 0);
43600
43657
  }
43601
43658
 
43602
- const getDataFromTree = (tree) => {
43603
- let dataSource = {};
43604
- let unboundValues = {};
43605
- const queue = [...tree.root.children];
43606
- while (queue.length) {
43607
- const node = queue.shift();
43608
- if (!node) {
43609
- continue;
43610
- }
43611
- dataSource = { ...dataSource, ...node.data.dataSource };
43612
- unboundValues = { ...unboundValues, ...node.data.unboundValues };
43613
- if (node.children.length) {
43614
- queue.push(...node.children);
43615
- }
43616
- }
43617
- return {
43618
- dataSource,
43619
- unboundValues,
43620
- };
43621
- };
43622
- function parseCSSValue(input) {
43623
- const regex = /^(\d+(\.\d+)?)(px|em|rem)$/;
43624
- const match = input.match(regex);
43625
- if (match) {
43626
- return {
43627
- value: parseFloat(match[1]),
43628
- unit: match[3],
43629
- };
43630
- }
43631
- return null;
43632
- }
43633
- function getTargetValueInPixels(targetWidthObject) {
43634
- switch (targetWidthObject.unit) {
43635
- case 'px':
43636
- return targetWidthObject.value;
43637
- case 'em':
43638
- return targetWidthObject.value * 16;
43639
- case 'rem':
43640
- return targetWidthObject.value * 16;
43641
- default:
43642
- return targetWidthObject.value;
43643
- }
43644
- }
43645
- /**
43646
- * Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,
43647
- * all should be registered via this function.
43648
- */
43649
- const createAssemblyDefinition = (definitionId) => {
43650
- return {
43651
- id: definitionId,
43652
- name: 'Component',
43653
- variables: {},
43654
- children: true,
43655
- category: ASSEMBLY_DEFAULT_CATEGORY,
43656
- };
43657
- };
43658
-
43659
43659
  class ParseError extends Error {
43660
43660
  constructor(message) {
43661
43661
  super(message);
@@ -50986,9 +50986,9 @@ const checkIsNodeVisible = (node, resolveDesignValue) => {
50986
50986
  // If this is a wrapping pattern/root with no visible children, it is invisible as well
50987
50987
  return node.children.some((childNode) => checkIsNodeVisible(childNode, resolveDesignValue));
50988
50988
  }
50989
- // Check if the current node is visible (`cfVisibility` is enforced on all nodes)
50989
+ // Check if the current node is visible (`cfVisibility` is enforced on all nodes however leaving as optional chaining due to bug discovered [SPA-3298])
50990
50990
  // Check explicitly for false, as `undefined` is treated as `true`. It could become undefined when the breakpoint IDs changed.
50991
- return (resolveDesignValue(node.data.props['cfVisibility'].valuesByBreakpoint) !==
50991
+ return (resolveDesignValue(node.data.props['cfVisibility']?.valuesByBreakpoint) !==
50992
50992
  false);
50993
50993
  };
50994
50994