@contentstack/studio-react-editor 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/EditableRenderer.js +2 -1
- package/dist/components/EditableRenderer.js.map +1 -1
- package/dist/components/Element.js +21 -18
- package/dist/components/Element.js.map +1 -1
- package/dist/components/WelcomeState.js +1 -1
- package/dist/components/elements/SectionComposition.js +2 -1
- package/dist/components/elements/SectionComposition.js.map +1 -1
- package/dist/components/elements/SectionSlot.js +4 -39
- package/dist/components/elements/SectionSlot.js.map +1 -1
- package/dist/components/styles.js +0 -52
- package/dist/components/styles.js.map +1 -1
- package/dist/contexts/providers/edit-context.provider.js +2 -2
- package/dist/contexts/providers/edit-context.provider.js.map +1 -1
- package/dist/hooks/use-active-node-path.hook.js +1 -1
- package/dist/hooks/use-active-node-path.hook.js.map +1 -1
- package/dist/hooks/use-canvas-events.hook.js +2 -1
- package/dist/hooks/use-canvas-events.hook.js.map +1 -1
- package/dist/hooks/use-edit-context-listener.hook.js +2 -1
- package/dist/hooks/use-edit-context-listener.hook.js.map +1 -1
- package/dist/hooks/use-section-events.hook.js +2 -1
- package/dist/hooks/use-section-events.hook.js.map +1 -1
- package/dist/hooks/use-spec-data-listener.hook.js +39 -29
- package/dist/hooks/use-spec-data-listener.hook.js.map +1 -1
- package/dist/hooks/use-static-values-listener.hook.js +10 -2
- package/dist/hooks/use-static-values-listener.hook.js.map +1 -1
- package/dist/utils/renderer.util.js +46 -35
- package/dist/utils/renderer.util.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-spec-data-listener.hook.js","sources":["../../src/hooks/use-spec-data-listener.hook.ts"],"sourcesContent":["import {\n isCompositionBeingEdited,\n StudioSpec,\n applyOperation,\n SECTION_COMPOSITIONS_KEY,\n clientRendererModeUtil,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n SectionCompositionEntry,\n} from \"@contentstack/studio-client\";\nimport { Operation } from \"@contentstack/studio-internal\";\nimport {\n composableStudioEventManager,\n POST_MESSAGE_EVENTS,\n} from \"@contentstack/studio-messenger\";\nimport {\n StudioSpecData,\n DataSourceItem,\n DATA_SOURCES_PREFIX,\n} from \"@contentstack/studio-registry\";\nimport { seedSectionInstanceBindings } from \"@contentstack/studio-react-components/utils\";\nimport { useEffect, useRef } from \"react\";\nimport { Immer } from \"immer\";\n\n// Immer freezes what it produces, but metadata-binding resolution (currently\n// just styles) writes onto the produced node afterwards, which throws on frozen\n// state — so this module needs a non-freezing `produce`. Scoped to an isolated\n// instance rather than the global `setAutoFreeze(false)`: this is a published\n// package, and the global switch would silently remove the mutation guard for\n// the consuming app's own Immer usage.\nconst { produce } = new Immer({ autoFreeze: false });\n\n/**\n * Walk a fresh UI tree (post-Immer-produce) and populate the NODE_TO_PARENT\n * and NODE_TO_PATH_NODE WeakMaps for every node. These maps are normally\n * populated during React render (in Element.tsx). After APPLY_OPERATION\n * produces a brand-new tree via Immer, the maps still hold entries for\n * stale node refs — `findPath` (used to compute hover/highlight paths sent\n * back to Studio) returns stale paths until the next React commit. Calling\n * this immediately after applyOperation closes that window.\n */\nfunction refreshNodeWeakMaps(root: any): void {\n if (!root || typeof root !== \"object\") return;\n NODE_TO_PARENT.set(root, undefined);\n const visit = (parent: any) => {\n const slots = parent?.slots || {};\n for (const slotUid of Object.keys(slots)) {\n const children = slots[slotUid] || [];\n for (let idx = 0; idx < children.length; idx++) {\n const child = children[idx];\n if (!child || typeof child !== \"object\") continue;\n NODE_TO_PARENT.set(child, parent);\n NODE_TO_PATH_NODE.set(child, [slotUid, idx] as any);\n visit(child);\n }\n }\n };\n visit(root);\n}\n\nexport const useSpecDataListener = (\n setState: React.Dispatch<React.SetStateAction<StudioSpec>>,\n // Read into `stateRef` only — listener bodies use `stateRef.current` (not\n // `state` directly) so the effect's deps don't include `state.data`, which\n // would force re-register on every data change and create a window with\n // zero handlers between unregister/re-register (the original\n // `NO_REQUEST_LISTENER_FOUND` cause).\n state?: StudioSpec,\n composableUid?: string,\n) => {\n // Keep a ref to the latest state so the listener registrations don't have\n // to depend on state.data — they can read latest via stateRef.current\n // synchronously. Without this, every state.data change tore down + re-registered\n // the listeners, creating a window where Studio's UPDATE_SECTION_CONTEXTS\n // message was dropped with NO_REQUEST_LISTENER_FOUND.\n const stateRef = useRef(state);\n stateRef.current = state;\n\n // Rebuild section_scoped_data entries for instances whose binding metadata\n // (selectedField / uidRemapping / parentRepeaterUID) is present in the\n // legacy section_compositions slice. Mirrors build-scoped-data.ts logic\n // inline so the hook can rebuild without re-running the full fetchSpec\n // pipeline. Needed because Studio's fresh per-instance bindings arrive via\n // UPDATE_SPEC_DATA (and UPDATE_SECTION_CONTEXTS), while the provider only\n // reads from section_scoped_data — without this rebuild, sections render\n // the stale pre-computed scope from the initial fetchSpec (selectedField\n // missing from UI metadata on cold load → scoped template = whole page\n // template → placeholder text).\n const rebuildScopedFromBindings = (\n prevData: any,\n incomingBindings?: Record<string, unknown>,\n ): any => {\n const dataSources = prevData?.dataSources || {};\n const sectionBindings: Record<string, any> =\n incomingBindings && Object.keys(incomingBindings).length\n ? {\n ...(dataSources[SECTION_COMPOSITIONS_KEY] || {}),\n ...incomingBindings,\n }\n : dataSources[SECTION_COMPOSITIONS_KEY] || {};\n\n const pageTemplate = dataSources.template;\n\n /**\n * The document an instance's section data lives in (ADR 0017).\n *\n * The editor re-scopes every section from `dataSources.template` — the page\n * template entry. A FREEFORM page has none, so a section whose Section data\n * points at a pinned entry or a query resolved to `undefined` here and\n * rendered component defaults, even though the binding was stored\n * correctly and the fetch/cold-load path (build-scoped-data) resolved it\n * fine. This is the same hardcoded-anchor bug, in the live editor path.\n */\n const resolveFetchRootDocument = (fetchRootKey?: string): unknown => {\n if (!fetchRootKey || fetchRootKey === \"template\") return pageTemplate;\n if (fetchRootKey.startsWith(\"query:\")) {\n const qUid = fetchRootKey.slice(\"query:\".length);\n return (dataSources.contentstack_queries || {})[qUid];\n }\n // `<ct>:<uid>` — the same composite key the contentstack resolver uses.\n return (dataSources.contentstack || {})[fetchRootKey];\n };\n /**\n * Reference stubs, followed to their pooled entry — the step this scoper was\n * missing entirely (the fetch path's `build-scoped-data` has it at every\n * traversal step).\n *\n * CDA returns `{uid, _content_type_uid}` at a reference field unless the\n * request included it, and Studio's read funnel pools the resolved entry\n * separately under its `<ct>:<uid>` key. Without following the stub, a\n * Section data whose path CROSSES a reference resolved to the stub object:\n * the section's own fields were absent from it, so the canvas rendered\n * component defaults while the deployed site — which does follow — was\n * correct (COMS-2031: DR5.5, and the wrapper half of DR7.4).\n */\n const META_KEYS = new Set([\n \"uid\",\n \"_content_type_uid\",\n \"_version\",\n \"locale\",\n \"ACL\",\n \"_metadata\",\n // Live-preview edit tags. The Preview service stamps `$` onto every entry\n // and reference stub in the editor, so a bare stub arrives as\n // `{uid, _content_type_uid, $}` — three keys, one of which used to read as\n // \"this stub already carries a payload\". The stub was then handed back\n // unfollowed and a Section data whose path crosses a reference resolved to\n // the stub instead of the entry (E2E DR7.4). Metadata, never content.\n \"$\",\n ]);\n const followReference = (v: any): any => {\n if (\n !v ||\n typeof v !== \"object\" ||\n Array.isArray(v) ||\n typeof v.uid !== \"string\" ||\n typeof v._content_type_uid !== \"string\"\n ) {\n return v;\n }\n // CDA may already have inlined the entry into the stub object; anything\n // beyond the meta keys means it is resolved already.\n if (Object.keys(v).some((k) => !META_KEYS.has(k))) return v;\n const resolved = (dataSources.contentstack || {})[\n `${v._content_type_uid}:${v.uid}`\n ];\n return resolved !== undefined ? resolved : v;\n };\n const followAll = (v: any): any =>\n Array.isArray(v) ? v.map(followReference) : followReference(v);\n\n const prevScoped = prevData?.section_scoped_data || {};\n const nextScoped: Record<string, any> = { ...prevScoped };\n\n const getScopedData = (obj: any, selectedField?: string): any => {\n if (!selectedField) return followAll(obj);\n const traversed = selectedField\n .split(\".\")\n .reduce((val: any, seg: string) => {\n if (val == null) return val;\n // Swap a stub for its resolved entry BEFORE drilling into it.\n val = followReference(val);\n const arrayMatch = seg.match(/^(.*?)\\[(\\d+)\\]$/);\n if (arrayMatch) {\n const [, name, idxStr] = arrayMatch;\n const next = name ? val[name] : val;\n return next == null ? next : followReference(next[Number(idxStr)]);\n }\n // A bare NUMERIC segment is an array index. Contentstack bindings\n // encode one as a plain segment (`page_sections.17.keynote_speakers`)\n // rather than bracket notation, so this must precede the\n // array→first-element fallback below, which would otherwise look `17`\n // up as a key on element [0].\n if (Array.isArray(val) && /^\\d+$/.test(seg)) {\n return followReference(val[Number(seg)]);\n }\n // Non-indexed field access landing on an ARRAY → default to the first\n // element so an un-indexed array-ancestor path (e.g.\n // \"navigation_menu_3.menu_subitems\", where navigation_menu_3 is a\n // multiple group) still resolves instead of `array[field]` →\n // undefined → null. Indexed pushes (`navigation_menu_3[1]…`) override\n // this with the picked instance.\n if (Array.isArray(val)) {\n const first = followReference(val[0]);\n return first == null ? null : followReference(first[seg]);\n }\n return followReference(val[seg]);\n }, obj);\n return (\n (Array.isArray(traversed) ? followAll(traversed) : traversed) ?? null\n );\n };\n\n const applyUidRemapping = (\n scoped: any,\n uidRemapping: Record<string, string> = {},\n ): any => {\n if (\n !scoped ||\n typeof scoped !== \"object\" ||\n Object.keys(uidRemapping).length === 0\n ) {\n return scoped;\n }\n if (Array.isArray(scoped)) {\n return scoped.map((item: any) => applyUidRemapping(item, uidRemapping));\n }\n const remapped: Record<string, unknown> = {};\n const pageKeyValues = new Set(Object.values(uidRemapping));\n for (const [sectionKey, pageKey] of Object.entries(uidRemapping)) {\n remapped[sectionKey] = applyUidRemapping(scoped[pageKey], uidRemapping);\n }\n for (const key of Object.keys(scoped)) {\n if (!pageKeyValues.has(key) && !(key in uidRemapping)) {\n remapped[key] = applyUidRemapping(scoped[key], uidRemapping);\n }\n }\n return remapped;\n };\n\n let changed = false;\n for (const [instanceUid, bindingUnknown] of Object.entries(\n sectionBindings,\n )) {\n const binding = bindingUnknown as {\n selectedField?: string;\n uidRemapping?: Record<string, string>;\n parentRepeaterUID?: string | null;\n context?: unknown;\n componentPropsFallback?: Record<string, unknown>;\n cardinality?: \"collection\" | \"single\";\n expectsSingleDocument?: boolean;\n };\n // Skip context-only legacy shape — no selectedField to re-scope from.\n if (binding && \"context\" in binding && !(\"selectedField\" in binding)) {\n continue;\n }\n // A non-template fetch root carries its own in-document path; the\n // legacy `selectedField` is a page-template path and does not apply.\n const fetchRootKey = (binding as { fetchRootKey?: string })?.fetchRootKey;\n const fetchRootPrefix = (binding as { fetchRootPrefix?: string[] })\n ?.fetchRootPrefix;\n const usesPageTemplate = !fetchRootKey || fetchRootKey === \"template\";\n const rootDocument = resolveFetchRootDocument(fetchRootKey);\n const rootScopePath = usesPageTemplate\n ? binding?.selectedField\n : fetchRootPrefix?.join(\".\");\n\n let scopedTemplate = applyUidRemapping(\n getScopedData(rootDocument, rootScopePath),\n binding?.uidRemapping,\n );\n // Single-element section: `selectedField` stays index-free, so an\n // un-indexed terminal array resolves to the WHOLE array. Collapse to the\n // first element (the deploy default — the preview instance is session-only)\n // so the bound field resolves live, without depending on a save+reload\n // running the cold-load scoper. Mirrors build-scoped-data.ts. When the\n // path is already indexed (`menu_items[0]`, from Studio's push),\n // getScopedData returns the element and this is a no-op.\n if (binding?.cardinality === \"single\" && Array.isArray(scopedTemplate)) {\n scopedTemplate = scopedTemplate[0] ?? null;\n }\n // A CT-anchored section is ONE document. When its scope reached it through\n // a REFERENCE — a wrapper pinned at `settings_ref` rebasing its slot\n // children (ADR 0017) — CDA's array arrives instead of the entry, and the\n // section's own fields are not on an array. Collapse to the document.\n if (\n (binding as { expectsSingleDocument?: boolean })\n ?.expectsSingleDocument &&\n Array.isArray(scopedTemplate)\n ) {\n scopedTemplate = scopedTemplate[0] ?? null;\n }\n let repeater: Record<string, { context: unknown }> | undefined;\n if (binding?.parentRepeaterUID) {\n const ctx = dataSources.repeater?.[binding.parentRepeaterUID];\n if (ctx !== undefined) {\n repeater = { [binding.parentRepeaterUID]: ctx };\n }\n }\n const prev = prevScoped[instanceUid] || {};\n // Refresh contentstack / contentstack_queries from the live page\n // dataSources every time we rebuild. The initial scoped data built\n // during fetchSpec may have stale (or empty) entries because the\n // iframe loaded with getSpecFromParent and never fetched the section's\n // data sources itself — the studio pushes them later via\n // UPDATE_SPEC_DATA. Pool-keyed maps would be ideal but the listener\n // doesn't have access to them; copying the full page slice is a safe\n // superset (same composite-key format the resolver expects).\n const refreshedContentstack =\n dataSources.contentstack && typeof dataSources.contentstack === \"object\"\n ? { ...dataSources.contentstack }\n : prev.contentstack || {};\n const refreshedQueries =\n dataSources.contentstack_queries &&\n typeof dataSources.contentstack_queries === \"object\"\n ? { ...dataSources.contentstack_queries }\n : prev.contentstack_queries || {};\n\n const next = {\n ...prev,\n template: scopedTemplate,\n contentstack: refreshedContentstack,\n contentstack_queries: refreshedQueries,\n page: dataSources,\n repeater: repeater ?? prev.repeater,\n // Carry binding metadata so SectionCompositionProvider can re-scope the\n // template from the LIVE per-iteration repeater item. The scopedTemplate\n // above is page-root-scoped and shared across every iteration of this\n // instance, so it can't represent per-iteration values on its own.\n parentRepeaterUID: binding?.parentRepeaterUID ?? null,\n selectedField: binding?.selectedField,\n fetchRootKey,\n fetchRootPrefix,\n uidRemapping: binding?.uidRemapping,\n cardinality: binding?.cardinality,\n componentPropsFallback: binding?.componentPropsFallback,\n };\n if (\n prev.template !== next.template ||\n prev.page !== next.page ||\n prev.repeater !== next.repeater ||\n prev.contentstack !== next.contentstack ||\n prev.contentstack_queries !== next.contentstack_queries ||\n prev.componentPropsFallback !== next.componentPropsFallback\n ) {\n nextScoped[instanceUid] = next;\n changed = true;\n }\n }\n if (!changed) return prevData;\n return { ...prevData, section_scoped_data: nextScoped };\n };\n\n // Self-heal when the section catalog arrives after the initial seed.\n // `sectionCompositions` (each section's `linked_schemas` + authored UI) is\n // fetched asynchronously (GET_SECTIONS / UPDATE_SECTIONS_CATALOG) and can land\n // AFTER the first `seedSectionInstanceBindings` run (on GET_COMPOSITION_SPEC).\n // A root section seeded without the catalog gets `selectedField=\"\"` → its\n // scoped template resolves to the whole page (renders the page root, e.g. the\n // page title, instead of its bound field) and stays wedged unless Studio's\n // UPDATE_SECTION_CONTEXTS push wins the race. This is especially visible after\n // a preview-entry switch, which re-navigates the canvas iframe (a fresh cold\n // load). Re-run the seeder — which now heals empty root scopes from the\n // freshly-available `linked_schemas` — and rebuild `section_scoped_data` so the\n // render picks up the corrected scope without depending on the timing of\n // Studio's push. No-op when the seeder heals nothing (`seeded === prev`), so\n // working specs are unaffected and this can't loop.\n useEffect(() => {\n // Editor-only heal — mirror every other effect in this hook, which\n // early-returns outside the Studio frame. No reason to re-seed/commit in a\n // standalone or published render.\n if (!clientRendererModeUtil.isInsideStudioFrame()) return;\n if (!state?.sectionCompositions?.length) return;\n setState((prev: StudioSpec) => {\n if (!prev?.ui || !prev?.data) return prev;\n const seeded = seedSectionInstanceBindings(prev);\n // Gate the rebuild + commit on the seeder's own no-op signal.\n // `rebuildScopedFromBindings` re-spreads the live `contentstack` /\n // `contentstack_queries` slices on every call, so for a page that has\n // sections it never returns its input unchanged — testing its result\n // would commit a fresh state (extra render + full scoped rebuild) on\n // every `sectionCompositions` ref change (Studio re-pushes the catalog on\n // refetch/refocus), not just when a cold-load scope actually heals.\n if (seeded === prev) return prev;\n return { ...seeded, data: rebuildScopedFromBindings(seeded.data) };\n });\n // Re-run whenever EITHER input the root-scope heal depends on lands:\n // • `sectionCompositions` — the section catalog (`linked_schemas`), and\n // • `connected_content_type` — the page CT that selects which linked\n // schema supplies the anchor field.\n // Both arrive asynchronously after a (re)load and in either order; keying on\n // only one leaves a race where the heal runs before the other is present,\n // computes an empty scope, and never retries — re-wedging the section.\n // The setState above changes neither dep, so this can't self-trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n state?.sectionCompositions,\n (state?.compositionEntry as any)?.connected_content_type,\n ]);\n\n // HOOK TO UPDATE THE STATE WITH THE LATEST SPEC DATA\n // Listeners are registered as soon as we're inside the Studio frame, before\n // spec has been fetched. Studio decides when to push UPDATE_SECTION_CONTEXTS\n // and UPDATE_SPEC_DATA based on its own readiness signal; the SDK can't\n // gate on `isCompositionBeingEdited(composableUid)` because that requires the\n // spec — and the parent reaches \"ready\" before the SDK's setState effect\n // has propagated, producing NO_REQUEST_LISTENER_FOUND.\n // The handlers themselves still defensively check `stateRef.current?.data`\n // before acting, so registering early is safe.\n useEffect(() => {\n if (!clientRendererModeUtil.isInsideStudioFrame()) return;\n const specDataChangeListener =\n composableStudioEventManager?.on<StudioSpecData>(\n POST_MESSAGE_EVENTS.UPDATE_SPEC_DATA,\n async (event) => {\n const { data } = event;\n if (!data || !stateRef.current?.data) return;\n\n setState((state: StudioSpec) => {\n if (!state) return state;\n // Merge incoming over existing — never replace dataSources\n // wholesale. Studio's UPDATE_SPEC_DATA pushes can carry only\n // a subset of slices (e.g., only `template` + `section_compositions`),\n // and a naive overwrite would wipe slices the SDK relied on\n // (e.g., the `repeater` item context populated earlier from\n // preview data resolution). Result was a visible flicker as\n // sections inside a Repeater suddenly lost their item context.\n // Also merge section_compositions key-by-key so SDK-seeded\n // per-instance bindings survive when Studio's push is partial.\n const incomingSections =\n (data as any)?.dataSources?.[SECTION_COMPOSITIONS_KEY] || {};\n const existingSections =\n (state.data as any)?.dataSources?.[SECTION_COMPOSITIONS_KEY] ||\n {};\n // Per-uid merge preserves `cardinality` when the incoming entry\n // lacks it — cardinality is a stable schema property, and a stale\n // push dropping it would disable the single-element array→element\n // collapse in rebuildScopedFromBindings (section blanks out).\n const mergedSections: Record<string, any> = {\n ...existingSections,\n };\n for (const [uid, incoming] of Object.entries(incomingSections)) {\n const prev = existingSections[uid];\n mergedSections[uid] =\n incoming &&\n typeof incoming === \"object\" &&\n (incoming as any).cardinality === undefined &&\n prev?.cardinality !== undefined\n ? { ...(incoming as any), cardinality: prev.cardinality }\n : incoming;\n }\n const mergedDataSources = {\n ...((state.data as any)?.dataSources || {}),\n ...((data as any)?.dataSources || {}),\n [SECTION_COMPOSITIONS_KEY]: mergedSections,\n };\n const mergedData = {\n ...state.data,\n ...data,\n dataSources: mergedDataSources,\n };\n const rebuilt = rebuildScopedFromBindings(mergedData);\n return {\n ...state,\n data: rebuilt,\n };\n });\n },\n );\n\n const previewEntryChangeListener = composableStudioEventManager?.on<{\n dataSources: DataSourceItem[];\n }>(POST_MESSAGE_EVENTS.REPLACE_PREVIEW_ENTRY, async (event) => {\n const { data } = event;\n if (!data?.dataSources || !stateRef.current?.data) return;\n\n setState((prevState: StudioSpec) => {\n if (!prevState) return prevState;\n // REPLACE_PREVIEW_ENTRY pushes dataSources for the preview-entry change\n // (typically just `template`/`contentstack` slices). Merge into existing\n // dataSources — don't wipe sibling slices like `repeater` or\n // `section_compositions`, which would cause a flicker for sections\n // inside a Repeater (their item context would disappear).\n const mergedData = {\n ...prevState?.data,\n [DATA_SOURCES_PREFIX]: {\n ...((prevState?.data as any)?.[DATA_SOURCES_PREFIX] || {}),\n ...(data?.dataSources as any),\n },\n };\n // The merge updates dataSources.template, but each section's SCOPED\n // template in section_scoped_data is derived from it — re-scope here,\n // else a section keeps its stale (often null) scope and renders the\n // empty placeholder after the preview entry is set/switched. (The\n // UPDATE_SPEC_DATA handler already rebuilds; this is the equivalent for\n // the preview-entry change path that EntryPickerBtn sends.)\n const rebuilt = rebuildScopedFromBindings(mergedData);\n return { ...prevState, data: rebuilt };\n });\n });\n\n const applyOperationListener = composableStudioEventManager?.on<{\n operations: Operation[];\n }>(POST_MESSAGE_EVENTS.APPLY_OPERATION, (event) => {\n const { data } = event;\n\n // Self-heal section catalog: if any op inserts a section-composition\n // node whose compositionUID isn't in the locally-known catalog\n // (race between Studio's section store hydration and the iframe's\n // initial GET_SECTIONS reply), re-fetch the catalog and merge.\n // Without this the section renders with \"Component … is not\n // registered\" until the page is saved + reloaded.\n const newSectionUids = new Set<string>();\n for (const op of data?.operations || []) {\n const node = (op as any)?.node;\n if (\n op &&\n (op as any).type === \"insert_node\" &&\n node &&\n typeof node === \"object\" &&\n node.type === \"section-composition\" &&\n typeof node.metadata?.compositionUID === \"string\"\n ) {\n newSectionUids.add(node.metadata.compositionUID as string);\n }\n }\n const known = new Set(\n (stateRef.current?.sectionCompositions || []).map(\n (s: SectionCompositionEntry) => s.uid,\n ),\n );\n const unknown = [...newSectionUids].filter((u) => !known.has(u));\n if (unknown.length > 0) {\n composableStudioEventManager\n ?.send<{ sectionCompositions: SectionCompositionEntry[] }>(\n POST_MESSAGE_EVENTS.GET_SECTIONS,\n {},\n )\n .then((resp) => {\n if (!resp?.sectionCompositions) return;\n setState((prevState: StudioSpec) => ({\n ...prevState,\n sectionCompositions: resp.sectionCompositions,\n }));\n })\n .catch(() => {});\n }\n\n setState((prevState: StudioSpec) => {\n if (!prevState?.ui || !data?.operations) return prevState;\n const newUI = produce(prevState.ui, (ui) => {\n const operations = data.operations;\n return applyOperation(ui, operations);\n });\n // Eagerly refresh the NODE_TO_PARENT / NODE_TO_PATH_NODE WeakMaps for\n // the new tree. These WeakMaps are otherwise only populated during\n // React render (Element.tsx) and `findPath` (used by hover/highlight\n // postMessages back to Studio) reads from them. Without this refresh\n // there is a window between APPLY_OPERATION and the next React commit\n // where mouse-move events emit paths derived from old node refs —\n // those paths don't exist in Studio's now-updated slate editor and\n // surface as \"Cannot find a descendant at path\" errors.\n refreshNodeWeakMaps(newUI as any);\n // Re-seed per-instance section bindings ONLY when the slate op might\n // have moved/inserted/removed a section-composition node. Property /\n // style / text-content ops can't change the section-instance graph,\n // so the seeder's full UI walk on those is wasted work. The seeder\n // itself is idempotent (it short-circuits when nothing mutated), but\n // skipping the walk altogether keeps interactive ops (typing, style\n // edits) cheap on large pages.\n const ops = data.operations as any[];\n const opAffectsSectionInstances = ops.some(\n (op) =>\n op?.type === \"insert_node\" ||\n op?.type === \"remove_node\" ||\n op?.type === \"move_node\" ||\n op?.type === \"merge_node\" ||\n op?.type === \"split_node\",\n );\n if (!opAffectsSectionInstances) {\n return { ...prevState, ui: newUI };\n }\n return seedSectionInstanceBindings({ ...prevState, ui: newUI });\n });\n });\n\n // Studio pushes only the section_compositions slice when section contexts\n // are recomputed (e.g. after a section node is added/moved/removed). We\n // patch just that slice on top of existing dataSources so other data\n // (template, contentstack, query results) isn't clobbered.\n //\n // We ALSO rebuild the matching `section_scoped_data[instanceUid].template`\n // (and repeater slot) using the fresh selectedField / uidRemapping /\n // parentRepeaterUID Studio just sent. Without this, SectionCompositionProvider\n // would keep rendering the stale pre-computed scoped data from fetchSpec\n // (which can be wrong on cold load if the UI node lacked\n // metadata.selectedField), because the provider prefers section_scoped_data\n // and never falls back to the legacy section_compositions slot when it\n // exists.\n const sectionContextsListener = composableStudioEventManager?.on<{\n sectionCompositions: Record<string, unknown>;\n }>(POST_MESSAGE_EVENTS.UPDATE_SECTION_CONTEXTS, (event) => {\n const { data } = event;\n if (!data?.sectionCompositions) return;\n // Merge key-by-key on top of SDK-seeded defaults. Studio only pushes\n // user-driven overrides for specific instance nodes; replacing the whole\n // slice would wipe the SDK's seeded baseline for all other instances.\n setState((prevState: StudioSpec) => {\n if (!prevState?.data) return prevState;\n const existing =\n (prevState.data as any)?.dataSources?.[SECTION_COMPOSITIONS_KEY] ||\n {};\n // Per-uid merge preserves `cardinality` when an incoming entry lacks\n // it (mirrors the UPDATE_SPEC_DATA merge below). Cardinality is a\n // stable schema property; a push dropping it disables the\n // single-element item-identity scoping for repeater-nested sections\n // and the array→element collapse — the section blanks out.\n const merged: Record<string, any> = { ...existing };\n for (const [uid, incoming] of Object.entries(\n data.sectionCompositions,\n )) {\n const prev = existing[uid];\n merged[uid] =\n incoming &&\n typeof incoming === \"object\" &&\n (incoming as any).cardinality === undefined &&\n prev?.cardinality !== undefined\n ? { ...(incoming as any), cardinality: prev.cardinality }\n : incoming;\n }\n const mergedData = {\n ...prevState.data,\n dataSources: {\n ...prevState.data?.dataSources,\n [SECTION_COMPOSITIONS_KEY]: merged,\n },\n } as any;\n // Pass the MERGED entries for the incoming uids (not the raw incoming)\n // — rebuildScopedFromBindings spreads incomingBindings over the slice,\n // so raw entries would reintroduce the dropped cardinality.\n const incomingMerged = Object.fromEntries(\n Object.keys(data.sectionCompositions).map((uid) => [\n uid,\n merged[uid],\n ]),\n );\n const finalData = rebuildScopedFromBindings(mergedData, incomingMerged);\n return {\n ...prevState,\n data: finalData,\n };\n });\n });\n\n // Signal to Studio that our editor→iframe post-message listeners are now\n // in the handler map. Studio gates UPDATE_SPEC_DATA (and similar) on this\n // event because earlier readiness signals (SDK_SPEC_RESOLVED, INIT_STUDIO)\n // fire before EditableRenderer commits its first render and race against\n // the .on(...) calls above.\n composableStudioEventManager\n ?.send(POST_MESSAGE_EVENTS.LISTENERS_READY, { composableUid })\n .then(() => {})\n .catch(() => {\n // Studio may not have its LISTENERS_READY handler registered yet on\n // very first paint — the bridge resolves this via its message queue,\n // so a dropped first emit is harmless. Not an error worth surfacing.\n });\n\n return () => {\n applyOperationListener?.unregister();\n specDataChangeListener?.unregister();\n previewEntryChangeListener?.unregister();\n sectionContextsListener?.unregister();\n };\n // Deps deliberately exclude state.data — see stateRef above. Re-registering\n // on every data change creates a window where Studio's pushes are dropped\n // with NO_REQUEST_LISTENER_FOUND. We do re-register on composableUid change\n // (e.g. switching to a different composition without unmount); the\n // LISTENERS_READY emit above re-signals Studio after each rebind.\n }, [composableUid]);\n};\n"],"names":[],"mappings":";;;;;;;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAEpD;;;;;;;;AAQG;AACH,SAAS,mBAAmB,CAAC,IAAS,EAAA;AACpC,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE;AACvC,IAAA,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;AACnC,IAAA,MAAM,KAAK,GAAG,CAAC,MAAW,KAAI;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,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AC;AACJ,QAAA,CAAC,CAAC;;;;;;QAOF;cACI,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE;AAC5D,aAAA,IAAI,CAAC,MAAK,EAAE,CAAC;aACb,KAAK,CAAC,MAAK;;;;AAIZ,QAAA,CAAC,CAAC;AAEJ,QAAA,OAAO,MAAK;YACV,sBAAsB,EAAE,UAAU,EAAE;YACpC,sBAAsB,EAAE,UAAU,EAAE;YACpC,0BAA0B,EAAE,UAAU,EAAE;YACxC,uBAAuB,EAAE,UAAU,EAAE;AACvC,QAAA,CAAC;;;;;;AAMH,IAAA,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;AACrB;;;;"}
|
|
1
|
+
{"version":3,"file":"use-spec-data-listener.hook.js","sources":["../../src/hooks/use-spec-data-listener.hook.ts"],"sourcesContent":["import {\n isCompositionBeingEdited,\n StudioSpec,\n applyOperation,\n SECTION_COMPOSITIONS_KEY,\n clientRendererModeUtil,\n NODE_TO_PARENT,\n NODE_TO_PATH_NODE,\n SectionCompositionEntry,\n} from \"@contentstack/studio-client\";\nimport { Operation } from \"@contentstack/studio-internal\";\nimport { POST_MESSAGE_EVENTS } from \"@contentstack/studio-messenger/constants\";\nimport { composableStudioEventManager } from \"@contentstack/studio-messenger\";\nimport {\n StudioSpecData,\n DataSourceItem,\n DATA_SOURCES_PREFIX,\n} from \"@contentstack/studio-registry\";\nimport {\n keepEqualReferences,\n pageDataSourcesOf,\n seedSectionInstanceBindings,\n} from \"@contentstack/studio-react-components/utils\";\nimport { useEffect, useRef } from \"react\";\nimport { Immer } from \"immer\";\n\n// Immer freezes what it produces, but metadata-binding resolution (currently\n// just styles) writes onto the produced node afterwards, which throws on frozen\n// state — so this module needs a non-freezing `produce`. Scoped to an isolated\n// instance rather than the global `setAutoFreeze(false)`: this is a published\n// package, and the global switch would silently remove the mutation guard for\n// the consuming app's own Immer usage.\nconst { produce } = new Immer({ autoFreeze: false });\n\n/**\n * Walk a fresh UI tree (post-Immer-produce) and populate the NODE_TO_PARENT\n * and NODE_TO_PATH_NODE WeakMaps for every node. These maps are normally\n * populated during React render (in Element.tsx). After APPLY_OPERATION\n * produces a brand-new tree via Immer, the maps still hold entries for\n * stale node refs — `findPath` (used to compute hover/highlight paths sent\n * back to Studio) returns stale paths until the next React commit. Calling\n * this immediately after applyOperation closes that window.\n */\nfunction refreshNodeWeakMaps(root: any): void {\n if (!root || typeof root !== \"object\") return;\n NODE_TO_PARENT.set(root, undefined);\n const visit = (parent: any) => {\n const slots = parent?.slots || {};\n for (const slotUid of Object.keys(slots)) {\n const children = slots[slotUid] || [];\n for (let idx = 0; idx < children.length; idx++) {\n const child = children[idx];\n if (!child || typeof child !== \"object\") continue;\n NODE_TO_PARENT.set(child, parent);\n NODE_TO_PATH_NODE.set(child, [slotUid, idx] as any);\n visit(child);\n }\n }\n };\n visit(root);\n}\n\n/**\n * `next` with every data slice `prev` already holds kept at its old reference,\n * one level into `dataSources` as well. Studio's pushes cross postMessage, so\n * they arrive as new objects even when nothing changed; without this, every\n * push re-renders the page.\n */\nfunction keepEqualData(prev: any, next: any): any {\n return keepEqualReferences(prev, {\n ...next,\n [DATA_SOURCES_PREFIX]: keepEqualReferences(\n prev?.[DATA_SOURCES_PREFIX],\n next?.[DATA_SOURCES_PREFIX],\n ),\n });\n}\n\nexport const useSpecDataListener = (\n setState: React.Dispatch<React.SetStateAction<StudioSpec>>,\n // Read into `stateRef` only — listener bodies use `stateRef.current` (not\n // `state` directly) so the effect's deps don't include `state.data`, which\n // would force re-register on every data change and create a window with\n // zero handlers between unregister/re-register (the original\n // `NO_REQUEST_LISTENER_FOUND` cause).\n state?: StudioSpec,\n composableUid?: string,\n) => {\n // Keep a ref to the latest state so the listener registrations don't have\n // to depend on state.data — they can read latest via stateRef.current\n // synchronously. Without this, every state.data change tore down + re-registered\n // the listeners, creating a window where Studio's UPDATE_SECTION_CONTEXTS\n // message was dropped with NO_REQUEST_LISTENER_FOUND.\n const stateRef = useRef(state);\n stateRef.current = state;\n\n // Rebuild section_scoped_data entries for instances whose binding metadata\n // (selectedField / uidRemapping / parentRepeaterUID) is present in the\n // legacy section_compositions slice. Mirrors build-scoped-data.ts logic\n // inline so the hook can rebuild without re-running the full fetchSpec\n // pipeline. Needed because Studio's fresh per-instance bindings arrive via\n // UPDATE_SPEC_DATA (and UPDATE_SECTION_CONTEXTS), while the provider only\n // reads from section_scoped_data — without this rebuild, sections render\n // the stale pre-computed scope from the initial fetchSpec (selectedField\n // missing from UI metadata on cold load → scoped template = whole page\n // template → placeholder text).\n const rebuildScopedFromBindings = (\n prevData: any,\n incomingBindings?: Record<string, unknown>,\n ): any => {\n const dataSources = prevData?.dataSources || {};\n const sectionBindings: Record<string, any> =\n incomingBindings && Object.keys(incomingBindings).length\n ? {\n ...(dataSources[SECTION_COMPOSITIONS_KEY] || {}),\n ...incomingBindings,\n }\n : dataSources[SECTION_COMPOSITIONS_KEY] || {};\n\n const pageTemplate = dataSources.template;\n const pageDataSources = pageDataSourcesOf(dataSources);\n\n /**\n * The document an instance's section data lives in (ADR 0017).\n *\n * The editor re-scopes every section from `dataSources.template` — the page\n * template entry. A FREEFORM page has none, so a section whose Section data\n * points at a pinned entry or a query resolved to `undefined` here and\n * rendered component defaults, even though the binding was stored\n * correctly and the fetch/cold-load path (build-scoped-data) resolved it\n * fine. This is the same hardcoded-anchor bug, in the live editor path.\n */\n const resolveFetchRootDocument = (fetchRootKey?: string): unknown => {\n if (!fetchRootKey || fetchRootKey === \"template\") return pageTemplate;\n if (fetchRootKey.startsWith(\"query:\")) {\n const qUid = fetchRootKey.slice(\"query:\".length);\n return (dataSources.contentstack_queries || {})[qUid];\n }\n // `<ct>:<uid>` — the same composite key the contentstack resolver uses.\n return (dataSources.contentstack || {})[fetchRootKey];\n };\n /**\n * Reference stubs, followed to their pooled entry — the step this scoper was\n * missing entirely (the fetch path's `build-scoped-data` has it at every\n * traversal step).\n *\n * CDA returns `{uid, _content_type_uid}` at a reference field unless the\n * request included it, and Studio's read funnel pools the resolved entry\n * separately under its `<ct>:<uid>` key. Without following the stub, a\n * Section data whose path CROSSES a reference resolved to the stub object:\n * the section's own fields were absent from it, so the canvas rendered\n * component defaults while the deployed site — which does follow — was\n * correct (COMS-2031: DR5.5, and the wrapper half of DR7.4).\n */\n const META_KEYS = new Set([\n \"uid\",\n \"_content_type_uid\",\n \"_version\",\n \"locale\",\n \"ACL\",\n \"_metadata\",\n // Live-preview edit tags. The Preview service stamps `$` onto every entry\n // and reference stub in the editor, so a bare stub arrives as\n // `{uid, _content_type_uid, $}` — three keys, one of which used to read as\n // \"this stub already carries a payload\". The stub was then handed back\n // unfollowed and a Section data whose path crosses a reference resolved to\n // the stub instead of the entry (E2E DR7.4). Metadata, never content.\n \"$\",\n ]);\n const followReference = (v: any): any => {\n if (\n !v ||\n typeof v !== \"object\" ||\n Array.isArray(v) ||\n typeof v.uid !== \"string\" ||\n typeof v._content_type_uid !== \"string\"\n ) {\n return v;\n }\n // CDA may already have inlined the entry into the stub object; anything\n // beyond the meta keys means it is resolved already.\n if (Object.keys(v).some((k) => !META_KEYS.has(k))) return v;\n const resolved = (dataSources.contentstack || {})[\n `${v._content_type_uid}:${v.uid}`\n ];\n return resolved !== undefined ? resolved : v;\n };\n const followAll = (v: any): any =>\n Array.isArray(v) ? v.map(followReference) : followReference(v);\n\n const prevScoped = prevData?.section_scoped_data || {};\n const nextScoped: Record<string, any> = { ...prevScoped };\n\n const getScopedData = (obj: any, selectedField?: string): any => {\n if (!selectedField) return followAll(obj);\n const traversed = selectedField\n .split(\".\")\n .reduce((val: any, seg: string) => {\n if (val == null) return val;\n // Swap a stub for its resolved entry BEFORE drilling into it.\n val = followReference(val);\n const arrayMatch = seg.match(/^(.*?)\\[(\\d+)\\]$/);\n if (arrayMatch) {\n const [, name, idxStr] = arrayMatch;\n const next = name ? val[name] : val;\n return next == null ? next : followReference(next[Number(idxStr)]);\n }\n // A bare NUMERIC segment is an array index. Contentstack bindings\n // encode one as a plain segment (`page_sections.17.keynote_speakers`)\n // rather than bracket notation, so this must precede the\n // array→first-element fallback below, which would otherwise look `17`\n // up as a key on element [0].\n if (Array.isArray(val) && /^\\d+$/.test(seg)) {\n return followReference(val[Number(seg)]);\n }\n // Non-indexed field access landing on an ARRAY → default to the first\n // element so an un-indexed array-ancestor path (e.g.\n // \"navigation_menu_3.menu_subitems\", where navigation_menu_3 is a\n // multiple group) still resolves instead of `array[field]` →\n // undefined → null. Indexed pushes (`navigation_menu_3[1]…`) override\n // this with the picked instance.\n if (Array.isArray(val)) {\n const first = followReference(val[0]);\n return first == null ? null : followReference(first[seg]);\n }\n return followReference(val[seg]);\n }, obj);\n return (\n (Array.isArray(traversed) ? followAll(traversed) : traversed) ?? null\n );\n };\n\n const applyUidRemapping = (\n scoped: any,\n uidRemapping: Record<string, string> = {},\n ): any => {\n if (\n !scoped ||\n typeof scoped !== \"object\" ||\n Object.keys(uidRemapping).length === 0\n ) {\n return scoped;\n }\n if (Array.isArray(scoped)) {\n return scoped.map((item: any) => applyUidRemapping(item, uidRemapping));\n }\n const remapped: Record<string, unknown> = {};\n const pageKeyValues = new Set(Object.values(uidRemapping));\n for (const [sectionKey, pageKey] of Object.entries(uidRemapping)) {\n remapped[sectionKey] = applyUidRemapping(scoped[pageKey], uidRemapping);\n }\n for (const key of Object.keys(scoped)) {\n if (!pageKeyValues.has(key) && !(key in uidRemapping)) {\n remapped[key] = applyUidRemapping(scoped[key], uidRemapping);\n }\n }\n return remapped;\n };\n\n let changed = false;\n for (const [instanceUid, bindingUnknown] of Object.entries(\n sectionBindings,\n )) {\n const binding = bindingUnknown as {\n selectedField?: string;\n uidRemapping?: Record<string, string>;\n parentRepeaterUID?: string | null;\n context?: unknown;\n componentPropsFallback?: Record<string, unknown>;\n cardinality?: \"collection\" | \"single\";\n expectsSingleDocument?: boolean;\n };\n // Skip context-only legacy shape — no selectedField to re-scope from.\n if (binding && \"context\" in binding && !(\"selectedField\" in binding)) {\n continue;\n }\n // A non-template fetch root carries its own in-document path; the\n // legacy `selectedField` is a page-template path and does not apply.\n const fetchRootKey = (binding as { fetchRootKey?: string })?.fetchRootKey;\n const fetchRootPrefix = (binding as { fetchRootPrefix?: string[] })\n ?.fetchRootPrefix;\n const usesPageTemplate = !fetchRootKey || fetchRootKey === \"template\";\n const rootDocument = resolveFetchRootDocument(fetchRootKey);\n const rootScopePath = usesPageTemplate\n ? binding?.selectedField\n : fetchRootPrefix?.join(\".\");\n\n let scopedTemplate = applyUidRemapping(\n getScopedData(rootDocument, rootScopePath),\n binding?.uidRemapping,\n );\n // Single-element section: `selectedField` stays index-free, so an\n // un-indexed terminal array resolves to the WHOLE array. Collapse to the\n // first element (the deploy default — the preview instance is session-only)\n // so the bound field resolves live, without depending on a save+reload\n // running the cold-load scoper. Mirrors build-scoped-data.ts. When the\n // path is already indexed (`menu_items[0]`, from Studio's push),\n // getScopedData returns the element and this is a no-op.\n if (binding?.cardinality === \"single\" && Array.isArray(scopedTemplate)) {\n scopedTemplate = scopedTemplate[0] ?? null;\n }\n // A CT-anchored section is ONE document. When its scope reached it through\n // a REFERENCE — a wrapper pinned at `settings_ref` rebasing its slot\n // children (ADR 0017) — CDA's array arrives instead of the entry, and the\n // section's own fields are not on an array. Collapse to the document.\n if (\n (binding as { expectsSingleDocument?: boolean })\n ?.expectsSingleDocument &&\n Array.isArray(scopedTemplate)\n ) {\n scopedTemplate = scopedTemplate[0] ?? null;\n }\n let repeater: Record<string, { context: unknown }> | undefined;\n if (binding?.parentRepeaterUID) {\n const ctx = dataSources.repeater?.[binding.parentRepeaterUID];\n if (ctx !== undefined) {\n repeater = { [binding.parentRepeaterUID]: ctx };\n }\n }\n const prev = prevScoped[instanceUid] || {};\n // Refresh contentstack / contentstack_queries from the live page\n // dataSources every time we rebuild. The initial scoped data built\n // during fetchSpec may have stale (or empty) entries because the\n // iframe loaded with getSpecFromParent and never fetched the section's\n // data sources itself — the studio pushes them later via\n // UPDATE_SPEC_DATA. Pool-keyed maps would be ideal but the listener\n // doesn't have access to them; sharing the full page slice is a safe\n // superset (same composite-key format the resolver expects). Shared by\n // reference, not copied, so an unchanged slice compares by identity.\n const refreshedContentstack =\n dataSources.contentstack && typeof dataSources.contentstack === \"object\"\n ? dataSources.contentstack\n : prev.contentstack || {};\n const refreshedQueries =\n dataSources.contentstack_queries &&\n typeof dataSources.contentstack_queries === \"object\"\n ? dataSources.contentstack_queries\n : prev.contentstack_queries || {};\n\n const next = {\n ...prev,\n template: scopedTemplate,\n contentstack: refreshedContentstack,\n contentstack_queries: refreshedQueries,\n page: pageDataSources,\n repeater: repeater ?? prev.repeater,\n // Carry binding metadata so SectionCompositionProvider can re-scope the\n // template from the LIVE per-iteration repeater item. The scopedTemplate\n // above is page-root-scoped and shared across every iteration of this\n // instance, so it can't represent per-iteration values on its own.\n parentRepeaterUID: binding?.parentRepeaterUID ?? null,\n selectedField: binding?.selectedField,\n fetchRootKey,\n fetchRootPrefix,\n uidRemapping: binding?.uidRemapping,\n cardinality: binding?.cardinality,\n componentPropsFallback: binding?.componentPropsFallback,\n };\n // Keep the old entry when its content is unchanged.\n const kept = keepEqualReferences(prev, next);\n if (kept !== prev) {\n nextScoped[instanceUid] = kept;\n changed = true;\n }\n }\n if (!changed) return prevData;\n return { ...prevData, section_scoped_data: nextScoped };\n };\n\n // Self-heal when the section catalog arrives after the initial seed.\n // `sectionCompositions` (each section's `linked_schemas` + authored UI) is\n // fetched asynchronously (GET_SECTIONS / UPDATE_SECTIONS_CATALOG) and can land\n // AFTER the first `seedSectionInstanceBindings` run (on GET_COMPOSITION_SPEC).\n // A root section seeded without the catalog gets `selectedField=\"\"` → its\n // scoped template resolves to the whole page (renders the page root, e.g. the\n // page title, instead of its bound field) and stays wedged unless Studio's\n // UPDATE_SECTION_CONTEXTS push wins the race. This is especially visible after\n // a preview-entry switch, which re-navigates the canvas iframe (a fresh cold\n // load). Re-run the seeder — which now heals empty root scopes from the\n // freshly-available `linked_schemas` — and rebuild `section_scoped_data` so the\n // render picks up the corrected scope without depending on the timing of\n // Studio's push. No-op when the seeder heals nothing (`seeded === prev`), so\n // working specs are unaffected and this can't loop.\n useEffect(() => {\n // Editor-only heal — mirror every other effect in this hook, which\n // early-returns outside the Studio frame. No reason to re-seed/commit in a\n // standalone or published render.\n if (!clientRendererModeUtil.isInsideStudioFrame()) return;\n if (!state?.sectionCompositions?.length) return;\n setState((prev: StudioSpec) => {\n if (!prev?.ui || !prev?.data) return prev;\n const seeded = seedSectionInstanceBindings(prev);\n // Gate the rebuild + commit on the seeder's own no-op signal.\n // `rebuildScopedFromBindings` re-spreads the live `contentstack` /\n // `contentstack_queries` slices on every call, so for a page that has\n // sections it never returns its input unchanged — testing its result\n // would commit a fresh state (extra render + full scoped rebuild) on\n // every `sectionCompositions` ref change (Studio re-pushes the catalog on\n // refetch/refocus), not just when a cold-load scope actually heals.\n if (seeded === prev) return prev;\n return { ...seeded, data: rebuildScopedFromBindings(seeded.data) };\n });\n // Re-run whenever EITHER input the root-scope heal depends on lands:\n // • `sectionCompositions` — the section catalog (`linked_schemas`), and\n // • `connected_content_type` — the page CT that selects which linked\n // schema supplies the anchor field.\n // Both arrive asynchronously after a (re)load and in either order; keying on\n // only one leaves a race where the heal runs before the other is present,\n // computes an empty scope, and never retries — re-wedging the section.\n // The setState above changes neither dep, so this can't self-trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n state?.sectionCompositions,\n (state?.compositionEntry as any)?.connected_content_type,\n ]);\n\n // HOOK TO UPDATE THE STATE WITH THE LATEST SPEC DATA\n // Listeners are registered as soon as we're inside the Studio frame, before\n // spec has been fetched. Studio decides when to push UPDATE_SECTION_CONTEXTS\n // and UPDATE_SPEC_DATA based on its own readiness signal; the SDK can't\n // gate on `isCompositionBeingEdited(composableUid)` because that requires the\n // spec — and the parent reaches \"ready\" before the SDK's setState effect\n // has propagated, producing NO_REQUEST_LISTENER_FOUND.\n // The handlers themselves still defensively check `stateRef.current?.data`\n // before acting, so registering early is safe.\n useEffect(() => {\n if (!clientRendererModeUtil.isInsideStudioFrame()) return;\n const specDataChangeListener =\n composableStudioEventManager?.on<StudioSpecData>(\n POST_MESSAGE_EVENTS.UPDATE_SPEC_DATA,\n async (event) => {\n const { data } = event;\n if (!data || !stateRef.current?.data) return;\n\n setState((state: StudioSpec) => {\n if (!state) return state;\n // Merge incoming over existing — never replace dataSources\n // wholesale. Studio's UPDATE_SPEC_DATA pushes can carry only\n // a subset of slices (e.g., only `template` + `section_compositions`),\n // and a naive overwrite would wipe slices the SDK relied on\n // (e.g., the `repeater` item context populated earlier from\n // preview data resolution). Result was a visible flicker as\n // sections inside a Repeater suddenly lost their item context.\n // Also merge section_compositions key-by-key so SDK-seeded\n // per-instance bindings survive when Studio's push is partial.\n const incomingSections =\n (data as any)?.dataSources?.[SECTION_COMPOSITIONS_KEY] || {};\n const existingSections =\n (state.data as any)?.dataSources?.[SECTION_COMPOSITIONS_KEY] ||\n {};\n // Per-uid merge preserves `cardinality` when the incoming entry\n // lacks it — cardinality is a stable schema property, and a stale\n // push dropping it would disable the single-element array→element\n // collapse in rebuildScopedFromBindings (section blanks out).\n const mergedSections: Record<string, any> = {\n ...existingSections,\n };\n for (const [uid, incoming] of Object.entries(incomingSections)) {\n const prev = existingSections[uid];\n mergedSections[uid] =\n incoming &&\n typeof incoming === \"object\" &&\n (incoming as any).cardinality === undefined &&\n prev?.cardinality !== undefined\n ? { ...(incoming as any), cardinality: prev.cardinality }\n : incoming;\n }\n const mergedDataSources = {\n ...((state.data as any)?.dataSources || {}),\n ...((data as any)?.dataSources || {}),\n [SECTION_COMPOSITIONS_KEY]: mergedSections,\n };\n const mergedData = keepEqualData(state.data, {\n ...state.data,\n ...data,\n dataSources: mergedDataSources,\n });\n const rebuilt = rebuildScopedFromBindings(mergedData);\n return rebuilt === state.data ? state : { ...state, data: rebuilt };\n });\n },\n );\n\n const previewEntryChangeListener = composableStudioEventManager?.on<{\n dataSources: DataSourceItem[];\n }>(POST_MESSAGE_EVENTS.REPLACE_PREVIEW_ENTRY, async (event) => {\n const { data } = event;\n if (!data?.dataSources || !stateRef.current?.data) return;\n\n setState((prevState: StudioSpec) => {\n if (!prevState) return prevState;\n // REPLACE_PREVIEW_ENTRY pushes dataSources for the preview-entry change\n // (typically just `template`/`contentstack` slices). Merge into existing\n // dataSources — don't wipe sibling slices like `repeater` or\n // `section_compositions`, which would cause a flicker for sections\n // inside a Repeater (their item context would disappear).\n const mergedData = keepEqualData(prevState.data, {\n ...prevState?.data,\n [DATA_SOURCES_PREFIX]: {\n ...((prevState?.data as any)?.[DATA_SOURCES_PREFIX] || {}),\n ...(data?.dataSources as any),\n },\n });\n // The merge updates dataSources.template, but each section's SCOPED\n // template in section_scoped_data is derived from it — re-scope here,\n // else a section keeps its stale (often null) scope and renders the\n // empty placeholder after the preview entry is set/switched. (The\n // UPDATE_SPEC_DATA handler already rebuilds; this is the equivalent for\n // the preview-entry change path that EntryPickerBtn sends.)\n const rebuilt = rebuildScopedFromBindings(mergedData);\n return rebuilt === prevState.data\n ? prevState\n : { ...prevState, data: rebuilt };\n });\n });\n\n const applyOperationListener = composableStudioEventManager?.on<{\n operations: Operation[];\n }>(POST_MESSAGE_EVENTS.APPLY_OPERATION, (event) => {\n const { data } = event;\n\n // Self-heal section catalog: if any op inserts a section-composition\n // node whose compositionUID isn't in the locally-known catalog\n // (race between Studio's section store hydration and the iframe's\n // initial GET_SECTIONS reply), re-fetch the catalog and merge.\n // Without this the section renders with \"Component … is not\n // registered\" until the page is saved + reloaded.\n const newSectionUids = new Set<string>();\n for (const op of data?.operations || []) {\n const node = (op as any)?.node;\n if (\n op &&\n (op as any).type === \"insert_node\" &&\n node &&\n typeof node === \"object\" &&\n node.type === \"section-composition\" &&\n typeof node.metadata?.compositionUID === \"string\"\n ) {\n newSectionUids.add(node.metadata.compositionUID as string);\n }\n }\n const known = new Set(\n (stateRef.current?.sectionCompositions || []).map(\n (s: SectionCompositionEntry) => s.uid,\n ),\n );\n const unknown = [...newSectionUids].filter((u) => !known.has(u));\n if (unknown.length > 0) {\n composableStudioEventManager\n ?.send<{ sectionCompositions: SectionCompositionEntry[] }>(\n POST_MESSAGE_EVENTS.GET_SECTIONS,\n {},\n )\n .then((resp) => {\n if (!resp?.sectionCompositions) return;\n setState((prevState: StudioSpec) => ({\n ...prevState,\n sectionCompositions: resp.sectionCompositions,\n }));\n })\n .catch(() => {});\n }\n\n setState((prevState: StudioSpec) => {\n if (!prevState?.ui || !data?.operations) return prevState;\n const newUI = produce(prevState.ui, (ui) => {\n const operations = data.operations;\n return applyOperation(ui, operations);\n });\n // Eagerly refresh the NODE_TO_PARENT / NODE_TO_PATH_NODE WeakMaps for\n // the new tree. These WeakMaps are otherwise only populated during\n // React render (Element.tsx) and `findPath` (used by hover/highlight\n // postMessages back to Studio) reads from them. Without this refresh\n // there is a window between APPLY_OPERATION and the next React commit\n // where mouse-move events emit paths derived from old node refs —\n // those paths don't exist in Studio's now-updated slate editor and\n // surface as \"Cannot find a descendant at path\" errors.\n refreshNodeWeakMaps(newUI as any);\n // Re-seed per-instance section bindings ONLY when the slate op might\n // have moved/inserted/removed a section-composition node. Property /\n // style / text-content ops can't change the section-instance graph,\n // so the seeder's full UI walk on those is wasted work. The seeder\n // itself is idempotent (it short-circuits when nothing mutated), but\n // skipping the walk altogether keeps interactive ops (typing, style\n // edits) cheap on large pages.\n const ops = data.operations as any[];\n const opAffectsSectionInstances = ops.some(\n (op) =>\n op?.type === \"insert_node\" ||\n op?.type === \"remove_node\" ||\n op?.type === \"move_node\" ||\n op?.type === \"merge_node\" ||\n op?.type === \"split_node\",\n );\n if (!opAffectsSectionInstances) {\n return { ...prevState, ui: newUI };\n }\n return seedSectionInstanceBindings({ ...prevState, ui: newUI });\n });\n });\n\n // Studio pushes only the section_compositions slice when section contexts\n // are recomputed (e.g. after a section node is added/moved/removed). We\n // patch just that slice on top of existing dataSources so other data\n // (template, contentstack, query results) isn't clobbered.\n //\n // We ALSO rebuild the matching `section_scoped_data[instanceUid].template`\n // (and repeater slot) using the fresh selectedField / uidRemapping /\n // parentRepeaterUID Studio just sent. Without this, SectionCompositionProvider\n // would keep rendering the stale pre-computed scoped data from fetchSpec\n // (which can be wrong on cold load if the UI node lacked\n // metadata.selectedField), because the provider prefers section_scoped_data\n // and never falls back to the legacy section_compositions slot when it\n // exists.\n const sectionContextsListener = composableStudioEventManager?.on<{\n sectionCompositions: Record<string, unknown>;\n }>(POST_MESSAGE_EVENTS.UPDATE_SECTION_CONTEXTS, (event) => {\n const { data } = event;\n if (!data?.sectionCompositions) return;\n // Merge key-by-key on top of SDK-seeded defaults. Studio only pushes\n // user-driven overrides for specific instance nodes; replacing the whole\n // slice would wipe the SDK's seeded baseline for all other instances.\n setState((prevState: StudioSpec) => {\n if (!prevState?.data) return prevState;\n const existing =\n (prevState.data as any)?.dataSources?.[SECTION_COMPOSITIONS_KEY] ||\n {};\n // Per-uid merge preserves `cardinality` when an incoming entry lacks\n // it (mirrors the UPDATE_SPEC_DATA merge below). Cardinality is a\n // stable schema property; a push dropping it disables the\n // single-element item-identity scoping for repeater-nested sections\n // and the array→element collapse — the section blanks out.\n const merged: Record<string, any> = { ...existing };\n for (const [uid, incoming] of Object.entries(\n data.sectionCompositions,\n )) {\n const prev = existing[uid];\n merged[uid] =\n incoming &&\n typeof incoming === \"object\" &&\n (incoming as any).cardinality === undefined &&\n prev?.cardinality !== undefined\n ? { ...(incoming as any), cardinality: prev.cardinality }\n : incoming;\n }\n const mergedData = keepEqualData(prevState.data, {\n ...prevState.data,\n dataSources: {\n ...prevState.data?.dataSources,\n [SECTION_COMPOSITIONS_KEY]: merged,\n },\n });\n // Pass the MERGED entries for the incoming uids (not the raw incoming)\n // — rebuildScopedFromBindings spreads incomingBindings over the slice,\n // so raw entries would reintroduce the dropped cardinality.\n const incomingMerged = Object.fromEntries(\n Object.keys(data.sectionCompositions).map((uid) => [\n uid,\n merged[uid],\n ]),\n );\n const finalData = rebuildScopedFromBindings(mergedData, incomingMerged);\n return finalData === prevState.data\n ? prevState\n : { ...prevState, data: finalData };\n });\n });\n\n // Signal to Studio that our editor→iframe post-message listeners are now\n // in the handler map. Studio gates UPDATE_SPEC_DATA (and similar) on this\n // event because earlier readiness signals (SDK_SPEC_RESOLVED, INIT_STUDIO)\n // fire before EditableRenderer commits its first render and race against\n // the .on(...) calls above.\n composableStudioEventManager\n ?.send(POST_MESSAGE_EVENTS.LISTENERS_READY, { composableUid })\n .then(() => {})\n .catch(() => {\n // Studio may not have its LISTENERS_READY handler registered yet on\n // very first paint — the bridge resolves this via its message queue,\n // so a dropped first emit is harmless. Not an error worth surfacing.\n });\n\n return () => {\n applyOperationListener?.unregister();\n specDataChangeListener?.unregister();\n previewEntryChangeListener?.unregister();\n sectionContextsListener?.unregister();\n };\n // Deps deliberately exclude state.data — see stateRef above. Re-registering\n // on every data change creates a window where Studio's pushes are dropped\n // with NO_REQUEST_LISTENER_FOUND. We do re-register on composableUid change\n // (e.g. switching to a different composition without unmount); the\n // LISTENERS_READY emit above re-signals Studio after each rebind.\n }, [composableUid]);\n};\n"],"names":[],"mappings":";;;;;;;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAEpD;;;;;;;;AAQG;AACH,SAAS,mBAAmB,CAAC,IAAS,EAAA;AACpC,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE;AACvC,IAAA,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;AACnC,IAAA,MAAM,KAAK,GAAG,CAAC,MAAW,KAAI;AAC5B,QAAA,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,EAAE;QACjC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE;AACrC,YAAA,K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AO,SAAS,KAAK,SAAS,CAAC;AAC7B,sBAAE;sBACA,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;AACvC,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;;;;;;QAOF;cACI,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE;AAC5D,aAAA,IAAI,CAAC,MAAK,EAAE,CAAC;aACb,KAAK,CAAC,MAAK;;;;AAIZ,QAAA,CAAC,CAAC;AAEJ,QAAA,OAAO,MAAK;YACV,sBAAsB,EAAE,UAAU,EAAE;YACpC,sBAAsB,EAAE,UAAU,EAAE;YACpC,0BAA0B,EAAE,UAAU,EAAE;YACxC,uBAAuB,EAAE,UAAU,EAAE;AACvC,QAAA,CAAC;;;;;;AAMH,IAAA,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;AACrB;;;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isCompositionBeingEdited, preProcessStaticValues } from '@contentstack/studio-client';
|
|
2
|
-
import {
|
|
2
|
+
import { POST_MESSAGE_EVENTS } from '@contentstack/studio-messenger/constants';
|
|
3
|
+
import { composableStudioEventManager } from '@contentstack/studio-messenger';
|
|
3
4
|
import { DATA_SOURCES } from '@contentstack/studio-registry';
|
|
5
|
+
import { keepEqualReferences } from '@contentstack/studio-react-components/utils';
|
|
4
6
|
import { useEffect } from 'react';
|
|
5
7
|
|
|
6
8
|
const useStaticValuesListener = (setState, state, composableUid) => {
|
|
@@ -14,11 +16,17 @@ const useStaticValuesListener = (setState, state, composableUid) => {
|
|
|
14
16
|
setState((prevState) => {
|
|
15
17
|
if (!prevState)
|
|
16
18
|
return prevState;
|
|
19
|
+
const prevStaticValue = prevState.data?.[DATA_SOURCES.STATIC_VALUE];
|
|
20
|
+
// Keep the old reference when the values are unchanged; a new one
|
|
21
|
+
// re-renders every Element on the page.
|
|
22
|
+
const staticValue = keepEqualReferences(prevStaticValue, preProcessStaticValues(data.staticValue));
|
|
23
|
+
if (staticValue === prevStaticValue)
|
|
24
|
+
return prevState;
|
|
17
25
|
return {
|
|
18
26
|
...prevState,
|
|
19
27
|
data: {
|
|
20
28
|
...prevState.data,
|
|
21
|
-
[DATA_SOURCES.STATIC_VALUE]:
|
|
29
|
+
[DATA_SOURCES.STATIC_VALUE]: staticValue,
|
|
22
30
|
},
|
|
23
31
|
};
|
|
24
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-static-values-listener.hook.js","sources":["../../src/hooks/use-static-values-listener.hook.ts"],"sourcesContent":["import {\n isCompositionBeingEdited,\n StudioSpec,\n preProcessStaticValues,\n} from \"@contentstack/studio-client\";\nimport {\
|
|
1
|
+
{"version":3,"file":"use-static-values-listener.hook.js","sources":["../../src/hooks/use-static-values-listener.hook.ts"],"sourcesContent":["import {\n isCompositionBeingEdited,\n StudioSpec,\n preProcessStaticValues,\n} from \"@contentstack/studio-client\";\nimport { POST_MESSAGE_EVENTS } from \"@contentstack/studio-messenger/constants\";\nimport { composableStudioEventManager } from \"@contentstack/studio-messenger\";\nimport { RawStaticValue, DATA_SOURCES } from \"@contentstack/studio-registry\";\nimport { keepEqualReferences } from \"@contentstack/studio-react-components/utils\";\nimport { useEffect } from \"react\";\n\nexport const useStaticValuesListener = (\n setState: React.Dispatch<React.SetStateAction<StudioSpec>>,\n state?: StudioSpec,\n composableUid?: string,\n) => {\n useEffect(() => {\n if (!isCompositionBeingEdited(composableUid || \"\")) return;\n const staticValueChangeListener = composableStudioEventManager?.on<{\n staticValue: RawStaticValue;\n }>(POST_MESSAGE_EVENTS.UPDATE_STATIC_VALUE, (event) => {\n const { data } = event;\n if (!data) return;\n setState((prevState: StudioSpec) => {\n if (!prevState) return prevState;\n const prevStaticValue = prevState.data?.[DATA_SOURCES.STATIC_VALUE];\n // Keep the old reference when the values are unchanged; a new one\n // re-renders every Element on the page.\n const staticValue = keepEqualReferences(\n prevStaticValue,\n preProcessStaticValues(data.staticValue),\n );\n if (staticValue === prevStaticValue) return prevState;\n return {\n ...prevState,\n data: {\n ...prevState.data,\n [DATA_SOURCES.STATIC_VALUE]: staticValue,\n },\n };\n });\n });\n\n return () => {\n staticValueChangeListener?.unregister();\n };\n }, [state?.compositionEntry?.uid, composableUid]);\n};\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,uBAAuB,GAAG,CACrC,QAA0D,EAC1D,KAAkB,EAClB,aAAsB,KACpB;IACF,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,wBAAwB,CAAC,aAAa,IAAI,EAAE,CAAC;YAAE;AACpD,QAAA,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,EAAE,CAE/D,mBAAmB,CAAC,mBAAmB,EAAE,CAAC,KAAK,KAAI;AACpD,YAAA,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK;AACtB,YAAA,IAAI,CAAC,IAAI;gBAAE;AACX,YAAA,QAAQ,CAAC,CAAC,SAAqB,KAAI;AACjC,gBAAA,IAAI,CAAC,SAAS;AAAE,oBAAA,OAAO,SAAS;gBAChC,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC,YAAY,CAAC;;;AAGnE,gBAAA,MAAM,WAAW,GAAG,mBAAmB,CACrC,eAAe,EACf,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC,CACzC;gBACD,IAAI,WAAW,KAAK,eAAe;AAAE,oBAAA,OAAO,SAAS;gBACrD,OAAO;AACL,oBAAA,GAAG,SAAS;AACZ,oBAAA,IAAI,EAAE;wBACJ,GAAG,SAAS,CAAC,IAAI;AACjB,wBAAA,CAAC,YAAY,CAAC,YAAY,GAAG,WAAW;AACzC,qBAAA;iBACF;AACH,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,MAAK;YACV,yBAAyB,EAAE,UAAU,EAAE;AACzC,QAAA,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;AACnD;;;;"}
|
|
@@ -12,19 +12,46 @@ const shouldRenderSlot = (componentRegistry, parent, nodes, isCompositionBeingEd
|
|
|
12
12
|
return isEmpty;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Placeholder text for an empty slot owned by `parent`, or `undefined` for the
|
|
16
|
+
* plain "Drop Here".
|
|
17
|
+
*
|
|
18
|
+
* Covers the two hints a node can read off itself: the repeater advice, and a
|
|
19
|
+
* condition block's own empty slot. The third case — the single container inside
|
|
20
|
+
* a condition block — is handed down by the block instead; see
|
|
21
|
+
* `getConditionWellHint`.
|
|
22
|
+
*
|
|
23
|
+
* Repeater and condition hints are mutually exclusive by construction — a node
|
|
24
|
+
* cannot be both — so they share the single `hint` channel and need no
|
|
25
|
+
* precedence rule between them.
|
|
26
|
+
*/
|
|
27
|
+
const getSlotHint = (parent) => {
|
|
28
|
+
if (parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&
|
|
29
|
+
parent.metadata?.repeaterBindingFieldType) {
|
|
30
|
+
return "It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References.";
|
|
31
|
+
}
|
|
32
|
+
if (parent.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)
|
|
33
|
+
return undefined;
|
|
34
|
+
return getConditionBlockHint(parent);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The hint a condition block hands down to `child` when the child's empty slot is
|
|
38
|
+
* the block's **drop well**, or `undefined` when it is not.
|
|
17
39
|
*
|
|
18
40
|
* A condition block is `display: contents`, so it has no drop area of its own.
|
|
19
|
-
* The well is therefore the block's own slot while the block is empty
|
|
20
|
-
* slot of the single container placed inside it once one
|
|
21
|
-
* Box auto-inserted for modular-block / reference
|
|
22
|
-
* mutually exclusive in time: the moment the Box
|
|
23
|
-
* filled and stops rendering a placeholder.
|
|
41
|
+
* The well is therefore the block's own slot while the block is empty (handled by
|
|
42
|
+
* `getSlotHint`), and the slot of the single container placed inside it once one
|
|
43
|
+
* has been (typically the Box auto-inserted for modular-block / reference
|
|
44
|
+
* repeaters). Those two are mutually exclusive in time: the moment the Box
|
|
45
|
+
* exists, the block's own slot is filled and stops rendering a placeholder.
|
|
24
46
|
*
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
47
|
+
* The block computes this and passes it DOWN, rather than the container looking
|
|
48
|
+
* UP for its block. Elements are memoised on node identity, and editor state is
|
|
49
|
+
* structurally shared: setting the block's condition replaces the block and its
|
|
50
|
+
* ancestors but leaves the container the same object. A container that read the
|
|
51
|
+
* condition off its parent would therefore never re-render and keep the hint it
|
|
52
|
+
* drew before the condition existed. The block always re-renders when anything
|
|
53
|
+
* the hint depends on changes — its own condition, or the container filling —
|
|
54
|
+
* so deriving it there and passing it as a prop keeps the two in step.
|
|
28
55
|
*
|
|
29
56
|
* The rule is positional, not provenance-based: a Box the author dropped in
|
|
30
57
|
* themselves is treated exactly like the auto-inserted one, because its
|
|
@@ -32,38 +59,22 @@ const shouldRenderSlot = (componentRegistry, parent, nodes, isCompositionBeingEd
|
|
|
32
59
|
* says. Depth stops at one hop — a well is a single slot, so a placeholder
|
|
33
60
|
* nested deeper is not standing in for the block's contents.
|
|
34
61
|
*/
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
return parent;
|
|
38
|
-
const grandParent = NODE_TO_PARENT.get(parent);
|
|
39
|
-
if (grandParent?.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)
|
|
62
|
+
const getConditionWellHint = (block, child) => {
|
|
63
|
+
if (block.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)
|
|
40
64
|
return undefined;
|
|
41
65
|
// The block must hold exactly this one node. With two empty containers there
|
|
42
66
|
// is no single well, and printing the hint on both would be noise.
|
|
43
|
-
const blockChildren = Object.values(
|
|
44
|
-
if (blockChildren.length !== 1 || blockChildren[0] !==
|
|
67
|
+
const blockChildren = Object.values(block.slots || {}).flat();
|
|
68
|
+
if (blockChildren.length !== 1 || blockChildren[0]?.uid !== child.uid)
|
|
45
69
|
return undefined;
|
|
46
70
|
// And that node must itself be empty — once real content lands anywhere under
|
|
47
71
|
// the block, no slot beneath it is standing in for the block's contents.
|
|
48
|
-
if (Object.values(
|
|
72
|
+
if (Object.values(child.slots || {}).flat().length > 0)
|
|
49
73
|
return undefined;
|
|
50
|
-
return
|
|
74
|
+
return getConditionBlockHint(block);
|
|
51
75
|
};
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
* Repeater and condition hints are mutually exclusive by construction — a node
|
|
56
|
-
* cannot be both — so they share the single `hint` channel and need no
|
|
57
|
-
* precedence rule between them.
|
|
58
|
-
*/
|
|
59
|
-
const getSlotHint = (parent) => {
|
|
60
|
-
if (parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&
|
|
61
|
-
parent.metadata?.repeaterBindingFieldType) {
|
|
62
|
-
return "It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References.";
|
|
63
|
-
}
|
|
64
|
-
const block = getConditionWellBlock(parent);
|
|
65
|
-
if (!block)
|
|
66
|
-
return undefined;
|
|
76
|
+
/** The condition a block's drop well describes, as "When …" text. */
|
|
77
|
+
const getConditionBlockHint = (block) => {
|
|
67
78
|
// An `unsupported` hint means a condition IS set but cannot be described.
|
|
68
79
|
// "Drop Here" on its own is already a complete, correct message, so the well
|
|
69
80
|
// says nothing extra rather than guessing.
|
|
@@ -99,5 +110,5 @@ const getRepeaterFieldName = (node) => {
|
|
|
99
110
|
return field ? uidToDisplayName(field) : undefined;
|
|
100
111
|
};
|
|
101
112
|
|
|
102
|
-
export {
|
|
113
|
+
export { getConditionWellHint, getSlotHint, shouldRenderSlot };
|
|
103
114
|
//# sourceMappingURL=renderer.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.util.js","sources":["../../src/utils/renderer.util.ts"],"sourcesContent":["import { NODE_TO_PARENT } from \"@contentstack/studio-client\";\nimport type {\n Condition,\n ConditionDisplay,\n Node,\n} from \"@contentstack/studio-internal\";\nimport {\n getBindingFieldPath,\n getConditionHint,\n uidToDisplayName,\n} from \"@contentstack/studio-internal\";\nimport {\n ComponentRegistry,\n INTERNAL_COMPONENTS_NAMES,\n} from \"@contentstack/studio-registry\";\nimport { ReactNode } from \"react\";\n\nexport const shouldRenderSlot = (\n componentRegistry: ComponentRegistry<(props?: any) => ReactNode>,\n parent: Node,\n nodes: Node[],\n isCompositionBeingEdited: boolean,\n) => {\n if (!isCompositionBeingEdited) return false;\n if (!componentRegistry?.hasComponent(parent)) {\n return false;\n }\n const isEmpty = nodes.length === 0;\n\n return isEmpty;\n};\n\n/**\n * The condition block
|
|
1
|
+
{"version":3,"file":"renderer.util.js","sources":["../../src/utils/renderer.util.ts"],"sourcesContent":["import { NODE_TO_PARENT } from \"@contentstack/studio-client\";\nimport type {\n Condition,\n ConditionDisplay,\n Node,\n} from \"@contentstack/studio-internal\";\nimport {\n getBindingFieldPath,\n getConditionHint,\n uidToDisplayName,\n} from \"@contentstack/studio-internal\";\nimport {\n ComponentRegistry,\n INTERNAL_COMPONENTS_NAMES,\n} from \"@contentstack/studio-registry\";\nimport { ReactNode } from \"react\";\n\nexport const shouldRenderSlot = (\n componentRegistry: ComponentRegistry<(props?: any) => ReactNode>,\n parent: Node,\n nodes: Node[],\n isCompositionBeingEdited: boolean,\n) => {\n if (!isCompositionBeingEdited) return false;\n if (!componentRegistry?.hasComponent(parent)) {\n return false;\n }\n const isEmpty = nodes.length === 0;\n\n return isEmpty;\n};\n\n/**\n * Placeholder text for an empty slot owned by `parent`, or `undefined` for the\n * plain \"Drop Here\".\n *\n * Covers the two hints a node can read off itself: the repeater advice, and a\n * condition block's own empty slot. The third case — the single container inside\n * a condition block — is handed down by the block instead; see\n * `getConditionWellHint`.\n *\n * Repeater and condition hints are mutually exclusive by construction — a node\n * cannot be both — so they share the single `hint` channel and need no\n * precedence rule between them.\n */\nexport const getSlotHint = (parent: Node): string | undefined => {\n if (\n parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&\n parent.metadata?.repeaterBindingFieldType\n ) {\n return \"It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References.\";\n }\n\n if (parent.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)\n return undefined;\n\n return getConditionBlockHint(parent);\n};\n\n/**\n * The hint a condition block hands down to `child` when the child's empty slot is\n * the block's **drop well**, or `undefined` when it is not.\n *\n * A condition block is `display: contents`, so it has no drop area of its own.\n * The well is therefore the block's own slot while the block is empty (handled by\n * `getSlotHint`), and the slot of the single container placed inside it once one\n * has been (typically the Box auto-inserted for modular-block / reference\n * repeaters). Those two are mutually exclusive in time: the moment the Box\n * exists, the block's own slot is filled and stops rendering a placeholder.\n *\n * The block computes this and passes it DOWN, rather than the container looking\n * UP for its block. Elements are memoised on node identity, and editor state is\n * structurally shared: setting the block's condition replaces the block and its\n * ancestors but leaves the container the same object. A container that read the\n * condition off its parent would therefore never re-render and keep the hint it\n * drew before the condition existed. The block always re-renders when anything\n * the hint depends on changes — its own condition, or the container filling —\n * so deriving it there and passing it as a prop keeps the two in step.\n *\n * The rule is positional, not provenance-based: a Box the author dropped in\n * themselves is treated exactly like the auto-inserted one, because its\n * provenance is invisible to the author and should not change what the slot\n * says. Depth stops at one hop — a well is a single slot, so a placeholder\n * nested deeper is not standing in for the block's contents.\n */\nexport const getConditionWellHint = (\n block: Node,\n child: Node,\n): string | undefined => {\n if (block.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)\n return undefined;\n\n // The block must hold exactly this one node. With two empty containers there\n // is no single well, and printing the hint on both would be noise.\n const blockChildren = Object.values(block.slots || {}).flat();\n if (blockChildren.length !== 1 || blockChildren[0]?.uid !== child.uid)\n return undefined;\n\n // And that node must itself be empty — once real content lands anywhere under\n // the block, no slot beneath it is standing in for the block's contents.\n if (Object.values(child.slots || {}).flat().length > 0) return undefined;\n\n return getConditionBlockHint(block);\n};\n\n/** The condition a block's drop well describes, as \"When …\" text. */\nconst getConditionBlockHint = (block: Node): string | undefined => {\n // An `unsupported` hint means a condition IS set but cannot be described.\n // \"Drop Here\" on its own is already a complete, correct message, so the well\n // says nothing extra rather than guessing.\n //\n // `conditionDisplay` carries the display names resolved when the condition was\n // authored. The helper falls back to the stored uids when it is absent, which\n // is the permanent case for conditions written by the CLI or the API.\n const hint = getConditionHint(\n block.metadata?.condition as Condition | undefined,\n block.metadata?.conditionDisplay as ConditionDisplay | undefined,\n {\n subject: getRepeaterFieldName(\n NODE_TO_PARENT.get(block) as Node | undefined,\n ),\n },\n );\n return hint?.kind === \"info\" ? `${hint.prefix} ${hint.value}` : undefined;\n};\n\n/**\n * The field a Repeater iterates, as a display name — `hero_sections` → \"Hero\n * Sections\".\n *\n * Recovers the subject of a condition whose own binding has collapsed into its\n * value: a repeater-scoped condition's `path` is rewritten to the branch, but the\n * Repeater it sits in still names the field. Used only as a fallback, so a name\n * stamped at author time always wins.\n *\n * De-uid-ified deliberately, unlike a subject read from the condition's own\n * binding. This is the same string the Repeater's own hint renders one row up in\n * Layers (\"Iterates Hero Sections\"), so showing it raw here would make the two\n * disagree about the same field.\n */\nconst getRepeaterFieldName = (node?: Node): string | undefined => {\n if (node?.type !== INTERNAL_COMPONENTS_NAMES.REPEATER) return undefined;\n const binding = (node.props?.items as { binding?: any } | undefined)?.binding;\n const path = getBindingFieldPath(binding);\n const field = path?.split(\".\").pop();\n return field ? uidToDisplayName(field) : undefined;\n};\n"],"names":[],"mappings":";;;;AAiBO,MAAM,gBAAgB,GAAG,CAC9B,iBAAgE,EAChE,MAAY,EACZ,KAAa,EACb,wBAAiC,KAC/B;AACF,IAAA,IAAI,CAAC,wBAAwB;AAAE,QAAA,OAAO,KAAK;IAC3C,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE;AAC5C,QAAA,OAAO,KAAK;IACd;AACA,IAAA,MAAM,OA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;QACE,OAAO,EAAE,oBAAoB,CAC3B,cAAc,CAAC,GAAG,CAAC,KAAK,CAAqB,CAC9C;AACF,KAAA,CACF;IACD,OAAO,IAAI,EAAE,IAAI,KAAK,MAAM,GAAG,CAAA,EAAG,IAAI,CAAC,MAAM,CAAA,CAAA,EAAI,IAAI,CAAC,KAAK,EAAE,GAAG,SAAS;AAC3E,CAAC;AAED;;;;;;;;;;;;;AAaG;AACH,MAAM,oBAAoB,GAAG,CAAC,IAAW,KAAwB;AAC/D,IAAA,IAAI,IAAI,EAAE,IAAI,KAAK,yBAAyB,CAAC,QAAQ;AAAE,QAAA,OAAO,SAAS;IACvE,MAAM,OAAO,GAAI,IAAI,CAAC,KAAK,EAAE,KAAuC,EAAE,OAAO;AAC7E,IAAA,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AACpC,IAAA,OAAO,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,SAAS;AACpD,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/studio-react-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Contains all logic of editing for react based environment",
|
|
5
5
|
"author": "RavenColEvol <ravilamkoti@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/contentstack/composable-studio-sdk#readme",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@contentstack/common-config": "^1.2.
|
|
41
|
+
"@contentstack/common-config": "^1.2.5",
|
|
42
42
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
43
43
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
44
44
|
"@rollup/plugin-terser": "^1.0.0",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"typescript": "^5.2.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@contentstack/studio-client": "^
|
|
62
|
-
"@contentstack/studio-core": "^1.4.
|
|
63
|
-
"@contentstack/studio-internal": "^1.
|
|
64
|
-
"@contentstack/studio-messenger": "^3.
|
|
65
|
-
"@contentstack/studio-react-components": "^
|
|
66
|
-
"@contentstack/studio-registry": "^
|
|
61
|
+
"@contentstack/studio-client": "^4.0.0",
|
|
62
|
+
"@contentstack/studio-core": "^1.4.3",
|
|
63
|
+
"@contentstack/studio-internal": "^1.8.0",
|
|
64
|
+
"@contentstack/studio-messenger": "^3.2.0",
|
|
65
|
+
"@contentstack/studio-react-components": "^2.0.0",
|
|
66
|
+
"@contentstack/studio-registry": "^2.0.0",
|
|
67
67
|
"classnames": "^2.5.1",
|
|
68
68
|
"goober": "^2.1.16",
|
|
69
69
|
"immer": "^10.1.1",
|