@particle-academy/fancy-cms-ui 0.0.1-dev.9 → 0.1.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.
@@ -0,0 +1,162 @@
1
+ import { ReactElement } from 'react';
2
+ import { N as Node, l as NodeId, L as LayoutMode, f as Breakpoint, p as StyleProps, C as Constraints, c as Anim, A as Action, m as PageMeta, T as ThemeTokens, P as PageDoc } from './registry-D5y5IgCR.js';
3
+
4
+ /**
5
+ * `PageOp` — the closed set of mutations. Every edit (human drag, agent tool
6
+ * call, collab message) is one of these, reduced by the pure `reduce` in
7
+ * `reduce.ts`. See `fancy-ui/docs/fancy-cms.md` §4.
8
+ */
9
+
10
+ type Actor = {
11
+ kind: "human" | "agent";
12
+ id: string;
13
+ };
14
+ type PageOp = {
15
+ t: "insert_node";
16
+ node: Node;
17
+ } | {
18
+ t: "remove_node";
19
+ id: NodeId;
20
+ } | {
21
+ t: "move_node";
22
+ id: NodeId;
23
+ parent: NodeId | null;
24
+ order: string;
25
+ } | {
26
+ t: "set_props";
27
+ id: NodeId;
28
+ patch: Record<string, unknown>;
29
+ } | {
30
+ t: "set_layout";
31
+ id: NodeId;
32
+ layout: LayoutMode | undefined;
33
+ } | {
34
+ t: "set_style";
35
+ id: NodeId;
36
+ breakpoint: Breakpoint;
37
+ patch: Partial<StyleProps>;
38
+ } | {
39
+ t: "set_constraints";
40
+ id: NodeId;
41
+ breakpoint: Breakpoint;
42
+ patch: Partial<Constraints>;
43
+ } | {
44
+ t: "set_animation";
45
+ id: NodeId;
46
+ anim: Anim;
47
+ } | {
48
+ t: "remove_animation";
49
+ id: NodeId;
50
+ animId: string;
51
+ } | {
52
+ t: "set_action";
53
+ id: NodeId;
54
+ index: number;
55
+ action: Action | null;
56
+ } | {
57
+ t: "set_meta";
58
+ patch: Partial<PageMeta>;
59
+ } | {
60
+ t: "set_theme";
61
+ patch: Partial<ThemeTokens>;
62
+ } | {
63
+ t: "reorder_sections";
64
+ order: NodeId[];
65
+ };
66
+ type PageOpType = PageOp["t"];
67
+ /** Wire envelope — carries provenance + ordering. `pending` = an agent proposal. */
68
+ interface OpEnvelope {
69
+ op: PageOp;
70
+ actor: Actor;
71
+ ts: number;
72
+ seq: number;
73
+ pending?: boolean;
74
+ }
75
+
76
+ interface EditorProps {
77
+ /** Initial document; edits are surfaced via {@link EditorProps.onChange}. */
78
+ defaultValue: PageDoc;
79
+ onChange?: (doc: PageDoc) => void;
80
+ }
81
+ /**
82
+ * The fancy-cms editor: layers · canvas · inspector over the op-spine. Phase 1
83
+ * cut — chrome is plain markup for now; it graduates to react-fancy next.
84
+ */
85
+ declare function Editor({ defaultValue, onChange }: EditorProps): ReactElement;
86
+
87
+ interface CanvasProps {
88
+ doc: PageDoc;
89
+ selection: string | null;
90
+ onSelect: (id: string | null) => void;
91
+ apply: (op: PageOp) => void;
92
+ }
93
+ /**
94
+ * The edit surface: renders the live page and overlays a selection box. Click to
95
+ * select; drag the box to move (px constraints). Phase 1 cut: free-parent
96
+ * move + resize handles, stack/grid reordering, and snapping come next.
97
+ */
98
+ declare function Canvas({ doc, selection, onSelect, apply }: CanvasProps): ReactElement;
99
+
100
+ interface LayersPanelProps {
101
+ doc: PageDoc;
102
+ selection: string | null;
103
+ onSelect: (id: string) => void;
104
+ /** Reparent/reorder a node (drag-to-reorder). Omit to disable dragging. */
105
+ onMove?: (id: NodeId, parent: NodeId | null, order: string) => void;
106
+ }
107
+ /** The section/layer tree. Click a row to select; drag a row onto another to reorder. */
108
+ declare function LayersPanel({ doc, selection, onSelect, onMove }: LayersPanelProps): ReactElement;
109
+
110
+ interface InspectorProps {
111
+ doc: PageDoc;
112
+ selection: string | null;
113
+ apply: (op: PageOp) => void;
114
+ }
115
+ /** Contextual property editor for the selected node. Every change is one op. */
116
+ declare function Inspector({ doc, selection, apply }: InspectorProps): ReactElement;
117
+
118
+ /**
119
+ * Editor state engine — pure and framework-agnostic so it's unit-testable.
120
+ * `useEditor` wraps this with `useReducer`. Undo/redo uses document snapshots
121
+ * (simple + robust); the op-level `invert` in the spine is for collab/op-stream
122
+ * undo.
123
+ */
124
+
125
+ interface EditorState {
126
+ doc: PageDoc;
127
+ past: PageDoc[];
128
+ future: PageDoc[];
129
+ selection: string | null;
130
+ }
131
+ type EditorAction = {
132
+ type: "apply";
133
+ op: PageOp;
134
+ } | {
135
+ type: "undo";
136
+ } | {
137
+ type: "redo";
138
+ } | {
139
+ type: "select";
140
+ id: string | null;
141
+ } | {
142
+ type: "replace";
143
+ doc: PageDoc;
144
+ };
145
+ declare function initEditor(doc: PageDoc): EditorState;
146
+ declare function editorReduce(state: EditorState, action: EditorAction): EditorState;
147
+
148
+ interface EditorApi {
149
+ state: EditorState;
150
+ /** Dispatch a mutation through the op-spine (records an undo snapshot). */
151
+ apply: (op: PageOp) => void;
152
+ undo: () => void;
153
+ redo: () => void;
154
+ select: (id: string | null) => void;
155
+ /** Replace the document wholesale (e.g. a controlled `value` change). */
156
+ replace: (doc: PageDoc) => void;
157
+ canUndo: boolean;
158
+ canRedo: boolean;
159
+ }
160
+ declare function useEditor(initialDoc: PageDoc): EditorApi;
161
+
162
+ export { type Actor as A, Canvas as C, Editor as E, Inspector as I, LayersPanel as L, type OpEnvelope as O, type PageOp as P, type CanvasProps as a, type EditorAction as b, type EditorApi as c, type EditorProps as d, type EditorState as e, type InspectorProps as f, type LayersPanelProps as g, type PageOpType as h, editorReduce as i, initEditor as j, useEditor as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-academy/fancy-cms-ui",
3
- "version": "0.0.1-dev.9",
3
+ "version": "0.1.0",
4
4
  "description": "Editor + isomorphic renderer for fancy-cms — the Stages document model, PageOp op-spine, the JS style→CSS emitter (one half of the dual-emitter pair with the PHP particle-academy/fancy-cms), and the React renderer. Built on the Fancy UI suite.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -75,15 +75,12 @@
75
75
  "react": "^18 || ^19"
76
76
  },
