@particle-academy/fancy-cms-ui 0.0.1-dev.1 → 0.0.1-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NWH2AJLH.js → chunk-3YZMELJJ.js} +11 -2
- package/dist/chunk-3YZMELJJ.js.map +1 -0
- package/dist/chunk-7YYLYBLI.js +47 -0
- package/dist/chunk-7YYLYBLI.js.map +1 -0
- package/dist/{chunk-MRWUUNJR.js → chunk-ZV7CV54P.js} +35 -4
- package/dist/chunk-ZV7CV54P.js.map +1 -0
- package/dist/editor.cjs +1029 -22
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.d.cts +81 -6
- package/dist/editor.d.ts +81 -6
- package/dist/editor.js +947 -20
- package/dist/editor.js.map +1 -1
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -47
- package/dist/index.js.map +1 -1
- package/dist/{ops-CJenUAsy.d.ts → ops-BsM6kZxY.d.ts} +5 -1
- package/dist/{ops-DWgJjAbX.d.cts → ops-CdBZarAT.d.cts} +5 -1
- package/dist/react.cjs +32 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -18
- package/dist/react.d.ts +5 -18
- package/dist/react.js +3 -3
- package/dist/registry-Bk7GN1rA.d.cts +19 -0
- package/dist/registry-Dht9JBLU.d.ts +19 -0
- package/dist/{types-DKCl14aV.d.cts → types-CpfPEq3V.d.cts} +6 -0
- package/dist/{types-DKCl14aV.d.ts → types-CpfPEq3V.d.ts} +6 -0
- package/package.json +5 -4
- package/dist/chunk-MRWUUNJR.js.map +0 -1
- package/dist/chunk-NWH2AJLH.js.map +0 -1
package/dist/editor.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { P as PageDoc } from './types-
|
|
3
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { P as PageDoc, i as NodeId, N as Node, m as StyleProps, L as LayoutMode } from './types-CpfPEq3V.cjs';
|
|
3
|
+
import { a as ElementRegistry } from './registry-Bk7GN1rA.cjs';
|
|
4
|
+
import { P as PageOp } from './ops-CdBZarAT.cjs';
|
|
4
5
|
|
|
5
6
|
interface EditorProps {
|
|
6
7
|
/** Initial document; edits are surfaced via {@link EditorProps.onChange}. */
|
|
@@ -13,6 +14,48 @@ interface EditorProps {
|
|
|
13
14
|
*/
|
|
14
15
|
declare function Editor({ defaultValue, onChange }: EditorProps): ReactElement;
|
|
15
16
|
|
|
17
|
+
/** Animatable per-node transform (mirrors fancy-motion's NodeState, kept local to avoid a hard dep). */
|
|
18
|
+
interface NodeTransform {
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
scale?: number;
|
|
22
|
+
opacity?: number;
|
|
23
|
+
rotate?: number;
|
|
24
|
+
/** Explicit size in px (a true resize, distinct from `scale`). Absent = auto. */
|
|
25
|
+
w?: number;
|
|
26
|
+
h?: number;
|
|
27
|
+
}
|
|
28
|
+
interface EditablePageProps {
|
|
29
|
+
doc: PageDoc;
|
|
30
|
+
registry?: ElementRegistry;
|
|
31
|
+
/** Slot for the fancy-motion timeline dock (rendered at the bottom in EditMode). */
|
|
32
|
+
timelineDock?: ReactNode;
|
|
33
|
+
/** Per-node transforms applied to the page (e.g. the sampled keyframe snapshot). */
|
|
34
|
+
transforms?: Record<string, NodeTransform>;
|
|
35
|
+
/** Fired when the user moves/resizes a node — the host writes it into the current keyframe. */
|
|
36
|
+
onNodeTransform?: (id: string, transform: NodeTransform) => void;
|
|
37
|
+
/** Notifies the host of the current selection (e.g. to sync the timeline). */
|
|
38
|
+
onSelect?: (id: string | null) => void;
|
|
39
|
+
/** Scroll length in viewports — the page becomes a tall scroll canvas (extend via the timeline). */
|
|
40
|
+
frames?: number;
|
|
41
|
+
/** Scroll progress 0..1 (scroll = the timeline playhead). The host maps it to transforms. */
|
|
42
|
+
onProgress?: (progress: number) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Pin the page into a scroll canvas (the `frames`×viewport spacer + sticky pin
|
|
45
|
+
* that turns scroll into the playhead). Default `true`. Set **false** for a
|
|
46
|
+
* full multi-section page that should scroll naturally — animation is then
|
|
47
|
+
* driven by the dock scrub + Play preview instead of raw scroll.
|
|
48
|
+
*/
|
|
49
|
+
pinned?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Inline EditMode over a live, seeded CMS page. Hold **Ctrl+Shift** to reveal
|
|
53
|
+
* the Edit toggle. Editing is on the page: text is edited in place, a floating
|
|
54
|
+
* toolbar styles it, and the selection can be **dragged to move** / **resized**
|
|
55
|
+
* — committed as transforms the host captures into a timeline keyframe.
|
|
56
|
+
*/
|
|
57
|
+
declare function EditablePage({ doc, registry, timelineDock, transforms, onNodeTransform, onSelect, frames, onProgress, pinned, }: EditablePageProps): ReactElement;
|
|
58
|
+
|
|
16
59
|
interface CanvasProps {
|
|
17
60
|
doc: PageDoc;
|
|
18
61
|
selection: string | null;
|
|
@@ -30,9 +73,11 @@ interface LayersPanelProps {
|
|
|
30
73
|
doc: PageDoc;
|
|
31
74
|
selection: string | null;
|
|
32
75
|
onSelect: (id: string) => void;
|
|
76
|
+
/** Reparent/reorder a node (drag-to-reorder). Omit to disable dragging. */
|
|
77
|
+
onMove?: (id: NodeId, parent: NodeId | null, order: string) => void;
|
|
33
78
|
}
|
|
34
|
-
/** The section/layer tree. Click a row to select. */
|
|
35
|
-
declare function LayersPanel({ doc, selection, onSelect }: LayersPanelProps): ReactElement;
|
|
79
|
+
/** The section/layer tree. Click a row to select; drag a row onto another to reorder. */
|
|
80
|
+
declare function LayersPanel({ doc, selection, onSelect, onMove }: LayersPanelProps): ReactElement;
|
|
36
81
|
|
|
37
82
|
interface InspectorProps {
|
|
38
83
|
doc: PageDoc;
|
|
@@ -42,6 +87,36 @@ interface InspectorProps {
|
|
|
42
87
|
/** Contextual property editor for the selected node. Every change is one op. */
|
|
43
88
|
declare function Inspector({ doc, selection, apply }: InspectorProps): ReactElement;
|
|
44
89
|
|
|
90
|
+
interface NodeInspectorProps {
|
|
91
|
+
node: Node;
|
|
92
|
+
/** The currently-applied transform for this node (sampled from the active keyframe). */
|
|
93
|
+
transform: NodeTransform;
|
|
94
|
+
/** Live measured size, used as the placeholder when width/height are still "auto". */
|
|
95
|
+
measured: {
|
|
96
|
+
w: number;
|
|
97
|
+
h: number;
|
|
98
|
+
};
|
|
99
|
+
/** Patch the node's props (commits through the op-spine → undoable). */
|
|
100
|
+
onProps: (patch: Record<string, unknown>) => void;
|
|
101
|
+
/** Patch the node's base style. */
|
|
102
|
+
onStyle: (patch: Partial<StyleProps>) => void;
|
|
103
|
+
/** Set how a container arranges its children (free / stack / grid). */
|
|
104
|
+
onLayout?: (layout: LayoutMode | undefined) => void;
|
|
105
|
+
/** Commit a transform (position / size / opacity / scale / rotate) into the active keyframe. */
|
|
106
|
+
onTransform: (t: NodeTransform) => void;
|
|
107
|
+
onRemove: () => void;
|
|
108
|
+
onClose: () => void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The on-page element Inspector — a docked properties panel shown while a node
|
|
112
|
+
* is selected in EditMode. Where the floating toolbar handles quick text tweaks,
|
|
113
|
+
* this is the full surface: content, element-specific props (a button's label /
|
|
114
|
+
* link / variant, an image's src / alt, …), exact position + size, and the style
|
|
115
|
+
* box. Every control writes through the op-spine or the active keyframe, so edits
|
|
116
|
+
* are undoable and animatable.
|
|
117
|
+
*/
|
|
118
|
+
declare function NodeInspector({ node, transform, measured, onProps, onStyle, onLayout, onTransform, onRemove, onClose, }: NodeInspectorProps): ReactElement;
|
|
119
|
+
|
|
45
120
|
/**
|
|
46
121
|
* Editor state engine — pure and framework-agnostic so it's unit-testable.
|
|
47
122
|
* `useEditor` wraps this with `useReducer`. Undo/redo uses document snapshots
|
|
@@ -86,4 +161,4 @@ interface EditorApi {
|
|
|
86
161
|
}
|
|
87
162
|
declare function useEditor(initialDoc: PageDoc): EditorApi;
|
|
88
163
|
|
|
89
|
-
export { Canvas, type CanvasProps, Editor, type EditorAction, type EditorApi, type EditorProps, type EditorState, Inspector, type InspectorProps, LayersPanel, type LayersPanelProps, editorReduce, initEditor, useEditor };
|
|
164
|
+
export { Canvas, type CanvasProps, EditablePage, type EditablePageProps, Editor, type EditorAction, type EditorApi, type EditorProps, type EditorState, Inspector, type InspectorProps, LayersPanel, type LayersPanelProps, NodeInspector, type NodeInspectorProps, editorReduce, initEditor, useEditor };
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { P as PageDoc } from './types-
|
|
3
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { P as PageDoc, i as NodeId, N as Node, m as StyleProps, L as LayoutMode } from './types-CpfPEq3V.js';
|
|
3
|
+
import { a as ElementRegistry } from './registry-Dht9JBLU.js';
|
|
4
|
+
import { P as PageOp } from './ops-BsM6kZxY.js';
|
|
4
5
|
|
|
5
6
|
interface EditorProps {
|
|
6
7
|
/** Initial document; edits are surfaced via {@link EditorProps.onChange}. */
|
|
@@ -13,6 +14,48 @@ interface EditorProps {
|
|
|
13
14
|
*/
|
|
14
15
|
declare function Editor({ defaultValue, onChange }: EditorProps): ReactElement;
|
|
15
16
|
|
|
17
|
+
/** Animatable per-node transform (mirrors fancy-motion's NodeState, kept local to avoid a hard dep). */
|
|
18
|
+
interface NodeTransform {
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
scale?: number;
|
|
22
|
+
opacity?: number;
|
|
23
|
+
rotate?: number;
|
|
24
|
+
/** Explicit size in px (a true resize, distinct from `scale`). Absent = auto. */
|
|
25
|
+
w?: number;
|
|
26
|
+
h?: number;
|
|
27
|
+
}
|
|
28
|
+
interface EditablePageProps {
|
|
29
|
+
doc: PageDoc;
|
|
30
|
+
registry?: ElementRegistry;
|
|
31
|
+
/** Slot for the fancy-motion timeline dock (rendered at the bottom in EditMode). */
|
|
32
|
+
timelineDock?: ReactNode;
|
|
33
|
+
/** Per-node transforms applied to the page (e.g. the sampled keyframe snapshot). */
|
|
34
|
+
transforms?: Record<string, NodeTransform>;
|
|
35
|
+
/** Fired when the user moves/resizes a node — the host writes it into the current keyframe. */
|
|
36
|
+
onNodeTransform?: (id: string, transform: NodeTransform) => void;
|
|
37
|
+
/** Notifies the host of the current selection (e.g. to sync the timeline). */
|
|
38
|
+
onSelect?: (id: string | null) => void;
|
|
39
|
+
/** Scroll length in viewports — the page becomes a tall scroll canvas (extend via the timeline). */
|
|
40
|
+
frames?: number;
|
|
41
|
+
/** Scroll progress 0..1 (scroll = the timeline playhead). The host maps it to transforms. */
|
|
42
|
+
onProgress?: (progress: number) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Pin the page into a scroll canvas (the `frames`×viewport spacer + sticky pin
|
|
45
|
+
* that turns scroll into the playhead). Default `true`. Set **false** for a
|
|
46
|
+
* full multi-section page that should scroll naturally — animation is then
|
|
47
|
+
* driven by the dock scrub + Play preview instead of raw scroll.
|
|
48
|
+
*/
|
|
49
|
+
pinned?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Inline EditMode over a live, seeded CMS page. Hold **Ctrl+Shift** to reveal
|
|
53
|
+
* the Edit toggle. Editing is on the page: text is edited in place, a floating
|
|
54
|
+
* toolbar styles it, and the selection can be **dragged to move** / **resized**
|
|
55
|
+
* — committed as transforms the host captures into a timeline keyframe.
|
|
56
|
+
*/
|
|
57
|
+
declare function EditablePage({ doc, registry, timelineDock, transforms, onNodeTransform, onSelect, frames, onProgress, pinned, }: EditablePageProps): ReactElement;
|
|
58
|
+
|
|
16
59
|
interface CanvasProps {
|
|
17
60
|
doc: PageDoc;
|
|
18
61
|
selection: string | null;
|
|
@@ -30,9 +73,11 @@ interface LayersPanelProps {
|
|
|
30
73
|
doc: PageDoc;
|
|
31
74
|
selection: string | null;
|
|
32
75
|
onSelect: (id: string) => void;
|
|
76
|
+
/** Reparent/reorder a node (drag-to-reorder). Omit to disable dragging. */
|
|
77
|
+
onMove?: (id: NodeId, parent: NodeId | null, order: string) => void;
|
|
33
78
|
}
|
|
34
|
-
/** The section/layer tree. Click a row to select. */
|
|
35
|
-
declare function LayersPanel({ doc, selection, onSelect }: LayersPanelProps): ReactElement;
|
|
79
|
+
/** The section/layer tree. Click a row to select; drag a row onto another to reorder. */
|
|
80
|
+
declare function LayersPanel({ doc, selection, onSelect, onMove }: LayersPanelProps): ReactElement;
|
|
36
81
|
|
|
37
82
|
interface InspectorProps {
|
|
38
83
|
doc: PageDoc;
|
|
@@ -42,6 +87,36 @@ interface InspectorProps {
|
|
|
42
87
|
/** Contextual property editor for the selected node. Every change is one op. */
|
|
43
88
|
declare function Inspector({ doc, selection, apply }: InspectorProps): ReactElement;
|
|
44
89
|
|
|
90
|
+
interface NodeInspectorProps {
|
|
91
|
+
node: Node;
|
|
92
|
+
/** The currently-applied transform for this node (sampled from the active keyframe). */
|
|
93
|
+
transform: NodeTransform;
|
|
94
|
+
/** Live measured size, used as the placeholder when width/height are still "auto". */
|
|
95
|
+
measured: {
|
|
96
|
+
w: number;
|
|
97
|
+
h: number;
|
|
98
|
+
};
|
|
99
|
+
/** Patch the node's props (commits through the op-spine → undoable). */
|
|
100
|
+
onProps: (patch: Record<string, unknown>) => void;
|
|
101
|
+
/** Patch the node's base style. */
|
|
102
|
+
onStyle: (patch: Partial<StyleProps>) => void;
|
|
103
|
+
/** Set how a container arranges its children (free / stack / grid). */
|
|
104
|
+
onLayout?: (layout: LayoutMode | undefined) => void;
|
|
105
|
+
/** Commit a transform (position / size / opacity / scale / rotate) into the active keyframe. */
|
|
106
|
+
onTransform: (t: NodeTransform) => void;
|
|
107
|
+
onRemove: () => void;
|
|
108
|
+
onClose: () => void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The on-page element Inspector — a docked properties panel shown while a node
|
|
112
|
+
* is selected in EditMode. Where the floating toolbar handles quick text tweaks,
|
|
113
|
+
* this is the full surface: content, element-specific props (a button's label /
|
|
114
|
+
* link / variant, an image's src / alt, …), exact position + size, and the style
|
|
115
|
+
* box. Every control writes through the op-spine or the active keyframe, so edits
|
|
116
|
+
* are undoable and animatable.
|
|
117
|
+
*/
|
|
118
|
+
declare function NodeInspector({ node, transform, measured, onProps, onStyle, onLayout, onTransform, onRemove, onClose, }: NodeInspectorProps): ReactElement;
|
|
119
|
+
|
|
45
120
|
/**
|
|
46
121
|
* Editor state engine — pure and framework-agnostic so it's unit-testable.
|
|
47
122
|
* `useEditor` wraps this with `useReducer`. Undo/redo uses document snapshots
|
|
@@ -86,4 +161,4 @@ interface EditorApi {
|
|
|
86
161
|
}
|
|
87
162
|
declare function useEditor(initialDoc: PageDoc): EditorApi;
|
|
88
163
|
|
|
89
|
-
export { Canvas, type CanvasProps, Editor, type EditorAction, type EditorApi, type EditorProps, type EditorState, Inspector, type InspectorProps, LayersPanel, type LayersPanelProps, editorReduce, initEditor, useEditor };
|
|
164
|
+
export { Canvas, type CanvasProps, EditablePage, type EditablePageProps, Editor, type EditorAction, type EditorApi, type EditorProps, type EditorState, Inspector, type InspectorProps, LayersPanel, type LayersPanelProps, NodeInspector, type NodeInspectorProps, editorReduce, initEditor, useEditor };
|