@contentstack/studio-react-editor 1.9.0 → 1.11.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 (36) hide show
  1. package/dist/components/EditableRenderer.js +2 -1
  2. package/dist/components/EditableRenderer.js.map +1 -1
  3. package/dist/components/Element.js +35 -32
  4. package/dist/components/Element.js.map +1 -1
  5. package/dist/components/PermanentDropZone.js +77 -0
  6. package/dist/components/PermanentDropZone.js.map +1 -0
  7. package/dist/components/WelcomeState.js +1 -1
  8. package/dist/components/elements/SectionComposition.js +2 -1
  9. package/dist/components/elements/SectionComposition.js.map +1 -1
  10. package/dist/components/elements/SectionSlot.js +16 -50
  11. package/dist/components/elements/SectionSlot.js.map +1 -1
  12. package/dist/components/styles.js +76 -52
  13. package/dist/components/styles.js.map +1 -1
  14. package/dist/contexts/providers/edit-context.provider.js +2 -2
  15. package/dist/contexts/providers/edit-context.provider.js.map +1 -1
  16. package/dist/hooks/use-active-node-path.hook.js +1 -1
  17. package/dist/hooks/use-active-node-path.hook.js.map +1 -1
  18. package/dist/hooks/use-can-show-permanent-drop-zones.hook.js +20 -0
  19. package/dist/hooks/use-can-show-permanent-drop-zones.hook.js.map +1 -0
  20. package/dist/hooks/use-canvas-events.hook.js +2 -1
  21. package/dist/hooks/use-canvas-events.hook.js.map +1 -1
  22. package/dist/hooks/use-edit-context-listener.hook.js +2 -1
  23. package/dist/hooks/use-edit-context-listener.hook.js.map +1 -1
  24. package/dist/hooks/use-section-events.hook.js +2 -1
  25. package/dist/hooks/use-section-events.hook.js.map +1 -1
  26. package/dist/hooks/use-should-show-design.hook.js +47 -35
  27. package/dist/hooks/use-should-show-design.hook.js.map +1 -1
  28. package/dist/hooks/use-slot-copy-color.hook.js +13 -10
  29. package/dist/hooks/use-slot-copy-color.hook.js.map +1 -1
  30. package/dist/hooks/use-spec-data-listener.hook.js +39 -29
  31. package/dist/hooks/use-spec-data-listener.hook.js.map +1 -1
  32. package/dist/hooks/use-static-values-listener.hook.js +10 -2
  33. package/dist/hooks/use-static-values-listener.hook.js.map +1 -1
  34. package/dist/utils/renderer.util.js +105 -35
  35. package/dist/utils/renderer.util.js.map +1 -1
  36. package/package.json +8 -8
@@ -2,8 +2,6 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { ELEMENT_TO_NODE, COMPOSABLE_DATA_ATTRIBUTES, NODE_TO_PARENT, NODE_TO_PATH_NODE } from '@contentstack/studio-client';
3
3
  import { SectionInstanceSlotsCtx, DataCtxProvider, CurrentNodeContext } from '@contentstack/studio-react-components/contexts';
4
4
  import { useCurrentNode, useData } from '@contentstack/studio-react-components/hooks';
