@particle-academy/fancy-cms-ui 0.0.1-dev.8 → 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.
- package/README.md +72 -0
- package/dist/{chunk-HYHNMW47.js → chunk-GOXVGEKU.js} +103 -3
- package/dist/chunk-GOXVGEKU.js.map +1 -0
- package/dist/chunk-N22BQAY3.js +442 -0
- package/dist/chunk-N22BQAY3.js.map +1 -0
- package/dist/chunk-QYNWSECG.js +19 -0
- package/dist/chunk-QYNWSECG.js.map +1 -0
- package/dist/editor.cjs +475 -116
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.d.cts +10 -91
- package/dist/editor.d.ts +10 -91
- package/dist/editor.js +364 -420
- package/dist/editor.js.map +1 -1
- package/dist/index.cjs +517 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +3 -2
- package/dist/react.cjs +45 -25
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +13 -6
- package/dist/react.d.ts +13 -6
- package/dist/react.js +2 -19
- package/dist/react.js.map +1 -1
- package/dist/{types-CpfPEq3V.d.cts → registry-D5y5IgCR.d.cts} +30 -1
- package/dist/{types-CpfPEq3V.d.ts → registry-D5y5IgCR.d.ts} +30 -1
- package/dist/useEditor-DLH7hU6G.d.cts +162 -0
- package/dist/useEditor-qmF9n2e6.d.ts +162 -0
- package/package.json +6 -6
- package/dist/chunk-5O6U4VIU.js +0 -78
- package/dist/chunk-5O6U4VIU.js.map +0 -1
- package/dist/chunk-7YYLYBLI.js +0 -47
- package/dist/chunk-7YYLYBLI.js.map +0 -1
- package/dist/chunk-HYHNMW47.js.map +0 -1
- package/dist/ops-C_s0FGeV.d.cts +0 -71
- package/dist/ops-nevYkDzK.d.ts +0 -71
- package/dist/registry-Bk7GN1rA.d.cts +0 -19
- package/dist/registry-Dht9JBLU.d.ts +0 -19
package/dist/editor.d.cts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { P as PageOp } from './ops-C_s0FGeV.cjs';
|
|
5
|
-
|
|
6
|
-
interface EditorProps {
|
|
7
|
-
/** Initial document; edits are surfaced via {@link EditorProps.onChange}. */
|
|
8
|
-
defaultValue: PageDoc;
|
|
9
|
-
onChange?: (doc: PageDoc) => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The fancy-cms editor: layers · canvas · inspector over the op-spine. Phase 1
|
|
13
|
-
* cut — chrome is plain markup for now; it graduates to react-fancy next.
|
|
14
|
-
*/
|
|
15
|
-
declare function Editor({ defaultValue, onChange }: EditorProps): ReactElement;
|
|
1
|
+
export { C as Canvas, a as CanvasProps, E as Editor, b as EditorAction, c as EditorApi, d as EditorProps, e as EditorState, I as Inspector, f as InspectorProps, L as LayersPanel, g as LayersPanelProps, i as editorReduce, j as initEditor, u as useEditor } from './useEditor-DLH7hU6G.cjs';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { P as PageDoc, h as ElementRegistry, g as DataContext, N as Node, p as StyleProps, L as LayoutMode } from './registry-D5y5IgCR.cjs';
|
|
16
4
|
|
|
17
5
|
/** Animatable per-node transform (mirrors fancy-motion's NodeState, kept local to avoid a hard dep). */
|
|
18
6
|
interface NodeTransform {
|
|
@@ -28,6 +16,8 @@ interface NodeTransform {
|
|
|
28
16
|
interface EditablePageProps {
|
|
29
17
|
doc: PageDoc;
|
|
30
18
|
registry?: ElementRegistry;
|
|
19
|
+
/** Data context for `{ $bind }` props + repeaters (server props, etc.). */
|
|
20
|
+
data?: DataContext;
|
|
31
21
|
/** Slot for the fancy-motion timeline dock (rendered at the bottom in EditMode). */
|
|
32
22
|
timelineDock?: ReactNode;
|
|
33
23
|
/** Per-node transforms applied to the page (e.g. the sampled keyframe snapshot). */
|
|
@@ -54,36 +44,7 @@ interface EditablePageProps {
|
|
|
54
44
|
* toolbar styles it, and the selection can be **dragged to move** / **resized**
|
|
55
45
|
* — committed as transforms the host captures into a timeline keyframe.
|
|
56
46
|
*/
|
|
57
|
-
declare function EditablePage({ doc, registry, timelineDock, transforms, onNodeTransform, onSelect, frames, onProgress, pinned, }: EditablePageProps): ReactElement;
|
|
58
|
-
|
|
59
|
-
interface CanvasProps {
|
|
60
|
-
doc: PageDoc;
|
|
61
|
-
selection: string | null;
|
|
62
|
-
onSelect: (id: string | null) => void;
|
|
63
|
-
apply: (op: PageOp) => void;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The edit surface: renders the live page and overlays a selection box. Click to
|
|
67
|
-
* select; drag the box to move (px constraints). Phase 1 cut: free-parent
|
|
68
|
-
* move + resize handles, stack/grid reordering, and snapping come next.
|
|
69
|
-
*/
|
|
70
|
-
declare function Canvas({ doc, selection, onSelect, apply }: CanvasProps): ReactElement;
|
|
71
|
-
|
|
72
|
-
interface LayersPanelProps {
|
|
73
|
-
doc: PageDoc;
|
|
74
|
-
selection: string | null;
|
|
75
|
-
onSelect: (id: string) => void;
|
|
76
|
-
}
|
|
77
|
-
/** The section/layer tree. Click a row to select. */
|
|
78
|
-
declare function LayersPanel({ doc, selection, onSelect }: LayersPanelProps): ReactElement;
|
|
79
|
-
|
|
80
|
-
interface InspectorProps {
|
|
81
|
-
doc: PageDoc;
|
|
82
|
-
selection: string | null;
|
|
83
|
-
apply: (op: PageOp) => void;
|
|
84
|
-
}
|
|
85
|
-
/** Contextual property editor for the selected node. Every change is one op. */
|
|
86
|
-
declare function Inspector({ doc, selection, apply }: InspectorProps): ReactElement;
|
|
47
|
+
declare function EditablePage({ doc, registry, data, timelineDock, transforms, onNodeTransform, onSelect, frames, onProgress, pinned, }: EditablePageProps): ReactElement;
|
|
87
48
|
|
|
88
49
|
interface NodeInspectorProps {
|
|
89
50
|
node: Node;
|
|
@@ -98,6 +59,8 @@ interface NodeInspectorProps {
|
|
|
98
59
|
onProps: (patch: Record<string, unknown>) => void;
|
|
99
60
|
/** Patch the node's base style. */
|
|
100
61
|
onStyle: (patch: Partial<StyleProps>) => void;
|
|
62
|
+
/** Set how a container arranges its children (free / stack / grid). */
|
|
63
|
+
onLayout?: (layout: LayoutMode | undefined) => void;
|
|
101
64
|
/** Commit a transform (position / size / opacity / scale / rotate) into the active keyframe. */
|
|
102
65
|
onTransform: (t: NodeTransform) => void;
|
|
103
66
|
onRemove: () => void;
|
|
@@ -111,50 +74,6 @@ interface NodeInspectorProps {
|
|
|
111
74
|
* box. Every control writes through the op-spine or the active keyframe, so edits
|
|
112
75
|
* are undoable and animatable.
|
|
113
76
|
*/
|
|
114
|
-
declare function NodeInspector({ node, transform, measured, onProps, onStyle, onTransform, onRemove, onClose, }: NodeInspectorProps): ReactElement;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Editor state engine — pure and framework-agnostic so it's unit-testable.
|
|
118
|
-
* `useEditor` wraps this with `useReducer`. Undo/redo uses document snapshots
|
|
119
|
-
* (simple + robust); the op-level `invert` in the spine is for collab/op-stream
|
|
120
|
-
* undo.
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
interface EditorState {
|
|
124
|
-
doc: PageDoc;
|
|
125
|
-
past: PageDoc[];
|
|
126
|
-
future: PageDoc[];
|
|
127
|
-
selection: string | null;
|
|
128
|
-
}
|
|
129
|
-
type EditorAction = {
|
|
130
|
-
type: "apply";
|
|
131
|
-
op: PageOp;
|
|
132
|
-
} | {
|
|
133
|
-
type: "undo";
|
|
134
|
-
} | {
|
|
135
|
-
type: "redo";
|
|
136
|
-
} | {
|
|
137
|
-
type: "select";
|
|
138
|
-
id: string | null;
|
|
139
|
-
} | {
|
|
140
|
-
type: "replace";
|
|
141
|
-
doc: PageDoc;
|
|
142
|
-
};
|
|
143
|
-
declare function initEditor(doc: PageDoc): EditorState;
|
|
144
|
-
declare function editorReduce(state: EditorState, action: EditorAction): EditorState;
|
|
145
|
-
|
|
146
|
-
interface EditorApi {
|
|
147
|
-
state: EditorState;
|
|
148
|
-
/** Dispatch a mutation through the op-spine (records an undo snapshot). */
|
|
149
|
-
apply: (op: PageOp) => void;
|
|
150
|
-
undo: () => void;
|
|
151
|
-
redo: () => void;
|
|
152
|
-
select: (id: string | null) => void;
|
|
153
|
-
/** Replace the document wholesale (e.g. a controlled `value` change). */
|
|
154
|
-
replace: (doc: PageDoc) => void;
|
|
155
|
-
canUndo: boolean;
|
|
156
|
-
canRedo: boolean;
|
|
157
|
-
}
|
|
158
|
-
declare function useEditor(initialDoc: PageDoc): EditorApi;
|
|
77
|
+
declare function NodeInspector({ node, transform, measured, onProps, onStyle, onLayout, onTransform, onRemove, onClose, }: NodeInspectorProps): ReactElement;
|
|
159
78
|
|
|
160
|
-
export {
|
|
79
|
+
export { EditablePage, type EditablePageProps, NodeInspector, type NodeInspectorProps };
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { P as PageOp } from './ops-nevYkDzK.js';
|
|
5
|
-
|
|
6
|
-
interface EditorProps {
|
|
7
|
-
/** Initial document; edits are surfaced via {@link EditorProps.onChange}. */
|
|
8
|
-
defaultValue: PageDoc;
|
|
9
|
-
onChange?: (doc: PageDoc) => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The fancy-cms editor: layers · canvas · inspector over the op-spine. Phase 1
|
|
13
|
-
* cut — chrome is plain markup for now; it graduates to react-fancy next.
|
|
14
|
-
*/
|
|
15
|
-
declare function Editor({ defaultValue, onChange }: EditorProps): ReactElement;
|
|
1
|
+
export { C as Canvas, a as CanvasProps, E as Editor, b as EditorAction, c as EditorApi, d as EditorProps, e as EditorState, I as Inspector, f as InspectorProps, L as LayersPanel, g as LayersPanelProps, i as editorReduce, j as initEditor, u as useEditor } from './useEditor-qmF9n2e6.js';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { P as PageDoc, h as ElementRegistry, g as DataContext, N as Node, p as StyleProps, L as LayoutMode } from './registry-D5y5IgCR.js';
|
|
16
4
|
|
|
17
5
|
/** Animatable per-node transform (mirrors fancy-motion's NodeState, kept local to avoid a hard dep). */
|
|
18
6
|
interface NodeTransform {
|
|
@@ -28,6 +16,8 @@ interface NodeTransform {
|
|
|
28
16
|
interface EditablePageProps {
|
|
29
17
|
doc: PageDoc;
|
|
30
18
|
registry?: ElementRegistry;
|
|
19
|
+
/** Data context for `{ $bind }` props + repeaters (server props, etc.). */
|
|
20
|
+
data?: DataContext;
|
|
31
21
|
/** Slot for the fancy-motion timeline dock (rendered at the bottom in EditMode). */
|
|
32
22
|
timelineDock?: ReactNode;
|
|
33
23
|
/** Per-node transforms applied to the page (e.g. the sampled keyframe snapshot). */
|
|
@@ -54,36 +44,7 @@ interface EditablePageProps {
|
|
|
54
44
|
* toolbar styles it, and the selection can be **dragged to move** / **resized**
|
|
55
45
|
* — committed as transforms the host captures into a timeline keyframe.
|
|
56
46
|
*/
|
|
57
|
-
declare function EditablePage({ doc, registry, timelineDock, transforms, onNodeTransform, onSelect, frames, onProgress, pinned, }: EditablePageProps): ReactElement;
|
|
58
|
-
|
|
59
|
-
interface CanvasProps {
|
|
60
|
-
doc: PageDoc;
|
|
61
|
-
selection: string | null;
|
|
62
|
-
onSelect: (id: string | null) => void;
|
|
63
|
-
apply: (op: PageOp) => void;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The edit surface: renders the live page and overlays a selection box. Click to
|
|
67
|
-
* select; drag the box to move (px constraints). Phase 1 cut: free-parent
|
|
68
|
-
* move + resize handles, stack/grid reordering, and snapping come next.
|
|
69
|
-
*/
|
|
70
|
-
declare function Canvas({ doc, selection, onSelect, apply }: CanvasProps): ReactElement;
|
|
71
|
-
|
|
72
|
-
interface LayersPanelProps {
|
|
73
|
-
doc: PageDoc;
|
|
74
|
-
selection: string | null;
|
|
75
|
-
onSelect: (id: string) => void;
|
|
76
|
-
}
|
|
77
|
-
/** The section/layer tree. Click a row to select. */
|
|
78
|
-
declare function LayersPanel({ doc, selection, onSelect }: LayersPanelProps): ReactElement;
|
|
79
|
-
|
|
80
|
-
interface InspectorProps {
|
|
81
|
-
doc: PageDoc;
|
|
82
|
-
selection: string | null;
|
|
83
|
-
apply: (op: PageOp) => void;
|
|
84
|
-
}
|
|
85
|
-
/** Contextual property editor for the selected node. Every change is one op. */
|
|
86
|
-
declare function Inspector({ doc, selection, apply }: InspectorProps): ReactElement;
|
|
47
|
+
declare function EditablePage({ doc, registry, data, timelineDock, transforms, onNodeTransform, onSelect, frames, onProgress, pinned, }: EditablePageProps): ReactElement;
|
|
87
48
|
|
|
88
49
|
interface NodeInspectorProps {
|
|
89
50
|
node: Node;
|
|
@@ -98,6 +59,8 @@ interface NodeInspectorProps {
|
|
|
98
59
|
onProps: (patch: Record<string, unknown>) => void;
|
|
99
60
|
/** Patch the node's base style. */
|
|
100
61
|
onStyle: (patch: Partial<StyleProps>) => void;
|
|
62
|
+
/** Set how a container arranges its children (free / stack / grid). */
|
|
63
|
+
onLayout?: (layout: LayoutMode | undefined) => void;
|
|
101
64
|
/** Commit a transform (position / size / opacity / scale / rotate) into the active keyframe. */
|
|
102
65
|
onTransform: (t: NodeTransform) => void;
|
|
103
66
|
onRemove: () => void;
|
|
@@ -111,50 +74,6 @@ interface NodeInspectorProps {
|
|
|
111
74
|
* box. Every control writes through the op-spine or the active keyframe, so edits
|
|
112
75
|
* are undoable and animatable.
|
|
113
76
|
*/
|
|
114
|
-
declare function NodeInspector({ node, transform, measured, onProps, onStyle, onTransform, onRemove, onClose, }: NodeInspectorProps): ReactElement;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Editor state engine — pure and framework-agnostic so it's unit-testable.
|
|
118
|
-
* `useEditor` wraps this with `useReducer`. Undo/redo uses document snapshots
|
|
119
|
-
* (simple + robust); the op-level `invert` in the spine is for collab/op-stream
|
|
120
|
-
* undo.
|
|
121
|
-
*/
|
|
122
|
-
|
|
123
|
-
interface EditorState {
|
|
124
|
-
doc: PageDoc;
|
|
125
|
-
past: PageDoc[];
|
|
126
|
-
future: PageDoc[];
|
|
127
|
-
selection: string | null;
|
|
128
|
-
}
|
|
129
|
-
type EditorAction = {
|
|
130
|
-
type: "apply";
|
|
131
|
-
op: PageOp;
|
|
132
|
-
} | {
|
|
133
|
-
type: "undo";
|
|
134
|
-
} | {
|
|
135
|
-
type: "redo";
|
|
136
|
-
} | {
|
|
137
|
-
type: "select";
|
|
138
|
-
id: string | null;
|
|
139
|
-
} | {
|
|
140
|
-
type: "replace";
|
|
141
|
-
doc: PageDoc;
|
|
142
|
-
};
|
|
143
|
-
declare function initEditor(doc: PageDoc): EditorState;
|
|
144
|
-
declare function editorReduce(state: EditorState, action: EditorAction): EditorState;
|
|
145
|
-
|
|
146
|
-
interface EditorApi {
|
|
147
|
-
state: EditorState;
|
|
148
|
-
/** Dispatch a mutation through the op-spine (records an undo snapshot). */
|
|
149
|
-
apply: (op: PageOp) => void;
|
|
150
|
-
undo: () => void;
|
|
151
|
-
redo: () => void;
|
|
152
|
-
select: (id: string | null) => void;
|
|
153
|
-
/** Replace the document wholesale (e.g. a controlled `value` change). */
|
|
154
|
-
replace: (doc: PageDoc) => void;
|
|
155
|
-
canUndo: boolean;
|
|
156
|
-
canRedo: boolean;
|
|
157
|
-
}
|
|
158
|
-
declare function useEditor(initialDoc: PageDoc): EditorApi;
|
|
77
|
+
declare function NodeInspector({ node, transform, measured, onProps, onStyle, onLayout, onTransform, onRemove, onClose, }: NodeInspectorProps): ReactElement;
|
|
159
78
|
|
|
160
|
-
export {
|
|
79
|
+
export { EditablePage, type EditablePageProps, NodeInspector, type NodeInspectorProps };
|