@contentstack/studio-react-editor 1.7.0-alpha-20260721T1325-1838437.0 → 1.8.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.
Files changed (45) hide show
  1. package/dist/components/EditableRenderer.js +6 -19
  2. package/dist/components/EditableRenderer.js.map +1 -1
  3. package/dist/components/Element.js +36 -21
  4. package/dist/components/Element.js.map +1 -1
  5. package/dist/components/PreviewRenderer.js +0 -19
  6. package/dist/components/PreviewRenderer.js.map +1 -1
  7. package/dist/components/WelcomeState.js +1 -17
  8. package/dist/components/WelcomeState.js.map +1 -1
  9. package/dist/components/elements/ConditionBlock.js +2 -15
  10. package/dist/components/elements/ConditionBlock.js.map +1 -1
  11. package/dist/components/elements/Repeater.js +1 -15
  12. package/dist/components/elements/Repeater.js.map +1 -1
  13. package/dist/components/elements/SectionSlot.js +59 -2
  14. package/dist/components/elements/SectionSlot.js.map +1 -1
  15. package/dist/components/styles.js +69 -0
  16. package/dist/components/styles.js.map +1 -1
  17. package/dist/hooks/use-active-node-path.hook.js +0 -19
  18. package/dist/hooks/use-active-node-path.hook.js.map +1 -1
  19. package/dist/hooks/use-condition-block-context.js +0 -20
  20. package/dist/hooks/use-condition-block-context.js.map +1 -1
  21. package/dist/hooks/use-design-preview.hook.js +0 -20
  22. package/dist/hooks/use-design-preview.hook.js.map +1 -1
  23. package/dist/hooks/use-preview-mode.hook.js +0 -20
  24. package/dist/hooks/use-preview-mode.hook.js.map +1 -1
  25. package/dist/hooks/use-register-section.hook.js +0 -1
  26. package/dist/hooks/use-register-section.hook.js.map +1 -1
  27. package/dist/hooks/use-renderer.hook.js +0 -20
  28. package/dist/hooks/use-renderer.hook.js.map +1 -1
  29. package/dist/hooks/use-repeater.hook.js +0 -20
  30. package/dist/hooks/use-repeater.hook.js.map +1 -1
  31. package/dist/hooks/use-should-show-design.hook.js +1 -20
  32. package/dist/hooks/use-should-show-design.hook.js.map +1 -1
  33. package/dist/hooks/use-spec-data-listener.hook.js +55 -10
  34. package/dist/hooks/use-spec-data-listener.hook.js.map +1 -1
  35. package/package.json +12 -13
  36. package/dist/components/elements/Symbol.js +0 -65
  37. package/dist/components/elements/Symbol.js.map +0 -1
  38. package/dist/contexts/providers/symbol-ui.provider.js +0 -88
  39. package/dist/contexts/providers/symbol-ui.provider.js.map +0 -1
  40. package/dist/hooks/use-register-symbol.hook.js +0 -54
  41. package/dist/hooks/use-register-symbol.hook.js.map +0 -1
  42. package/dist/hooks/use-symbol-events.hook.js +0 -45
  43. package/dist/hooks/use-symbol-events.hook.js.map +0 -1
  44. package/dist/hooks/use-symbol-ui-listener.hook.js +0 -17
  45. package/dist/hooks/use-symbol-ui-listener.hook.js.map +0 -1
@@ -6,24 +6,16 @@ import { useDataWithSpec } from '@contentstack/studio-react-components/hooks';
6
6
  import { SectionCompositionProvider } from '@contentstack/studio-react-components/basic-components';
7
7
  import { INTERNAL_COMPONENTS_NAMES } from '@contentstack/studio-registry';
8
8
  import { useState, useMemo, useEffect, useCallback } from 'react';
9
- import { RendererProvider } from '../contexts/providers/renderer.provider.js';
10
- import { EditContextProvider } from '../contexts/providers/edit-context.provider.js';
11
9
  import { ActiveComponentPathContext } from '../contexts/providers/active-node.provider.js';
12
- import { SymbolUIProvider } from '../contexts/providers/symbol-ui.provider.js';
13
- import '../contexts/providers/use-design-preview.provider.js';
14
- import '../contexts/providers/use-repeater.provider.js';
15
- import '../contexts/providers/use-condition-block.provider.js';
16
- import '../contexts/providers/preview-mode.provider.js';
17
- import '../contexts/providers/section-mode.provider.js';
10
+ import { EditContextProvider } from '../contexts/providers/edit-context.provider.js';
11
+ import { RendererProvider } from '../contexts/providers/renderer.provider.js';
18
12
  import { useCanvasEvents } from '../hooks/use-canvas-events.hook.js';
19
13
  import { useEditContextListener } from '../hooks/use-edit-context-listener.hook.js';
20
- import { useSectionEvents } from '../hooks/use-section-events.hook.js';
21
- import { useRegisterSectionComponents } from '../hooks/use-register-section.hook.js';
22
- import { Symbol } from './elements/Symbol.js';
23
14
  import { useGetActiveComponentPathContext } from '../hooks/use-active-node-path.hook.js';
15
+ import { useSectionEvents } from '../hooks/use-section-events.hook.js';
24
16
  import { useSpecDataListener } from '../hooks/use-spec-data-listener.hook.js';
17
+ import { useRegisterSectionComponents } from '../hooks/use-register-section.hook.js';
25
18
  import { useStaticValuesListener } from '../hooks/use-static-values-listener.hook.js';
26
- import { useSymbolsEvents } from '../hooks/use-symbol-events.hook.js';
27
19
  import MemoizedElement from './Element.js';
28
20
  import { RenderErrorHOC } from './RenderErrorHOC.js';
29
21
  import { Repeater } from './elements/Repeater.js';
@@ -32,7 +24,7 @@ import { SectionSlot } from './elements/SectionSlot.js';
32
24
 
33
25
  function EditableRendererHOC(props) {
34
26
  const { spec, componentRegistry } = props;
35
- return (jsx(RendererProvider, { spec: spec, componentRegistry: componentRegistry, children: jsx(SymbolUIProvider, { symbols: spec.symbols || [], children: jsx(EditableRenderer, { ...props }) }) }));
27
+ return (jsx(RendererProvider, { spec: spec, componentRegistry: componentRegistry, children: jsx(EditableRenderer, { ...props }) }));
36
28
  }