77
77
  "peerDependenciesMeta": {
78
- "react": {
79
- "optional": true
80
- },
81
78
  "@particle-academy/react-fancy": {
82
79
  "optional": true
83
80
  }
84
81
  },
85
82
  "devDependencies": {
86
- "@particle-academy/react-fancy": "^3.5.0",
83
+ "@particle-academy/react-fancy": "^4.10.0",
87
84
  "@types/node": "^20.0.0",
88
85
  "@types/react": "^19.0.0",
89
86
  "@types/react-dom": "^19.0.0",
@@ -99,5 +96,8 @@
99
96
  "publishConfig": {
100
97
  "access": "public"
101
98
  },
102
- "license": "MIT"
99
+ "license": "MIT",
100
+ "overrides": {
101
+ "esbuild": "^0.28.1"
102
+ }
103
103
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/document/types.ts","../src/document/reduce.ts","../src/render/css.ts"],"names":[],"mappings":";AAwBO,SAAS,UAAU,CAAA,EAA0B;AAClD,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,IAAY,MAAM,IAAA,IAAQ,OAAQ,EAAc,KAAA,KAAU,QAAA;AAChF;AA2JO,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,UAAU,EAAC;AAAA,IACX,OAAO;AAAC,GACV;AACF;;;ACpLO,SAAS,UAAA,CAAW,KAAc,MAAA,EAA+B;AACtE,EAAA,IAAI,WAAW,IAAA,EAAM;AACnB,IAAA,OAAO,GAAA,CAAI,QAAA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AAA,CAAA;AACvD","file":"chunk-3YZMELJJ.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\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}\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\nexport interface Node {\n id: NodeId;\n /** Addon key: `section | text | image | shape | stack | grid | frame | <addon>`. */\n type: string;\n /** `null` = a top-level section. */\n parent: NodeId | null;\n /** Fractional index — collab-safe ordering among siblings. */\n order: string;\n /** Addon-specific props; any value may be a {@link Binding}. */\n props: Record<string, Bound<Json>>;\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 /** Top-level section order. */\n sections: NodeId[];\n /** Flat map — not a nested tree. */\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 sections: [],\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: top-level order is the canonical `sections` array; child order is\n * the fractional `order` field among siblings (see `fractional.ts`).\n */\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/** Children of a node (or top-level when `parent` is null), in order. */\nexport function childrenOf(doc: PageDoc, parent: NodeId | null): Node[] {\n if (parent === null) {\n return doc.sections.map((id) => doc.nodes[id]).filter((n): n is Node => Boolean(n));\n }\n const out: Node[] = [];\n for (const id of Object.keys(doc.nodes)) {\n const n = doc.nodes[id]!;\n if (n.parent === parent) out.push(n);\n }\n out.sort((a, b) => (a.order < b.order ? -1 : a.order > b.order ? 1 : 0));\n return out;\n}\n\n/** Every transitive descendant id of `id` (excludes `id`). */\nexport function descendantIds(doc: PageDoc, id: NodeId): NodeId[] {\n const out: NodeId[] = [];\n const stack: NodeId[] = [id];\n while (stack.length) {\n const current = stack.pop()!;\n for (const childId of Object.keys(doc.nodes)) {\n const n = doc.nodes[childId]!;\n if (n.parent === current) {\n out.push(childId);\n stack.push(childId);\n }\n }\n }\n return out;\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 sections: op.node.parent === null ? [...doc.sections, op.node.id] : doc.sections,\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 sections: doc.sections.filter((s) => !dead.has(s)),\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 const wasTop = node.parent === null;\n const nowTop = op.parent === null;\n let sections = doc.sections;\n if (wasTop && !nowTop) sections = sections.filter((s) => s !== op.id);\n else if (!wasTop && nowTop) sections = [...sections, op.id];\n return {\n ...doc,\n nodes: { ...doc.nodes, [op.id]: { ...node, parent: op.parent, order: op.order } },\n sections,\n seq: doc.seq + 1,\n };\n }\n\n case \"set_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_sections\": {\n const current = new Set(doc.sections);\n const same =\n op.order.length === doc.sections.length && op.order.every((id) => current.has(id));\n if (!same) return invalid(\"reorder must be a permutation of current sections\");\n return { ...doc, sections: [...op.order], 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) inserts.push({ t: \"reorder_sections\", order: [...doc.sections] });\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) back.push({ t: \"reorder_sections\", order: [...doc.sections] });\n return back;\n }\n\n case \"set_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_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_sections\":\n return [{ t: \"reorder_sections\", order: [...doc.sections] }];\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 * 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"]}
@@ -1,47 +0,0 @@
1
- // src/document/fractional.ts
2
- var BASE = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
3
- var RADIX = BASE.length;
4
- var MID = Math.floor(RADIX / 2);
5
- function val(c) {
6
- const i = BASE.indexOf(c);
7
- return i < 0 ? 0 : i;
8
- }
9
- function keyBetween(a, b) {
10
- if (a === null) a = "";
11
- if (b === null) {
12
- return a + BASE[MID];
13
- }
14
- if (a >= b) {
15
- throw new Error(`keyBetween: lower bound "${a}" is not below upper bound "${b}"`);
16
- }
17
- let result = "";
18
- let i = 0;
19
- for (; ; ) {
20
- const ca = i < a.length ? val(a[i]) : 0;
21
- const cb = i < b.length ? val(b[i]) : RADIX;
22
- if (cb - ca > 1) {
23
- result += BASE[ca + Math.floor((cb - ca) / 2)];
24
- return result;
25
- }
26
- if (ca === cb) {
27
- result += BASE[ca];
28
- i++;
29
- continue;
30
- }
31
- result += BASE[ca];
32
- i++;
33
- for (; ; ) {
34
- const da = i < a.length ? val(a[i]) : 0;
35
- if (RADIX - da > 1) {
36
- result += BASE[da + Math.floor((RADIX - da) / 2)];
37
- return result;
38
- }
39
- result += BASE[da];
40
- i++;
41
- }
42
- }
43
- }
44
-
45
- export { keyBetween };
46
- //# sourceMappingURL=chunk-7YYLYBLI.js.map
47
- //# sourceMappingURL=chunk-7YYLYBLI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/document/fractional.ts"],"names":[],"mappings":";AAaA,IAAM,IAAA,GAAO,gEAAA;AACb,IAAM,QAAQ,IAAA,CAAK,MAAA;AACnB,IAAM,GAAA,GAAM,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,CAAC,CAAA;AAEhC,SAAS,IAAI,CAAA,EAAmB;AAC9B,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,OAAA,CAAQ,CAAC,CAAA;AACxB,EAAA,OAAO,CAAA,GAAI,IAAI,CAAA,GAAI,CAAA;AACrB;AAOO,SAAS,UAAA,CAAW,GAAkB,CAAA,EAA0B;AACrE,EAAA,IAAI,CAAA,KAAM,MAAM,CAAA,GAAI,EAAA;AACpB,EAAA,IAAI,MAAM,IAAA,EAAM;AAEd,IAAA,OAAO,CAAA,GAAI,KAAK,GAAG,CAAA;AAAA,EACrB;AACA,EAAA,IAAI,KAAK,CAAA,EAAG;AACV,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,yBAAA,EAA4B,CAAC,CAAA,4BAAA,EAA+B,CAAC,CAAA,CAAA,CAAG,CAAA;AAAA,EAClF;AAEA,EAAA,IAAI,MAAA,GAAS,EAAA;AACb,EAAA,IAAI,CAAA,GAAI,CAAA;AAER,EAAA,WAAS;AACP,IAAA,MAAM,EAAA,GAAK,IAAI,CAAA,CAAE,MAAA,GAAS,IAAI,CAAA,CAAE,CAAC,CAAW,CAAA,GAAI,CAAA;AAChD,IAAA,MAAM,EAAA,GAAK,IAAI,CAAA,CAAE,MAAA,GAAS,IAAI,CAAA,CAAE,CAAC,CAAW,CAAA,GAAI,KAAA;AAChD,IAAA,IAAI,EAAA,GAAK,KAAK,CAAA,EAAG;AACf,MAAA,MAAA,IAAU,KAAK,EAAA,GAAK,IAAA,CAAK,OAAO,EAAA,GAAK,EAAA,IAAM,CAAC,CAAC,CAAA;AAC7C,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,IAAI,OAAO,EAAA,EAAI;AACb,MAAA,MAAA,IAAU,KAAK,EAAE,CAAA;AACjB,MAAA,CAAA,EAAA;AACA,MAAA;AAAA,IACF;AAGA,IAAA,MAAA,IAAU,KAAK,EAAE,CAAA;AACjB,IAAA,CAAA,EAAA;AACA,IAAA,WAAS;AACP,MAAA,MAAM,EAAA,GAAK,IAAI,CAAA,CAAE,MAAA,GAAS,IAAI,CAAA,CAAE,CAAC,CAAW,CAAA,GAAI,CAAA;AAChD,MAAA,IAAI,KAAA,GAAQ,KAAK,CAAA,EAAG;AAClB,QAAA,MAAA,IAAU,KAAK,EAAA,GAAK,IAAA,CAAK,OAAO,KAAA,GAAQ,EAAA,IAAM,CAAC,CAAC,CAAA;AAChD,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,MAAA,IAAU,KAAK,EAAE,CAAA;AACjB,MAAA,CAAA,EAAA;AAAA,IACF;AAAA,EACF;AACF","file":"chunk-7YYLYBLI.js","sourcesContent":["/**\n * Minimal collab-safe fractional ordering keys.\n *\n * Sibling `order` is a string over a base-62 alphabet interpreted as a fraction\n * in (0, 1). `keyBetween(a, b)` returns a key that sorts strictly between `a`\n * and `b` (lexicographically), extending precision when the bounds are\n * adjacent. Concurrent inserts at the same spot produce different keys (vary by\n * actor), so reorders never collide.\n *\n * This is intentionally compact for Phase 0. Before live collaboration ships it\n * should be swapped for a hardened implementation with jitter + bucket bounds.\n */\n\nconst BASE = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\nconst RADIX = BASE.length; // 62\nconst MID = Math.floor(RADIX / 2);\n\nfunction val(c: string): number {\n const i = BASE.indexOf(c);\n return i < 0 ? 0 : i;\n}\n\n/**\n * Return a key strictly between `a` and `b`. Pass `null` for an open bound\n * (`keyBetween(null, null)` for the first key, `keyBetween(last, null)` to\n * append, `keyBetween(null, first)` to prepend).\n */\nexport function keyBetween(a: string | null, b: string | null): string {\n if (a === null) a = \"\";\n if (b === null) {\n // Append: a key greater than `a`. Appending a mid digit always sorts after.\n return a + BASE[MID];\n }\n if (a >= b) {\n throw new Error(`keyBetween: lower bound \"${a}\" is not below upper bound \"${b}\"`);\n }\n\n let result = \"\";\n let i = 0;\n // Walk the common prefix, then split at the first differing digit.\n for (;;) {\n const ca = i < a.length ? val(a[i] as string) : 0;\n const cb = i < b.length ? val(b[i] as string) : RADIX;\n if (cb - ca > 1) {\n result += BASE[ca + Math.floor((cb - ca) / 2)];\n return result;\n }\n if (ca === cb) {\n result += BASE[ca];\n i++;\n continue;\n }\n // Adjacent digits (cb - ca === 1): take the lower path, then descend into\n // `a`'s remainder with RADIX as the upper bound until a gap opens.\n result += BASE[ca];\n i++;\n for (;;) {\n const da = i < a.length ? val(a[i] as string) : 0;\n if (RADIX - da > 1) {\n result += BASE[da + Math.floor((RADIX - da) / 2)];\n return result;\n }\n result += BASE[da];\n i++;\n }\n }\n}\n"]}
@@ -1,78 +0,0 @@
1
- import { childrenOf, emitDocCss, isBinding } from './chunk-3YZMELJJ.js';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { Fragment } from 'react';
4
-
5
- function literal(v) {
6
- if (v === void 0 || v === null) return "";
7
- if (isBinding(v)) return "";
8
- return String(v);
9
- }
10
- var defaultRegistry = {
11
- section: ({ children }) => children,
12
- stack: ({ children }) => children,
13
- grid: ({ children }) => children,
14
- frame: ({ children }) => children,
15
- shape: ({ children }) => children,
16
- text: ({ node }) => literal(node.props.content),
17
- heading: ({ node }) => literal(node.props.content) || "Heading",
18
- button: ({ node }) => {
19
- const label = literal(node.props.label) || literal(node.props.content) || "Button";
20
- const variant = literal(node.props.variant) || "primary";
21
- return /* @__PURE__ */ jsx("span", { "data-cms-button": variant, style: buttonStyle(variant), children: label });
22
- },
23
- image: ({ node }) => /* @__PURE__ */ jsx(
24
- "img",
25
- {
26
- src: literal(node.props.src),
27
- alt: literal(node.props.alt),
28
- style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
29
- }
30
- )
31
- };
32
- function buttonStyle(variant) {
33
- const base = {
34
- display: "inline-flex",
35
- alignItems: "center",
36
- gap: 6,
37
- padding: "9px 16px",
38
- borderRadius: 8,
39
- fontWeight: 600,
40
- fontSize: 14,
41
- lineHeight: 1,
42
- cursor: "pointer",
43
- userSelect: "none"
44
- };
45
- if (variant === "ghost") return { ...base, background: "transparent", color: "inherit", border: "1px solid currentColor" };
46
- if (variant === "outline") return { ...base, background: "transparent", color: "#7c3aed", border: "1px solid #7c3aed" };
47
- return { ...base, background: "#7c3aed", color: "#fff", border: "1px solid #7c3aed" };
48
- }
49
- function RenderNode({ doc, id, registry = defaultRegistry }) {
50
- const node = doc.nodes[id];
51
- if (!node) return null;
52
- const kids = childrenOf(doc, id).map((child) => /* @__PURE__ */ jsx(RenderNode, { doc, id: child.id, registry }, child.id));
53
- const renderer = registry[node.type];
54
- const inner = renderer ? renderer({ node, doc, children: kids }) : node.island ? null : kids;
55
- return /* @__PURE__ */ jsx(
56
- "div",
57
- {
58
- "data-cms": node.id,
59
- "data-cms-island": node.island ? node.type : void 0,
60
- className: node.className,
61
- children: inner
62
- }
63
- );
64
- }
65
- function CmsPage({
66
- doc,
67
- registry = defaultRegistry,
68
- includeStyles = true
69
- }) {
70
- return /* @__PURE__ */ jsxs(Fragment, { children: [
71
- includeStyles ? /* @__PURE__ */ jsx("style", { "data-cms-styles": "", children: emitDocCss(doc) }) : null,
72
- doc.sections.map((id) => /* @__PURE__ */ jsx(RenderNode, { doc, id, registry }, id))
73
- ] });
74
- }
75
-
76
- export { CmsPage, RenderNode, defaultRegistry };
77
- //# sourceMappingURL=chunk-ZV7CV54P.js.map
78
- //# sourceMappingURL=chunk-ZV7CV54P.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/registry.tsx","../src/react/RenderNode.tsx","../src/react/CmsPage.tsx"],"names":["jsx"],"mappings":";;;;AAmBA,SAAS,QAAQ,CAAA,EAAoC;AACnD,EAAA,IAAI,CAAA,KAAM,MAAA,IAAa,CAAA,KAAM,IAAA,EAAM,OAAO,EAAA;AAC1C,EAAA,IAAI,SAAA,CAAU,CAAC,CAAA,EAAG,OAAO,EAAA;AACzB,EAAA,OAAO,OAAO,CAAC,CAAA;AACjB;AAGO,IAAM,eAAA,GAAmC;AAAA,EAC9C,OAAA,EAAS,CAAC,EAAE,QAAA,EAAS,KAAM,QAAA;AAAA,EAC3B,KAAA,EAAO,CAAC,EAAE,QAAA,EAAS,KAAM,QAAA;AAAA,EACzB,IAAA,EAAM,CAAC,EAAE,QAAA,EAAS,KAAM,QAAA;AAAA,EACxB,KAAA,EAAO,CAAC,EAAE,QAAA,EAAS,KAAM,QAAA;AAAA,EACzB,KAAA,EAAO,CAAC,EAAE,QAAA,EAAS,KAAM,QAAA;AAAA,EACzB,IAAA,EAAM,CAAC,EAAE,IAAA,OAAW,OAAA,CAAQ,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,EAC9C,OAAA,EAAS,CAAC,EAAE,IAAA,OAAW,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,OAAO,CAAA,IAAK,SAAA;AAAA,EACtD,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAK,KAAM;AACpB,IAAA,MAAM,KAAA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AAAA,EACX,aAAA,GAAgB;AAClB,CAAA,EAA+B;AAC7B,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,GAAA,CAAI,QAAA,CAAS,GAAA,CAAI,CAAC,EAAA,qBACjBA,GAAAA,CAAC,UAAA,EAAA,EAAoB,GAAA,EAAU,EAAA,EAAQ,QAAA,EAAA,EAAtB,EAA0C,CAC5D;AAAA,GAAA,EACH,CAAA;AAEJ","file":"chunk-ZV7CV54P.js","sourcesContent":["import type { ReactNode } from \"react\";\nimport { isBinding, type Bound, type Json, type Node, type PageDoc } from \"../document/types\";\n\nexport interface ElementContext {\n node: Node;\n doc: PageDoc;\n /** Pre-rendered child nodes, in order. */\n children: ReactNode;\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/** Resolve a literal prop to a string (bindings resolve in Phase 3). */\nfunction literal(v: Bound<Json> | undefined): string {\n if (v === undefined || v === null) return \"\";\n if (isBinding(v)) return \"\";\n return String(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 text: ({ node }) => literal(node.props.content),\n heading: ({ node }) => literal(node.props.content) || \"Heading\",\n button: ({ node }) => {\n const label = literal(node.props.label) || literal(node.props.content) || \"Button\";\n const variant = literal(node.props.variant) || \"primary\";\n return <span data-cms-button={variant} style={buttonStyle(variant)}>{label}</span>;\n },\n image: ({ node }) => (\n <img\n src={literal(node.props.src)}\n alt={literal(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 { PageDoc } from \"../document/types\";\nimport { childrenOf } from \"../document/reduce\";\nimport { defaultRegistry, type ElementRegistry } from \"./registry\";\n\nexport interface RenderNodeProps {\n doc: PageDoc;\n id: string;\n registry?: ElementRegistry;\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 */\nexport function RenderNode({ doc, id, registry = defaultRegistry }: RenderNodeProps): ReactElement | null {\n const node = doc.nodes[id];\n if (!node) return null;\n\n const kids = childrenOf(doc, id).map((child) => (\n <RenderNode key={child.id} doc={doc} id={child.id} registry={registry} />\n ));\n\n const renderer = registry[node.type];\n const inner = renderer ? renderer({ node, doc, children: kids }) : node.island ? null : kids;\n\n return (\n <div\n data-cms={node.id}\n data-cms-island={node.island ? node.type : undefined}\n className={node.className}\n >\n {inner}\n </div>\n );\n}\n","import { Fragment, type ReactElement } from \"react\";\nimport type { PageDoc } from \"../document/types\";\nimport { emitDocCss } from \"../render/css\";\nimport { RenderNode } from \"./RenderNode\";\nimport { defaultRegistry, type ElementRegistry } from \"./registry\";\n\nexport interface CmsPageProps {\n doc: PageDoc;\n registry?: ElementRegistry;\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,\n registry = defaultRegistry,\n includeStyles = true,\n}: CmsPageProps): ReactElement {\n return (\n <Fragment>\n {includeStyles ? <style data-cms-styles=\"\">{emitDocCss(doc)}</style> : null}\n {doc.sections.map((id) => (\n <RenderNode key={id} doc={doc} id={id} registry={registry} />\n ))}\n </Fragment>\n );\n}\n"]}
@@ -1,75 +0,0 @@
1
- import { N as Node, i as NodeId, L as LayoutMode, f as Breakpoint, m as StyleProps, C as Constraints, c as Anim, A as Action, j as PageMeta, T as ThemeTokens } from './types-CpfPEq3V.js';
2
-
3
- /**
4
- * `PageOp` — the closed set of mutations. Every edit (human drag, agent tool
5
- * call, collab message) is one of these, reduced by the pure `reduce` in
6
- * `reduce.ts`. See `fancy-ui/docs/fancy-cms.md` §4.
7
- */
8
-
9
- type Actor = {
10
- kind: "human" | "agent";
11
- id: string;
12
- };
13
- type PageOp = {
14
- t: "insert_node";
15
- node: Node;
16
- } | {
17
- t: "remove_node";
18
- id: NodeId;
19
- } | {
20
- t: "move_node";
21
- id: NodeId;
22
- parent: NodeId | null;
23
- order: string;
24
- } | {
25
- t: "set_props";
26
- id: NodeId;
27
- patch: Record<string, unknown>;
28
- } | {
29
- t: "set_layout";
30
- id: NodeId;
31
- layout: LayoutMode | undefined;
32
- } | {
33
- t: "set_style";
34
- id: NodeId;
35
- breakpoint: Breakpoint;
36
- patch: Partial<StyleProps>;
37
- } | {
38
- t: "set_constraints";
39
- id: NodeId;
40
- breakpoint: Breakpoint;
41
- patch: Partial<Constraints>;
42
- } | {
43
- t: "set_animation";
44
- id: NodeId;
45
- anim: Anim;
46
- } | {
47
- t: "remove_animation";
48
- id: NodeId;
49
- animId: string;
50
- } | {
51
- t: "set_action";
52
- id: NodeId;
53
- index: number;
54
- action: Action | null;
55
- } | {
56
- t: "set_meta";
57
- patch: Partial<PageMeta>;
58
- } | {
59
- t: "set_theme";
60
- patch: Partial<ThemeTokens>;
61
- } | {
62
- t: "reorder_sections";
63
- order: NodeId[];
64
- };
65
- type PageOpType = PageOp["t"];
66
- /** Wire envelope — carries provenance + ordering. `pending` = an agent proposal. */
67
- interface OpEnvelope {
68
- op: PageOp;
69
- actor: Actor;
70
- ts: number;
71
- seq: number;
72
- pending?: boolean;
73
- }
74
-
75
- export type { Actor as A, OpEnvelope as O, PageOp as P, PageOpType as a };
@@ -1,75 +0,0 @@
1
- import { N as Node, i as NodeId, L as LayoutMode, f as Breakpoint, m as StyleProps, C as Constraints, c as Anim, A as Action, j as PageMeta, T as ThemeTokens } from './types-CpfPEq3V.cjs';
2
-
3
- /**
4
- * `PageOp` — the closed set of mutations. Every edit (human drag, agent tool
5
- * call, collab message) is one of these, reduced by the pure `reduce` in
6
- * `reduce.ts`. See `fancy-ui/docs/fancy-cms.md` §4.
7
- */
8
-
9
- type Actor = {
10
- kind: "human" | "agent";
11
- id: string;
12
- };
13
- type PageOp = {
14
- t: "insert_node";
15
- node: Node;
16
- } | {
17
- t: "remove_node";
18
- id: NodeId;
19
- } | {
20
- t: "move_node";
21
- id: NodeId;
22
- parent: NodeId | null;
23
- order: string;
24
- } | {
25
- t: "set_props";
26
- id: NodeId;
27
- patch: Record<string, unknown>;
28
- } | {
29
- t: "set_layout";
30
- id: NodeId;
31
- layout: LayoutMode | undefined;
32
- } | {
33
- t: "set_style";
34
- id: NodeId;
35
- breakpoint: Breakpoint;
36
- patch: Partial<StyleProps>;
37
- } | {
38
- t: "set_constraints";
39
- id: NodeId;
40
- breakpoint: Breakpoint;
41
- patch: Partial<Constraints>;
42
- } | {
43
- t: "set_animation";
44
- id: NodeId;
45
- anim: Anim;
46
- } | {
47
- t: "remove_animation";
48
- id: NodeId;
49
- animId: string;
50
- } | {
51
- t: "set_action";
52
- id: NodeId;
53
- index: number;
54
- action: Action | null;
55
- } | {
56
- t: "set_meta";
57
- patch: Partial<PageMeta>;
58
- } | {
59
- t: "set_theme";
60
- patch: Partial<ThemeTokens>;
61
- } | {
62
- t: "reorder_sections";
63
- order: NodeId[];
64
- };
65
- type PageOpType = PageOp["t"];
66
- /** Wire envelope — carries provenance + ordering. `pending` = an agent proposal. */
67
- interface OpEnvelope {
68
- op: PageOp;
69
- actor: Actor;
70
- ts: number;
71
- seq: number;
72
- pending?: boolean;
73
- }
74
-
75
- export type { Actor as A, OpEnvelope as O, PageOp as P, PageOpType as a };
@@ -1,19 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { N as Node, P as PageDoc } from './types-CpfPEq3V.cjs';
3
-
4
- interface ElementContext {
5
- node: Node;
6
- doc: PageDoc;
7
- /** Pre-rendered child nodes, in order. */
8
- children: ReactNode;
9
- }
10
- /**
11
- * Renders the INNER content of a node. The outer `[data-cms]` wrapper is added
12
- * by {@link RenderNode}, so a renderer only returns what goes inside.
13
- */
14
- type ElementRenderer = (ctx: ElementContext) => ReactNode;
15
- type ElementRegistry = Record<string, ElementRenderer>;
16
- /** Built-in native elements. Containers render their children; leaves render content. */
17
- declare const defaultRegistry: ElementRegistry;
18
-
19
- export { type ElementContext as E, type ElementRegistry as a, type ElementRenderer as b, defaultRegistry as d };
@@ -1,19 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { N as Node, P as PageDoc } from './types-CpfPEq3V.js';
3
-
4
- interface ElementContext {
5
- node: Node;
6
- doc: PageDoc;
7
- /** Pre-rendered child nodes, in order. */
8
- children: ReactNode;
9
- }
10
- /**
11
- * Renders the INNER content of a node. The outer `[data-cms]` wrapper is added
12
- * by {@link RenderNode}, so a renderer only returns what goes inside.
13
- */
14
- type ElementRenderer = (ctx: ElementContext) => ReactNode;
15
- type ElementRegistry = Record<string, ElementRenderer>;
16
- /** Built-in native elements. Containers render their children; leaves render content. */
17
- declare const defaultRegistry: ElementRegistry;
18
-
19
- export { type ElementContext as E, type ElementRegistry as a, type ElementRenderer as b, defaultRegistry as d };