@contentful/experiences-visual-editor-react 1.37.1-dev-20250514T1115-cc6f809.0 → 1.37.1-dev-20250515T1211-cc16b86.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.js +1 -78
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +1 -78
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1063,21 +1063,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
|
|
|
1063
1063
|
return valuesByBreakpoint;
|
|
1064
1064
|
}
|
|
1065
1065
|
};
|
|
1066
|
-
/** Overwrites the default value breakpoint by breakpoint. If a breakpoint
|
|
1067
|
-
* is not overwritten, it will fall back to the default. */
|
|
1068
|
-
const mergeDesignValuesByBreakpoint = (defaultValue, overwriteValue) => {
|
|
1069
|
-
const mergedValuesByBreakpoint = { ...defaultValue.valuesByBreakpoint };
|
|
1070
|
-
for (const [breakpointId, value] of Object.entries(overwriteValue.valuesByBreakpoint)) {
|
|
1071
|
-
if (!isValidBreakpointValue(value)) {
|
|
1072
|
-
continue;
|
|
1073
|
-
}
|
|
1074
|
-
mergedValuesByBreakpoint[breakpointId] = value;
|
|
1075
|
-
}
|
|
1076
|
-
return {
|
|
1077
|
-
type: 'DesignValue',
|
|
1078
|
-
valuesByBreakpoint: mergedValuesByBreakpoint,
|
|
1079
|
-
};
|
|
1080
|
-
};
|
|
1081
1066
|
|
|
1082
1067
|
const CF_DEBUG_KEY$1 = 'cf_debug';
|
|
1083
1068
|
let DebugLogger$1 = class DebugLogger {
|
|
@@ -3074,26 +3059,6 @@ const useTreeStore = create((set, get) => ({
|
|
|
3074
3059
|
reparentChildNode(sourceIndex, destinationIndex, sourceParentId, destinationParentId, state.tree.root);
|
|
3075
3060
|
}));
|
|
3076
3061
|
},
|
|
3077
|
-
// breadth first search
|
|
3078
|
-
findNodeById(nodeId) {
|
|
3079
|
-
if (!nodeId) {
|
|
3080
|
-
return null;
|
|
3081
|
-
}
|
|
3082
|
-
const rootNode = get().tree.root;
|
|
3083
|
-
const visitedNodeIds = [];
|
|
3084
|
-
const queue = [];
|
|
3085
|
-
let currentNode = rootNode;
|
|
3086
|
-
queue.push(currentNode);
|
|
3087
|
-
while (queue.length) {
|
|
3088
|
-
currentNode = queue.shift();
|
|
3089
|
-
visitedNodeIds.push(currentNode.data.id);
|
|
3090
|
-
if (currentNode.data.id === nodeId) {
|
|
3091
|
-
return currentNode;
|
|
3092
|
-
}
|
|
3093
|
-
queue.push(...currentNode.children);
|
|
3094
|
-
}
|
|
3095
|
-
return null;
|
|
3096
|
-
},
|
|
3097
3062
|
}));
|
|
3098
3063
|
const hasBreakpointDiffs = (currentTree, newTree) => {
|
|
3099
3064
|
const currentBreakpoints = currentTree?.root?.data?.breakpoints ?? [];
|
|
@@ -3244,8 +3209,6 @@ const useEditorStore = create((set, get) => ({
|
|
|
3244
3209
|
dataSource: {},
|
|
3245
3210
|
hyperLinkPattern: undefined,
|
|
3246
3211
|
unboundValues: {},
|
|
3247
|
-
isDragging: false,
|
|
3248
|
-
dragItem: '',
|
|
3249
3212
|
selectedNodeId: null,
|
|
3250
3213
|
locale: null,
|
|
3251
3214
|
setHyperLinkPattern: (pattern) => {
|
|
@@ -4639,38 +4602,6 @@ const getUnboundValues = ({ key, fallback, unboundValues, }) => {
|
|
|
4639
4602
|
return get$1(unboundValues, lodashPath, fallback);
|
|
4640
4603
|
};
|
|
4641
4604
|
|
|
4642
|
-
/**
|
|
4643
|
-
* When node is a pattern block, we need to look up for default values of the pattern variables
|
|
4644
|
-
* and merge them with the updated node props.
|
|
4645
|
-
* While loop is making sure that we look up for the updated default values in the parent pattern
|
|
4646
|
-
* component settings as well.
|
|
4647
|
-
*/
|
|
4648
|
-
const maybeMergePatternDefaultDesignValues = ({ variableName, variableMapping, node, findNodeById, }) => {
|
|
4649
|
-
if (node.type === ASSEMBLY_BLOCK_NODE_TYPE) {
|
|
4650
|
-
const patternId = node.data.pattern?.id;
|
|
4651
|
-
const exposedPropertyName = node['exposedPropertyNameToKeyMap'][variableName];
|
|
4652
|
-
if (!exposedPropertyName || !patternId) {
|
|
4653
|
-
return variableMapping.valuesByBreakpoint;
|
|
4654
|
-
}
|
|
4655
|
-
const exposedVariableDefinition = componentRegistry.get(patternId)?.definition.variables[exposedPropertyName];
|
|
4656
|
-
let exposedDefaultValue = exposedVariableDefinition?.defaultValue;
|
|
4657
|
-
let parentPatternNode = findNodeById(node.data.pattern?.nodeId);
|
|
4658
|
-
while (parentPatternNode) {
|
|
4659
|
-
const parentPatternId = parentPatternNode.data.pattern?.id;
|
|
4660
|
-
const nextKey = parentPatternNode['exposedPropertyNameToKeyMap'][exposedPropertyName];
|
|
4661
|
-
if (!parentPatternId || !nextKey) {
|
|
4662
|
-
break;
|
|
4663
|
-
}
|
|
4664
|
-
const parentPatternVariableDefinition = componentRegistry.get(parentPatternId)?.definition.variables[nextKey];
|
|
4665
|
-
exposedDefaultValue = mergeDesignValuesByBreakpoint(parentPatternVariableDefinition?.defaultValue, exposedDefaultValue);
|
|
4666
|
-
parentPatternNode = findNodeById(parentPatternNode.data.pattern?.nodeId);
|
|
4667
|
-
}
|
|
4668
|
-
const mergedDesignValue = mergeDesignValuesByBreakpoint(exposedDefaultValue, variableMapping);
|
|
4669
|
-
return mergedDesignValue.valuesByBreakpoint;
|
|
4670
|
-
}
|
|
4671
|
-
return variableMapping.valuesByBreakpoint;
|
|
4672
|
-
};
|
|
4673
|
-
|
|
4674
4605
|
const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, renderDropzone, definition, options, userIsDragging, requiresDragWrapper, }) => {
|
|
4675
4606
|
const unboundValues = useEditorStore((state) => state.unboundValues);
|
|
4676
4607
|
const hyperlinkPattern = useEditorStore((state) => state.hyperLinkPattern);
|
|
@@ -4679,7 +4610,6 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4679
4610
|
const entityStore = useEntityStore((state) => state.entityStore);
|
|
4680
4611
|
const draggingId = useDraggedItemStore((state) => state.onBeforeCaptureId);
|
|
4681
4612
|
const nodeRect = useDraggedItemStore((state) => state.domRect);
|
|
4682
|
-
const findNodeById = useTreeStore((state) => state.findNodeById);
|
|
4683
4613
|
const isEmptyZone = !node.children.length;
|
|
4684
4614
|
const props = useMemo(() => {
|
|
4685
4615
|
const propsBase = {
|
|
@@ -4703,13 +4633,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4703
4633
|
};
|
|
4704
4634
|
}
|
|
4705
4635
|
if (variableMapping.type === 'DesignValue') {
|
|
4706
|
-
const
|
|
4707
|
-
variableName,
|
|
4708
|
-
variableMapping,
|
|
4709
|
-
node,
|
|
4710
|
-
findNodeById,
|
|
4711
|
-
});
|
|
4712
|
-
const valuesByBreakpoint = resolveDesignValue(value, variableName);
|
|
4636
|
+
const valuesByBreakpoint = resolveDesignValue(variableMapping.valuesByBreakpoint, variableName);
|
|
4713
4637
|
const designValue = variableName === 'cfHeight'
|
|
4714
4638
|
? calculateNodeDefaultHeight({
|
|
4715
4639
|
blockId: node.data.blockId,
|
|
@@ -4800,7 +4724,6 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
4800
4724
|
unboundValues,
|
|
4801
4725
|
entityStore,
|
|
4802
4726
|
renderDropzone,
|
|
4803
|
-
findNodeById,
|
|
4804
4727
|
]);
|
|
4805
4728
|
const cfStyles = useMemo(() => buildCfStyles(props), [props]);
|
|
4806
4729
|
const cfVisibility = props['cfVisibility'];
|