@particle-academy/fancy-cms-ui 0.7.0 → 0.7.1

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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/document/types.ts","../src/document/reduce.ts","../src/document/migrate.ts","../src/render/css.ts","../src/react/registry.tsx","../src/react/RenderNode.tsx","../src/react/CmsPage.tsx"],"names":["docChildrenOf","fractionalKey","jsx"],"mappings":";;;;;AAuCO,SAAS,UAAU,CAAA,EAA0B;AAClD,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,MAAM,IAAA,IAAQ,OAAQ,EAAc,KAAA,KAAU,QAAA;AAChF;AAqKO,IAAM,mBAAA,GAA8C;AAAA,EACzD,IAAA,EAAM,CAAA;AAAA,EACN,EAAA,EAAI,GAAA;AAAA,EACJ,EAAA,EAAI;AACN;AAGO,SAAS,QAAA,CAAS,EAAA,EAAY,IAAA,GAAO,GAAA,EAAc;AACxD,EAAA,OAAO;AAAA,IACL,EAAA;AAAA,IACA,GAAA,EAAK,CAAA;AAAA,IACL,MAAM,EAAE,KAAA,EAAO,UAAA,EAAY,IAAA,EAAM,YAAY,QAAA,EAAS;AAAA,IACtD,KAAA,EAAO,EAAE,IAAA,EAAM,SAAA,EAAU;AAAA,IACzB,WAAA,EAAa,CAAC,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IAChC,OAAO;AAAC,GACV;AACF;AC/LO,SAAS,UAAA,CAAW,KAAc,MAAA,EAA+B;AACtE,EAAA,OAAOA,YAAA,CAAoB,KAAK,MAAM,CAAA;AACxC;AAUO,SAAS,QAAQ,GAAA,EAAwB;AAC9C,EAAA,OAAO,UAAA,CAAW,KAAK,IAAI,CAAA,CAAE,IAAI,CAAC,CAAA,KAAM,EAAE,EAAE,CAAA;AAC9C;AAGO,SAAS,WAAW,GAAA,EAA6B;AACtD,EAAA,MAAM,CAAA,GAAI,QAAQ,GAAG,CAAA;AACrB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C,CAAA;AAEpD,EAAA,4BACG,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,IAAA,aAAA,mBAAgBA,IAAC,OAAA,EAAA,EAAM,iBAAA,EAAgB,IAAI,QAAA,EAAA,UAAA,CAAW,GAAG,GAAE,CAAA,GAAW,IAAA;AAAA,IACtE,OAAA,CAAQ,GAAG,CAAA,CAAE,GAAA,CAAI,CAAC,EAAA,qBACjBA,GAAAA,CAAC,UAAA,EAAA,EAAoB,GAAA,EAAU,EAAA,EAAQ,QAAA,EAAoB,IAAA,EAAA,EAA1C,EAAsD,CACxE;AAAA,GAAA,EACH,CAAA;AAEJ","file":"chunk-IWQQINCF.js","sourcesContent":["/**\n * Stages document model — see `fancy-ui/docs/fancy-cms.md` §4.\n *\n * A page is a vertical stack of full-bleed **sections**; inside each, **layers**\n * are positioned by constraints (free + bold stays responsive), with stack/grid\n * containers where structure is wanted. Nodes live in a **flat map** keyed by id\n * (Figma-style) so ops target a stable identity and collab merges stay clean.\n */\n\nimport type { DocNode, DocTree } from \"@particle-academy/fancy-doc-commons\";\n\n/** A node id. Alias of doc-commons' `DocId`, kept for readability in CMS code. */\nexport type NodeId = string;\n\nexport type ScrollMode = \"snap\" | \"smooth\";\n\n/** Ordered, mobile-first. Convention: `\"base\" | \"md\" | \"lg\"`. */\nexport type Breakpoint = string;\n\nexport type Json = string | number | boolean | null | Json[] | { [key: string]: Json };\n\n/** A literal value OR a binding into the page's data context (`{ $bind: \"profile.coins\" }`). */\nexport interface Binding {\n $bind: string;\n /**\n * Which live query this path reads from — `[\"catalog\", \"products\"]`.\n *\n * Optional: a host-supplied static context is still legitimate, and every\n * document saved before this has no `$source`.\n *\n * When present it is the Live Contract's vocabulary — the same\n * `[namespace, resource, …]` shape `fancy-query`'s `liveKey()` produces —\n * NOT a CMS-local name. See `./bindings` for why that matters and for\n * `bindingSources()`, which answers \"what does this page depend on?\".\n */\n $source?: readonly (string | number)[];\n}\nexport type Bound<T> = T | Binding;\n\nexport function isBinding(v: unknown): v is Binding {\n return typeof v === \"object\" && v !== null && typeof (v as Binding).$bind === \"string\";\n}\n\n// ── Sizing ────────────────────────────────────────────────────────────────\n\nexport type LengthUnit = \"px\" | \"%\" | \"vw\" | \"vh\" | \"rem\" | \"fr\";\nexport interface Length {\n value: number;\n unit: LengthUnit;\n}\nexport type SizeMode = Length | \"fill\" | \"hug\";\n\nexport interface Constraints {\n /** Pinned offsets within a `free` parent (null = unpinned). */\n left?: Length | null;\n right?: Length | null;\n top?: Length | null;\n bottom?: Length | null;\n centerX?: boolean;\n centerY?: boolean;\n width: SizeMode;\n height: SizeMode;\n}\n\nexport type LayoutMode = \"free\" | \"stack\" | \"grid\";\n\n// ── Style (compiles deterministically to CSS in both emitters) ──────────────\n\nexport interface StyleProps {\n // box\n padding?: Length;\n margin?: Length;\n radius?: Length;\n // color / surface\n background?: string; // color | gradient | url(...)\n color?: string;\n opacity?: number;\n // typography\n fontFamily?: string;\n fontSize?: Length;\n fontWeight?: number;\n lineHeight?: number;\n textAlign?: \"left\" | \"center\" | \"right\" | \"justify\";\n letterSpacing?: Length;\n // border / shadow / effects (static)\n border?: string;\n boxShadow?: string;\n transform?: string;\n filter?: string;\n // container knobs (when layout = stack | grid)\n gap?: Length;\n direction?: \"row\" | \"column\";\n columns?: number;\n align?: \"start\" | \"center\" | \"end\" | \"stretch\";\n justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\n}\n\n/** Per-breakpoint overrides; `base` is required, others cascade mobile-first. */\nexport type PerBreakpoint<T> = { base: T } & Partial<Record<Breakpoint, Partial<T>>>;\n\n// ── Animation (typed for Phase 2; ignored by the static CSS emitter) ────────\n\nexport type AnimDriver = \"enter\" | \"scroll\" | \"loop\" | \"hover\" | \"click\" | \"drag\";\nexport interface Keyframe {\n at: number; // 0..1\n props: Record<string, number | string>;\n}\nexport interface Anim {\n id: string;\n driver: AnimDriver;\n keyframes: Keyframe[];\n range?: { start: number; end: number };\n ease?: string;\n duration?: number;\n delay?: number;\n stagger?: number;\n once?: boolean;\n emit?: \"css\" | \"js\";\n}\n\n// ── Actions (typed for Phase 3/4) ───────────────────────────────────────────\n\nexport type ActionEvent = \"click\" | \"submit\" | \"change\" | \"load\" | \"timer\" | \"scroll-into\" | \"hover\";\nexport type ActionHandler =\n | { kind: \"navigate\"; href: Bound<string> }\n | { kind: \"submitForm\"; endpoint: string; method?: \"post\" | \"put\" }\n | { kind: \"mutate\"; target: string; value: Bound<Json> }\n | { kind: \"callEndpoint\"; endpoint: string; method?: string }\n | { kind: \"runFlow\"; flow: string }\n | { kind: \"openModal\"; node: NodeId }\n | { kind: \"openDrawer\"; node: NodeId }\n | { kind: \"playTimeline\"; section: NodeId }\n | { kind: \"toggleNode\"; node: NodeId };\nexport interface Action {\n on: ActionEvent;\n do: ActionHandler;\n}\n\n// ── Nodes & document ────────────────────────────────────────────────────────\n\n/**\n * A page node.\n *\n * Extends {@link DocNode} from `fancy-doc-commons` rather than redeclaring it:\n * id / type / parent / order / props are the shared substrate every Fancy\n * document surface uses, and the CMS adds its own domain fields on top. That\n * is what lets `registerDocBridge` drive a CMS page and a fancy-screens screen\n * through the same tools, with no CMS-specific bridge.\n */\nexport interface Node extends DocNode<Record<string, Bound<Json>>> {\n /** Addon key: `section | text | image | shape | stack | grid | frame | <addon>`. */\n type: string;\n /** How this node arranges its children. */\n layout?: LayoutMode;\n /** How this node positions itself within its parent. */\n constraints?: PerBreakpoint<Constraints>;\n style: PerBreakpoint<StyleProps>;\n animations?: Anim[];\n actions?: Action[];\n /** Repeater: render this node once per item of a bound array. */\n repeat?: { each: Binding; as: string };\n /**\n * Host CSS class(es) applied to the node's element. The migration enabler:\n * reuse the host site's existing stylesheet for pixel-perfect reproduction\n * instead of re-deriving every rule through {@link StyleProps}.\n */\n className?: string;\n /** Derived from the addon manifest — interactive/3rd-party ⇒ hydration island. */\n island?: boolean;\n}\n\nexport interface ThemeTokens {\n name?: string;\n [key: string]: Json | undefined;\n}\n\nexport interface PageMeta {\n title: string;\n slug: string;\n scrollMode: ScrollMode;\n seo?: Record<string, string>;\n}\n\nexport interface PageDoc {\n id: string;\n /** Op counter — collab ordering + revision checkpoints. */\n seq: number;\n meta: PageMeta;\n theme: ThemeTokens;\n /** Ordered, mobile-first. */\n breakpoints: Breakpoint[];\n /**\n * Flat map — not a nested tree. This is a {@link DocTree}, so every\n * doc-commons walk (`childrenOf`, `roots`, `descendantsOf`) works on it\n * directly.\n *\n * There is no separate `sections[]` any more. Top-level order used to live in\n * its own array while every other level used fractional `order` keys, which\n * meant two ordering mechanisms that could disagree — a node could be a root\n * by `parent === null` and absent from `sections`, and then simply not\n * render. Roots are now ordered exactly like any other sibling group.\n */\n nodes: Record<NodeId, Node>;\n}\n\n/** Default breakpoint → min-width (px) map. `base` has no media query. */\nexport const DEFAULT_BREAKPOINTS: Record<string, number> = {\n base: 0,\n md: 768,\n lg: 1024,\n};\n\n/** A minimal empty document. */\nexport function emptyDoc(id: string, slug = \"/\"): PageDoc {\n return {\n id,\n seq: 0,\n meta: { title: \"Untitled\", slug, scrollMode: \"smooth\" },\n theme: { name: \"default\" },\n breakpoints: [\"base\", \"md\", \"lg\"],\n nodes: {},\n };\n}\n","/**\n * The pure, total reducer. `reduce(doc, op)` returns a new document; an invalid\n * op is a **logged no-op** (returns the same doc, `seq` unchanged). That single\n * property is what makes undo, revisions, collaboration, and agent edits all\n * flow through one spine.\n *\n * Ordering: EVERY level uses the fractional `order` field among siblings,\n * including the roots. Top-level order used to live in a separate `sections`\n * array, which meant two mechanisms that could disagree — a node could be a\n * root by `parent === null` and missing from `sections`, and then simply not\n * render, with nothing reporting it.\n */\nimport {\n childrenOf as docChildrenOf,\n descendantsOf,\n fractionalKey,\n} from \"@particle-academy/fancy-doc-commons\";\nimport type { Action, Node, NodeId, PageDoc, StyleProps } from \"./types\";\nimport type { PageOp } from \"./ops\";\n\nexport interface ReduceOptions {\n /** Called when an op can't apply. Default: silent. */\n onInvalid?: (op: PageOp, reason: string) => void;\n}\n\n/**\n * Children of a node (or the roots when `parent` is null), in order.\n *\n * Delegates to doc-commons so the CMS, fancy-screens and any future surface\n * walk a document the same way. Roots are no longer a special case.\n */\nexport function childrenOf(doc: PageDoc, parent: NodeId | null): Node[] {\n return docChildrenOf<Node>(doc, parent);\n}\n\n/**\n * The top-level node ids, in order.\n *\n * Replaces the old `doc.sections` array. Kept as a named helper because the two\n * things callers actually wanted from that array — \"list the roots\" and \"the\n * last root\" — read badly as `childrenOf(doc, null).map(n => n.id)` at every\n * call site.\n */\nexport function rootIds(doc: PageDoc): NodeId[] {\n return childrenOf(doc, null).map((n) => n.id);\n}\n\n/** The last top-level node, or null — the default parent for a new insert. */\nexport function lastRootId(doc: PageDoc): NodeId | null {\n const r = rootIds(doc);\n return r[r.length - 1] ?? null;\n}\n\n/** Every transitive descendant id of `id` (excludes `id`). */\nexport function descendantIds(doc: PageDoc, id: NodeId): NodeId[] {\n return descendantsOf<Node>(doc, id);\n}\n\nfunction patchNode(doc: PageDoc, id: NodeId, patch: Partial<Node>): PageDoc {\n const node = doc.nodes[id]!;\n return {\n ...doc,\n nodes: { ...doc.nodes, [id]: { ...node, ...patch } },\n seq: doc.seq + 1,\n };\n}\n\nexport function reduce(doc: PageDoc, op: PageOp, opts: ReduceOptions = {}): PageDoc {\n const invalid = (reason: string): PageDoc => {\n opts.onInvalid?.(op, reason);\n return doc;\n };\n\n switch (op.t) {\n case \"insert_node\": {\n if (doc.nodes[op.node.id]) return invalid(\"node id already exists\");\n if (op.node.parent !== null && !doc.nodes[op.node.parent]) return invalid(\"parent not found\");\n return {\n ...doc,\n nodes: { ...doc.nodes, [op.node.id]: op.node },\n seq: doc.seq + 1,\n };\n }\n\n case \"remove_node\": {\n if (!doc.nodes[op.id]) return invalid(\"node not found\");\n const dead = new Set<NodeId>([op.id, ...descendantIds(doc, op.id)]);\n const nodes: Record<NodeId, Node> = {};\n for (const id of Object.keys(doc.nodes)) {\n if (!dead.has(id)) nodes[id] = doc.nodes[id]!;\n }\n return {\n ...doc,\n nodes,\n seq: doc.seq + 1,\n };\n }\n\n case \"move_node\": {\n const node = doc.nodes[op.id];\n if (!node) return invalid(\"node not found\");\n if (op.parent === op.id) return invalid(\"cannot parent a node to itself\");\n if (op.parent !== null && !doc.nodes[op.parent]) return invalid(\"new parent not found\");\n if (op.parent !== null && descendantIds(doc, op.id).includes(op.parent)) {\n return invalid(\"move would create a cycle\");\n }\n return {\n ...doc,\n nodes: { ...doc.nodes, [op.id]: { ...node, parent: op.parent, order: op.order } },\n seq: doc.seq + 1,\n };\n }\n\n case \"set_node_props\": {\n if (!doc.nodes[op.id]) return invalid(\"node not found\");\n return patchNode(doc, op.id, {\n props: { ...doc.nodes[op.id]!.props, ...op.patch } as unknown as Node[\"props\"],\n });\n }\n\n case \"set_layout\": {\n if (!doc.nodes[op.id]) return invalid(\"node not found\");\n return patchNode(doc, op.id, { layout: op.layout });\n }\n\n case \"set_style\": {\n const node = doc.nodes[op.id];\n if (!node) return invalid(\"node not found\");\n const prev = node.style[op.breakpoint] ?? {};\n return patchNode(doc, op.id, {\n style: { ...node.style, [op.breakpoint]: { ...prev, ...op.patch } } as Node[\"style\"],\n });\n }\n\n case \"set_constraints\": {\n const node = doc.nodes[op.id];\n if (!node) return invalid(\"node not found\");\n const base = node.constraints ?? { base: { width: \"hug\", height: \"hug\" } };\n const prev = base[op.breakpoint] ?? {};\n return patchNode(doc, op.id, {\n constraints: { ...base, [op.breakpoint]: { ...prev, ...op.patch } } as Node[\"constraints\"],\n });\n }\n\n case \"set_animation\": {\n const node = doc.nodes[op.id];\n if (!node) return invalid(\"node not found\");\n const list = node.animations ?? [];\n const idx = list.findIndex((a) => a.id === op.anim.id);\n return patchNode(doc, op.id, {\n animations: idx >= 0 ? list.map((a, i) => (i === idx ? op.anim : a)) : [...list, op.anim],\n });\n }\n\n case \"remove_animation\": {\n const node = doc.nodes[op.id];\n if (!node) return invalid(\"node not found\");\n return patchNode(doc, op.id, {\n animations: (node.animations ?? []).filter((a) => a.id !== op.animId),\n });\n }\n\n case \"set_action\": {\n const node = doc.nodes[op.id];\n if (!node) return invalid(\"node not found\");\n const list = node.actions ?? [];\n let actions: Action[];\n if (op.action === null) actions = list.filter((_, i) => i !== op.index);\n else if (op.index >= list.length) actions = [...list, op.action];\n else actions = list.map((a, i) => (i === op.index ? op.action! : a));\n return patchNode(doc, op.id, { actions });\n }\n\n case \"set_meta\":\n return { ...doc, meta: { ...doc.meta, ...op.patch }, seq: doc.seq + 1 };\n\n case \"set_theme\":\n return { ...doc, theme: { ...doc.theme, ...op.patch }, seq: doc.seq + 1 };\n\n case \"reorder_roots\": {\n // Roots are ordered by their own fractional keys now, so a reorder\n // REWRITES those keys rather than replacing a list. Still validated as a\n // permutation: a partial list would silently drop roots out of the page.\n const currentRoots = childrenOf(doc, null);\n const current = new Set(currentRoots.map((n) => n.id));\n const same =\n op.order.length === currentRoots.length && op.order.every((id) => current.has(id));\n if (!same) return invalid(\"reorder must be a permutation of the current roots\");\n\n const nodes = { ...doc.nodes };\n let prev: string | null = null;\n for (const id of op.order) {\n prev = fractionalKey(prev, null);\n nodes[id] = { ...nodes[id]!, order: prev };\n }\n return { ...doc, nodes, seq: doc.seq + 1 };\n }\n\n default:\n return invalid(`unknown op \"${(op as PageOp).t}\"`);\n }\n}\n\n/** Apply a sequence of ops, threading the document. */\nexport function reduceAll(doc: PageDoc, ops: PageOp[], opts?: ReduceOptions): PageDoc {\n return ops.reduce((d, op) => reduce(d, op, opts), doc);\n}\n\n/**\n * Inverse op(s) for undo, computed against the **pre-op** document. Structural\n * ops invert cleanly; merge-style ops (`set_props`/`set_style`/`set_constraints`)\n * restore the previous values of the touched keys (keys that did not previously\n * exist can't be deleted via a merge — a known Phase-0 limitation).\n */\nexport function invert(doc: PageDoc, op: PageOp): PageOp[] {\n switch (op.t) {\n case \"insert_node\":\n return [{ t: \"remove_node\", id: op.node.id }];\n\n case \"remove_node\": {\n const node = doc.nodes[op.id];\n if (!node) return [];\n // Re-insert the subtree parent-first, then restore section order.\n const ids = [op.id, ...descendantIds(doc, op.id)];\n const inserts: PageOp[] = ids.map((id) => ({ t: \"insert_node\", node: doc.nodes[id]! }));\n if (node.parent === null) {\n inserts.push({ t: \"reorder_roots\", order: childrenOf(doc, null).map((n) => n.id) });\n }\n return inserts;\n }\n\n case \"move_node\": {\n const node = doc.nodes[op.id];\n if (!node) return [];\n const back: PageOp[] = [{ t: \"move_node\", id: op.id, parent: node.parent, order: node.order }];\n if (node.parent === null) {\n back.push({ t: \"reorder_roots\", order: childrenOf(doc, null).map((n) => n.id) });\n }\n return back;\n }\n\n case \"set_node_props\": {\n const node = doc.nodes[op.id];\n if (!node) return [];\n const prev: Record<string, unknown> = {};\n for (const k of Object.keys(op.patch)) prev[k] = node.props[k];\n return [{ t: \"set_node_props\", id: op.id, patch: prev }];\n }\n\n case \"set_layout\": {\n const node = doc.nodes[op.id];\n if (!node) return [];\n return [{ t: \"set_layout\", id: op.id, layout: node.layout }];\n }\n\n case \"set_style\": {\n const node = doc.nodes[op.id];\n if (!node) return [];\n const prevBp = (node.style[op.breakpoint] ?? {}) as Record<string, unknown>;\n const prev: Partial<StyleProps> = {};\n for (const k of Object.keys(op.patch)) (prev as Record<string, unknown>)[k] = prevBp[k];\n return [{ t: \"set_style\", id: op.id, breakpoint: op.breakpoint, patch: prev }];\n }\n\n case \"set_meta\":\n return [{ t: \"set_meta\", patch: pick(doc.meta, Object.keys(op.patch)) }];\n\n case \"set_theme\":\n return [{ t: \"set_theme\", patch: pick(doc.theme, Object.keys(op.patch)) }];\n\n case \"reorder_roots\":\n return [{ t: \"reorder_roots\", order: childrenOf(doc, null).map((n) => n.id) }];\n\n default:\n return [];\n }\n}\n\nfunction pick<T extends object>(obj: T, keys: string[]): Partial<T> {\n const out: Partial<T> = {};\n for (const k of keys) (out as Record<string, unknown>)[k] = (obj as Record<string, unknown>)[k];\n return out;\n}\n","/**\n * Forward migration for documents saved before roots were ordered like every\n * other sibling group.\n *\n * ## Why this cannot be skipped\n *\n * The old model carried top-level order TWICE: a `sections: NodeId[]` array, and\n * an `order` key on every node like any other sibling. The old `reorder_sections`\n * op permuted the array and **left the order keys untouched** — so the moment a\n * user dragged a section, the two disagreed, and `sections[]` was the one that\n * won (it was what the renderer walked).\n *\n * Which means: dropping `sections[]` and falling back to the order keys does not\n * merely lose a redundant field. On every page whose sections were ever\n * rearranged, it silently reverts them to the order they were first created in.\n * The page still loads, nothing throws, and the layout is wrong.\n *\n * So the migration rewrites root `order` keys to agree with `sections[]` before\n * the array is discarded. `sections[]` is treated as authoritative for exactly\n * the reason above.\n *\n * ## Idempotent, and safe on already-migrated documents\n *\n * A doc with no `sections` is returned unchanged (same reference). Running this\n * twice is a no-op, so a host can call it unconditionally on load rather than\n * tracking a schema version.\n */\n\nimport { fractionalKey } from \"@particle-academy/fancy-doc-commons\";\nimport type { NodeId, PageDoc } from \"./types\";\n\n/** A `PageDoc` as persisted before this change — with the extra array. */\nexport type LegacyPageDoc = PageDoc & { sections?: NodeId[] };\n\nexport interface MigrateResult {\n doc: PageDoc;\n /** True when the input actually carried `sections[]` and was rewritten. */\n migrated: boolean;\n /**\n * Ids listed in `sections[]` with no matching node. Skipped rather than\n * faulted — a dangling id is a stale write, and refusing to open the document\n * over it would be a worse outcome than dropping it.\n */\n danglingIds: NodeId[];\n /**\n * Roots present in `nodes` but missing from `sections[]`. Under the old model\n * these did not render at all. They are appended after the listed sections, in\n * their existing order-key order, because making a node visible is recoverable\n * and deleting one is not.\n */\n unlistedRootIds: NodeId[];\n}\n\n/**\n * Migrate a possibly-legacy document, reporting what was found.\n *\n * Use {@link migrateDoc} unless you want the diagnostics.\n */\nexport function migrateDocVerbose(input: LegacyPageDoc | PageDoc): MigrateResult {\n const legacy = input as LegacyPageDoc;\n const sections = legacy.sections;\n\n if (!Array.isArray(sections)) {\n return { doc: input as PageDoc, migrated: false, danglingIds: [], unlistedRootIds: [] };\n }\n\n const danglingIds: NodeId[] = [];\n const ordered: NodeId[] = [];\n const seen = new Set<NodeId>();\n\n for (const id of sections) {\n if (!input.nodes[id]) {\n danglingIds.push(id);\n continue;\n }\n // A duplicate id in the array would otherwise be minted two order keys, and\n // the second would overwrite the first — take the first occurrence.\n if (seen.has(id)) continue;\n seen.add(id);\n ordered.push(id);\n }\n\n // Roots that the array never mentioned. Sorted by their existing key so their\n // relative order is at least stable rather than dependent on object insertion.\n const unlistedRootIds = Object.values(input.nodes)\n .filter((n) => n.parent === null && !seen.has(n.id))\n .sort((a, b) => (a.order < b.order ? -1 : a.order > b.order ? 1 : 0))\n .map((n) => n.id);\n\n const finalOrder = [...ordered, ...unlistedRootIds];\n\n const nodes = { ...input.nodes };\n let prev: string | null = null;\n\n for (const id of finalOrder) {\n const key = fractionalKey(prev, null);\n nodes[id] = { ...nodes[id]!, order: key };\n prev = key;\n }\n\n const { sections: _dropped, ...rest } = legacy;\n\n return {\n doc: { ...rest, nodes } as PageDoc,\n migrated: true,\n danglingIds,\n unlistedRootIds,\n };\n}\n\n/**\n * Migrate a possibly-legacy document. Safe to call on every load — an\n * already-migrated document is returned unchanged, by reference.\n */\nexport function migrateDoc(input: LegacyPageDoc | PageDoc): PageDoc {\n return migrateDocVerbose(input).doc;\n}\n\n/** True when the document still carries the pre-migration `sections[]` array. */\nexport function needsMigration(input: LegacyPageDoc | PageDoc): boolean {\n return Array.isArray((input as LegacyPageDoc).sections);\n}\n","/**\n * The JS style → CSS emitter (one half of the dual-emitter pair; the PHP\n * `particle-academy/fancy-cms` mirrors it byte-for-byte). Output is\n * **deterministic**: declarations are sorted, selectors and media blocks use a\n * fixed format, and nodes are emitted in sorted-id order — so the parity harness\n * can diff the two engines' CSS exactly.\n *\n * Phase 0 covers the static subset (layout / constraints / style). Motion lands\n * in Phase 2.\n */\nimport {\n DEFAULT_BREAKPOINTS,\n type Constraints,\n type Length,\n type Node,\n type PageDoc,\n type SizeMode,\n type StyleProps,\n} from \"../document/types\";\n\nconst selectorFor = (id: string): string => `[data-cms=\"${id}\"]`;\n\nfunction lengthToCss(len: Length): string {\n return `${len.value}${len.unit}`;\n}\n\nfunction sizeToCss(size: SizeMode): string {\n if (size === \"fill\") return \"100%\";\n if (size === \"hug\") return \"auto\";\n return lengthToCss(size);\n}\n\nconst ALIGN: Record<string, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n stretch: \"stretch\",\n};\nconst JUSTIFY: Record<string, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n between: \"space-between\",\n around: \"space-around\",\n};\n\n/** Map StyleProps → CSS declarations (property → value). */\nfunction styleDecls(style: Partial<StyleProps>): Record<string, string> {\n const d: Record<string, string> = {};\n if (style.padding) d[\"padding\"] = lengthToCss(style.padding);\n if (style.margin) d[\"margin\"] = lengthToCss(style.margin);\n if (style.radius) d[\"border-radius\"] = lengthToCss(style.radius);\n if (style.background !== undefined) d[\"background\"] = style.background;\n if (style.color !== undefined) d[\"color\"] = style.color;\n if (style.opacity !== undefined) d[\"opacity\"] = String(style.opacity);\n if (style.fontFamily !== undefined) d[\"font-family\"] = style.fontFamily;\n if (style.fontSize) d[\"font-size\"] = lengthToCss(style.fontSize);\n if (style.fontWeight !== undefined) d[\"font-weight\"] = String(style.fontWeight);\n if (style.lineHeight !== undefined) d[\"line-height\"] = String(style.lineHeight);\n if (style.textAlign !== undefined) d[\"text-align\"] = style.textAlign;\n if (style.letterSpacing) d[\"letter-spacing\"] = lengthToCss(style.letterSpacing);\n if (style.border !== undefined) d[\"border\"] = style.border;\n if (style.boxShadow !== undefined) d[\"box-shadow\"] = style.boxShadow;\n if (style.transform !== undefined) d[\"transform\"] = style.transform;\n if (style.filter !== undefined) d[\"filter\"] = style.filter;\n if (style.gap) d[\"gap\"] = lengthToCss(style.gap);\n if (style.align !== undefined) d[\"align-items\"] = ALIGN[style.align] ?? style.align;\n if (style.justify !== undefined) d[\"justify-content\"] = JUSTIFY[style.justify] ?? style.justify;\n return d;\n}\n\n/** Container behaviour from `node.layout`. */\nfunction layoutDecls(node: Node): Record<string, string> {\n const d: Record<string, string> = {};\n if (node.layout === \"stack\") {\n d[\"display\"] = \"flex\";\n d[\"flex-direction\"] = node.style.base.direction ?? \"column\";\n } else if (node.layout === \"grid\") {\n d[\"display\"] = \"grid\";\n d[\"grid-template-columns\"] = `repeat(${node.style.base.columns ?? 1}, 1fr)`;\n } else if (node.layout === \"free\") {\n d[\"position\"] = \"relative\";\n }\n return d;\n}\n\n/** Self-positioning from constraints (absolute pins only inside a `free` parent). */\nfunction constraintDecls(c: Partial<Constraints>, parentFree: boolean): Record<string, string> {\n const d: Record<string, string> = {};\n const transforms: string[] = [];\n if (parentFree) {\n d[\"position\"] = \"absolute\";\n if (c.left) d[\"left\"] = lengthToCss(c.left);\n if (c.right) d[\"right\"] = lengthToCss(c.right);\n if (c.top) d[\"top\"] = lengthToCss(c.top);\n if (c.bottom) d[\"bottom\"] = lengthToCss(c.bottom);\n if (c.centerX) {\n d[\"left\"] = \"50%\";\n transforms.push(\"translateX(-50%)\");\n }\n if (c.centerY) {\n d[\"top\"] = \"50%\";\n transforms.push(\"translateY(-50%)\");\n }\n if (transforms.length) d[\"transform\"] = transforms.join(\" \");\n }\n if (c.width) d[\"width\"] = sizeToCss(c.width);\n if (c.height) d[\"height\"] = sizeToCss(c.height);\n return d;\n}\n\nfunction isParentFree(doc: PageDoc, node: Node): boolean {\n if (node.parent === null) return false; // sections stack in the page flow\n const parent = doc.nodes[node.parent];\n return !parent || parent.layout === undefined || parent.layout === \"free\";\n}\n\nfunction serializeRule(selector: string, decls: Record<string, string>, indent: string): string {\n const props = Object.keys(decls).sort();\n if (props.length === 0) return \"\";\n const body = props.map((p) => `${indent} ${p}: ${decls[p]};`).join(\"\\n\");\n return `${indent}${selector} {\\n${body}\\n${indent}}`;\n}\n\n/** Emit the full stylesheet for a document. Deterministic. */\nexport function emitDocCss(doc: PageDoc): string {\n const breakpointPx = DEFAULT_BREAKPOINTS;\n const blocks: string[] = [];\n\n for (const id of Object.keys(doc.nodes).sort()) {\n const node = doc.nodes[id]!;\n const selector = selectorFor(id);\n const parentFree = isParentFree(doc, node);\n\n // base = style.base + layout + constraints.base\n const base: Record<string, string> = {\n ...layoutDecls(node),\n ...(node.constraints ? constraintDecls(node.constraints.base, parentFree) : {}),\n ...styleDecls(node.style.base),\n };\n const baseRule = serializeRule(selector, base, \"\");\n if (baseRule) blocks.push(baseRule);\n\n // per-breakpoint overrides (mobile-first, in doc order, skipping base)\n for (const bp of doc.breakpoints) {\n if (bp === \"base\") continue;\n const px = breakpointPx[bp];\n if (px === undefined) continue;\n const decls: Record<string, string> = {\n ...(node.constraints?.[bp] ? constraintDecls(node.constraints[bp]!, parentFree) : {}),\n ...(node.style[bp] ? styleDecls(node.style[bp]!) : {}),\n };\n const inner = serializeRule(selector, decls, \" \");\n if (inner) blocks.push(`@media (min-width: ${px}px) {\\n${inner}\\n}`);\n }\n }\n\n return blocks.join(\"\\n\\n\") + (blocks.length ? \"\\n\" : \"\");\n}\n","import type { ReactNode } from \"react\";\nimport { isBinding, type Bound, type Json, type Node, type PageDoc } from \"../document/types\";\n\n/** The page data context bindings resolve against (e.g. server props, repeater `item`). */\nexport type DataContext = Record<string, unknown>;\n\nexport interface ElementContext {\n node: Node;\n doc: PageDoc;\n /** Pre-rendered child nodes, in order. */\n children: ReactNode;\n /** The data context this node renders in (page data + any repeater scope). */\n data?: DataContext;\n /** Resolve a (possibly bound) value to its raw resolved value. */\n resolve: (v: Bound<Json> | undefined) => unknown;\n /** Resolve a (possibly bound) value to a display string. */\n text: (v: Bound<Json> | undefined) => string;\n}\n\n/**\n * Renders the INNER content of a node. The outer `[data-cms]` wrapper is added\n * by {@link RenderNode}, so a renderer only returns what goes inside.\n */\nexport type ElementRenderer = (ctx: ElementContext) => ReactNode;\n\nexport type ElementRegistry = Record<string, ElementRenderer>;\n\n/** Read a dotted path (`a.b.c`) out of the data context. */\nexport function getPath(data: DataContext | undefined, path: string): unknown {\n return path.split(\".\").reduce<unknown>((o, k) => (o == null ? undefined : (o as Record<string, unknown>)[k]), data);\n}\n\n/** Resolve a value: a `{ $bind }` reads from the data context; anything else is literal. */\nexport function resolveValue(v: Bound<Json> | undefined, data?: DataContext): unknown {\n if (v === undefined || v === null) return v;\n if (isBinding(v)) return getPath(data, v.$bind);\n return v;\n}\n\n/** Built-in native elements. Containers render their children; leaves render content. */\nexport const defaultRegistry: ElementRegistry = {\n section: ({ children }) => children,\n stack: ({ children }) => children,\n grid: ({ children }) => children,\n frame: ({ children }) => children,\n shape: ({ children }) => children,\n card: ({ children }) => children,\n text: ({ node, text }) => text(node.props.content),\n heading: ({ node, text }) => text(node.props.content) || \"Heading\",\n // Rich text — inline-formatted HTML (gradient spans, links, <code>, …) that\n // plain `text` can't express. The author owns the markup (it's their content).\n richtext: ({ node, text }) => <div dangerouslySetInnerHTML={{ __html: text(node.props.html) }} />,\n link: ({ node, text }) => (\n <a href={text(node.props.href) || \"#\"} style={{ color: \"inherit\", textDecoration: \"underline\" }}>\n {text(node.props.content) || \"link\"}\n </a>\n ),\n divider: () => <hr style={{ border: \"none\", borderTop: \"1px solid #e2e8f0\", margin: 0 }} />,\n callout: ({ node, text }) => {\n const tone = ({ info: \"#3b82f6\", success: \"#10b981\", warning: \"#f59e0b\", danger: \"#ef4444\" } as Record<string, string>)[text(node.props.variant)] ?? \"#3b82f6\";\n return (\n <div style={{ display: \"flex\", gap: 10, padding: \"12px 14px\", borderRadius: 10, background: `${tone}14`, borderLeft: `3px solid ${tone}` }}>\n <span style={{ fontSize: 13 }}>{text(node.props.content) || \"Callout\"}</span>\n </div>\n );\n },\n code: ({ node, text }) => (\n <pre style={{ margin: 0, padding: \"12px 14px\", borderRadius: 10, background: \"#0b1220\", color: \"#e2e8f0\", fontFamily: \"ui-monospace, monospace\", fontSize: 13, overflowX: \"auto\" }}>\n <code>{text(node.props.content)}</code>\n </pre>\n ),\n button: ({ node, text }) => {\n const label = text(node.props.label) || text(node.props.content) || \"Button\";\n const variant = text(node.props.variant) || \"primary\";\n return <span data-cms-button={variant} style={buttonStyle(variant)}>{label}</span>;\n },\n image: ({ node, text }) => (\n <img\n src={text(node.props.src)}\n alt={text(node.props.alt)}\n style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\", display: \"block\" }}\n />\n ),\n};\n\n/**\n * A self-contained button look so the `button` primitive renders sensibly with\n * zero host CSS. Hosts that want their own button classes override the `button`\n * renderer in their registry (e.g. the sandbox maps it to `.btn .btn-primary`).\n */\nfunction buttonStyle(variant: string): import(\"react\").CSSProperties {\n const base: import(\"react\").CSSProperties = {\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 6,\n padding: \"9px 16px\",\n borderRadius: 8,\n fontWeight: 600,\n fontSize: 14,\n lineHeight: 1,\n cursor: \"pointer\",\n userSelect: \"none\",\n };\n if (variant === \"ghost\") return { ...base, background: \"transparent\", color: \"inherit\", border: \"1px solid currentColor\" };\n if (variant === \"outline\") return { ...base, background: \"transparent\", color: \"#7c3aed\", border: \"1px solid #7c3aed\" };\n return { ...base, background: \"#7c3aed\", color: \"#fff\", border: \"1px solid #7c3aed\" };\n}\n","import type { ReactElement } from \"react\";\nimport type { Bound, Json, PageDoc } from \"../document/types\";\nimport { childrenOf } from \"../document/reduce\";\nimport { defaultRegistry, resolveValue, type DataContext, type ElementRegistry } from \"./registry\";\n\nexport interface RenderNodeProps {\n doc: PageDoc;\n id: string;\n registry?: ElementRegistry;\n /** Data context bindings resolve against (page data + any repeater scope). */\n data?: DataContext;\n}\n\n/**\n * Render one node (and its subtree) to a `[data-cms]`-tagged element. The CSS\n * emitted by `emitDocCss` targets these `data-cms` handles. Interactive /\n * 3rd-party **islands** with no registered renderer become an empty, sized\n * placeholder the host hydrates client-side — mirroring the PHP renderer.\n *\n * `repeater` nodes are special-cased: their first child is a template rendered\n * once per item of the bound `items` array, each in a scope that exposes `item`\n * and `index` to nested `{ $bind: \"item.…\" }` bindings.\n */\nexport function RenderNode({ doc, id, registry = defaultRegistry, data }: RenderNodeProps): ReactElement | null {\n const node = doc.nodes[id];\n if (!node) return null;\n\n if (node.type === \"repeater\") {\n const arr = resolveValue(node.props.items as Bound<Json> | undefined, data);\n const items = Array.isArray(arr) ? arr : [];\n const template = childrenOf(doc, id)[0];\n return (\n <div data-cms={node.id} className={node.className}>\n {template\n ? items.map((item, index) => (\n <RenderNode key={index} doc={doc} id={template.id} registry={registry} data={{ ...data, item, index }} />\n ))\n : null}\n </div>\n );\n }\n\n const kids = childrenOf(doc, id).map((child) => (\n <RenderNode key={child.id} doc={doc} id={child.id} registry={registry} data={data} />\n ));\n\n const resolve = (v: Bound<Json> | undefined) => resolveValue(v, data);\n const text = (v: Bound<Json> | undefined): string => {\n const r = resolve(v);\n return r === undefined || r === null ? \"\" : String(r);\n };\n\n const renderer = registry[node.type];\n const inner = renderer ? renderer({ node, doc, children: kids, data, resolve, text }) : node.island ? null : kids;\n\n return (\n <div data-cms={node.id} data-cms-island={node.island ? node.type : undefined} className={node.className}>\n {inner}\n </div>\n );\n}\n","import { Fragment, useMemo, type ReactElement } from \"react\";\nimport type { PageDoc } from \"../document/types\";\nimport { rootIds } from \"../document/reduce\";\nimport { migrateDoc, type LegacyPageDoc } from \"../document/migrate\";\nimport { emitDocCss } from \"../render/css\";\nimport { RenderNode } from \"./RenderNode\";\nimport { defaultRegistry, type DataContext, type ElementRegistry } from \"./registry\";\n\nexport interface CmsPageProps {\n doc: LegacyPageDoc | PageDoc;\n registry?: ElementRegistry;\n /** Data context that `{ $bind: \"…\" }` props + repeaters resolve against. */\n data?: DataContext;\n /** Inject the compiled stylesheet. Set false when the host emits CSS itself. */\n includeStyles?: boolean;\n}\n\n/** Render a full page document: the compiled stylesheet + every section. */\nexport function CmsPage({\n doc: input,\n registry = defaultRegistry,\n data,\n includeStyles = true,\n}: CmsPageProps): ReactElement {\n // Renders a pre-`sections[]` document correctly rather than in whatever order\n // its stale order keys happen to imply. The check is an `Array.isArray`, and\n // an already-migrated document comes back by reference, so the memo costs a\n // migrated host nothing.\n const doc = useMemo(() => migrateDoc(input), [input]);\n\n return (\n <Fragment>\n {includeStyles ? <style data-cms-styles=\"\">{emitDocCss(doc)}</style> : null}\n {rootIds(doc).map((id: string) => (\n <RenderNode key={id} doc={doc} id={id} registry={registry} data={data} />\n ))}\n </Fragment>\n );\n}\n"]}