@contentstack/studio-react-editor 1.1.4 → 1.3.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.
@@ -3,7 +3,7 @@ import { composableStudioEventEmitter, COMPOSABLE_STUDIO_EMITTED_EVENTS, ELEMENT
3
3
  import { lightSdk, sdk, handleNodeStyles } from '@contentstack/studio-core';
4
4
  import { CurrentNodeContext } from '@contentstack/studio-react-components/contexts';
5
5
  import { useData, useCurrentNode } from '@contentstack/studio-react-components/hooks';
6
- import { resolveMetadataBindings, getRepeaterBinding, getBindingString, getCslpTag, retrievePropValue } from '@contentstack/studio-registry';
6
+ import { resolveMetadataBindings, getRepeaterBinding, getBindingString, getCslpTag, retrievePropValue, INTERNAL_COMPONENTS_NAMES } from '@contentstack/studio-registry';
7
7
  import classNames from 'classnames';
8
8
  import { memo, useRef, useEffect, useCallback } from 'react';
9
9
  import { RendererErrorComponent } from './ErrorComponent.js';
@@ -26,7 +26,7 @@ import { SelectedNodeProvider } from '../contexts/providers/selected-node.provid
26
26
  const Element = ({ node, renderError, dataCslp, }) => {
27
27
  const isPreviewMode = usePreviewMode();
28
28
  const data = useData();
29
- const { attrs, styles, uid } = node;
29
+ const { attrs = {}, styles = {}, uid } = node;
30
30
  const { isCompositionBeingEdited, componentRegistry } = useRenderer();
31
31
  resolveMetadataBindings(node, data);
32
32
  const reference = useRef(null);
@@ -119,7 +119,7 @@ const Element = ({ node, renderError, dataCslp, }) => {
119
119
  internalAttributes["data-cslp"] = dataCslp;
120
120
  }
121
121
  const config = lightSdk?.internal?.getConfig() ?? sdk?.internal?.getConfig();
122
- if (node.metadata?.repeaterWrapper && config?.cslp.appendTags) {
122
+ if (node.metadata.repeaterWrapper && config?.cslp.appendTags) {
123
123
  const binding = getRepeaterBinding(node);
124
124
  if (binding) {
125
125
  const bindingPath = getBindingString(binding);
@@ -213,7 +213,7 @@ const VisualComponent = ({ parent, nodes, slotUid, renderError, dataCslp = "", }
213
213
  NODE_TO_PATH_NODE.set(node, [slotUid, idx]);
214
214
  NODE_TO_PARENT.set(node, parent);
215
215
  }
216
- if (node.metadata?.visible === false) {
216
+ if (node.metadata.visible === false) {
217
217
  return;
218
218
  }
219
219
  return (jsx(CurrentNodeContext.Provider, { value: {
@@ -223,8 +223,13 @@ const VisualComponent = ({ parent, nodes, slotUid, renderError, dataCslp = "", }
223
223
  });
224
224
  return jsx(Fragment, { children: children });
225
225
  }
226
+ // Compute hint for repeater slots bound to modular blocks or references
227
+ const hint = parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&
228
+ parent.metadata?.repeaterBindingFieldType
229
+ ? "It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References."
230
+ : undefined;
226
231
  if (!isCompositionBeingEdited || isPreviewMode) {
227
- return jsx(Slot, { studioAttributes: {}, slotUid: slotUid });
232
+ return jsx(Slot, { studioAttributes: {}, slotUid: slotUid, hint: hint });
228
233
  }
229
234
  const internalAttributes = {
230
235
  [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,
@@ -232,7 +237,7 @@ const VisualComponent = ({ parent, nodes, slotUid, renderError, dataCslp = "", }
232
237
  [COMPOSABLE_DATA_ATTRIBUTES.ID]: uid,
233
238
  ref,
234
239
  };
235
- return jsx(Slot, { studioAttributes: internalAttributes, slotUid: slotUid });
240
+ return (jsx(Slot, { studioAttributes: internalAttributes, slotUid: slotUid, hint: hint }));
236
241
  };
237
242
 
238
243
  export { MemoizedElement as default };
@@ -1 +1 @@
1
- {"version":3,"file":"Element.js","sources":["../../src/components/Element.tsx"],"sourcesContent":["import {\n COMPOSABLE_DATA_ATTRIBUTES,\n COMPOSABLE_STUDIO_EMITTED_EVENTS,\n composableStudioEventEmitter,\n ELEMENT_TO_NODE,\n getJSONRTE,\n loadGoogleFont,\n NODE_TO_ELEMENT,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n} from \"@contentstack/studio-client\";\nimport { lightSdk, sdk, handleNodeStyles } from \"@contentstack/studio-core\";\nimport { Node, Path, SlotUid } from \"@contentstack/studio-internal\";\nimport { HiddenElementNotificationEventData } from \"@contentstack/studio-messenger\";\nimport { CurrentNodeContext } from \"@contentstack/studio-react-components/contexts\";\nimport {\n useCurrentNode,\n useData,\n} from \"@contentstack/studio-react-components/hooks\";\nimport {\n getBindingString,\n getCslpTag,\n getRepeaterBinding,\n GetSlotsParams,\n resolveMetadataBindings,\n retrievePropValue,\n} from \"@contentstack/studio-registry\";\nimport classNames from \"classnames\";\nimport { memo, RefCallback, useCallback, useEffect, useRef } from \"react\";\nimport { BuilderNodeInternalAttributes, StudioComponentRef } from \"../types\";\nimport { RendererErrorComponent } from \"./ErrorComponent\";\nimport { TextPlaceholder } from \"./TextPlaceholder\";\nimport { RendererErrorBoundary } from \"./RendererErrorBoundary\";\nimport { shouldRenderSlot } from \"../utils\";\nimport Slot from \"./Slot\";\nimport { usePreviewMode, useRenderer } from \"../hooks\";\nimport { SelectedNodeProvider } from \"../contexts/providers/selected-node.provider\";\n\nconst Element = ({\n node,\n renderError,\n dataCslp,\n}: {\n node: Node;\n renderError?: React.ComponentType<{ error: Error }>;\n dataCslp?: string;\n}): React.ReactNode => {\n const isPreviewMode = usePreviewMode();\n const data = useData();\n const { attrs, styles, uid } = node;\n const { isCompositionBeingEdited, componentRegistry } = useRenderer();\n resolveMetadataBindings(node, data);\n const reference = useRef<StudioComponentRef>(null);\n\n // handles the hidden element notification event\n useEffect(() => {\n const hiddenElementNotificationEventListener = (\n data: HiddenElementNotificationEventData,\n ) => {\n if (!isCompositionBeingEdited) return;\n\n if (data.uid !== node.uid && data.uid !== \"__all__\") return;\n\n if (reference.current) {\n if (data.action === \"open\") {\n if (\n \"open\" in reference.current &&\n typeof reference.current.open === \"function\"\n ) {\n reference.current.open();\n } else {\n // TODO: link to the documentation\n console.error(\n \"Open method is not available on the reference. Please check the documentation for more details.\",\n );\n }\n } else {\n if (\n \"close\" in reference.current &&\n typeof reference.current.close === \"function\"\n ) {\n reference.current.close();\n } else {\n // TODO: link to the documentation\n console.error(\n \"Close method is not available on the reference. Please check the documentation for more details.\",\n );\n }\n }\n }\n };\n\n composableStudioEventEmitter.on(\n COMPOSABLE_STUDIO_EMITTED_EVENTS.HIDDEN_ELEMENT_NOTIFICATION,\n hiddenElementNotificationEventListener,\n );\n\n return () => {\n composableStudioEventEmitter.off(\n COMPOSABLE_STUDIO_EMITTED_EVENTS.HIDDEN_ELEMENT_NOTIFICATION,\n hiddenElementNotificationEventListener,\n );\n };\n }, []);\n\n if (!componentRegistry) {\n return <RendererErrorComponent reason=\"SDK is not initialized\" />;\n }\n let internalAttributes: BuilderNodeInternalAttributes = {};\n\n const ref: RefCallback<StudioComponentRef> = useCallback(\n (ref) => {\n // NOTE: if you change this condition, make sure to update the internal attributes above\n if (isCompositionBeingEdited && !isPreviewMode) {\n reference.current = ref;\n let refElement: HTMLElement | null = null;\n if (ref instanceof HTMLElement) {\n refElement = ref;\n } else if (ref) {\n if (\"element\" in ref) {\n refElement = ref.element ?? null;\n } else {\n // TODO: Link to documentation explaining how to use the element property\n console.error(\n \"Reference is not a valid object. It should have a element property.\",\n );\n }\n }\n\n if (refElement && node) {\n ELEMENT_TO_NODE.set(refElement, node);\n NODE_TO_ELEMENT.set(node, refElement);\n } else if (!refElement) {\n const element = NODE_TO_ELEMENT.get(node);\n if (element) {\n ELEMENT_TO_NODE.delete(element);\n }\n if (NODE_TO_ELEMENT.has(node)) {\n NODE_TO_ELEMENT.delete(node);\n }\n }\n }\n },\n [node],\n );\n\n // NOTE: if you change this condition, make sure to update the ref callback above\n if (isCompositionBeingEdited && !isPreviewMode) {\n internalAttributes = {\n [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.NODE]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.ID]: uid,\n ref,\n };\n }\n\n try {\n const componentOptions = componentRegistry.getComponentByNode(node, false);\n if (!componentOptions) return null;\n const Component = componentOptions.component;\n\n if (dataCslp) {\n internalAttributes[\"data-cslp\"] = dataCslp;\n }\n const config =\n lightSdk?.internal?.getConfig() ?? sdk?.internal?.getConfig();\n\n if (node.metadata?.repeaterWrapper && config?.cslp.appendTags) {\n const binding = getRepeaterBinding(node);\n if (binding) {\n const bindingPath = getBindingString(binding);\n const cslpValue = getCslpTag({ bindedField: bindingPath, data });\n if (cslpValue[\"data-cslp\"]) {\n internalAttributes[\"data-cslp\"] = cslpValue[\"data-cslp\"];\n }\n }\n }\n const resolvedProps = retrievePropValue<string, React.ReactNode>({\n data,\n defaultSlot: \"I am a default slot\", // TODO: this should be an component\n componentOptions: componentOptions,\n node: node,\n placeholders: {\n string: (placeholder?: string) => (\n <TextPlaceholder placeholder={placeholder} />\n ),\n },\n cslp: {\n appendTags: config?.cslp.appendTags ?? false,\n },\n nodeUid: uid,\n jsonRTE: getJSONRTE(),\n getSlots({ slots, parent, slotUid }: GetSlotsParams) {\n return (\n <VisualComponent\n parent={parent}\n nodes={slots}\n slotUid={slotUid}\n renderError={renderError}\n />\n );\n },\n isCompositionBeingEdited,\n });\n\n const [\n defaultResponsiveClass,\n namedResponsiveClasses,\n fontFamilies,\n fontVariants,\n ] = handleNodeStyles(styles, uid);\n\n // TODO: @RavenColEvol, can we memoize this?\n useEffect(() => {\n fontFamilies.forEach((fontFamily) => {\n loadGoogleFont(fontFamily, fontVariants.get(fontFamily)!, styles, uid);\n });\n }, [fontFamilies, styles, uid]);\n\n const componentClass = classNames(\n resolvedProps.className,\n defaultResponsiveClass,\n attrs.className,\n );\n\n const attrsWithResponsiveClass = {\n ...attrs,\n ...namedResponsiveClasses,\n className: componentClass,\n };\n const WrapTag =\n typeof componentOptions.wrap === \"string\"\n ? componentOptions.wrap || \"div\"\n : \"div\";\n if (componentOptions.wrap) {\n return (\n <RendererErrorBoundary renderError={renderError}>\n <WrapTag {...internalAttributes}>\n <Component {...attrsWithResponsiveClass} {...resolvedProps} />\n </WrapTag>\n </RendererErrorBoundary>\n );\n }\n return (\n <RendererErrorBoundary renderError={renderError}>\n <Component\n studioAttributes={internalAttributes}\n {...attrsWithResponsiveClass}\n {...resolvedProps}\n />\n </RendererErrorBoundary>\n );\n } catch (error) {\n if (error instanceof Error) {\n console.error(\"Error while rendering component\", error);\n return (\n <RendererErrorComponent\n builderAttributes={internalAttributes}\n reason={error.message}\n />\n );\n }\n throw error;\n }\n};\n\nconst MemoizedElement = memo(Element, (prev, next) => {\n const isSame =\n prev.node === next.node &&\n prev.dataCslp === next.dataCslp &&\n prev.renderError === next.renderError;\n return isSame;\n});\n\nconst VisualComponent = ({\n parent,\n nodes,\n slotUid,\n renderError,\n dataCslp = \"\",\n}: {\n parent: Node;\n nodes: Node[];\n slotUid: SlotUid;\n renderError?: React.ComponentType<{ error: Error }>;\n dataCslp?: string;\n}) => {\n const { uid } = parent;\n const isPreviewMode = usePreviewMode();\n const { isCompositionBeingEdited, componentRegistry } = useRenderer();\n const { currentNodePath: parentNodePath = [] } = useCurrentNode();\n const ref = useCallback(\n (ref: HTMLElement) => {\n if (isPreviewMode) return;\n if (ref && parent) {\n ELEMENT_TO_NODE.set(ref, parent);\n NODE_TO_ELEMENT.set(parent, ref);\n } else if (!ref) {\n // When component unmounts, remove references safely\n const element = NODE_TO_ELEMENT.get(parent);\n if (element) {\n ELEMENT_TO_NODE.delete(element);\n }\n if (NODE_TO_ELEMENT.has(parent)) {\n NODE_TO_ELEMENT.delete(parent);\n }\n }\n },\n [parent],\n );\n if (\n !shouldRenderSlot(\n componentRegistry!,\n parent,\n nodes,\n isCompositionBeingEdited,\n )\n ) {\n const children = nodes?.map((node, idx) => {\n const key = node.uid;\n const currentNodePath: Path = [...parentNodePath, [slotUid, idx]];\n\n if (isCompositionBeingEdited) {\n NODE_TO_PATH_NODE.set(node, [slotUid, idx]);\n NODE_TO_PARENT.set(node, parent);\n }\n\n if (node.metadata?.visible === false) {\n return;\n }\n return (\n <CurrentNodeContext.Provider\n key={key}\n value={{\n currentNodeUid: key,\n currentNodePath: currentNodePath,\n }}\n >\n <SelectedNodeProvider>\n <Element\n key={key}\n node={node}\n renderError={renderError}\n dataCslp={dataCslp}\n />\n </SelectedNodeProvider>\n </CurrentNodeContext.Provider>\n );\n });\n\n return <>{children}</>;\n }\n\n if (!isCompositionBeingEdited || isPreviewMode) {\n return <Slot studioAttributes={{}} slotUid={slotUid} />;\n }\n const internalAttributes: BuilderNodeInternalAttributes = {\n [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.NODE]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.ID]: uid,\n ref,\n };\n return <Slot studioAttributes={internalAttributes} slotUid={slotUid} />;\n};\n\nexport default MemoizedElement;\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,OAAO,GAAG,CAAC,EACf,IAAI,EACJ,WAAW,EACX,QAAQ,GAKT,KAAqB;AACpB,IAAA,MAAM,aAAa,GAAG,cAAc,EAAE;AACtC,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;IACtB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IACnC,MAAM,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,GAAG,WAAW,EAAE;AACrE,IAAA,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC;AACnC,IAAA,MAAM,SAAS,GAAG,MAAM,CAAqB,IAAI,CAAC;;IAGlD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,sCAAsC,GAAG,CAC7C,IAAwC,KACtC;AACF,YAAA,IAAI,CAAC,wBAAwB;gBAAE;AAE/B,YAAA,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;gBAAE;AAErD,YAAA,IAAI,SAAS,CAAC,OAAO,EAAE;AACrB,gBAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;AAC1B,o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xB;AAEA,IAAA,IAAI,CAAC,wBAAwB,IAAI,aAAa,EAAE;QAC9C,OAAOD,GAAA,CAAC,IAAI,EAAA,EAAC,gBAAgB,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAA,CAAI;IACzD;AACA,IAAA,MAAM,kBAAkB,GAAkC;AACxD,QAAA,CAAC,0BAA0B,CAAC,OAAO,GAAG,IAAI;AAC1C,QAAA,CAAC,0BAA0B,CAAC,IAAI,GAAG,IAAI;AACvC,QAAA,CAAC,0BAA0B,CAAC,EAAE,GAAG,GAAG;QACpC,GAAG;KACJ;IACD,OAAOA,GAAA,CAAC,IAAI,EAAA,EAAC,gBAAgB,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAA,CAAI;AACzE,CAAC;;;;"}
1
+ {"version":3,"file":"Element.js","sources":["../../src/components/Element.tsx"],"sourcesContent":["import {\n COMPOSABLE_DATA_ATTRIBUTES,\n COMPOSABLE_STUDIO_EMITTED_EVENTS,\n composableStudioEventEmitter,\n ELEMENT_TO_NODE,\n getJSONRTE,\n loadGoogleFont,\n NODE_TO_ELEMENT,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n} from \"@contentstack/studio-client\";\nimport { lightSdk, sdk, handleNodeStyles } from \"@contentstack/studio-core\";\nimport { Node, Path, SlotUid } from \"@contentstack/studio-internal\";\nimport { HiddenElementNotificationEventData } from \"@contentstack/studio-messenger\";\nimport { CurrentNodeContext } from \"@contentstack/studio-react-components/contexts\";\nimport {\n useCurrentNode,\n useData,\n} from \"@contentstack/studio-react-components/hooks\";\nimport {\n getBindingString,\n getCslpTag,\n getRepeaterBinding,\n GetSlotsParams,\n resolveMetadataBindings,\n retrievePropValue,\n INTERNAL_COMPONENTS_NAMES,\n ComponentRegistry,\n} from \"@contentstack/studio-registry\";\nimport classNames from \"classnames\";\nimport { memo, RefCallback, useCallback, useEffect, useRef } from \"react\";\nimport { BuilderNodeInternalAttributes, StudioComponentRef } from \"../types\";\nimport { RendererErrorComponent } from \"./ErrorComponent\";\nimport { TextPlaceholder } from \"./TextPlaceholder\";\nimport { RendererErrorBoundary } from \"./RendererErrorBoundary\";\nimport { shouldRenderSlot } from \"../utils\";\nimport Slot from \"./Slot\";\nimport { usePreviewMode, useRenderer } from \"../hooks\";\nimport { SelectedNodeProvider } from \"../contexts/providers/selected-node.provider\";\n\nconst Element = ({\n node,\n renderError,\n dataCslp,\n}: {\n node: Node;\n renderError?: React.ComponentType<{ error: Error }>;\n dataCslp?: string;\n}): React.ReactNode => {\n const isPreviewMode = usePreviewMode();\n const data = useData();\n const { attrs = {}, styles = {}, uid } = node;\n const { isCompositionBeingEdited, componentRegistry } = useRenderer();\n resolveMetadataBindings(node, data);\n const reference = useRef<StudioComponentRef>(null);\n\n // handles the hidden element notification event\n useEffect(() => {\n const hiddenElementNotificationEventListener = (\n data: HiddenElementNotificationEventData,\n ) => {\n if (!isCompositionBeingEdited) return;\n\n if (data.uid !== node.uid && data.uid !== \"__all__\") return;\n\n if (reference.current) {\n if (data.action === \"open\") {\n if (\n \"open\" in reference.current &&\n typeof reference.current.open === \"function\"\n ) {\n reference.current.open();\n } else {\n // TODO: link to the documentation\n console.error(\n \"Open method is not available on the reference. Please check the documentation for more details.\",\n );\n }\n } else {\n if (\n \"close\" in reference.current &&\n typeof reference.current.close === \"function\"\n ) {\n reference.current.close();\n } else {\n // TODO: link to the documentation\n console.error(\n \"Close method is not available on the reference. Please check the documentation for more details.\",\n );\n }\n }\n }\n };\n\n composableStudioEventEmitter.on(\n COMPOSABLE_STUDIO_EMITTED_EVENTS.HIDDEN_ELEMENT_NOTIFICATION,\n hiddenElementNotificationEventListener,\n );\n\n return () => {\n composableStudioEventEmitter.off(\n COMPOSABLE_STUDIO_EMITTED_EVENTS.HIDDEN_ELEMENT_NOTIFICATION,\n hiddenElementNotificationEventListener,\n );\n };\n }, []);\n\n if (!componentRegistry) {\n return <RendererErrorComponent reason=\"SDK is not initialized\" />;\n }\n let internalAttributes: BuilderNodeInternalAttributes = {};\n\n const ref: RefCallback<StudioComponentRef> = useCallback(\n (ref) => {\n // NOTE: if you change this condition, make sure to update the internal attributes above\n if (isCompositionBeingEdited && !isPreviewMode) {\n reference.current = ref;\n let refElement: HTMLElement | null = null;\n if (ref instanceof HTMLElement) {\n refElement = ref;\n } else if (ref) {\n if (\"element\" in ref) {\n refElement = ref.element ?? null;\n } else {\n // TODO: Link to documentation explaining how to use the element property\n console.error(\n \"Reference is not a valid object. It should have a element property.\",\n );\n }\n }\n\n if (refElement && node) {\n ELEMENT_TO_NODE.set(refElement, node);\n NODE_TO_ELEMENT.set(node, refElement);\n } else if (!refElement) {\n const element = NODE_TO_ELEMENT.get(node);\n if (element) {\n ELEMENT_TO_NODE.delete(element);\n }\n if (NODE_TO_ELEMENT.has(node)) {\n NODE_TO_ELEMENT.delete(node);\n }\n }\n }\n },\n [node],\n );\n\n // NOTE: if you change this condition, make sure to update the ref callback above\n if (isCompositionBeingEdited && !isPreviewMode) {\n internalAttributes = {\n [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.NODE]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.ID]: uid,\n ref,\n };\n }\n\n try {\n const componentOptions = componentRegistry.getComponentByNode(node, false);\n if (!componentOptions) return null;\n const Component = componentOptions.component;\n\n if (dataCslp) {\n internalAttributes[\"data-cslp\"] = dataCslp;\n }\n const config =\n lightSdk?.internal?.getConfig() ?? sdk?.internal?.getConfig();\n\n if (node.metadata.repeaterWrapper && config?.cslp.appendTags) {\n const binding = getRepeaterBinding(node);\n if (binding) {\n const bindingPath = getBindingString(binding);\n const cslpValue = getCslpTag({ bindedField: bindingPath, data });\n if (cslpValue[\"data-cslp\"]) {\n internalAttributes[\"data-cslp\"] = cslpValue[\"data-cslp\"];\n }\n }\n }\n const resolvedProps = retrievePropValue<string, React.ReactNode>({\n data,\n defaultSlot: \"I am a default slot\", // TODO: this should be an component\n componentOptions: componentOptions,\n node: node,\n placeholders: {\n string: (placeholder?: string) => (\n <TextPlaceholder placeholder={placeholder} />\n ),\n },\n cslp: {\n appendTags: config?.cslp.appendTags ?? false,\n },\n nodeUid: uid,\n jsonRTE: getJSONRTE(),\n getSlots({ slots, parent, slotUid }: GetSlotsParams) {\n return (\n <VisualComponent\n parent={parent}\n nodes={slots}\n slotUid={slotUid}\n renderError={renderError}\n />\n );\n },\n isCompositionBeingEdited,\n });\n\n const [\n defaultResponsiveClass,\n namedResponsiveClasses,\n fontFamilies,\n fontVariants,\n ] = handleNodeStyles(styles, uid);\n\n // TODO: @RavenColEvol, can we memoize this?\n useEffect(() => {\n fontFamilies.forEach((fontFamily) => {\n loadGoogleFont(fontFamily, fontVariants.get(fontFamily)!, styles, uid);\n });\n }, [fontFamilies, styles, uid]);\n\n const componentClass = classNames(\n resolvedProps.className,\n defaultResponsiveClass,\n attrs.className,\n );\n\n const attrsWithResponsiveClass = {\n ...attrs,\n ...namedResponsiveClasses,\n className: componentClass,\n };\n\n const WrapTag =\n typeof componentOptions.wrap === \"string\"\n ? componentOptions.wrap || \"div\"\n : \"div\";\n if (componentOptions.wrap) {\n return (\n <RendererErrorBoundary renderError={renderError}>\n <WrapTag {...internalAttributes}>\n <Component {...attrsWithResponsiveClass} {...resolvedProps} />\n </WrapTag>\n </RendererErrorBoundary>\n );\n }\n return (\n <RendererErrorBoundary renderError={renderError}>\n <Component\n studioAttributes={internalAttributes}\n {...attrsWithResponsiveClass}\n {...resolvedProps}\n />\n </RendererErrorBoundary>\n );\n } catch (error) {\n if (error instanceof Error) {\n console.error(\"Error while rendering component\", error);\n return (\n <RendererErrorComponent\n builderAttributes={internalAttributes}\n reason={error.message}\n />\n );\n }\n throw error;\n }\n};\n\nconst MemoizedElement = memo(Element, (prev, next) => {\n const isSame =\n prev.node === next.node &&\n prev.dataCslp === next.dataCslp &&\n prev.renderError === next.renderError;\n return isSame;\n});\n\nconst VisualComponent = ({\n parent,\n nodes,\n slotUid,\n renderError,\n dataCslp = \"\",\n}: {\n parent: Node;\n nodes: Node[];\n slotUid: SlotUid;\n renderError?: React.ComponentType<{ error: Error }>;\n dataCslp?: string;\n}) => {\n const { uid } = parent;\n const isPreviewMode = usePreviewMode();\n const { isCompositionBeingEdited, componentRegistry } = useRenderer();\n const { currentNodePath: parentNodePath = [] } = useCurrentNode();\n const ref = useCallback(\n (ref: HTMLElement) => {\n if (isPreviewMode) return;\n if (ref && parent) {\n ELEMENT_TO_NODE.set(ref, parent);\n NODE_TO_ELEMENT.set(parent, ref);\n } else if (!ref) {\n // When component unmounts, remove references safely\n const element = NODE_TO_ELEMENT.get(parent);\n if (element) {\n ELEMENT_TO_NODE.delete(element);\n }\n if (NODE_TO_ELEMENT.has(parent)) {\n NODE_TO_ELEMENT.delete(parent);\n }\n }\n },\n [parent],\n );\n if (\n !shouldRenderSlot(\n componentRegistry!,\n parent,\n nodes,\n isCompositionBeingEdited,\n )\n ) {\n const children = nodes?.map((node, idx) => {\n const key = node.uid;\n const currentNodePath: Path = [...parentNodePath, [slotUid, idx]];\n\n if (isCompositionBeingEdited) {\n NODE_TO_PATH_NODE.set(node, [slotUid, idx]);\n NODE_TO_PARENT.set(node, parent);\n }\n\n if (node.metadata.visible === false) {\n return;\n }\n return (\n <CurrentNodeContext.Provider\n key={key}\n value={{\n currentNodeUid: key,\n currentNodePath: currentNodePath,\n }}\n >\n <SelectedNodeProvider>\n <Element\n key={key}\n node={node}\n renderError={renderError}\n dataCslp={dataCslp}\n />\n </SelectedNodeProvider>\n </CurrentNodeContext.Provider>\n );\n });\n\n return <>{children}</>;\n }\n\n // Compute hint for repeater slots bound to modular blocks or references\n const hint =\n parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&\n parent.metadata?.repeaterBindingFieldType\n ? \"It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References.\"\n : undefined;\n\n if (!isCompositionBeingEdited || isPreviewMode) {\n return <Slot studioAttributes={{}} slotUid={slotUid} hint={hint} />;\n }\n const internalAttributes: BuilderNodeInternalAttributes = {\n [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.NODE]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.ID]: uid,\n ref,\n };\n return (\n <Slot studioAttributes={internalAttributes} slotUid={slotUid} hint={hint} />\n );\n};\n\nexport default MemoizedElement;\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,OAAO,GAAG,CAAC,EACf,IAAI,EACJ,WAAW,EACX,QAAQ,GAKT,KAAqB;AACpB,IAAA,MAAM,aAAa,GAAG,cAAc,EAAE;AACtC,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;AACtB,IAAA,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IAC7C,MAAM,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,GAAG,WAAW,EAAE;AACrE,IAAA,uBAAuB,CAAC,IAAI,EAAE,IAAI,CAAC;AACnC,IAAA,MAAM,SAAS,GAAG,MAAM,CAAqB,IAAI,CAAC;;IAGlD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,sCAAsC,GAAG,CAC7C,IAAwC,KACtC;AACF,YAAA,IAAI,CAAC,wBAAwB;gBAAE;AAE/B,YAAA,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;gBAAE;AAErD,YAAA,IAAI,SAAS,CAAC,OAAO,EAAE;AACrB,gBAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;AAC1B,oBAAA,IACE,MAAM,IAAI,SAAS,CAAC,OAAO;wBAC3B,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,EAC5C;AACA,wBAAA,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE;oBAC1B;yBAAO;;AAEL,wBAAA,OAAO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A,OAAOD,GAAA,CAAC,IAAI,EAAA,EAAC,gBAAgB,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAI;IACrE;AACA,IAAA,MAAM,kBAAkB,GAAkC;AACxD,QAAA,CAAC,0BAA0B,CAAC,OAAO,GAAG,IAAI;AAC1C,QAAA,CAAC,0BAA0B,CAAC,IAAI,GAAG,IAAI;AACvC,QAAA,CAAC,0BAA0B,CAAC,EAAE,GAAG,GAAG;QACpC,GAAG;KACJ;AACD,IAAA,QACEA,GAAA,CAAC,IAAI,EAAA,EAAC,gBAAgB,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAA,CAAI;AAEhF,CAAC;;;;"}
@@ -6,13 +6,7 @@ const RenderErrorHOC = ({ error, renderError, }) => {
6
6
  const DefaultComponent = jsx(RendererErrorComponent, { reason: error.message });
7
7
  if (error instanceof ComposableStudioError && renderError) {
8
8
  const ErrorComponent = renderError;
9
- return (jsx(ErrorComponent
10
- // safe to cast, most likely fallback errors
11
- // will not be thrown from the rendering logic
12
- , {
13
- // safe to cast, most likely fallback errors
14
- // will not be thrown from the rendering logic
15
- error: error, defaultComponent: DefaultComponent }));
9
+ return jsx(ErrorComponent, { error: error, defaultComponent: DefaultComponent });
16
10
  }
17
11
  return DefaultComponent;
18
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RenderErrorHOC.js","sources":["../../src/components/RenderErrorHOC.tsx"],"sourcesContent":["import {\n ComposableStudioError,\n ComposableStudioClientError,\n} from \"@contentstack/studio-client\";\nimport { RendererErrorComponent } from \"./ErrorComponent\";\n\nexport const RenderErrorHOC = ({\n error,\n renderError,\n}: {\n error: Error;\n renderError: any;\n}) => {\n const DefaultComponent = <RendererErrorComponent reason={error.message} />;\n if (error instanceof ComposableStudioError && renderError) {\n const ErrorComponent = renderError;\n return (\n <ErrorComponent\n // safe to cast, most likely fallback errors\n // will not be thrown from the rendering logic\n error={error as ComposableStudioClientError}\n defaultComponent={DefaultComponent}\n />\n );\n }\n return DefaultComponent;\n};\n"],"names":["_jsx"],"mappings":";;;;AAMO,MAAM,cAAc,GAAG,CAAC,EAC7B,KAAK,EACL,WAAW,GAIZ,KAAI;IACH,MAAM,gBAAgB,GAAGA,GAAA,CAAC,sBAAsB,EAAA,EAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI;AAC1E,IAAA,IAAI,KAAK,YAAY,qBAAqB,IAAI,WAAW,EAAE;QACzD,MAAM,cAAc,GAAG,WAAW;QAClC,QACEA,IAAC;;;;;;YAGC,KAAK,EAAE,KAAoC,EAC3C,gBAAgB,EAAE,gBAAgB,EAAA,CAClC;IAEN;AACA,IAAA,OAAO,gBAAgB;AACzB;;;;"}
1
+ {"version":3,"file":"RenderErrorHOC.js","sources":["../../src/components/RenderErrorHOC.tsx"],"sourcesContent":["import { ComposableStudioError } from \"@contentstack/studio-client\";\nimport { RendererErrorComponent } from \"./ErrorComponent\";\n\nexport const RenderErrorHOC = ({\n error,\n renderError,\n}: {\n error: Error;\n renderError: any;\n}) => {\n const DefaultComponent = <RendererErrorComponent reason={error.message} />;\n if (error instanceof ComposableStudioError && renderError) {\n const ErrorComponent = renderError;\n return <ErrorComponent error={error} defaultComponent={DefaultComponent} />;\n }\n return DefaultComponent;\n};\n"],"names":["_jsx"],"mappings":";;;;AAGO,MAAM,cAAc,GAAG,CAAC,EAC7B,KAAK,EACL,WAAW,GAIZ,KAAI;IACH,MAAM,gBAAgB,GAAGA,GAAA,CAAC,sBAAsB,EAAA,EAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI;AAC1E,IAAA,IAAI,KAAK,YAAY,qBAAqB,IAAI,WAAW,EAAE;QACzD,MAAM,cAAc,GAAG,WAAW;QAClC,OAAOA,GAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAA,CAAI;IAC7E;AACA,IAAA,OAAO,gBAAgB;AACzB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RendererErrorBoundary.js","sources":["../../src/components/RendererErrorBoundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\nimport { RendererErrorComponent } from \"./ErrorComponent\";\n\ninterface RendererErrorBoundaryProps {\n children: React.ReactNode;\n renderError?: React.ComponentType<{ error: Error }>;\n}\n\nexport const RendererErrorBoundary = React.memo(\n ({ children, renderError }: RendererErrorBoundaryProps) => {\n return (\n <ErrorBoundary\n FallbackComponent={({ error }) => {\n if (renderError) {\n const CustomErrorComponent = renderError;\n return <CustomErrorComponent error={error} />;\n }\n return <RendererErrorComponent reason={error.message} />;\n }}\n >\n {children}\n </ErrorBoundary>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;AAWO;;;;AAOK;;;AAGJ;AAKN;;"}
1
+ {"version":3,"file":"RendererErrorBoundary.js","sources":["../../src/components/RendererErrorBoundary.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { ErrorBoundary } from \"react-error-boundary\";\nimport { RendererErrorComponent } from \"./ErrorComponent\";\n\ninterface RendererErrorBoundaryProps {\n children: React.ReactNode;\n renderError?: React.ComponentType<{ error: Error }>;\n}\n\nexport const RendererErrorBoundary = React.memo(\n ({ children, renderError }: RendererErrorBoundaryProps) => {\n return (\n <ErrorBoundary\n FallbackComponent={({ error }) => {\n const errorObj = error as Error;\n if (renderError) {\n const CustomErrorComponent = renderError;\n return <CustomErrorComponent error={error as Error} />;\n }\n return <RendererErrorComponent reason={(error as Error).message} />;\n }}\n >\n {children}\n </ErrorBoundary>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;AAWO;;;;AAQK;;;AAGJ;AAKN;;"}
@@ -2,13 +2,18 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { COMPOSABLE_DATA_ATTRIBUTES } from '@contentstack/studio-client';
3
3
  import { css } from 'goober';
4
4
  import { styleFactory } from './styles.js';
5
+ import classNames from 'classnames';
5
6
 
6
- function Slot({ studioAttributes, slotUid }) {
7
+ function Slot({ studioAttributes, slotUid, hint }) {
7
8
  const attributes = {
8
9
  [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,
9
10
  [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,
10
11
  };
11
- return (jsxs("div", { ...attributes, className: styleFactory(css).slotStyle, ...studioAttributes, children: [jsx(AddIcon, {}), " Drop Here", jsx("p", { className: styleFactory(css).slotContentStyle })] }));
12
+ const styles = styleFactory(css);
13
+ const slotClassName = classNames(styles.slotStyle, {
14
+ [styles.slotColumnStyle]: hint,
15
+ });
16
+ return (jsxs("div", { ...attributes, className: slotClassName, ...studioAttributes, children: [jsxs("span", { className: styles.slotDropText, children: [jsx(AddIcon, {}), " Drop Here"] }), hint && jsxs("p", { className: styles.slotHintStyle, children: ["(", hint, ")"] })] }));
12
17
  }
13
18
  const AddIcon = () => {
14
19
  return (jsxs("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("rect", { x: "0.5", y: "0.5", width: "21", height: "21", rx: "4.5", fill: "white" }), jsx("rect", { x: "0.5", y: "0.5", width: "21", height: "21", rx: "4.5", stroke: "#475161" }), jsx("path", { d: "M11.2808 6.78125C11.2808 6.62592 11.1548 6.5 10.9995 6.5C10.8442 6.5 10.7183 6.62592 10.7183 6.78125V10.7184H6.78125C6.62592 10.7184 6.5 10.8443 6.5 10.9996C6.5 11.155 6.62592 11.2809 6.78125 11.2809H10.7183V15.218C10.7183 15.3733 10.8442 15.4993 10.9995 15.4993C11.1548 15.4993 11.2808 15.3733 11.2808 15.218V11.2809H15.218C15.3733 11.2809 15.4993 11.155 15.4993 10.9996C15.4993 10.8443 15.3733 10.7184 15.218 10.7184H11.2808V6.78125Z", fill: "#475161" })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"Slot.js","sources":["../../src/components/Slot.tsx"],"sourcesContent":["import { COMPOSABLE_DATA_ATTRIBUTES } from \"@contentstack/studio-client\";\nimport { css } from \"goober\";\nimport { styleFactory } from \"./styles\";\nimport { StudioAttributes } from \"../types/renderer.type\";\n\ninterface SlotProps extends StudioAttributes {\n slotUid: string;\n}\n\nexport default function Slot({ studioAttributes, slotUid }: SlotProps) {\n const attributes = {\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,\n };\n return (\n <div\n {...attributes}\n className={styleFactory(css).slotStyle}\n {...studioAttributes}\n >\n <AddIcon /> Drop Here\n <p className={styleFactory(css).slotContentStyle}></p>\n </div>\n );\n}\n\nconst AddIcon: React.FC = () => {\n return (\n <svg\n width=\"22\"\n height=\"22\"\n viewBox=\"0 0 22 22\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect x=\"0.5\" y=\"0.5\" width=\"21\" height=\"21\" rx=\"4.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"0.5\" width=\"21\" height=\"21\" rx=\"4.5\" stroke=\"#475161\" />\n <path\n d=\"M11.2808 6.78125C11.2808 6.62592 11.1548 6.5 10.9995 6.5C10.8442 6.5 10.7183 6.62592 10.7183 6.78125V10.7184H6.78125C6.62592 10.7184 6.5 10.8443 6.5 10.9996C6.5 11.155 6.62592 11.2809 6.78125 11.2809H10.7183V15.218C10.7183 15.3733 10.8442 15.4993 10.9995 15.4993C11.1548 15.4993 11.2808 15.3733 11.2808 15.218V11.2809H15.218C15.3733 11.2809 15.4993 11.155 15.4993 10.9996C15.4993 10.8443 15.3733 10.7184 15.218 10.7184H11.2808V6.78125Z\"\n fill=\"#475161\"\n />\n </svg>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;AASc,SAAU,IAAI,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAa,EAAA;AACnE,IAAA,MAAM,UAAU,GAAG;AACjB,QAAA,CAAC,0BAA0B,CAAC,IAAI,GAAG,IAAI;AACvC,QAAA,CAAC,0BAA0B,CAAC,QAAQ,GAAG,OAAO;KAC/C;AACD,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAA,GACM,UAAU,EACd,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,SAAS,KAClC,gBAAgB,EAAA,QAAA,EAAA,CAEpBC,GAAA,CAAC,OAAO,EAAA,EAAA,CAAG,EAAA,YAAA,EACXA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAA,CAAM,CAAA,EAAA,CAClD;AAEV;AAEA,MAAM,OAAO,GAAa,MAAK;AAC7B,IAAA,QACED,IAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAAA,QAAA,EAAA,CAElCC,cAAM,CAAC,EAAC,KAAK,EAAC,CAAC,EAAC,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAC,OAAO,EAAA,CAAG,EACrEA,GAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,KAAK,EAAC,CAAC,EAAC,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,KAAK,EAAC,MAAM,EAAC,SAAS,GAAG,EACzEA,GAAA,CAAA,MAAA,EAAA,EACE,CAAC,EAAC,qbAAqb,EACvb,IAAI,EAAC,SAAS,EAAA,CACd,CAAA,EAAA,CACE;AAEV,CAAC;;;;"}
1
+ {"version":3,"file":"Slot.js","sources":["../../src/components/Slot.tsx"],"sourcesContent":["import { COMPOSABLE_DATA_ATTRIBUTES } from \"@contentstack/studio-client\";\nimport { css } from \"goober\";\nimport { styleFactory } from \"./styles\";\nimport { StudioAttributes } from \"../types/renderer.type\";\nimport classNames from \"classnames\";\n\ninterface SlotProps extends StudioAttributes {\n slotUid: string;\n hint?: string;\n}\n\nexport default function Slot({ studioAttributes, slotUid, hint }: SlotProps) {\n const attributes = {\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,\n };\n const styles = styleFactory(css);\n const slotClassName = classNames(styles.slotStyle, {\n [styles.slotColumnStyle]: hint,\n });\n\n return (\n <div {...attributes} className={slotClassName} {...studioAttributes}>\n <span className={styles.slotDropText}>\n <AddIcon /> Drop Here\n </span>\n {hint && <p className={styles.slotHintStyle}>({hint})</p>}\n </div>\n );\n}\n\nconst AddIcon: React.FC = () => {\n return (\n <svg\n width=\"22\"\n height=\"22\"\n viewBox=\"0 0 22 22\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect x=\"0.5\" y=\"0.5\" width=\"21\" height=\"21\" rx=\"4.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"0.5\" width=\"21\" height=\"21\" rx=\"4.5\" stroke=\"#475161\" />\n <path\n d=\"M11.2808 6.78125C11.2808 6.62592 11.1548 6.5 10.9995 6.5C10.8442 6.5 10.7183 6.62592 10.7183 6.78125V10.7184H6.78125C6.62592 10.7184 6.5 10.8443 6.5 10.9996C6.5 11.155 6.62592 11.2809 6.78125 11.2809H10.7183V15.218C10.7183 15.3733 10.8442 15.4993 10.9995 15.4993C11.1548 15.4993 11.2808 15.3733 11.2808 15.218V11.2809H15.218C15.3733 11.2809 15.4993 11.155 15.4993 10.9996C15.4993 10.8443 15.3733 10.7184 15.218 10.7184H11.2808V6.78125Z\"\n fill=\"#475161\"\n />\n </svg>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;AAWc,SAAU,IAAI,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAa,EAAA;AACzE,IAAA,MAAM,U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AAC,MAAM,EAAC,SAAS,GAAG,EACzEA,GAAA,CAAA,MAAA,EAAA,EACE,CAAC,EAAC,qbAAqb,EACvb,IAAI,EAAC,SAAS,EAAA,CACd,CAAA,EAAA,CACE;AAEV,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionBlock.js","sources":["../../../src/components/elements/ConditionBlock.tsx"],"sourcesContent":["import { evaluateCondition } from \"@contentstack/studio-client\";\nimport { Condition } from \"@contentstack/studio-internal\";\nimport {\n getBindingString,\n getRepeaterContextPath,\n RepeaterBindingValue,\n} from \"@contentstack/studio-registry\";\nimport { produce } from \"immer\";\nimport { get, set } from \"lodash-es\";\nimport React from \"react\";\nimport { DataCtxProvider } from \"@contentstack/studio-react-components/contexts\";\nimport { useData } from \"@contentstack/studio-react-components/hooks\";\nimport {\n ConditionBlockContext,\n DesignPreviewContext,\n} from \"../../contexts/providers\";\nimport { useShouldShowDesign } from \"../../hooks\";\n\ninterface ConditionBlockProps {\n condition: Condition;\n children: React.ReactNode;\n mode: \"design\" | \"preview\";\n studioAttributes: any;\n}\n\nexport function ConditionBlock({\n condition,\n children,\n mode,\n studioAttributes,\n}: ConditionBlockProps) {\n const showDesign = useShouldShowDesign(mode);\n\n if (showDesign) {\n return (\n <ConditionBlockContext.Provider value={{ isInsideConditionBlock: true }}>\n <DesignPreviewContext.Provider value=\"design\">\n <div {...studioAttributes} style={{ display: \"contents\" }}>\n {children}\n </div>\n </DesignPreviewContext.Provider>\n </ConditionBlockContext.Provider>\n );\n }\n return (\n <ConditionPreview condition={condition} studioAttributes={studioAttributes}>\n {children}\n </ConditionPreview>\n );\n}\n\nfunction ConditionPreview({\n condition,\n children,\n studioAttributes,\n}: Omit<ConditionBlockProps, \"mode\">) {\n const data = useData();\n if (!condition) return null;\n let conditionAppliedData = data;\n const { dataBinding: binding } = condition;\n let shouldRender = evaluateCondition(condition, conditionAppliedData);\n const dataPath = binding && getBindingString(binding);\n const repeaterPath =\n binding &&\n getRepeaterContextPath(binding.value as unknown as RepeaterBindingValue);\n if (dataPath) {\n const conditionalData = get(data, dataPath);\n if (conditionalData && repeaterPath) {\n conditionAppliedData = produce(data, (draft) => {\n set(draft, repeaterPath, conditionalData);\n });\n }\n }\n const { \"data-cslp\": dataCslp, ...rest } = studioAttributes || {};\n\n const conditionCSLP = {\n dataCslp: dataCslp,\n };\n const childrenWithCSLP = React.Children.map(children, (child, index) => {\n const newProps = index === 0 ? conditionCSLP : {};\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n key: index,\n ...newProps,\n });\n }\n });\n // Only render children if condition is met\n return shouldRender ? (\n <ConditionBlockContext.Provider value={{ isInsideConditionBlock: true }}>\n <DesignPreviewContext.Provider value=\"preview\">\n <DataCtxProvider value={conditionAppliedData}>\n <div {...rest} style={{ display: \"contents\" }}>\n {childrenWithCSLP}\n </div>\n </DataCtxProvider>\n </DesignPreviewContext.Provider>\n </ConditionBlockContext.Provider>\n ) : null;\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAyBM,SAAU,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,gBAAgB,GACI,EAAA;AACpB,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAAC,IAAI,CAAC;IAE5C,IAAI,UAAU,EAAE;AACd,QAAA,QACEA,GAAA,CAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,YACrEA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAC,QAAQ,EAAA,QAAA,EAC3CA,GAAA,CAAA,KAAA,EAAA,EAAA,GAAS,gBAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EACtD,QAAQ,GACL,EAAA,CACwB,EAAA,CACD;IAErC;AACA,IAAA,QACEA,GAAA,CAAC,gBAAgB,EAAA,EAAC,SAAS,EAAE,SAAS,EAAE,gBAAg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,EAAE;AAC/B,YAAA,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE;AAC/B,gBAAA,GAAG,EAAE,KAAK;AACV,gBAAA,GAAG,QAAQ;AACZ,aAAA,CAAC;QACJ;AACF,IAAA,CAAC,CAAC;;IAEF,OAAO,YAAY,IACjBA,IAAC,qBAAqB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAA,QAAA,EACrEA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAC,SAAS,EAAA,QAAA,EAC5CA,IAAC,eAAe,EAAA,EAAC,KAAK,EAAE,oBAAoB,EAAA,QAAA,EAC1CA,GAAA,CAAA,KAAA,EAAA,EAAA,GAAS,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EAC1C,gBAAgB,EAAA,CACb,EAAA,CACU,EAAA,CACY,EAAA,CACD,IAC/B,IAAI;AACV;;;;"}
1
+ {"version":3,"file":"ConditionBlock.js","sources":["../../../src/components/elements/ConditionBlock.tsx"],"sourcesContent":["import { evaluateCondition } from \"@contentstack/studio-client\";\nimport { Condition } from \"@contentstack/studio-internal\";\nimport {\n getBindingString,\n getRepeaterContextPath,\n RepeaterBindingValue,\n} from \"@contentstack/studio-registry\";\nimport { produce } from \"immer\";\nimport { get, set } from \"lodash-es\";\nimport React from \"react\";\nimport { DataCtxProvider } from \"@contentstack/studio-react-components/contexts\";\nimport { useData } from \"@contentstack/studio-react-components/hooks\";\nimport {\n ConditionBlockContext,\n DesignPreviewContext,\n} from \"../../contexts/providers\";\nimport { useShouldShowDesign } from \"../../hooks\";\n\ninterface ConditionBlockProps {\n condition: Condition;\n children: React.ReactNode;\n mode: \"design\" | \"preview\";\n studioAttributes: any;\n}\n\nexport function ConditionBlock({\n condition,\n children,\n mode,\n studioAttributes,\n}: ConditionBlockProps) {\n const showDesign = useShouldShowDesign(mode);\n\n if (showDesign) {\n return (\n <ConditionBlockContext.Provider value={{ isInsideConditionBlock: true }}>\n <DesignPreviewContext.Provider value=\"design\">\n <div {...studioAttributes} style={{ display: \"contents\" }}>\n {children}\n </div>\n </DesignPreviewContext.Provider>\n </ConditionBlockContext.Provider>\n );\n }\n return (\n <ConditionPreview condition={condition} studioAttributes={studioAttributes}>\n {children}\n </ConditionPreview>\n );\n}\n\nfunction ConditionPreview({\n condition,\n children,\n studioAttributes,\n}: Omit<ConditionBlockProps, \"mode\">) {\n const data = useData();\n if (!condition) return null;\n let conditionAppliedData = data;\n const { dataBinding: binding } = condition;\n let shouldRender = evaluateCondition(condition, conditionAppliedData);\n const dataPath = binding && getBindingString(binding);\n const repeaterPath =\n binding &&\n getRepeaterContextPath(binding.value as unknown as RepeaterBindingValue);\n\n if (dataPath) {\n const conditionalData = get(data, dataPath);\n if (conditionalData && repeaterPath) {\n conditionAppliedData = produce(data, (draft) => {\n set(draft, repeaterPath, conditionalData);\n });\n }\n }\n const { \"data-cslp\": dataCslp, ...rest } = studioAttributes || {};\n\n const conditionCSLP = {\n dataCslp: dataCslp,\n };\n const childrenWithCSLP = React.Children.map(children, (child, index) => {\n const newProps = index === 0 ? conditionCSLP : {};\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n key: index,\n ...newProps,\n });\n }\n });\n // Only render children if condition is met\n return shouldRender ? (\n <ConditionBlockContext.Provider value={{ isInsideConditionBlock: true }}>\n <DesignPreviewContext.Provider value=\"preview\">\n <DataCtxProvider value={conditionAppliedData}>\n <div {...rest} style={{ display: \"contents\" }}>\n {childrenWithCSLP}\n </div>\n </DataCtxProvider>\n </DesignPreviewContext.Provider>\n </ConditionBlockContext.Provider>\n ) : null;\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAyBM,SAAU,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,gBAAgB,GACI,EAAA;AACpB,IAAA,MAAM,UAAU,GAAG,mBAAmB,CA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AAE,YAAY,EAAE,eAAe,CAAC;AAC3C,YAAA,CAAC,CAAC;QACJ;IACF;AACA,IAAA,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,gBAAgB,IAAI,EAAE;AAEjE,IAAA,MAAM,aAAa,GAAG;AACpB,QAAA,QAAQ,EAAE,QAAQ;KACnB;AACD,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAI;AACrE,QAAA,MAAM,QAAQ,GAAG,KAAK,KAAK,CAAC,GAAG,aAAa,GAAG,EAAE;AACjD,QAAA,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;AAC/B,YAAA,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE;AAC/B,gBAAA,GAAG,EAAE,KAAK;AACV,gBAAA,GAAG,QAAQ;AACZ,aAAA,CAAC;QACJ;AACF,IAAA,CAAC,CAAC;;IAEF,OAAO,YAAY,IACjBA,IAAC,qBAAqB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAA,QAAA,EACrEA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAC,SAAS,EAAA,QAAA,EAC5CA,IAAC,eAAe,EAAA,EAAC,KAAK,EAAE,oBAAoB,EAAA,QAAA,EAC1CA,GAAA,CAAA,KAAA,EAAA,EAAA,GAAS,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EAC1C,gBAAgB,EAAA,CACb,EAAA,CACU,EAAA,CACY,EAAA,CACD,IAC/B,IAAI;AACV;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { getFlattenedData } from '@contentstack/studio-registry';
2
3
  import { DataCtxProvider } from '@contentstack/studio-react-components/contexts';
3
4
  import { useData } from '@contentstack/studio-react-components/hooks';
4
5
  import { Children, isValidElement, cloneElement } from 'react';
@@ -7,7 +8,6 @@ import '../../contexts/providers/active-node.provider.js';
7
8
  import '@contentstack/studio-client';
8
9
  import '@contentstack/studio-messenger';
9
10
  import 'immer';
10
- import '@contentstack/studio-registry';
11
11
  import '../Element.js';
12
12
  import { useShouldShowDesign } from '../../hooks/use-should-show-design.hook.js';
13
13
  import { DesignPreviewContext } from '../../contexts/providers/use-design-preview.provider.js';
@@ -20,17 +20,31 @@ function RepeaterPreview({ children, studioAttributes, items = [], _uid, $items,
20
20
  // Get uid from builder attributes or generate a fallback
21
21
  const uid = _uid || studioAttributes?.["data-composable-studio-id"] || "default";
22
22
  return (jsx(RepeaterContext.Provider, { value: { isInsideRepeater: true }, children: jsx(DesignPreviewContext.Provider, { value: "preview", children: items.map((item, index) => {
23
- // Create a new data context for each item with uid in path
23
+ // Single-level unwrap (see studio-react-components/Repeater.tsx).
24
+ let mergedContext = getFlattenedData(item);
25
+ if (item && typeof item === "object" && !Array.isArray(item)) {
26
+ const keys = Object.keys(item).filter((k) => k !== "$" && k !== "_metadata");
27
+ if (keys.length === 1) {
28
+ const inner = item[keys[0]];
29
+ if (inner && typeof inner === "object" && !Array.isArray(inner)) {
30
+ mergedContext = { ...inner, ...item };
31
+ }
32
+ else {
33
+ mergedContext = item;
34
+ }
35
+ }
36
+ }
37
+ const existingRepData = data?.dataSources?.repeater;
24
38
  const itemContext = {
25
39
  ...data,
26
40
  dataSources: {
27
41
  ...data?.dataSources,
28
42
  repeater: {
29
43
  [uid]: {
30
- context: item,
44
+ context: mergedContext,
31
45
  index,
32
46
  },
33
- ...data?.dataSources?.repeater,
47
+ ...existingRepData,
34
48
  },
35
49
  },
36
50
  };
@@ -54,13 +68,46 @@ function RepeaterPreview({ children, studioAttributes, items = [], _uid, $items,
54
68
  // Optimize repeater
55
69
  function Repeater({ children, studioAttributes, items = [], _uid, mode, $items, }) {
56
70
  const showDesign = useShouldShowDesign(mode);
71
+ // In canvas
72
+ const data = useData();
57
73
  if (!Array.isArray(items)) {
58
- console.warn("Repeater items is not an array:", items);
59
74
  return null;
60
75
  }
61
- // In canvas
62
76
  if (showDesign) {
63
- return (jsx(RepeaterContext.Provider, { value: { isInsideRepeater: true }, children: jsx(DesignPreviewContext.Provider, { value: "design", children: jsx("div", { ...studioAttributes, style: { display: "contents" }, children: children }) }) }));
77
+ const uid = _uid || studioAttributes?.["data-composable-studio-id"] || "default";
78
+ // In design mode, we wrap the children with the context of the first item if available
79
+ // to allow data resolution to work for the "template" children.
80
+ // Single-level unwrap (same logic as preview mode above).
81
+ const rawFirst = items[0];
82
+ let mergedFirst = getFlattenedData(rawFirst);
83
+ if (rawFirst && typeof rawFirst === "object" && !Array.isArray(rawFirst)) {
84
+ const keys = Object.keys(rawFirst).filter((k) => k !== "$" && k !== "_metadata");
85
+ if (keys.length === 1) {
86
+ const inner = rawFirst[keys[0]];
87
+ if (inner && typeof inner === "object" && !Array.isArray(inner)) {
88
+ mergedFirst = { ...inner, ...rawFirst };
89
+ }
90
+ else {
91
+ mergedFirst = rawFirst;
92
+ }
93
+ }
94
+ }
95
+ const itemContext = mergedFirst !== undefined
96
+ ? {
97
+ ...data,
98
+ dataSources: {
99
+ ...data?.dataSources,
100
+ repeater: {
101
+ [uid]: {
102
+ context: mergedFirst,
103
+ index: 0,
104
+ },
105
+ ...data?.dataSources?.repeater,
106
+ },
107
+ },
108
+ }
109
+ : data;
110
+ return (jsx(RepeaterContext.Provider, { value: { isInsideRepeater: true }, children: jsx(DesignPreviewContext.Provider, { value: "design", children: jsx(DataCtxProvider, { value: itemContext, children: jsx("div", { ...studioAttributes, style: { display: "contents" }, children: children }) }) }) }));
64
111
  }
65
112
  // Production renderer or mode === "preview"
66
113
  return (jsx(RepeaterPreview, { items: items, children: children, studioAttributes: studioAttributes, _uid: _uid, "$items": $items }));
@@ -1 +1 @@
1
- {"version":3,"file":"Repeater.js","sources":["../../../src/components/elements/Repeater.tsx"],"sourcesContent":["import { DataCtxProvider } from \"@contentstack/studio-react-components/contexts\";\nimport { useData } from \"@contentstack/studio-react-components/hooks\";\nimport React, { Children, cloneElement, isValidElement } from \"react\";\nimport {\n DesignPreviewContext,\n RepeaterContext,\n} from \"../../contexts/providers\";\nimport { useShouldShowDesign } from \"../../hooks\";\n\ntype CSLP = { \"data-cslp\": string };\ninterface RepeaterProps {\n children: React.ReactNode;\n studioAttributes?: any;\n items?: any[];\n data?: any;\n _uid: string;\n mode: \"design\" | \"preview\";\n $items?: CSLP;\n}\n\nfunction RepeaterPreview({\n children,\n studioAttributes,\n items = [],\n _uid,\n $items,\n}: Omit<RepeaterProps, \"mode\">) {\n const data = useData();\n // Get uid from builder attributes or generate a fallback\n const uid =\n _uid || studioAttributes?.[\"data-composable-studio-id\"] || \"default\";\n return (\n <RepeaterContext.Provider value={{ isInsideRepeater: true }}>\n <DesignPreviewContext.Provider value=\"preview\">\n {items.map((item, index) => {\n // Create a new data context for each item with uid in path\n const itemContext = {\n ...data,\n dataSources: {\n ...data?.dataSources,\n repeater: {\n [uid]: {\n context: item,\n index,\n },\n ...data?.dataSources?.repeater,\n },\n },\n };\n const instanceCSLP: any = {};\n if ($items) {\n instanceCSLP.dataCslp = `${$items[\"data-cslp\"]}.${index}`;\n }\n\n // Clone children with the new context\n const childrenWithCSLP = Children.map(children, (child) => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n ...instanceCSLP,\n });\n }\n });\n return (\n //TODO: Handle key with slot uid and support cslp tags\n <DataCtxProvider value={itemContext} key={`${uid}-${index}`}>\n <div {...studioAttributes} style={{ display: \"contents\" }}>\n {childrenWithCSLP}\n </div>\n </DataCtxProvider>\n );\n })}\n </DesignPreviewContext.Provider>\n </RepeaterContext.Provider>\n );\n}\n\n// Optimize repeater\nexport function Repeater({\n children,\n studioAttributes,\n items = [],\n _uid,\n mode,\n $items,\n}: RepeaterProps) {\n const showDesign = useShouldShowDesign(mode);\n\n if (!Array.isArray(items)) {\n console.warn(\"Repeater items is not an array:\", items);\n return null;\n }\n\n // In canvas\n if (showDesign) {\n return (\n <RepeaterContext.Provider value={{ isInsideRepeater: true }}>\n <DesignPreviewContext.Provider value=\"design\">\n <div {...studioAttributes} style={{ display: \"contents\" }}>\n {children}\n </div>\n </DesignPreviewContext.Provider>\n </RepeaterContext.Provider>\n );\n }\n // Production renderer or mode === \"preview\"\n return (\n <RepeaterPreview\n items={items}\n children={children}\n studioAttributes={studioAttributes}\n _uid={_uid}\n $items={$items}\n />\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe,CAAC,EACvB,QAAQ,EACR,gBAAgB,EAChB,KAAK,GAAG,EAAE,EACV,IAAI,EACJ,MAAM,GACsB,EAAA;AAC5B,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;;IAEtB,MAAM,GAAG,GACP,IAAI,IAAI,gBAAgB,GAAG,2BAA2B,CAAC,IAAI,SAAS;AACtE,IAAA,QACEA,GAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,YACzDA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAC,SAAS,YAC3C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;;AAEzB,gBAAA,MAAM,WAAW,GAAG;AAClB,oBAAA,GAAG,IAAI;AACP,oBAAA,WAAW,EAAE;wBACX,GAAG,IAAI,EAAE,WAAW;AACpB,wBAAA,QAAQ,EAAE;4BACR,CAAC,GAAG,GAAG;AACL,gCAAA,OAAO,EAAE,IAAI;gCACb,KAAK;AACN,6BAAA;AACD,4BAAA,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ;AAC/B,yBAAA;AACF,qBAAA;iBACF;gBACD,MAAM,YAAY,GAAQ,EAAE;gBAC5B,IAAI,MAAM,EAAE;oBACV,YAAY,CAAC,QAAQ,GAAG,CAAA,EA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AA,EAAA,GAAS,gBAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EACtD,QAAQ,GACL,EAAA,CACwB,EAAA,CACP;IAE/B;;IAEA,QACEA,IAAC,eAAe,EAAA,EACd,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,IAAI,EAAA,QAAA,EACF,MAAM,EAAA,CACd;AAEN;;;;"}
1
+ {"version":3,"file":"Repeater.js","sources":["../../../src/components/elements/Repeater.tsx"],"sourcesContent":["import { getFlattenedData } from \"@contentstack/studio-registry\";\nimport { DataCtxProvider } from \"@contentstack/studio-react-components/contexts\";\nimport { useData } from \"@contentstack/studio-react-components/hooks\";\nimport React, { Children, cloneElement, isValidElement } from \"react\";\nimport {\n DesignPreviewContext,\n RepeaterContext,\n} from \"../../contexts/providers\";\nimport { useShouldShowDesign } from \"../../hooks\";\n\ntype CSLP = { \"data-cslp\": string };\ninterface RepeaterProps {\n children: React.ReactNode;\n studioAttributes?: any;\n items?: any[];\n data?: any;\n _uid: string;\n mode: \"design\" | \"preview\";\n $items?: CSLP;\n}\n\nfunction RepeaterPreview({\n children,\n studioAttributes,\n items = [],\n _uid,\n $items,\n}: Omit<RepeaterProps, \"mode\">) {\n const data = useData();\n // Get uid from builder attributes or generate a fallback\n const uid =\n _uid || studioAttributes?.[\"data-composable-studio-id\"] || \"default\";\n return (\n <RepeaterContext.Provider value={{ isInsideRepeater: true }}>\n <DesignPreviewContext.Provider value=\"preview\">\n {items.map((item, index) => {\n // Single-level unwrap (see studio-react-components/Repeater.tsx).\n let mergedContext = getFlattenedData(item);\n if (item && typeof item === \"object\" && !Array.isArray(item)) {\n const keys = Object.keys(item).filter(\n (k) => k !== \"$\" && k !== \"_metadata\",\n );\n if (keys.length === 1) {\n const inner = item[keys[0]];\n if (inner && typeof inner === \"object\" && !Array.isArray(inner)) {\n mergedContext = { ...inner, ...item };\n } else {\n mergedContext = item;\n }\n }\n }\n\n const existingRepData = data?.dataSources?.repeater;\n const itemContext = {\n ...data,\n dataSources: {\n ...data?.dataSources,\n repeater: {\n [uid]: {\n context: mergedContext,\n index,\n },\n ...existingRepData,\n },\n },\n };\n const instanceCSLP: any = {};\n if ($items) {\n instanceCSLP.dataCslp = `${$items[\"data-cslp\"]}.${index}`;\n }\n\n // Clone children with the new context\n const childrenWithCSLP = Children.map(children, (child) => {\n if (isValidElement(child)) {\n return cloneElement(child, {\n ...instanceCSLP,\n });\n }\n });\n return (\n //TODO: Handle key with slot uid and support cslp tags\n <DataCtxProvider value={itemContext} key={`${uid}-${index}`}>\n <div {...studioAttributes} style={{ display: \"contents\" }}>\n {childrenWithCSLP}\n </div>\n </DataCtxProvider>\n );\n })}\n </DesignPreviewContext.Provider>\n </RepeaterContext.Provider>\n );\n}\n\n// Optimize repeater\nexport function Repeater({\n children,\n studioAttributes,\n items = [],\n _uid,\n mode,\n $items,\n}: RepeaterProps) {\n const showDesign = useShouldShowDesign(mode);\n // In canvas\n const data = useData();\n\n if (!Array.isArray(items)) {\n return null;\n }\n if (showDesign) {\n const uid =\n _uid || studioAttributes?.[\"data-composable-studio-id\"] || \"default\";\n\n // In design mode, we wrap the children with the context of the first item if available\n // to allow data resolution to work for the \"template\" children.\n // Single-level unwrap (same logic as preview mode above).\n const rawFirst = items[0];\n let mergedFirst = getFlattenedData(rawFirst);\n if (rawFirst && typeof rawFirst === \"object\" && !Array.isArray(rawFirst)) {\n const keys = Object.keys(rawFirst).filter(\n (k) => k !== \"$\" && k !== \"_metadata\",\n );\n if (keys.length === 1) {\n const inner = rawFirst[keys[0]];\n if (inner && typeof inner === \"object\" && !Array.isArray(inner)) {\n mergedFirst = { ...inner, ...rawFirst };\n } else {\n mergedFirst = rawFirst;\n }\n }\n }\n const itemContext =\n mergedFirst !== undefined\n ? {\n ...data,\n dataSources: {\n ...data?.dataSources,\n repeater: {\n [uid]: {\n context: mergedFirst,\n index: 0,\n },\n ...data?.dataSources?.repeater,\n },\n },\n }\n : data;\n\n return (\n <RepeaterContext.Provider value={{ isInsideRepeater: true }}>\n <DesignPreviewContext.Provider value=\"design\">\n <DataCtxProvider value={itemContext}>\n <div {...studioAttributes} style={{ display: \"contents\" }}>\n {children}\n </div>\n </DataCtxProvider>\n </DesignPreviewContext.Provider>\n </RepeaterContext.Provider>\n );\n }\n // Production renderer or mode === \"preview\"\n return (\n <RepeaterPreview\n items={items}\n children={children}\n studioAttributes={studioAttributes}\n _uid={_uid}\n $items={$items}\n />\n );\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,SAAS,eAAe,CAAC,EACvB,QAAQ,EACR,gBAAgB,EAChB,KAAK,GAAG,EAAE,EACV,IAAI,EACJ,MAAM,GACsB,EAAA;AAC5B,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;;IAEtB,MAAM,GAAG,GACP,IAAI,IAAI,gBAAgB,GAAG,2BAA2B,CAAC,IAAI,SAAS;AACtE,IAAA,QACEA,GAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,YACzDA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAC,SAAS,YAC3C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KAAI;;AAEzB,gBAAA,IAAI,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAC1C,gBAAA,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CACnC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,WAAW,CACtC;AACD,oBAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EA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,GAAG,QAAQ,EAAE;gBACzC;qBAAO;oBACL,WAAW,GAAG,QAAQ;gBACxB;YACF;QACF;AACA,QAAA,MAAM,WAAW,GACf,WAAW,KAAK;AACd,cAAE;AACE,gBAAA,GAAG,IAAI;AACP,gBAAA,WAAW,EAAE;oBACX,GAAG,IAAI,EAAE,WAAW;AACpB,oBAAA,QAAQ,EAAE;wBACR,CAAC,GAAG,GAAG;AACL,4BAAA,OAAO,EAAE,WAAW;AACpB,4BAAA,KAAK,EAAE,CAAC;AACT,yBAAA;AACD,wBAAA,GAAG,IAAI,EAAE,WAAW,EAAE,QAAQ;AAC/B,qBAAA;AACF,iBAAA;AACF;cACD,IAAI;QAEV,QACEA,IAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,YACzDA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAC,QAAQ,EAAA,QAAA,EAC3CA,IAAC,eAAe,EAAA,EAAC,KAAK,EAAE,WAAW,YACjCA,GAAA,CAAA,KAAA,EAAA,EAAA,GAAS,gBAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAA,QAAA,EACtD,QAAQ,GACL,EAAA,CACU,EAAA,CACY,EAAA,CACP;IAE/B;;IAEA,QACEA,IAAC,eAAe,EAAA,EACd,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,IAAI,EAAA,QAAA,EACF,MAAM,EAAA,CACd;AAEN;;;;"}
@@ -37,6 +37,19 @@ const styleFactory = (css) => ({
37
37
  marginBottom: 0,
38
38
  marginTop: 0,
39
39
  }),
40
+ slotColumnStyle: css({
41
+ flexDirection: "column",
42
+ gap: "4px",
43
+ }),
44
+ slotDropText: css({
45
+ display: "inline-flex",
46
+ alignItems: "center",
47
+ gap: "4px",
48
+ }),
49
+ slotHintStyle: css({
50
+ textAlign: "center",
51
+ margin: 0,
52
+ }),
40
53
  rendererErrorComponent: css({
41
54
  boxSizing: "border-box",
42
55
  backgroundColor: "#fff0ed",
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../src/components/styles.ts"],"sourcesContent":["import { css as gooberCss } from \"goober\";\n\nexport const styleFactory = (css: typeof gooberCss) => ({\n embedStyle: css({\n height: \"100%\",\n width: \"100%\",\n display: \"grid\",\n placeItems: \"center\",\n padding: \"1rem\",\n border: \"1px solid #dde3ee\",\n }),\n embedIconStyle: css({\n opacity: 0.5,\n }),\n pageStyle: css({\n height: \"100%\",\n }),\n slotStyle: css({\n boxSizing: \"border-box\",\n // width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n gap: \"4px\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"1px dashed #6c5ce7\",\n color: \"#475161\",\n fontSize: \"14px\",\n fontStyle: \"normal\",\n fontWeight: 400,\n lineHeight: \"24px\",\n userSelect: \"none\",\n fontFamily: \"Inter\",\n paddingInline: \"2rem\",\n paddingBlock: \"1rem\",\n transition: \"background-color 0.3s ease\",\n }),\n slotContentStyle: css({\n marginBottom: 0,\n marginTop: 0,\n }),\n rendererErrorComponent: css({\n boxSizing: \"border-box\",\n backgroundColor: \"#fff0ed\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"#fdafa3\",\n boxShadow: `0px 2px 4px rgba(0, 0, 0, 0.14),\n 0px 5px 5px rgba(0, 0, 0, 0.12),\n 0px 1px 10px rgba(108, 92, 231, 0.2)`,\n borderRadius: \"4px\",\n padding: \"1rem\",\n color: \"#475161\",\n fontFamily: \"Inter, sans-serif\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"1rem\",\n \".header\": {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"0.5rem\",\n },\n h3: {\n fontSize: \"14px\",\n fontWeight: 600,\n margin: 0,\n },\n p: {\n fontSize: \"1rem\",\n fontWeight: 400,\n lineHeight: \"24px\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E,KAAK;AAClB,QAAA,WAAW,EAAE,OAAO;AACpB,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,SAAS,EAAE,CAAA;;AAE4B,0CAAA,CAAA;AACvC,QAAA,YAAY,EAAE,KAAK;AACnB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,UAAU,EAAE,mBAAmB;AAC/B,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,GAAG,EAAE,MAAM;AACX,QAAA,SAAS,EAAE;AACT,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,GAAG,EAAE,QAAQ;AACd,SAAA;AACD,QAAA,EAAE,EAAE;AACF,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,UAAU,EAAE,GAAG;AACf,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACD,QAAA,CAAC,EAAE;AACD,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,UAAU,EAAE,GAAG;AACf,YAAA,UAAU,EAAE,MAAM;AAClB,YAAA,aAAa,EAAE,IAAI;AACnB,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;KACF,CAAC;AACH,CAAA;;;;"}
1
+ {"version":3,"file":"styles.js","sources":["../../src/components/styles.ts"],"sourcesContent":["import { css as gooberCss } from \"goober\";\n\nexport const styleFactory = (css: typeof gooberCss) => ({\n embedStyle: css({\n height: \"100%\",\n width: \"100%\",\n display: \"grid\",\n placeItems: \"center\",\n padding: \"1rem\",\n border: \"1px solid #dde3ee\",\n }),\n embedIconStyle: css({\n opacity: 0.5,\n }),\n pageStyle: css({\n height: \"100%\",\n }),\n slotStyle: css({\n boxSizing: \"border-box\",\n // width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n gap: \"4px\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"1px dashed #6c5ce7\",\n color: \"#475161\",\n fontSize: \"14px\",\n fontStyle: \"normal\",\n fontWeight: 400,\n lineHeight: \"24px\",\n userSelect: \"none\",\n fontFamily: \"Inter\",\n paddingInline: \"2rem\",\n paddingBlock: \"1rem\",\n transition: \"background-color 0.3s ease\",\n }),\n slotContentStyle: css({\n marginBottom: 0,\n marginTop: 0,\n }),\n slotColumnStyle: css({\n flexDirection: \"column\",\n gap: \"4px\",\n }),\n slotDropText: css({\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n }),\n slotHintStyle: css({\n textAlign: \"center\",\n margin: 0,\n }),\n rendererErrorComponent: css({\n boxSizing: \"border-box\",\n backgroundColor: \"#fff0ed\",\n borderWidth: \"1px\",\n borderStyle: \"solid\",\n borderColor: \"#fdafa3\",\n boxShadow: `0px 2px 4px rgba(0, 0, 0, 0.14),\n 0px 5px 5px rgba(0, 0, 0, 0.12),\n 0px 1px 10px rgba(108, 92, 231, 0.2)`,\n borderRadius: \"4px\",\n padding: \"1rem\",\n color: \"#475161\",\n fontFamily: \"Inter, sans-serif\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"1rem\",\n \".header\": {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"0.5rem\",\n },\n h3: {\n fontSize: \"14px\",\n fontWeight: 600,\n margin: 0,\n },\n p: {\n fontSize: \"1rem\",\n fontWeight: 400,\n lineHeight: \"24px\",\n letterSpacing: \"1%\",\n margin: 0,\n },\n }),\n});\n"],"names":[],"mappings":"MAEa,YAAY,GAAG,CAAC,GAAqB,MAAM;IACtD,UAAU,EAAE,GAAG,CAAC;AACd,QAAA,MAAM,EAAE,MAAM;AACd,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,MAAM,EAAE,mBAAmB;KAC5B,CAAC;IACF,cAAc,EAAE,GAAG,CAAC;AAClB,QAAA,OAAO,EAAE,GAAG;KACb,CAAC;IACF,SAAS,EAA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AACtB,QAAA,SAAS,EAAE,CAAA;;AAE4B,0CAAA,CAAA;AACvC,QAAA,YAAY,EAAE,KAAK;AACnB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,UAAU,EAAE,mBAAmB;AAC/B,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,aAAa,EAAE,QAAQ;AACvB,QAAA,GAAG,EAAE,MAAM;AACX,QAAA,SAAS,EAAE;AACT,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,GAAG,EAAE,QAAQ;AACd,SAAA;AACD,QAAA,EAAE,EAAE;AACF,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,UAAU,EAAE,GAAG;AACf,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACD,QAAA,CAAC,EAAE;AACD,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,UAAU,EAAE,GAAG;AACf,YAAA,UAAU,EAAE,MAAM;AAClB,YAAA,aAAa,EAAE,IAAI;AACnB,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;KACF,CAAC;AACH,CAAA;;;;"}
@@ -1,4 +1,4 @@
1
- import { isCompositionBeingEdited, addHighlightNodeEventListeners, addHighlightSpacingEventListeners, addContextMenuEventListeners, addBreakpointEventListeners, dndEventListener, updateStyleOnStyleNodeChange, hiddenElementNotificationEventEmitter, getNodeScreenshotEvent, isInsideVisualBuilderFrame, compositionSaveEventListener } from '@contentstack/studio-client';
1
+ import { isCompositionBeingEdited, addHighlightNodeEventListeners, addUrlChangeListeners, addHighlightSpacingEventListeners, addContextMenuEventListeners, addBreakpointEventListeners, dndEventListener, updateStyleOnStyleNodeChange, hiddenElementNotificationEventEmitter, getNodeScreenshotEvent, isInsideVisualBuilderFrame, compositionSaveEventListener } from '@contentstack/studio-client';
2
2
  import { useEffect } from 'react';
3
3
 
4
4
  const useCanvasEvents = (composableUid) => {
@@ -7,6 +7,7 @@ const useCanvasEvents = (composableUid) => {
7
7
  if (!isCompositionBeingEdited(composableUid || ""))
8
8
  return;
9
9
  const highlightNodeEventListener = addHighlightNodeEventListeners();
10
+ const urlChangeEventListener = addUrlChangeListeners();
10
11
  const highlightSpacingEventListener = addHighlightSpacingEventListeners();
11
12
  const contextMenuEventListener = addContextMenuEventListeners();
12
13
  const breakpointEventListener = addBreakpointEventListeners();
@@ -16,6 +17,7 @@ const useCanvasEvents = (composableUid) => {
16
17
  const getNodeScreenshotEventListener = getNodeScreenshotEvent();
17
18
  return () => {
18
19
  highlightNodeEventListener?.removeEventListeners();
20
+ urlChangeEventListener?.removeEventListeners();
19
21
  highlightSpacingEventListener?.removeEventListeners();
20
22
  contextMenuEventListener?.removeEventListeners();
21
23
  breakpointEventListener?.removeEventListeners();
@@ -1 +1 @@
1
- {"version":3,"file":"use-canvas-events.hook.js","sources":["../../src/hooks/use-canvas-events.hook.ts"],"sourcesContent":["import {\n addBreakpointEventListeners,\n addContextMenuEventListeners,\n addHighlightNodeEventListeners,\n addHighlightSpacingEventListeners,\n compositionSaveEventListener,\n dndEventListener,\n getNodeScreenshotEvent,\n hiddenElementNotificationEventEmitter,\n isCompositionBeingEdited,\n isInsideVisualBuilderFrame,\n updateStyleOnStyleNodeChange,\n} from \"@contentstack/studio-client\";\nimport { useEffect } from \"react\";\n\nexport const useCanvasEvents = (composableUid?: string) => {\n // HOOK TO ADD HIGHLIGHT NODE EVENT LISTENERS\n useEffect(() => {\n if (!isCompositionBeingEdited(composableUid || \"\")) return;\n const highlightNodeEventListener = addHighlightNodeEventListeners();\n const highlightSpacingEventListener = addHighlightSpacingEventListeners();\n const contextMenuEventListener = addContextMenuEventListeners();\n const breakpointEventListener = addBreakpointEventListeners();\n const dndListener = dndEventListener();\n const updatedStyleEventListener = updateStyleOnStyleNodeChange();\n const hiddenElementNotificationEventListener =\n hiddenElementNotificationEventEmitter();\n const getNodeScreenshotEventListener = getNodeScreenshotEvent();\n\n return () => {\n highlightNodeEventListener?.removeEventListeners();\n highlightSpacingEventListener?.removeEventListeners();\n contextMenuEventListener?.removeEventListeners();\n breakpointEventListener?.removeEventListeners();\n dndListener?.removeEventListeners();\n updatedStyleEventListener?.removeEventListeners();\n hiddenElementNotificationEventListener?.unregister();\n getNodeScreenshotEventListener?.unregister();\n };\n }, [composableUid]);\n\n useEffect(() => {\n if (!isInsideVisualBuilderFrame()) return;\n const cleanup = compositionSaveEventListener();\n return () => {\n cleanup?.unregister();\n };\n }, []);\n};\n"],"names":[],"mappings":";;;AAeO,MAAM,eAAe,GAAG,CAAC,aAAsB,KAAI;;IAExD,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,wBAAwB,CAAC,aAAa,IAAI,EAAE,CAAC;YAAE;AACpD,QAAA,MAAM,0BAA0B,GAAG,8BAA8B,EAAE;AACnE,QAAA,MAAM,6BAA6B,GAAG,iCAAiC,EAAE;AACzE,QAAA,MAAM,wBAAwB,GAAG,4BAA4B,EAAE;AAC/D,QAAA,MAAM,uBAAuB,GAAG,2BAA2B,EAAE;AAC7D,QAAA,MAAM,WAAW,GAAG,gBAAgB,EAAE;AACtC,QAAA,MAAM,yBAAyB,GAAG,4BAA4B,EAAE;AAChE,QAAA,MAAM,sCAAsC,GAC1C,qCAAqC,EAAE;AACzC,QAAA,MAAM,8BAA8B,GAAG,sBAAsB,EAAE;AAE/D,QAAA,OAAO,MAAK;YACV,0BAA0B,EAAE,oBAAoB,EAAE;YAClD,6BAA6B,EAAE,oBAAoB,EAAE;YACrD,wBAAwB,EAAE,oBAAoB,EAAE;YAChD,uBAAuB,EAAE,oBAAoB,EAAE;YAC/C,WAAW,EAAE,oBAAoB,EAAE;YACnC,yBAAyB,EAAE,oBAAoB,EAAE;YACjD,sCAAsC,EAAE,UAAU,EAAE;YACpD,8BAA8B,EAAE,UAAU,EAAE;AAC9C,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;IAEnB,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,0BAA0B,EAAE;YAAE;AACnC,QAAA,MAAM,OAAO,GAAG,4BAA4B,EAAE;AAC9C,QAAA,OAAO,MAAK;YACV,OAAO,EAAE,UAAU,EAAE;AACvB,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;AACR;;;;"}
1
+ {"version":3,"file":"use-canvas-events.hook.js","sources":["../../src/hooks/use-canvas-events.hook.ts"],"sourcesContent":["import {\n addBreakpointEventListeners,\n addContextMenuEventListeners,\n addHighlightNodeEventListeners,\n addHighlightSpacingEventListeners,\n addUrlChangeListeners,\n compositionSaveEventListener,\n dndEventListener,\n getNodeScreenshotEvent,\n hiddenElementNotificationEventEmitter,\n isCompositionBeingEdited,\n isInsideVisualBuilderFrame,\n updateStyleOnStyleNodeChange,\n} from \"@contentstack/studio-client\";\nimport { useEffect } from \"react\";\n\nexport const useCanvasEvents = (composableUid?: string) => {\n // HOOK TO ADD HIGHLIGHT NODE EVENT LISTENERS\n useEffect(() => {\n if (!isCompositionBeingEdited(composableUid || \"\")) return;\n const highlightNodeEventListener = addHighlightNodeEventListeners();\n const urlChangeEventListener = addUrlChangeListeners();\n const highlightSpacingEventListener = addHighlightSpacingEventListeners();\n const contextMenuEventListener = addContextMenuEventListeners();\n const breakpointEventListener = addBreakpointEventListeners();\n const dndListener = dndEventListener();\n const updatedStyleEventListener = updateStyleOnStyleNodeChange();\n const hiddenElementNotificationEventListener =\n hiddenElementNotificationEventEmitter();\n const getNodeScreenshotEventListener = getNodeScreenshotEvent();\n\n return () => {\n highlightNodeEventListener?.removeEventListeners();\n urlChangeEventListener?.removeEventListeners();\n highlightSpacingEventListener?.removeEventListeners();\n contextMenuEventListener?.removeEventListeners();\n breakpointEventListener?.removeEventListeners();\n dndListener?.removeEventListeners();\n updatedStyleEventListener?.removeEventListeners();\n hiddenElementNotificationEventListener?.unregister();\n getNodeScreenshotEventListener?.unregister();\n };\n }, [composableUid]);\n\n useEffect(() => {\n if (!isInsideVisualBuilderFrame()) return;\n const c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AAE,CAAC;AACR;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/studio-react-editor",
3
- "version": "1.1.4",
3
+ "version": "1.3.0",
4
4
  "description": "Contains all logic of editing for react based environment",
5
5
  "author": "RavenColEvol <ravilamkoti@gmail.com>",
6
6
  "homepage": "https://github.com/contentstack/composable-studio-sdk#readme",
@@ -42,7 +42,7 @@
42
42
  "@contentstack/common-config": "1.0.2",
43
43
  "@rollup/plugin-commonjs": "^28.0.6",
44
44
  "@rollup/plugin-node-resolve": "^16.0.1",
45
- "@rollup/plugin-terser": "^0.4.4",
45
+ "@rollup/plugin-terser": "^1.0.0",
46
46
  "@rollup/plugin-typescript": "^12.1.4",
47
47
  "@types/lodash": "^4.17.5",
48
48
  "@types/react": "^18.3.5",
@@ -60,17 +60,17 @@
60
60
  "typescript": "^5.2.2"
61
61
  },
62
62
  "dependencies": {
63
- "@contentstack/studio-client": "^1.3.0",
64
- "@contentstack/studio-core": "^1.1.4",
65
- "@contentstack/studio-internal": "^1.1.4",
66
- "@contentstack/studio-messenger": "^1.1.4",
67
- "@contentstack/studio-react-components": "^1.4.0",
68
- "@contentstack/studio-registry": "^1.2.1",
63
+ "@contentstack/studio-client": "^1.5.0",
64
+ "@contentstack/studio-core": "^1.1.6",
65
+ "@contentstack/studio-internal": "^1.2.0",
66
+ "@contentstack/studio-messenger": "^1.3.0",
67
+ "@contentstack/studio-react-components": "^1.5.0",
68
+ "@contentstack/studio-registry": "^1.4.0",
69
69
  "classnames": "^2.5.1",
70
70
  "goober": "^2.1.16",
71
71
  "immer": "^10.1.1",
72
72
  "lodash-es": "^4.17.23",
73
73
  "react-error-boundary": "^6.0.0"
74
74
  },
75
- "gitHead": "a8df12b115d554e3c69b5fcd5972197d92b1f558"
75
+ "gitHead": "9ff4f8381cb17d0e06ad91be106e1f4628de55fd"
76
76
  }