@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.
- package/dist/{chunk-IWQQINCF.js → chunk-LY6ID2J2.js} +21 -8
- package/dist/chunk-LY6ID2J2.js.map +1 -0
- package/dist/{chunk-BWGAUTKG.js → chunk-R7HDS4VG.js} +3 -3
- package/dist/{chunk-BWGAUTKG.js.map → chunk-R7HDS4VG.js.map} +1 -1
- package/dist/{chunk-YOAZRQKN.js → chunk-SYRU2X45.js} +3 -3
- package/dist/{chunk-YOAZRQKN.js.map → chunk-SYRU2X45.js.map} +1 -1
- package/dist/editor.cjs +40 -25
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.d.cts +2 -2
- package/dist/editor.d.ts +2 -2
- package/dist/editor.js +3 -3
- package/dist/index.cjs +19 -5
- 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 +4 -4
- package/dist/react.cjs +36 -11
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +2 -2
- package/dist/{registry-CiPir27w.d.cts → registry-CUNaBqTs.d.cts} +5 -1
- package/dist/{registry-CiPir27w.d.ts → registry-CUNaBqTs.d.ts} +5 -1
- package/dist/{useEditor-DAE36OYU.d.ts → useEditor-aPH5falI.d.ts} +1 -1
- package/dist/{useEditor-CoxNeC53.d.cts → useEditor-wdlYQMHg.d.cts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-IWQQINCF.js.map +0 -1
package/dist/editor.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-wdlYQMHg.cjs';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { P as PageDoc, h as ElementRegistry, g as DataContext, N as Node, q as StyleProps, L as LayoutMode } from './registry-
|
|
3
|
+
import { P as PageDoc, h as ElementRegistry, g as DataContext, N as Node, q as StyleProps, L as LayoutMode } from './registry-CUNaBqTs.cjs';
|
|
4
4
|
import '@particle-academy/fancy-doc-commons';
|
|
5
5
|
|
|
6
6
|
/** Animatable per-node transform (mirrors fancy-motion's NodeState, kept local to avoid a hard dep). */
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-aPH5falI.js';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { P as PageDoc, h as ElementRegistry, g as DataContext, N as Node, q as StyleProps, L as LayoutMode } from './registry-
|
|
3
|
+
import { P as PageDoc, h as ElementRegistry, g as DataContext, N as Node, q as StyleProps, L as LayoutMode } from './registry-CUNaBqTs.js';
|
|
4
4
|
import '@particle-academy/fancy-doc-commons';
|
|
5
5
|
|
|
6
6
|
/** Animatable per-node transform (mirrors fancy-motion's NodeState, kept local to avoid a hard dep). */
|
package/dist/editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useEditor, useLatestRef, CONTAINER_TYPES, ADD_DEFAULTS, ADD_MENU } from './chunk-
|
|
2
|
-
export { Canvas, Editor, Inspector, LayersPanel, editorReduce, initEditor, useEditor } from './chunk-
|
|
3
|
-
import { isBinding, lastRootId, childrenOf, CmsPage, defaultRegistry } from './chunk-
|
|
1
|
+
import { useEditor, useLatestRef, CONTAINER_TYPES, ADD_DEFAULTS, ADD_MENU } from './chunk-SYRU2X45.js';
|
|
2
|
+
export { Canvas, Editor, Inspector, LayersPanel, editorReduce, initEditor, useEditor } from './chunk-SYRU2X45.js';
|
|
3
|
+
import { isBinding, lastRootId, childrenOf, CmsPage, defaultRegistry } from './chunk-LY6ID2J2.js';
|
|
4
4
|
import { useState, useRef, useEffect, useCallback, useLayoutEffect } from 'react';
|
|
5
5
|
import { ContextMenu } from '@particle-academy/react-fancy';
|
|
6
6
|
import { fractionalKey } from '@particle-academy/fancy-doc-commons';
|
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,11 @@ var react = require('react');
|
|
|
8
8
|
function isBinding(v) {
|
|
9
9
|
return typeof v === "object" && v !== null && typeof v.$bind === "string";
|
|
10
10
|
}
|
|
11
|
+
function hasNodeMap(value) {
|
|
12
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
13
|
+
const nodes = value.nodes;
|
|
14
|
+
return typeof nodes === "object" && nodes !== null && !Array.isArray(nodes);
|
|
15
|
+
}
|
|
11
16
|
var DEFAULT_BREAKPOINTS = {
|
|
12
17
|
base: 0,
|
|
13
18
|
md: 768,
|
|
@@ -60,6 +65,7 @@ function childrenOf(doc, parent) {
|
|
|
60
65
|
return fancyDocCommons.childrenOf(doc, parent);
|
|
61
66
|
}
|
|
62
67
|
function rootIds(doc) {
|
|
68
|
+
if (!hasNodeMap(doc)) return [];
|
|
63
69
|
return childrenOf(doc, null).map((n) => n.id);
|
|
64
70
|
}
|
|
65
71
|
function lastRootId(doc) {
|
|
@@ -254,17 +260,23 @@ function pick(obj, keys) {
|
|
|
254
260
|
for (const k of keys) out[k] = obj[k];
|
|
255
261
|
return out;
|
|
256
262
|
}
|
|
263
|
+
function normalizeDoc(input2) {
|
|
264
|
+
if (hasNodeMap(input2)) return input2;
|
|
265
|
+
const id = typeof input2 === "object" && input2 !== null && !Array.isArray(input2) && typeof input2.id === "string" ? input2.id : "malformed";
|
|
266
|
+
return emptyDoc(id);
|
|
267
|
+
}
|
|
257
268
|
function migrateDocVerbose(input2) {
|
|
258
|
-
const
|
|
269
|
+
const normalized = normalizeDoc(input2);
|
|
270
|
+
const legacy = normalized;
|
|
259
271
|
const sections = legacy.sections;
|
|
260
272
|
if (!Array.isArray(sections)) {
|
|
261
|
-
return { doc:
|
|
273
|
+
return { doc: normalized, migrated: false, danglingIds: [], unlistedRootIds: [] };
|
|
262
274
|
}
|
|
263
275
|
const danglingIds = [];
|
|
264
276
|
const ordered = [];
|
|
265
277
|
const seen = /* @__PURE__ */ new Set();
|
|
266
278
|
for (const id of sections) {
|
|
267
|
-
if (!
|
|
279
|
+
if (!normalized.nodes[id]) {
|
|
268
280
|
danglingIds.push(id);
|
|
269
281
|
continue;
|
|
270
282
|
}
|
|
@@ -272,9 +284,9 @@ function migrateDocVerbose(input2) {
|
|
|
272
284
|
seen.add(id);
|
|
273
285
|
ordered.push(id);
|
|
274
286
|
}
|
|
275
|
-
const unlistedRootIds = Object.values(
|
|
287
|
+
const unlistedRootIds = Object.values(normalized.nodes).filter((n) => n.parent === null && !seen.has(n.id)).sort((a, b) => a.order < b.order ? -1 : a.order > b.order ? 1 : 0).map((n) => n.id);
|
|
276
288
|
const finalOrder = [...ordered, ...unlistedRootIds];
|
|
277
|
-
const nodes = { ...
|
|
289
|
+
const nodes = { ...normalized.nodes };
|
|
278
290
|
let prev = null;
|
|
279
291
|
for (const id of finalOrder) {
|
|
280
292
|
const key = fancyDocCommons.fractionalKey(prev, null);
|
|
@@ -392,6 +404,7 @@ ${body}
|
|
|
392
404
|
${indent}}`;
|
|
393
405
|
}
|
|
394
406
|
function emitDocCss(doc) {
|
|
407
|
+
if (!hasNodeMap(doc)) return "";
|
|
395
408
|
const breakpointPx = DEFAULT_BREAKPOINTS;
|
|
396
409
|
const blocks = [];
|
|
397
410
|
for (const id of Object.keys(doc.nodes).sort()) {
|
|
@@ -1121,6 +1134,7 @@ exports.editorReduce = editorReduce;
|
|
|
1121
1134
|
exports.emitDocCss = emitDocCss;
|
|
1122
1135
|
exports.emptyDoc = emptyDoc;
|
|
1123
1136
|
exports.getPath = getPath;
|
|
1137
|
+
exports.hasNodeMap = hasNodeMap;
|
|
1124
1138
|
exports.initEditor = initEditor;
|
|
1125
1139
|
exports.invert = invert;
|
|
1126
1140
|
exports.isBinding = isBinding;
|