@contentful/experiences-visual-editor-react 3.8.3-dev-20251010T1235-2d92513.0 → 3.8.3-dev-20251020T1356-dca4ced.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.ts +1 -2
- package/dist/index.js +59 -59
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +59 -59
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EntityStore, InMemoryEntitiesStore } from '@contentful/experiences-core';
|
|
2
|
+
import { Experience, EntityStore, InMemoryEntitiesStore } from '@contentful/experiences-core';
|
|
3
3
|
import { StudioCanvasMode } from '@contentful/experiences-core/constants';
|
|
4
|
-
import { Experience } from '@contentful/experiences-core/types';
|
|
5
4
|
|
|
6
5
|
declare const VisualEditorRoot: ({ experience, inMemoryEntitiesStore, canvasMode, }: {
|
|
7
6
|
experience?: Experience<EntityStore>;
|
package/dist/index.js
CHANGED
|
@@ -1870,6 +1870,63 @@ const calculateNodeDefaultHeight = ({ blockId, children, value, }) => {
|
|
|
1870
1870
|
return EMPTY_CONTAINER_SIZE$1;
|
|
1871
1871
|
};
|
|
1872
1872
|
|
|
1873
|
+
const getDataFromTree = (tree) => {
|
|
1874
|
+
let dataSource = {};
|
|
1875
|
+
let unboundValues = {};
|
|
1876
|
+
const queue = [...tree.root.children];
|
|
1877
|
+
while (queue.length) {
|
|
1878
|
+
const node = queue.shift();
|
|
1879
|
+
if (!node) {
|
|
1880
|
+
continue;
|
|
1881
|
+
}
|
|
1882
|
+
dataSource = { ...dataSource, ...node.data.dataSource };
|
|
1883
|
+
unboundValues = { ...unboundValues, ...node.data.unboundValues };
|
|
1884
|
+
if (node.children.length) {
|
|
1885
|
+
queue.push(...node.children);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
return {
|
|
1889
|
+
dataSource,
|
|
1890
|
+
unboundValues,
|
|
1891
|
+
};
|
|
1892
|
+
};
|
|
1893
|
+
function parseCSSValue(input) {
|
|
1894
|
+
const regex = /^(\d+(\.\d+)?)(px|em|rem)$/;
|
|
1895
|
+
const match = input.match(regex);
|
|
1896
|
+
if (match) {
|
|
1897
|
+
return {
|
|
1898
|
+
value: parseFloat(match[1]),
|
|
1899
|
+
unit: match[3],
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
return null;
|
|
1903
|
+
}
|
|
1904
|
+
function getTargetValueInPixels(targetWidthObject) {
|
|
1905
|
+
switch (targetWidthObject.unit) {
|
|
1906
|
+
case 'px':
|
|
1907
|
+
return targetWidthObject.value;
|
|
1908
|
+
case 'em':
|
|
1909
|
+
return targetWidthObject.value * 16;
|
|
1910
|
+
case 'rem':
|
|
1911
|
+
return targetWidthObject.value * 16;
|
|
1912
|
+
default:
|
|
1913
|
+
return targetWidthObject.value;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,
|
|
1918
|
+
* all should be registered via this function.
|
|
1919
|
+
*/
|
|
1920
|
+
const createAssemblyDefinition = (definitionId) => {
|
|
1921
|
+
return {
|
|
1922
|
+
id: definitionId,
|
|
1923
|
+
name: 'Component',
|
|
1924
|
+
variables: {},
|
|
1925
|
+
children: true,
|
|
1926
|
+
category: ASSEMBLY_DEFAULT_CATEGORY,
|
|
1927
|
+
};
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1873
1930
|
function getOptimizedImageUrl(url, width, quality, format) {
|
|
1874
1931
|
if (url.startsWith('//')) {
|
|
1875
1932
|
url = 'https:' + url;
|
|
@@ -2225,63 +2282,6 @@ function treeVisit(initialNode, onNode) {
|
|
|
2225
2282
|
_treeVisit(initialNode, 0, 0);
|
|
2226
2283
|
}
|
|
2227
2284
|
|
|
2228
|
-
const getDataFromTree = (tree) => {
|
|
2229
|
-
let dataSource = {};
|
|
2230
|
-
let unboundValues = {};
|
|
2231
|
-
const queue = [...tree.root.children];
|
|
2232
|
-
while (queue.length) {
|
|
2233
|
-
const node = queue.shift();
|
|
2234
|
-
if (!node) {
|
|
2235
|
-
continue;
|
|
2236
|
-
}
|
|
2237
|
-
dataSource = { ...dataSource, ...node.data.dataSource };
|
|
2238
|
-
unboundValues = { ...unboundValues, ...node.data.unboundValues };
|
|
2239
|
-
if (node.children.length) {
|
|
2240
|
-
queue.push(...node.children);
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
return {
|
|
2244
|
-
dataSource,
|
|
2245
|
-
unboundValues,
|
|
2246
|
-
};
|
|
2247
|
-
};
|
|
2248
|
-
function parseCSSValue(input) {
|
|
2249
|
-
const regex = /^(\d+(\.\d+)?)(px|em|rem)$/;
|
|
2250
|
-
const match = input.match(regex);
|
|
2251
|
-
if (match) {
|
|
2252
|
-
return {
|
|
2253
|
-
value: parseFloat(match[1]),
|
|
2254
|
-
unit: match[3],
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2257
|
-
return null;
|
|
2258
|
-
}
|
|
2259
|
-
function getTargetValueInPixels(targetWidthObject) {
|
|
2260
|
-
switch (targetWidthObject.unit) {
|
|
2261
|
-
case 'px':
|
|
2262
|
-
return targetWidthObject.value;
|
|
2263
|
-
case 'em':
|
|
2264
|
-
return targetWidthObject.value * 16;
|
|
2265
|
-
case 'rem':
|
|
2266
|
-
return targetWidthObject.value * 16;
|
|
2267
|
-
default:
|
|
2268
|
-
return targetWidthObject.value;
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
/**
|
|
2272
|
-
* Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,
|
|
2273
|
-
* all should be registered via this function.
|
|
2274
|
-
*/
|
|
2275
|
-
const createAssemblyDefinition = (definitionId) => {
|
|
2276
|
-
return {
|
|
2277
|
-
id: definitionId,
|
|
2278
|
-
name: 'Component',
|
|
2279
|
-
variables: {},
|
|
2280
|
-
children: true,
|
|
2281
|
-
category: ASSEMBLY_DEFAULT_CATEGORY,
|
|
2282
|
-
};
|
|
2283
|
-
};
|
|
2284
|
-
|
|
2285
2285
|
class ParseError extends Error {
|
|
2286
2286
|
constructor(message) {
|
|
2287
2287
|
super(message);
|
|
@@ -5040,9 +5040,9 @@ const checkIsNodeVisible = (node, resolveDesignValue) => {
|
|
|
5040
5040
|
// If this is a wrapping pattern/root with no visible children, it is invisible as well
|
|
5041
5041
|
return node.children.some((childNode) => checkIsNodeVisible(childNode, resolveDesignValue));
|
|
5042
5042
|
}
|
|
5043
|
-
// Check if the current node is visible (`cfVisibility` is enforced on all nodes)
|
|
5043
|
+
// Check if the current node is visible (`cfVisibility` is enforced on all nodes however leaving as optional chaining due to bug discovered [SPA-3298])
|
|
5044
5044
|
// Check explicitly for false, as `undefined` is treated as `true`. It could become undefined when the breakpoint IDs changed.
|
|
5045
|
-
return (resolveDesignValue(node.data.props['cfVisibility']
|
|
5045
|
+
return (resolveDesignValue(node.data.props['cfVisibility']?.valuesByBreakpoint) !==
|
|
5046
5046
|
false);
|
|
5047
5047
|
};
|
|
5048
5048
|
|