37
29
  function EditableRenderer({ spec: initialSpec, data: stateData, componentRegistry, renderError, }) {
38
30
  const [spec, setSpec] = useState(initialSpec);
@@ -42,10 +34,9 @@ function EditableRenderer({ spec: initialSpec, data: stateData, componentRegistr
42
34
  useSpecDataListener(setSpec, spec, composableUid);
43
35
  const { dataStepMode } = useEditContextListener(composableUid);
44
36
  useStaticValuesListener(setSpec, spec, composableUid);
45
- useSymbolsEvents(setSpec, spec, composableUid);
46
37
  useSectionEvents(setSpec, spec, composableUid);
47
38
  useRegisterSectionComponents(spec.sectionCompositions || []);
48
- // Swap basic (preview-only) Repeater/ConditionBlock/Symbol with their
39
+ // Swap basic (preview-only) Repeater/ConditionBlock with their
49
40
  // editor-aware versions BEFORE the first render. Doing this in useEffect
50
41
  // would let the basic Repeater render once (iterating items + injecting
51
42
  // `dataSources.repeater[uid].context`) before being replaced — visible
@@ -63,10 +54,6 @@ function EditableRenderer({ spec: initialSpec, data: stateData, componentRegistr
63
54
  type: INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK,
64
55
  component: ConditionBlock,
65
56
  },
66
- {
67
- type: INTERNAL_COMPONENTS_NAMES.SYMBOL,
68
- component: Symbol,
69
- },
70
57
  {
71
58
  type: INTERNAL_COMPONENTS_NAMES.SECTION_SLOT,
72
59
  component: SectionSlot,
@@ -1 +1 @@
1
- {"version":3,"file":"EditableRenderer.js","sources":["../../src/components/EditableRenderer.tsx"],"sourcesContent":["import {\n StudioSpec,\n isCompositionBeingEdited,\n clientRendererModeUtil,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n} from \"@contentstack/studio-client\";\nimport {\n composableStudioEventManager,\n POST_MESSAGE_EVENTS,\n} from \"@contentstack/studio-messenger\";\nimport { DataCtxProvider } from \"@contentstack/studio-react-components/contexts\";\nimport { useDataWithSpec } from \"@contentstack/studio-react-components/hooks\";\nimport { SectionCompositionProvider } from \"@contentstack/studio-react-components/basic-components\";\nimport {\n ComposableStudioData,\n INTERNAL_COMPONENTS_NAMES,\n} from \"@contentstack/studio-registry\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport {\n ActiveComponentPathContext,\n EditContextProvider,\n RendererProvider,\n} from \"../contexts/providers\";\nimport { SymbolUIProvider } from \"../contexts/providers/symbol-ui.provider\";\nimport { useCanvasEvents, useEditContextListener } from \"../hooks\";\nimport { useGetActiveComponentPathContext } from \"../hooks/use-active-node-path.hook\";\nimport { useSectionEvents } from \"../hooks/use-section-events.hook\";\nimport { useSpecDataListener } from \"../hooks/use-spec-data-listener.hook\";\nimport { useRegisterSectionComponents } from \"../hooks/use-register-section.hook\";\nimport { useStaticValuesListener } from \"../hooks/use-static-values-listener.hook\";\nimport { useSymbolsEvents } from \"../hooks/use-symbol-events.hook\";\nimport { ComponentRegistryType } from \"../types\";\nimport Element from \"./Element\";\nimport { RenderErrorHOC } from \"./RenderErrorHOC\";\nimport { ConditionBlock, Repeater, SectionSlot, Symbol } from \"./elements\";\n\ninterface EditableRendererHOCProps {\n spec: StudioSpec;\n data: ComposableStudioData;\n componentRegistry: ComponentRegistryType;\n renderError: (props: { error: Error }) => JSX.Element;\n}\n\nexport default function EditableRendererHOC(\n props: EditableRendererHOCProps & { children: React.ReactNode },\n) {\n const { spec, componentRegistry } = props;\n return (\n <RendererProvider spec={spec} componentRegistry={componentRegistry}>\n <SymbolUIProvider symbols={spec.symbols || []}>\n <EditableRenderer {...props} />\n </SymbolUIProvider>\n </RendererProvider>\n );\n}\n\ninterface EditableRendererProps {\n spec: StudioSpec;\n data: ComposableStudioData;\n componentRegistry: ComponentRegistryType;\n renderError: (props: { error: Error }) => JSX.Element;\n}\n\nfunction EditableRenderer({\n spec: initialSpec,\n data: stateData,\n componentRegistry,\n renderError,\n}: EditableRendererProps): JSX.Element {\n const [spec, setSpec] = useState<StudioSpec>(initialSpec);\n const composableUid = spec?.compositionEntry?.composable_uid ?? \"\";\n const isCompositionEdited = isCompositionBeingEdited(composableUid);\n useCanvasEvents(composableUid);\n useSpecDataListener(setSpec, spec, composableUid);\n const { dataStepMode } = useEditContextListener(composableUid);\n useStaticValuesListener(setSpec, spec, composableUid);\n useSymbolsEvents(setSpec, spec, composableUid);\n useSectionEvents(setSpec, spec, composableUid);\n useRegisterSectionComponents(spec.sectionCompositions || []);\n // Swap basic (preview-only) Repeater/ConditionBlock/Symbol with their\n // editor-aware versions BEFORE the first render. Doing this in useEffect\n // would let the basic Repeater render once (iterating items + injecting\n // `dataSources.repeater[uid].context`) before being replaced — visible\n // as a one-frame flicker for sections inside the Repeater whose scope\n // jumps from REPEATER_ITEM to the design-mode passthrough.\n // useMemo runs during the render phase, so the registry is updated before\n // any child component renders.\n useMemo(() => {\n componentRegistry.updateComponents([\n {\n type: INTERNAL_COMPONENTS_NAMES.REPEATER,\n component: Repeater,\n },\n {\n type: INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK,\n component: ConditionBlock,\n },\n {\n type: INTERNAL_COMPONENTS_NAMES.SYMBOL,\n component: Symbol,\n },\n {\n type: INTERNAL_COMPONENTS_NAMES.SECTION_SLOT,\n component: SectionSlot,\n },\n ]);\n return null;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const data: ComposableStudioData = useDataWithSpec(spec, stateData);\n const activeComponentPathContext = useGetActiveComponentPathContext(spec);\n\n useEffect(() => {\n // 🎯 STUDIO CONTEXT CHECK: Only send postMessage when inside Studio, not standalone\n const shouldSendStudioEvents =\n isCompositionEdited && clientRendererModeUtil.isInsideStudioFrame();\n if (!shouldSendStudioEvents) return;\n\n composableStudioEventManager\n ?.send(POST_MESSAGE_EVENTS.GET_COMPONENT_PROPS, data)\n .catch((error: any) => {\n console.error(\"Error while setting component props.\", error);\n });\n }, [data, isCompositionEdited]);\n\n // * When we render the components, we set the parent and path for the nodes,\n // * However, the root node and the page node are not set during the render.\n // * Hence, we set the parent and path for the root and page node here.\n useMemo(() => {\n if (!spec || !isCompositionEdited) return;\n const rootNode = spec.ui;\n if (!rootNode || !rootNode.slots) return;\n\n const rootSlotUid = Object.keys(rootNode.slots)[0];\n if (!rootSlotUid || !rootNode.slots[rootSlotUid]) return;\n\n const pageNode = rootNode.slots[rootSlotUid][0];\n if (!pageNode) return;\n\n NODE_TO_PARENT.set(rootNode, undefined);\n NODE_TO_PARENT.set(pageNode, rootNode);\n NODE_TO_PATH_NODE.set(pageNode, [rootSlotUid, 0]);\n }, [spec, isCompositionEdited]);\n const renderErrorComponent = useCallback(({ error }: { error: Error }) => {\n return <RenderErrorHOC error={error} renderError={renderError} />;\n }, []);\n\n const isSection = spec.compositionEntry?.place_composition_as === \"section\";\n const compositionUid = spec.compositionEntry?.uid;\n\n return (\n <ActiveComponentPathContext.Provider value={activeComponentPathContext}>\n <EditContextProvider value={{ dataStepMode }}>\n <DataCtxProvider value={data}>\n {isSection && compositionUid ? (\n <SectionCompositionProvider uid={compositionUid}>\n <Element node={spec.ui} renderError={renderErrorComponent} />\n </SectionCompositionProvider>\n ) : (\n <Element node={spec.ui} renderError={renderErrorComponent} />\n )}\n </DataCtxProvider>\n </EditContextProvider>\n </ActiveComponentPathContext.Provider>\n );\n}\n"],"names":["_jsx","Element"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Cc,SAAU,mBAAmB,CACzC,KAA+D,EAAA;AAE/D,IAAA,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,KAAK;AACzC,IAAA,QACEA,GAAA,CAAC,gBAAgB,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EAChEA,IAAC,gBAAgB,EAAA,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,EAAA,QAAA,EAC3CA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI,EAAA,CACd,EAAA,CACF;AAEvB;AASA,SAAS,gBAAgB,CAAC,EACxB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,EACjB,WAAW,GACW,EAAA;IACtB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAa,WAAW,CAAC;IACzD,MAAM,aAAa,GAAG,IAAI,EAAE,gBAAgB,EAAE,cAAc,IAAI,EAAE;AAClE,IAAA,MAAM,mBAAmB,GAAG,wBAAwB,CAAC,aAAa,CAAC;IACnE,eAAe,CAAC,aAAa,CAAC;AAC9B,IAAA,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC;IACjD,MAAM,EAAE,YAAY,EAAE,GAAG,sBAAsB,CAAC,aAAa,CAAC;AAC9D,IAAA,uBAAuB,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC;AACrD,IAAA,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC;AAC9C,IAAA,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE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,GAAA,CAAC,0BAA0B,IAAC,GAAG,EAAE,cAAc,EAAA,QAAA,EAC7CA,IAACC,eAAO,EAAA,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAA,CAAI,EAAA,CAClC,KAE7BD,GAAA,CAACC,eAAO,EAAA,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAA,CAAI,CAC9D,GACe,EAAA,CACE,EAAA,CACc;AAE1C;;;;"}
1
+ {"version":3,"file":"EditableRenderer.js","sources":["../../src/components/EditableRenderer.tsx"],"sourcesContent":["import {\n StudioSpec,\n isCompositionBeingEdited,\n clientRendererModeUtil,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n} from \"@contentstack/studio-client\";\nimport {\n composableStudioEventManager,\n POST_MESSAGE_EVENTS,\n} from \"@contentstack/studio-messenger\";\nimport { DataCtxProvider } from \"@contentstack/studio-react-components/contexts\";\nimport { useDataWithSpec } from \"@contentstack/studio-react-components/hooks\";\nimport { SectionCompositionProvider } from \"@contentstack/studio-react-components/basic-components\";\nimport {\n ComposableStudioData,\n INTERNAL_COMPONENTS_NAMES,\n} from \"@contentstack/studio-registry\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { ActiveComponentPathContext } from \"../contexts/providers/active-node.provider\";\nimport { EditContextProvider } from \"../contexts/providers/edit-context.provider\";\nimport { RendererProvider } from \"../contexts/providers/renderer.provider\";\nimport { useCanvasEvents } from \"../hooks/use-canvas-events.hook\";\nimport { useEditContextListener } from \"../hooks/use-edit-context-listener.hook\";\nimport { useGetActiveComponentPathContext } from \"../hooks/use-active-node-path.hook\";\nimport { useSectionEvents } from \"../hooks/use-section-events.hook\";\nimport { useSpecDataListener } from \"../hooks/use-spec-data-listener.hook\";\nimport { useRegisterSectionComponents } from \"../hooks/use-register-section.hook\";\nimport { useStaticValuesListener } from \"../hooks/use-static-values-listener.hook\";\nimport { ComponentRegistryType } from \"../types\";\nimport Element from \"./Element\";\nimport { RenderErrorHOC } from \"./RenderErrorHOC\";\nimport { ConditionBlock, Repeater, SectionSlot } from \"./elements\";\n\ninterface EditableRendererHOCProps {\n spec: StudioSpec;\n data: ComposableStudioData;\n componentRegistry: ComponentRegistryType;\n renderError: (props: { error: Error }) => JSX.Element;\n}\n\nexport default function EditableRendererHOC(\n props: EditableRendererHOCProps & { children: React.ReactNode },\n) {\n const { spec, componentRegistry } = props;\n return (\n <RendererProvider spec={spec} componentRegistry={componentRegistry}>\n <EditableRenderer {...props} />\n </RendererProvider>\n );\n}\n\ninterface EditableRendererProps {\n spec: StudioSpec;\n data: ComposableStudioData;\n componentRegistry: ComponentRegistryType;\n renderError: (props: { error: Error }) => JSX.Element;\n}\n\nfunction EditableRenderer({\n spec: initialSpec,\n data: stateData,\n componentRegistry,\n renderError,\n}: EditableRendererProps): JSX.Element {\n const [spec, setSpec] = useState<StudioSpec>(initialSpec);\n const composableUid = spec?.compositionEntry?.composable_uid ?? \"\";\n const isCompositionEdited = isCompositionBeingEdited(composableUid);\n useCanvasEvents(composableUid);\n useSpecDataListener(setSpec, spec, composableUid);\n const { dataStepMode } = useEditContextListener(composableUid);\n useStaticValuesListener(setSpec, spec, composableUid);\n useSectionEvents(setSpec, spec, composableUid);\n useRegisterSectionComponents(spec.sectionCompositions || []);\n // Swap basic (preview-only) Repeater/ConditionBlock with their\n // editor-aware versions BEFORE the first render. Doing this in useEffect\n // would let the basic Repeater render once (iterating items + injecting\n // `dataSources.repeater[uid].context`) before being replaced — visible\n // as a one-frame flicker for sections inside the Repeater whose scope\n // jumps from REPEATER_ITEM to the design-mode passthrough.\n // useMemo runs during the render phase, so the registry is updated before\n // any child component renders.\n useMemo(() => {\n componentRegistry.updateComponents([\n {\n type: INTERNAL_COMPONENTS_NAMES.REPEATER,\n component: Repeater,\n },\n {\n type: INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK,\n component: ConditionBlock,\n },\n {\n type: INTERNAL_COMPONENTS_NAMES.SECTION_SLOT,\n component: SectionSlot,\n },\n ]);\n return null;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const data: ComposableStudioData = useDataWithSpec(spec, stateData);\n const activeComponentPathContext = useGetActiveComponentPathContext(spec);\n\n useEffect(() => {\n // 🎯 STUDIO CONTEXT CHECK: Only send postMessage when inside Studio, not standalone\n const shouldSendStudioEvents =\n isCompositionEdited && clientRendererModeUtil.isInsideStudioFrame();\n if (!shouldSendStudioEvents) return;\n\n composableStudioEventManager\n ?.send(POST_MESSAGE_EVENTS.GET_COMPONENT_PROPS, data)\n .catch((error: any) => {\n console.error(\"Error while setting component props.\", error);\n });\n }, [data, isCompositionEdited]);\n\n // * When we render the components, we set the parent and path for the nodes,\n // * However, the root node and the page node are not set during the render.\n // * Hence, we set the parent and path for the root and page node here.\n useMemo(() => {\n if (!spec || !isCompositionEdited) return;\n const rootNode = spec.ui;\n if (!rootNode || !rootNode.slots) return;\n\n const rootSlotUid = Object.keys(rootNode.slots)[0];\n if (!rootSlotUid || !rootNode.slots[rootSlotUid]) return;\n\n const pageNode = rootNode.slots[rootSlotUid][0];\n if (!pageNode) return;\n\n NODE_TO_PARENT.set(rootNode, undefined);\n NODE_TO_PARENT.set(pageNode, rootNode);\n NODE_TO_PATH_NODE.set(pageNode, [rootSlotUid, 0]);\n }, [spec, isCompositionEdited]);\n const renderErrorComponent = useCallback(({ error }: { error: Error }) => {\n return <RenderErrorHOC error={error} renderError={renderError} />;\n }, []);\n\n const isSection = spec.compositionEntry?.place_composition_as === \"section\";\n const compositionUid = spec.compositionEntry?.uid;\n\n return (\n <ActiveComponentPathContext.Provider value={activeComponentPathContext}>\n <EditContextProvider value={{ dataStepMode }}>\n <DataCtxProvider value={data}>\n {isSection && compositionUid ? (\n <SectionCompositionProvider uid={compositionUid}>\n <Element node={spec.ui} renderError={renderErrorComponent} />\n </SectionCompositionProvider>\n ) : (\n <Element node={spec.ui} renderError={renderErrorComponent} />\n )}\n </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, Fragment } from 'react/jsx-runtime';
2
2
  import { composableStudioEventEmitter, COMPOSABLE_STUDIO_EMITTED_EVENTS, ELEMENT_TO_NODE, NODE_TO_ELEMENT, loadGoogleFont, COMPOSABLE_DATA_ATTRIBUTES, getJSONRTE, NODE_TO_PATH_NODE, NODE_TO_PARENT } from '@contentstack/studio-client';
3
3
  import { handleNodeStyles, lightSdk, sdk } from '@contentstack/studio-core';
4
4
  import { SectionInstanceSlotsCtxProvider, CurrentNodeContext } from '@contentstack/studio-react-components/contexts';
5
- import { useData, useCurrentNode } from '@contentstack/studio-react-components/hooks';
6
- import { resolveMetadataBindings, clearReportedBindingErrorsForNode, getRepeaterBinding, getBindingString, getCslpTag, retrievePropValue, INTERNAL_COMPONENTS_NAMES } from '@contentstack/studio-registry';
5
+ import { useData, useNodeStateBindings, useNodeBoundFunctionName, useCurrentNode } from '@contentstack/studio-react-components/hooks';
6
+ import { resolveMetadataBindings, clearReportedBindingErrorsForNode, getRepeaterBinding, getBindingString, getCslpTag, wrapActionProps, retrievePropValue, callStudioFunction, INTERNAL_COMPONENTS_NAMES } from '@contentstack/studio-registry';
7
7
  import classNames from 'classnames';
8
- import { memo, useRef, useEffect, useCallback } from 'react';
8
+ import { memo, useMemo, useRef, useEffect, useCallback } from 'react';
9
9
  import { RendererErrorComponent } from './ErrorComponent.js';
10
10
  import { TextPlaceholder } from './TextPlaceholder.js';
11
11
  import { RendererErrorBoundary } from './RendererErrorBoundary.js';
12
12
  import { shouldRenderSlot } from '../utils/renderer.util.js';
13
13
  import Slot from './Slot.js';
14
- import '../hooks/use-edit-context-listener.hook.js';
15
- import '@contentstack/studio-messenger';
16
- import '@contentstack/studio-internal';
17
- import '@contentstack/studio-react-components/basic-components';
18
- import 'goober';
19
- import '../contexts/providers/renderer.provider.js';
20
- import '../contexts/providers/edit-context.provider.js';
21
- import '../contexts/providers/active-node.provider.js';
22
- import 'immer';
23
- import '../contexts/providers/use-design-preview.provider.js';
24
- import '../contexts/providers/use-repeater.provider.js';
25
- import '../contexts/providers/use-condition-block.provider.js';
26
- import '../contexts/providers/preview-mode.provider.js';
27
- import '../contexts/providers/section-mode.provider.js';
28
- import { useRenderer } from '../hooks/use-renderer.hook.js';
29
14
  import { usePreviewMode } from '../hooks/use-preview-mode.hook.js';
15
+ import { useRenderer } from '../hooks/use-renderer.hook.js';
30
16
  import { SelectedNodeProvider } from '../contexts/providers/selected-node.provider.js';
31
17
 
32
18
  const Element = ({ node, renderError, dataCslp, }) => {
33
19
  const isPreviewMode = usePreviewMode();
34
- const data = useData();
20
+ const pageData = useData();
21
+ // Canvas parity with the production renderer's BaseElement: declared state
22
+ // variables bound via component_props resolve from the shared BYOS state
23
+ // store. Per-node subscription — only this node re-renders when one of ITS
24
+ // bound state keys changes.
25
+ const stateSnapshot = useNodeStateBindings(node);
26
+ // Behavior assignment (BYOS): reactive — re-reads when the app registers
27
+ // functions (commonly after this node's first render).
28
+ const boundFunctionName = useNodeBoundFunctionName(node);
29
+ const data = useMemo(() => stateSnapshot
30
+ ? {
31
+ ...pageData,
32
+ component_props: {
33
+ ...pageData?.component_props,
34
+ ...stateSnapshot,
35
+ },
36
+ }
37
+ : pageData, [pageData, stateSnapshot]);
35
38
  const { attrs = {}, styles = {}, uid } = node;
36
39
  const { isCompositionBeingEdited, componentRegistry } = useRenderer();
37
40
  resolveMetadataBindings(node, data);
@@ -168,7 +171,7 @@ const Element = ({ node, renderError, dataCslp, }) => {
168
171
  }
169
172
  }
170
173
  }
171
- const resolvedProps = retrievePropValue({
174
+ const resolvedProps = wrapActionProps(componentOptions.props, retrievePropValue({
172
175
  data,
173
176
  defaultSlot: "I am a default slot", // TODO: this should be an component
174
177
  componentOptions: componentOptions,
@@ -185,12 +188,24 @@ const Element = ({ node, renderError, dataCslp, }) => {
185
188
  return (jsx(VisualComponent, { parent: parent, nodes: slots, slotUid: slotUid, renderError: renderError }));
186
189
  },
187
190
  isCompositionBeingEdited,
188
- });
191
+ }));
189
192
  const componentClass = classNames(resolvedProps.className, defaultResponsiveClass, attrs.className);
193
+ // Behavior assignment (BYOS): component_props binding whose key is a
194
+ // registered studio function → node click runs it (mirrors the live
195
+ // renderer; in edit mode the canvas overlay owns clicks, so this fires
196
+ // only in preview / interactive contexts).
190
197
  const attrsWithResponsiveClass = {
191
198
  ...attrs,
192
199
  ...namedResponsiveClasses,
193
200
  className: componentClass,
201
+ ...(boundFunctionName
202
+ ? {
203
+ onClick: (event) => {
204
+ attrs.onClick?.(event);
205
+ callStudioFunction(boundFunctionName);
206
+ },
207
+ }
208
+ : {}),
194
209
  };
195
210
  const WrapTag = typeof componentOptions.wrap === "string"
196
211
  ? componentOptions.wrap || "div"
@@ -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 {\n CurrentNodeContext,\n SectionInstanceSlotsCtxProvider,\n} from \"@contentstack/studio-react-components/contexts\";\nimport {\n useCurrentNode,\n useData,\n} from \"@contentstack/studio-react-components/hooks\";\nimport {\n clearReportedBindingErrorsForNode,\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 {\n memo,\n ReactNode,\n RefCallback,\n useCallback,\n useEffect,\n useRef,\n} 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 // Open method is optional - only components with _hiddenElementNotification: true need it\n console.debug(\n \"Open method not available on this component reference.\",\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 // Close method is optional - only components with _hiddenElementNotification: true need it\n console.debug(\n \"Close method not available on this component reference.\",\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 // When this node leaves the tree (or its uid changes), retract any binding-\n // mismatch errors we reported for it. retrievePropValue's in-render retraction\n // can only fire while the node still renders, so without this an unmounted\n // node's \"Data Mismatch Found\" badge would latch and its tracking entry leak.\n useEffect(() => {\n if (!isCompositionBeingEdited) return;\n return () => clearReportedBindingErrorsForNode(node.uid);\n }, [node.uid, isCompositionBeingEdited]);\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 // Node style extraction + Google-font side effect. These previously lived\n // inside the try below, AFTER the early `return null` for an unregistered\n // component — so the hook count varied between renders (\"Rendered more hooks\n // than during the previous render\") whenever a node's component wasn't\n // registered yet on the first paint, or `componentRegistry` was momentarily\n // absent. React requires hooks to be unconditional, so they run here before\n // ANY early return. handleNodeStyles is a pure style extractor (no hooks/SDK).\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 // Every hook above runs unconditionally; the early returns below are now safe.\n if (!componentRegistry) {\n return <RendererErrorComponent reason=\"SDK is not initialized\" />;\n }\n let internalAttributes: BuilderNodeInternalAttributes = {};\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 // RSC client-reference safeguard (see studio-react/src/renderer/index.tsx).\n // Editor normally only runs in-browser, but consumers may render the\n // composition tree from a server entry; mirror the renderer's guard so\n // SSR never invokes a client-reference proxy.\n const isClientReference =\n (Component as any)?.$$typeof === Symbol.for(\"react.client.reference\");\n if (isClientReference && typeof window === \"undefined\") {\n const PlaceholderTag = (componentOptions.wrap as any) || \"div\";\n return (\n <PlaceholderTag\n {...internalAttributes}\n data-cs-defer-builtin={node.type}\n suppressHydrationWarning\n />\n );\n }\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 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\n // For section-composition nodes, expose the page-side instance uid,\n // its filled slots map, AND the page-level outer data (captured here\n // BEFORE SectionCompositionProvider downstream scopes `template` to\n // the section's selected_field). section-slot placeholders inside the\n // section's body read this context to transclude filled children\n // under the page's data context — so bindings authored on the dropped\n // components resolve against the page's preview entry / additional\n // entries / queries as if the components were on the page directly.\n const wrapWithSectionInstanceCtx = (children: ReactNode) =>\n node.type === \"section-composition\" ? (\n <SectionInstanceSlotsCtxProvider\n value={{\n sectionInstanceUid: uid,\n sectionNode: node,\n slotsMap: (node.slots ?? {}) as Record<string, any[]>,\n pageOuterData: data,\n }}\n >\n {children}\n </SectionInstanceSlotsCtxProvider>\n ) : (\n children\n );\n\n if (componentOptions.wrap) {\n return (\n <RendererErrorBoundary renderError={renderError}>\n <WrapTag {...internalAttributes}>\n {wrapWithSectionInstanceCtx(\n <Component {...attrsWithResponsiveClass} {...resolvedProps} />,\n )}\n </WrapTag>\n </RendererErrorBoundary>\n );\n }\n return (\n <RendererErrorBoundary renderError={renderError}>\n {wrapWithSectionInstanceCtx(\n <Component\n studioAttributes={internalAttributes}\n {...attrsWithResponsiveClass}\n {...resolvedProps}\n />,\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, compositionPlacement } =\n 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 // Detect if this is a page slot for welcome message\n const isPageSlot = parent.type === INTERNAL_COMPONENTS_NAMES.PAGE;\n\n if (!isCompositionBeingEdited || isPreviewMode) {\n return (\n <Slot\n studioAttributes={{}}\n slotUid={slotUid}\n hint={hint}\n isRootSlot={isPageSlot}\n compositionPlacement={compositionPlacement}\n />\n );\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\n studioAttributes={internalAttributes}\n slotUid={slotUid}\n hint={hint}\n isRootSlot={isPageSlot}\n compositionPlacement={compositionPlacement}\n />\n );\n};\n\nexport default MemoizedElement;\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,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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M,UAAU,GAAG,MAAM,CAAC,IAAI,KAAK,yBAAyB,CAAC,IAAI;AAEjE,IAAA,IAAI,CAAC,wBAAwB,IAAI,aAAa,EAAE;QAC9C,QACED,GAAA,CAAC,IAAI,EAAA,EACH,gBAAgB,EAAE,EAAE,EACpB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,EAAA,CAC1C;IAEN;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,QACEA,GAAA,CAAC,IAAI,EAAA,EACH,gBAAgB,EAAE,kBAAkB,EACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,EAAA,CAC1C;AAEN,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 {\n CurrentNodeContext,\n SectionInstanceSlotsCtxProvider,\n} from \"@contentstack/studio-react-components/contexts\";\nimport {\n useCurrentNode,\n useData,\n useNodeStateBindings,\n useNodeBoundFunctionName,\n} from \"@contentstack/studio-react-components/hooks\";\nimport {\n clearReportedBindingErrorsForNode,\n getBindingString,\n getCslpTag,\n getRepeaterBinding,\n GetSlotsParams,\n resolveMetadataBindings,\n retrievePropValue,\n wrapActionProps,\n callStudioFunction,\n INTERNAL_COMPONENTS_NAMES,\n ComponentRegistry,\n} from \"@contentstack/studio-registry\";\nimport classNames from \"classnames\";\nimport {\n memo,\n ReactNode,\n RefCallback,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} 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 } from \"../hooks/use-preview-mode.hook\";\nimport { useRenderer } from \"../hooks/use-renderer.hook\";\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 pageData = useData();\n\n // Canvas parity with the production renderer's BaseElement: declared state\n // variables bound via component_props resolve from the shared BYOS state\n // store. Per-node subscription — only this node re-renders when one of ITS\n // bound state keys changes.\n const stateSnapshot = useNodeStateBindings(node);\n // Behavior assignment (BYOS): reactive — re-reads when the app registers\n // functions (commonly after this node's first render).\n const boundFunctionName = useNodeBoundFunctionName(node);\n const data = useMemo(\n () =>\n stateSnapshot\n ? {\n ...pageData,\n component_props: {\n ...pageData?.component_props,\n ...stateSnapshot,\n },\n }\n : pageData,\n [pageData, stateSnapshot],\n );\n\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 // Open method is optional - only components with _hiddenElementNotification: true need it\n console.debug(\n \"Open method not available on this component reference.\",\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 // Close method is optional - only components with _hiddenElementNotification: true need it\n console.debug(\n \"Close method not available on this component reference.\",\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 // When this node leaves the tree (or its uid changes), retract any binding-\n // mismatch errors we reported for it. retrievePropValue's in-render retraction\n // can only fire while the node still renders, so without this an unmounted\n // node's \"Data Mismatch Found\" badge would latch and its tracking entry leak.\n useEffect(() => {\n if (!isCompositionBeingEdited) return;\n return () => clearReportedBindingErrorsForNode(node.uid);\n }, [node.uid, isCompositionBeingEdited]);\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 // Node style extraction + Google-font side effect. These previously lived\n // inside the try below, AFTER the early `return null` for an unregistered\n // component — so the hook count varied between renders (\"Rendered more hooks\n // than during the previous render\") whenever a node's component wasn't\n // registered yet on the first paint, or `componentRegistry` was momentarily\n // absent. React requires hooks to be unconditional, so they run here before\n // ANY early return. handleNodeStyles is a pure style extractor (no hooks/SDK).\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 // Every hook above runs unconditionally; the early returns below are now safe.\n if (!componentRegistry) {\n return <RendererErrorComponent reason=\"SDK is not initialized\" />;\n }\n let internalAttributes: BuilderNodeInternalAttributes = {};\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 // RSC client-reference safeguard (see studio-react/src/renderer/index.tsx).\n // Editor normally only runs in-browser, but consumers may render the\n // composition tree from a server entry; mirror the renderer's guard so\n // SSR never invokes a client-reference proxy.\n const isClientReference =\n (Component as any)?.$$typeof === Symbol.for(\"react.client.reference\");\n if (isClientReference && typeof window === \"undefined\") {\n const PlaceholderTag = (componentOptions.wrap as any) || \"div\";\n return (\n <PlaceholderTag\n {...internalAttributes}\n data-cs-defer-builtin={node.type}\n suppressHydrationWarning\n />\n );\n }\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 = wrapActionProps(\n componentOptions.props,\n 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\n const componentClass = classNames(\n resolvedProps.className,\n defaultResponsiveClass,\n attrs.className,\n );\n\n // Behavior assignment (BYOS): component_props binding whose key is a\n // registered studio function → node click runs it (mirrors the live\n // renderer; in edit mode the canvas overlay owns clicks, so this fires\n // only in preview / interactive contexts).\n const attrsWithResponsiveClass = {\n ...attrs,\n ...namedResponsiveClasses,\n className: componentClass,\n ...(boundFunctionName\n ? {\n onClick: (event: React.MouseEvent) => {\n (attrs as { onClick?: (e: React.MouseEvent) => void }).onClick?.(\n event,\n );\n callStudioFunction(boundFunctionName);\n },\n }\n : {}),\n };\n\n const WrapTag =\n typeof componentOptions.wrap === \"string\"\n ? componentOptions.wrap || \"div\"\n : \"div\";\n\n // For section-composition nodes, expose the page-side instance uid,\n // its filled slots map, AND the page-level outer data (captured here\n // BEFORE SectionCompositionProvider downstream scopes `template` to\n // the section's selected_field). section-slot placeholders inside the\n // section's body read this context to transclude filled children\n // under the page's data context — so bindings authored on the dropped\n // components resolve against the page's preview entry / additional\n // entries / queries as if the components were on the page directly.\n const wrapWithSectionInstanceCtx = (children: ReactNode) =>\n node.type === \"section-composition\" ? (\n <SectionInstanceSlotsCtxProvider\n value={{\n sectionInstanceUid: uid,\n sectionNode: node,\n slotsMap: (node.slots ?? {}) as Record<string, any[]>,\n pageOuterData: data,\n }}\n >\n {children}\n </SectionInstanceSlotsCtxProvider>\n ) : (\n children\n );\n\n if (componentOptions.wrap) {\n return (\n <RendererErrorBoundary renderError={renderError}>\n <WrapTag {...internalAttributes}>\n {wrapWithSectionInstanceCtx(\n <Component {...attrsWithResponsiveClass} {...resolvedProps} />,\n )}\n </WrapTag>\n </RendererErrorBoundary>\n );\n }\n return (\n <RendererErrorBoundary renderError={renderError}>\n {wrapWithSectionInstanceCtx(\n <Component\n studioAttributes={internalAttributes}\n {...attrsWithResponsiveClass}\n {...resolvedProps}\n />,\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, compositionPlacement } =\n 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 // Detect if this is a page slot for welcome message\n const isPageSlot = parent.type === INTERNAL_COMPONENTS_NAMES.PAGE;\n\n if (!isCompositionBeingEdited || isPreviewMode) {\n return (\n <Slot\n studioAttributes={{}}\n slotUid={slotUid}\n hint={hint}\n isRootSlot={isPageSlot}\n compositionPlacement={compositionPlacement}\n />\n );\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\n studioAttributes={internalAttributes}\n slotUid={slotUid}\n hint={hint}\n isRootSlot={isPageSlot}\n compositionPlacement={compositionPlacement}\n />\n );\n};\n\nexport default MemoizedElement;\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,MAAM,OAAO,GAAG,CAAC,EACf,IAAI,EACJ,WAAW,EACX,QAAQ,GAKT,KAAqB;AACpB,IAAA,MAAM,aAAa,GAAG,cAAc,EAAE;AACtC,IAAA,MAAM,QAAQ,GAAG,OAAO,EAAE;;;;;AAM1B,IAAA,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAC;;;AAGhD,IAAA,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,IAAI,CAAC;AACxD,IAAA,MAAM,IAAI,GAAG,OAAO,CAClB,MACE;AACE,UAAE;AACE,YAAA,GAAG,QAAQ;AACX,YAAA,eAAe,EAAE;gBACf,GAAG,QAAQ,EAAE,eAAe;AAC5B,gBAAA,GAAG,aAAa;AACjB,aAAA;AACF;UACD,QAAQ,EACd,CAAC,QAAQ,EAAE,aAAa,CAAC,CAC1B;AAED,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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AW,EACxB,QAAQ,EAAE,QAAQ,EAAA,EAHb,GAAG,CAIR,EAAA,CACmB,EAAA,EAblB,GAAG,CAcoB;AAElC,QAAA,CAAC,CAAC;QAEF,OAAOA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;IACxB;;IAGA,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,KAAK,yBAAyB,CAAC,QAAQ;QAClD,MAAM,CAAC,QAAQ,EAAE;AACf,UAAE;UACA,SAAS;;IAGf,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,KAAK,yBAAyB,CAAC,IAAI;AAEjE,IAAA,IAAI,CAAC,wBAAwB,IAAI,aAAa,EAAE;QAC9C,QACED,GAAA,CAAC,IAAI,EAAA,EACH,gBAAgB,EAAE,EAAE,EACpB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,EAAA,CAC1C;IAEN;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,QACEA,GAAA,CAAC,IAAI,EAAA,EACH,gBAAgB,EAAE,kBAAkB,EACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,EAAA,CAC1C;AAEN,CAAC;;;;"}
@@ -1,24 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import MemoizedElement from './Element.js';
3
- import '../contexts/providers/renderer.provider.js';
4
- import '../contexts/providers/edit-context.provider.js';
5
- import '../contexts/providers/active-node.provider.js';
6
- import '@contentstack/studio-client';
7
- import '@contentstack/studio-messenger';
8
- import '@contentstack/studio-react-components/contexts';
9
- import 'immer';
10
- import 'react';
11
- import '../hooks/use-edit-context-listener.hook.js';
12
- import '@contentstack/studio-internal';
13
- import '@contentstack/studio-core';
14
- import '@contentstack/studio-react-components/basic-components';
15
- import '@contentstack/studio-react-components/hooks';
16
- import 'goober';
17
- import '../contexts/providers/section-mode.provider.js';
18
- import '@contentstack/studio-registry';
19
- import '../contexts/providers/use-design-preview.provider.js';
20
- import '../contexts/providers/use-repeater.provider.js';
21
- import '../contexts/providers/use-condition-block.provider.js';
22
3
  import { PreviewModeContext } from '../contexts/providers/preview-mode.provider.js';
23
4
 
24
5
  function PreviewRenderer(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewRenderer.js","sources":["../../src/components/PreviewRenderer.tsx"],"sourcesContent":["import { StudioSpec } from \"@contentstack/studio-client\";\nimport { ComposableStudioData } from \"@contentstack/studio-registry\";\nimport Element from \"./Element\";\nimport { PreviewModeContext } from \"../contexts/providers\";\n\nexport interface StudioComponentLiteProps {\n spec: Omit<StudioSpec, \"compositionEntry\">;\n data?: ComposableStudioData[\"component_props\"];\n}\n\nexport function PreviewRenderer(props: StudioComponentLiteProps) {\n const { spec } = props;\n\n return (\n <PreviewModeContext.Provider value={true}>\n <Element node={spec.ui} />\n </PreviewModeContext.Provider>\n );\n}\n"],"names":["_jsx","Element"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUM,SAAU,eAAe,CAAC,KAA+B,EAAA;AAC7D,IAAA,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;IAEtB,QACEA,IAAC,kBAAkB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACtCA,IAACC,eAAO,EAAA,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAA,CAAI,EAAA,CACE;AAElC;;;;"}
1
+ {"version":3,"file":"PreviewRenderer.js","sources":["../../src/components/PreviewRenderer.tsx"],"sourcesContent":["import { StudioSpec } from \"@contentstack/studio-client\";\nimport { ComposableStudioData } from \"@contentstack/studio-registry\";\nimport Element from \"./Element\";\nimport { PreviewModeContext } from \"../contexts/providers/preview-mode.provider\";\n\nexport interface StudioComponentLiteProps {\n spec: Omit<StudioSpec, \"compositionEntry\">;\n data?: ComposableStudioData[\"component_props\"];\n}\n\nexport function PreviewRenderer(props: StudioComponentLiteProps) {\n const { spec } = props;\n\n return (\n <PreviewModeContext.Provider value={true}>\n <Element node={spec.ui} />\n </PreviewModeContext.Provider>\n );\n}\n"],"names":["_jsx","Element"],"mappings":";;;;AAUM,SAAU,eAAe,CAAC,KAA+B,EAAA;AAC7D,IAAA,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;IAEtB,QACEA,IAAC,kBAAkB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACtCA,IAACC,eAAO,EAAA,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAA,CAAI,EAAA,CACE;AAElC;;;;"}
@@ -4,25 +4,9 @@ import { COMPOSITION_PLACEMENT_OPTIONS } from '@contentstack/studio-client';
4
4
  import { css } from 'goober';
5
5
  import { styleFactory } from './styles.js';
6
6
  import { BuildingIllustration } from './BuildingIllustration.js';
7
- import '../contexts/providers/renderer.provider.js';
8
7
  import { editContext } from '../contexts/providers/edit-context.provider.js';
9
- import '../contexts/providers/active-node.provider.js';
10
- import { DataStepMode } from '@contentstack/studio-messenger';
11
- import '@contentstack/studio-react-components/contexts';
12
- import 'immer';
13
- import '../hooks/use-edit-context-listener.hook.js';
14
- import '@contentstack/studio-internal';
15
- import '@contentstack/studio-core';
16
- import '@contentstack/studio-react-components/basic-components';
17
- import '@contentstack/studio-react-components/hooks';
18
- import './Element.js';
19
- import '../contexts/providers/section-mode.provider.js';
20
- import '@contentstack/studio-registry';
21
- import '../contexts/providers/use-design-preview.provider.js';
22
- import '../contexts/providers/use-repeater.provider.js';
23
- import '../contexts/providers/use-condition-block.provider.js';
24
- import '../contexts/providers/preview-mode.provider.js';
25
8
  import classNames from 'classnames';
9
+ import { DataStepMode } from '@contentstack/studio-messenger';
26
10
 
27
11
  // Step 2 wording follows the data options the editor actually offers for this
28
12
  // composition (composable-studio ADR 0008): a freeform page can only pin, a
@@ -1 +1 @@
1
- {"version":3,"file":"WelcomeState.js","sources":["../../src/components/WelcomeState.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport {\n type CompositionPlacement,\n COMPOSITION_PLACEMENT_OPTIONS,\n} from \"@contentstack/studio-client\";\nimport { css } from \"goober\";\nimport { styleFactory } from \"./styles\";\nimport { BuildingIllustration } from \"./BuildingIllustration\";\nimport { editContext, DataStepMode } from \"../contexts/providers\";\nimport classNames from \"classnames\";\n\ninterface WelcomeStateProps {\n compositionPlacement: CompositionPlacement;\n}\n\ninterface WelcomeContent {\n title: string;\n subtitle: string;\n step1Description: string;\n step2Heading: string;\n step2Description: string;\n}\n\n// Step 2 wording follows the data options the editor actually offers for this\n// composition (composable-studio ADR 0008): a freeform page can only pin, a\n// linked page connects a schema (plus pin when the Freeform plan is on).\nconst STEP2_BY_MODE: Record<\n DataStepMode,\n { heading: string; description: string }\n> = {\n [DataStepMode.PinOnly]: {\n heading: \"Step 2: Pin data\",\n description: \"Pin flexible content to your components.\",\n },\n [DataStepMode.SchemaOrPin]: {\n heading: \"Step 2: Connect a schema or pin data\",\n description:\n \"Bind structured data or pin flexible content to your components.\",\n },\n [DataStepMode.SchemaOnly]: {\n heading: \"Step 2: Connect a schema\",\n description: \"Bind structured data to your components.\",\n },\n};\n\nconst getWelcomeContent = (\n placement: CompositionPlacement,\n dataStepMode: DataStepMode,\n): WelcomeContent => {\n const step2 = STEP2_BY_MODE[dataStepMode];\n const isPage = placement === COMPOSITION_PLACEMENT_OPTIONS.PAGE;\n return {\n title: isPage ? \"Start Building Template\" : \"Start Building Section\",\n subtitle: isPage\n ? \"Add components and bind data to complete your setup.\"\n : \"Add components and bind data to complete your section setup.\",\n step1Description: isPage\n ? \"Drag and drop components from the LHS components panel to create your design.\"\n : \"Drag and drop components from the LHS components panel to create your section design.\",\n step2Heading: step2.heading,\n step2Description: step2.description,\n };\n};\n\nexport const WelcomeState: React.FC<WelcomeStateProps> = ({\n compositionPlacement,\n}) => {\n const { dataStepMode } = useContext(editContext);\n const content = getWelcomeContent(compositionPlacement, dataStepMode);\n const styles = styleFactory(css);\n\n return (\n <div className={styles.welcomeContainer}>\n <BuildingIllustration />\n <h2 className={styles.welcomeTitle}>{content.title}</h2>\n <p className={styles.welcomeSubtitle}>{content.subtitle}</p>\n <div className={styles.welcomeSteps}>\n <div\n className={classNames(styles.welcomeStep, styles.activeWelcomeStep)}\n >\n <h3>Step 1: Add components to canvas</h3>\n <p>{content.step1Description}</p>\n </div>\n <div className={styles.welcomeStep}>\n <h3>{content.step2Heading}</h3>\n <p>{content.step2Description}</p>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;AACA;AACA;AACA,MAAM,aAAa,GAGf;AACF,IAAA,CAAC,YAAY,CAAC,OAAO,GAAG;AACtB,QAAA,OAAO,EAAE,kBAAkB;AAC3B,QAAA,WAAW,EAAE,0CAA0C;AACxD,KAAA;AACD,IAAA,CAAC,YAAY,CAAC,WAAW,GAAG;AAC1B,QAAA,OAAO,EAAE,sCAAsC;AAC/C,QAAA,WAAW,EACT,kEAAkE;AACrE,KAAA;AACD,IAAA,CAAC,YAAY,CAAC,UAAU,GAAG;AACzB,QAAA,OAAO,EAAE,0BAA0B;AACnC,QAAA,WAAW,EAAE,0CAA0C;AACxD,KAAA;CACF;AAED,MAAM,iBAAiB,GAAG,CACxB,SAA+B,EAC/B,YAA0B,KACR;AAClB,IAAA,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,CAAC;AACzC,IAAA,MAAM,MAAM,GAAG,SAAS,KAAK,6BAA6B,CAAC,IAAI;IAC/D,OAAO;QACL,KAAK,EAAE,MAAM,GAAG,yBAAyB,GAAG,wBAAw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A,CAAA,IAAA,EAAA,EAAA,QAAA,EAAK,OAAO,CAAC,YAAY,EAAA,CAAM,EAC/BA,GAAA,CAAA,GAAA,EAAA,EAAA,QAAA,EAAI,OAAO,CAAC,gBAAgB,EAAA,CAAK,IAC7B,CAAA,EAAA,CACF,CAAA,EAAA,CACF;AAEV;;;;"}
1
+ {"version":3,"file":"WelcomeState.js","sources":["../../src/components/WelcomeState.tsx"],"sourcesContent":["import React, { useContext } from \"react\";\nimport {\n type CompositionPlacement,\n COMPOSITION_PLACEMENT_OPTIONS,\n} from \"@contentstack/studio-client\";\nimport { css } from \"goober\";\nimport { styleFactory } from \"./styles\";\nimport { BuildingIllustration } from \"./BuildingIllustration\";\nimport {\n editContext,\n DataStepMode,\n} from \"../contexts/providers/edit-context.provider\";\nimport classNames from \"classnames\";\n\ninterface WelcomeStateProps {\n compositionPlacement: CompositionPlacement;\n}\n\ninterface WelcomeContent {\n title: string;\n subtitle: string;\n step1Description: string;\n step2Heading: string;\n step2Description: string;\n}\n\n// Step 2 wording follows the data options the editor actually offers for this\n// composition (composable-studio ADR 0008): a freeform page can only pin, a\n// linked page connects a schema (plus pin when the Freeform plan is on).\nconst STEP2_BY_MODE: Record<\n DataStepMode,\n { heading: string; description: string }\n> = {\n [DataStepMode.PinOnly]: {\n heading: \"Step 2: Pin data\",\n description: \"Pin flexible content to your components.\",\n },\n [DataStepMode.SchemaOrPin]: {\n heading: \"Step 2: Connect a schema or pin data\",\n description:\n \"Bind structured data or pin flexible content to your components.\",\n },\n [DataStepMode.SchemaOnly]: {\n heading: \"Step 2: Connect a schema\",\n description: \"Bind structured data to your components.\",\n },\n};\n\nconst getWelcomeContent = (\n placement: CompositionPlacement,\n dataStepMode: DataStepMode,\n): WelcomeContent => {\n const step2 = STEP2_BY_MODE[dataStepMode];\n const isPage = placement === COMPOSITION_PLACEMENT_OPTIONS.PAGE;\n return {\n title: isPage ? \"Start Building Template\" : \"Start Building Section\",\n subtitle: isPage\n ? \"Add components and bind data to complete your setup.\"\n : \"Add components and bind data to complete your section setup.\",\n step1Description: isPage\n ? \"Drag and drop components from the LHS components panel to create your design.\"\n : \"Drag and drop components from the LHS components panel to create your section design.\",\n step2Heading: step2.heading,\n step2Description: step2.description,\n };\n};\n\nexport const WelcomeState: React.FC<WelcomeStateProps> = ({\n compositionPlacement,\n}) => {\n const { dataStepMode } = useContext(editContext);\n const content = getWelcomeContent(compositionPlacement, dataStepMode);\n const styles = styleFactory(css);\n\n return (\n <div className={styles.welcomeContainer}>\n <BuildingIllustration />\n <h2 className={styles.welcomeTitle}>{content.title}</h2>\n <p className={styles.welcomeSubtitle}>{content.subtitle}</p>\n <div className={styles.welcomeSteps}>\n <div\n className={classNames(styles.welcomeStep, styles.activeWelcomeStep)}\n >\n <h3>Step 1: Add components to canvas</h3>\n <p>{content.step1Description}</p>\n </div>\n <div className={styles.welcomeStep}>\n <h3>{content.step2Heading}</h3>\n <p>{content.step2Description}</p>\n </div>\n </div>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AA0BA;AACA;AACA;AACA,MAAM,aAAa,GAGf;AACF,IAAA,CAAC,YAAY,CAAC,OAAO,GAAG;AACtB,QAAA,OAAO,EAAE,kBAAkB;AAC3B,QAAA,WAAW,EAAE,0CAA0C;AACxD,KAAA;AACD,IAAA,CAAC,YAAY,CAAC,WAAW,GAAG;AAC1B,QAAA,OAAO,EAAE,sCAAsC;AAC/C,QAAA,WAAW,EACT,kEAAkE;AACrE,KAAA;AACD,IAAA,CAAC,YAAY,CAAC,UAAU,GAAG;AACzB,QAAA,OAAO,EAAE,0BAA0B;AACnC,QAAA,WAAW,EAAE,0CAA0C;AACxD,KAAA;CACF;AAED,MAAM,iBAAiB,GAAG,CACxB,SAA+B,EAC/B,YAA0B,KACR;AAClB,IAAA,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,CAAC;AACzC,IAAA,MAAM,MAAM,GAAG,SAAS,KAAK,6BAA6B,CAAC,IAAI;IAC/D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AA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,WAAW,aAChCC,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EAAK,OAAO,CAAC,YAAY,EAAA,CAAM,EAC/BA,GAAA,CAAA,GAAA,EAAA,EAAA,QAAA,EAAI,OAAO,CAAC,gBAAgB,EAAA,CAAK,IAC7B,CAAA,EAAA,CACF,CAAA,EAAA,CACF;AAEV;;;;"}
@@ -6,22 +6,9 @@ import { get, set } from 'lodash-es';
6
6
  import React from 'react';
7
7
  import { DataCtxProvider } from '@contentstack/studio-react-components/contexts';
8
8
  import { useData } from '@contentstack/studio-react-components/hooks';
9
- import '../../contexts/providers/renderer.provider.js';
10
- import '../../contexts/providers/edit-context.provider.js';
11
- import '../../contexts/providers/active-node.provider.js';
12
- import '@contentstack/studio-messenger';
13
- import '../../hooks/use-edit-context-listener.hook.js';
14
- import '@contentstack/studio-internal';
15
- import '@contentstack/studio-core';
16
- import '@contentstack/studio-react-components/basic-components';
17
- import 'goober';
18
- import '../Element.js';
19
- import '../../contexts/providers/section-mode.provider.js';
20
- import { useShouldShowDesign } from '../../hooks/use-should-show-design.hook.js';
21
- import { DesignPreviewContext } from '../../contexts/providers/use-design-preview.provider.js';
22
- import '../../contexts/providers/use-repeater.provider.js';
23
9
  import { ConditionBlockContext } from '../../contexts/providers/use-condition-block.provider.js';
24
- import '../../contexts/providers/preview-mode.provider.js';
10
+ import { DesignPreviewContext } from '../../contexts/providers/use-design-preview.provider.js';
11
+ import { useShouldShowDesign } from '../../hooks/use-should-show-design.hook.js';
25
12
 
26
13
  function ConditionBlock({ condition, children, mode, studioAttributes, }) {
27
14
  const showDesign = useShouldShowDesign(mode);
@@ -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\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,gBAAgB,EAAE,gBAAgB,EAAA,QAAA,EACvE,QAAQ,EAAA,CACQ;AAEvB;AAEA,SAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,gBAAgB,GACkB,EAAA;AAClC,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;AACtB,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,IAAI;IAC3B,IAAI,oBAAoB,GAAG,IAAI;AAC/B,IAAA,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,SAAS;IAC1C,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,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 { ConditionBlockContext } from \"../../contexts/providers/use-condition-block.provider\";\nimport { DesignPreviewContext } from \"../../contexts/providers/use-design-preview.provider\";\nimport { useShouldShowDesign } from \"../../hooks/use-should-show-design.hook\";\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":";;;;;;;;;;;;AAuBM,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,E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AC,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;;;;"}
@@ -4,23 +4,9 @@ import { getFlattenedData } from '@contentstack/studio-registry';
4
4
  import { DataCtxProvider } from '@contentstack/studio-react-components/contexts';
5
5
  import { useData } from '@contentstack/studio-react-components/hooks';
6
6
  import { Children, isValidElement, cloneElement } from 'react';
7
- import '../../contexts/providers/renderer.provider.js';
8
- import '../../contexts/providers/edit-context.provider.js';
9
- import '../../contexts/providers/active-node.provider.js';
10
- import '@contentstack/studio-messenger';
11
- import 'immer';
12
- import '../../hooks/use-edit-context-listener.hook.js';
13
- import '@contentstack/studio-internal';
14
- import '@contentstack/studio-core';
15
- import '@contentstack/studio-react-components/basic-components';
16
- import 'goober';
17
- import '../Element.js';
18
- import '../../contexts/providers/section-mode.provider.js';
19
- import { useShouldShowDesign } from '../../hooks/use-should-show-design.hook.js';
20
7
  import { DesignPreviewContext } from '../../contexts/providers/use-design-preview.provider.js';
21
8
  import { RepeaterContext } from '../../contexts/providers/use-repeater.provider.js';
22
- import '../../contexts/providers/use-condition-block.provider.js';
23
- import '../../contexts/providers/preview-mode.provider.js';
9
+ import { useShouldShowDesign } from '../../hooks/use-should-show-design.hook.js';
24
10
 
25
11
  function RepeaterPreview({ children, studioAttributes, items = [], _uid, $items, }) {
26
12
  const data = useData();
@@ -1 +1 @@
1
- {"version":3,"file":"Repeater.js","sources":["../../../src/components/elements/Repeater.tsx"],"sourcesContent":["import { COMPOSABLE_DATA_ATTRIBUTES } from \"@contentstack/studio-client\";\nimport { 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?.[COMPOSABLE_DATA_ATTRIBUTES.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\n if (!Array.isArray(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":";;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,eAAe,CAAC,EACvB,QAAQ,EACR,gBAAgB,EAChB,KAAK,GAAG,EAAE,EACV,IAAI,EACJ,MAAM,GACsB,EAA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,CAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,YACzDA,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,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 { COMPOSABLE_DATA_ATTRIBUTES } from \"@contentstack/studio-client\";\nimport { 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 { DesignPreviewContext } from \"../../contexts/providers/use-design-preview.provider\";\nimport { RepeaterContext } from \"../../contexts/providers/use-repeater.provider\";\nimport { useShouldShowDesign } from \"../../hooks/use-should-show-design.hook\";\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?.[COMPOSABLE_DATA_ATTRIBUTES.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\n if (!Array.isArray(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={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