@measured/puck 0.21.0-canary.c78dc826 → 0.21.0-canary.d1e8fa71
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/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
- package/dist/{Editor-N46HUQEC.mjs → Editor-L3JAAT2X.mjs} +13 -10
- package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
- package/dist/{Render-Y567PGZ7.mjs → Render-FXZX6NFH.mjs} +6 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-tsxxcX1z.d.mts} +24 -35
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-tsxxcX1z.d.ts} +24 -35
- package/dist/chunk-23IZFPL7.mjs +528 -0
- package/dist/{chunk-C2TVYIYC.mjs → chunk-3SDLQIUZ.mjs} +57 -43
- package/dist/chunk-45I5SDOI.mjs +134 -0
- package/dist/{chunk-DNF2EMM4.mjs → chunk-5ZZVX2Z3.mjs} +2 -2
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/{chunk-DJSH5REF.mjs → chunk-B7REOAA7.mjs} +24 -126
- package/dist/{chunk-K3V4LVUL.mjs → chunk-BXQQARCR.mjs} +14 -10
- package/dist/{chunk-TB3SSIAY.mjs → chunk-CQUAWHOK.mjs} +5224 -4509
- package/dist/{chunk-7KY6RHEY.mjs → chunk-D2SRL6YA.mjs} +101 -524
- package/dist/{chunk-GQKMOYLG.mjs → chunk-LJEGWHDD.mjs} +2 -2
- package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
- package/dist/{chunk-FNWOH4R6.mjs → chunk-PBAAIKXA.mjs} +8 -6
- package/dist/{chunk-3QHWXJEI.mjs → chunk-U4VSQKO3.mjs} +2 -2
- package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{full-NLUNPJWS.mjs → full-L7DWVNTZ.mjs} +10 -7
- package/dist/index-Ca6V6NQD.d.ts +118 -0
- package/dist/index-mQvUCH3C.d.mts +118 -0
- package/dist/index.css +732 -341
- package/dist/index.d.mts +29 -120
- package/dist/index.d.ts +29 -120
- package/dist/index.js +3273 -2392
- package/dist/index.mjs +22 -16
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/{loaded-HMSPJUZM.mjs → loaded-2HLHDP2G.mjs} +7 -4
- package/dist/{loaded-EV34KGYJ.mjs → loaded-LZUXYAGW.mjs} +7 -4
- package/dist/{loaded-ZXOU6S6R.mjs → loaded-UHVTB6OD.mjs} +7 -4
- package/dist/no-external.css +870 -475
- package/dist/no-external.d.mts +4 -2
- package/dist/no-external.d.ts +4 -2
- package/dist/no-external.js +3276 -2392
- package/dist/no-external.mjs +22 -11
- package/dist/rsc.css +28 -27
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +56 -29
- package/dist/rsc.mjs +6 -4
- package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
- package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
- package/package.json +9 -4
- package/dist/chunk-WUWXFMEM.mjs +0 -11
|
@@ -1,21 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createReducer,
|
|
3
|
+
generateId,
|
|
4
|
+
getItem,
|
|
5
|
+
makeStatePublic
|
|
6
|
+
} from "./chunk-23IZFPL7.mjs";
|
|
1
7
|
import {
|
|
2
8
|
defaultAppState,
|
|
3
9
|
defaultViewports,
|
|
4
10
|
getChanged,
|
|
5
|
-
resolveComponentData
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
resolveComponentData
|
|
12
|
+
} from "./chunk-45I5SDOI.mjs";
|
|
13
|
+
import {
|
|
14
|
+
get_class_name_factory_default
|
|
15
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
16
|
+
import {
|
|
17
|
+
walkAppState
|
|
18
|
+
} from "./chunk-B7REOAA7.mjs";
|
|
11
19
|
import {
|
|
12
20
|
__async,
|
|
13
21
|
__objRest,
|
|
14
22
|
__spreadProps,
|
|
15
23
|
__spreadValues,
|
|
16
|
-
get_class_name_factory_default,
|
|
17
24
|
init_react_import
|
|
18
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
19
26
|
|
|
20
27
|
// ../../node_modules/lucide-react/dist/esm/icons/align-left.js
|
|
21
28
|
init_react_import();
|
|
@@ -218,6 +225,15 @@ var EllipsisVertical = createLucideIcon("EllipsisVertical", [
|
|
|
218
225
|
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
|
219
226
|
]);
|
|
220
227
|
|
|
228
|
+
// ../../node_modules/lucide-react/dist/esm/icons/expand.js
|
|
229
|
+
init_react_import();
|
|
230
|
+
var Expand = createLucideIcon("Expand", [
|
|
231
|
+
["path", { d: "m21 21-6-6m6 6v-4.8m0 4.8h-4.8", key: "1c15vz" }],
|
|
232
|
+
["path", { d: "M3 16.2V21m0 0h4.8M3 21l6-6", key: "1fsnz2" }],
|
|
233
|
+
["path", { d: "M21 7.8V3m0 0h-4.8M21 3l-6 6", key: "hawz9i" }],
|
|
234
|
+
["path", { d: "M3 7.8V3m0 0h4.8M3 3l6 6", key: "u9ee12" }]
|
|
235
|
+
]);
|
|
236
|
+
|
|
221
237
|
// ../../node_modules/lucide-react/dist/esm/icons/globe.js
|
|
222
238
|
init_react_import();
|
|
223
239
|
var Globe = createLucideIcon("Globe", [
|
|
@@ -226,6 +242,20 @@ var Globe = createLucideIcon("Globe", [
|
|
|
226
242
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
227
243
|
]);
|
|
228
244
|
|
|
245
|
+
// ../../node_modules/lucide-react/dist/esm/icons/hammer.js
|
|
246
|
+
init_react_import();
|
|
247
|
+
var Hammer = createLucideIcon("Hammer", [
|
|
248
|
+
["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
|
|
249
|
+
["path", { d: "m18 15 4-4", key: "16gjal" }],
|
|
250
|
+
[
|
|
251
|
+
"path",
|
|
252
|
+
{
|
|
253
|
+
d: "m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",
|
|
254
|
+
key: "b7pghm"
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
]);
|
|
258
|
+
|
|
229
259
|
// ../../node_modules/lucide-react/dist/esm/icons/hash.js
|
|
230
260
|
init_react_import();
|
|
231
261
|
var Hash = createLucideIcon("Hash", [
|
|
@@ -371,6 +401,24 @@ var Lock = createLucideIcon("Lock", [
|
|
|
371
401
|
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
|
372
402
|
]);
|
|
373
403
|
|
|
404
|
+
// ../../node_modules/lucide-react/dist/esm/icons/maximize-2.js
|
|
405
|
+
init_react_import();
|
|
406
|
+
var Maximize2 = createLucideIcon("Maximize2", [
|
|
407
|
+
["polyline", { points: "15 3 21 3 21 9", key: "mznyad" }],
|
|
408
|
+
["polyline", { points: "9 21 3 21 3 15", key: "1avn1i" }],
|
|
409
|
+
["line", { x1: "21", x2: "14", y1: "3", y2: "10", key: "ota7mn" }],
|
|
410
|
+
["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
|
|
411
|
+
]);
|
|
412
|
+
|
|
413
|
+
// ../../node_modules/lucide-react/dist/esm/icons/minimize-2.js
|
|
414
|
+
init_react_import();
|
|
415
|
+
var Minimize2 = createLucideIcon("Minimize2", [
|
|
416
|
+
["polyline", { points: "4 14 10 14 10 20", key: "11kfnr" }],
|
|
417
|
+
["polyline", { points: "20 10 14 10 14 4", key: "rlmsce" }],
|
|
418
|
+
["line", { x1: "14", x2: "21", y1: "10", y2: "3", key: "o5lafz" }],
|
|
419
|
+
["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
|
|
420
|
+
]);
|
|
421
|
+
|
|
374
422
|
// ../../node_modules/lucide-react/dist/esm/icons/minus.js
|
|
375
423
|
init_react_import();
|
|
376
424
|
var Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
|
|
@@ -423,6 +471,15 @@ var Quote = createLucideIcon("Quote", [
|
|
|
423
471
|
]
|
|
424
472
|
]);
|
|
425
473
|
|
|
474
|
+
// ../../node_modules/lucide-react/dist/esm/icons/rectangle-ellipsis.js
|
|
475
|
+
init_react_import();
|
|
476
|
+
var RectangleEllipsis = createLucideIcon("RectangleEllipsis", [
|
|
477
|
+
["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }],
|
|
478
|
+
["path", { d: "M12 12h.01", key: "1mp3jc" }],
|
|
479
|
+
["path", { d: "M17 12h.01", key: "1m0b6t" }],
|
|
480
|
+
["path", { d: "M7 12h.01", key: "eqddd0" }]
|
|
481
|
+
]);
|
|
482
|
+
|
|
426
483
|
// ../../node_modules/lucide-react/dist/esm/icons/redo-2.js
|
|
427
484
|
init_react_import();
|
|
428
485
|
var Redo2 = createLucideIcon("Redo2", [
|
|
@@ -481,6 +538,14 @@ var Tablet = createLucideIcon("Tablet", [
|
|
|
481
538
|
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
|
482
539
|
]);
|
|
483
540
|
|
|
541
|
+
// ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
|
|
542
|
+
init_react_import();
|
|
543
|
+
var ToyBrick = createLucideIcon("ToyBrick", [
|
|
544
|
+
["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
|
|
545
|
+
["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
|
|
546
|
+
["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
|
|
547
|
+
]);
|
|
548
|
+
|
|
484
549
|
// ../../node_modules/lucide-react/dist/esm/icons/trash.js
|
|
485
550
|
init_react_import();
|
|
486
551
|
var Trash = createLucideIcon("Trash", [
|
|
@@ -511,6 +576,13 @@ var Undo2 = createLucideIcon("Undo2", [
|
|
|
511
576
|
["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
|
|
512
577
|
]);
|
|
513
578
|
|
|
579
|
+
// ../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
580
|
+
init_react_import();
|
|
581
|
+
var X = createLucideIcon("X", [
|
|
582
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
583
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
584
|
+
]);
|
|
585
|
+
|
|
514
586
|
// ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
|
|
515
587
|
init_react_import();
|
|
516
588
|
var ZoomIn = createLucideIcon("ZoomIn", [
|
|
@@ -530,515 +602,6 @@ var ZoomOut = createLucideIcon("ZoomOut", [
|
|
|
530
602
|
|
|
531
603
|
// store/index.ts
|
|
532
604
|
init_react_import();
|
|
533
|
-
|
|
534
|
-
// reducer/index.ts
|
|
535
|
-
init_react_import();
|
|
536
|
-
|
|
537
|
-
// reducer/actions/set.ts
|
|
538
|
-
init_react_import();
|
|
539
|
-
var setAction = (state, action, appStore) => {
|
|
540
|
-
if (typeof action.state === "object") {
|
|
541
|
-
const newState = __spreadValues(__spreadValues({}, state), action.state);
|
|
542
|
-
if (action.state.indexes) {
|
|
543
|
-
return newState;
|
|
544
|
-
}
|
|
545
|
-
console.warn(
|
|
546
|
-
"`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
|
547
|
-
);
|
|
548
|
-
return walkAppState(newState, appStore.config);
|
|
549
|
-
}
|
|
550
|
-
return __spreadValues(__spreadValues({}, state), action.state(state));
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
// reducer/actions/insert.ts
|
|
554
|
-
init_react_import();
|
|
555
|
-
|
|
556
|
-
// lib/data/insert.ts
|
|
557
|
-
init_react_import();
|
|
558
|
-
var insert = (list, index, item) => {
|
|
559
|
-
const result = Array.from(list || []);
|
|
560
|
-
result.splice(index, 0, item);
|
|
561
|
-
return result;
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
// lib/generate-id.ts
|
|
565
|
-
init_react_import();
|
|
566
|
-
import { v4 as uuidv4 } from "uuid";
|
|
567
|
-
var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
|
|
568
|
-
|
|
569
|
-
// lib/data/get-ids-for-parent.ts
|
|
570
|
-
init_react_import();
|
|
571
|
-
var getIdsForParent = (zoneCompound, state) => {
|
|
572
|
-
const [parentId] = zoneCompound.split(":");
|
|
573
|
-
const node = state.indexes.nodes[parentId];
|
|
574
|
-
return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
// lib/data/populate-ids.ts
|
|
578
|
-
init_react_import();
|
|
579
|
-
var populateIds = (data, config, override = false) => {
|
|
580
|
-
const id = generateId(data.type);
|
|
581
|
-
return walkTree(
|
|
582
|
-
__spreadProps(__spreadValues({}, data), {
|
|
583
|
-
props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
|
|
584
|
-
}),
|
|
585
|
-
config,
|
|
586
|
-
(contents) => contents.map((item) => {
|
|
587
|
-
const id2 = generateId(item.type);
|
|
588
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
589
|
-
props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
|
|
590
|
-
});
|
|
591
|
-
})
|
|
592
|
-
);
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
// reducer/actions/insert.ts
|
|
596
|
-
function insertAction(state, action, appStore) {
|
|
597
|
-
const id = action.id || generateId(action.componentType);
|
|
598
|
-
const emptyComponentData = populateIds(
|
|
599
|
-
{
|
|
600
|
-
type: action.componentType,
|
|
601
|
-
props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
|
|
602
|
-
id
|
|
603
|
-
})
|
|
604
|
-
},
|
|
605
|
-
appStore.config
|
|
606
|
-
);
|
|
607
|
-
const [parentId] = action.destinationZone.split(":");
|
|
608
|
-
const idsInPath = getIdsForParent(action.destinationZone, state);
|
|
609
|
-
return walkAppState(
|
|
610
|
-
state,
|
|
611
|
-
appStore.config,
|
|
612
|
-
(content, zoneCompound) => {
|
|
613
|
-
if (zoneCompound === action.destinationZone) {
|
|
614
|
-
return insert(
|
|
615
|
-
content || [],
|
|
616
|
-
action.destinationIndex,
|
|
617
|
-
emptyComponentData
|
|
618
|
-
);
|
|
619
|
-
}
|
|
620
|
-
return content;
|
|
621
|
-
},
|
|
622
|
-
(childItem, path) => {
|
|
623
|
-
if (childItem.props.id === id || childItem.props.id === parentId) {
|
|
624
|
-
return childItem;
|
|
625
|
-
} else if (idsInPath.includes(childItem.props.id)) {
|
|
626
|
-
return childItem;
|
|
627
|
-
} else if (path.includes(action.destinationZone)) {
|
|
628
|
-
return childItem;
|
|
629
|
-
}
|
|
630
|
-
return null;
|
|
631
|
-
}
|
|
632
|
-
);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// reducer/actions/replace.ts
|
|
636
|
-
init_react_import();
|
|
637
|
-
var replaceAction = (state, action, appStore) => {
|
|
638
|
-
const [parentId] = action.destinationZone.split(":");
|
|
639
|
-
const idsInPath = getIdsForParent(action.destinationZone, state);
|
|
640
|
-
const originalId = state.indexes.zones[action.destinationZone].contentIds[action.destinationIndex];
|
|
641
|
-
const idChanged = originalId !== action.data.props.id;
|
|
642
|
-
if (idChanged) {
|
|
643
|
-
throw new Error(
|
|
644
|
-
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
const newSlotIds = [];
|
|
648
|
-
const data = walkTree(action.data, appStore.config, (contents, opts) => {
|
|
649
|
-
newSlotIds.push(`${opts.parentId}:${opts.propName}`);
|
|
650
|
-
return contents.map((item) => {
|
|
651
|
-
const id = generateId(item.type);
|
|
652
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
653
|
-
props: __spreadValues({ id }, item.props)
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
});
|
|
657
|
-
const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
|
|
658
|
-
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
659
|
-
});
|
|
660
|
-
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
|
661
|
-
const id = zoneCompound.split(":")[0];
|
|
662
|
-
if (id === originalId) {
|
|
663
|
-
if (!newSlotIds.includes(zoneCompound)) {
|
|
664
|
-
delete stateWithDeepSlotsRemoved.indexes.zones[zoneCompound];
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
return walkAppState(
|
|
669
|
-
stateWithDeepSlotsRemoved,
|
|
670
|
-
appStore.config,
|
|
671
|
-
(content, zoneCompound) => {
|
|
672
|
-
const newContent = [...content];
|
|
673
|
-
if (zoneCompound === action.destinationZone) {
|
|
674
|
-
newContent[action.destinationIndex] = data;
|
|
675
|
-
}
|
|
676
|
-
return newContent;
|
|
677
|
-
},
|
|
678
|
-
(childItem, path) => {
|
|
679
|
-
const pathIds = path.map((p) => p.split(":")[0]);
|
|
680
|
-
if (childItem.props.id === data.props.id) {
|
|
681
|
-
return data;
|
|
682
|
-
} else if (childItem.props.id === parentId) {
|
|
683
|
-
return childItem;
|
|
684
|
-
} else if (idsInPath.indexOf(childItem.props.id) > -1) {
|
|
685
|
-
return childItem;
|
|
686
|
-
} else if (pathIds.indexOf(data.props.id) > -1) {
|
|
687
|
-
return childItem;
|
|
688
|
-
}
|
|
689
|
-
return null;
|
|
690
|
-
}
|
|
691
|
-
);
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
// reducer/actions/replace-root.ts
|
|
695
|
-
init_react_import();
|
|
696
|
-
var replaceRootAction = (state, action, appStore) => {
|
|
697
|
-
return walkAppState(
|
|
698
|
-
state,
|
|
699
|
-
appStore.config,
|
|
700
|
-
(content) => content,
|
|
701
|
-
(childItem) => {
|
|
702
|
-
if (childItem.props.id === "root") {
|
|
703
|
-
return __spreadProps(__spreadValues({}, childItem), {
|
|
704
|
-
props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
|
|
705
|
-
readOnly: action.root.readOnly
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
return childItem;
|
|
709
|
-
}
|
|
710
|
-
);
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
// reducer/actions/duplicate.ts
|
|
714
|
-
init_react_import();
|
|
715
|
-
|
|
716
|
-
// lib/data/get-item.ts
|
|
717
|
-
init_react_import();
|
|
718
|
-
function getItem(selector, state) {
|
|
719
|
-
var _a, _b;
|
|
720
|
-
const zone = (_a = state.indexes.zones) == null ? void 0 : _a[selector.zone || rootDroppableId];
|
|
721
|
-
return zone ? (_b = state.indexes.nodes[zone.contentIds[selector.index]]) == null ? void 0 : _b.data : void 0;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
// reducer/actions/duplicate.ts
|
|
725
|
-
function duplicateAction(state, action, appStore) {
|
|
726
|
-
const item = getItem(
|
|
727
|
-
{ index: action.sourceIndex, zone: action.sourceZone },
|
|
728
|
-
state
|
|
729
|
-
);
|
|
730
|
-
const idsInPath = getIdsForParent(action.sourceZone, state);
|
|
731
|
-
const newItem = __spreadProps(__spreadValues({}, item), {
|
|
732
|
-
props: __spreadProps(__spreadValues({}, item.props), {
|
|
733
|
-
id: generateId(item.type)
|
|
734
|
-
})
|
|
735
|
-
});
|
|
736
|
-
const modified = walkAppState(
|
|
737
|
-
state,
|
|
738
|
-
appStore.config,
|
|
739
|
-
(content, zoneCompound) => {
|
|
740
|
-
if (zoneCompound === action.sourceZone) {
|
|
741
|
-
return insert(content, action.sourceIndex + 1, item);
|
|
742
|
-
}
|
|
743
|
-
return content;
|
|
744
|
-
},
|
|
745
|
-
(childItem, path, index) => {
|
|
746
|
-
const zoneCompound = path[path.length - 1];
|
|
747
|
-
const parents = path.map((p) => p.split(":")[0]);
|
|
748
|
-
if (parents.indexOf(newItem.props.id) > -1) {
|
|
749
|
-
return __spreadProps(__spreadValues({}, childItem), {
|
|
750
|
-
props: __spreadProps(__spreadValues({}, childItem.props), {
|
|
751
|
-
id: generateId(childItem.type)
|
|
752
|
-
})
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
if (zoneCompound === action.sourceZone && index === action.sourceIndex + 1) {
|
|
756
|
-
return newItem;
|
|
757
|
-
}
|
|
758
|
-
const [sourceZoneParent] = action.sourceZone.split(":");
|
|
759
|
-
if (sourceZoneParent === childItem.props.id || idsInPath.indexOf(childItem.props.id) > -1) {
|
|
760
|
-
return childItem;
|
|
761
|
-
}
|
|
762
|
-
return null;
|
|
763
|
-
}
|
|
764
|
-
);
|
|
765
|
-
return __spreadProps(__spreadValues({}, modified), {
|
|
766
|
-
ui: __spreadProps(__spreadValues({}, modified.ui), {
|
|
767
|
-
itemSelector: {
|
|
768
|
-
index: action.sourceIndex + 1,
|
|
769
|
-
zone: action.sourceZone
|
|
770
|
-
}
|
|
771
|
-
})
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
// reducer/actions/reorder.ts
|
|
776
|
-
init_react_import();
|
|
777
|
-
|
|
778
|
-
// reducer/actions/move.ts
|
|
779
|
-
init_react_import();
|
|
780
|
-
|
|
781
|
-
// lib/data/remove.ts
|
|
782
|
-
init_react_import();
|
|
783
|
-
var remove = (list, index) => {
|
|
784
|
-
const result = Array.from(list);
|
|
785
|
-
result.splice(index, 1);
|
|
786
|
-
return result;
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
// reducer/actions/move.ts
|
|
790
|
-
var moveAction = (state, action, appStore) => {
|
|
791
|
-
if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
|
|
792
|
-
return state;
|
|
793
|
-
}
|
|
794
|
-
const item = getItem(
|
|
795
|
-
{ zone: action.sourceZone, index: action.sourceIndex },
|
|
796
|
-
state
|
|
797
|
-
);
|
|
798
|
-
if (!item) return state;
|
|
799
|
-
const idsInSourcePath = getIdsForParent(action.sourceZone, state);
|
|
800
|
-
const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
|
|
801
|
-
return walkAppState(
|
|
802
|
-
state,
|
|
803
|
-
appStore.config,
|
|
804
|
-
(content, zoneCompound) => {
|
|
805
|
-
if (zoneCompound === action.sourceZone && zoneCompound === action.destinationZone) {
|
|
806
|
-
return insert(
|
|
807
|
-
remove(content, action.sourceIndex),
|
|
808
|
-
action.destinationIndex,
|
|
809
|
-
item
|
|
810
|
-
);
|
|
811
|
-
} else if (zoneCompound === action.sourceZone) {
|
|
812
|
-
return remove(content, action.sourceIndex);
|
|
813
|
-
} else if (zoneCompound === action.destinationZone) {
|
|
814
|
-
return insert(content, action.destinationIndex, item);
|
|
815
|
-
}
|
|
816
|
-
return content;
|
|
817
|
-
},
|
|
818
|
-
(childItem, path) => {
|
|
819
|
-
const [sourceZoneParent] = action.sourceZone.split(":");
|
|
820
|
-
const [destinationZoneParent] = action.destinationZone.split(":");
|
|
821
|
-
const childId = childItem.props.id;
|
|
822
|
-
if (sourceZoneParent === childId || destinationZoneParent === childId || item.props.id === childId || idsInSourcePath.indexOf(childId) > -1 || idsInDestinationPath.indexOf(childId) > -1 || path.includes(action.destinationZone)) {
|
|
823
|
-
return childItem;
|
|
824
|
-
}
|
|
825
|
-
return null;
|
|
826
|
-
}
|
|
827
|
-
);
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
// reducer/actions/reorder.ts
|
|
831
|
-
var reorderAction = (state, action, appStore) => {
|
|
832
|
-
return moveAction(
|
|
833
|
-
state,
|
|
834
|
-
{
|
|
835
|
-
type: "move",
|
|
836
|
-
sourceIndex: action.sourceIndex,
|
|
837
|
-
sourceZone: action.destinationZone,
|
|
838
|
-
destinationIndex: action.destinationIndex,
|
|
839
|
-
destinationZone: action.destinationZone
|
|
840
|
-
},
|
|
841
|
-
appStore
|
|
842
|
-
);
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
// reducer/actions/remove.ts
|
|
846
|
-
init_react_import();
|
|
847
|
-
var removeAction = (state, action, appStore) => {
|
|
848
|
-
const item = getItem({ index: action.index, zone: action.zone }, state);
|
|
849
|
-
const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
|
|
850
|
-
(acc, [nodeId, nodeData]) => {
|
|
851
|
-
const pathIds = nodeData.path.map((p) => p.split(":")[0]);
|
|
852
|
-
if (pathIds.includes(item.props.id)) {
|
|
853
|
-
return [...acc, nodeId];
|
|
854
|
-
}
|
|
855
|
-
return acc;
|
|
856
|
-
},
|
|
857
|
-
[item.props.id]
|
|
858
|
-
);
|
|
859
|
-
const newState = walkAppState(
|
|
860
|
-
state,
|
|
861
|
-
appStore.config,
|
|
862
|
-
(content, zoneCompound) => {
|
|
863
|
-
if (zoneCompound === action.zone) {
|
|
864
|
-
return remove(content, action.index);
|
|
865
|
-
}
|
|
866
|
-
return content;
|
|
867
|
-
}
|
|
868
|
-
);
|
|
869
|
-
Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
|
|
870
|
-
const parentId = zoneCompound.split(":")[0];
|
|
871
|
-
if (nodesToDelete.includes(parentId) && newState.data.zones) {
|
|
872
|
-
delete newState.data.zones[zoneCompound];
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
|
|
876
|
-
const parentId = zoneCompound.split(":")[0];
|
|
877
|
-
if (nodesToDelete.includes(parentId)) {
|
|
878
|
-
delete newState.indexes.zones[zoneCompound];
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
nodesToDelete.forEach((id) => {
|
|
882
|
-
delete newState.indexes.nodes[id];
|
|
883
|
-
});
|
|
884
|
-
return newState;
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
// reducer/actions/register-zone.ts
|
|
888
|
-
init_react_import();
|
|
889
|
-
var zoneCache = {};
|
|
890
|
-
function registerZoneAction(state, action) {
|
|
891
|
-
if (zoneCache[action.zone]) {
|
|
892
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
893
|
-
data: __spreadProps(__spreadValues({}, state.data), {
|
|
894
|
-
zones: __spreadProps(__spreadValues({}, state.data.zones), {
|
|
895
|
-
[action.zone]: zoneCache[action.zone]
|
|
896
|
-
})
|
|
897
|
-
}),
|
|
898
|
-
indexes: __spreadProps(__spreadValues({}, state.indexes), {
|
|
899
|
-
zones: __spreadProps(__spreadValues({}, state.indexes.zones), {
|
|
900
|
-
[action.zone]: __spreadProps(__spreadValues({}, state.indexes.zones[action.zone]), {
|
|
901
|
-
contentIds: zoneCache[action.zone].map((item) => item.props.id),
|
|
902
|
-
type: "dropzone"
|
|
903
|
-
})
|
|
904
|
-
})
|
|
905
|
-
})
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
return __spreadProps(__spreadValues({}, state), { data: setupZone(state.data, action.zone) });
|
|
909
|
-
}
|
|
910
|
-
function unregisterZoneAction(state, action) {
|
|
911
|
-
const _zones = __spreadValues({}, state.data.zones || {});
|
|
912
|
-
const zoneIndex = __spreadValues({}, state.indexes.zones || {});
|
|
913
|
-
if (_zones[action.zone]) {
|
|
914
|
-
zoneCache[action.zone] = _zones[action.zone];
|
|
915
|
-
delete _zones[action.zone];
|
|
916
|
-
}
|
|
917
|
-
delete zoneIndex[action.zone];
|
|
918
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
919
|
-
data: __spreadProps(__spreadValues({}, state.data), {
|
|
920
|
-
zones: _zones
|
|
921
|
-
}),
|
|
922
|
-
indexes: __spreadProps(__spreadValues({}, state.indexes), {
|
|
923
|
-
zones: zoneIndex
|
|
924
|
-
})
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
// reducer/actions/set-data.ts
|
|
929
|
-
init_react_import();
|
|
930
|
-
var setDataAction = (state, action, appStore) => {
|
|
931
|
-
if (typeof action.data === "object") {
|
|
932
|
-
console.warn(
|
|
933
|
-
"`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
|
934
|
-
);
|
|
935
|
-
return walkAppState(
|
|
936
|
-
__spreadProps(__spreadValues({}, state), {
|
|
937
|
-
data: __spreadValues(__spreadValues({}, state.data), action.data)
|
|
938
|
-
}),
|
|
939
|
-
appStore.config
|
|
940
|
-
);
|
|
941
|
-
}
|
|
942
|
-
return walkAppState(
|
|
943
|
-
__spreadProps(__spreadValues({}, state), {
|
|
944
|
-
data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
|
|
945
|
-
}),
|
|
946
|
-
appStore.config
|
|
947
|
-
);
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
// reducer/actions/set-ui.ts
|
|
951
|
-
init_react_import();
|
|
952
|
-
var setUiAction = (state, action) => {
|
|
953
|
-
if (typeof action.ui === "object") {
|
|
954
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
955
|
-
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
959
|
-
ui: __spreadValues(__spreadValues({}, state.ui), action.ui(state.ui))
|
|
960
|
-
});
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
// lib/data/make-state-public.ts
|
|
964
|
-
init_react_import();
|
|
965
|
-
var makeStatePublic = (state) => {
|
|
966
|
-
const { data, ui } = state;
|
|
967
|
-
return { data, ui };
|
|
968
|
-
};
|
|
969
|
-
|
|
970
|
-
// reducer/actions.tsx
|
|
971
|
-
init_react_import();
|
|
972
|
-
|
|
973
|
-
// reducer/index.ts
|
|
974
|
-
function storeInterceptor(reducer, record, onAction) {
|
|
975
|
-
return (state, action) => {
|
|
976
|
-
const newAppState = reducer(state, action);
|
|
977
|
-
const isValidType = ![
|
|
978
|
-
"registerZone",
|
|
979
|
-
"unregisterZone",
|
|
980
|
-
"setData",
|
|
981
|
-
"setUi",
|
|
982
|
-
"set"
|
|
983
|
-
].includes(action.type);
|
|
984
|
-
if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
|
|
985
|
-
if (record) record(newAppState);
|
|
986
|
-
}
|
|
987
|
-
onAction == null ? void 0 : onAction(action, makeStatePublic(newAppState), makeStatePublic(state));
|
|
988
|
-
return newAppState;
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
function createReducer({
|
|
992
|
-
record,
|
|
993
|
-
onAction,
|
|
994
|
-
appStore
|
|
995
|
-
}) {
|
|
996
|
-
return storeInterceptor(
|
|
997
|
-
(state, action) => {
|
|
998
|
-
if (action.type === "set") {
|
|
999
|
-
return setAction(state, action, appStore);
|
|
1000
|
-
}
|
|
1001
|
-
if (action.type === "insert") {
|
|
1002
|
-
return insertAction(state, action, appStore);
|
|
1003
|
-
}
|
|
1004
|
-
if (action.type === "replace") {
|
|
1005
|
-
return replaceAction(state, action, appStore);
|
|
1006
|
-
}
|
|
1007
|
-
if (action.type === "replaceRoot") {
|
|
1008
|
-
return replaceRootAction(state, action, appStore);
|
|
1009
|
-
}
|
|
1010
|
-
if (action.type === "duplicate") {
|
|
1011
|
-
return duplicateAction(state, action, appStore);
|
|
1012
|
-
}
|
|
1013
|
-
if (action.type === "reorder") {
|
|
1014
|
-
return reorderAction(state, action, appStore);
|
|
1015
|
-
}
|
|
1016
|
-
if (action.type === "move") {
|
|
1017
|
-
return moveAction(state, action, appStore);
|
|
1018
|
-
}
|
|
1019
|
-
if (action.type === "remove") {
|
|
1020
|
-
return removeAction(state, action, appStore);
|
|
1021
|
-
}
|
|
1022
|
-
if (action.type === "registerZone") {
|
|
1023
|
-
return registerZoneAction(state, action);
|
|
1024
|
-
}
|
|
1025
|
-
if (action.type === "unregisterZone") {
|
|
1026
|
-
return unregisterZoneAction(state, action);
|
|
1027
|
-
}
|
|
1028
|
-
if (action.type === "setData") {
|
|
1029
|
-
return setDataAction(state, action, appStore);
|
|
1030
|
-
}
|
|
1031
|
-
if (action.type === "setUi") {
|
|
1032
|
-
return setUiAction(state, action);
|
|
1033
|
-
}
|
|
1034
|
-
return state;
|
|
1035
|
-
},
|
|
1036
|
-
record,
|
|
1037
|
-
onAction
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
// store/index.ts
|
|
1042
605
|
import { create as create2, useStore } from "zustand";
|
|
1043
606
|
import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
|
|
1044
607
|
import { createContext, useContext } from "react";
|
|
@@ -1596,6 +1159,7 @@ var createAppStore = (initialAppStore) => create2()(
|
|
|
1596
1159
|
subscribeWithSelector2((set, get) => {
|
|
1597
1160
|
var _a, _b;
|
|
1598
1161
|
return __spreadProps(__spreadValues({
|
|
1162
|
+
instanceId: generateId(),
|
|
1599
1163
|
state: defaultAppState,
|
|
1600
1164
|
config: { components: {} },
|
|
1601
1165
|
componentState: {},
|
|
@@ -1616,6 +1180,11 @@ var createAppStore = (initialAppStore) => create2()(
|
|
|
1616
1180
|
history: createHistorySlice(set, get),
|
|
1617
1181
|
nodes: createNodesSlice(set, get),
|
|
1618
1182
|
permissions: createPermissionsSlice(set, get),
|
|
1183
|
+
getCurrentData: () => {
|
|
1184
|
+
var _a2;
|
|
1185
|
+
const s = get();
|
|
1186
|
+
return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
|
|
1187
|
+
},
|
|
1619
1188
|
getComponentConfig: (type) => {
|
|
1620
1189
|
var _a2;
|
|
1621
1190
|
const { config, selectedItem } = get();
|
|
@@ -1959,7 +1528,7 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
|
1959
1528
|
const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
|
|
1960
1529
|
let rootHeight = 0;
|
|
1961
1530
|
let autoZoom = 1;
|
|
1962
|
-
if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
|
|
1531
|
+
if (typeof uiViewport.width === "number" && (uiViewport.width > frameWidth || viewportHeight > frameHeight)) {
|
|
1963
1532
|
const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
|
|
1964
1533
|
const heightZoom = Math.min(frameHeight / viewportHeight, 1);
|
|
1965
1534
|
zoom = widthZoom;
|
|
@@ -2105,7 +1674,9 @@ export {
|
|
|
2105
1674
|
Copy,
|
|
2106
1675
|
CornerLeftUp,
|
|
2107
1676
|
EllipsisVertical,
|
|
1677
|
+
Expand,
|
|
2108
1678
|
Globe,
|
|
1679
|
+
Hammer,
|
|
2109
1680
|
Hash,
|
|
2110
1681
|
Heading1,
|
|
2111
1682
|
Heading2,
|
|
@@ -2122,12 +1693,15 @@ export {
|
|
|
2122
1693
|
List,
|
|
2123
1694
|
LockOpen,
|
|
2124
1695
|
Lock,
|
|
1696
|
+
Maximize2,
|
|
1697
|
+
Minimize2,
|
|
2125
1698
|
Minus,
|
|
2126
1699
|
Monitor,
|
|
2127
1700
|
PanelLeft,
|
|
2128
1701
|
PanelRight,
|
|
2129
1702
|
Plus,
|
|
2130
1703
|
Quote,
|
|
1704
|
+
RectangleEllipsis,
|
|
2131
1705
|
Redo2,
|
|
2132
1706
|
Search,
|
|
2133
1707
|
SlidersHorizontal,
|
|
@@ -2135,20 +1709,16 @@ export {
|
|
|
2135
1709
|
SquareCode,
|
|
2136
1710
|
Strikethrough,
|
|
2137
1711
|
Tablet,
|
|
1712
|
+
ToyBrick,
|
|
2138
1713
|
Trash,
|
|
2139
1714
|
Type,
|
|
2140
1715
|
Underline,
|
|
2141
1716
|
Undo2,
|
|
1717
|
+
X,
|
|
2142
1718
|
ZoomIn,
|
|
2143
1719
|
ZoomOut,
|
|
2144
1720
|
reorder,
|
|
2145
1721
|
replace,
|
|
2146
|
-
insert,
|
|
2147
|
-
generateId,
|
|
2148
|
-
populateIds,
|
|
2149
|
-
insertAction,
|
|
2150
|
-
getItem,
|
|
2151
|
-
makeStatePublic,
|
|
2152
1722
|
monitorHotkeys,
|
|
2153
1723
|
useMonitorHotkeys,
|
|
2154
1724
|
useHotkey,
|
|
@@ -2186,7 +1756,9 @@ lucide-react/dist/esm/icons/code.js:
|
|
|
2186
1756
|
lucide-react/dist/esm/icons/copy.js:
|
|
2187
1757
|
lucide-react/dist/esm/icons/corner-left-up.js:
|
|
2188
1758
|
lucide-react/dist/esm/icons/ellipsis-vertical.js:
|
|
1759
|
+
lucide-react/dist/esm/icons/expand.js:
|
|
2189
1760
|
lucide-react/dist/esm/icons/globe.js:
|
|
1761
|
+
lucide-react/dist/esm/icons/hammer.js:
|
|
2190
1762
|
lucide-react/dist/esm/icons/hash.js:
|
|
2191
1763
|
lucide-react/dist/esm/icons/heading-1.js:
|
|
2192
1764
|
lucide-react/dist/esm/icons/heading-2.js:
|
|
@@ -2201,12 +1773,15 @@ lucide-react/dist/esm/icons/link.js:
|
|
|
2201
1773
|
lucide-react/dist/esm/icons/list-ordered.js:
|
|
2202
1774
|
lucide-react/dist/esm/icons/lock-open.js:
|
|
2203
1775
|
lucide-react/dist/esm/icons/lock.js:
|
|
1776
|
+
lucide-react/dist/esm/icons/maximize-2.js:
|
|
1777
|
+
lucide-react/dist/esm/icons/minimize-2.js:
|
|
2204
1778
|
lucide-react/dist/esm/icons/minus.js:
|
|
2205
1779
|
lucide-react/dist/esm/icons/monitor.js:
|
|
2206
1780
|
lucide-react/dist/esm/icons/panel-left.js:
|
|
2207
1781
|
lucide-react/dist/esm/icons/panel-right.js:
|
|
2208
1782
|
lucide-react/dist/esm/icons/plus.js:
|
|
2209
1783
|
lucide-react/dist/esm/icons/quote.js:
|
|
1784
|
+
lucide-react/dist/esm/icons/rectangle-ellipsis.js:
|
|
2210
1785
|
lucide-react/dist/esm/icons/redo-2.js:
|
|
2211
1786
|
lucide-react/dist/esm/icons/search.js:
|
|
2212
1787
|
lucide-react/dist/esm/icons/sliders-horizontal.js:
|
|
@@ -2214,10 +1789,12 @@ lucide-react/dist/esm/icons/smartphone.js:
|
|
|
2214
1789
|
lucide-react/dist/esm/icons/square-code.js:
|
|
2215
1790
|
lucide-react/dist/esm/icons/strikethrough.js:
|
|
2216
1791
|
lucide-react/dist/esm/icons/tablet.js:
|
|
1792
|
+
lucide-react/dist/esm/icons/toy-brick.js:
|
|
2217
1793
|
lucide-react/dist/esm/icons/trash.js:
|
|
2218
1794
|
lucide-react/dist/esm/icons/type.js:
|
|
2219
1795
|
lucide-react/dist/esm/icons/underline.js:
|
|
2220
1796
|
lucide-react/dist/esm/icons/undo-2.js:
|
|
1797
|
+
lucide-react/dist/esm/icons/x.js:
|
|
2221
1798
|
lucide-react/dist/esm/icons/zoom-in.js:
|
|
2222
1799
|
lucide-react/dist/esm/icons/zoom-out.js:
|
|
2223
1800
|
lucide-react/dist/esm/lucide-react.js:
|