@contentful/experiences-visual-editor-react 0.0.1-dev-20240307T2018-aadea9e.0 → 0.0.1-dev-20240307T2139-e68f560.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 +12 -49
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +12 -49
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -34370,16 +34370,6 @@ const INCOMING_EVENTS$1 = {
|
|
|
34370
34370
|
SelectComponent: 'selectComponent',
|
|
34371
34371
|
HoverComponent: 'hoverComponent',
|
|
34372
34372
|
UpdatedEntity: 'updatedEntity',
|
|
34373
|
-
/**
|
|
34374
|
-
* @deprecated use `AssembliesAdded` instead. This will be removed in version 5.
|
|
34375
|
-
* In the meanwhile, the experience builder will send the old and the new event to support multiple SDK versions.
|
|
34376
|
-
*/
|
|
34377
|
-
DesignComponentsAdded: 'designComponentsAdded',
|
|
34378
|
-
/**
|
|
34379
|
-
* @deprecated use `AssembliesRegistered` instead. This will be removed in version 5.
|
|
34380
|
-
* In the meanwhile, the experience builder will send the old and the new event to support multiple SDK versions.
|
|
34381
|
-
*/
|
|
34382
|
-
DesignComponentsRegistered: 'designComponentsRegistered',
|
|
34383
34373
|
AssembliesAdded: 'assembliesAdded',
|
|
34384
34374
|
AssembliesRegistered: 'assembliesRegistered',
|
|
34385
34375
|
InitEditor: 'initEditor',
|
|
@@ -46213,16 +46203,6 @@ const INCOMING_EVENTS = {
|
|
|
46213
46203
|
SelectComponent: 'selectComponent',
|
|
46214
46204
|
HoverComponent: 'hoverComponent',
|
|
46215
46205
|
UpdatedEntity: 'updatedEntity',
|
|
46216
|
-
/**
|
|
46217
|
-
* @deprecated use `AssembliesAdded` instead. This will be removed in version 5.
|
|
46218
|
-
* In the meanwhile, the experience builder will send the old and the new event to support multiple SDK versions.
|
|
46219
|
-
*/
|
|
46220
|
-
DesignComponentsAdded: 'designComponentsAdded',
|
|
46221
|
-
/**
|
|
46222
|
-
* @deprecated use `AssembliesRegistered` instead. This will be removed in version 5.
|
|
46223
|
-
* In the meanwhile, the experience builder will send the old and the new event to support multiple SDK versions.
|
|
46224
|
-
*/
|
|
46225
|
-
DesignComponentsRegistered: 'designComponentsRegistered',
|
|
46226
46206
|
AssembliesAdded: 'assembliesAdded',
|
|
46227
46207
|
AssembliesRegistered: 'assembliesRegistered',
|
|
46228
46208
|
InitEditor: 'initEditor',
|
|
@@ -46278,15 +46258,6 @@ const ASSEMBLY_NODE_TYPE = 'assembly';
|
|
|
46278
46258
|
const ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';
|
|
46279
46259
|
const ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';
|
|
46280
46260
|
const ASSEMBLY_NODE_TYPES = [ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE];
|
|
46281
|
-
/** @deprecated use `ASSEMBLY_NODE_TYPE` instead. This will be removed in version 5. */
|
|
46282
|
-
const DESIGN_COMPONENT_NODE_TYPE = 'designComponent';
|
|
46283
|
-
/** @deprecated use `ASSEMBLY_BLOCK_NODE_TYPE` instead. This will be removed in version 5. */
|
|
46284
|
-
const DESIGN_COMPONENT_BLOCK_NODE_TYPE = 'designComponentBlock';
|
|
46285
|
-
/** @deprecated use `ASSEMBLY_NODE_TYPES` instead. This will be removed in version 5. */
|
|
46286
|
-
const DESIGN_COMPONENT_NODE_TYPES = [
|
|
46287
|
-
DESIGN_COMPONENT_NODE_TYPE,
|
|
46288
|
-
DESIGN_COMPONENT_BLOCK_NODE_TYPE,
|
|
46289
|
-
];
|
|
46290
46261
|
const CF_STYLE_ATTRIBUTES = [
|
|
46291
46262
|
'cfHorizontalAlignment',
|
|
46292
46263
|
'cfVerticalAlignment',
|
|
@@ -50422,9 +50393,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
50422
50393
|
const entityStore = useEntityStore((state) => state.entityStore);
|
|
50423
50394
|
const props = reactExports.useMemo(() => {
|
|
50424
50395
|
// Don't enrich the assembly wrapper node with props
|
|
50425
|
-
if (!definition ||
|
|
50426
|
-
node.type === DESIGN_COMPONENT_NODE_TYPE ||
|
|
50427
|
-
node.type === ASSEMBLY_NODE_TYPE) {
|
|
50396
|
+
if (!definition || node.type === ASSEMBLY_NODE_TYPE) {
|
|
50428
50397
|
return {};
|
|
50429
50398
|
}
|
|
50430
50399
|
return Object.entries(definition.variables).reduce((acc, [variableName, variableDefinition]) => {
|
|
@@ -51265,7 +51234,7 @@ const deserializeAssemblyNode = ({ node, nodeId, nodeLocation, parentId, assembl
|
|
|
51265
51234
|
};
|
|
51266
51235
|
};
|
|
51267
51236
|
const resolveAssembly = ({ node, entityStore, }) => {
|
|
51268
|
-
if (node.type !==
|
|
51237
|
+
if (node.type !== ASSEMBLY_NODE_TYPE) {
|
|
51269
51238
|
return node;
|
|
51270
51239
|
}
|
|
51271
51240
|
const componentId = node.data.blockId;
|
|
@@ -51310,8 +51279,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
|
|
|
51310
51279
|
const areEntitiesFetched = useEntityStore((state) => state.areEntitiesFetched);
|
|
51311
51280
|
const entityStore = useEntityStore((state) => state.entityStore);
|
|
51312
51281
|
const node = reactExports.useMemo(() => {
|
|
51313
|
-
if (
|
|
51314
|
-
areEntitiesFetched) {
|
|
51282
|
+
if (rawNode.type === ASSEMBLY_NODE_TYPE && areEntitiesFetched) {
|
|
51315
51283
|
return resolveAssembly({
|
|
51316
51284
|
node: rawNode,
|
|
51317
51285
|
entityStore,
|
|
@@ -51321,8 +51289,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
|
|
|
51321
51289
|
}, [areEntitiesFetched, rawNode, entityStore]);
|
|
51322
51290
|
const componentRegistration = reactExports.useMemo(() => {
|
|
51323
51291
|
const registration = componentRegistry.get(node.data.blockId);
|
|
51324
|
-
if (
|
|
51325
|
-
!registration) {
|
|
51292
|
+
if (node.type === ASSEMBLY_NODE_TYPE && !registration) {
|
|
51326
51293
|
return createAssemblyRegistration({
|
|
51327
51294
|
definitionId: node.data.blockId,
|
|
51328
51295
|
component: Assembly,
|
|
@@ -51346,7 +51313,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
|
|
|
51346
51313
|
const { editorMode, renderDropzone: _renderDropzone, ...otherComponentProps } = componentProps;
|
|
51347
51314
|
const elementToRender = builtInComponents.includes(node.data.blockId || '')
|
|
51348
51315
|
? (dragProps) => React.createElement(componentRegistration.component, { ...dragProps, ...componentProps })
|
|
51349
|
-
: node.type ===
|
|
51316
|
+
: node.type === ASSEMBLY_NODE_TYPE
|
|
51350
51317
|
? // Assembly.tsx requires renderDropzone and editorMode as well
|
|
51351
51318
|
() => React.createElement(componentRegistration.component, componentProps)
|
|
51352
51319
|
: () => React.createElement(componentRegistration.component, otherComponentProps);
|
|
@@ -52355,7 +52322,7 @@ function treeVisit(initialNode, onNode) {
|
|
|
52355
52322
|
}
|
|
52356
52323
|
|
|
52357
52324
|
const isAssemblyNode = (node) => {
|
|
52358
|
-
return node.type ===
|
|
52325
|
+
return node.type === ASSEMBLY_NODE_TYPE;
|
|
52359
52326
|
};
|
|
52360
52327
|
const useTreeStore = create((set, get) => ({
|
|
52361
52328
|
tree: {
|
|
@@ -52772,8 +52739,7 @@ function Dropzone({ node, zoneId, resolveDesignValue, className, WrapperComponen
|
|
|
52772
52739
|
const isRootZone = zoneId === ROOT_ID;
|
|
52773
52740
|
const isDestination = draggedDestinationId === zoneId;
|
|
52774
52741
|
const isEmptyCanvas = isRootZone && !content.length;
|
|
52775
|
-
const isAssembly =
|
|
52776
|
-
ASSEMBLY_NODE_TYPES.includes(node?.type || '');
|
|
52742
|
+
const isAssembly = ASSEMBLY_NODE_TYPES.includes(node?.type || '');
|
|
52777
52743
|
// To avoid a circular dependency, we create the recursive rendering function here and trickle it down
|
|
52778
52744
|
const renderDropzone = reactExports.useCallback((node, props) => {
|
|
52779
52745
|
return (React.createElement(Dropzone, { zoneId: node.data.id, node: node, resolveDesignValue: resolveDesignValue, ...props }));
|
|
@@ -53035,8 +53001,7 @@ class MouseOverHandler {
|
|
|
53035
53001
|
};
|
|
53036
53002
|
}
|
|
53037
53003
|
getBoundingClientRect(element) {
|
|
53038
|
-
const isAssembly = element.getAttribute('data-cf-node-block-type') ===
|
|
53039
|
-
element.getAttribute('data-cf-node-block-type') === ASSEMBLY_NODE_TYPE;
|
|
53004
|
+
const isAssembly = element.getAttribute('data-cf-node-block-type') === ASSEMBLY_NODE_TYPE;
|
|
53040
53005
|
if (!isAssembly) {
|
|
53041
53006
|
return element.getBoundingClientRect();
|
|
53042
53007
|
}
|
|
@@ -53331,9 +53296,6 @@ function useEditorSubscriber() {
|
|
|
53331
53296
|
}
|
|
53332
53297
|
break;
|
|
53333
53298
|
}
|
|
53334
|
-
case INCOMING_EVENTS.DesignComponentsRegistered:
|
|
53335
|
-
// Event was deprecated and support will be discontinued with version 5
|
|
53336
|
-
break;
|
|
53337
53299
|
case INCOMING_EVENTS.AssembliesRegistered: {
|
|
53338
53300
|
const { assemblies } = payload;
|
|
53339
53301
|
assemblies.forEach((definition) => {
|
|
@@ -53344,9 +53306,6 @@ function useEditorSubscriber() {
|
|
|
53344
53306
|
});
|
|
53345
53307
|
break;
|
|
53346
53308
|
}
|
|
53347
|
-
case INCOMING_EVENTS.DesignComponentsAdded:
|
|
53348
|
-
// Event was deprecated and support will be discontinued with version 5
|
|
53349
|
-
break;
|
|
53350
53309
|
case INCOMING_EVENTS.AssembliesAdded: {
|
|
53351
53310
|
const { assembly, assemblyDefinition, } = payload;
|
|
53352
53311
|
entityStore.updateEntity(assembly);
|
|
@@ -53365,6 +53324,10 @@ function useEditorSubscriber() {
|
|
|
53365
53324
|
break;
|
|
53366
53325
|
}
|
|
53367
53326
|
case INCOMING_EVENTS.CanvasResized: {
|
|
53327
|
+
const { selectedNodeId } = payload;
|
|
53328
|
+
if (selectedNodeId) {
|
|
53329
|
+
sendSelectedComponentCoordinates(selectedNodeId);
|
|
53330
|
+
}
|
|
53368
53331
|
break;
|
|
53369
53332
|
}
|
|
53370
53333
|
case INCOMING_EVENTS.HoverComponent: {
|