5
- import { composableStudioEventManager, POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger';
6
- import { Button } from '@contentstack/studio-core';
7
5
  import { css } from 'goober';
8
6
  import classNames from 'classnames';
9
7
  import { useContext, useCallback, useMemo } from 'react';
@@ -14,6 +12,7 @@ import { SectionModeContext } from '../../contexts/providers/section-mode.provid
14
12
  import { useRenderer } from '../../hooks/use-renderer.hook.js';
15
13
  import { useSlotCopyColor } from '../../hooks/use-slot-copy-color.hook.js';
16
14
  import MemoizedElement from '../Element.js';
15
+ import { SlotChildrenWithPermanentDropZones } from '../PermanentDropZone.js';
17
16
  import { AddIcon } from '../AddIcon.js';
18
17
 
19
18
  /**
@@ -66,8 +65,6 @@ function SectionSlot({ studioAttributes, label, _uid, defaultSection, }) {
66
65
  const authoringCopyColor = useSlotCopyColor();
67
66
  const dropCopyColor = useSlotCopyColor();
68
67
  const defaultHintCopyColor = useSlotCopyColor();
69
- const orDividerCopyColor = useSlotCopyColor();
70
- const allowedLabelCopyColor = useSlotCopyColor();
71
68
  const sectionCtx = useContext(SectionInstanceSlotsCtx);
72
69
  // Registry resolves the authored Default section's human title for the
73
70
  // design-mode hint (COMS-1770). Sections register with `type = section.uid`
@@ -170,29 +167,6 @@ function SectionSlot({ studioAttributes, label, _uid, defaultSection, }) {
170
167
  defaultSectionTitle = undefined;
171
168
  }
172
169
  }
173
- // COMS-1809: open the section-slot picker. The button lives here in the
174
- // iframe, but the picker is a parent-app overlay (reusing the Component tab
175
- // card + hover preview + section catalog — ADR 0010), so we only post the
176
- // slot identity plus the button's viewport rect. Studio offsets the rect by
177
- // the iframe's own position to anchor the popover. Plain function (used only
178
- // in the consumption design-empty branch below), not a hook.
179
- const handleSelectSection = (event) => {
180
- event.preventDefault();
181
- event.stopPropagation();
182
- const r = event.currentTarget.getBoundingClientRect();
183
- composableStudioEventManager?.send(POST_MESSAGE_EVENTS.OPEN_SECTION_SLOT_PICKER, {
184
- sectionInstanceUid: sectionCtx?.sectionInstanceUid,
185
- slotUid,
186
- buttonRect: {
187
- top: r.top,
188
- left: r.left,
189
- right: r.right,
190
- bottom: r.bottom,
191
- width: r.width,
192
- height: r.height,
193
- },
194
- });
195
- };
196
170
  // Authoring mode: section is the top-level composition being edited.
197
171
  if (!sectionCtx) {
198
172
  return (jsx("div", { [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,
@@ -224,14 +198,12 @@ function SectionSlot({ studioAttributes, label, _uid, defaultSection, }) {
224
198
  }, children: jsx(MemoizedElement, { node: synth, renderError: () => null }) }) }) }) }) }));
225
199
  }
226
200
  return (jsxs("div", { ref: slotDomRef, ...dropZoneAttrs, ...studioAttributes,
227
- // Always column now (COMS-1809): the "Select section" button stacks
228
- // below the drop copy in every design-mode empty slot.
201
+ // Column: the default-section hint stacks below the drop copy. Sections
202
+ // are added by dropping one here or from the slot's Insert handle in
203
+ // Studio (COMS-2392), which offers the slot's allowed sections.
229
204
  className: classNames(styles.slotStyle, styles.slotColumnStyle), children: [jsxs("span", { ref: dropCopyColor.ref, className: classNames(styles.slotDropText, dropCopyColor.colorClassName, dropCopyColor.strokeClassName), children: [jsx(AddIcon, {}), " ", defaultSection
230
205
  ? "Drop a section here to replace it."
231
- : "Drop a section here."] }), defaultSection ? (jsxs("p", { ref: defaultHintCopyColor.ref, className: classNames(styles.slotDefaultHint, defaultHintCopyColor.colorClassName, defaultHintCopyColor.strokeClassName), children: ["(When this slot is empty, the default section", defaultSectionTitle ? (jsxs(Fragment, { children: [" (", jsx("strong", { children: defaultSectionTitle }), ")"] })) : null, " added by the section author is shown in Preview and on the live page.)"] })) : null, jsx("p", { ref: orDividerCopyColor.ref, className: classNames(styles.slotOrDivider, orDividerCopyColor.colorClassName, orDividerCopyColor.strokeClassName), children: "OR" }), jsx("p", { ref: allowedLabelCopyColor.ref, className: classNames(styles.slotAllowedLabel, allowedLabelCopyColor.colorClassName, allowedLabelCopyColor.strokeClassName), children: "Add from the allowed Sections" }), jsxs(Button, { type: "button", "data-studio-ui": true, className: styles.slotSelectButton,
232
- // Swallow mousedown so the slot's drag-select never starts from the
233
- // button; the click opens the picker instead.
234
- onMouseDown: (e) => e.stopPropagation(), onClick: handleSelectSection, children: [jsx(SelectSectionIcon, {}), " Select section"] })] }));
206
+ : "Drop a section here."] }), defaultSection ? (jsxs("p", { ref: defaultHintCopyColor.ref, className: classNames(styles.slotDefaultHint, defaultHintCopyColor.colorClassName, defaultHintCopyColor.strokeClassName), children: ["(When this slot is empty, the default section", defaultSectionTitle ? (jsxs(Fragment, { children: [" (", jsx("strong", { children: defaultSectionTitle }), ")"] })) : null, " added by the section author is shown in Preview and on the live page.)"] })) : null] }));
235
207
  }
236
208
  // Transclude filled children. Anchor each child's slate path under the
237
209
  // page-side section-composition node + this slot's uid. In design mode, exit
@@ -239,24 +211,18 @@ function SectionSlot({ studioAttributes, label, _uid, defaultSection, }) {
239
211
  // selectable, hover-highlightable, and draggable like a normal node. In
240
212
  // preview mode, keep them inside preview (non-interactive) and drop the
241
213
  // drop-zone attributes so the slot reads like production.
242
- return (jsx(DataCtxProvider, { value: slotChildData, children: jsx(PreviewModeContext.Provider, { value: isSectionPreview, children: jsx("div", { ref: slotDomRef, ...(isSectionPreview ? {} : dropZoneAttrs), ...studioAttributes, style: { display: "contents" }, children: jsx(SectionInstanceSlotsCtx.Provider, { value: undefined, children: filled.map((child, idx) => {
243
- if (!child || typeof child !== "object")
244
- return null;
245
- NODE_TO_PARENT.set(child, sectionCtx.sectionNode);
246
- NODE_TO_PATH_NODE.set(child, [slotUid, idx]);
247
- const childPath = [...parentNodePath, [slotUid, idx]];
248
- return (jsx(CurrentNodeContext.Provider, { value: {
249
- currentNodeUid: child.uid,
250
- currentNodePath: childPath,
251
- }, children: jsx(SelectedNodeProvider, { children: jsx(MemoizedElement, { node: child, renderError: () => null }) }) }, child.uid));
252
- }) }) }) }) }));
214
+ return (jsx(DataCtxProvider, { value: slotChildData, children: jsx(PreviewModeContext.Provider, { value: isSectionPreview, children: jsx("div", { ref: slotDomRef, ...(isSectionPreview ? {} : dropZoneAttrs), ...studioAttributes, style: { display: "contents" }, children: jsx(SectionInstanceSlotsCtx.Provider, { value: undefined, children: jsx(SlotChildrenWithPermanentDropZones, { slotOwner: sectionCtx.sectionNode, slotChildren: filled, renderSlotChild: (child, idx) => {
215
+ if (!child || typeof child !== "object")
216
+ return null;
217
+ NODE_TO_PARENT.set(child, sectionCtx.sectionNode);
218
+ NODE_TO_PATH_NODE.set(child, [slotUid, idx]);
219
+ const childPath = [...parentNodePath, [slotUid, idx]];
220
+ return (jsx(CurrentNodeContext.Provider, { value: {
221
+ currentNodeUid: child.uid,
222
+ currentNodePath: childPath,
223
+ }, children: jsx(SelectedNodeProvider, { children: jsx(MemoizedElement, { node: child, renderError: () => null }) }) }));
224
+ } }) }) }) }) }));
253
225
  }
254
- // Marquee-select glyph for the "Select section" button (COMS-1809) — the
255
- // design's asset verbatim, with fills switched to `currentColor` so it
256
- // inherits the button's white text.
257
- const SelectSectionIcon = () => {
258
- return (jsxs("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.09375 0.9375C1.00746 0.9375 0.9375 1.00746 0.9375 1.09375V2.34375C0.9375 2.60263 0.727633 2.8125 0.46875 2.8125C0.209867 2.8125 0 2.60263 0 2.34375V1.09375C0 0.489689 0.489688 0 1.09375 0H2.34375C2.60263 0 2.8125 0.209867 2.8125 0.46875C2.8125 0.727633 2.60263 0.9375 2.34375 0.9375H1.09375ZM4.375 0.46875C4.375 0.209867 4.58487 0 4.84375 0H7.34375C7.60263 0 7.8125 0.209867 7.8125 0.46875C7.8125 0.727633 7.60263 0.9375 7.34375 0.9375H4.84375C4.58487 0.9375 4.375 0.727633 4.375 0.46875ZM9.375 0.46875C9.375 0.209867 9.58487 0 9.84375 0H12.3438C12.6026 0 12.8125 0.209867 12.8125 0.46875C12.8125 0.727633 12.6026 0.9375 12.3438 0.9375H9.84375C9.58487 0.9375 9.375 0.727633 9.375 0.46875ZM14.375 0.46875C14.375 0.209867 14.5849 0 14.8438 0H16.0938C16.6978 0 17.1875 0.489688 17.1875 1.09375V2.5C17.1875 2.75888 16.9776 2.96875 16.7188 2.96875C16.4599 2.96875 16.25 2.75888 16.25 2.5V1.09375C16.25 1.00746 16.18 0.9375 16.0938 0.9375H14.8438C14.5849 0.9375 14.375 0.727633 14.375 0.46875ZM0.46875 4.375C0.727633 4.375 0.9375 4.58487 0.9375 4.84375V6.09375C0.9375 6.18004 1.00746 6.25 1.09375 6.25H2.03125C2.29013 6.25 2.5 6.45987 2.5 6.71875C2.5 6.97763 2.29013 7.1875 2.03125 7.1875H1.09375C0.489689 7.1875 0 6.69781 0 6.09375V4.84375C0 4.58487 0.209867 4.375 0.46875 4.375ZM16.7188 4.84375C16.9776 4.84375 17.1875 5.05362 17.1875 5.3125V6.71875C17.1875 6.97763 16.9776 7.1875 16.7188 7.1875C16.4599 7.1875 16.25 6.97763 16.25 6.71875V5.3125C16.25 5.05362 16.4599 4.84375 16.7188 4.84375ZM3.4375 6.71875C3.4375 6.45987 3.64737 6.25 3.90625 6.25H5.78125C6.04013 6.25 6.25 6.45987 6.25 6.71875C6.25 6.97763 6.04013 7.1875 5.78125 7.1875H3.90625C3.64737 7.1875 3.4375 6.97763 3.4375 6.71875ZM7.1875 6.71875C7.1875 6.45987 7.39737 6.25 7.65625 6.25H8.59375C8.85263 6.25 9.0625 6.45987 9.0625 6.71875C9.0625 6.97763 8.85263 7.1875 8.59375 7.1875H7.65625C7.39737 7.1875 7.1875 6.97763 7.1875 6.71875Z", fill: "currentColor" }), jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.79852 4.73594C9.72732 4.06274 10.4877 3.62376 11.0351 4.02202L16.3345 7.8776C16.9193 8.30303 16.6619 9.22617 15.9414 9.28775L13.3774 9.5069L11.9056 11.6178C11.492 12.211 10.5639 11.9723 10.4878 11.2532L9.79852 4.73594ZM10.7678 4.98694L11.3761 10.7381L12.6503 8.91063C12.783 8.7203 12.9934 8.5988 13.2246 8.57904L15.4443 8.38932L10.7678 4.98694Z", fill: "currentColor" })] }));
259
- };
260
226
 
261
227
  export { SectionSlot };
262
228
  //# sourceMappingURL=SectionSlot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionSlot.js","sources":["../../../src/components/elements/SectionSlot.tsx"],"sourcesContent":["import {\n COMPOSABLE_DATA_ATTRIBUTES,\n ELEMENT_TO_NODE,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n} from \"@contentstack/studio-client\";\nimport { Node, Path } from \"@contentstack/studio-internal\";\nimport {\n CurrentNodeContext,\n DataCtxProvider,\n SectionInstanceSlotsCtx,\n} from \"@contentstack/studio-react-components/contexts\";\nimport {\n useCurrentNode,\n useData,\n} from \"@contentstack/studio-react-components/hooks\";\nimport {\n POST_MESSAGE_EVENTS,\n composableStudioEventManager,\n} from \"@contentstack/studio-messenger\";\nimport { Button } from \"@contentstack/studio-core\";\nimport { css } from \"goober\";\nimport classNames from \"classnames\";\nimport { MouseEvent, useCallback, useContext, useMemo } from \"react\";\nimport { styleFactory } from \"../styles\";\nimport { StudioAttributes } from \"../../types\";\nimport { SelectedNodeProvider } from \"../../contexts/providers/selected-node.provider\";\nimport { PreviewModeContext } from \"../../contexts/providers/preview-mode.provider\";\nimport { SectionModeContext } from \"../../contexts/providers/section-mode.provider\";\nimport { useRenderer } from \"../../hooks/use-renderer.hook\";\nimport { useSlotCopyColor } from \"../../hooks/use-slot-copy-color.hook\";\nimport Element from \"../Element\";\nimport { AddIcon } from \"../AddIcon\";\n\ninterface SectionSlotEditorProps extends StudioAttributes {\n label?: string;\n _uid?: string;\n /** Authored Slot default section uid (COMS-1659). Rendered when the slot is\n * empty in preview mode; design mode keeps the dropzone. */\n defaultSection?: string;\n}\n\n/**\n * In-memory `section-composition` node for a slot's authored default. Rendered\n * through the normal element path so the default's spec resolves by\n * `compositionUID` and nested defaults recurse. Stable uid → no remount. Never\n * persisted into the placement.\n */\nfunction makeDefaultSectionNode(\n instanceUid: string | undefined,\n slotUid: string,\n defaultUid: string,\n): Node {\n // Key by the enclosing placement instance too (COMS-1659): the same section\n // placed twice shares one internal `slotUid`, so a slot-uid-only key would\n // collide across placements and make their empty-slot defaults share one\n // uid-keyed data context. The instance uid makes each placement's default\n // distinct.\n const prefix = instanceUid ? `${instanceUid}-` : \"\";\n return {\n type: \"section-composition\",\n uid: `${prefix}${slotUid}-default-${defaultUid}`,\n metadata: { compositionUID: defaultUid, mode: \"preview\" },\n attrs: {},\n props: {},\n slots: {},\n styles: {},\n } as Node;\n}\n\n/**\n * Editor variant of section-slot. Two modes:\n *\n * 1. **Authoring mode** (no SectionInstanceSlotsCtx in scope) — the section\n * composition is being authored. Render a labelled drop-zone-style\n * placeholder; not droppable into (section slots only accept drops when\n * the section is consumed in a page composition).\n *\n * 2. **Consumption mode** (SectionInstanceSlotsCtx present) — the section\n * is being rendered inside a page composition. Look up the page-side\n * slots map by this slot's stable uid (== this node's uid). If filled,\n * transclude the children via <Element> with their paths anchored to\n * the page-side section-composition node, and lift them out of preview\n * mode so they're individually selectable / hover-targetable / draggable\n * like any other page-tree node. If empty, render a labelled drop\n * target that itself acts as a builder node (attributes mapped to the\n * page-side section-composition parent), so hover highlights only the\n * slot zone — not the whole section.\n */\nexport function SectionSlot({\n studioAttributes,\n label,\n _uid,\n defaultSection,\n}: SectionSlotEditorProps) {\n // ALL hooks unconditionally at the top — React doesn't allow conditional\n // hook calls and the component returns early for authoring/empty modes.\n // One measurement per line of empty-slot chrome: each reads the page colour\n // behind itself and picks the palette entry that separates from it best.\n const authoringCopyColor = useSlotCopyColor<HTMLSpanElement>();\n const dropCopyColor = useSlotCopyColor<HTMLSpanElement>();\n const defaultHintCopyColor = useSlotCopyColor<HTMLParagraphElement>();\n const orDividerCopyColor = useSlotCopyColor<HTMLParagraphElement>();\n const allowedLabelCopyColor = useSlotCopyColor<HTMLParagraphElement>();\n const sectionCtx = useContext(SectionInstanceSlotsCtx);\n // Registry resolves the authored Default section's human title for the\n // design-mode hint (COMS-1770). Sections register with `type = section.uid`\n // and `displayName = section.title`, so a uid lookup yields the title.\n const { componentRegistry } = useRenderer();\n // When the enclosing placed section is in preview mode, the slot renders like\n // production: an empty slot collapses to nothing and a filled slot drops its\n // drop-chrome / selection affordances.\n const isSectionPreview = useContext(SectionModeContext) === \"preview\";\n const { currentNodePath: parentNodePath = [] } = useCurrentNode();\n // Current section-local data (template scoped to section, in-section\n // repeater item if surrounding, etc.). Slot children inherit this as\n // their *default* context — the user's authored bindings on slot\n // children resolve against this by default.\n const sectionLocalData = useData();\n const slotDomRef = useCallback(\n (el: HTMLElement | null) => {\n if (el && sectionCtx?.sectionNode) {\n ELEMENT_TO_NODE.set(el, sectionCtx.sectionNode);\n }\n },\n [sectionCtx?.sectionNode],\n );\n // Slot child's data context namespace:\n //\n // dataSources.template = section-local scoped template; if the\n // slot sits inside an in-section\n // Repeater that's currently iterating,\n // this is the active iteration item.\n // Matches what the Data Picker writes\n // when authoring against fields from\n // the slot's surrounding section scope.\n // dataSources.repeater[uid] = in-section Repeater map (full\n // per-uid context). Inherited from\n // sectionLocal via {...sectionDS}.\n // dataSources.static_value = section's persisted static values.\n // dataSources.page = OUTERMOST page-level namespace\n // ({ template, contentstack,\n // contentstack_queries, ... }).\n // Always points to the real page even\n // across recursive slot nesting — see\n // `truePageNamespace` below.\n //\n // Until Phase 8 lands, picker emits `dataSources.<src>.X` paths only.\n // retrieve-data.ts retries unresolved `dataSources.<src>.X` lookups under\n // `dataSources.page.<src>.X` so page-level bindings authored on slot\n // children still resolve.\n const slotChildData = useMemo(() => {\n const sectionLocal: any = sectionLocalData || {};\n const pageOuter: any = sectionCtx?.pageOuterData || {};\n const pageDS = pageOuter?.dataSources || {};\n const sectionDS = sectionLocal?.dataSources || {};\n\n const repeaterMap = (sectionDS.repeater || {}) as Record<string, any>;\n const repeaterUids = Object.keys(repeaterMap);\n const activeRepeaterUid =\n repeaterUids.length > 0\n ? repeaterUids[repeaterUids.length - 1]\n : undefined;\n const activeItem = activeRepeaterUid\n ? repeaterMap[activeRepeaterUid]?.context\n : undefined;\n const sectionLocalTemplate = activeItem ?? sectionDS.template;\n\n // Slot child's default namespace = section-local context AS IS (template,\n // repeater, static_value, …). Page-level sources are nested under `page.*`\n // as the explicit escape. This matches what the Data Picker writes when\n // authoring a slot child (picker shows the slot child's surrounding\n // scope, so its `template.X` / `repeater[uid].context.X` paths resolve\n // natively without rewriting).\n //\n // For nested cases (Section B in Section A's slot), `page` must always\n // point to the OUTERMOST page context — not to Section A's slot-local\n // view. Otherwise each nesting level shadows `page` with the surrounding\n // section's local, and `dataSources.page.template.title` would resolve\n // to a modular_block item instead of the page entry. So: if the outer\n // dataSources already has its own `page` key (because the section we're\n // inside is itself in another slot), inherit THAT — it's the real page.\n const outerPage = (pageDS as any)?.page;\n const truePageNamespace = outerPage ?? pageDS;\n return {\n ...sectionLocal,\n dataSources: {\n ...sectionDS,\n template: sectionLocalTemplate,\n page: truePageNamespace,\n },\n };\n }, [sectionLocalData, sectionCtx?.pageOuterData]);\n\n // ALL hooks above are unconditional. From here, branch based on mode.\n const styles = styleFactory(css);\n const text = label && label.trim().length > 0 ? label : \"Drop Here\";\n const slotUid =\n _uid ||\n (studioAttributes as any)?.[COMPOSABLE_DATA_ATTRIBUTES.ID] ||\n \"section-slot\";\n\n // Design-mode hint (COMS-1770): resolve the Default section's title for the\n // message. `getComponent` throws for a uid outside the locally-known catalog,\n // so fall back to a nameless hint instead of crashing the slot.\n let defaultSectionTitle: string | undefined;\n if (defaultSection) {\n try {\n defaultSectionTitle =\n componentRegistry.getComponent(defaultSection)?.displayName;\n } catch {\n defaultSectionTitle = undefined;\n }\n }\n\n // COMS-1809: open the section-slot picker. The button lives here in the\n // iframe, but the picker is a parent-app overlay (reusing the Component tab\n // card + hover preview + section catalog — ADR 0010), so we only post the\n // slot identity plus the button's viewport rect. Studio offsets the rect by\n // the iframe's own position to anchor the popover. Plain function (used only\n // in the consumption design-empty branch below), not a hook.\n const handleSelectSection = (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n const r = event.currentTarget.getBoundingClientRect();\n composableStudioEventManager?.send(\n POST_MESSAGE_EVENTS.OPEN_SECTION_SLOT_PICKER,\n {\n sectionInstanceUid: sectionCtx?.sectionInstanceUid,\n slotUid,\n buttonRect: {\n top: r.top,\n left: r.left,\n right: r.right,\n bottom: r.bottom,\n width: r.width,\n height: r.height,\n },\n },\n );\n };\n\n // Authoring mode: section is the top-level composition being edited.\n if (!sectionCtx) {\n return (\n <div\n {...{\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,\n }}\n {...studioAttributes}\n className={classNames(styles.slotStyle)}\n >\n <span\n ref={authoringCopyColor.ref}\n className={classNames(\n styles.slotDropText,\n authoringCopyColor.colorClassName,\n authoringCopyColor.strokeClassName,\n )}\n >\n <AddIcon /> {text}\n </span>\n </div>\n );\n }\n\n // Consumption mode.\n const filled = (sectionCtx.slotsMap[slotUid] || []) as Node[];\n const dropZoneAttrs = {\n [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.NODE]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.ID]: sectionCtx.sectionInstanceUid,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,\n };\n\n if (filled.length === 0) {\n // Preview mode: an empty slot falls back to its authored default section\n // (COMS-1659), rendered like production — non-interactive, no drop chrome.\n // With no default it collapses to nothing. Design mode always shows the\n // dropzone below (default never shown while authoring the placement).\n if (isSectionPreview) {\n if (!defaultSection) return null;\n const synth = makeDefaultSectionNode(\n sectionCtx.sectionInstanceUid,\n slotUid,\n defaultSection,\n );\n NODE_TO_PARENT.set(synth, sectionCtx.sectionNode);\n NODE_TO_PATH_NODE.set(synth, [slotUid, 0]);\n return (\n <DataCtxProvider value={slotChildData}>\n <PreviewModeContext.Provider value={true}>\n <div style={{ display: \"contents\" }}>\n <SectionInstanceSlotsCtx.Provider value={undefined}>\n <CurrentNodeContext.Provider\n value={{\n currentNodeUid: synth.uid,\n currentNodePath: [...parentNodePath, [slotUid, 0]],\n }}\n >\n <Element node={synth} renderError={() => null as any} />\n </CurrentNodeContext.Provider>\n </SectionInstanceSlotsCtx.Provider>\n </div>\n </PreviewModeContext.Provider>\n </DataCtxProvider>\n );\n }\n return (\n <div\n ref={slotDomRef as any}\n {...dropZoneAttrs}\n {...studioAttributes}\n // Always column now (COMS-1809): the \"Select section\" button stacks\n // below the drop copy in every design-mode empty slot.\n className={classNames(styles.slotStyle, styles.slotColumnStyle)}\n >\n {/* One empty-state layout regardless of a configured default — only\n the parenthetical hint below is default-only. The drop copy keeps\n \"…to replace it\" solely when there IS a default to replace. */}\n <span\n ref={dropCopyColor.ref}\n className={classNames(\n styles.slotDropText,\n dropCopyColor.colorClassName,\n dropCopyColor.strokeClassName,\n )}\n >\n <AddIcon />{\" \"}\n {defaultSection\n ? \"Drop a section here to replace it.\"\n : \"Drop a section here.\"}\n </span>\n {/* Design-mode hint (COMS-1770): tell the page composer that leaving\n this slot empty will render the author's Default section in preview\n and on the live page. Mirrors the repeater's condition-block hint\n (Slot.tsx). Only shown when a default is configured. */}\n {defaultSection ? (\n <p\n ref={defaultHintCopyColor.ref}\n className={classNames(\n styles.slotDefaultHint,\n defaultHintCopyColor.colorClassName,\n defaultHintCopyColor.strokeClassName,\n )}\n >\n {\"(When this slot is empty, the default section\"}\n {defaultSectionTitle ? (\n <>\n {\" (\"}\n <strong>{defaultSectionTitle}</strong>\n {\")\"}\n </>\n ) : null}\n {\n \" added by the section author is shown in Preview and on the live page.)\"\n }\n </p>\n ) : null}\n {/* COMS-1809: click-to-pick alternative to drag-and-drop. The \"OR\"\n reads DND vs picker, so it shows in every empty slot. */}\n <p\n ref={orDividerCopyColor.ref}\n className={classNames(\n styles.slotOrDivider,\n orDividerCopyColor.colorClassName,\n orDividerCopyColor.strokeClassName,\n )}\n >\n OR\n </p>\n <p\n ref={allowedLabelCopyColor.ref}\n className={classNames(\n styles.slotAllowedLabel,\n allowedLabelCopyColor.colorClassName,\n allowedLabelCopyColor.strokeClassName,\n )}\n >\n Add from the allowed Sections\n </p>\n <Button\n type=\"button\"\n data-studio-ui={true}\n className={styles.slotSelectButton}\n // Swallow mousedown so the slot's drag-select never starts from the\n // button; the click opens the picker instead.\n onMouseDown={(e) => e.stopPropagation()}\n onClick={handleSelectSection}\n >\n <SelectSectionIcon /> Select section\n </Button>\n </div>\n );\n }\n\n // Transclude filled children. Anchor each child's slate path under the\n // page-side section-composition node + this slot's uid. In design mode, exit\n // preview so Element's internalAttributes get applied — making each child\n // selectable, hover-highlightable, and draggable like a normal node. In\n // preview mode, keep them inside preview (non-interactive) and drop the\n // drop-zone attributes so the slot reads like production.\n return (\n <DataCtxProvider value={slotChildData}>\n <PreviewModeContext.Provider value={isSectionPreview}>\n <div\n ref={slotDomRef as any}\n {...(isSectionPreview ? {} : dropZoneAttrs)}\n {...studioAttributes}\n style={{ display: \"contents\" }}\n >\n {/*\n * The filled children are PAGE-authored content the composer dropped\n * into this slot — not part of the section's authored body. Clear the\n * section-instance context for them so their own internal slots render\n * normally (e.g. an empty Repeater dropped here shows its \"Drop Here\"\n * placeholder instead of being suppressed by Slot.tsx's\n * in-section-consumption guard, which would make it disappear).\n */}\n <SectionInstanceSlotsCtx.Provider value={undefined}>\n {filled.map((child, idx) => {\n if (!child || typeof child !== \"object\") return null;\n NODE_TO_PARENT.set(child, sectionCtx.sectionNode);\n NODE_TO_PATH_NODE.set(child, [slotUid, idx]);\n const childPath: Path = [...parentNodePath, [slotUid, idx]];\n return (\n <CurrentNodeContext.Provider\n key={child.uid}\n value={{\n currentNodeUid: child.uid,\n currentNodePath: childPath,\n }}\n >\n <SelectedNodeProvider>\n <Element node={child} renderError={() => null as any} />\n </SelectedNodeProvider>\n </CurrentNodeContext.Provider>\n );\n })}\n </SectionInstanceSlotsCtx.Provider>\n </div>\n </PreviewModeContext.Provider>\n </DataCtxProvider>\n );\n}\n\n// Marquee-select glyph for the \"Select section\" button (COMS-1809) — the\n// design's asset verbatim, with fills switched to `currentColor` so it\n// inherits the button's white text.\nconst SelectSectionIcon: React.FC = () => {\n return (\n <svg\n width=\"18\"\n height=\"12\"\n viewBox=\"0 0 18 12\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M1.09375 0.9375C1.00746 0.9375 0.9375 1.00746 0.9375 1.09375V2.34375C0.9375 2.60263 0.727633 2.8125 0.46875 2.8125C0.209867 2.8125 0 2.60263 0 2.34375V1.09375C0 0.489689 0.489688 0 1.09375 0H2.34375C2.60263 0 2.8125 0.209867 2.8125 0.46875C2.8125 0.727633 2.60263 0.9375 2.34375 0.9375H1.09375ZM4.375 0.46875C4.375 0.209867 4.58487 0 4.84375 0H7.34375C7.60263 0 7.8125 0.209867 7.8125 0.46875C7.8125 0.727633 7.60263 0.9375 7.34375 0.9375H4.84375C4.58487 0.9375 4.375 0.727633 4.375 0.46875ZM9.375 0.46875C9.375 0.209867 9.58487 0 9.84375 0H12.3438C12.6026 0 12.8125 0.209867 12.8125 0.46875C12.8125 0.727633 12.6026 0.9375 12.3438 0.9375H9.84375C9.58487 0.9375 9.375 0.727633 9.375 0.46875ZM14.375 0.46875C14.375 0.209867 14.5849 0 14.8438 0H16.0938C16.6978 0 17.1875 0.489688 17.1875 1.09375V2.5C17.1875 2.75888 16.9776 2.96875 16.7188 2.96875C16.4599 2.96875 16.25 2.75888 16.25 2.5V1.09375C16.25 1.00746 16.18 0.9375 16.0938 0.9375H14.8438C14.5849 0.9375 14.375 0.727633 14.375 0.46875ZM0.46875 4.375C0.727633 4.375 0.9375 4.58487 0.9375 4.84375V6.09375C0.9375 6.18004 1.00746 6.25 1.09375 6.25H2.03125C2.29013 6.25 2.5 6.45987 2.5 6.71875C2.5 6.97763 2.29013 7.1875 2.03125 7.1875H1.09375C0.489689 7.1875 0 6.69781 0 6.09375V4.84375C0 4.58487 0.209867 4.375 0.46875 4.375ZM16.7188 4.84375C16.9776 4.84375 17.1875 5.05362 17.1875 5.3125V6.71875C17.1875 6.97763 16.9776 7.1875 16.7188 7.1875C16.4599 7.1875 16.25 6.97763 16.25 6.71875V5.3125C16.25 5.05362 16.4599 4.84375 16.7188 4.84375ZM3.4375 6.71875C3.4375 6.45987 3.64737 6.25 3.90625 6.25H5.78125C6.04013 6.25 6.25 6.45987 6.25 6.71875C6.25 6.97763 6.04013 7.1875 5.78125 7.1875H3.90625C3.64737 7.1875 3.4375 6.97763 3.4375 6.71875ZM7.1875 6.71875C7.1875 6.45987 7.39737 6.25 7.65625 6.25H8.59375C8.85263 6.25 9.0625 6.45987 9.0625 6.71875C9.0625 6.97763 8.85263 7.1875 8.59375 7.1875H7.65625C7.39737 7.1875 7.1875 6.97763 7.1875 6.71875Z\"\n fill=\"currentColor\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M9.79852 4.73594C9.72732 4.06274 10.4877 3.62376 11.0351 4.02202L16.3345 7.8776C16.9193 8.30303 16.6619 9.22617 15.9414 9.28775L13.3774 9.5069L11.9056 11.6178C11.492 12.211 10.5639 11.9723 10.4878 11.2532L9.79852 4.73594ZM10.7678 4.98694L11.3761 10.7381L12.6503 8.91063C12.783 8.7203 12.9934 8.5988 13.2246 8.57904L15.4443 8.38932L10.7678 4.98694Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n"],"names":["_jsx","_jsxs","Element","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA;;;;;AAKG;AACH,SAAS,sBAAsB,CAC7B,WAA+B,EAC/B,OAAe,EACf,UAAkB,EAAA;;;;;;AAOlB,IAAA,MAAM,MAAM,GAAG,WAAW,GAAG,CAAA,EAAG,WAAW,CAAA,CAAA,CAAG,GAAG,EAAE;IACnD,OAAO;AACL,QAAA,IAAI,EAAE,qBAAqB;AAC3B,QAAA,GAAG,EAAE,CAAA,EAAG,MAAM,GAAG,OAAO,CAAA,SAAA,EAAY,UAAU,CAAA,CAAE;QAChD,QAAQ,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;AACzD,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,MAAM,EAAE,EAAE;KACH;AACX;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,WAAW,CAAC,EAC1B,gBAAgB,EAChB,KAAK,EACL,IAAI,EACJ,cAAc,GACS,EAAA;;;;;AAKvB,IAAA,MAAM,kBAAkB,GAAG,gBAAgB,EAAmB;AAC9D,IAAA,MAAM,aAAa,GAAG,gBAAgB,EAAmB;AACzD,IAAA,MAAM,oBAAoB,GAAG,gBAAgB,EAAwB;AACrE,IAAA,MAAM,kBAAkB,GAAG,gBAAgB,EAAwB;AACnE,IAAA,MAAM,qBAAqB,GAAG,gBAAgB,EAAwB;AACtE,IAAA,MAAM,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+B,EAAA,CAC/B,EAAA,CACsB,EAAA,CACd;AAEtB;AAEA;AACA;AACA;AACA,MAAM,iBAAiB,GAAa,MAAK;AACvC,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,aAAA,EACtB,MAAM,EAAA,QAAA,EAAA,CAElBD,GAAA,CAAA,MAAA,EAAA,EACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,22DAA22D,EAC72D,IAAI,EAAC,cAAc,EAAA,CACnB,EACFA,GAAA,CAAA,MAAA,EAAA,EACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,6VAA6V,EAC/V,IAAI,EAAC,cAAc,EAAA,CACnB,CAAA,EAAA,CACE;AAEV,CAAC;;;;"}
1
+ {"version":3,"file":"SectionSlot.js","sources":["../../../src/components/elements/SectionSlot.tsx"],"sourcesContent":["import {\n COMPOSABLE_DATA_ATTRIBUTES,\n ELEMENT_TO_NODE,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n} from \"@contentstack/studio-client\";\nimport { Node, Path } from \"@contentstack/studio-internal\";\nimport {\n CurrentNodeContext,\n DataCtxProvider,\n SectionInstanceSlotsCtx,\n} from \"@contentstack/studio-react-components/contexts\";\nimport {\n useCurrentNode,\n useData,\n} from \"@contentstack/studio-react-components/hooks\";\nimport { css } from \"goober\";\nimport classNames from \"classnames\";\nimport { useCallback, useContext, useMemo } from \"react\";\nimport { styleFactory } from \"../styles\";\nimport { StudioAttributes } from \"../../types\";\nimport { SelectedNodeProvider } from \"../../contexts/providers/selected-node.provider\";\nimport { PreviewModeContext } from \"../../contexts/providers/preview-mode.provider\";\nimport { SectionModeContext } from \"../../contexts/providers/section-mode.provider\";\nimport { useRenderer } from \"../../hooks/use-renderer.hook\";\nimport { useSlotCopyColor } from \"../../hooks/use-slot-copy-color.hook\";\nimport Element from \"../Element\";\nimport { SlotChildrenWithPermanentDropZones } from \"../PermanentDropZone\";\nimport { AddIcon } from \"../AddIcon\";\n\ninterface SectionSlotEditorProps extends StudioAttributes {\n label?: string;\n _uid?: string;\n /** Authored Slot default section uid (COMS-1659). Rendered when the slot is\n * empty in preview mode; design mode keeps the dropzone. */\n defaultSection?: string;\n}\n\n/**\n * In-memory `section-composition` node for a slot's authored default. Rendered\n * through the normal element path so the default's spec resolves by\n * `compositionUID` and nested defaults recurse. Stable uid → no remount. Never\n * persisted into the placement.\n */\nfunction makeDefaultSectionNode(\n instanceUid: string | undefined,\n slotUid: string,\n defaultUid: string,\n): Node {\n // Key by the enclosing placement instance too (COMS-1659): the same section\n // placed twice shares one internal `slotUid`, so a slot-uid-only key would\n // collide across placements and make their empty-slot defaults share one\n // uid-keyed data context. The instance uid makes each placement's default\n // distinct.\n const prefix = instanceUid ? `${instanceUid}-` : \"\";\n return {\n type: \"section-composition\",\n uid: `${prefix}${slotUid}-default-${defaultUid}`,\n metadata: { compositionUID: defaultUid, mode: \"preview\" },\n attrs: {},\n props: {},\n slots: {},\n styles: {},\n } as Node;\n}\n\n/**\n * Editor variant of section-slot. Two modes:\n *\n * 1. **Authoring mode** (no SectionInstanceSlotsCtx in scope) — the section\n * composition is being authored. Render a labelled drop-zone-style\n * placeholder; not droppable into (section slots only accept drops when\n * the section is consumed in a page composition).\n *\n * 2. **Consumption mode** (SectionInstanceSlotsCtx present) — the section\n * is being rendered inside a page composition. Look up the page-side\n * slots map by this slot's stable uid (== this node's uid). If filled,\n * transclude the children via <Element> with their paths anchored to\n * the page-side section-composition node, and lift them out of preview\n * mode so they're individually selectable / hover-targetable / draggable\n * like any other page-tree node. If empty, render a labelled drop\n * target that itself acts as a builder node (attributes mapped to the\n * page-side section-composition parent), so hover highlights only the\n * slot zone — not the whole section.\n */\nexport function SectionSlot({\n studioAttributes,\n label,\n _uid,\n defaultSection,\n}: SectionSlotEditorProps) {\n // ALL hooks unconditionally at the top — React doesn't allow conditional\n // hook calls and the component returns early for authoring/empty modes.\n // One measurement per line of empty-slot chrome: each reads the page colour\n // behind itself and picks the palette entry that separates from it best.\n const authoringCopyColor = useSlotCopyColor<HTMLSpanElement>();\n const dropCopyColor = useSlotCopyColor<HTMLSpanElement>();\n const defaultHintCopyColor = useSlotCopyColor<HTMLParagraphElement>();\n const sectionCtx = useContext(SectionInstanceSlotsCtx);\n // Registry resolves the authored Default section's human title for the\n // design-mode hint (COMS-1770). Sections register with `type = section.uid`\n // and `displayName = section.title`, so a uid lookup yields the title.\n const { componentRegistry } = useRenderer();\n // When the enclosing placed section is in preview mode, the slot renders like\n // production: an empty slot collapses to nothing and a filled slot drops its\n // drop-chrome / selection affordances.\n const isSectionPreview = useContext(SectionModeContext) === \"preview\";\n const { currentNodePath: parentNodePath = [] } = useCurrentNode();\n // Current section-local data (template scoped to section, in-section\n // repeater item if surrounding, etc.). Slot children inherit this as\n // their *default* context — the user's authored bindings on slot\n // children resolve against this by default.\n const sectionLocalData = useData();\n const slotDomRef = useCallback(\n (el: HTMLElement | null) => {\n if (el && sectionCtx?.sectionNode) {\n ELEMENT_TO_NODE.set(el, sectionCtx.sectionNode);\n }\n },\n [sectionCtx?.sectionNode],\n );\n // Slot child's data context namespace:\n //\n // dataSources.template = section-local scoped template; if the\n // slot sits inside an in-section\n // Repeater that's currently iterating,\n // this is the active iteration item.\n // Matches what the Data Picker writes\n // when authoring against fields from\n // the slot's surrounding section scope.\n // dataSources.repeater[uid] = in-section Repeater map (full\n // per-uid context). Inherited from\n // sectionLocal via {...sectionDS}.\n // dataSources.static_value = section's persisted static values.\n // dataSources.page = OUTERMOST page-level namespace\n // ({ template, contentstack,\n // contentstack_queries, ... }).\n // Always points to the real page even\n // across recursive slot nesting — see\n // `truePageNamespace` below.\n //\n // Until Phase 8 lands, picker emits `dataSources.<src>.X` paths only.\n // retrieve-data.ts retries unresolved `dataSources.<src>.X` lookups under\n // `dataSources.page.<src>.X` so page-level bindings authored on slot\n // children still resolve.\n const slotChildData = useMemo(() => {\n const sectionLocal: any = sectionLocalData || {};\n const pageOuter: any = sectionCtx?.pageOuterData || {};\n const pageDS = pageOuter?.dataSources || {};\n const sectionDS = sectionLocal?.dataSources || {};\n\n const repeaterMap = (sectionDS.repeater || {}) as Record<string, any>;\n const repeaterUids = Object.keys(repeaterMap);\n const activeRepeaterUid =\n repeaterUids.length > 0\n ? repeaterUids[repeaterUids.length - 1]\n : undefined;\n const activeItem = activeRepeaterUid\n ? repeaterMap[activeRepeaterUid]?.context\n : undefined;\n const sectionLocalTemplate = activeItem ?? sectionDS.template;\n\n // Slot child's default namespace = section-local context AS IS (template,\n // repeater, static_value, …). Page-level sources are nested under `page.*`\n // as the explicit escape. This matches what the Data Picker writes when\n // authoring a slot child (picker shows the slot child's surrounding\n // scope, so its `template.X` / `repeater[uid].context.X` paths resolve\n // natively without rewriting).\n //\n // For nested cases (Section B in Section A's slot), `page` must always\n // point to the OUTERMOST page context — not to Section A's slot-local\n // view. Otherwise each nesting level shadows `page` with the surrounding\n // section's local, and `dataSources.page.template.title` would resolve\n // to a modular_block item instead of the page entry. So: if the outer\n // dataSources already has its own `page` key (because the section we're\n // inside is itself in another slot), inherit THAT — it's the real page.\n const outerPage = (pageDS as any)?.page;\n const truePageNamespace = outerPage ?? pageDS;\n return {\n ...sectionLocal,\n dataSources: {\n ...sectionDS,\n template: sectionLocalTemplate,\n page: truePageNamespace,\n },\n };\n }, [sectionLocalData, sectionCtx?.pageOuterData]);\n\n // ALL hooks above are unconditional. From here, branch based on mode.\n const styles = styleFactory(css);\n const text = label && label.trim().length > 0 ? label : \"Drop Here\";\n const slotUid =\n _uid ||\n (studioAttributes as any)?.[COMPOSABLE_DATA_ATTRIBUTES.ID] ||\n \"section-slot\";\n\n // Design-mode hint (COMS-1770): resolve the Default section's title for the\n // message. `getComponent` throws for a uid outside the locally-known catalog,\n // so fall back to a nameless hint instead of crashing the slot.\n let defaultSectionTitle: string | undefined;\n if (defaultSection) {\n try {\n defaultSectionTitle =\n componentRegistry.getComponent(defaultSection)?.displayName;\n } catch {\n defaultSectionTitle = undefined;\n }\n }\n\n // Authoring mode: section is the top-level composition being edited.\n if (!sectionCtx) {\n return (\n <div\n {...{\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,\n }}\n {...studioAttributes}\n className={classNames(styles.slotStyle)}\n >\n <span\n ref={authoringCopyColor.ref}\n className={classNames(\n styles.slotDropText,\n authoringCopyColor.colorClassName,\n authoringCopyColor.strokeClassName,\n )}\n >\n <AddIcon /> {text}\n </span>\n </div>\n );\n }\n\n // Consumption mode.\n const filled = (sectionCtx.slotsMap[slotUid] || []) as Node[];\n const dropZoneAttrs = {\n [COMPOSABLE_DATA_ATTRIBUTES.BUILDER]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.NODE]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.ID]: sectionCtx.sectionInstanceUid,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT]: true,\n [COMPOSABLE_DATA_ATTRIBUTES.SLOT_UID]: slotUid,\n };\n\n if (filled.length === 0) {\n // Preview mode: an empty slot falls back to its authored default section\n // (COMS-1659), rendered like production — non-interactive, no drop chrome.\n // With no default it collapses to nothing. Design mode always shows the\n // dropzone below (default never shown while authoring the placement).\n if (isSectionPreview) {\n if (!defaultSection) return null;\n const synth = makeDefaultSectionNode(\n sectionCtx.sectionInstanceUid,\n slotUid,\n defaultSection,\n );\n NODE_TO_PARENT.set(synth, sectionCtx.sectionNode);\n NODE_TO_PATH_NODE.set(synth, [slotUid, 0]);\n return (\n <DataCtxProvider value={slotChildData}>\n <PreviewModeContext.Provider value={true}>\n <div style={{ display: \"contents\" }}>\n <SectionInstanceSlotsCtx.Provider value={undefined}>\n <CurrentNodeContext.Provider\n value={{\n currentNodeUid: synth.uid,\n currentNodePath: [...parentNodePath, [slotUid, 0]],\n }}\n >\n <Element node={synth} renderError={() => null as any} />\n </CurrentNodeContext.Provider>\n </SectionInstanceSlotsCtx.Provider>\n </div>\n </PreviewModeContext.Provider>\n </DataCtxProvider>\n );\n }\n return (\n <div\n ref={slotDomRef as any}\n {...dropZoneAttrs}\n {...studioAttributes}\n // Column: the default-section hint stacks below the drop copy. Sections\n // are added by dropping one here or from the slot's Insert handle in\n // Studio (COMS-2392), which offers the slot's allowed sections.\n className={classNames(styles.slotStyle, styles.slotColumnStyle)}\n >\n {/* One empty-state layout regardless of a configured default — only\n the parenthetical hint below is default-only. The drop copy keeps\n \"…to replace it\" solely when there IS a default to replace. */}\n <span\n ref={dropCopyColor.ref}\n className={classNames(\n styles.slotDropText,\n dropCopyColor.colorClassName,\n dropCopyColor.strokeClassName,\n )}\n >\n <AddIcon />{\" \"}\n {defaultSection\n ? \"Drop a section here to replace it.\"\n : \"Drop a section here.\"}\n </span>\n {/* Design-mode hint (COMS-1770): tell the page composer that leaving\n this slot empty will render the author's Default section in preview\n and on the live page. Mirrors the repeater's condition-block hint\n (Slot.tsx). Only shown when a default is configured. */}\n {defaultSection ? (\n <p\n ref={defaultHintCopyColor.ref}\n className={classNames(\n styles.slotDefaultHint,\n defaultHintCopyColor.colorClassName,\n defaultHintCopyColor.strokeClassName,\n )}\n >\n {\"(When this slot is empty, the default section\"}\n {defaultSectionTitle ? (\n <>\n {\" (\"}\n <strong>{defaultSectionTitle}</strong>\n {\")\"}\n </>\n ) : null}\n {\n \" added by the section author is shown in Preview and on the live page.)\"\n }\n </p>\n ) : null}\n </div>\n );\n }\n\n // Transclude filled children. Anchor each child's slate path under the\n // page-side section-composition node + this slot's uid. In design mode, exit\n // preview so Element's internalAttributes get applied — making each child\n // selectable, hover-highlightable, and draggable like a normal node. In\n // preview mode, keep them inside preview (non-interactive) and drop the\n // drop-zone attributes so the slot reads like production.\n return (\n <DataCtxProvider value={slotChildData}>\n <PreviewModeContext.Provider value={isSectionPreview}>\n <div\n ref={slotDomRef as any}\n {...(isSectionPreview ? {} : dropZoneAttrs)}\n {...studioAttributes}\n style={{ display: \"contents\" }}\n >\n {/*\n * The filled children are PAGE-authored content the composer dropped\n * into this slot — not part of the section's authored body. Clear the\n * section-instance context for them so their own internal slots render\n * normally (e.g. an empty Repeater dropped here shows its \"Drop Here\"\n * placeholder instead of being suppressed by Slot.tsx's\n * in-section-consumption guard, which would make it disappear).\n */}\n <SectionInstanceSlotsCtx.Provider value={undefined}>\n <SlotChildrenWithPermanentDropZones\n slotOwner={sectionCtx.sectionNode}\n slotChildren={filled}\n renderSlotChild={(child, idx) => {\n if (!child || typeof child !== \"object\") return null;\n NODE_TO_PARENT.set(child, sectionCtx.sectionNode);\n NODE_TO_PATH_NODE.set(child, [slotUid, idx]);\n const childPath: Path = [...parentNodePath, [slotUid, idx]];\n return (\n <CurrentNodeContext.Provider\n value={{\n currentNodeUid: child.uid,\n currentNodePath: childPath,\n }}\n >\n <SelectedNodeProvider>\n <Element node={child} renderError={() => null as any} />\n </SelectedNodeProvider>\n </CurrentNodeContext.Provider>\n );\n }}\n />\n </SectionInstanceSlotsCtx.Provider>\n </div>\n </PreviewModeContext.Provider>\n </DataCtxProvider>\n );\n}\n"],"names":["_jsx","_jsxs","Element","_Fragment"],"mappings":";;;;;;;;;;;;;;;;;AAsCA;;;;;AAKG;AACH,SAAS,sBAAsB,CAC7B,WAA+B,EAC/B,OAAe,EACf,UAAkB,EAAA;;;;;;AAOlB,IAAA,MAAM,MAAM,GAAG,WAAW,GAAG,CAAA,EAAG,WAAW,CAAA,CAAA,CAAG,GAAG,EAAE;IACnD,OAAO;AACL,QAAA,IAAI,EAAE,qBAAqB;AAC3B,QAAA,GAAG,EAAE,CAAA,EAAG,MAAM,GAAG,OAAO,CAAA,SAAA,EAAY,UAAU,CAAA,CAAE;QAChD,QAAQ,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;AACzD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AC3D,4BAAA,QACEA,GAAA,CAAC,kBAAkB,CAAC,QAAQ,EAAA,EAC1B,KAAK,EAAE;oCACL,cAAc,EAAE,KAAK,CAAC,GAAG;AACzB,oCAAA,eAAe,EAAE,SAAS;iCAC3B,EAAA,QAAA,EAEDA,GAAA,CAAC,oBAAoB,EAAA,EAAA,QAAA,EACnBA,GAAA,CAACE,eAAO,EAAA,EAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,IAAW,GAAI,EAAA,CACnC,EAAA,CACK;AAElC,wBAAA,CAAC,GACD,EAAA,CAC+B,EAAA,CAC/B,EAAA,CACsB,EAAA,CACd;AAEtB;;;;"}
@@ -1,10 +1,33 @@
1
+ import { COMPOSABLE_DATA_ATTRIBUTES } from '@contentstack/studio-client';
1
2
  import { STUDIO_CHROME_MODES } from '../utils/copy-color.util.js';
2
3
 
3
- /** Builds one class per chrome mode from the same tokens the maths reads. */
4
- const perMode = (css, rule) => Object.fromEntries(Object.entries(STUDIO_CHROME_MODES).map(([mode, tokens]) => [
5
- mode,
6
- css(rule(tokens)),
4
+ /** Builds one class per chrome mode from a table of each mode's tokens. */
5
+ const buildClassPerChromeMode = (css, tokensByChromeMode, buildRule) => Object.fromEntries(Object.keys(tokensByChromeMode).map((chromeMode) => [
6
+ chromeMode,
7
+ css(buildRule(tokensByChromeMode[chromeMode])),
7
8
  ]));
9
+ /**
10
+ * Light keeps the pinned design; dark takes the dark chrome tokens so the zone
11
+ * doesn't glare on a dark page.
12
+ */
13
+ const PERMANENT_DROP_ZONE_COLORS_BY_CHROME_MODE = {
14
+ light: {
15
+ background: "#FAFAFA",
16
+ borderColor: "#D1D5DB",
17
+ targetedBackground: "#EDE9FE",
18
+ iconColor: "#9CA3AF",
19
+ // Darker than the design's grey, which read as disabled; matches the ink
20
+ // of the empty-slot copy.
21
+ labelColor: STUDIO_CHROME_MODES.light.secondary,
22
+ },
23
+ dark: {
24
+ background: STUDIO_CHROME_MODES.dark.surface,
25
+ borderColor: STUDIO_CHROME_MODES.dark.surfaceEdge,
26
+ targetedBackground: STUDIO_CHROME_MODES.dark.emphasisSurface,
27
+ iconColor: "rgba(255, 255, 255, 0.6)",
28
+ labelColor: STUDIO_CHROME_MODES.dark.secondary,
29
+ },
30
+ };
8
31
  const styleFactory = (css) => ({
9
32
  embedStyle: css({
10
33
  height: "100%",
@@ -87,7 +110,7 @@ const styleFactory = (css) => ({
87
110
  // colour that gets scored is the colour that gets painted. `!important`
88
111
  // because this chrome renders inside the customer's page, whose CSS would
89
112
  // otherwise recolour it.
90
- slotCopyColors: perMode(css, (tokens) => ({
113
+ slotCopyColors: buildClassPerChromeMode(css, STUDIO_CHROME_MODES, (tokens) => ({
91
114
  color: `${tokens.ink} !important`,
92
115
  })),
93
116
  // A stroke for a bare label the ink cannot carry on its own — the mid-tone
@@ -95,7 +118,7 @@ const styleFactory = (css) => ({
95
118
  // sit on. Stroking in the opposite mode's ink gives each glyph its own local
96
119
  // polarity without painting a fill behind it. `paint-order` puts the stroke
97
120
  // under the fill so the letterforms stay their own weight.
98
- slotCopyStroke: perMode(css, (tokens) => ({
121
+ slotCopyStroke: buildClassPerChromeMode(css, STUDIO_CHROME_MODES, (tokens) => ({
99
122
  // Stroke in the opposite mode's ink — that is the colour guaranteed to
100
123
  // contrast with this mode's.
101
124
  WebkitTextStroke: `2px ${tokens.surface}`,
@@ -125,57 +148,58 @@ const styleFactory = (css) => ({
125
148
  lineHeight: "24px !important",
126
149
  letterSpacing: "0 !important",
127
150
  }),
128
- // Section-slot "Select section" affordance (COMS-1809). Renders inside the
129
- // customer's page, so — like slotDefaultHint — the visual props are pinned
130
- // with `!important` to survive the host page's CSS. The button overrides the
131
- // shared studio-core Button base (light-purple outline) to the filled-purple
132
- // primary shown in the design.
133
- slotSelectButton: css({
134
- backgroundColor: "#6c5ce7 !important",
135
- color: "#ffffff !important",
136
- border: "1px solid #6c5ce7 !important",
137
- fontWeight: "600 !important",
138
- // Pin the icon/text alignment too — the studio-core base sets flex
139
- // centering, but host-page CSS can override it, leaving the icon riding
140
- // above the label. The svg is inline by default (baseline-aligned), so
141
- // make it a block flex item.
142
- display: "inline-flex !important",
143
- alignItems: "center !important",
144
- justifyContent: "center !important",
145
- gap: "0.5rem !important",
146
- // Typography pinned as well: a host font-size/line-height override makes
147
- // the label's line box taller than the 12px icon and drags its visual
148
- // center away from the icon's. line-height 1 makes the text flex item
149
- // exactly glyph-high, so both centers coincide.
150
- fontSize: "0.875rem !important",
151
- lineHeight: "1 !important",
152
- fontFamily: "'Inter', sans-serif !important",
151
+ // A permanent drop zone beside a Repeater. Layout only; its colours come
152
+ // from `permanentDropZoneColors`, picked per page tone like the slot chrome.
153
+ permanentDropZone: css({
154
+ boxSizing: "border-box",
155
+ margin: 0,
156
+ display: "flex",
157
+ flexFlow: "wrap",
158
+ alignItems: "center",
159
+ justifyContent: "center",
160
+ gap: "0 12px",
161
+ padding: "8px 16px",
162
+ minHeight: "44px",
163
+ borderWidth: "2px",
164
+ borderStyle: "dashed",
165
+ borderRadius: 0,
166
+ userSelect: "none",
167
+ transition: "background-color 0.15s, border-color 0.15s",
168
+ }),
169
+ // The zone has its own fill, so it stays readable in light on a page whose
170
+ // colour can't be measured. `!important` on the copy, set through these
171
+ // variables, because the customer's CSS reaches it too.
172
+ permanentDropZoneColors: buildClassPerChromeMode(css, PERMANENT_DROP_ZONE_COLORS_BY_CHROME_MODE, (colors) => ({
173
+ background: colors.background,
174
+ borderColor: colors.borderColor,
175
+ "--cs-permanent-drop-zone-icon": colors.iconColor,
176
+ "--cs-permanent-drop-zone-label": colors.labelColor,
177
+ // Highlights while a drag targets it: the client marks the zone it picked
178
+ // as the drop target, the same choice that tells Studio where it drops.
179
+ [`&[${COMPOSABLE_DATA_ATTRIBUTES.PERMANENT_DROP_ZONE_TARGETED}]`]: {
180
+ background: colors.targetedBackground,
181
+ borderColor: "#6C5CE7",
182
+ },
183
+ })),
184
+ permanentDropZoneAwaitingBackdrop: css({
185
+ display: "none !important",
186
+ }),
187
+ permanentDropZoneLabelRow: css({
188
+ display: "flex",
189
+ alignItems: "center",
190
+ gap: "8px",
191
+ // The icon draws in `currentColor`.
192
+ color: "var(--cs-permanent-drop-zone-icon) !important",
153
193
  "& svg": {
154
- display: "block",
155
194
  flexShrink: 0,
156
- // Optical centering: the flex boxes align exactly (verified — svg/text
157
- // center deltas are 0), but the asset's dashed marquee occupies only the
158
- // top 7.2px of its 18x12 box with the pointer overhanging below-right,
159
- // so a box-centered icon READS ~2px high. Nudge down so the marquee —
160
- // the dominant shape — centers on the label, pointer descending like a
161
- // glyph descender (matches the design).
162
- transform: "translateY(2px)",
163
195
  },
164
196
  }),
165
- slotOrDivider: css({
166
- margin: 0,
167
- textAlign: "center",
168
- fontFamily: "Inter, sans-serif !important",
169
- fontSize: "12px !important",
170
- fontWeight: "400 !important",
171
- textTransform: "uppercase",
172
- }),
173
- slotAllowedLabel: css({
174
- margin: 0,
175
- textAlign: "center",
197
+ permanentDropZoneLabel: css({
198
+ color: "var(--cs-permanent-drop-zone-label) !important",
176
199
  fontFamily: "Inter, sans-serif !important",
177
- fontSize: "12px !important",
178
- fontWeight: "600 !important",
200
+ fontSize: "13px !important",
201
+ fontStyle: "normal !important",
202
+ fontWeight: "500 !important",
179
203
  }),
180
204
  embeddedSectionHost: css({
181
205
  position: "relative",
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../src/components/styles.ts"],"sourcesContent":["import { css as gooberCss, CSSAttribute } from \"goober\";\nimport {\n STUDIO_CHROME_MODES,\n StudioChromeMode,\n} from \"../utils/copy-color.util\";\n\n/** Builds one class per chrome mode from the same tokens the maths reads. */\nconst perMode = (\n css: typeof gooberCss,\n rule: (\n tokens: (typeof STUDIO_CHROME_MODES)[StudioChromeMode],\n ) => CSSAttribute,\n): Record<StudioChromeMode, string> =>\n Object.fromEntries(\n Object.entries(STUDIO_CHROME_MODES).map(([mode, tokens]) => [\n mode,\n css(rule(tokens)),\n ]),\n ) as Record<StudioChromeMode, string>;\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 // No background of its own. An earlier fix painted every dropzone white,\n // on the premise that the host page's colour could not be known or read\n // reliably. It can: the walk in copy-color.util.ts reads it, and the chrome\n // colours itself from the answer. A white fill also made empty columns read\n // as occupied — the dashed outline says empty while the fill says full —\n // which is why it is gone rather than kept alongside.\n //\n // Two-tone outline. A lone dashed border leaves its gaps transparent, so\n // the slot boundary washes out against dark or purple-ish host pages.\n // The element's own border is a solid white ring; the dashes are painted\n // over it by the overlay below, leaving white — not the page — in the\n // gaps, which reads on any background.\n position: \"relative\",\n border: \"1px solid #ffffff\",\n \"&::before\": {\n content: '\"\"',\n position: \"absolute\",\n // Sit on the border ring itself, not inside the padding box.\n inset: \"-1px\",\n border: \"1px dashed #6c5ce7\",\n pointerEvents: \"none\",\n },\n color: \"#475161\",\n fontSize: \"14px\",\n fontStyle: \"normal\",\n fontWeight: 400,\n lineHeight: \"24px\",\n userSelect: \"none\",\n fontFamily: \"Inter, sans-serif\",\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 // Drop copy and hints sit on top of whatever the host page paints behind\n // the slot, so no fixed colour is readable on every page. These rules carry\n // only layout — the colour comes from a class chosen per line:\n // `slotCopyColors` when the page colour can be measured,\n // `slotCopyOverImage` when it cannot.\n slotDropText: css({\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"6px\",\n }),\n slotHintStyle: css({\n textAlign: \"center\",\n margin: 0,\n }),\n // Ink per mode, built from the same tokens the contrast maths reads, so the\n // colour that gets scored is the colour that gets painted. `!important`\n // because this chrome renders inside the customer's page, whose CSS would\n // otherwise recolour it.\n slotCopyColors: perMode(css, (tokens) => ({\n color: `${tokens.ink} !important`,\n })),\n // A stroke for a bare label the ink cannot carry on its own — the mid-tone\n // band, where a card would take a surface but a one-line label has nothing to\n // sit on. Stroking in the opposite mode's ink gives each glyph its own local\n // polarity without painting a fill behind it. `paint-order` puts the stroke\n // under the fill so the letterforms stay their own weight.\n slotCopyStroke: perMode(css, (tokens) => ({\n // Stroke in the opposite mode's ink — that is the colour guaranteed to\n // contrast with this mode's.\n WebkitTextStroke: `2px ${tokens.surface}`,\n paintOrder: \"stroke fill\",\n fontWeight: 600,\n })),\n // Fallback for pages whose background cannot be read from computed styles —\n // a gradient, photo or video behind the slot. With nothing to measure and no\n // fill to sit on, the copy goes white and leans on a soft dark shadow, the\n // usual way text survives over imagery of unknown brightness.\n slotCopyOverImage: css({\n color: \"#ffffff !important\",\n textShadow: \"0 1px 3px rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 0, 0, 0.55)\",\n }),\n // Section-slot Default-section hint (COMS-1770). Typography pinned to the\n // Figma spec (Text/Secondary_Text); the colour comes from the measured copy\n // colour instead. `!important` because this chrome renders inside the\n // customer's page, whose CSS would otherwise override the weight/color\n // (e.g. render it bold).\n slotDefaultHint: css({\n margin: 0,\n textAlign: \"center\",\n fontFamily: \"Inter, sans-serif !important\",\n fontSize: \"14px !important\",\n fontStyle: \"normal !important\",\n fontWeight: \"400 !important\",\n lineHeight: \"24px !important\",\n letterSpacing: \"0 !important\",\n }),\n // Section-slot \"Select section\" affordance (COMS-1809). Renders inside the\n // customer's page, so — like slotDefaultHint — the visual props are pinned\n // with `!important` to survive the host page's CSS. The button overrides the\n // shared studio-core Button base (light-purple outline) to the filled-purple\n // primary shown in the design.\n slotSelectButton: css({\n backgroundColor: \"#6c5ce7 !important\",\n color: \"#ffffff !important\",\n border: \"1px solid #6c5ce7 !important\",\n fontWeight: \"600 !important\",\n // Pin the icon/text alignment too — the studio-core base sets flex\n // centering, but host-page CSS can override it, leaving the icon riding\n // above the label. The svg is inline by default (baseline-aligned), so\n // make it a block flex item.\n display: \"inline-flex !important\",\n alignItems: \"center !important\",\n justifyContent: \"center !important\",\n gap: \"0.5rem !important\",\n // Typography pinned as well: a host font-size/line-height override makes\n // the label's line box taller than the 12px icon and drags its visual\n // center away from the icon's. line-height 1 makes the text flex item\n // exactly glyph-high, so both centers coincide.\n fontSize: \"0.875rem !important\",\n lineHeight: \"1 !important\",\n fontFamily: \"'Inter', sans-serif !important\",\n \"& svg\": {\n display: \"block\",\n flexShrink: 0,\n // Optical centering: the flex boxes align exactly (verified — svg/text\n // center deltas are 0), but the asset's dashed marquee occupies only the\n // top 7.2px of its 18x12 box with the pointer overhanging below-right,\n // so a box-centered icon READS ~2px high. Nudge down so the marquee —\n // the dominant shape — centers on the label, pointer descending like a\n // glyph descender (matches the design).\n transform: \"translateY(2px)\",\n },\n }),\n slotOrDivider: css({\n margin: 0,\n textAlign: \"center\",\n fontFamily: \"Inter, sans-serif !important\",\n fontSize: \"12px !important\",\n fontWeight: \"400 !important\",\n textTransform: \"uppercase\",\n }),\n slotAllowedLabel: css({\n margin: 0,\n textAlign: \"center\",\n fontFamily: \"Inter, sans-serif !important\",\n fontSize: \"12px !important\",\n fontWeight: \"600 !important\",\n }),\n embeddedSectionHost: css({\n position: \"relative\",\n \".cs-embedded-section-edit-btn\": {\n display: \"none\",\n },\n \"&:hover\": {\n \".cs-embedded-section-edit-btn\": {\n display: \"flex\",\n },\n },\n }),\n embeddedSectionButton: css({\n position: \"absolute\",\n top: \"0.75rem\",\n right: \"0.75rem\",\n zIndex: 2,\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 welcomeContainer: css({\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"40px 20px\",\n textAlign: \"center\",\n minHeight: \"400px\",\n }),\n welcomeTitle: css({\n fontSize: \"20px\",\n fontWeight: \"600\",\n margin: \"20px 0 10px 0\",\n fontFamily: \"Inter, sans-serif\",\n }),\n welcomeSubtitle: css({\n fontSize: \"14px\",\n margin: \"0 0 30px 0\",\n maxWidth: \"400px\",\n fontFamily: \"Inter, sans-serif\",\n lineHeight: \"1.5\",\n }),\n welcomeSteps: css({\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"16px\",\n maxWidth: \"1000px\",\n width: \"100%\",\n }),\n welcomeStep: css({\n padding: \"16px\",\n border: \"1px solid #DDE3EE\",\n borderRadius: \"8px\",\n textAlign: \"left\",\n \"& h3\": {\n fontSize: \"16px\",\n fontWeight: \"600\",\n margin: \"0 0 8px 0\",\n fontFamily: \"Inter, sans-serif\",\n },\n \"& p\": {\n fontSize: \"14px\",\n margin: 0,\n fontFamily: \"Inter, sans-serif\",\n lineHeight: \"1.4\",\n },\n }),\n // Fill comes from the measurement; a fixed pale fill swallowed its own copy\n // at 1:1 once the ink adapted pale on a dark page. The purple border is what\n // marks the step regardless.\n activeWelcom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;AACnB,YAAA,UAAU,EAAE,mBAAmB;AAChC,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,UAAU,EAAE,mBAAmB;AAC/B,YAAA,UAAU,EAAE,KAAK;AAClB,SAAA;KACF,CAAC;;;;IAIF,iBAAiB,EAAE,GAAG,CAAC;AACrB,QAAA,MAAM,EAAE,mBAAmB;KAC5B,CAAC;AACH,CAAA;;;;"}
1
+ {"version":3,"file":"styles.js","sources":["../../src/components/styles.ts"],"sourcesContent":["import { COMPOSABLE_DATA_ATTRIBUTES } from \"@contentstack/studio-client\";\nimport { css as gooberCss, CSSAttribute } from \"goober\";\nimport {\n STUDIO_CHROME_MODES,\n StudioChromeMode,\n} from \"../utils/copy-color.util\";\n\n/** Builds one class per chrome mode from a table of each mode's tokens. */\nconst buildClassPerChromeMode = <\n TokensByChromeMode extends Record<StudioChromeMode, object>,\n>(\n css: typeof gooberCss,\n tokensByChromeMode: TokensByChromeMode,\n buildRule: (tokens: TokensByChromeMode[StudioChromeMode]) => CSSAttribute,\n): Record<StudioChromeMode, string> =>\n Object.fromEntries(\n (Object.keys(tokensByChromeMode) as StudioChromeMode[]).map(\n (chromeMode) => [\n chromeMode,\n css(buildRule(tokensByChromeMode[chromeMode])),\n ],\n ),\n ) as Record<StudioChromeMode, string>;\n\n/** The colours one chrome mode paints a permanent drop zone in. */\ninterface PermanentDropZoneColors {\n background: string;\n borderColor: string;\n /** Background while a drag targets the zone. */\n targetedBackground: string;\n iconColor: string;\n labelColor: string;\n}\n\n/**\n * Light keeps the pinned design; dark takes the dark chrome tokens so the zone\n * doesn't glare on a dark page.\n */\nconst PERMANENT_DROP_ZONE_COLORS_BY_CHROME_MODE: Record<\n StudioChromeMode,\n PermanentDropZoneColors\n> = {\n light: {\n background: \"#FAFAFA\",\n borderColor: \"#D1D5DB\",\n targetedBackground: \"#EDE9FE\",\n iconColor: \"#9CA3AF\",\n // Darker than the design's grey, which read as disabled; matches the ink\n // of the empty-slot copy.\n labelColor: STUDIO_CHROME_MODES.light.secondary,\n },\n dark: {\n background: STUDIO_CHROME_MODES.dark.surface,\n borderColor: STUDIO_CHROME_MODES.dark.surfaceEdge,\n targetedBackground: STUDIO_CHROME_MODES.dark.emphasisSurface,\n iconColor: \"rgba(255, 255, 255, 0.6)\",\n labelColor: STUDIO_CHROME_MODES.dark.secondary,\n },\n};\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 // No background of its own. An earlier fix painted every dropzone white,\n // on the premise that the host page's colour could not be known or read\n // reliably. It can: the walk in copy-color.util.ts reads it, and the chrome\n // colours itself from the answer. A white fill also made empty columns read\n // as occupied — the dashed outline says empty while the fill says full —\n // which is why it is gone rather than kept alongside.\n //\n // Two-tone outline. A lone dashed border leaves its gaps transparent, so\n // the slot boundary washes out against dark or purple-ish host pages.\n // The element's own border is a solid white ring; the dashes are painted\n // over it by the overlay below, leaving white — not the page — in the\n // gaps, which reads on any background.\n position: \"relative\",\n border: \"1px solid #ffffff\",\n \"&::before\": {\n content: '\"\"',\n position: \"absolute\",\n // Sit on the border ring itself, not inside the padding box.\n inset: \"-1px\",\n border: \"1px dashed #6c5ce7\",\n pointerEvents: \"none\",\n },\n color: \"#475161\",\n fontSize: \"14px\",\n fontStyle: \"normal\",\n fontWeight: 400,\n lineHeight: \"24px\",\n userSelect: \"none\",\n fontFamily: \"Inter, sans-serif\",\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 // Drop copy and hints sit on top of whatever the host page paints behind\n // the slot, so no fixed colour is readable on every page. These rules carry\n // only layout — the colour comes from a class chosen per line:\n // `slotCopyColors` when the page colour can be measured,\n // `slotCopyOverImage` when it cannot.\n slotDropText: css({\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"6px\",\n }),\n slotHintStyle: css({\n textAlign: \"center\",\n margin: 0,\n }),\n // Ink per mode, built from the same tokens the contrast maths reads, so the\n // colour that gets scored is the colour that gets painted. `!important`\n // because this chrome renders inside the customer's page, whose CSS would\n // otherwise recolour it.\n slotCopyColors: buildClassPerChromeMode(\n css,\n STUDIO_CHROME_MODES,\n (tokens) => ({\n color: `${tokens.ink} !important`,\n }),\n ),\n // A stroke for a bare label the ink cannot carry on its own — the mid-tone\n // band, where a card would take a surface but a one-line label has nothing to\n // sit on. Stroking in the opposite mode's ink gives each glyph its own local\n // polarity without painting a fill behind it. `paint-order` puts the stroke\n // under the fill so the letterforms stay their own weight.\n slotCopyStroke: buildClassPerChromeMode(\n css,\n STUDIO_CHROME_MODES,\n (tokens) => ({\n // Stroke in the opposite mode's ink — that is the colour guaranteed to\n // contrast with this mode's.\n WebkitTextStroke: `2px ${tokens.surface}`,\n paintOrder: \"stroke fill\",\n fontWeight: 600,\n }),\n ),\n // Fallback for pages whose background cannot be read from computed styles —\n // a gradient, photo or video behind the slot. With nothing to measure and no\n // fill to sit on, the copy goes white and leans on a soft dark shadow, the\n // usual way text survives over imagery of unknown brightness.\n slotCopyOverImage: css({\n color: \"#ffffff !important\",\n textShadow: \"0 1px 3px rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 0, 0, 0.55)\",\n }),\n // Section-slot Default-section hint (COMS-1770). Typography pinned to the\n // Figma spec (Text/Secondary_Text); the colour comes from the measured copy\n // colour instead. `!important` because this chrome renders inside the\n // customer's page, whose CSS would otherwise override the weight/color\n // (e.g. render it bold).\n slotDefaultHint: css({\n margin: 0,\n textAlign: \"center\",\n fontFamily: \"Inter, sans-serif !important\",\n fontSize: \"14px !important\",\n fontStyle: \"normal !important\",\n fontWeight: \"400 !important\",\n lineHeight: \"24px !important\",\n letterSpacing: \"0 !important\",\n }),\n // A permanent drop zone beside a Repeater. Layout only; its colours come\n // from `permanentDropZoneColors`, picked per page tone like the slot chrome.\n permanentDropZone: css({\n boxSizing: \"border-box\",\n margin: 0,\n display: \"flex\",\n flexFlow: \"wrap\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"0 12px\",\n padding: \"8px 16px\",\n minHeight: \"44px\",\n borderWidth: \"2px\",\n borderStyle: \"dashed\",\n borderRadius: 0,\n userSelect: \"none\",\n transition: \"background-color 0.15s, border-color 0.15s\",\n }),\n // The zone has its own fill, so it stays readable in light on a page whose\n // colour can't be measured. `!important` on the copy, set through these\n // variables, because the customer's CSS reaches it too.\n permanentDropZoneColors: buildClassPerChromeMode(\n css,\n PERMANENT_DROP_ZONE_COLORS_BY_CHROME_MODE,\n (colors) => ({\n background: colors.background,\n borderColor: colors.borderColor,\n \"--cs-permanent-drop-zone-icon\": colors.iconColor,\n \"--cs-permanent-drop-zone-label\": colors.labelColor,\n // Highlights while a drag targets it: the client marks the zone it picked\n // as the drop target, the same choice that tells Studio where it drops.\n [`&[${COMPOSABLE_DATA_ATTRIBUTES.PERMANENT_DROP_ZONE_TARGETED}]`]: {\n background: colors.targetedBackground,\n borderColor: \"#6C5CE7\",\n },\n }),\n ),\n permanentDropZoneAwaitingBackdrop: css({\n display: \"none !important\",\n }),\n permanentDropZoneLabelRow: css({\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n // The icon draws in `currentColor`.\n color: \"var(--cs-permanent-drop-zone-icon) !important\",\n \"& svg\": {\n flexShrink: 0,\n },\n }),\n permanentDropZoneLabel: css({\n color: \"var(--cs-permanent-drop-zone-label) !important\",\n fontFamily: \"Inter, sans-serif !important\",\n fontSize: \"13px !important\",\n fontStyle: \"normal !important\",\n fontWeight: \"500 !important\",\n }),\n embeddedSectionHost: css({\n position: \"relative\",\n \".cs-embedded-section-edit-btn\": {\n display: \"none\",\n },\n \"&:hover\": {\n \".cs-embedded-section-edit-btn\": {\n display: \"flex\",\n },\n },\n }),\n embeddedSectionButton: css({\n position: \"absolute\",\n top: \"0.75rem\",\n right: \"0.75rem\",\n zIndex: 2,\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 welcomeContainer: css({\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"40px 20px\",\n textAlign: \"center\",\n minHeight: \"400px\",\n }),\n welcomeTitle: css({\n fontSize: \"20px\",\n fontWeight: \"600\",\n margin: \"20px 0 10px 0\",\n fontFamily: \"Inter, sans-serif\",\n }),\n welcomeSubtitle: css({\n fontSize: \"14px\",\n margin: \"0 0 30px 0\",\n maxWidth: \"400px\",\n fontFamily: \"Inter, sans-serif\",\n lineHeight: \"1.5\",\n }),\n welcomeSteps: css({\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"16px\",\n maxWidth: \"1000px\",\n width: \"100%\",\n }),\n welcomeStep: css({\n padding: \"16px\",\n border: \"1px solid #DDE3EE\",\n borderRadius: \"8px\",\n textAlign: \"left\",\n \"& h3\": {\n fontSize: \"16px\",\n fontWeight: \"600\",\n margin: \"0 0 8px 0\",\n fontFamily: \"Inter, sans-serif\",\n },\n \"& p\": {\n fontSize: \"14px\",\n margin: 0,\n fontFamily: \"Inter, sans-serif\",\n lineHeight: \"1.4\",\n },\n }),\n // Fill comes from the measurement; a fixed pale fill swallowed its own copy\n // at 1:1 once the ink adapted pale on a dark page. The purple border is what\n // marks the step regardless.\n activeWelcomeStep: css({\n border: \"1px solid #6C5CE7\",\n }),\n});\n"],"names":[],"mappings":";;;AAOA;AACA,MAAM,uBAAuB,GAAG,CAG9B,GAAqB,EACrB,kBAAsC,EACtC,SAAyE,KAEzE,MAAM,CAAC,WAAW,CACf,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAwB,CAAC,GAAG,CACzD,CAAC,UAAU,KAAK;IACd,UAAU;IACV,GAAG,CAAC,SAAS,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;AAC/C,CAAA,CACF,CACkC;AAYvC;;;AAGG;AACH,MAAM,yCAAyC,GAG3C;AACF,IAAA,KAAK,EAAE;AACL,QAAA,UAAU,EAAE,SAAS;AACrB,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,kBAAkB,EAAE,SAAS;AAC7B,QAAA,SAAS,EAAE,SAAS;;;AAGpB,QAAA,UAAU,EAAE,mBAAmB,CAAC,KAAK,CAAC,SAAS;AAChD,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,UAAU,EAAE,mBAAmB,CAAC,IAAI,CAAC,OAAO;AAC5C,QAAA,WAAW,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW;AACjD,QAAA,kBAAkB,EAAE,mBAAmB,CAAC,IAAI,CAAC,eAAe;AAC5D,QAAA,SAAS,EAAE,0BAA0B;AACrC,QAAA,UAAU,EAAE,mBAAmB,C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AAE,KAAK;AACnB,QAAA,SAAS,EAAE,MAAM;AACjB,QAAA,MAAM,EAAE;AACN,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,UAAU,EAAE,KAAK;AACjB,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,UAAU,EAAE,mBAAmB;AAChC,SAAA;AACD,QAAA,KAAK,EAAE;AACL,YAAA,QAAQ,EAAE,MAAM;AAChB,YAAA,MAAM,EAAE,CAAC;AACT,YAAA,UAAU,EAAE,mBAAmB;AAC/B,YAAA,UAAU,EAAE,KAAK;AAClB,SAAA;KACF,CAAC;;;;IAIF,iBAAiB,EAAE,GAAG,CAAC;AACrB,QAAA,MAAM,EAAE,mBAAmB;KAC5B,CAAC;AACH,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { DataStepMode } from '@contentstack/studio-messenger';
3
- export { DataStepMode } from '@contentstack/studio-messenger';
2
+ import { DataStepMode } from '@contentstack/studio-messenger/constants';
3
+ export { DataStepMode } from '@contentstack/studio-messenger/constants';
4
4
  import { createContext } from 'react';
5
5
 
6
6
  const editContext = createContext({
@@ -1 +1 @@
1
- {"version":3,"file":"edit-context.provider.js","sources":["../../../src/contexts/providers/edit-context.provider.tsx"],"sourcesContent":["import { DataStepMode } from \"@contentstack/studio-messenger\";\nimport { createContext, FC } from \"react\";\n\n// Re-exported so editor-internal consumers keep importing from the providers\n// barrel; the enum's single source of truth is @contentstack/studio-messenger.\nexport { DataStepMode };\n\n/**\n * Per-composition editor context that Studio computes and pushes into the\n * iframe (pulled via `GET_EDIT_CONTEXT`, updated live via `SET_EDIT_CONTEXT`).\n * Read directly by descendants such as `WelcomeState` — it must live INSIDE\n * `EditableRenderer` (which owns the stateful spec), not the outer\n * `RendererProvider` (which is fed the one-shot initial spec).\n */\nexport interface EditContextValue {\n /**\n * Defaults to `schema-or-pin` so older Studio / anything that can't answer\n * keeps the existing \"Connect a schema or pin data\" copy.\n */\n dataStepMode: DataStepMode;\n}\n\nexport const editContext = createContext<EditContextValue>({\n dataStepMode: DataStepMode.SchemaOrPin,\n});\n\nexport const EditContextProvider: FC<{\n value: EditContextValue;\n children: React.ReactNode;\n}> = ({ value, children }) => {\n return <editContext.Provider value={value}>{children}</editContext.Provider>;\n};\n"],"names":["_jsx"],"mappings":";;;;;AAsBO,MAAM,WAAW,GAAG,aAAa,CAAmB;IACzD,YAAY,EAAE,YAAY,CAAC,WAAW;AACvC,CAAA;AAEM,MAAM,mBAAmB,GAG3B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;IAC3B,OAAOA,GAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAwB;AAC9E;;;;"}
1
+ {"version":3,"file":"edit-context.provider.js","sources":["../../../src/contexts/providers/edit-context.provider.tsx"],"sourcesContent":["import { DataStepMode } from \"@contentstack/studio-messenger/constants\";\nimport { createContext, FC } from \"react\";\n\n// Re-exported so editor-internal consumers keep importing from the providers\n// barrel; the enum's single source of truth is @contentstack/studio-messenger.\nexport { DataStepMode };\n\n/**\n * Per-composition editor context that Studio computes and pushes into the\n * iframe (pulled via `GET_EDIT_CONTEXT`, updated live via `SET_EDIT_CONTEXT`).\n * Read directly by descendants such as `WelcomeState` — it must live INSIDE\n * `EditableRenderer` (which owns the stateful spec), not the outer\n * `RendererProvider` (which is fed the one-shot initial spec).\n */\nexport interface EditContextValue {\n /**\n * Defaults to `schema-or-pin` so older Studio / anything that can't answer\n * keeps the existing \"Connect a schema or pin data\" copy.\n */\n dataStepMode: DataStepMode;\n}\n\nexport const editContext = createContext<EditContextValue>({\n dataStepMode: DataStepMode.SchemaOrPin,\n});\n\nexport const EditContextProvider: FC<{\n value: EditContextValue;\n children: React.ReactNode;\n}> = ({ value, children }) => {\n return <editContext.Provider value={value}>{children}</editContext.Provider>;\n};\n"],"names":["_jsx"],"mappings":";;;;;AAsBO,MAAM,WAAW,GAAG,aAAa,CAAmB;IACzD,YAAY,EAAE,YAAY,CAAC,WAAW;AACvC,CAAA;AAEM,MAAM,mBAAmB,GAG3B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAI;IAC3B,OAAOA,GAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAwB;AAC9E;;;;"}
@@ -1,4 +1,4 @@
1
- import { highlightNodeManager } from '@contentstack/studio-client';
1
+ import { highlightNodeManager } from '@contentstack/studio-client/editor';
2
2
  import { useContext, useState, useEffect } from 'react';
3
3
  import { ActiveComponentPathContext } from '../contexts/providers/active-node.provider.js';
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"use-active-node-path.hook.js","sources":["../../src/hooks/use-active-node-path.hook.ts"],"sourcesContent":["import { StudioSpec, highlightNodeManager } from \"@contentstack/studio-client\";\nimport { Path } from \"@contentstack/studio-internal\";\nimport { useContext, useEffect, useState } from \"react\";\nimport {\n ActiveComponentPathContext,\n ActiveComponentPathContextType,\n} from \"../contexts/providers/active-node.provider\";\n\nexport function useActiveComponentPath() {\n const activeComponentPath = useContext(ActiveComponentPathContext);\n return activeComponentPath;\n}\n\nexport function useGetActiveComponentPathContext(\n spec: StudioSpec,\n): ActiveComponentPathContextType {\n const [activeComponentPath, setActiveComponentPath] =\n useState<ActiveComponentPathContextType>({\n activeNodeUid: null,\n activeNodePath: null,\n });\n\n useEffect(() => {\n function getActiveNodeCallback(\n activeNodeUid: string,\n activeNodePath: Path,\n ) {\n if (!spec) return;\n\n setActiveComponentPath({\n activeNodeUid,\n activeNodePath,\n });\n }\n\n highlightNodeManager.onActiveNodeChange(getActiveNodeCallback, {\n syncToExistingValue: true,\n });\n\n return () => {\n highlightNodeManager.unsubscribeFromActiveNodeChange(\n getActiveNodeCallback,\n );\n };\n }, [spec]);\n\n return activeComponentPath;\n}\n"],"names":[],"mappings":";;;;SAQgB,sBAAsB,GAAA;AACpC,IAAA,MAAM,mBAAmB,GAAG,UAAU,CAAC,0BAA0B,CAAC;AAClE,IAAA,OAAO,mBAAmB;AAC5B;AAEM,SAAU,gCAAgC,CAC9C,IAAgB,EAAA;AAEhB,IAAA,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GACjD,QAAQ,CAAiC;AACvC,QAAA,aAAa,EAAE,IAAI;AACnB,QAAA,cAAc,EAAE,IAAI;AACrB,KAAA,CAAC;IAEJ,SAAS,CAAC,MAAK;AACb,QAAA,SAAS,qBAAqB,CAC5B,aAAqB,EACrB,cAAoB,EAAA;AAEpB,YAAA,IAAI,CAAC,IAAI;gBAAE;AAEX,YAAA,sBAAsB,CAAC;gBACrB,aAAa;gBACb,cAAc;AACf,aAAA,CAAC;QACJ;AAEA,QAAA,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE;AAC7D,YAAA,mBAAmB,EAAE,IAAI;AAC1B,SAAA,CAAC;AAEF,QAAA,OAAO,MAAK;AACV,YAAA,oBAAoB,CAAC,+BAA+B,CAClD,qBAAqB,CACtB;AACH,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAEV,IAAA,OAAO,mBAAmB;AAC5B;;;;"}
1
+ {"version":3,"file":"use-active-node-path.hook.js","sources":["../../src/hooks/use-active-node-path.hook.ts"],"sourcesContent":["import { StudioSpec } from \"@contentstack/studio-client\";\nimport { highlightNodeManager } from \"@contentstack/studio-client/editor\";\nimport { Path } from \"@contentstack/studio-internal\";\nimport { useContext, useEffect, useState } from \"react\";\nimport {\n ActiveComponentPathContext,\n ActiveComponentPathContextType,\n} from \"../contexts/providers/active-node.provider\";\n\nexport function useActiveComponentPath() {\n const activeComponentPath = useContext(ActiveComponentPathContext);\n return activeComponentPath;\n}\n\nexport function useGetActiveComponentPathContext(\n spec: StudioSpec,\n): ActiveComponentPathContextType {\n const [activeComponentPath, setActiveComponentPath] =\n useState<ActiveComponentPathContextType>({\n activeNodeUid: null,\n activeNodePath: null,\n });\n\n useEffect(() => {\n function getActiveNodeCallback(\n activeNodeUid: string,\n activeNodePath: Path,\n ) {\n if (!spec) return;\n\n setActiveComponentPath({\n activeNodeUid,\n activeNodePath,\n });\n }\n\n highlightNodeManager.onActiveNodeChange(getActiveNodeCallback, {\n syncToExistingValue: true,\n });\n\n return () => {\n highlightNodeManager.unsubscribeFromActiveNodeChange(\n getActiveNodeCallback,\n );\n };\n }, [spec]);\n\n return activeComponentPath;\n}\n"],"names":[],"mappings":";;;;SASgB,sBAAsB,GAAA;AACpC,IAAA,MAAM,mBAAmB,GAAG,UAAU,CAAC,0BAA0B,CAAC;AAClE,IAAA,OAAO,mBAAmB;AAC5B;AAEM,SAAU,gCAAgC,CAC9C,IAAgB,EAAA;AAEhB,IAAA,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GACjD,QAAQ,CAAiC;AACvC,QAAA,aAAa,EAAE,IAAI;AACnB,QAAA,cAAc,EAAE,IAAI;AACrB,KAAA,CAAC;IAEJ,SAAS,CAAC,MAAK;AACb,QAAA,SAAS,qBAAqB,CAC5B,aAAqB,EACrB,cAAoB,EAAA;AAEpB,YAAA,IAAI,CAAC,IAAI;gBAAE;AAEX,YAAA,sBAAsB,CAAC;gBACrB,aAAa;gBACb,cAAc;AACf,aAAA,CAAC;QACJ;AAEA,QAAA,oBAAoB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE;AAC7D,YAAA,mBAAmB,EAAE,IAAI;AAC1B,SAAA,CAAC;AAEF,QAAA,OAAO,MAAK;AACV,YAAA,oBAAoB,CAAC,+BAA+B,CAClD,qBAAqB,CACtB;AACH,QAAA,CAAC;AACH,IAAA,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAEV,IAAA,OAAO,mBAAmB;AAC5B;;;;"}
@@ -0,0 +1,20 @@
1
+ import { useDesignPreviewContext } from './use-design-preview.hook.js';
2
+ import { usePreviewMode } from './use-preview-mode.hook.js';
3
+ import { useRenderer } from './use-renderer.hook.js';
4
+
5
+ /**
6
+ * Whether permanent drop zones may show here: only while editing, never in
7
+ * preview mode, and never inside a Repeater or Condition block that is showing
8
+ * its preview, where children render once per item and zones would repeat.
9
+ */
10
+ function useCanShowPermanentDropZones() {
11
+ const { isCompositionBeingEdited } = useRenderer();
12
+ const isPreviewMode = usePreviewMode();
13
+ const designPreviewContext = useDesignPreviewContext();
14
+ return (isCompositionBeingEdited &&
15
+ !isPreviewMode &&
16
+ designPreviewContext !== "preview");
17
+ }
18
+
19
+ export { useCanShowPermanentDropZones };
20
+ //# sourceMappingURL=use-can-show-permanent-drop-zones.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-can-show-permanent-drop-zones.hook.js","sources":["../../src/hooks/use-can-show-permanent-drop-zones.hook.ts"],"sourcesContent":["import { useDesignPreviewContext } from \"./use-design-preview.hook\";\nimport { usePreviewMode } from \"./use-preview-mode.hook\";\nimport { useRenderer } from \"./use-renderer.hook\";\n\n/**\n * Whether permanent drop zones may show here: only while editing, never in\n * preview mode, and never inside a Repeater or Condition block that is showing\n * its preview, where children render once per item and zones would repeat.\n */\nexport function useCanShowPermanentDropZones(): boolean {\n const { isCompositionBeingEdited } = useRenderer();\n const isPreviewMode = usePreviewMode();\n const designPreviewContext = useDesignPreviewContext();\n return (\n isCompositionBeingEdited &&\n !isPreviewMode &&\n designPreviewContext !== \"preview\"\n );\n}\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;SACa,4BAA4B,GAAA;AAC1C,IAAA,MAAM,EAAE,wBAAwB,EAAE,GAAG,WAAW,EAAE;AAClD,IAAA,MAAM,aAAa,GAAG,cAAc,EAAE;AACtC,IAAA,MAAM,oBAAoB,GAAG,uBAAuB,EAAE;AACtD,IAAA,QACE,wBAAwB;AACxB,QAAA,CAAC,aAAa;QACd,oBAAoB,KAAK,SAAS;AAEtC;;;;"}
@@ -1,4 +1,5 @@
1
- import { isCompositionBeingEdited, clientRendererModeUtil, addHighlightNodeEventListeners, addUrlChangeListeners, addHighlightSpacingEventListeners, addContextMenuEventListeners, addBreakpointEventListeners, dndEventListener, updateStyleOnStyleNodeChange, hiddenElementNotificationEventEmitter, getNodeScreenshotEvent, isInsideVisualBuilderFrame, compositionSaveEventListener } from '@contentstack/studio-client';
1
+ import { isCompositionBeingEdited, clientRendererModeUtil, addUrlChangeListeners, addContextMenuEventListeners, addBreakpointEventListeners, updateStyleOnStyleNodeChange, isInsideVisualBuilderFrame } from '@contentstack/studio-client';
2
+ import { addHighlightNodeEventListeners, addHighlightSpacingEventListeners, dndEventListener, hiddenElementNotificationEventEmitter, getNodeScreenshotEvent, compositionSaveEventListener } from '@contentstack/studio-client/editor';
2
3
  import { useEffect } from 'react';
3
4
 
4
5
  const useCanvasEvents = (composableUid) => {