@puckeditor/core 0.21.2-canary.edc81920 → 0.21.2
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-JHS34JLP.mjs → Editor-EPSED64A.mjs} +6 -6
- package/dist/{actions-BRYM0ifH.d.mts → actions-C3e2nJ9v.d.mts} +1 -1
- package/dist/{actions-BRYM0ifH.d.ts → actions-C3e2nJ9v.d.ts} +1 -1
- package/dist/{chunk-AFOEZCNE.mjs → chunk-22UJFAFA.mjs} +35 -37
- package/dist/{chunk-JGZBBNEW.mjs → chunk-BCL7VBTL.mjs} +1 -1
- package/dist/{chunk-46RDHJGL.mjs → chunk-G74MZKKD.mjs} +7 -7
- package/dist/{chunk-BSAENBPL.mjs → chunk-K23YHISE.mjs} +1 -1
- package/dist/{chunk-LBGOSTI5.mjs → chunk-PK2F2YZX.mjs} +1128 -633
- package/dist/{chunk-TVE6QYBR.mjs → chunk-U6THAD4G.mjs} +1 -1
- package/dist/{chunk-GYDP2UKB.mjs → chunk-WCC2G7U7.mjs} +3 -3
- package/dist/{full-ATSD2DNB.mjs → full-N67EAB2Q.mjs} +5 -5
- package/dist/{index-D_Idfrfb.d.ts → index-Cx46WIFC.d.ts} +9 -10
- package/dist/{index-BVLGipsj.d.mts → index-zHrchQGY.d.mts} +9 -10
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1192 -717
- package/dist/index.mjs +7 -7
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-BKAMJ2FS.mjs → loaded-F37CNCVG.mjs} +2 -2
- package/dist/{loaded-2765LE3N.mjs → loaded-H325ZSK5.mjs} +2 -2
- package/dist/{loaded-ANEJLSYJ.mjs → loaded-MIY725CK.mjs} +2 -2
- package/dist/no-external.d.mts +3 -3
- package/dist/no-external.d.ts +3 -3
- package/dist/no-external.js +1192 -717
- package/dist/no-external.mjs +7 -7
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +42 -24
- package/dist/rsc.mjs +42 -24
- package/dist/{walk-tree-C1Zdgx7d.d.mts → walk-tree-BJoNgZ0l.d.mts} +1 -1
- package/dist/{walk-tree-DQyC1GA7.d.ts → walk-tree-f8Yzs5o3.d.ts} +1 -1
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorInner,
|
|
3
3
|
LoadedRichTextMenu
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WCC2G7U7.mjs";
|
|
5
5
|
import {
|
|
6
6
|
RichTextRenderFallback,
|
|
7
7
|
SlotRender,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
IconButton,
|
|
17
17
|
LoadedRichTextMenuInner,
|
|
18
18
|
Loader
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-G74MZKKD.mjs";
|
|
20
20
|
import {
|
|
21
21
|
ChevronDown,
|
|
22
22
|
ChevronRight,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
useRegisterHistorySlice,
|
|
69
69
|
useRegisterPermissionsSlice,
|
|
70
70
|
useResetAutoZoom
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-22UJFAFA.mjs";
|
|
72
72
|
import {
|
|
73
73
|
getItem,
|
|
74
74
|
insert,
|
|
@@ -1368,10 +1368,13 @@ var useLocalValue = (path, onChange) => {
|
|
|
1368
1368
|
const value = useDeepField(path);
|
|
1369
1369
|
const isFocused = useIsFocused(path);
|
|
1370
1370
|
const [localValue, setLocalValue] = useState5(value == null ? void 0 : value.toString());
|
|
1371
|
-
const onChangeLocal = useCallback2(
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1371
|
+
const onChangeLocal = useCallback2(
|
|
1372
|
+
(val) => {
|
|
1373
|
+
setLocalValue(val);
|
|
1374
|
+
onChange(val);
|
|
1375
|
+
},
|
|
1376
|
+
[onChange]
|
|
1377
|
+
);
|
|
1375
1378
|
useEffect3(() => {
|
|
1376
1379
|
if (!isFocused) {
|
|
1377
1380
|
setLocalValue(value);
|
|
@@ -1988,7 +1991,7 @@ EditorFallback.displayName = "EditorFallback";
|
|
|
1988
1991
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
1989
1992
|
import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
|
|
1990
1993
|
var Editor = lazy(
|
|
1991
|
-
() => import("./Editor-
|
|
1994
|
+
() => import("./Editor-EPSED64A.mjs").then((m) => ({
|
|
1992
1995
|
default: m.Editor
|
|
1993
1996
|
}))
|
|
1994
1997
|
);
|
|
@@ -2290,11 +2293,11 @@ init_react_import();
|
|
|
2290
2293
|
import {
|
|
2291
2294
|
forwardRef,
|
|
2292
2295
|
memo as memo7,
|
|
2293
|
-
useCallback as
|
|
2294
|
-
useContext as
|
|
2296
|
+
useCallback as useCallback13,
|
|
2297
|
+
useContext as useContext9,
|
|
2295
2298
|
useEffect as useEffect16,
|
|
2296
|
-
useMemo as
|
|
2297
|
-
useRef as
|
|
2299
|
+
useMemo as useMemo12,
|
|
2300
|
+
useRef as useRef9
|
|
2298
2301
|
} from "react";
|
|
2299
2302
|
|
|
2300
2303
|
// components/DraggableComponent/index.tsx
|
|
@@ -2302,10 +2305,11 @@ init_react_import();
|
|
|
2302
2305
|
import {
|
|
2303
2306
|
useCallback as useCallback7,
|
|
2304
2307
|
useContext as useContext5,
|
|
2305
|
-
useEffect as
|
|
2308
|
+
useEffect as useEffect8,
|
|
2309
|
+
useLayoutEffect,
|
|
2306
2310
|
useMemo as useMemo7,
|
|
2307
2311
|
useRef as useRef2,
|
|
2308
|
-
useState as
|
|
2312
|
+
useState as useState9,
|
|
2309
2313
|
useTransition
|
|
2310
2314
|
} from "react";
|
|
2311
2315
|
|
|
@@ -2354,7 +2358,12 @@ var ZoneStoreContext = createContext3(
|
|
|
2354
2358
|
draggedItem: null,
|
|
2355
2359
|
previewIndex: {},
|
|
2356
2360
|
enabledIndex: {},
|
|
2357
|
-
hoveringComponent: null
|
|
2361
|
+
hoveringComponent: null,
|
|
2362
|
+
registerRootVirtualizer: () => {
|
|
2363
|
+
},
|
|
2364
|
+
unregisterRootVirtualizer: () => {
|
|
2365
|
+
},
|
|
2366
|
+
scrollToComponent: () => false
|
|
2358
2367
|
}))
|
|
2359
2368
|
);
|
|
2360
2369
|
var ZoneStoreProvider = ({
|
|
@@ -2390,21 +2399,6 @@ var DropZoneProvider = ({
|
|
|
2390
2399
|
import { useShallow as useShallow4 } from "zustand/react/shallow";
|
|
2391
2400
|
import { useSortable as useSortable2 } from "@dnd-kit/react/sortable";
|
|
2392
2401
|
|
|
2393
|
-
// lib/accumulate-transform.ts
|
|
2394
|
-
init_react_import();
|
|
2395
|
-
function accumulateTransform(el) {
|
|
2396
|
-
let matrix = new DOMMatrixReadOnly();
|
|
2397
|
-
let n = el.parentElement;
|
|
2398
|
-
while (n && n !== document.documentElement) {
|
|
2399
|
-
const t = getComputedStyle(n).transform;
|
|
2400
|
-
if (t && t !== "none") {
|
|
2401
|
-
matrix = new DOMMatrixReadOnly(t).multiply(matrix);
|
|
2402
|
-
}
|
|
2403
|
-
n = n.parentElement;
|
|
2404
|
-
}
|
|
2405
|
-
return { scaleX: matrix.a, scaleY: matrix.d };
|
|
2406
|
-
}
|
|
2407
|
-
|
|
2408
2402
|
// lib/dnd/use-on-drag-finished.ts
|
|
2409
2403
|
init_react_import();
|
|
2410
2404
|
import { useCallback as useCallback6 } from "react";
|
|
@@ -2437,10 +2431,26 @@ var useOnDragFinished = (cb, deps = []) => {
|
|
|
2437
2431
|
}, [appStore, ...deps]);
|
|
2438
2432
|
};
|
|
2439
2433
|
|
|
2434
|
+
// lib/assign-refs.ts
|
|
2435
|
+
init_react_import();
|
|
2436
|
+
function assignRef(ref, node) {
|
|
2437
|
+
if (typeof ref === "function") {
|
|
2438
|
+
ref(node);
|
|
2439
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
2440
|
+
ref.current = node;
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
function assignRefs(refs, node) {
|
|
2444
|
+
refs.forEach((ref) => {
|
|
2445
|
+
assignRef(ref, node);
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2440
2449
|
// components/DraggableComponent/index.tsx
|
|
2441
2450
|
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2442
2451
|
var getClassName14 = get_class_name_factory_default("DraggableComponent", styles_module_default8);
|
|
2443
2452
|
var DEBUG2 = false;
|
|
2453
|
+
var MEASURE_EVERY_MS = 100;
|
|
2444
2454
|
var space = 8;
|
|
2445
2455
|
var actionsOverlayTop = space * 6.5;
|
|
2446
2456
|
var actionsTop = -(actionsOverlayTop - 8);
|
|
@@ -2472,7 +2482,8 @@ var DraggableComponent = ({
|
|
|
2472
2482
|
label,
|
|
2473
2483
|
autoDragAxis,
|
|
2474
2484
|
userDragAxis,
|
|
2475
|
-
inDroppableZone = true
|
|
2485
|
+
inDroppableZone = true,
|
|
2486
|
+
itemRef
|
|
2476
2487
|
}) => {
|
|
2477
2488
|
const zoom = useAppStore(
|
|
2478
2489
|
(s) => {
|
|
@@ -2480,11 +2491,15 @@ var DraggableComponent = ({
|
|
|
2480
2491
|
return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) === id ? s.zoomConfig.zoom : 1;
|
|
2481
2492
|
}
|
|
2482
2493
|
);
|
|
2494
|
+
const _experimentalFullScreenCanvas = useAppStore(
|
|
2495
|
+
(s) => s._experimentalFullScreenCanvas
|
|
2496
|
+
);
|
|
2483
2497
|
const overrides = useAppStore((s) => s.overrides);
|
|
2484
2498
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
2485
2499
|
const iframe = useAppStore((s) => s.iframe);
|
|
2500
|
+
const lastMeasureRef = useRef2(0);
|
|
2486
2501
|
const ctx = useContext5(dropZoneContext);
|
|
2487
|
-
const [localZones, setLocalZones] =
|
|
2502
|
+
const [localZones, setLocalZones] = useState9({});
|
|
2488
2503
|
const registerLocalZone = useCallback7(
|
|
2489
2504
|
(zoneCompound2, active) => {
|
|
2490
2505
|
var _a;
|
|
@@ -2519,7 +2534,7 @@ var DraggableComponent = ({
|
|
|
2519
2534
|
})
|
|
2520
2535
|
);
|
|
2521
2536
|
const zoneStore = useContext5(ZoneStoreContext);
|
|
2522
|
-
const [dragAxis, setDragAxis] =
|
|
2537
|
+
const [dragAxis, setDragAxis] = useState9(userDragAxis || autoDragAxis);
|
|
2523
2538
|
const dynamicCollisionDetector = useMemo7(
|
|
2524
2539
|
() => createDynamicCollisionDetector(dragAxis),
|
|
2525
2540
|
[dragAxis]
|
|
@@ -2552,7 +2567,7 @@ var DraggableComponent = ({
|
|
|
2552
2567
|
},
|
|
2553
2568
|
feedback: "clone"
|
|
2554
2569
|
});
|
|
2555
|
-
|
|
2570
|
+
useEffect8(() => {
|
|
2556
2571
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
2557
2572
|
sortable.droppable.disabled = !isEnabled;
|
|
2558
2573
|
sortable.draggable.disabled = !permissions.drag;
|
|
@@ -2569,7 +2584,7 @@ var DraggableComponent = ({
|
|
|
2569
2584
|
}
|
|
2570
2585
|
return cleanup;
|
|
2571
2586
|
}, [permissions.drag, zoneCompound]);
|
|
2572
|
-
const [, setRerender] =
|
|
2587
|
+
const [, setRerender] = useState9(0);
|
|
2573
2588
|
const ref = useRef2(null);
|
|
2574
2589
|
const refSetter = useCallback7(
|
|
2575
2590
|
(el) => {
|
|
@@ -2577,79 +2592,111 @@ var DraggableComponent = ({
|
|
|
2577
2592
|
if (ref.current !== el) {
|
|
2578
2593
|
ref.current = el;
|
|
2579
2594
|
setRerender((update) => update + 1);
|
|
2595
|
+
if (itemRef) {
|
|
2596
|
+
assignRefs([itemRef], el);
|
|
2597
|
+
}
|
|
2580
2598
|
}
|
|
2581
2599
|
},
|
|
2582
|
-
[sortableRef]
|
|
2600
|
+
[itemRef, sortableRef]
|
|
2583
2601
|
);
|
|
2584
|
-
const [portalEl, setPortalEl] =
|
|
2585
|
-
|
|
2602
|
+
const [portalEl, setPortalEl] = useState9();
|
|
2603
|
+
useEffect8(() => {
|
|
2586
2604
|
var _a, _b, _c;
|
|
2587
2605
|
setPortalEl(
|
|
2588
2606
|
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
|
|
2589
2607
|
);
|
|
2590
|
-
}, [iframe.enabled
|
|
2608
|
+
}, [iframe.enabled]);
|
|
2591
2609
|
const getStyle = useCallback7(() => {
|
|
2592
|
-
var _a, _b
|
|
2610
|
+
var _a, _b;
|
|
2593
2611
|
if (!ref.current) return;
|
|
2594
|
-
const
|
|
2595
|
-
const
|
|
2596
|
-
const portalContainerEl = iframe.enabled ? null :
|
|
2612
|
+
const el = ref.current;
|
|
2613
|
+
const rect = el.getBoundingClientRect();
|
|
2614
|
+
const portalContainerEl = iframe.enabled ? null : el.closest("[data-puck-preview]");
|
|
2615
|
+
const targetIsFixed = (() => {
|
|
2616
|
+
let node = el;
|
|
2617
|
+
while (node && node !== document.documentElement) {
|
|
2618
|
+
if (getComputedStyle(node).position === "fixed") {
|
|
2619
|
+
return true;
|
|
2620
|
+
}
|
|
2621
|
+
node = node.parentElement;
|
|
2622
|
+
}
|
|
2623
|
+
return false;
|
|
2624
|
+
})();
|
|
2597
2625
|
const portalContainerRect = portalContainerEl == null ? void 0 : portalContainerEl.getBoundingClientRect();
|
|
2598
2626
|
const portalScroll = portalContainerEl ? getDeepScrollPosition(portalContainerEl) : { x: 0, y: 0 };
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
const untransformed = {
|
|
2604
|
-
height: ref.current.offsetHeight,
|
|
2605
|
-
width: ref.current.offsetWidth
|
|
2627
|
+
const deepScrollPosition = targetIsFixed ? { x: 0, y: 0 } : getDeepScrollPosition(el);
|
|
2628
|
+
const scroll = targetIsFixed ? { x: 0, y: 0 } : {
|
|
2629
|
+
x: deepScrollPosition.x - portalScroll.x - ((_a = portalContainerRect == null ? void 0 : portalContainerRect.left) != null ? _a : 0),
|
|
2630
|
+
y: deepScrollPosition.y - portalScroll.y - ((_b = portalContainerRect == null ? void 0 : portalContainerRect.top) != null ? _b : 0)
|
|
2606
2631
|
};
|
|
2607
|
-
const transform = accumulateTransform(ref.current);
|
|
2608
2632
|
const style2 = {
|
|
2609
|
-
left: `${
|
|
2610
|
-
top: `${
|
|
2611
|
-
height: `${
|
|
2612
|
-
width: `${
|
|
2633
|
+
left: `${rect.left + scroll.x}px`,
|
|
2634
|
+
top: `${rect.top + scroll.y}px`,
|
|
2635
|
+
height: `${rect.height}px`,
|
|
2636
|
+
width: `${rect.width}px`,
|
|
2637
|
+
position: targetIsFixed ? "fixed" : void 0
|
|
2613
2638
|
};
|
|
2614
2639
|
return style2;
|
|
2615
|
-
}, [
|
|
2616
|
-
const [style, setStyle] =
|
|
2640
|
+
}, [iframe.enabled]);
|
|
2641
|
+
const [style, setStyle] = useState9();
|
|
2642
|
+
const lastRectRef = useRef2(null);
|
|
2643
|
+
const syncRafRef = useRef2(null);
|
|
2617
2644
|
const sync = useCallback7(() => {
|
|
2618
2645
|
setStyle(getStyle());
|
|
2619
|
-
|
|
2620
|
-
|
|
2646
|
+
if (itemRef) {
|
|
2647
|
+
assignRefs([itemRef], ref.current);
|
|
2648
|
+
}
|
|
2649
|
+
}, [getStyle, itemRef]);
|
|
2650
|
+
const scheduleSync = useCallback7(() => {
|
|
2651
|
+
if (syncRafRef.current != null) return;
|
|
2652
|
+
syncRafRef.current = requestAnimationFrame(() => {
|
|
2653
|
+
syncRafRef.current = null;
|
|
2654
|
+
sync();
|
|
2655
|
+
});
|
|
2656
|
+
}, [sync]);
|
|
2657
|
+
useEffect8(() => {
|
|
2658
|
+
return () => {
|
|
2659
|
+
if (syncRafRef.current != null) {
|
|
2660
|
+
cancelAnimationFrame(syncRafRef.current);
|
|
2661
|
+
syncRafRef.current = null;
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
}, []);
|
|
2665
|
+
useEffect8(() => {
|
|
2621
2666
|
if (ref.current) {
|
|
2622
|
-
const observer = new ResizeObserver(
|
|
2667
|
+
const observer = new ResizeObserver(() => {
|
|
2668
|
+
scheduleSync();
|
|
2669
|
+
});
|
|
2623
2670
|
observer.observe(ref.current);
|
|
2624
2671
|
return () => {
|
|
2625
2672
|
observer.disconnect();
|
|
2626
2673
|
};
|
|
2627
2674
|
}
|
|
2628
|
-
}, [
|
|
2675
|
+
}, [scheduleSync, itemRef]);
|
|
2629
2676
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
|
2677
|
+
const unregisterNode = useAppStore((s) => s.nodes.unregisterNode);
|
|
2630
2678
|
const hideOverlay = useCallback7(() => {
|
|
2631
2679
|
setIsVisible(false);
|
|
2632
2680
|
}, []);
|
|
2633
2681
|
const showOverlay = useCallback7(() => {
|
|
2634
2682
|
setIsVisible(true);
|
|
2635
2683
|
}, []);
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2684
|
+
const nodeHandleRef = useRef2({
|
|
2685
|
+
sync: () => null,
|
|
2686
|
+
hideOverlay: () => null,
|
|
2687
|
+
showOverlay: () => null
|
|
2688
|
+
});
|
|
2689
|
+
useLayoutEffect(() => {
|
|
2690
|
+
nodeHandleRef.current.sync = sync;
|
|
2691
|
+
nodeHandleRef.current.hideOverlay = hideOverlay;
|
|
2692
|
+
nodeHandleRef.current.showOverlay = showOverlay;
|
|
2693
|
+
}, [hideOverlay, showOverlay, sync]);
|
|
2694
|
+
useEffect8(() => {
|
|
2695
|
+
registerNode(id, nodeHandleRef.current);
|
|
2642
2696
|
return () => {
|
|
2643
|
-
|
|
2644
|
-
methods: {
|
|
2645
|
-
sync: () => null,
|
|
2646
|
-
hideOverlay: () => null,
|
|
2647
|
-
showOverlay: () => null
|
|
2648
|
-
},
|
|
2649
|
-
element: null
|
|
2650
|
-
});
|
|
2697
|
+
unregisterNode(id);
|
|
2651
2698
|
};
|
|
2652
|
-
}, [id,
|
|
2699
|
+
}, [id, registerNode, unregisterNode]);
|
|
2653
2700
|
const CustomActionBar = useMemo7(
|
|
2654
2701
|
() => overrides.actionBar || DefaultActionBar,
|
|
2655
2702
|
[overrides.actionBar]
|
|
@@ -2664,11 +2711,11 @@ var DraggableComponent = ({
|
|
|
2664
2711
|
if (!el.closest("[data-puck-overlay-portal]")) {
|
|
2665
2712
|
e.stopPropagation();
|
|
2666
2713
|
}
|
|
2667
|
-
if (
|
|
2714
|
+
if (_experimentalFullScreenCanvas) {
|
|
2668
2715
|
dispatch({
|
|
2669
2716
|
type: "setUi",
|
|
2670
2717
|
ui: {
|
|
2671
|
-
itemSelector: null
|
|
2718
|
+
itemSelector: isSelected ? null : { index, zone: zoneCompound }
|
|
2672
2719
|
}
|
|
2673
2720
|
});
|
|
2674
2721
|
} else {
|
|
@@ -2680,7 +2727,7 @@ var DraggableComponent = ({
|
|
|
2680
2727
|
});
|
|
2681
2728
|
}
|
|
2682
2729
|
},
|
|
2683
|
-
[index, zoneCompound, id, isSelected]
|
|
2730
|
+
[index, zoneCompound, id, isSelected, _experimentalFullScreenCanvas]
|
|
2684
2731
|
);
|
|
2685
2732
|
const appStore = useAppStoreApi();
|
|
2686
2733
|
const onSelectParent = useCallback7(() => {
|
|
@@ -2718,12 +2765,12 @@ var DraggableComponent = ({
|
|
|
2718
2765
|
zone: zoneCompound
|
|
2719
2766
|
});
|
|
2720
2767
|
}, [index, zoneCompound]);
|
|
2721
|
-
const [hover, setHover] =
|
|
2768
|
+
const [hover, setHover] = useState9(false);
|
|
2722
2769
|
const indicativeHover = useContextStore(
|
|
2723
2770
|
ZoneStoreContext,
|
|
2724
2771
|
(s) => s.hoveringComponent === id
|
|
2725
2772
|
);
|
|
2726
|
-
|
|
2773
|
+
useEffect8(() => {
|
|
2727
2774
|
if (!ref.current) {
|
|
2728
2775
|
return;
|
|
2729
2776
|
}
|
|
@@ -2768,13 +2815,13 @@ var DraggableComponent = ({
|
|
|
2768
2815
|
thisIsDragging,
|
|
2769
2816
|
inDroppableZone
|
|
2770
2817
|
]);
|
|
2771
|
-
const [isVisible, setIsVisible] =
|
|
2772
|
-
const [dragFinished, setDragFinished] =
|
|
2818
|
+
const [isVisible, setIsVisible] = useState9(false);
|
|
2819
|
+
const [dragFinished, setDragFinished] = useState9(true);
|
|
2773
2820
|
const [_, startTransition] = useTransition();
|
|
2774
|
-
|
|
2821
|
+
useEffect8(() => {
|
|
2775
2822
|
startTransition(() => {
|
|
2776
2823
|
if (hover || indicativeHover || isSelected) {
|
|
2777
|
-
|
|
2824
|
+
scheduleSync();
|
|
2778
2825
|
setIsVisible(true);
|
|
2779
2826
|
setThisWasDragging(false);
|
|
2780
2827
|
} else {
|
|
@@ -2782,7 +2829,7 @@ var DraggableComponent = ({
|
|
|
2782
2829
|
}
|
|
2783
2830
|
});
|
|
2784
2831
|
}, [hover, indicativeHover, isSelected, iframe]);
|
|
2785
|
-
const [thisWasDragging, setThisWasDragging] =
|
|
2832
|
+
const [thisWasDragging, setThisWasDragging] = useState9(false);
|
|
2786
2833
|
const onDragFinished = useOnDragFinished((finished) => {
|
|
2787
2834
|
if (finished) {
|
|
2788
2835
|
startTransition(() => {
|
|
@@ -2793,14 +2840,51 @@ var DraggableComponent = ({
|
|
|
2793
2840
|
setDragFinished(false);
|
|
2794
2841
|
}
|
|
2795
2842
|
});
|
|
2796
|
-
|
|
2843
|
+
useEffect8(() => {
|
|
2797
2844
|
if (thisIsDragging) {
|
|
2798
2845
|
setThisWasDragging(true);
|
|
2799
2846
|
}
|
|
2800
2847
|
}, [thisIsDragging]);
|
|
2801
|
-
|
|
2848
|
+
useEffect8(() => {
|
|
2802
2849
|
if (thisWasDragging) return onDragFinished();
|
|
2803
2850
|
}, [thisWasDragging, onDragFinished]);
|
|
2851
|
+
useEffect8(() => {
|
|
2852
|
+
if (!dragFinished || !(isSelected || thisIsDragging)) return;
|
|
2853
|
+
const el = ref.current;
|
|
2854
|
+
if (!el) return;
|
|
2855
|
+
const doc = el.ownerDocument;
|
|
2856
|
+
const view = doc.defaultView;
|
|
2857
|
+
if (!view) return;
|
|
2858
|
+
lastMeasureRef.current = 0;
|
|
2859
|
+
scheduleSync();
|
|
2860
|
+
const onScroll = () => scheduleSync();
|
|
2861
|
+
const onResize = () => scheduleSync();
|
|
2862
|
+
doc.addEventListener("scroll", onScroll, true);
|
|
2863
|
+
view.addEventListener("resize", onResize);
|
|
2864
|
+
let frame = 0;
|
|
2865
|
+
const tick = (t) => {
|
|
2866
|
+
if (t - lastMeasureRef.current >= MEASURE_EVERY_MS) {
|
|
2867
|
+
lastMeasureRef.current = t;
|
|
2868
|
+
const node = ref.current;
|
|
2869
|
+
if (node) {
|
|
2870
|
+
const rect = node.getBoundingClientRect();
|
|
2871
|
+
const prev = lastRectRef.current;
|
|
2872
|
+
const changed = !prev || Math.abs(rect.x - prev.x) > 0.5 || Math.abs(rect.y - prev.y) > 0.5 || Math.abs(rect.width - prev.width) > 0.5 || Math.abs(rect.height - prev.height) > 0.5;
|
|
2873
|
+
if (changed) {
|
|
2874
|
+
lastRectRef.current = rect;
|
|
2875
|
+
scheduleSync();
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
frame = requestAnimationFrame(tick);
|
|
2880
|
+
};
|
|
2881
|
+
frame = requestAnimationFrame(tick);
|
|
2882
|
+
return () => {
|
|
2883
|
+
doc.removeEventListener("scroll", onScroll, true);
|
|
2884
|
+
view.removeEventListener("resize", onResize);
|
|
2885
|
+
cancelAnimationFrame(frame);
|
|
2886
|
+
};
|
|
2887
|
+
}, [dragFinished, isSelected, thisIsDragging, scheduleSync]);
|
|
2804
2888
|
const syncActionsPosition = useCallback7(
|
|
2805
2889
|
(el) => {
|
|
2806
2890
|
if (el) {
|
|
@@ -2826,7 +2910,7 @@ var DraggableComponent = ({
|
|
|
2826
2910
|
},
|
|
2827
2911
|
[zoom]
|
|
2828
2912
|
);
|
|
2829
|
-
|
|
2913
|
+
useEffect8(() => {
|
|
2830
2914
|
if (userDragAxis) {
|
|
2831
2915
|
setDragAxis(userDragAxis);
|
|
2832
2916
|
return;
|
|
@@ -2965,7 +3049,7 @@ init_react_import();
|
|
|
2965
3049
|
var styles_module_default10 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable": "_Drawer-draggable_pl7z0_8", "Drawer-draggableBg": "_Drawer-draggableBg_pl7z0_12", "DrawerItem-draggable": "_DrawerItem-draggable_pl7z0_22", "DrawerItem--disabled": "_DrawerItem--disabled_pl7z0_35", "DrawerItem": "_DrawerItem_pl7z0_22", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_pl7z0_45", "DrawerItem-name": "_DrawerItem-name_pl7z0_63" };
|
|
2966
3050
|
|
|
2967
3051
|
// components/Drawer/index.tsx
|
|
2968
|
-
import { useMemo as useMemo9, useState as
|
|
3052
|
+
import { useMemo as useMemo9, useState as useState11 } from "react";
|
|
2969
3053
|
|
|
2970
3054
|
// components/DragDropContext/index.tsx
|
|
2971
3055
|
init_react_import();
|
|
@@ -2974,10 +3058,10 @@ import {
|
|
|
2974
3058
|
createContext as createContext4,
|
|
2975
3059
|
useCallback as useCallback8,
|
|
2976
3060
|
useContext as useContext6,
|
|
2977
|
-
useEffect as
|
|
3061
|
+
useEffect as useEffect9,
|
|
2978
3062
|
useMemo as useMemo8,
|
|
2979
3063
|
useRef as useRef3,
|
|
2980
|
-
useState as
|
|
3064
|
+
useState as useState10
|
|
2981
3065
|
} from "react";
|
|
2982
3066
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
|
2983
3067
|
|
|
@@ -3363,7 +3447,7 @@ var dragListenerContext = createContext4({
|
|
|
3363
3447
|
});
|
|
3364
3448
|
function useDragListener(type, fn, deps = []) {
|
|
3365
3449
|
const { setDragListeners } = useContext6(dragListenerContext);
|
|
3366
|
-
|
|
3450
|
+
useEffect9(() => {
|
|
3367
3451
|
if (setDragListeners) {
|
|
3368
3452
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
3369
3453
|
[type]: [...old[type] || [], fn]
|
|
@@ -3395,8 +3479,9 @@ var DragDropContextClient = ({
|
|
|
3395
3479
|
const appStore = useAppStoreApi();
|
|
3396
3480
|
const debouncedParamsRef = useRef3(null);
|
|
3397
3481
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
3398
|
-
const [zoneStore] =
|
|
3399
|
-
|
|
3482
|
+
const [zoneStore] = useState10(() => {
|
|
3483
|
+
const rootVirtualizers = /* @__PURE__ */ new Map();
|
|
3484
|
+
return createStore4(() => ({
|
|
3400
3485
|
zoneDepthIndex: {},
|
|
3401
3486
|
nextZoneDepthIndex: {},
|
|
3402
3487
|
areaDepthIndex: {},
|
|
@@ -3404,9 +3489,35 @@ var DragDropContextClient = ({
|
|
|
3404
3489
|
draggedItem: null,
|
|
3405
3490
|
previewIndex: {},
|
|
3406
3491
|
enabledIndex: {},
|
|
3407
|
-
hoveringComponent: null
|
|
3408
|
-
|
|
3409
|
-
|
|
3492
|
+
hoveringComponent: null,
|
|
3493
|
+
registerRootVirtualizer: (zoneCompound, handle) => {
|
|
3494
|
+
rootVirtualizers.set(zoneCompound, handle);
|
|
3495
|
+
},
|
|
3496
|
+
unregisterRootVirtualizer: (zoneCompound) => {
|
|
3497
|
+
rootVirtualizers.delete(zoneCompound);
|
|
3498
|
+
},
|
|
3499
|
+
scrollToComponent: (id) => {
|
|
3500
|
+
const virtualizers = Array.from(rootVirtualizers.values());
|
|
3501
|
+
if (virtualizers.length > 0) {
|
|
3502
|
+
for (const handle of virtualizers) {
|
|
3503
|
+
const index = handle.resolveIndex(id);
|
|
3504
|
+
if (index < 0) {
|
|
3505
|
+
continue;
|
|
3506
|
+
}
|
|
3507
|
+
handle.virtualizer.scrollToIndex(index, {
|
|
3508
|
+
behavior: "auto",
|
|
3509
|
+
// We avoid smooth scroll as this triggers virtualizer renders
|
|
3510
|
+
align: "auto"
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3513
|
+
} else {
|
|
3514
|
+
const frame = getFrame();
|
|
3515
|
+
const el = frame == null ? void 0 : frame.querySelector(`[data-puck-component="${id}"]`);
|
|
3516
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
}));
|
|
3520
|
+
});
|
|
3410
3521
|
const getChanged = useCallback8(
|
|
3411
3522
|
(params) => {
|
|
3412
3523
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
@@ -3452,7 +3563,7 @@ var DragDropContextClient = ({
|
|
|
3452
3563
|
setDeepestDb.cancel();
|
|
3453
3564
|
debouncedParamsRef.current = null;
|
|
3454
3565
|
};
|
|
3455
|
-
|
|
3566
|
+
useEffect9(() => {
|
|
3456
3567
|
if (DEBUG3) {
|
|
3457
3568
|
zoneStore.subscribe(
|
|
3458
3569
|
(s) => {
|
|
@@ -3466,7 +3577,7 @@ var DragDropContextClient = ({
|
|
|
3466
3577
|
);
|
|
3467
3578
|
}
|
|
3468
3579
|
}, []);
|
|
3469
|
-
const [plugins] =
|
|
3580
|
+
const [plugins] = useState10(() => [
|
|
3470
3581
|
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
|
3471
3582
|
createNestedDroppablePlugin(
|
|
3472
3583
|
{
|
|
@@ -3514,7 +3625,7 @@ var DragDropContextClient = ({
|
|
|
3514
3625
|
)
|
|
3515
3626
|
]);
|
|
3516
3627
|
const sensors = useSensors();
|
|
3517
|
-
const [dragListeners, setDragListeners] =
|
|
3628
|
+
const [dragListeners, setDragListeners] = useState10({});
|
|
3518
3629
|
const dragMode = useRef3(null);
|
|
3519
3630
|
const initialSelector = useRef3(void 0);
|
|
3520
3631
|
const nextContextValue = useMemo8(
|
|
@@ -3554,24 +3665,9 @@ var DragDropContextClient = ({
|
|
|
3554
3665
|
zoneStore.setState({ draggedItem: null });
|
|
3555
3666
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
|
3556
3667
|
zoneStore.setState({ previewIndex: {} });
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
insertComponent(
|
|
3561
|
-
thisPreview.componentType,
|
|
3562
|
-
thisPreview.zone,
|
|
3563
|
-
thisPreview.index,
|
|
3564
|
-
appStore
|
|
3565
|
-
);
|
|
3566
|
-
} else if (initialSelector.current) {
|
|
3567
|
-
moveComponent(
|
|
3568
|
-
thisPreview.props.id,
|
|
3569
|
-
initialSelector.current,
|
|
3570
|
-
thisPreview,
|
|
3571
|
-
appStore
|
|
3572
|
-
);
|
|
3573
|
-
}
|
|
3574
|
-
}
|
|
3668
|
+
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
|
3669
|
+
fn(event, manager);
|
|
3670
|
+
});
|
|
3575
3671
|
dispatch({
|
|
3576
3672
|
type: "setUi",
|
|
3577
3673
|
ui: {
|
|
@@ -3579,9 +3675,6 @@ var DragDropContextClient = ({
|
|
|
3579
3675
|
isDragging: false
|
|
3580
3676
|
}
|
|
3581
3677
|
});
|
|
3582
|
-
(_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
|
|
3583
|
-
fn(event, manager);
|
|
3584
|
-
});
|
|
3585
3678
|
return;
|
|
3586
3679
|
}
|
|
3587
3680
|
if (thisPreview) {
|
|
@@ -3594,14 +3687,12 @@ var DragDropContextClient = ({
|
|
|
3594
3687
|
appStore
|
|
3595
3688
|
);
|
|
3596
3689
|
} else if (initialSelector.current) {
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
recordHistory: false
|
|
3604
|
-
});
|
|
3690
|
+
moveComponent(
|
|
3691
|
+
thisPreview.props.id,
|
|
3692
|
+
initialSelector.current,
|
|
3693
|
+
thisPreview,
|
|
3694
|
+
appStore
|
|
3695
|
+
);
|
|
3605
3696
|
}
|
|
3606
3697
|
}
|
|
3607
3698
|
dispatch({
|
|
@@ -3610,7 +3701,7 @@ var DragDropContextClient = ({
|
|
|
3610
3701
|
itemSelector: { index, zone },
|
|
3611
3702
|
isDragging: false
|
|
3612
3703
|
},
|
|
3613
|
-
recordHistory:
|
|
3704
|
+
recordHistory: false
|
|
3614
3705
|
});
|
|
3615
3706
|
(_b2 = dragListeners.dragend) == null ? void 0 : _b2.forEach((fn) => {
|
|
3616
3707
|
fn(event, manager);
|
|
@@ -3850,7 +3941,7 @@ var DrawerItem = ({
|
|
|
3850
3941
|
isDragDisabled
|
|
3851
3942
|
}) => {
|
|
3852
3943
|
const resolvedId = id || name;
|
|
3853
|
-
const [dynamicId, setDynamicId] =
|
|
3944
|
+
const [dynamicId, setDynamicId] = useState11(generateId(resolvedId));
|
|
3854
3945
|
if (typeof index !== "undefined") {
|
|
3855
3946
|
console.error(
|
|
3856
3947
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -3912,7 +4003,7 @@ Drawer.Item = DrawerItem;
|
|
|
3912
4003
|
|
|
3913
4004
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
3914
4005
|
init_react_import();
|
|
3915
|
-
import { useEffect as
|
|
4006
|
+
import { useEffect as useEffect10, useRef as useRef4, useState as useState12 } from "react";
|
|
3916
4007
|
var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
|
|
3917
4008
|
var useMinEmptyHeight = ({
|
|
3918
4009
|
zoneCompound,
|
|
@@ -3920,8 +4011,8 @@ var useMinEmptyHeight = ({
|
|
|
3920
4011
|
ref
|
|
3921
4012
|
}) => {
|
|
3922
4013
|
const appStore = useAppStoreApi();
|
|
3923
|
-
const [prevHeight, setPrevHeight] =
|
|
3924
|
-
const [isAnimating, setIsAnimating] =
|
|
4014
|
+
const [prevHeight, setPrevHeight] = useState12(0);
|
|
4015
|
+
const [isAnimating, setIsAnimating] = useState12(false);
|
|
3925
4016
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
|
3926
4017
|
var _a, _b;
|
|
3927
4018
|
return {
|
|
@@ -3932,7 +4023,6 @@ var useMinEmptyHeight = ({
|
|
|
3932
4023
|
const numItems = useRef4(0);
|
|
3933
4024
|
const onDragFinished = useOnDragFinished(
|
|
3934
4025
|
(finished) => {
|
|
3935
|
-
var _a;
|
|
3936
4026
|
if (finished) {
|
|
3937
4027
|
const newNumItems = getNumItems(appStore, zoneCompound);
|
|
3938
4028
|
setPrevHeight(0);
|
|
@@ -3943,19 +4033,15 @@ var useMinEmptyHeight = ({
|
|
|
3943
4033
|
const selectedItem = appStore.getState().selectedItem;
|
|
3944
4034
|
const zones = appStore.getState().state.indexes.zones;
|
|
3945
4035
|
const nodes = appStore.getState().nodes;
|
|
3946
|
-
|
|
4036
|
+
nodes.setOverlayVisible(selectedItem == null ? void 0 : selectedItem.props.id, false);
|
|
3947
4037
|
setTimeout(() => {
|
|
3948
|
-
var
|
|
3949
|
-
const contentIds = ((
|
|
3950
|
-
|
|
3951
|
-
const node = nodes.nodes[contentId];
|
|
3952
|
-
node == null ? void 0 : node.methods.sync();
|
|
3953
|
-
});
|
|
4038
|
+
var _a;
|
|
4039
|
+
const contentIds = ((_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) || [];
|
|
4040
|
+
nodes.syncNodes(contentIds);
|
|
3954
4041
|
if (selectedItem) {
|
|
3955
4042
|
setTimeout(() => {
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
(_b = nodes.nodes[selectedItem.props.id]) == null ? void 0 : _b.methods.showOverlay();
|
|
4043
|
+
nodes.syncNode(selectedItem.props.id);
|
|
4044
|
+
nodes.setOverlayVisible(selectedItem.props.id, true);
|
|
3959
4045
|
}, 200);
|
|
3960
4046
|
}
|
|
3961
4047
|
setIsAnimating(false);
|
|
@@ -3964,7 +4050,7 @@ var useMinEmptyHeight = ({
|
|
|
3964
4050
|
},
|
|
3965
4051
|
[appStore, prevHeight, zoneCompound]
|
|
3966
4052
|
);
|
|
3967
|
-
|
|
4053
|
+
useEffect10(() => {
|
|
3968
4054
|
if (draggedItem && ref.current) {
|
|
3969
4055
|
if (isZone) {
|
|
3970
4056
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -3979,24 +4065,9 @@ var useMinEmptyHeight = ({
|
|
|
3979
4065
|
return [prevHeight ? `${prevHeight}px` : returnedMinHeight, isAnimating];
|
|
3980
4066
|
};
|
|
3981
4067
|
|
|
3982
|
-
// lib/assign-refs.ts
|
|
3983
|
-
init_react_import();
|
|
3984
|
-
function assignRef(ref, node) {
|
|
3985
|
-
if (typeof ref === "function") {
|
|
3986
|
-
ref(node);
|
|
3987
|
-
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
3988
|
-
ref.current = node;
|
|
3989
|
-
}
|
|
3990
|
-
}
|
|
3991
|
-
function assignRefs(refs, node) {
|
|
3992
|
-
refs.forEach((ref) => {
|
|
3993
|
-
assignRef(ref, node);
|
|
3994
|
-
});
|
|
3995
|
-
}
|
|
3996
|
-
|
|
3997
4068
|
// components/DropZone/lib/use-content-with-preview.ts
|
|
3998
4069
|
init_react_import();
|
|
3999
|
-
import { useContext as useContext7, useEffect as
|
|
4070
|
+
import { useContext as useContext7, useEffect as useEffect11, useState as useState13 } from "react";
|
|
4000
4071
|
|
|
4001
4072
|
// lib/dnd/use-rendered-callback.ts
|
|
4002
4073
|
init_react_import();
|
|
@@ -4021,8 +4092,8 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
4021
4092
|
(s) => s.previewIndex[zoneCompound]
|
|
4022
4093
|
);
|
|
4023
4094
|
const isDragging = useAppStore((s) => s.state.ui.isDragging);
|
|
4024
|
-
const [contentIdsWithPreview, setContentIdsWithPreview] =
|
|
4025
|
-
const [localPreview, setLocalPreview] =
|
|
4095
|
+
const [contentIdsWithPreview, setContentIdsWithPreview] = useState13(contentIds);
|
|
4096
|
+
const [localPreview, setLocalPreview] = useState13(
|
|
4026
4097
|
preview
|
|
4027
4098
|
);
|
|
4028
4099
|
const updateContent = useRenderedCallback(
|
|
@@ -4057,7 +4128,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
4057
4128
|
},
|
|
4058
4129
|
[]
|
|
4059
4130
|
);
|
|
4060
|
-
|
|
4131
|
+
useEffect11(() => {
|
|
4061
4132
|
var _a;
|
|
4062
4133
|
const s = zoneStore.getState();
|
|
4063
4134
|
const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
@@ -4075,13 +4146,13 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
4075
4146
|
|
|
4076
4147
|
// components/DropZone/lib/use-drag-axis.ts
|
|
4077
4148
|
init_react_import();
|
|
4078
|
-
import { useCallback as useCallback10, useEffect as
|
|
4149
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useState as useState14 } from "react";
|
|
4079
4150
|
var GRID_DRAG_AXIS = "dynamic";
|
|
4080
4151
|
var FLEX_ROW_DRAG_AXIS = "x";
|
|
4081
4152
|
var DEFAULT_DRAG_AXIS = "y";
|
|
4082
4153
|
var useDragAxis = (ref, collisionAxis) => {
|
|
4083
4154
|
const status = useAppStore((s) => s.status);
|
|
4084
|
-
const [dragAxis, setDragAxis] =
|
|
4155
|
+
const [dragAxis, setDragAxis] = useState14(
|
|
4085
4156
|
collisionAxis || DEFAULT_DRAG_AXIS
|
|
4086
4157
|
);
|
|
4087
4158
|
const calculateDragAxis = useCallback10(() => {
|
|
@@ -4096,7 +4167,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
4096
4167
|
}
|
|
4097
4168
|
}
|
|
4098
4169
|
}, [ref.current]);
|
|
4099
|
-
|
|
4170
|
+
useEffect12(() => {
|
|
4100
4171
|
const onViewportChange = () => {
|
|
4101
4172
|
calculateDragAxis();
|
|
4102
4173
|
};
|
|
@@ -4105,7 +4176,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
4105
4176
|
window.removeEventListener("viewportchange", onViewportChange);
|
|
4106
4177
|
};
|
|
4107
4178
|
}, []);
|
|
4108
|
-
|
|
4179
|
+
useEffect12(calculateDragAxis, [status, collisionAxis]);
|
|
4109
4180
|
return [dragAxis, calculateDragAxis];
|
|
4110
4181
|
};
|
|
4111
4182
|
|
|
@@ -4189,7 +4260,7 @@ init_react_import();
|
|
|
4189
4260
|
|
|
4190
4261
|
// components/InlineTextField/index.tsx
|
|
4191
4262
|
init_react_import();
|
|
4192
|
-
import { memo as memo4, useEffect as
|
|
4263
|
+
import { memo as memo4, useEffect as useEffect13, useRef as useRef6, useState as useState15 } from "react";
|
|
4193
4264
|
|
|
4194
4265
|
// lib/overlay-portal/index.tsx
|
|
4195
4266
|
init_react_import();
|
|
@@ -4257,7 +4328,7 @@ var InlineTextFieldInternal = ({
|
|
|
4257
4328
|
const ref = useRef6(null);
|
|
4258
4329
|
const appStoreApi = useAppStoreApi();
|
|
4259
4330
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
4260
|
-
|
|
4331
|
+
useEffect13(() => {
|
|
4261
4332
|
const appStore = appStoreApi.getState();
|
|
4262
4333
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
4263
4334
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -4303,8 +4374,8 @@ var InlineTextFieldInternal = ({
|
|
|
4303
4374
|
};
|
|
4304
4375
|
}
|
|
4305
4376
|
}, [appStoreApi, ref.current, value, disableLineBreaks]);
|
|
4306
|
-
const [isHovering, setIsHovering] =
|
|
4307
|
-
const [isFocused, setIsFocused] =
|
|
4377
|
+
const [isHovering, setIsHovering] = useState15(false);
|
|
4378
|
+
const [isFocused, setIsFocused] = useState15(false);
|
|
4308
4379
|
return /* @__PURE__ */ jsx26(
|
|
4309
4380
|
"span",
|
|
4310
4381
|
{
|
|
@@ -4394,7 +4465,7 @@ var getInlineTextTransform = () => ({
|
|
|
4394
4465
|
// lib/field-transforms/default-transforms/rich-text-transform.tsx
|
|
4395
4466
|
init_react_import();
|
|
4396
4467
|
import {
|
|
4397
|
-
useEffect as
|
|
4468
|
+
useEffect as useEffect14,
|
|
4398
4469
|
useRef as useRef7,
|
|
4399
4470
|
useCallback as useCallback11,
|
|
4400
4471
|
memo as memo5,
|
|
@@ -4403,7 +4474,7 @@ import {
|
|
|
4403
4474
|
} from "react";
|
|
4404
4475
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4405
4476
|
var Editor2 = lazy2(
|
|
4406
|
-
() => import("./Editor-
|
|
4477
|
+
() => import("./Editor-EPSED64A.mjs").then((m) => ({
|
|
4407
4478
|
default: m.Editor
|
|
4408
4479
|
}))
|
|
4409
4480
|
);
|
|
@@ -4435,7 +4506,7 @@ var InlineEditorWrapper = memo5(
|
|
|
4435
4506
|
);
|
|
4436
4507
|
appStoreApi.getState().setUi({ itemSelector });
|
|
4437
4508
|
};
|
|
4438
|
-
|
|
4509
|
+
useEffect14(() => {
|
|
4439
4510
|
if (!portalRef.current) return;
|
|
4440
4511
|
const cleanup = registerOverlayPortal(portalRef.current, {
|
|
4441
4512
|
disableDragOnFocus: true
|
|
@@ -4569,8 +4640,210 @@ var MemoizeComponent = memo6(RenderComponent, (prev, next) => {
|
|
|
4569
4640
|
return prev.Component === next.Component && shallowEqual(prev.componentProps, next.componentProps, ["puck"]) && puckEquals;
|
|
4570
4641
|
});
|
|
4571
4642
|
|
|
4643
|
+
// components/DropZone/VirtualizedDropZone.tsx
|
|
4644
|
+
init_react_import();
|
|
4645
|
+
import {
|
|
4646
|
+
useCallback as useCallback12,
|
|
4647
|
+
useContext as useContext8,
|
|
4648
|
+
useEffect as useEffect15,
|
|
4649
|
+
useMemo as useMemo11,
|
|
4650
|
+
useRef as useRef8
|
|
4651
|
+
} from "react";
|
|
4652
|
+
import {
|
|
4653
|
+
defaultRangeExtractor,
|
|
4654
|
+
elementScroll,
|
|
4655
|
+
observeElementOffset,
|
|
4656
|
+
observeElementRect,
|
|
4657
|
+
observeWindowOffset,
|
|
4658
|
+
observeWindowRect,
|
|
4659
|
+
useVirtualizer,
|
|
4660
|
+
windowScroll
|
|
4661
|
+
} from "@tanstack/react-virtual";
|
|
4662
|
+
import { Fragment as Fragment8, jsx as jsx30 } from "react/jsx-runtime";
|
|
4663
|
+
var ROOT_ZONE_VIRTUALIZATION_OVERSCAN = 5;
|
|
4664
|
+
var DEFAULT_VIRTUALIZED_ITEM_HEIGHT = 320;
|
|
4665
|
+
var measuredItemHeights = /* @__PURE__ */ new Map();
|
|
4666
|
+
var getEstimatedItemHeight = (componentId) => {
|
|
4667
|
+
var _a;
|
|
4668
|
+
return (_a = measuredItemHeights.get(componentId)) != null ? _a : DEFAULT_VIRTUALIZED_ITEM_HEIGHT;
|
|
4669
|
+
};
|
|
4670
|
+
var cacheMeasuredItemHeight = (componentId, height) => {
|
|
4671
|
+
if (height <= 0) {
|
|
4672
|
+
return;
|
|
4673
|
+
}
|
|
4674
|
+
measuredItemHeights.set(componentId, height);
|
|
4675
|
+
};
|
|
4676
|
+
var VirtualizedDropZone = ({
|
|
4677
|
+
contentIds,
|
|
4678
|
+
zoneCompound,
|
|
4679
|
+
renderItem
|
|
4680
|
+
}) => {
|
|
4681
|
+
const selectedId = useAppStore((s) => {
|
|
4682
|
+
var _a, _b;
|
|
4683
|
+
return (_b = (_a = s.selectedItem) == null ? void 0 : _a.props.id) != null ? _b : null;
|
|
4684
|
+
});
|
|
4685
|
+
const frame = getFrame();
|
|
4686
|
+
const zoneStore = useContext8(ZoneStoreContext);
|
|
4687
|
+
const draggedItemId = useContextStore(ZoneStoreContext, (s) => {
|
|
4688
|
+
var _a;
|
|
4689
|
+
const draggedId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
4690
|
+
return draggedId ? String(draggedId) : null;
|
|
4691
|
+
});
|
|
4692
|
+
const dragTargetParentId = useContextStore(ZoneStoreContext, (s) => {
|
|
4693
|
+
var _a, _b;
|
|
4694
|
+
if ((_a = s.draggedItem) == null ? void 0 : _a.id) {
|
|
4695
|
+
const parentZone = Object.keys((_b = s.previewIndex) != null ? _b : {})[0];
|
|
4696
|
+
return parentZone == null ? void 0 : parentZone.split(":")[0];
|
|
4697
|
+
}
|
|
4698
|
+
return null;
|
|
4699
|
+
});
|
|
4700
|
+
const iframeWindow = frame == null ? void 0 : frame.defaultView;
|
|
4701
|
+
const measureRefsRef = useRef8(/* @__PURE__ */ new Map());
|
|
4702
|
+
const appStoreApi = useAppStoreApi();
|
|
4703
|
+
const resolveIndex = useCallback12(
|
|
4704
|
+
(targetId) => {
|
|
4705
|
+
var _a, _b, _c, _d;
|
|
4706
|
+
if (!targetId || targetId === "root") {
|
|
4707
|
+
return -1;
|
|
4708
|
+
}
|
|
4709
|
+
const directIndex = contentIds.indexOf(targetId);
|
|
4710
|
+
if (directIndex > -1) {
|
|
4711
|
+
return directIndex;
|
|
4712
|
+
}
|
|
4713
|
+
const path = (_c = (_b = (_a = appStoreApi.getState().state.indexes.nodes) == null ? void 0 : _a[targetId]) == null ? void 0 : _b.path) != null ? _c : [];
|
|
4714
|
+
for (let i = path.length - 1; i >= 0; i -= 1) {
|
|
4715
|
+
const candidateId = (_d = path[i]) == null ? void 0 : _d.split(":")[0];
|
|
4716
|
+
if (!candidateId || candidateId === "root") {
|
|
4717
|
+
continue;
|
|
4718
|
+
}
|
|
4719
|
+
const index = contentIds.indexOf(candidateId);
|
|
4720
|
+
if (index > -1) {
|
|
4721
|
+
return index;
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
return -1;
|
|
4725
|
+
},
|
|
4726
|
+
[appStoreApi, contentIds]
|
|
4727
|
+
);
|
|
4728
|
+
const pinnedIndexes = useMemo11(() => {
|
|
4729
|
+
const nextPinnedIndexes = /* @__PURE__ */ new Set();
|
|
4730
|
+
[selectedId, draggedItemId, dragTargetParentId].forEach((targetId) => {
|
|
4731
|
+
const currentIndex = resolveIndex(targetId);
|
|
4732
|
+
if (currentIndex > -1) {
|
|
4733
|
+
nextPinnedIndexes.add(currentIndex);
|
|
4734
|
+
}
|
|
4735
|
+
});
|
|
4736
|
+
return Array.from(nextPinnedIndexes).sort((a, b) => a - b);
|
|
4737
|
+
}, [dragTargetParentId, draggedItemId, resolveIndex, selectedId]);
|
|
4738
|
+
const rangeExtractor = useCallback12(
|
|
4739
|
+
(range) => {
|
|
4740
|
+
const indexes = defaultRangeExtractor(range);
|
|
4741
|
+
pinnedIndexes.forEach((index) => {
|
|
4742
|
+
if (!indexes.includes(index)) {
|
|
4743
|
+
indexes.push(index);
|
|
4744
|
+
}
|
|
4745
|
+
});
|
|
4746
|
+
indexes.sort((a, b) => a - b);
|
|
4747
|
+
return indexes;
|
|
4748
|
+
},
|
|
4749
|
+
[pinnedIndexes]
|
|
4750
|
+
);
|
|
4751
|
+
const virtualizer = useVirtualizer({
|
|
4752
|
+
count: contentIds.length,
|
|
4753
|
+
getItemKey: (index) => contentIds[index],
|
|
4754
|
+
estimateSize: (index) => getEstimatedItemHeight(contentIds[index]),
|
|
4755
|
+
getScrollElement: () => iframeWindow != null ? iframeWindow : null,
|
|
4756
|
+
overscan: ROOT_ZONE_VIRTUALIZATION_OVERSCAN,
|
|
4757
|
+
observeElementRect: (instance, cb) => iframeWindow ? observeWindowRect(instance, cb) : observeElementRect(instance, cb),
|
|
4758
|
+
observeElementOffset: (instance, cb) => iframeWindow ? observeWindowOffset(instance, cb) : observeElementOffset(instance, cb),
|
|
4759
|
+
scrollToFn: (offset, options, instance) => iframeWindow ? windowScroll(offset, options, instance) : elementScroll(offset, options, instance),
|
|
4760
|
+
rangeExtractor,
|
|
4761
|
+
initialOffset: () => iframeWindow ? iframeWindow.scrollY : 0
|
|
4762
|
+
});
|
|
4763
|
+
useEffect15(() => {
|
|
4764
|
+
zoneStore.getState().registerRootVirtualizer(zoneCompound, {
|
|
4765
|
+
resolveIndex: (targetId) => resolveIndex(targetId),
|
|
4766
|
+
virtualizer
|
|
4767
|
+
});
|
|
4768
|
+
return () => {
|
|
4769
|
+
zoneStore.getState().unregisterRootVirtualizer(zoneCompound);
|
|
4770
|
+
};
|
|
4771
|
+
}, [resolveIndex, virtualizer, zoneCompound, zoneStore]);
|
|
4772
|
+
const getMeasureRef = useCallback12((componentId) => {
|
|
4773
|
+
const cachedRef = measureRefsRef.current.get(componentId);
|
|
4774
|
+
if (cachedRef) {
|
|
4775
|
+
return cachedRef;
|
|
4776
|
+
}
|
|
4777
|
+
const measureRef = (element) => {
|
|
4778
|
+
if (!element) {
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
4781
|
+
const height = Math.ceil(element.getBoundingClientRect().height) || DEFAULT_VIRTUALIZED_ITEM_HEIGHT;
|
|
4782
|
+
if (typeof height === "number" && height > 0) {
|
|
4783
|
+
cacheMeasuredItemHeight(componentId, height);
|
|
4784
|
+
}
|
|
4785
|
+
};
|
|
4786
|
+
measureRefsRef.current.set(componentId, measureRef);
|
|
4787
|
+
return measureRef;
|
|
4788
|
+
}, []);
|
|
4789
|
+
useEffect15(() => {
|
|
4790
|
+
const validIds = new Set(contentIds);
|
|
4791
|
+
Array.from(measureRefsRef.current.keys()).forEach((componentId) => {
|
|
4792
|
+
if (!validIds.has(componentId)) {
|
|
4793
|
+
measureRefsRef.current.delete(componentId);
|
|
4794
|
+
}
|
|
4795
|
+
});
|
|
4796
|
+
}, [contentIds]);
|
|
4797
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
4798
|
+
const totalSize = virtualizer.getTotalSize();
|
|
4799
|
+
const renderedItems = useMemo11(() => {
|
|
4800
|
+
const items = [];
|
|
4801
|
+
let previousEnd = 0;
|
|
4802
|
+
let previousIndex = -1;
|
|
4803
|
+
virtualItems.forEach((virtualItem) => {
|
|
4804
|
+
if (!virtualItem) return;
|
|
4805
|
+
const componentId = contentIds[virtualItem.index];
|
|
4806
|
+
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
4807
|
+
if (gapSize > 0) {
|
|
4808
|
+
items.push(
|
|
4809
|
+
/* @__PURE__ */ jsx30(
|
|
4810
|
+
"div",
|
|
4811
|
+
{
|
|
4812
|
+
style: { height: `${gapSize}px` }
|
|
4813
|
+
},
|
|
4814
|
+
`gap:${previousIndex}:${virtualItem.index}`
|
|
4815
|
+
)
|
|
4816
|
+
);
|
|
4817
|
+
}
|
|
4818
|
+
items.push(
|
|
4819
|
+
renderItem({
|
|
4820
|
+
componentId,
|
|
4821
|
+
index: virtualItem.index,
|
|
4822
|
+
measureRef: getMeasureRef(componentId)
|
|
4823
|
+
})
|
|
4824
|
+
);
|
|
4825
|
+
previousEnd = virtualItem.end;
|
|
4826
|
+
previousIndex = virtualItem.index;
|
|
4827
|
+
});
|
|
4828
|
+
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
4829
|
+
if (trailingGap > 0) {
|
|
4830
|
+
items.push(
|
|
4831
|
+
/* @__PURE__ */ jsx30(
|
|
4832
|
+
"div",
|
|
4833
|
+
{
|
|
4834
|
+
style: { height: `${trailingGap}px` }
|
|
4835
|
+
},
|
|
4836
|
+
`gap:${previousIndex}:end`
|
|
4837
|
+
)
|
|
4838
|
+
);
|
|
4839
|
+
}
|
|
4840
|
+
return items;
|
|
4841
|
+
}, [totalSize, virtualItems, getMeasureRef]);
|
|
4842
|
+
return /* @__PURE__ */ jsx30(Fragment8, { children: renderedItems });
|
|
4843
|
+
};
|
|
4844
|
+
|
|
4572
4845
|
// components/DropZone/index.tsx
|
|
4573
|
-
import { Fragment as
|
|
4846
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4574
4847
|
var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default9);
|
|
4575
4848
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
4576
4849
|
var RENDER_DEBUG = false;
|
|
@@ -4582,25 +4855,26 @@ var InsertPreview = ({
|
|
|
4582
4855
|
if (element) {
|
|
4583
4856
|
return (
|
|
4584
4857
|
// Safe to use this since the HTML is set by the user
|
|
4585
|
-
/* @__PURE__ */
|
|
4858
|
+
/* @__PURE__ */ jsx31("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } })
|
|
4586
4859
|
);
|
|
4587
4860
|
}
|
|
4588
|
-
return /* @__PURE__ */
|
|
4861
|
+
return /* @__PURE__ */ jsx31(DrawerItemInner, { name: label, children: override });
|
|
4589
4862
|
};
|
|
4590
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */
|
|
4863
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ jsx31(DropZoneEdit, __spreadValues({}, props));
|
|
4591
4864
|
var DropZoneChild = ({
|
|
4592
4865
|
zoneCompound,
|
|
4593
4866
|
componentId,
|
|
4594
4867
|
index,
|
|
4595
4868
|
dragAxis,
|
|
4596
4869
|
collisionAxis,
|
|
4597
|
-
inDroppableZone
|
|
4870
|
+
inDroppableZone,
|
|
4871
|
+
itemRef
|
|
4598
4872
|
}) => {
|
|
4599
4873
|
var _a, _b;
|
|
4600
4874
|
const metadata = useAppStore((s) => s.metadata);
|
|
4601
|
-
const ctx =
|
|
4875
|
+
const ctx = useContext9(dropZoneContext);
|
|
4602
4876
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
4603
|
-
const zoneStore =
|
|
4877
|
+
const zoneStore = useContext9(ZoneStoreContext);
|
|
4604
4878
|
const nodeProps = useAppStore(
|
|
4605
4879
|
useShallow6((s) => {
|
|
4606
4880
|
var _a2;
|
|
@@ -4620,7 +4894,7 @@ var DropZoneChild = ({
|
|
|
4620
4894
|
})
|
|
4621
4895
|
);
|
|
4622
4896
|
const appStore = useAppStoreApi();
|
|
4623
|
-
const item =
|
|
4897
|
+
const item = useMemo12(() => {
|
|
4624
4898
|
if (nodeProps) {
|
|
4625
4899
|
const expanded = expandNode({
|
|
4626
4900
|
type: nodeType,
|
|
@@ -4642,7 +4916,7 @@ var DropZoneChild = ({
|
|
|
4642
4916
|
const componentConfig = useAppStore(
|
|
4643
4917
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
4644
4918
|
);
|
|
4645
|
-
const puckProps =
|
|
4919
|
+
const puckProps = useMemo12(
|
|
4646
4920
|
() => ({
|
|
4647
4921
|
renderDropZone: DropZoneEditPure,
|
|
4648
4922
|
isEditing: true,
|
|
@@ -4665,7 +4939,7 @@ var DropZoneChild = ({
|
|
|
4665
4939
|
}
|
|
4666
4940
|
);
|
|
4667
4941
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
4668
|
-
const defaultsProps =
|
|
4942
|
+
const defaultsProps = useMemo12(
|
|
4669
4943
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
4670
4944
|
puck: puckProps,
|
|
4671
4945
|
editMode: true
|
|
@@ -4673,7 +4947,7 @@ var DropZoneChild = ({
|
|
|
4673
4947
|
}),
|
|
4674
4948
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, puckProps]
|
|
4675
4949
|
);
|
|
4676
|
-
const defaultedNode =
|
|
4950
|
+
const defaultedNode = useMemo12(
|
|
4677
4951
|
() => {
|
|
4678
4952
|
var _a2;
|
|
4679
4953
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
@@ -4683,8 +4957,8 @@ var DropZoneChild = ({
|
|
|
4683
4957
|
const config = useAppStore((s) => s.config);
|
|
4684
4958
|
const plugins = useAppStore((s) => s.plugins);
|
|
4685
4959
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
4686
|
-
const combinedFieldTransforms =
|
|
4687
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */
|
|
4960
|
+
const combinedFieldTransforms = useMemo12(
|
|
4961
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx31(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
4688
4962
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
4689
4963
|
{}
|
|
4690
4964
|
)), userFieldTransforms),
|
|
@@ -4704,7 +4978,7 @@ var DropZoneChild = ({
|
|
|
4704
4978
|
] });
|
|
4705
4979
|
let componentType = item.type;
|
|
4706
4980
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
4707
|
-
return /* @__PURE__ */
|
|
4981
|
+
return /* @__PURE__ */ jsx31(
|
|
4708
4982
|
DraggableComponent,
|
|
4709
4983
|
{
|
|
4710
4984
|
id: componentId,
|
|
@@ -4718,10 +4992,11 @@ var DropZoneChild = ({
|
|
|
4718
4992
|
autoDragAxis: dragAxis,
|
|
4719
4993
|
userDragAxis: collisionAxis,
|
|
4720
4994
|
inDroppableZone,
|
|
4995
|
+
itemRef,
|
|
4721
4996
|
children: (dragRef) => {
|
|
4722
4997
|
var _a2;
|
|
4723
4998
|
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
4724
|
-
return /* @__PURE__ */
|
|
4999
|
+
return /* @__PURE__ */ jsx31(
|
|
4725
5000
|
MemoizeComponent,
|
|
4726
5001
|
{
|
|
4727
5002
|
Component: Render2,
|
|
@@ -4731,14 +5006,14 @@ var DropZoneChild = ({
|
|
|
4731
5006
|
}
|
|
4732
5007
|
);
|
|
4733
5008
|
}
|
|
4734
|
-
return /* @__PURE__ */
|
|
5009
|
+
return /* @__PURE__ */ jsx31("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ jsx31(
|
|
4735
5010
|
InsertPreview,
|
|
4736
5011
|
{
|
|
4737
5012
|
label,
|
|
4738
5013
|
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
4739
5014
|
element: "element" in item && item.element ? item.element : void 0
|
|
4740
5015
|
}
|
|
4741
|
-
) : /* @__PURE__ */
|
|
5016
|
+
) : /* @__PURE__ */ jsx31(
|
|
4742
5017
|
MemoizeComponent,
|
|
4743
5018
|
{
|
|
4744
5019
|
Component: Render2,
|
|
@@ -4761,7 +5036,7 @@ var DropZoneEdit = forwardRef(
|
|
|
4761
5036
|
collisionAxis,
|
|
4762
5037
|
as
|
|
4763
5038
|
}, userRef) {
|
|
4764
|
-
const ctx =
|
|
5039
|
+
const ctx = useContext9(dropZoneContext);
|
|
4765
5040
|
const appStoreApi = useAppStoreApi();
|
|
4766
5041
|
const {
|
|
4767
5042
|
// These all need setting via context
|
|
@@ -4815,11 +5090,11 @@ var DropZoneEdit = forwardRef(
|
|
|
4815
5090
|
}
|
|
4816
5091
|
}
|
|
4817
5092
|
}, [zoneType]);
|
|
4818
|
-
const contentIds =
|
|
5093
|
+
const contentIds = useMemo12(() => {
|
|
4819
5094
|
return zoneContentIds || [];
|
|
4820
5095
|
}, [zoneContentIds]);
|
|
4821
|
-
const ref =
|
|
4822
|
-
const acceptsTarget =
|
|
5096
|
+
const ref = useRef9(null);
|
|
5097
|
+
const acceptsTarget = useCallback13(
|
|
4823
5098
|
(componentType) => {
|
|
4824
5099
|
if (!componentType) {
|
|
4825
5100
|
return true;
|
|
@@ -4872,7 +5147,7 @@ var DropZoneEdit = forwardRef(
|
|
|
4872
5147
|
zoneCompound
|
|
4873
5148
|
);
|
|
4874
5149
|
const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
|
|
4875
|
-
const zoneStore =
|
|
5150
|
+
const zoneStore = useContext9(ZoneStoreContext);
|
|
4876
5151
|
useEffect16(() => {
|
|
4877
5152
|
const { enabledIndex } = zoneStore.getState();
|
|
4878
5153
|
zoneStore.setState({
|
|
@@ -4902,14 +5177,19 @@ var DropZoneEdit = forwardRef(
|
|
|
4902
5177
|
userMinEmptyHeight,
|
|
4903
5178
|
ref
|
|
4904
5179
|
});
|
|
4905
|
-
const setRefs =
|
|
5180
|
+
const setRefs = useCallback13(
|
|
4906
5181
|
(node) => {
|
|
4907
5182
|
assignRefs([ref, dropRef, userRef], node);
|
|
4908
5183
|
},
|
|
4909
5184
|
[dropRef]
|
|
4910
5185
|
);
|
|
5186
|
+
const _experimentalVirtualization = useAppStore(
|
|
5187
|
+
(s) => s._experimentalVirtualization
|
|
5188
|
+
);
|
|
4911
5189
|
const El = as != null ? as : "div";
|
|
4912
|
-
|
|
5190
|
+
const isRootAreaZone = (areaId != null ? areaId : rootAreaId) === rootAreaId && depth === 0;
|
|
5191
|
+
const shouldVirtualizeItems = _experimentalVirtualization && isRootAreaZone;
|
|
5192
|
+
return /* @__PURE__ */ jsx31(
|
|
4913
5193
|
El,
|
|
4914
5194
|
{
|
|
4915
5195
|
className: `${getClassName17({
|
|
@@ -4927,20 +5207,37 @@ var DropZoneEdit = forwardRef(
|
|
|
4927
5207
|
"--min-empty-height": minEmptyHeight,
|
|
4928
5208
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
4929
5209
|
}),
|
|
4930
|
-
children:
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
5210
|
+
children: shouldVirtualizeItems ? /* @__PURE__ */ jsx31(
|
|
5211
|
+
VirtualizedDropZone,
|
|
5212
|
+
{
|
|
5213
|
+
contentIds: contentIdsWithPreview,
|
|
5214
|
+
zoneCompound,
|
|
5215
|
+
renderItem: (props) => /* @__PURE__ */ jsx31(
|
|
5216
|
+
DropZoneChildMemo,
|
|
5217
|
+
{
|
|
5218
|
+
zoneCompound,
|
|
5219
|
+
componentId: props.componentId,
|
|
5220
|
+
dragAxis,
|
|
5221
|
+
index: props.index,
|
|
5222
|
+
collisionAxis,
|
|
5223
|
+
inDroppableZone: targetAccepted,
|
|
5224
|
+
itemRef: props.measureRef
|
|
5225
|
+
},
|
|
5226
|
+
props.componentId
|
|
5227
|
+
)
|
|
5228
|
+
}
|
|
5229
|
+
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ jsx31(
|
|
5230
|
+
DropZoneChildMemo,
|
|
5231
|
+
{
|
|
5232
|
+
zoneCompound,
|
|
5233
|
+
componentId,
|
|
5234
|
+
dragAxis,
|
|
5235
|
+
index: i,
|
|
5236
|
+
collisionAxis,
|
|
5237
|
+
inDroppableZone: targetAccepted
|
|
5238
|
+
},
|
|
5239
|
+
componentId
|
|
5240
|
+
))
|
|
4944
5241
|
}
|
|
4945
5242
|
);
|
|
4946
5243
|
}
|
|
@@ -4951,8 +5248,8 @@ var DropZoneRenderItem = ({
|
|
|
4951
5248
|
metadata
|
|
4952
5249
|
}) => {
|
|
4953
5250
|
const Component = config.components[item.type];
|
|
4954
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */
|
|
4955
|
-
const nextContextValue =
|
|
5251
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx31(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5252
|
+
const nextContextValue = useMemo12(
|
|
4956
5253
|
() => ({
|
|
4957
5254
|
areaId: props.id,
|
|
4958
5255
|
depth: 1
|
|
@@ -4960,7 +5257,7 @@ var DropZoneRenderItem = ({
|
|
|
4960
5257
|
[props]
|
|
4961
5258
|
);
|
|
4962
5259
|
const richtextProps = useRichtextProps(Component.fields, props);
|
|
4963
|
-
return /* @__PURE__ */
|
|
5260
|
+
return /* @__PURE__ */ jsx31(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx31(
|
|
4964
5261
|
Component.render,
|
|
4965
5262
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
4966
5263
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
@@ -4970,12 +5267,12 @@ var DropZoneRenderItem = ({
|
|
|
4970
5267
|
})
|
|
4971
5268
|
) }, props.id);
|
|
4972
5269
|
};
|
|
4973
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */
|
|
5270
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx31(DropZoneRender, __spreadValues({}, props));
|
|
4974
5271
|
var DropZoneRender = forwardRef(
|
|
4975
5272
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
4976
|
-
const ctx =
|
|
5273
|
+
const ctx = useContext9(dropZoneContext);
|
|
4977
5274
|
const { areaId = "root" } = ctx || {};
|
|
4978
|
-
const { config, data, metadata } =
|
|
5275
|
+
const { config, data, metadata } = useContext9(renderContext);
|
|
4979
5276
|
let zoneCompound = `${areaId}:${zone}`;
|
|
4980
5277
|
let content = (data == null ? void 0 : data.content) || [];
|
|
4981
5278
|
useEffect16(() => {
|
|
@@ -4992,10 +5289,10 @@ var DropZoneRender = forwardRef(
|
|
|
4992
5289
|
if (zoneCompound !== rootDroppableId) {
|
|
4993
5290
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
4994
5291
|
}
|
|
4995
|
-
return /* @__PURE__ */
|
|
5292
|
+
return /* @__PURE__ */ jsx31(El, { className, style, ref, children: content.map((item) => {
|
|
4996
5293
|
const Component = config.components[item.type];
|
|
4997
5294
|
if (Component) {
|
|
4998
|
-
return /* @__PURE__ */
|
|
5295
|
+
return /* @__PURE__ */ jsx31(
|
|
4999
5296
|
DropZoneRenderItem,
|
|
5000
5297
|
{
|
|
5001
5298
|
config,
|
|
@@ -5009,20 +5306,20 @@ var DropZoneRender = forwardRef(
|
|
|
5009
5306
|
}) });
|
|
5010
5307
|
}
|
|
5011
5308
|
);
|
|
5012
|
-
var DropZonePure = (props) => /* @__PURE__ */
|
|
5309
|
+
var DropZonePure = (props) => /* @__PURE__ */ jsx31(DropZone, __spreadValues({}, props));
|
|
5013
5310
|
var DropZone = forwardRef(
|
|
5014
5311
|
function DropZone2(props, ref) {
|
|
5015
|
-
const ctx =
|
|
5312
|
+
const ctx = useContext9(dropZoneContext);
|
|
5016
5313
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
5017
|
-
return /* @__PURE__ */
|
|
5314
|
+
return /* @__PURE__ */ jsx31(Fragment9, { children: /* @__PURE__ */ jsx31(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
5018
5315
|
}
|
|
5019
|
-
return /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ jsx31(Fragment9, { children: /* @__PURE__ */ jsx31(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
5020
5317
|
}
|
|
5021
5318
|
);
|
|
5022
5319
|
|
|
5023
5320
|
// components/Render/index.tsx
|
|
5024
|
-
import React3, { useMemo as
|
|
5025
|
-
import { jsx as
|
|
5321
|
+
import React3, { useMemo as useMemo13 } from "react";
|
|
5322
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5026
5323
|
var renderContext = React3.createContext({
|
|
5027
5324
|
config: { components: {} },
|
|
5028
5325
|
data: { root: {}, content: [] },
|
|
@@ -5054,10 +5351,10 @@ function Render({
|
|
|
5054
5351
|
const propsWithSlots = useSlots(
|
|
5055
5352
|
config,
|
|
5056
5353
|
{ type: "root", props: pageProps },
|
|
5057
|
-
(props) => /* @__PURE__ */
|
|
5354
|
+
(props) => /* @__PURE__ */ jsx32(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5058
5355
|
);
|
|
5059
5356
|
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, pageProps);
|
|
5060
|
-
const nextContextValue =
|
|
5357
|
+
const nextContextValue = useMemo13(
|
|
5061
5358
|
() => ({
|
|
5062
5359
|
mode: "render",
|
|
5063
5360
|
depth: 0
|
|
@@ -5065,14 +5362,14 @@ function Render({
|
|
|
5065
5362
|
[]
|
|
5066
5363
|
);
|
|
5067
5364
|
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
5068
|
-
return /* @__PURE__ */
|
|
5365
|
+
return /* @__PURE__ */ jsx32(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx32(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx32(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ jsx32(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5069
5366
|
}
|
|
5070
|
-
return /* @__PURE__ */
|
|
5367
|
+
return /* @__PURE__ */ jsx32(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx32(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx32(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5071
5368
|
}
|
|
5072
5369
|
|
|
5073
5370
|
// lib/use-puck.ts
|
|
5074
5371
|
init_react_import();
|
|
5075
|
-
import { createContext as createContext5, useContext as
|
|
5372
|
+
import { createContext as createContext5, useContext as useContext10, useEffect as useEffect17, useState as useState16 } from "react";
|
|
5076
5373
|
import { createStore as createStore5, useStore as useStore3 } from "zustand";
|
|
5077
5374
|
|
|
5078
5375
|
// lib/data/resolve-data-by-id.ts
|
|
@@ -5191,7 +5488,7 @@ var convertToPickedStore = (store) => {
|
|
|
5191
5488
|
};
|
|
5192
5489
|
};
|
|
5193
5490
|
var useRegisterUsePuckStore = (appStore) => {
|
|
5194
|
-
const [usePuckStore] =
|
|
5491
|
+
const [usePuckStore] = useState16(
|
|
5195
5492
|
() => createStore5(
|
|
5196
5493
|
() => generateUsePuck(
|
|
5197
5494
|
convertToPickedStore(appStore.getState()),
|
|
@@ -5211,7 +5508,7 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
|
5211
5508
|
};
|
|
5212
5509
|
function createUsePuck() {
|
|
5213
5510
|
return function usePuck2(selector) {
|
|
5214
|
-
const usePuckApi =
|
|
5511
|
+
const usePuckApi = useContext10(UsePuckStoreContext);
|
|
5215
5512
|
if (!usePuckApi) {
|
|
5216
5513
|
throw new Error("usePuck must be used inside <Puck>.");
|
|
5217
5514
|
}
|
|
@@ -5231,7 +5528,7 @@ function usePuck() {
|
|
|
5231
5528
|
return createUsePuck()((s) => s);
|
|
5232
5529
|
}
|
|
5233
5530
|
function useGetPuck() {
|
|
5234
|
-
const usePuckApi =
|
|
5531
|
+
const usePuckApi = useContext10(UsePuckStoreContext);
|
|
5235
5532
|
if (!usePuckApi) {
|
|
5236
5533
|
throw new Error("usePuckGet must be used inside <Puck>.");
|
|
5237
5534
|
}
|
|
@@ -5246,7 +5543,7 @@ init_react_import();
|
|
|
5246
5543
|
|
|
5247
5544
|
// lib/use-component-list.tsx
|
|
5248
5545
|
init_react_import();
|
|
5249
|
-
import { useEffect as useEffect19, useState as
|
|
5546
|
+
import { useEffect as useEffect19, useState as useState17 } from "react";
|
|
5250
5547
|
|
|
5251
5548
|
// components/ComponentList/index.tsx
|
|
5252
5549
|
init_react_import();
|
|
@@ -5257,7 +5554,7 @@ var styles_module_default12 = { "ComponentList": "_ComponentList_1rrlt_1", "Comp
|
|
|
5257
5554
|
|
|
5258
5555
|
// components/ComponentList/index.tsx
|
|
5259
5556
|
import { useEffect as useEffect18 } from "react";
|
|
5260
|
-
import { jsx as
|
|
5557
|
+
import { jsx as jsx33, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5261
5558
|
var getClassName18 = get_class_name_factory_default("ComponentList", styles_module_default12);
|
|
5262
5559
|
var ComponentListItem = ({
|
|
5263
5560
|
name,
|
|
@@ -5277,7 +5574,7 @@ var ComponentListItem = ({
|
|
|
5277
5574
|
);
|
|
5278
5575
|
}
|
|
5279
5576
|
}, [overrides]);
|
|
5280
|
-
return /* @__PURE__ */
|
|
5577
|
+
return /* @__PURE__ */ jsx33(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
5281
5578
|
};
|
|
5282
5579
|
var ComponentList = ({
|
|
5283
5580
|
children,
|
|
@@ -5303,14 +5600,14 @@ var ComponentList = ({
|
|
|
5303
5600
|
}),
|
|
5304
5601
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
5305
5602
|
children: [
|
|
5306
|
-
/* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5603
|
+
/* @__PURE__ */ jsx33("div", { children: title }),
|
|
5604
|
+
/* @__PURE__ */ jsx33("div", { className: getClassName18("titleIcon"), children: expanded ? /* @__PURE__ */ jsx33(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx33(ChevronDown, { size: 12 }) })
|
|
5308
5605
|
]
|
|
5309
5606
|
}
|
|
5310
5607
|
),
|
|
5311
|
-
/* @__PURE__ */
|
|
5608
|
+
/* @__PURE__ */ jsx33("div", { className: getClassName18("content"), children: /* @__PURE__ */ jsx33(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
|
|
5312
5609
|
var _a;
|
|
5313
|
-
return /* @__PURE__ */
|
|
5610
|
+
return /* @__PURE__ */ jsx33(
|
|
5314
5611
|
ComponentListItem,
|
|
5315
5612
|
{
|
|
5316
5613
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
|
@@ -5324,9 +5621,9 @@ var ComponentList = ({
|
|
|
5324
5621
|
ComponentList.Item = ComponentListItem;
|
|
5325
5622
|
|
|
5326
5623
|
// lib/use-component-list.tsx
|
|
5327
|
-
import { jsx as
|
|
5624
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5328
5625
|
var useComponentList = () => {
|
|
5329
|
-
const [componentList, setComponentList] =
|
|
5626
|
+
const [componentList, setComponentList] = useState17();
|
|
5330
5627
|
const config = useAppStore((s) => s.config);
|
|
5331
5628
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
|
5332
5629
|
useEffect19(() => {
|
|
@@ -5345,7 +5642,7 @@ var useComponentList = () => {
|
|
|
5345
5642
|
if (category.visible === false) {
|
|
5346
5643
|
return null;
|
|
5347
5644
|
}
|
|
5348
|
-
return /* @__PURE__ */
|
|
5645
|
+
return /* @__PURE__ */ jsx34(
|
|
5349
5646
|
ComponentList,
|
|
5350
5647
|
{
|
|
5351
5648
|
id: categoryKey,
|
|
@@ -5353,7 +5650,7 @@ var useComponentList = () => {
|
|
|
5353
5650
|
children: category.components.map((componentName, i) => {
|
|
5354
5651
|
var _a2;
|
|
5355
5652
|
const componentConf = config.components[componentName] || {};
|
|
5356
|
-
return /* @__PURE__ */
|
|
5653
|
+
return /* @__PURE__ */ jsx34(
|
|
5357
5654
|
ComponentList.Item,
|
|
5358
5655
|
{
|
|
5359
5656
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
|
@@ -5373,7 +5670,7 @@ var useComponentList = () => {
|
|
|
5373
5670
|
);
|
|
5374
5671
|
if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
|
|
5375
5672
|
_componentList.push(
|
|
5376
|
-
/* @__PURE__ */
|
|
5673
|
+
/* @__PURE__ */ jsx34(
|
|
5377
5674
|
ComponentList,
|
|
5378
5675
|
{
|
|
5379
5676
|
id: "other",
|
|
@@ -5381,7 +5678,7 @@ var useComponentList = () => {
|
|
|
5381
5678
|
children: remainingComponents.map((componentName, i) => {
|
|
5382
5679
|
var _a2;
|
|
5383
5680
|
const componentConf = config.components[componentName] || {};
|
|
5384
|
-
return /* @__PURE__ */
|
|
5681
|
+
return /* @__PURE__ */ jsx34(
|
|
5385
5682
|
ComponentList.Item,
|
|
5386
5683
|
{
|
|
5387
5684
|
name: componentName,
|
|
@@ -5403,12 +5700,12 @@ var useComponentList = () => {
|
|
|
5403
5700
|
};
|
|
5404
5701
|
|
|
5405
5702
|
// components/Puck/components/Components/index.tsx
|
|
5406
|
-
import { useMemo as
|
|
5407
|
-
import { jsx as
|
|
5703
|
+
import { useMemo as useMemo14 } from "react";
|
|
5704
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5408
5705
|
var Components = () => {
|
|
5409
5706
|
const overrides = useAppStore((s) => s.overrides);
|
|
5410
5707
|
const componentList = useComponentList();
|
|
5411
|
-
const Wrapper =
|
|
5708
|
+
const Wrapper = useMemo14(() => {
|
|
5412
5709
|
if (overrides.components) {
|
|
5413
5710
|
console.warn(
|
|
5414
5711
|
"The `components` override has been deprecated and renamed to `drawer`"
|
|
@@ -5416,7 +5713,7 @@ var Components = () => {
|
|
|
5416
5713
|
}
|
|
5417
5714
|
return overrides.components || overrides.drawer || "div";
|
|
5418
5715
|
}, [overrides]);
|
|
5419
|
-
return /* @__PURE__ */
|
|
5716
|
+
return /* @__PURE__ */ jsx35(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx35(ComponentList, { id: "all" }) });
|
|
5420
5717
|
};
|
|
5421
5718
|
|
|
5422
5719
|
// css-module:/home/runner/work/puck/puck/packages/core/plugins/blocks/styles.module.css#css-module
|
|
@@ -5424,13 +5721,13 @@ init_react_import();
|
|
|
5424
5721
|
var styles_module_default13 = { "BlocksPlugin": "_BlocksPlugin_1ey1i_1" };
|
|
5425
5722
|
|
|
5426
5723
|
// plugins/blocks/index.tsx
|
|
5427
|
-
import { jsx as
|
|
5724
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5428
5725
|
var getClassName19 = get_class_name_factory_default("BlocksPlugin", styles_module_default13);
|
|
5429
5726
|
var blocksPlugin = () => ({
|
|
5430
5727
|
name: "blocks",
|
|
5431
5728
|
label: "Blocks",
|
|
5432
|
-
render: () => /* @__PURE__ */
|
|
5433
|
-
icon: /* @__PURE__ */
|
|
5729
|
+
render: () => /* @__PURE__ */ jsx36("div", { className: getClassName19(), children: /* @__PURE__ */ jsx36(Components, {}) }),
|
|
5730
|
+
icon: /* @__PURE__ */ jsx36(Hammer, {})
|
|
5434
5731
|
});
|
|
5435
5732
|
|
|
5436
5733
|
// plugins/outline/index.tsx
|
|
@@ -5446,99 +5743,157 @@ init_react_import();
|
|
|
5446
5743
|
init_react_import();
|
|
5447
5744
|
var styles_module_default14 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
|
|
5448
5745
|
|
|
5449
|
-
// lib/scroll-into-view.ts
|
|
5450
|
-
init_react_import();
|
|
5451
|
-
var scrollIntoView = (el) => {
|
|
5452
|
-
const oldStyle = __spreadValues({}, el.style);
|
|
5453
|
-
el.style.scrollMargin = "256px";
|
|
5454
|
-
if (el) {
|
|
5455
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
5456
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
5457
|
-
}
|
|
5458
|
-
};
|
|
5459
|
-
|
|
5460
5746
|
// components/LayerTree/index.tsx
|
|
5461
|
-
import {
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
scrollTimeout = setTimeout(function() {
|
|
5470
|
-
cb();
|
|
5471
|
-
frame == null ? void 0 : frame.removeEventListener("scroll", callback);
|
|
5472
|
-
}, 50);
|
|
5473
|
-
};
|
|
5474
|
-
frame == null ? void 0 : frame.addEventListener("scroll", callback);
|
|
5475
|
-
setTimeout(() => {
|
|
5476
|
-
if (!scrollTimeout) {
|
|
5477
|
-
cb();
|
|
5478
|
-
}
|
|
5479
|
-
}, 50);
|
|
5480
|
-
};
|
|
5481
|
-
|
|
5482
|
-
// components/LayerTree/index.tsx
|
|
5483
|
-
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
|
5484
|
-
import { Fragment as Fragment9, jsx as jsx36, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5747
|
+
import {
|
|
5748
|
+
forwardRef as forwardRef2,
|
|
5749
|
+
useCallback as useCallback14,
|
|
5750
|
+
useContext as useContext11,
|
|
5751
|
+
useRef as useRef10
|
|
5752
|
+
} from "react";
|
|
5753
|
+
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
5754
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5485
5755
|
var getClassName20 = get_class_name_factory_default("LayerTree", styles_module_default14);
|
|
5486
5756
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default14);
|
|
5487
|
-
var
|
|
5488
|
-
|
|
5757
|
+
var DEFAULT_LAYER_ROW_HEIGHT = 32;
|
|
5758
|
+
var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
|
|
5759
|
+
var MIN_VIRTUALIZED_LAYER_COUNT = 25;
|
|
5760
|
+
var measuredRowHeights = /* @__PURE__ */ new Map();
|
|
5761
|
+
var getZonesByParent = (zones) => {
|
|
5762
|
+
return Object.keys(zones).reduce((acc, zone) => {
|
|
5763
|
+
const [parentId] = zone.split(":");
|
|
5764
|
+
acc[parentId] = [...acc[parentId] || [], zone];
|
|
5765
|
+
return acc;
|
|
5766
|
+
}, {});
|
|
5767
|
+
};
|
|
5768
|
+
var getZoneLabel = (zoneCompound, nodes, config, label) => {
|
|
5769
|
+
var _a, _b, _c, _d;
|
|
5770
|
+
if (label !== void 0) {
|
|
5771
|
+
return label;
|
|
5772
|
+
}
|
|
5773
|
+
const [componentId, slotId] = zoneCompound.split(":");
|
|
5774
|
+
if (!slotId) {
|
|
5775
|
+
return;
|
|
5776
|
+
}
|
|
5777
|
+
const componentType = (_a = nodes[componentId]) == null ? void 0 : _a.data.type;
|
|
5778
|
+
const configForComponent = componentType && componentType !== rootAreaId ? config.components[componentType] : config.root;
|
|
5779
|
+
return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
|
|
5780
|
+
};
|
|
5781
|
+
var buildLayerNode = ({
|
|
5782
|
+
config,
|
|
5489
5783
|
itemId,
|
|
5490
|
-
|
|
5784
|
+
index,
|
|
5785
|
+
nodes,
|
|
5786
|
+
zoneCompound,
|
|
5787
|
+
zones,
|
|
5788
|
+
zonesByParent
|
|
5789
|
+
}) => {
|
|
5790
|
+
var _a, _b, _c;
|
|
5791
|
+
const nodeData = nodes[itemId];
|
|
5792
|
+
const componentType = ((_a = nodeData == null ? void 0 : nodeData.data.type) == null ? void 0 : _a.toString()) || "Component";
|
|
5793
|
+
const label = (_c = (_b = config.components[componentType]) == null ? void 0 : _b.label) != null ? _c : componentType;
|
|
5794
|
+
const childZoneCompounds = zonesByParent[itemId] || [];
|
|
5795
|
+
return {
|
|
5796
|
+
childZones: childZoneCompounds.map(
|
|
5797
|
+
(childZoneCompound) => buildLayerTree({
|
|
5798
|
+
config,
|
|
5799
|
+
nodes,
|
|
5800
|
+
zoneCompound: childZoneCompound,
|
|
5801
|
+
zones,
|
|
5802
|
+
zonesByParent
|
|
5803
|
+
})
|
|
5804
|
+
),
|
|
5805
|
+
componentType,
|
|
5806
|
+
index,
|
|
5807
|
+
itemId,
|
|
5808
|
+
label,
|
|
5809
|
+
zoneCompound
|
|
5810
|
+
};
|
|
5811
|
+
};
|
|
5812
|
+
var buildLayerTree = ({
|
|
5813
|
+
config,
|
|
5814
|
+
label,
|
|
5815
|
+
nodes,
|
|
5816
|
+
zoneCompound,
|
|
5817
|
+
zones,
|
|
5818
|
+
zonesByParent = getZonesByParent(zones)
|
|
5491
5819
|
}) => {
|
|
5820
|
+
var _a, _b;
|
|
5821
|
+
const contentIds = (_b = (_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
5822
|
+
return {
|
|
5823
|
+
items: contentIds.map(
|
|
5824
|
+
(itemId, index) => buildLayerNode({
|
|
5825
|
+
config,
|
|
5826
|
+
itemId,
|
|
5827
|
+
index,
|
|
5828
|
+
nodes,
|
|
5829
|
+
zoneCompound,
|
|
5830
|
+
zones,
|
|
5831
|
+
zonesByParent
|
|
5832
|
+
})
|
|
5833
|
+
),
|
|
5834
|
+
label: getZoneLabel(zoneCompound, nodes, config, label),
|
|
5835
|
+
zoneCompound
|
|
5836
|
+
};
|
|
5837
|
+
};
|
|
5838
|
+
var getEstimatedRowHeight = (itemId) => {
|
|
5492
5839
|
var _a;
|
|
5493
|
-
|
|
5494
|
-
|
|
5840
|
+
return (_a = measuredRowHeights.get(itemId)) != null ? _a : DEFAULT_LAYER_ROW_HEIGHT;
|
|
5841
|
+
};
|
|
5842
|
+
var cacheMeasuredRowHeight = (itemId, height) => {
|
|
5843
|
+
if (height <= 0) {
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5846
|
+
measuredRowHeights.set(itemId, height);
|
|
5847
|
+
};
|
|
5848
|
+
var getScrollParent = (el) => {
|
|
5849
|
+
var _a;
|
|
5850
|
+
let current = (_a = el == null ? void 0 : el.parentElement) != null ? _a : null;
|
|
5851
|
+
while (current) {
|
|
5852
|
+
const { overflow, overflowY } = getComputedStyle(current);
|
|
5853
|
+
if ([overflow, overflowY].some((value) => /auto|scroll/.test(value))) {
|
|
5854
|
+
return current;
|
|
5855
|
+
}
|
|
5856
|
+
current = current.parentElement;
|
|
5857
|
+
}
|
|
5858
|
+
return null;
|
|
5859
|
+
};
|
|
5860
|
+
var Layer = forwardRef2(function Layer2({
|
|
5861
|
+
childIsSelected,
|
|
5862
|
+
dataIndex,
|
|
5863
|
+
depth,
|
|
5864
|
+
isSelected,
|
|
5865
|
+
node,
|
|
5866
|
+
selectedId,
|
|
5867
|
+
selectedPathIds
|
|
5868
|
+
}, ref) {
|
|
5495
5869
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
5496
|
-
const
|
|
5497
|
-
(itemSelector2) => {
|
|
5498
|
-
dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
|
|
5499
|
-
},
|
|
5500
|
-
[dispatch]
|
|
5501
|
-
);
|
|
5502
|
-
const selecedItemId = useAppStore((s) => {
|
|
5503
|
-
var _a2;
|
|
5504
|
-
return (_a2 = s.selectedItem) == null ? void 0 : _a2.props.id;
|
|
5505
|
-
});
|
|
5506
|
-
const isSelected = selecedItemId === itemId || itemSelector && itemSelector.zone === rootDroppableId && !zoneCompound;
|
|
5507
|
-
const nodeData = useAppStore((s) => s.state.indexes.nodes[itemId]);
|
|
5508
|
-
const zonesForItem = useAppStore(
|
|
5509
|
-
useShallow7(
|
|
5510
|
-
(s) => Object.keys(s.state.indexes.zones).filter(
|
|
5511
|
-
(z) => z.split(":")[0] === itemId
|
|
5512
|
-
)
|
|
5513
|
-
)
|
|
5514
|
-
);
|
|
5515
|
-
const containsZone = zonesForItem.length > 0;
|
|
5516
|
-
const zoneStore = useContext10(ZoneStoreContext);
|
|
5870
|
+
const zoneStore = useContext11(ZoneStoreContext);
|
|
5517
5871
|
const isHovering = useContextStore(
|
|
5518
5872
|
ZoneStoreContext,
|
|
5519
|
-
(s) => s.hoveringComponent === itemId
|
|
5873
|
+
(s) => s.hoveringComponent === node.itemId
|
|
5520
5874
|
);
|
|
5521
|
-
const
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
const componentConfig = config.components[nodeData.data.type];
|
|
5530
|
-
const label = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : nodeData.data.type.toString();
|
|
5875
|
+
const containsZone = node.childZones.length > 0;
|
|
5876
|
+
const setItemSelector = useCallback14(
|
|
5877
|
+
(itemSelector) => {
|
|
5878
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
5879
|
+
},
|
|
5880
|
+
[dispatch]
|
|
5881
|
+
);
|
|
5882
|
+
const shouldRenderChildren = isSelected || childIsSelected;
|
|
5531
5883
|
return /* @__PURE__ */ jsxs11(
|
|
5532
5884
|
"li",
|
|
5533
5885
|
{
|
|
5886
|
+
ref,
|
|
5534
5887
|
className: getClassNameLayer({
|
|
5535
|
-
|
|
5536
|
-
isHovering,
|
|
5888
|
+
childIsSelected,
|
|
5537
5889
|
containsZone,
|
|
5538
|
-
|
|
5890
|
+
isHovering,
|
|
5891
|
+
isSelected
|
|
5539
5892
|
}),
|
|
5893
|
+
"data-index": dataIndex,
|
|
5894
|
+
"data-puck-layer-tree-id": node.itemId,
|
|
5540
5895
|
children: [
|
|
5541
|
-
/* @__PURE__ */
|
|
5896
|
+
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs11(
|
|
5542
5897
|
"button",
|
|
5543
5898
|
{
|
|
5544
5899
|
type: "button",
|
|
@@ -5548,99 +5903,207 @@ var Layer = ({
|
|
|
5548
5903
|
setItemSelector(null);
|
|
5549
5904
|
return;
|
|
5550
5905
|
}
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
);
|
|
5555
|
-
if (!el) {
|
|
5556
|
-
setItemSelector({
|
|
5557
|
-
index,
|
|
5558
|
-
zone: zoneCompound
|
|
5559
|
-
});
|
|
5560
|
-
return;
|
|
5561
|
-
}
|
|
5562
|
-
scrollIntoView(el);
|
|
5563
|
-
onScrollEnd(frame, () => {
|
|
5564
|
-
setItemSelector({
|
|
5565
|
-
index,
|
|
5566
|
-
zone: zoneCompound
|
|
5567
|
-
});
|
|
5906
|
+
setItemSelector({
|
|
5907
|
+
index: node.index,
|
|
5908
|
+
zone: node.zoneCompound
|
|
5568
5909
|
});
|
|
5910
|
+
zoneStore.getState().scrollToComponent(node.itemId);
|
|
5569
5911
|
},
|
|
5570
5912
|
onMouseEnter: (e) => {
|
|
5571
5913
|
e.stopPropagation();
|
|
5572
|
-
zoneStore.setState({ hoveringComponent: itemId });
|
|
5914
|
+
zoneStore.setState({ hoveringComponent: node.itemId });
|
|
5573
5915
|
},
|
|
5574
5916
|
onMouseLeave: (e) => {
|
|
5575
5917
|
e.stopPropagation();
|
|
5576
5918
|
zoneStore.setState({ hoveringComponent: null });
|
|
5577
5919
|
},
|
|
5578
5920
|
children: [
|
|
5579
|
-
containsZone && /* @__PURE__ */
|
|
5921
|
+
containsZone && /* @__PURE__ */ jsx37(
|
|
5580
5922
|
"div",
|
|
5581
5923
|
{
|
|
5582
5924
|
className: getClassNameLayer("chevron"),
|
|
5583
5925
|
title: isSelected ? "Collapse" : "Expand",
|
|
5584
|
-
children: /* @__PURE__ */
|
|
5926
|
+
children: /* @__PURE__ */ jsx37(ChevronDown, { size: "12" })
|
|
5585
5927
|
}
|
|
5586
5928
|
),
|
|
5587
5929
|
/* @__PURE__ */ jsxs11("div", { className: getClassNameLayer("title"), children: [
|
|
5588
|
-
/* @__PURE__ */
|
|
5589
|
-
/* @__PURE__ */
|
|
5930
|
+
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("icon"), children: node.componentType === "Text" || node.componentType === "Heading" ? /* @__PURE__ */ jsx37(Type, { size: "16" }) : /* @__PURE__ */ jsx37(LayoutGrid, { size: "16" }) }),
|
|
5931
|
+
/* @__PURE__ */ jsx37("div", { className: getClassNameLayer("name"), children: node.label })
|
|
5590
5932
|
] })
|
|
5591
5933
|
]
|
|
5592
5934
|
}
|
|
5593
5935
|
) }),
|
|
5594
|
-
containsZone &&
|
|
5936
|
+
containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */ jsx37(
|
|
5937
|
+
"div",
|
|
5938
|
+
{
|
|
5939
|
+
className: getClassNameLayer("zones"),
|
|
5940
|
+
children: /* @__PURE__ */ jsx37(
|
|
5941
|
+
LayerTreeZone,
|
|
5942
|
+
{
|
|
5943
|
+
depth: depth + 1,
|
|
5944
|
+
selectedId,
|
|
5945
|
+
selectedPathIds,
|
|
5946
|
+
tree: childZone
|
|
5947
|
+
}
|
|
5948
|
+
)
|
|
5949
|
+
},
|
|
5950
|
+
childZone.zoneCompound
|
|
5951
|
+
))
|
|
5595
5952
|
]
|
|
5596
5953
|
}
|
|
5597
5954
|
);
|
|
5598
|
-
};
|
|
5599
|
-
var
|
|
5600
|
-
|
|
5601
|
-
|
|
5955
|
+
});
|
|
5956
|
+
var LayerTreeZone = ({
|
|
5957
|
+
depth,
|
|
5958
|
+
selectedId,
|
|
5959
|
+
selectedPathIds,
|
|
5960
|
+
tree
|
|
5602
5961
|
}) => {
|
|
5603
|
-
const
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5962
|
+
const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
|
|
5963
|
+
return /* @__PURE__ */ jsxs11(Fragment10, { children: [
|
|
5964
|
+
tree.label && /* @__PURE__ */ jsxs11("div", { className: getClassName20("zoneTitle"), children: [
|
|
5965
|
+
/* @__PURE__ */ jsx37("div", { className: getClassName20("zoneIcon"), children: /* @__PURE__ */ jsx37(Layers, { size: "16" }) }),
|
|
5966
|
+
tree.label
|
|
5967
|
+
] }),
|
|
5968
|
+
shouldVirtualize ? /* @__PURE__ */ jsx37(
|
|
5969
|
+
VirtualizedLayerTreeItems,
|
|
5970
|
+
{
|
|
5971
|
+
depth,
|
|
5972
|
+
selectedId,
|
|
5973
|
+
selectedPathIds,
|
|
5974
|
+
tree
|
|
5975
|
+
}
|
|
5976
|
+
) : /* @__PURE__ */ jsx37(
|
|
5977
|
+
StaticLayerTreeItems,
|
|
5978
|
+
{
|
|
5979
|
+
depth,
|
|
5980
|
+
selectedId,
|
|
5981
|
+
selectedPathIds,
|
|
5982
|
+
tree
|
|
5617
5983
|
}
|
|
5618
5984
|
)
|
|
5619
|
-
);
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5985
|
+
] });
|
|
5986
|
+
};
|
|
5987
|
+
var StaticLayerTreeItems = ({
|
|
5988
|
+
depth,
|
|
5989
|
+
selectedId,
|
|
5990
|
+
selectedPathIds,
|
|
5991
|
+
tree
|
|
5992
|
+
}) => {
|
|
5993
|
+
return /* @__PURE__ */ jsxs11("ul", { className: getClassName20(), children: [
|
|
5994
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx37("div", { className: getClassName20("helper"), children: "No items" }),
|
|
5995
|
+
tree.items.map((node) => /* @__PURE__ */ jsx37(
|
|
5996
|
+
Layer,
|
|
5997
|
+
{
|
|
5998
|
+
childIsSelected: selectedPathIds.has(node.itemId),
|
|
5999
|
+
depth,
|
|
6000
|
+
isSelected: selectedId === node.itemId,
|
|
6001
|
+
node,
|
|
6002
|
+
selectedId,
|
|
6003
|
+
selectedPathIds
|
|
6004
|
+
},
|
|
6005
|
+
node.itemId
|
|
6006
|
+
))
|
|
6007
|
+
] });
|
|
6008
|
+
};
|
|
6009
|
+
var VirtualizedLayerTreeItems = ({
|
|
6010
|
+
depth,
|
|
6011
|
+
selectedId,
|
|
6012
|
+
selectedPathIds,
|
|
6013
|
+
tree
|
|
6014
|
+
}) => {
|
|
6015
|
+
const listRef = useRef10(null);
|
|
6016
|
+
const virtualizer = useVirtualizer2({
|
|
6017
|
+
count: tree.items.length,
|
|
6018
|
+
estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
|
|
6019
|
+
getItemKey: (index) => tree.items[index].itemId,
|
|
6020
|
+
getScrollElement: () => getScrollParent(listRef.current),
|
|
6021
|
+
overscan: LAYER_TREE_VIRTUALIZATION_OVERSCAN,
|
|
6022
|
+
measureElement: (element) => {
|
|
6023
|
+
const height = Math.ceil(element.getBoundingClientRect().height);
|
|
6024
|
+
const itemId = element.dataset.puckLayerTreeId;
|
|
6025
|
+
if (itemId) {
|
|
6026
|
+
cacheMeasuredRowHeight(itemId, height);
|
|
6027
|
+
}
|
|
6028
|
+
return height || DEFAULT_LAYER_ROW_HEIGHT;
|
|
6029
|
+
}
|
|
6030
|
+
});
|
|
6031
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
6032
|
+
const totalSize = virtualizer.getTotalSize();
|
|
6033
|
+
const renderedItems = [];
|
|
6034
|
+
let previousEnd = 0;
|
|
6035
|
+
let previousIndex = -1;
|
|
6036
|
+
virtualItems.forEach((virtualItem) => {
|
|
6037
|
+
const node = tree.items[virtualItem.index];
|
|
6038
|
+
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
6039
|
+
if (gapSize > 0) {
|
|
6040
|
+
renderedItems.push(
|
|
6041
|
+
/* @__PURE__ */ jsx37(
|
|
6042
|
+
"li",
|
|
5630
6043
|
{
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
zoneCompound
|
|
6044
|
+
"aria-hidden": "true",
|
|
6045
|
+
style: { height: `${gapSize}px` }
|
|
5634
6046
|
},
|
|
5635
|
-
|
|
5636
|
-
)
|
|
5637
|
-
|
|
5638
|
-
|
|
6047
|
+
`gap:${tree.zoneCompound}:${previousIndex}:${virtualItem.index}`
|
|
6048
|
+
)
|
|
6049
|
+
);
|
|
6050
|
+
}
|
|
6051
|
+
renderedItems.push(
|
|
6052
|
+
/* @__PURE__ */ jsx37(
|
|
6053
|
+
Layer,
|
|
6054
|
+
{
|
|
6055
|
+
childIsSelected: selectedPathIds.has(node.itemId),
|
|
6056
|
+
dataIndex: virtualItem.index,
|
|
6057
|
+
depth,
|
|
6058
|
+
isSelected: selectedId === node.itemId,
|
|
6059
|
+
node,
|
|
6060
|
+
ref: virtualizer.measureElement,
|
|
6061
|
+
selectedId,
|
|
6062
|
+
selectedPathIds
|
|
6063
|
+
},
|
|
6064
|
+
node.itemId
|
|
6065
|
+
)
|
|
6066
|
+
);
|
|
6067
|
+
previousEnd = virtualItem.end;
|
|
6068
|
+
previousIndex = virtualItem.index;
|
|
6069
|
+
});
|
|
6070
|
+
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
6071
|
+
if (trailingGap > 0) {
|
|
6072
|
+
renderedItems.push(
|
|
6073
|
+
/* @__PURE__ */ jsx37(
|
|
6074
|
+
"li",
|
|
6075
|
+
{
|
|
6076
|
+
"aria-hidden": "true",
|
|
6077
|
+
style: { height: `${trailingGap}px` }
|
|
6078
|
+
},
|
|
6079
|
+
`gap:${tree.zoneCompound}:${previousIndex}:end`
|
|
6080
|
+
)
|
|
6081
|
+
);
|
|
6082
|
+
}
|
|
6083
|
+
return /* @__PURE__ */ jsxs11("ul", { className: getClassName20(), ref: listRef, children: [
|
|
6084
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx37("div", { className: getClassName20("helper"), children: "No items" }),
|
|
6085
|
+
renderedItems
|
|
5639
6086
|
] });
|
|
5640
6087
|
};
|
|
6088
|
+
var LayerTree = ({
|
|
6089
|
+
selectedId,
|
|
6090
|
+
selectedPathIds,
|
|
6091
|
+
trees
|
|
6092
|
+
}) => {
|
|
6093
|
+
return /* @__PURE__ */ jsx37(Fragment10, { children: trees.map((tree) => /* @__PURE__ */ jsx37(
|
|
6094
|
+
LayerTreeZone,
|
|
6095
|
+
{
|
|
6096
|
+
depth: 0,
|
|
6097
|
+
selectedId,
|
|
6098
|
+
selectedPathIds,
|
|
6099
|
+
tree
|
|
6100
|
+
},
|
|
6101
|
+
tree.zoneCompound
|
|
6102
|
+
)) });
|
|
6103
|
+
};
|
|
5641
6104
|
|
|
5642
6105
|
// components/Puck/components/Outline/index.tsx
|
|
5643
|
-
import { useMemo as
|
|
6106
|
+
import { useMemo as useMemo15 } from "react";
|
|
5644
6107
|
|
|
5645
6108
|
// lib/data/find-zones-for-area.ts
|
|
5646
6109
|
init_react_import();
|
|
@@ -5651,22 +6114,48 @@ var findZonesForArea = (state, area) => {
|
|
|
5651
6114
|
};
|
|
5652
6115
|
|
|
5653
6116
|
// components/Puck/components/Outline/index.tsx
|
|
5654
|
-
import { useShallow as
|
|
5655
|
-
import { jsx as
|
|
6117
|
+
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
|
6118
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
5656
6119
|
var Outline = () => {
|
|
5657
6120
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
6121
|
+
const config = useAppStore((s) => s.config);
|
|
6122
|
+
const nodes = useAppStore((s) => s.state.indexes.nodes);
|
|
6123
|
+
const zones = useAppStore((s) => s.state.indexes.zones);
|
|
6124
|
+
const selectedId = useAppStore((s) => {
|
|
6125
|
+
var _a;
|
|
6126
|
+
return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) || null;
|
|
6127
|
+
});
|
|
5658
6128
|
const rootZones = useAppStore(
|
|
5659
|
-
|
|
6129
|
+
useShallow7((s) => findZonesForArea(s.state, "root"))
|
|
5660
6130
|
);
|
|
5661
|
-
const
|
|
5662
|
-
|
|
6131
|
+
const selectedPathIds = useMemo15(() => {
|
|
6132
|
+
var _a;
|
|
6133
|
+
const selectedPath = selectedId ? (_a = nodes[selectedId]) == null ? void 0 : _a.path : null;
|
|
6134
|
+
return new Set(
|
|
6135
|
+
(selectedPath == null ? void 0 : selectedPath.map((candidate) => candidate.split(":")[0]).filter(Boolean)) || []
|
|
6136
|
+
);
|
|
6137
|
+
}, [nodes, selectedId]);
|
|
6138
|
+
const trees = useMemo15(
|
|
6139
|
+
() => rootZones.map(
|
|
6140
|
+
(zoneCompound) => buildLayerTree({
|
|
6141
|
+
config,
|
|
6142
|
+
label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
|
|
6143
|
+
nodes,
|
|
6144
|
+
zoneCompound,
|
|
6145
|
+
zones
|
|
6146
|
+
})
|
|
6147
|
+
),
|
|
6148
|
+
[config, nodes, rootZones, zones]
|
|
6149
|
+
);
|
|
6150
|
+
const Wrapper = useMemo15(() => outlineOverride || "div", [outlineOverride]);
|
|
6151
|
+
return /* @__PURE__ */ jsx38(Wrapper, { children: /* @__PURE__ */ jsx38(
|
|
5663
6152
|
LayerTree,
|
|
5664
6153
|
{
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
)
|
|
6154
|
+
selectedId,
|
|
6155
|
+
selectedPathIds,
|
|
6156
|
+
trees
|
|
6157
|
+
}
|
|
6158
|
+
) });
|
|
5670
6159
|
};
|
|
5671
6160
|
|
|
5672
6161
|
// css-module:/home/runner/work/puck/puck/packages/core/plugins/outline/styles.module.css#css-module
|
|
@@ -5674,13 +6163,13 @@ init_react_import();
|
|
|
5674
6163
|
var styles_module_default15 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
5675
6164
|
|
|
5676
6165
|
// plugins/outline/index.tsx
|
|
5677
|
-
import { jsx as
|
|
6166
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5678
6167
|
var getClassName21 = get_class_name_factory_default("OutlinePlugin", styles_module_default15);
|
|
5679
6168
|
var outlinePlugin = () => ({
|
|
5680
6169
|
name: "outline",
|
|
5681
6170
|
label: "Outline",
|
|
5682
|
-
render: () => /* @__PURE__ */
|
|
5683
|
-
icon: /* @__PURE__ */
|
|
6171
|
+
render: () => /* @__PURE__ */ jsx39("div", { className: getClassName21(), children: /* @__PURE__ */ jsx39(Outline, {}) }),
|
|
6172
|
+
icon: /* @__PURE__ */ jsx39(Layers, {})
|
|
5684
6173
|
});
|
|
5685
6174
|
|
|
5686
6175
|
// plugins/fields/index.tsx
|
|
@@ -5695,7 +6184,7 @@ var styles_module_default16 = { "Breadcrumbs": "_Breadcrumbs_1c9yh_1", "Breadcru
|
|
|
5695
6184
|
|
|
5696
6185
|
// lib/use-breadcrumbs.ts
|
|
5697
6186
|
init_react_import();
|
|
5698
|
-
import { useMemo as
|
|
6187
|
+
import { useMemo as useMemo16 } from "react";
|
|
5699
6188
|
var useBreadcrumbs = (renderCount) => {
|
|
5700
6189
|
const selectedId = useAppStore((s) => {
|
|
5701
6190
|
var _a;
|
|
@@ -5707,7 +6196,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
5707
6196
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
5708
6197
|
});
|
|
5709
6198
|
const appStore = useAppStoreApi();
|
|
5710
|
-
return
|
|
6199
|
+
return useMemo16(() => {
|
|
5711
6200
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
5712
6201
|
var _a, _b, _c, _d;
|
|
5713
6202
|
const [componentId] = zoneCompound.split(":");
|
|
@@ -5738,7 +6227,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
5738
6227
|
};
|
|
5739
6228
|
|
|
5740
6229
|
// components/Breadcrumbs/index.tsx
|
|
5741
|
-
import { jsx as
|
|
6230
|
+
import { jsx as jsx40, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5742
6231
|
var getClassName22 = get_class_name_factory_default("Breadcrumbs", styles_module_default16);
|
|
5743
6232
|
var Breadcrumbs = ({
|
|
5744
6233
|
children,
|
|
@@ -5748,7 +6237,7 @@ var Breadcrumbs = ({
|
|
|
5748
6237
|
const breadcrumbs = useBreadcrumbs(numParents);
|
|
5749
6238
|
return /* @__PURE__ */ jsxs12("div", { className: getClassName22(), children: [
|
|
5750
6239
|
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName22("breadcrumb"), children: [
|
|
5751
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsx40(
|
|
5752
6241
|
"button",
|
|
5753
6242
|
{
|
|
5754
6243
|
type: "button",
|
|
@@ -5757,7 +6246,7 @@ var Breadcrumbs = ({
|
|
|
5757
6246
|
children: breadcrumb.label
|
|
5758
6247
|
}
|
|
5759
6248
|
),
|
|
5760
|
-
/* @__PURE__ */
|
|
6249
|
+
/* @__PURE__ */ jsx40(ChevronRight, { size: 16 })
|
|
5761
6250
|
] }, i)),
|
|
5762
6251
|
children
|
|
5763
6252
|
] });
|
|
@@ -5773,18 +6262,18 @@ var styles_module_default17 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields
|
|
|
5773
6262
|
// components/Puck/components/Fields/index.tsx
|
|
5774
6263
|
import {
|
|
5775
6264
|
memo as memo8,
|
|
5776
|
-
useCallback as
|
|
5777
|
-
useContext as
|
|
6265
|
+
useCallback as useCallback15,
|
|
6266
|
+
useContext as useContext12,
|
|
5778
6267
|
useEffect as useEffect20,
|
|
5779
|
-
useMemo as
|
|
6268
|
+
useMemo as useMemo17
|
|
5780
6269
|
} from "react";
|
|
5781
|
-
import { useShallow as
|
|
5782
|
-
import { Fragment as
|
|
6270
|
+
import { useShallow as useShallow8 } from "zustand/react/shallow";
|
|
6271
|
+
import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5783
6272
|
var getClassName23 = get_class_name_factory_default("PuckFields", styles_module_default17);
|
|
5784
6273
|
var DefaultFields = ({
|
|
5785
6274
|
children
|
|
5786
6275
|
}) => {
|
|
5787
|
-
return /* @__PURE__ */
|
|
6276
|
+
return /* @__PURE__ */ jsx41(Fragment11, { children });
|
|
5788
6277
|
};
|
|
5789
6278
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
5790
6279
|
const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
|
|
@@ -5839,17 +6328,17 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
5839
6328
|
return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
|
|
5840
6329
|
});
|
|
5841
6330
|
const permissions = useAppStore(
|
|
5842
|
-
|
|
6331
|
+
useShallow8((s) => {
|
|
5843
6332
|
const { selectedItem, permissions: permissions2 } = s;
|
|
5844
6333
|
return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
|
|
5845
6334
|
})
|
|
5846
6335
|
);
|
|
5847
6336
|
const appStore = useAppStoreApi();
|
|
5848
|
-
const onChange =
|
|
6337
|
+
const onChange = useCallback15(createOnChange(fieldName, appStore), [
|
|
5849
6338
|
fieldName
|
|
5850
6339
|
]);
|
|
5851
6340
|
const { visible = true } = field != null ? field : {};
|
|
5852
|
-
const fieldStore =
|
|
6341
|
+
const fieldStore = useContext12(fieldContextStore.ctx);
|
|
5853
6342
|
useEffect20(() => {
|
|
5854
6343
|
return appStore.subscribe(
|
|
5855
6344
|
(s) => {
|
|
@@ -5864,7 +6353,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
5864
6353
|
}, [appStore, fieldStore]);
|
|
5865
6354
|
if (!field || !id || !visible) return null;
|
|
5866
6355
|
if (field.type === "slot") return null;
|
|
5867
|
-
return /* @__PURE__ */
|
|
6356
|
+
return /* @__PURE__ */ jsx41("div", { className: getClassName23("field"), children: /* @__PURE__ */ jsx41(
|
|
5868
6357
|
AutoFieldPrivate,
|
|
5869
6358
|
{
|
|
5870
6359
|
field,
|
|
@@ -5877,12 +6366,12 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
5877
6366
|
};
|
|
5878
6367
|
var FieldsChild = ({ fieldName }) => {
|
|
5879
6368
|
const appStore = useAppStoreApi();
|
|
5880
|
-
const initialValue =
|
|
6369
|
+
const initialValue = useMemo17(() => {
|
|
5881
6370
|
var _a;
|
|
5882
6371
|
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
5883
6372
|
return { [fieldName]: value };
|
|
5884
6373
|
}, []);
|
|
5885
|
-
return /* @__PURE__ */
|
|
6374
|
+
return /* @__PURE__ */ jsx41(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ jsx41(FieldsChildInner, { fieldName }) });
|
|
5886
6375
|
};
|
|
5887
6376
|
var FieldsChildMemo = memo8(FieldsChild);
|
|
5888
6377
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
@@ -5892,7 +6381,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
5892
6381
|
const loadingCount = s.selectedItem ? (_a = s.componentState[s.selectedItem.props.id]) == null ? void 0 : _a.loadingCount : (_b = s.componentState["root"]) == null ? void 0 : _b.loadingCount;
|
|
5893
6382
|
return (loadingCount != null ? loadingCount : 0) > 0;
|
|
5894
6383
|
});
|
|
5895
|
-
const itemSelector = useAppStore(
|
|
6384
|
+
const itemSelector = useAppStore(useShallow8((s) => s.state.ui.itemSelector));
|
|
5896
6385
|
const id = useAppStore((s) => {
|
|
5897
6386
|
var _a;
|
|
5898
6387
|
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
@@ -5901,7 +6390,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
5901
6390
|
useRegisterFieldsSlice(appStore, id);
|
|
5902
6391
|
const fieldsLoading = useAppStore((s) => s.fields.loading);
|
|
5903
6392
|
const fieldNames = useAppStore(
|
|
5904
|
-
|
|
6393
|
+
useShallow8((s) => {
|
|
5905
6394
|
if (s.fields.id === id) {
|
|
5906
6395
|
return Object.keys(s.fields.fields);
|
|
5907
6396
|
}
|
|
@@ -5909,7 +6398,7 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
5909
6398
|
})
|
|
5910
6399
|
);
|
|
5911
6400
|
const isLoading = fieldsLoading || componentResolving;
|
|
5912
|
-
const Wrapper =
|
|
6401
|
+
const Wrapper = useMemo17(() => overrides.fields || DefaultFields, [overrides]);
|
|
5913
6402
|
return /* @__PURE__ */ jsxs13(
|
|
5914
6403
|
"form",
|
|
5915
6404
|
{
|
|
@@ -5918,8 +6407,8 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
5918
6407
|
e.preventDefault();
|
|
5919
6408
|
},
|
|
5920
6409
|
children: [
|
|
5921
|
-
/* @__PURE__ */
|
|
5922
|
-
isLoading && /* @__PURE__ */
|
|
6410
|
+
/* @__PURE__ */ jsx41(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx41(FieldsChildMemo, { fieldName }, fieldName)) }),
|
|
6411
|
+
isLoading && /* @__PURE__ */ jsx41("div", { className: getClassName23("loadingOverlay"), children: /* @__PURE__ */ jsx41("div", { className: getClassName23("loadingOverlayInner"), children: /* @__PURE__ */ jsx41(Loader, { size: 16 }) }) })
|
|
5923
6412
|
]
|
|
5924
6413
|
}
|
|
5925
6414
|
);
|
|
@@ -5931,7 +6420,7 @@ init_react_import();
|
|
|
5931
6420
|
var styles_module_default18 = { "FieldsPlugin": "_FieldsPlugin_nd930_1", "FieldsPlugin-header": "_FieldsPlugin-header_nd930_7" };
|
|
5932
6421
|
|
|
5933
6422
|
// plugins/fields/index.tsx
|
|
5934
|
-
import { jsx as
|
|
6423
|
+
import { jsx as jsx42, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5935
6424
|
var getClassName24 = get_class_name_factory_default("FieldsPlugin", styles_module_default18);
|
|
5936
6425
|
var CurrentTitle = () => {
|
|
5937
6426
|
const label = useAppStore((s) => {
|
|
@@ -5945,10 +6434,10 @@ var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
|
5945
6434
|
name: "fields",
|
|
5946
6435
|
label: "Fields",
|
|
5947
6436
|
render: () => /* @__PURE__ */ jsxs14("div", { className: getClassName24(), children: [
|
|
5948
|
-
/* @__PURE__ */
|
|
5949
|
-
/* @__PURE__ */
|
|
6437
|
+
/* @__PURE__ */ jsx42("div", { className: getClassName24("header"), children: /* @__PURE__ */ jsx42(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx42(CurrentTitle, {}) }) }),
|
|
6438
|
+
/* @__PURE__ */ jsx42(Fields, {})
|
|
5950
6439
|
] }),
|
|
5951
|
-
icon: /* @__PURE__ */
|
|
6440
|
+
icon: /* @__PURE__ */ jsx42(RectangleEllipsis, {}),
|
|
5952
6441
|
mobileOnly: desktopSideBar === "right"
|
|
5953
6442
|
});
|
|
5954
6443
|
|
|
@@ -5956,29 +6445,29 @@ var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
|
5956
6445
|
init_react_import();
|
|
5957
6446
|
import {
|
|
5958
6447
|
createContext as createContext8,
|
|
5959
|
-
useCallback as
|
|
5960
|
-
useContext as
|
|
6448
|
+
useCallback as useCallback23,
|
|
6449
|
+
useContext as useContext15,
|
|
5961
6450
|
useEffect as useEffect29,
|
|
5962
|
-
useMemo as
|
|
5963
|
-
useRef as
|
|
5964
|
-
useState as
|
|
6451
|
+
useMemo as useMemo25,
|
|
6452
|
+
useRef as useRef16,
|
|
6453
|
+
useState as useState25
|
|
5965
6454
|
} from "react";
|
|
5966
6455
|
|
|
5967
6456
|
// components/Puck/components/Preview/index.tsx
|
|
5968
6457
|
init_react_import();
|
|
5969
|
-
import { useCallback as
|
|
6458
|
+
import { useCallback as useCallback16, useEffect as useEffect22, useRef as useRef11, useMemo as useMemo18 } from "react";
|
|
5970
6459
|
|
|
5971
6460
|
// components/AutoFrame/index.tsx
|
|
5972
6461
|
init_react_import();
|
|
5973
6462
|
import {
|
|
5974
6463
|
createContext as createContext6,
|
|
5975
|
-
useContext as
|
|
6464
|
+
useContext as useContext13,
|
|
5976
6465
|
useEffect as useEffect21,
|
|
5977
|
-
useState as
|
|
6466
|
+
useState as useState18
|
|
5978
6467
|
} from "react";
|
|
5979
6468
|
import hash from "object-hash";
|
|
5980
6469
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5981
|
-
import { Fragment as
|
|
6470
|
+
import { Fragment as Fragment12, jsx as jsx43 } from "react/jsx-runtime";
|
|
5982
6471
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
5983
6472
|
var collectStyles = (doc) => {
|
|
5984
6473
|
const collected = [];
|
|
@@ -6193,10 +6682,10 @@ var CopyHostStyles = ({
|
|
|
6193
6682
|
observer.disconnect();
|
|
6194
6683
|
};
|
|
6195
6684
|
}, []);
|
|
6196
|
-
return /* @__PURE__ */
|
|
6685
|
+
return /* @__PURE__ */ jsx43(Fragment12, { children });
|
|
6197
6686
|
};
|
|
6198
6687
|
var autoFrameContext = createContext6({});
|
|
6199
|
-
var useFrame = () =>
|
|
6688
|
+
var useFrame = () => useContext13(autoFrameContext);
|
|
6200
6689
|
function AutoFrame(_a) {
|
|
6201
6690
|
var _b = _a, {
|
|
6202
6691
|
children,
|
|
@@ -6217,10 +6706,10 @@ function AutoFrame(_a) {
|
|
|
6217
6706
|
"onNotReady",
|
|
6218
6707
|
"frameRef"
|
|
6219
6708
|
]);
|
|
6220
|
-
const [loaded, setLoaded] =
|
|
6221
|
-
const [ctx, setCtx] =
|
|
6222
|
-
const [mountTarget, setMountTarget] =
|
|
6223
|
-
const [stylesLoaded, setStylesLoaded] =
|
|
6709
|
+
const [loaded, setLoaded] = useState18(false);
|
|
6710
|
+
const [ctx, setCtx] = useState18({});
|
|
6711
|
+
const [mountTarget, setMountTarget] = useState18();
|
|
6712
|
+
const [stylesLoaded, setStylesLoaded] = useState18(false);
|
|
6224
6713
|
useEffect21(() => {
|
|
6225
6714
|
var _a2;
|
|
6226
6715
|
if (frameRef.current) {
|
|
@@ -6240,7 +6729,7 @@ function AutoFrame(_a) {
|
|
|
6240
6729
|
}
|
|
6241
6730
|
}
|
|
6242
6731
|
}, [frameRef, loaded, stylesLoaded]);
|
|
6243
|
-
return /* @__PURE__ */
|
|
6732
|
+
return /* @__PURE__ */ jsx43(
|
|
6244
6733
|
"iframe",
|
|
6245
6734
|
__spreadProps(__spreadValues({}, props), {
|
|
6246
6735
|
className,
|
|
@@ -6250,7 +6739,7 @@ function AutoFrame(_a) {
|
|
|
6250
6739
|
onLoad: () => {
|
|
6251
6740
|
setLoaded(true);
|
|
6252
6741
|
},
|
|
6253
|
-
children: /* @__PURE__ */
|
|
6742
|
+
children: /* @__PURE__ */ jsx43(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx43(
|
|
6254
6743
|
CopyHostStyles,
|
|
6255
6744
|
{
|
|
6256
6745
|
debug,
|
|
@@ -6269,7 +6758,7 @@ init_react_import();
|
|
|
6269
6758
|
var styles_module_default19 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
|
|
6270
6759
|
|
|
6271
6760
|
// components/Puck/components/Preview/index.tsx
|
|
6272
|
-
import { Fragment as
|
|
6761
|
+
import { Fragment as Fragment13, jsx as jsx44 } from "react/jsx-runtime";
|
|
6273
6762
|
var getClassName25 = get_class_name_factory_default("PuckPreview", styles_module_default19);
|
|
6274
6763
|
var useBubbleIframeEvents = (ref) => {
|
|
6275
6764
|
const status = useAppStore((s) => s.status);
|
|
@@ -6322,7 +6811,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6322
6811
|
const renderData = useAppStore(
|
|
6323
6812
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
6324
6813
|
);
|
|
6325
|
-
const Page =
|
|
6814
|
+
const Page = useCallback16(
|
|
6326
6815
|
(pageProps) => {
|
|
6327
6816
|
var _a, _b, _c, _d;
|
|
6328
6817
|
const propsWithSlots = useSlots(
|
|
@@ -6336,15 +6825,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6336
6825
|
);
|
|
6337
6826
|
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
|
|
6338
6827
|
id: "puck-root"
|
|
6339
|
-
}, propsWithSlots), richtextProps)) : /* @__PURE__ */
|
|
6828
|
+
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ jsx44(Fragment13, { children: propsWithSlots.children });
|
|
6340
6829
|
},
|
|
6341
6830
|
[config]
|
|
6342
6831
|
);
|
|
6343
|
-
const Frame =
|
|
6832
|
+
const Frame = useMemo18(() => overrides.iframe, [overrides]);
|
|
6344
6833
|
const rootProps = root.props || root;
|
|
6345
|
-
const ref =
|
|
6834
|
+
const ref = useRef11(null);
|
|
6346
6835
|
useBubbleIframeEvents(ref);
|
|
6347
|
-
const inner = !renderData ? /* @__PURE__ */
|
|
6836
|
+
const inner = !renderData ? /* @__PURE__ */ jsx44(
|
|
6348
6837
|
Page,
|
|
6349
6838
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
6350
6839
|
puck: {
|
|
@@ -6354,15 +6843,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6354
6843
|
metadata
|
|
6355
6844
|
},
|
|
6356
6845
|
editMode: true,
|
|
6357
|
-
children: /* @__PURE__ */
|
|
6846
|
+
children: /* @__PURE__ */ jsx44(DropZonePure, { zone: rootDroppableId })
|
|
6358
6847
|
})
|
|
6359
|
-
) : /* @__PURE__ */
|
|
6848
|
+
) : /* @__PURE__ */ jsx44(Render, { data: renderData, config, metadata });
|
|
6360
6849
|
useEffect22(() => {
|
|
6361
6850
|
if (!iframe.enabled) {
|
|
6362
6851
|
setStatus("READY");
|
|
6363
6852
|
}
|
|
6364
6853
|
}, [iframe.enabled]);
|
|
6365
|
-
return /* @__PURE__ */
|
|
6854
|
+
return /* @__PURE__ */ jsx44(
|
|
6366
6855
|
"div",
|
|
6367
6856
|
{
|
|
6368
6857
|
className: getClassName25(),
|
|
@@ -6374,7 +6863,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6374
6863
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
6375
6864
|
}
|
|
6376
6865
|
},
|
|
6377
|
-
children: iframe.enabled ? /* @__PURE__ */
|
|
6866
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx44(
|
|
6378
6867
|
AutoFrame_default,
|
|
6379
6868
|
{
|
|
6380
6869
|
id: "preview-frame",
|
|
@@ -6387,14 +6876,14 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6387
6876
|
setStatus("MOUNTED");
|
|
6388
6877
|
},
|
|
6389
6878
|
frameRef: ref,
|
|
6390
|
-
children: /* @__PURE__ */
|
|
6879
|
+
children: /* @__PURE__ */ jsx44(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
6391
6880
|
if (Frame) {
|
|
6392
|
-
return /* @__PURE__ */
|
|
6881
|
+
return /* @__PURE__ */ jsx44(Frame, { document: document2, children: inner });
|
|
6393
6882
|
}
|
|
6394
6883
|
return inner;
|
|
6395
6884
|
} })
|
|
6396
6885
|
}
|
|
6397
|
-
) : /* @__PURE__ */
|
|
6886
|
+
) : /* @__PURE__ */ jsx44(
|
|
6398
6887
|
"div",
|
|
6399
6888
|
{
|
|
6400
6889
|
id: "preview-frame",
|
|
@@ -6410,7 +6899,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
|
6410
6899
|
|
|
6411
6900
|
// lib/use-loaded-overrides.ts
|
|
6412
6901
|
init_react_import();
|
|
6413
|
-
import { useMemo as
|
|
6902
|
+
import { useMemo as useMemo19 } from "react";
|
|
6414
6903
|
|
|
6415
6904
|
// lib/load-overrides.ts
|
|
6416
6905
|
init_react_import();
|
|
@@ -6452,7 +6941,7 @@ var useLoadedOverrides = ({
|
|
|
6452
6941
|
overrides,
|
|
6453
6942
|
plugins
|
|
6454
6943
|
}) => {
|
|
6455
|
-
return
|
|
6944
|
+
return useMemo19(() => {
|
|
6456
6945
|
return loadOverrides({ overrides, plugins });
|
|
6457
6946
|
}, [plugins, overrides]);
|
|
6458
6947
|
};
|
|
@@ -6462,7 +6951,7 @@ import { deepEqual as deepEqual2 } from "fast-equals";
|
|
|
6462
6951
|
|
|
6463
6952
|
// components/Puck/components/Layout/index.tsx
|
|
6464
6953
|
init_react_import();
|
|
6465
|
-
import { useEffect as useEffect28, useMemo as
|
|
6954
|
+
import { useEffect as useEffect28, useMemo as useMemo24, useState as useState24 } from "react";
|
|
6466
6955
|
|
|
6467
6956
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
|
|
6468
6957
|
init_react_import();
|
|
@@ -6470,10 +6959,10 @@ var styles_module_default20 = { "Puck": "_Puck_1dd16_19", "Puck-portal": "_Puck-
|
|
|
6470
6959
|
|
|
6471
6960
|
// lib/use-inject-css.ts
|
|
6472
6961
|
init_react_import();
|
|
6473
|
-
import { useEffect as useEffect23, useState as
|
|
6962
|
+
import { useEffect as useEffect23, useState as useState19 } from "react";
|
|
6474
6963
|
var styles = ``;
|
|
6475
6964
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
|
6476
|
-
const [el, setEl] =
|
|
6965
|
+
const [el, setEl] = useState19();
|
|
6477
6966
|
useEffect23(() => {
|
|
6478
6967
|
setEl(document.createElement("style"));
|
|
6479
6968
|
}, []);
|
|
@@ -6497,15 +6986,15 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
|
6497
6986
|
|
|
6498
6987
|
// components/DefaultOverride/index.tsx
|
|
6499
6988
|
init_react_import();
|
|
6500
|
-
import { Fragment as
|
|
6501
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
|
6989
|
+
import { Fragment as Fragment14, jsx as jsx45 } from "react/jsx-runtime";
|
|
6990
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx45(Fragment14, { children });
|
|
6502
6991
|
|
|
6503
6992
|
// lib/use-preview-mode-hotkeys.ts
|
|
6504
6993
|
init_react_import();
|
|
6505
|
-
import { useCallback as
|
|
6994
|
+
import { useCallback as useCallback17 } from "react";
|
|
6506
6995
|
var usePreviewModeHotkeys = () => {
|
|
6507
6996
|
const appStore = useAppStoreApi();
|
|
6508
|
-
const toggleInteractive =
|
|
6997
|
+
const toggleInteractive = useCallback17(() => {
|
|
6509
6998
|
const dispatch = appStore.getState().dispatch;
|
|
6510
6999
|
dispatch({
|
|
6511
7000
|
type: "setUi",
|
|
@@ -6520,7 +7009,7 @@ var usePreviewModeHotkeys = () => {
|
|
|
6520
7009
|
|
|
6521
7010
|
// components/Puck/components/Header/index.tsx
|
|
6522
7011
|
init_react_import();
|
|
6523
|
-
import { memo as memo9, useCallback as
|
|
7012
|
+
import { memo as memo9, useCallback as useCallback18, useMemo as useMemo20, useState as useState20 } from "react";
|
|
6524
7013
|
|
|
6525
7014
|
// components/MenuBar/index.tsx
|
|
6526
7015
|
init_react_import();
|
|
@@ -6530,7 +7019,7 @@ init_react_import();
|
|
|
6530
7019
|
var styles_module_default21 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
|
6531
7020
|
|
|
6532
7021
|
// components/MenuBar/index.tsx
|
|
6533
|
-
import { Fragment as
|
|
7022
|
+
import { Fragment as Fragment15, jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6534
7023
|
var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
|
|
6535
7024
|
function MenuBar({
|
|
6536
7025
|
menuOpen = false,
|
|
@@ -6541,7 +7030,7 @@ function MenuBar({
|
|
|
6541
7030
|
const forward = useAppStore((s) => s.history.forward);
|
|
6542
7031
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
6543
7032
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
6544
|
-
return /* @__PURE__ */
|
|
7033
|
+
return /* @__PURE__ */ jsx46(
|
|
6545
7034
|
"div",
|
|
6546
7035
|
{
|
|
6547
7036
|
className: getClassName26({ menuOpen }),
|
|
@@ -6557,28 +7046,28 @@ function MenuBar({
|
|
|
6557
7046
|
},
|
|
6558
7047
|
children: /* @__PURE__ */ jsxs15("div", { className: getClassName26("inner"), children: [
|
|
6559
7048
|
/* @__PURE__ */ jsxs15("div", { className: getClassName26("history"), children: [
|
|
6560
|
-
/* @__PURE__ */
|
|
7049
|
+
/* @__PURE__ */ jsx46(
|
|
6561
7050
|
IconButton,
|
|
6562
7051
|
{
|
|
6563
7052
|
type: "button",
|
|
6564
7053
|
title: "undo",
|
|
6565
7054
|
disabled: !hasPast,
|
|
6566
7055
|
onClick: back,
|
|
6567
|
-
children: /* @__PURE__ */
|
|
7056
|
+
children: /* @__PURE__ */ jsx46(Undo2, { size: 21 })
|
|
6568
7057
|
}
|
|
6569
7058
|
),
|
|
6570
|
-
/* @__PURE__ */
|
|
7059
|
+
/* @__PURE__ */ jsx46(
|
|
6571
7060
|
IconButton,
|
|
6572
7061
|
{
|
|
6573
7062
|
type: "button",
|
|
6574
7063
|
title: "redo",
|
|
6575
7064
|
disabled: !hasFuture,
|
|
6576
7065
|
onClick: forward,
|
|
6577
|
-
children: /* @__PURE__ */
|
|
7066
|
+
children: /* @__PURE__ */ jsx46(Redo2, { size: 21 })
|
|
6578
7067
|
}
|
|
6579
7068
|
)
|
|
6580
7069
|
] }),
|
|
6581
|
-
/* @__PURE__ */
|
|
7070
|
+
/* @__PURE__ */ jsx46(Fragment15, { children: renderHeaderActions && renderHeaderActions() })
|
|
6582
7071
|
] })
|
|
6583
7072
|
}
|
|
6584
7073
|
);
|
|
@@ -6589,7 +7078,7 @@ init_react_import();
|
|
|
6589
7078
|
var styles_module_default22 = { "PuckHeader": "_PuckHeader_63pti_1", "PuckHeader--hidePlugins": "_PuckHeader--hidePlugins_63pti_15", "PuckHeader-inner": "_PuckHeader-inner_63pti_20", "PuckHeader-toggle": "_PuckHeader-toggle_63pti_40", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_63pti_47", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_63pti_47", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_63pti_48", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_63pti_48", "PuckHeader-title": "_PuckHeader-title_63pti_64", "PuckHeader-path": "_PuckHeader-path_63pti_68", "PuckHeader-tools": "_PuckHeader-tools_63pti_75", "PuckHeader-menuButton": "_PuckHeader-menuButton_63pti_81", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_63pti_86" };
|
|
6590
7079
|
|
|
6591
7080
|
// components/Puck/components/Header/index.tsx
|
|
6592
|
-
import { Fragment as
|
|
7081
|
+
import { Fragment as Fragment16, jsx as jsx47, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6593
7082
|
var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
|
|
6594
7083
|
var HeaderInner = ({
|
|
6595
7084
|
hidePlugins
|
|
@@ -6604,7 +7093,7 @@ var HeaderInner = ({
|
|
|
6604
7093
|
} = usePropsContext();
|
|
6605
7094
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
6606
7095
|
const appStore = useAppStoreApi();
|
|
6607
|
-
const defaultHeaderRender =
|
|
7096
|
+
const defaultHeaderRender = useMemo20(() => {
|
|
6608
7097
|
if (renderHeader) {
|
|
6609
7098
|
console.warn(
|
|
6610
7099
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
|
@@ -6613,13 +7102,13 @@ var HeaderInner = ({
|
|
|
6613
7102
|
var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
|
|
6614
7103
|
const Comp = renderHeader;
|
|
6615
7104
|
const appState = useAppStore((s) => s.state);
|
|
6616
|
-
return /* @__PURE__ */
|
|
7105
|
+
return /* @__PURE__ */ jsx47(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
|
6617
7106
|
};
|
|
6618
7107
|
return RenderHeader;
|
|
6619
7108
|
}
|
|
6620
7109
|
return DefaultOverride;
|
|
6621
7110
|
}, [renderHeader]);
|
|
6622
|
-
const defaultHeaderActionsRender =
|
|
7111
|
+
const defaultHeaderActionsRender = useMemo20(() => {
|
|
6623
7112
|
if (renderHeaderActions) {
|
|
6624
7113
|
console.warn(
|
|
6625
7114
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
|
@@ -6627,7 +7116,7 @@ var HeaderInner = ({
|
|
|
6627
7116
|
const RenderHeader = (props) => {
|
|
6628
7117
|
const Comp = renderHeaderActions;
|
|
6629
7118
|
const appState = useAppStore((s) => s.state);
|
|
6630
|
-
return /* @__PURE__ */
|
|
7119
|
+
return /* @__PURE__ */ jsx47(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
|
6631
7120
|
};
|
|
6632
7121
|
return RenderHeader;
|
|
6633
7122
|
}
|
|
@@ -6639,7 +7128,7 @@ var HeaderInner = ({
|
|
|
6639
7128
|
const CustomHeaderActions = useAppStore(
|
|
6640
7129
|
(s) => s.overrides.headerActions || defaultHeaderActionsRender
|
|
6641
7130
|
);
|
|
6642
|
-
const [menuOpen, setMenuOpen] =
|
|
7131
|
+
const [menuOpen, setMenuOpen] = useState20(false);
|
|
6643
7132
|
const rootTitle = useAppStore((s) => {
|
|
6644
7133
|
var _a, _b;
|
|
6645
7134
|
const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
|
|
@@ -6649,7 +7138,7 @@ var HeaderInner = ({
|
|
|
6649
7138
|
const rightSideBarVisible = useAppStore(
|
|
6650
7139
|
(s) => s.state.ui.rightSideBarVisible
|
|
6651
7140
|
);
|
|
6652
|
-
const toggleSidebars =
|
|
7141
|
+
const toggleSidebars = useCallback18(
|
|
6653
7142
|
(sidebar) => {
|
|
6654
7143
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
|
6655
7144
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
|
@@ -6663,21 +7152,21 @@ var HeaderInner = ({
|
|
|
6663
7152
|
},
|
|
6664
7153
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
|
6665
7154
|
);
|
|
6666
|
-
return /* @__PURE__ */
|
|
7155
|
+
return /* @__PURE__ */ jsx47(
|
|
6667
7156
|
CustomHeader,
|
|
6668
7157
|
{
|
|
6669
|
-
actions: /* @__PURE__ */
|
|
7158
|
+
actions: /* @__PURE__ */ jsx47(Fragment16, { children: /* @__PURE__ */ jsx47(CustomHeaderActions, { children: /* @__PURE__ */ jsx47(
|
|
6670
7159
|
Button,
|
|
6671
7160
|
{
|
|
6672
7161
|
onClick: () => {
|
|
6673
7162
|
const data = appStore.getState().state.data;
|
|
6674
7163
|
onPublish && onPublish(data);
|
|
6675
7164
|
},
|
|
6676
|
-
icon: /* @__PURE__ */
|
|
7165
|
+
icon: /* @__PURE__ */ jsx47(Globe, { size: "14px" }),
|
|
6677
7166
|
children: "Publish"
|
|
6678
7167
|
}
|
|
6679
7168
|
) }) }),
|
|
6680
|
-
children: /* @__PURE__ */
|
|
7169
|
+
children: /* @__PURE__ */ jsx47(
|
|
6681
7170
|
"header",
|
|
6682
7171
|
{
|
|
6683
7172
|
className: getClassName27({
|
|
@@ -6687,7 +7176,7 @@ var HeaderInner = ({
|
|
|
6687
7176
|
}),
|
|
6688
7177
|
children: /* @__PURE__ */ jsxs16("div", { className: getClassName27("inner"), children: [
|
|
6689
7178
|
/* @__PURE__ */ jsxs16("div", { className: getClassName27("toggle"), children: [
|
|
6690
|
-
/* @__PURE__ */
|
|
7179
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ jsx47(
|
|
6691
7180
|
IconButton,
|
|
6692
7181
|
{
|
|
6693
7182
|
type: "button",
|
|
@@ -6695,10 +7184,10 @@ var HeaderInner = ({
|
|
|
6695
7184
|
toggleSidebars("left");
|
|
6696
7185
|
},
|
|
6697
7186
|
title: "Toggle left sidebar",
|
|
6698
|
-
children: /* @__PURE__ */
|
|
7187
|
+
children: /* @__PURE__ */ jsx47(PanelLeft, { focusable: "false" })
|
|
6699
7188
|
}
|
|
6700
7189
|
) }),
|
|
6701
|
-
/* @__PURE__ */
|
|
7190
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ jsx47(
|
|
6702
7191
|
IconButton,
|
|
6703
7192
|
{
|
|
6704
7193
|
type: "button",
|
|
@@ -6706,19 +7195,19 @@ var HeaderInner = ({
|
|
|
6706
7195
|
toggleSidebars("right");
|
|
6707
7196
|
},
|
|
6708
7197
|
title: "Toggle right sidebar",
|
|
6709
|
-
children: /* @__PURE__ */
|
|
7198
|
+
children: /* @__PURE__ */ jsx47(PanelRight, { focusable: "false" })
|
|
6710
7199
|
}
|
|
6711
7200
|
) })
|
|
6712
7201
|
] }),
|
|
6713
|
-
/* @__PURE__ */
|
|
7202
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs16(Heading, { rank: "2", size: "xs", children: [
|
|
6714
7203
|
headerTitle || rootTitle || "Page",
|
|
6715
|
-
headerPath && /* @__PURE__ */ jsxs16(
|
|
7204
|
+
headerPath && /* @__PURE__ */ jsxs16(Fragment16, { children: [
|
|
6716
7205
|
" ",
|
|
6717
|
-
/* @__PURE__ */
|
|
7206
|
+
/* @__PURE__ */ jsx47("code", { className: getClassName27("path"), children: headerPath })
|
|
6718
7207
|
] })
|
|
6719
7208
|
] }) }),
|
|
6720
7209
|
/* @__PURE__ */ jsxs16("div", { className: getClassName27("tools"), children: [
|
|
6721
|
-
/* @__PURE__ */
|
|
7210
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ jsx47(
|
|
6722
7211
|
IconButton,
|
|
6723
7212
|
{
|
|
6724
7213
|
type: "button",
|
|
@@ -6726,23 +7215,23 @@ var HeaderInner = ({
|
|
|
6726
7215
|
return setMenuOpen(!menuOpen);
|
|
6727
7216
|
},
|
|
6728
7217
|
title: "Toggle menu bar",
|
|
6729
|
-
children: menuOpen ? /* @__PURE__ */
|
|
7218
|
+
children: menuOpen ? /* @__PURE__ */ jsx47(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx47(ChevronDown, { focusable: "false" })
|
|
6730
7219
|
}
|
|
6731
7220
|
) }),
|
|
6732
|
-
/* @__PURE__ */
|
|
7221
|
+
/* @__PURE__ */ jsx47(
|
|
6733
7222
|
MenuBar,
|
|
6734
7223
|
{
|
|
6735
7224
|
dispatch,
|
|
6736
7225
|
onPublish,
|
|
6737
7226
|
menuOpen,
|
|
6738
|
-
renderHeaderActions: () => /* @__PURE__ */
|
|
7227
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx47(CustomHeaderActions, { children: /* @__PURE__ */ jsx47(
|
|
6739
7228
|
Button,
|
|
6740
7229
|
{
|
|
6741
7230
|
onClick: () => {
|
|
6742
7231
|
const data = appStore.getState().state.data;
|
|
6743
7232
|
onPublish && onPublish(data);
|
|
6744
7233
|
},
|
|
6745
|
-
icon: /* @__PURE__ */
|
|
7234
|
+
icon: /* @__PURE__ */ jsx47(Globe, { size: "14px" }),
|
|
6746
7235
|
children: "Publish"
|
|
6747
7236
|
}
|
|
6748
7237
|
) }),
|
|
@@ -6766,7 +7255,7 @@ init_react_import();
|
|
|
6766
7255
|
var styles_module_default23 = { "SidebarSection": "_SidebarSection_5otpt_1", "SidebarSection-title": "_SidebarSection-title_5otpt_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_5otpt_20", "SidebarSection-content": "_SidebarSection-content_5otpt_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_5otpt_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_5otpt_62", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_5otpt_33", "SidebarSection-heading": "_SidebarSection-heading_5otpt_74", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_5otpt_78" };
|
|
6767
7256
|
|
|
6768
7257
|
// components/SidebarSection/index.tsx
|
|
6769
|
-
import { jsx as
|
|
7258
|
+
import { jsx as jsx48, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6770
7259
|
var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default23);
|
|
6771
7260
|
var SidebarSection = ({
|
|
6772
7261
|
children,
|
|
@@ -6777,40 +7266,40 @@ var SidebarSection = ({
|
|
|
6777
7266
|
isLoading
|
|
6778
7267
|
}) => {
|
|
6779
7268
|
return /* @__PURE__ */ jsxs17("div", { className: getClassName28({ noBorderTop }), style: { background }, children: [
|
|
6780
|
-
/* @__PURE__ */
|
|
6781
|
-
showBreadcrumbs && /* @__PURE__ */
|
|
6782
|
-
/* @__PURE__ */
|
|
7269
|
+
/* @__PURE__ */ jsx48("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs17("div", { className: getClassName28("breadcrumbs"), children: [
|
|
7270
|
+
showBreadcrumbs && /* @__PURE__ */ jsx48(Breadcrumbs, {}),
|
|
7271
|
+
/* @__PURE__ */ jsx48("div", { className: getClassName28("heading"), children: /* @__PURE__ */ jsx48(Heading, { rank: "2", size: "xs", children: title }) })
|
|
6783
7272
|
] }) }),
|
|
6784
|
-
/* @__PURE__ */
|
|
6785
|
-
isLoading && /* @__PURE__ */
|
|
7273
|
+
/* @__PURE__ */ jsx48("div", { className: getClassName28("content"), children }),
|
|
7274
|
+
isLoading && /* @__PURE__ */ jsx48("div", { className: getClassName28("loadingOverlay"), children: /* @__PURE__ */ jsx48(Loader, { size: 32 }) })
|
|
6786
7275
|
] });
|
|
6787
7276
|
};
|
|
6788
7277
|
|
|
6789
7278
|
// components/Puck/components/Canvas/index.tsx
|
|
6790
7279
|
init_react_import();
|
|
6791
7280
|
import {
|
|
6792
|
-
useCallback as
|
|
7281
|
+
useCallback as useCallback19,
|
|
6793
7282
|
useEffect as useEffect25,
|
|
6794
|
-
useMemo as
|
|
6795
|
-
useRef as
|
|
6796
|
-
useState as
|
|
7283
|
+
useMemo as useMemo23,
|
|
7284
|
+
useRef as useRef13,
|
|
7285
|
+
useState as useState22
|
|
6797
7286
|
} from "react";
|
|
6798
7287
|
|
|
6799
7288
|
// components/ViewportControls/index.tsx
|
|
6800
7289
|
init_react_import();
|
|
6801
|
-
import { useEffect as useEffect24, useMemo as
|
|
7290
|
+
import { useEffect as useEffect24, useMemo as useMemo21, useState as useState21 } from "react";
|
|
6802
7291
|
|
|
6803
7292
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
|
6804
7293
|
init_react_import();
|
|
6805
7294
|
var styles_module_default24 = { "ViewportControls": "_ViewportControls_e3unb_1", "ViewportControls--fullScreen": "_ViewportControls--fullScreen_e3unb_5", "ViewportControls-toggleButton": "_ViewportControls-toggleButton_e3unb_14", "ViewportControls--isExpanded": "_ViewportControls--isExpanded_e3unb_38", "ViewportControls-actions": "_ViewportControls-actions_e3unb_42", "ViewportControls-actionsInner": "_ViewportControls-actionsInner_e3unb_46", "ViewportControls-divider": "_ViewportControls-divider_e3unb_75", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_e3unb_81", "ViewportControls-zoom": "_ViewportControls-zoom_e3unb_81", "ViewportButton-inner": "_ViewportButton-inner_e3unb_111", "ViewportButton--isActive": "_ViewportButton--isActive_e3unb_119" };
|
|
6806
7295
|
|
|
6807
7296
|
// components/ViewportControls/index.tsx
|
|
6808
|
-
import { jsx as
|
|
7297
|
+
import { jsx as jsx49, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6809
7298
|
var icons = {
|
|
6810
|
-
Smartphone: /* @__PURE__ */
|
|
6811
|
-
Tablet: /* @__PURE__ */
|
|
6812
|
-
Monitor: /* @__PURE__ */
|
|
6813
|
-
FullWidth: /* @__PURE__ */
|
|
7299
|
+
Smartphone: /* @__PURE__ */ jsx49(Smartphone, { size: 16 }),
|
|
7300
|
+
Tablet: /* @__PURE__ */ jsx49(Tablet, { size: 16 }),
|
|
7301
|
+
Monitor: /* @__PURE__ */ jsx49(Monitor, { size: 16 }),
|
|
7302
|
+
FullWidth: /* @__PURE__ */ jsx49(Expand, { size: 16 })
|
|
6814
7303
|
};
|
|
6815
7304
|
var getClassName29 = get_class_name_factory_default("ViewportControls", styles_module_default24);
|
|
6816
7305
|
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default24);
|
|
@@ -6821,7 +7310,7 @@ var ActionButton = ({
|
|
|
6821
7310
|
isActive,
|
|
6822
7311
|
disabled
|
|
6823
7312
|
}) => {
|
|
6824
|
-
return /* @__PURE__ */
|
|
7313
|
+
return /* @__PURE__ */ jsx49("span", { className: getClassNameButton({ isActive }), suppressHydrationWarning: true, children: /* @__PURE__ */ jsx49(
|
|
6825
7314
|
IconButton,
|
|
6826
7315
|
{
|
|
6827
7316
|
type: "button",
|
|
@@ -6829,7 +7318,7 @@ var ActionButton = ({
|
|
|
6829
7318
|
disabled: disabled || isActive,
|
|
6830
7319
|
onClick,
|
|
6831
7320
|
suppressHydrationWarning: true,
|
|
6832
|
-
children: /* @__PURE__ */
|
|
7321
|
+
children: /* @__PURE__ */ jsx49("span", { className: getClassNameButton("inner"), children })
|
|
6833
7322
|
}
|
|
6834
7323
|
) });
|
|
6835
7324
|
};
|
|
@@ -6855,7 +7344,7 @@ var ViewportControls = ({
|
|
|
6855
7344
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
|
6856
7345
|
(option) => option.value === autoZoom
|
|
6857
7346
|
);
|
|
6858
|
-
const zoomOptions =
|
|
7347
|
+
const zoomOptions = useMemo21(
|
|
6859
7348
|
() => [
|
|
6860
7349
|
...defaultZoomOptions,
|
|
6861
7350
|
...defaultsContainAutoZoom ? [] : [
|
|
@@ -6867,21 +7356,21 @@ var ViewportControls = ({
|
|
|
6867
7356
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
|
6868
7357
|
[autoZoom]
|
|
6869
7358
|
);
|
|
6870
|
-
const [activeViewport, setActiveViewport] =
|
|
7359
|
+
const [activeViewport, setActiveViewport] = useState21(
|
|
6871
7360
|
uiViewports.current.width
|
|
6872
7361
|
);
|
|
6873
7362
|
useEffect24(() => {
|
|
6874
7363
|
setActiveViewport(uiViewports.current.width);
|
|
6875
7364
|
}, [uiViewports.current]);
|
|
6876
|
-
const [isExpanded, setIsExpanded] =
|
|
7365
|
+
const [isExpanded, setIsExpanded] = useState21(false);
|
|
6877
7366
|
return /* @__PURE__ */ jsxs18(
|
|
6878
7367
|
"div",
|
|
6879
7368
|
{
|
|
6880
7369
|
className: getClassName29({ isExpanded, fullScreen }),
|
|
6881
7370
|
suppressHydrationWarning: true,
|
|
6882
7371
|
children: [
|
|
6883
|
-
/* @__PURE__ */
|
|
6884
|
-
viewports.map((viewport, i) => /* @__PURE__ */
|
|
7372
|
+
/* @__PURE__ */ jsx49("div", { className: getClassName29("actions"), children: /* @__PURE__ */ jsxs18("div", { className: getClassName29("actionsInner"), children: [
|
|
7373
|
+
viewports.map((viewport, i) => /* @__PURE__ */ jsx49(
|
|
6885
7374
|
ActionButton,
|
|
6886
7375
|
{
|
|
6887
7376
|
title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
|
|
@@ -6894,8 +7383,8 @@ var ViewportControls = ({
|
|
|
6894
7383
|
},
|
|
6895
7384
|
i
|
|
6896
7385
|
)),
|
|
6897
|
-
/* @__PURE__ */
|
|
6898
|
-
/* @__PURE__ */
|
|
7386
|
+
/* @__PURE__ */ jsx49("div", { className: getClassName29("divider") }),
|
|
7387
|
+
/* @__PURE__ */ jsx49(
|
|
6899
7388
|
ActionButton,
|
|
6900
7389
|
{
|
|
6901
7390
|
title: "Zoom viewport out",
|
|
@@ -6909,10 +7398,10 @@ var ViewportControls = ({
|
|
|
6909
7398
|
)].value
|
|
6910
7399
|
);
|
|
6911
7400
|
},
|
|
6912
|
-
children: /* @__PURE__ */
|
|
7401
|
+
children: /* @__PURE__ */ jsx49(ZoomOut, { size: 16 })
|
|
6913
7402
|
}
|
|
6914
7403
|
),
|
|
6915
|
-
/* @__PURE__ */
|
|
7404
|
+
/* @__PURE__ */ jsx49(
|
|
6916
7405
|
ActionButton,
|
|
6917
7406
|
{
|
|
6918
7407
|
title: "Zoom viewport in",
|
|
@@ -6926,12 +7415,12 @@ var ViewportControls = ({
|
|
|
6926
7415
|
)].value
|
|
6927
7416
|
);
|
|
6928
7417
|
},
|
|
6929
|
-
children: /* @__PURE__ */
|
|
7418
|
+
children: /* @__PURE__ */ jsx49(ZoomIn, { size: 16 })
|
|
6930
7419
|
}
|
|
6931
7420
|
),
|
|
6932
7421
|
/* @__PURE__ */ jsxs18("div", { className: getClassName29("zoom"), children: [
|
|
6933
|
-
/* @__PURE__ */
|
|
6934
|
-
/* @__PURE__ */
|
|
7422
|
+
/* @__PURE__ */ jsx49("div", { className: getClassName29("divider") }),
|
|
7423
|
+
/* @__PURE__ */ jsx49(
|
|
6935
7424
|
"select",
|
|
6936
7425
|
{
|
|
6937
7426
|
className: getClassName29("zoomSelect"),
|
|
@@ -6942,7 +7431,7 @@ var ViewportControls = ({
|
|
|
6942
7431
|
onChange: (e) => {
|
|
6943
7432
|
onZoom(parseFloat(e.currentTarget.value));
|
|
6944
7433
|
},
|
|
6945
|
-
children: zoomOptions.map((option) => /* @__PURE__ */
|
|
7434
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ jsx49(
|
|
6946
7435
|
"option",
|
|
6947
7436
|
{
|
|
6948
7437
|
value: option.value,
|
|
@@ -6954,13 +7443,13 @@ var ViewportControls = ({
|
|
|
6954
7443
|
)
|
|
6955
7444
|
] })
|
|
6956
7445
|
] }) }),
|
|
6957
|
-
/* @__PURE__ */
|
|
7446
|
+
/* @__PURE__ */ jsx49(
|
|
6958
7447
|
"button",
|
|
6959
7448
|
{
|
|
6960
7449
|
className: getClassName29("toggleButton"),
|
|
6961
7450
|
title: "Toggle viewport menu",
|
|
6962
7451
|
onClick: () => setIsExpanded((s) => !s),
|
|
6963
|
-
children: isExpanded ? /* @__PURE__ */
|
|
7452
|
+
children: isExpanded ? /* @__PURE__ */ jsx49(X, { size: 16 }) : /* @__PURE__ */ jsx49(Monitor, { size: 16 })
|
|
6964
7453
|
}
|
|
6965
7454
|
)
|
|
6966
7455
|
]
|
|
@@ -6973,32 +7462,32 @@ init_react_import();
|
|
|
6973
7462
|
var styles_module_default25 = { "PuckCanvas": "_PuckCanvas_t6s9b_1", "PuckCanvas-controls": "_PuckCanvas-controls_t6s9b_17", "PuckCanvas--fullScreen": "_PuckCanvas--fullScreen_t6s9b_22", "PuckCanvas-inner": "_PuckCanvas-inner_t6s9b_33", "PuckCanvas-root": "_PuckCanvas-root_t6s9b_42", "PuckCanvas--ready": "_PuckCanvas--ready_t6s9b_67", "PuckCanvas-loader": "_PuckCanvas-loader_t6s9b_72", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_t6s9b_82" };
|
|
6974
7463
|
|
|
6975
7464
|
// components/Puck/components/Canvas/index.tsx
|
|
6976
|
-
import { useShallow as
|
|
7465
|
+
import { useShallow as useShallow9 } from "zustand/react/shallow";
|
|
6977
7466
|
|
|
6978
7467
|
// lib/frame-context.tsx
|
|
6979
7468
|
init_react_import();
|
|
6980
7469
|
import {
|
|
6981
7470
|
createContext as createContext7,
|
|
6982
|
-
useContext as
|
|
6983
|
-
useRef as
|
|
6984
|
-
useMemo as
|
|
7471
|
+
useContext as useContext14,
|
|
7472
|
+
useRef as useRef12,
|
|
7473
|
+
useMemo as useMemo22
|
|
6985
7474
|
} from "react";
|
|
6986
|
-
import { jsx as
|
|
7475
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
6987
7476
|
var FrameContext = createContext7(null);
|
|
6988
7477
|
var FrameProvider = ({
|
|
6989
7478
|
children
|
|
6990
7479
|
}) => {
|
|
6991
|
-
const frameRef =
|
|
6992
|
-
const value =
|
|
7480
|
+
const frameRef = useRef12(null);
|
|
7481
|
+
const value = useMemo22(
|
|
6993
7482
|
() => ({
|
|
6994
7483
|
frameRef
|
|
6995
7484
|
}),
|
|
6996
7485
|
[]
|
|
6997
7486
|
);
|
|
6998
|
-
return /* @__PURE__ */
|
|
7487
|
+
return /* @__PURE__ */ jsx50(FrameContext.Provider, { value, children });
|
|
6999
7488
|
};
|
|
7000
7489
|
var useCanvasFrame = () => {
|
|
7001
|
-
const context =
|
|
7490
|
+
const context = useContext14(FrameContext);
|
|
7002
7491
|
if (context === null) {
|
|
7003
7492
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
7004
7493
|
}
|
|
@@ -7006,7 +7495,7 @@ var useCanvasFrame = () => {
|
|
|
7006
7495
|
};
|
|
7007
7496
|
|
|
7008
7497
|
// components/Puck/components/Canvas/index.tsx
|
|
7009
|
-
import { Fragment as
|
|
7498
|
+
import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7010
7499
|
var getClassName30 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
|
|
7011
7500
|
var ZOOM_ON_CHANGE = true;
|
|
7012
7501
|
var TRANSITION_DURATION = 150;
|
|
@@ -7014,11 +7503,7 @@ var Canvas = () => {
|
|
|
7014
7503
|
var _a;
|
|
7015
7504
|
const { frameRef } = useCanvasFrame();
|
|
7016
7505
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
7017
|
-
const {
|
|
7018
|
-
_experimentalFullScreenCanvas,
|
|
7019
|
-
viewports: viewportOptions = defaultViewports,
|
|
7020
|
-
ui: uiProp
|
|
7021
|
-
} = usePropsContext();
|
|
7506
|
+
const { viewports: viewportOptions = defaultViewports, ui: uiProp } = usePropsContext();
|
|
7022
7507
|
const {
|
|
7023
7508
|
dispatch,
|
|
7024
7509
|
overrides,
|
|
@@ -7026,16 +7511,18 @@ var Canvas = () => {
|
|
|
7026
7511
|
zoomConfig,
|
|
7027
7512
|
setZoomConfig,
|
|
7028
7513
|
status,
|
|
7029
|
-
iframe
|
|
7514
|
+
iframe,
|
|
7515
|
+
_experimentalFullScreenCanvas
|
|
7030
7516
|
} = useAppStore(
|
|
7031
|
-
|
|
7517
|
+
useShallow9((s) => ({
|
|
7032
7518
|
dispatch: s.dispatch,
|
|
7033
7519
|
overrides: s.overrides,
|
|
7034
7520
|
setUi: s.setUi,
|
|
7035
7521
|
zoomConfig: s.zoomConfig,
|
|
7036
7522
|
setZoomConfig: s.setZoomConfig,
|
|
7037
7523
|
status: s.status,
|
|
7038
|
-
iframe: s.iframe
|
|
7524
|
+
iframe: s.iframe,
|
|
7525
|
+
_experimentalFullScreenCanvas: s._experimentalFullScreenCanvas
|
|
7039
7526
|
}))
|
|
7040
7527
|
);
|
|
7041
7528
|
const {
|
|
@@ -7045,7 +7532,7 @@ var Canvas = () => {
|
|
|
7045
7532
|
rightSideBarWidth,
|
|
7046
7533
|
viewports
|
|
7047
7534
|
} = useAppStore(
|
|
7048
|
-
|
|
7535
|
+
useShallow9((s) => ({
|
|
7049
7536
|
leftSideBarVisible: s.state.ui.leftSideBarVisible,
|
|
7050
7537
|
rightSideBarVisible: s.state.ui.rightSideBarVisible,
|
|
7051
7538
|
leftSideBarWidth: s.state.ui.leftSideBarWidth,
|
|
@@ -7053,17 +7540,17 @@ var Canvas = () => {
|
|
|
7053
7540
|
viewports: s.state.ui.viewports
|
|
7054
7541
|
}))
|
|
7055
7542
|
);
|
|
7056
|
-
const [showTransition, setShowTransition] =
|
|
7057
|
-
const isResizingRef =
|
|
7058
|
-
const defaultRender =
|
|
7059
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */
|
|
7543
|
+
const [showTransition, setShowTransition] = useState22(false);
|
|
7544
|
+
const isResizingRef = useRef13(false);
|
|
7545
|
+
const defaultRender = useMemo23(() => {
|
|
7546
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx51(Fragment17, { children });
|
|
7060
7547
|
return PuckDefault;
|
|
7061
7548
|
}, []);
|
|
7062
|
-
const CustomPreview =
|
|
7549
|
+
const CustomPreview = useMemo23(
|
|
7063
7550
|
() => overrides.preview || defaultRender,
|
|
7064
7551
|
[overrides]
|
|
7065
7552
|
);
|
|
7066
|
-
const getFrameDimensions =
|
|
7553
|
+
const getFrameDimensions = useCallback19(() => {
|
|
7067
7554
|
if (frameRef.current) {
|
|
7068
7555
|
const frame = frameRef.current;
|
|
7069
7556
|
const box = getBox(frame);
|
|
@@ -7106,7 +7593,7 @@ var Canvas = () => {
|
|
|
7106
7593
|
resizeObserver.disconnect();
|
|
7107
7594
|
};
|
|
7108
7595
|
}, [frameRef.current]);
|
|
7109
|
-
const [showLoader, setShowLoader] =
|
|
7596
|
+
const [showLoader, setShowLoader] = useState22(false);
|
|
7110
7597
|
useEffect25(() => {
|
|
7111
7598
|
setTimeout(() => {
|
|
7112
7599
|
setShowLoader(true);
|
|
@@ -7178,12 +7665,12 @@ var Canvas = () => {
|
|
|
7178
7665
|
dispatch({
|
|
7179
7666
|
type: "setUi",
|
|
7180
7667
|
ui: { itemSelector: null },
|
|
7181
|
-
recordHistory:
|
|
7668
|
+
recordHistory: false
|
|
7182
7669
|
});
|
|
7183
7670
|
}
|
|
7184
7671
|
},
|
|
7185
7672
|
children: [
|
|
7186
|
-
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */
|
|
7673
|
+
viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx51("div", { className: getClassName30("controls"), children: /* @__PURE__ */ jsx51(
|
|
7187
7674
|
ViewportControls,
|
|
7188
7675
|
{
|
|
7189
7676
|
fullScreen: _experimentalFullScreenCanvas,
|
|
@@ -7214,7 +7701,7 @@ var Canvas = () => {
|
|
|
7214
7701
|
}
|
|
7215
7702
|
) }),
|
|
7216
7703
|
/* @__PURE__ */ jsxs19("div", { className: getClassName30("inner"), ref: frameRef, children: [
|
|
7217
|
-
/* @__PURE__ */
|
|
7704
|
+
/* @__PURE__ */ jsx51(
|
|
7218
7705
|
"div",
|
|
7219
7706
|
{
|
|
7220
7707
|
className: getClassName30("root"),
|
|
@@ -7231,10 +7718,10 @@ var Canvas = () => {
|
|
|
7231
7718
|
setShowTransition(false);
|
|
7232
7719
|
isResizingRef.current = false;
|
|
7233
7720
|
},
|
|
7234
|
-
children: /* @__PURE__ */
|
|
7721
|
+
children: /* @__PURE__ */ jsx51(CustomPreview, { children: /* @__PURE__ */ jsx51(Preview2, {}) })
|
|
7235
7722
|
}
|
|
7236
7723
|
),
|
|
7237
|
-
/* @__PURE__ */
|
|
7724
|
+
/* @__PURE__ */ jsx51("div", { className: getClassName30("loader"), children: /* @__PURE__ */ jsx51(Loader, { size: 24 }) })
|
|
7238
7725
|
] })
|
|
7239
7726
|
]
|
|
7240
7727
|
}
|
|
@@ -7243,10 +7730,10 @@ var Canvas = () => {
|
|
|
7243
7730
|
|
|
7244
7731
|
// lib/use-sidebar-resize.ts
|
|
7245
7732
|
init_react_import();
|
|
7246
|
-
import { useCallback as
|
|
7733
|
+
import { useCallback as useCallback20, useEffect as useEffect26, useRef as useRef14, useState as useState23 } from "react";
|
|
7247
7734
|
function useSidebarResize(position, dispatch) {
|
|
7248
|
-
const [width, setWidth] =
|
|
7249
|
-
const sidebarRef =
|
|
7735
|
+
const [width, setWidth] = useState23(null);
|
|
7736
|
+
const sidebarRef = useRef14(null);
|
|
7250
7737
|
const storeWidth = useAppStore(
|
|
7251
7738
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
7252
7739
|
);
|
|
@@ -7280,7 +7767,7 @@ function useSidebarResize(position, dispatch) {
|
|
|
7280
7767
|
setWidth(storeWidth);
|
|
7281
7768
|
}
|
|
7282
7769
|
}, [storeWidth]);
|
|
7283
|
-
const handleResizeEnd =
|
|
7770
|
+
const handleResizeEnd = useCallback20(
|
|
7284
7771
|
(width2) => {
|
|
7285
7772
|
dispatch({
|
|
7286
7773
|
type: "setUi",
|
|
@@ -7327,14 +7814,14 @@ init_react_import();
|
|
|
7327
7814
|
|
|
7328
7815
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
7329
7816
|
init_react_import();
|
|
7330
|
-
import { useCallback as
|
|
7817
|
+
import { useCallback as useCallback21, useRef as useRef15 } from "react";
|
|
7331
7818
|
|
|
7332
7819
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
|
|
7333
7820
|
init_react_import();
|
|
7334
7821
|
var styles_module_default26 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
|
|
7335
7822
|
|
|
7336
7823
|
// components/Puck/components/ResizeHandle/index.tsx
|
|
7337
|
-
import { jsx as
|
|
7824
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
7338
7825
|
var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default26);
|
|
7339
7826
|
var ResizeHandle = ({
|
|
7340
7827
|
position,
|
|
@@ -7344,11 +7831,11 @@ var ResizeHandle = ({
|
|
|
7344
7831
|
}) => {
|
|
7345
7832
|
const { frameRef } = useCanvasFrame();
|
|
7346
7833
|
const resetAutoZoom = useResetAutoZoom(frameRef);
|
|
7347
|
-
const handleRef =
|
|
7348
|
-
const isDragging =
|
|
7349
|
-
const startX =
|
|
7350
|
-
const startWidth =
|
|
7351
|
-
const handleMouseMove =
|
|
7834
|
+
const handleRef = useRef15(null);
|
|
7835
|
+
const isDragging = useRef15(false);
|
|
7836
|
+
const startX = useRef15(0);
|
|
7837
|
+
const startWidth = useRef15(0);
|
|
7838
|
+
const handleMouseMove = useCallback21(
|
|
7352
7839
|
(e) => {
|
|
7353
7840
|
if (!isDragging.current) return;
|
|
7354
7841
|
const delta = e.clientX - startX.current;
|
|
@@ -7359,7 +7846,7 @@ var ResizeHandle = ({
|
|
|
7359
7846
|
},
|
|
7360
7847
|
[onResize, position]
|
|
7361
7848
|
);
|
|
7362
|
-
const handleMouseUp =
|
|
7849
|
+
const handleMouseUp = useCallback21(() => {
|
|
7363
7850
|
var _a;
|
|
7364
7851
|
if (!isDragging.current) return;
|
|
7365
7852
|
isDragging.current = false;
|
|
@@ -7375,7 +7862,7 @@ var ResizeHandle = ({
|
|
|
7375
7862
|
onResizeEnd(finalWidth);
|
|
7376
7863
|
resetAutoZoom();
|
|
7377
7864
|
}, [onResizeEnd]);
|
|
7378
|
-
const handleMouseDown =
|
|
7865
|
+
const handleMouseDown = useCallback21(
|
|
7379
7866
|
(e) => {
|
|
7380
7867
|
var _a;
|
|
7381
7868
|
isDragging.current = true;
|
|
@@ -7393,7 +7880,7 @@ var ResizeHandle = ({
|
|
|
7393
7880
|
},
|
|
7394
7881
|
[position, handleMouseMove, handleMouseUp]
|
|
7395
7882
|
);
|
|
7396
|
-
return /* @__PURE__ */
|
|
7883
|
+
return /* @__PURE__ */ jsx52(
|
|
7397
7884
|
"div",
|
|
7398
7885
|
{
|
|
7399
7886
|
ref: handleRef,
|
|
@@ -7408,7 +7895,7 @@ init_react_import();
|
|
|
7408
7895
|
var styles_module_default27 = { "Sidebar": "_Sidebar_o396p_1", "Sidebar--isVisible": "_Sidebar--isVisible_o396p_9", "Sidebar--left": "_Sidebar--left_o396p_13", "Sidebar--right": "_Sidebar--right_o396p_25", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_o396p_37" };
|
|
7409
7896
|
|
|
7410
7897
|
// components/Puck/components/Sidebar/index.tsx
|
|
7411
|
-
import { Fragment as
|
|
7898
|
+
import { Fragment as Fragment18, jsx as jsx53, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7412
7899
|
var getClassName32 = get_class_name_factory_default("Sidebar", styles_module_default27);
|
|
7413
7900
|
var Sidebar = ({
|
|
7414
7901
|
position,
|
|
@@ -7418,8 +7905,8 @@ var Sidebar = ({
|
|
|
7418
7905
|
onResizeEnd,
|
|
7419
7906
|
children
|
|
7420
7907
|
}) => {
|
|
7421
|
-
return /* @__PURE__ */ jsxs20(
|
|
7422
|
-
/* @__PURE__ */
|
|
7908
|
+
return /* @__PURE__ */ jsxs20(Fragment18, { children: [
|
|
7909
|
+
/* @__PURE__ */ jsx53(
|
|
7423
7910
|
"div",
|
|
7424
7911
|
{
|
|
7425
7912
|
ref: sidebarRef,
|
|
@@ -7427,7 +7914,7 @@ var Sidebar = ({
|
|
|
7427
7914
|
children
|
|
7428
7915
|
}
|
|
7429
7916
|
),
|
|
7430
|
-
/* @__PURE__ */
|
|
7917
|
+
/* @__PURE__ */ jsx53("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ jsx53(
|
|
7431
7918
|
ResizeHandle,
|
|
7432
7919
|
{
|
|
7433
7920
|
position,
|
|
@@ -7441,7 +7928,7 @@ var Sidebar = ({
|
|
|
7441
7928
|
|
|
7442
7929
|
// lib/use-delete-hotkeys.ts
|
|
7443
7930
|
init_react_import();
|
|
7444
|
-
import { useCallback as
|
|
7931
|
+
import { useCallback as useCallback22 } from "react";
|
|
7445
7932
|
var isElementVisible = (element) => {
|
|
7446
7933
|
let current = element;
|
|
7447
7934
|
while (current && current !== document.body) {
|
|
@@ -7476,7 +7963,7 @@ var shouldBlockDeleteHotkey = (e) => {
|
|
|
7476
7963
|
};
|
|
7477
7964
|
var useDeleteHotkeys = () => {
|
|
7478
7965
|
const appStore = useAppStoreApi();
|
|
7479
|
-
const deleteSelectedComponent =
|
|
7966
|
+
const deleteSelectedComponent = useCallback22(
|
|
7480
7967
|
(e) => {
|
|
7481
7968
|
var _a;
|
|
7482
7969
|
if (shouldBlockDeleteHotkey(e)) {
|
|
@@ -7508,7 +7995,7 @@ init_react_import();
|
|
|
7508
7995
|
var styles_module_default28 = { "Nav": "_Nav_1tvxq_1", "Nav-list": "_Nav-list_1tvxq_5", "Nav-mobileActions": "_Nav-mobileActions_1tvxq_23", "NavItem-link": "_NavItem-link_1tvxq_38", "NavItem": "_NavItem_1tvxq_38", "NavItem-linkIcon": "_NavItem-linkIcon_1tvxq_89", "NavItem--active": "_NavItem--active_1tvxq_94", "NavItem--mobileOnly": "_NavItem--mobileOnly_1tvxq_121", "NavItem--desktopOnly": "_NavItem--desktopOnly_1tvxq_126" };
|
|
7509
7996
|
|
|
7510
7997
|
// components/Puck/components/Nav/index.tsx
|
|
7511
|
-
import { jsx as
|
|
7998
|
+
import { jsx as jsx54, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7512
7999
|
var getClassName33 = get_class_name_factory_default("Nav", styles_module_default28);
|
|
7513
8000
|
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default28);
|
|
7514
8001
|
var MenuItem = ({
|
|
@@ -7519,7 +8006,7 @@ var MenuItem = ({
|
|
|
7519
8006
|
mobileOnly,
|
|
7520
8007
|
desktopOnly
|
|
7521
8008
|
}) => {
|
|
7522
|
-
return /* @__PURE__ */
|
|
8009
|
+
return /* @__PURE__ */ jsx54(
|
|
7523
8010
|
"li",
|
|
7524
8011
|
{
|
|
7525
8012
|
className: getClassNameItem3({
|
|
@@ -7528,8 +8015,8 @@ var MenuItem = ({
|
|
|
7528
8015
|
desktopOnly
|
|
7529
8016
|
}),
|
|
7530
8017
|
children: onClick && /* @__PURE__ */ jsxs21("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
7531
|
-
icon && /* @__PURE__ */
|
|
7532
|
-
/* @__PURE__ */
|
|
8018
|
+
icon && /* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
8019
|
+
/* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
7533
8020
|
] })
|
|
7534
8021
|
}
|
|
7535
8022
|
);
|
|
@@ -7539,13 +8026,13 @@ var Nav = ({
|
|
|
7539
8026
|
mobileActions
|
|
7540
8027
|
}) => {
|
|
7541
8028
|
return /* @__PURE__ */ jsxs21("nav", { className: getClassName33(), children: [
|
|
7542
|
-
/* @__PURE__ */
|
|
7543
|
-
mobileActions && /* @__PURE__ */
|
|
8029
|
+
/* @__PURE__ */ jsx54("ul", { className: getClassName33("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx54(MenuItem, __spreadValues({}, item), key)) }),
|
|
8030
|
+
mobileActions && /* @__PURE__ */ jsx54("div", { className: getClassName33("mobileActions"), children: mobileActions })
|
|
7544
8031
|
] });
|
|
7545
8032
|
};
|
|
7546
8033
|
|
|
7547
8034
|
// components/Puck/components/Layout/index.tsx
|
|
7548
|
-
import { jsx as
|
|
8035
|
+
import { jsx as jsx55, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7549
8036
|
var getClassName34 = get_class_name_factory_default("Puck", styles_module_default20);
|
|
7550
8037
|
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default20);
|
|
7551
8038
|
var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default20);
|
|
@@ -7556,14 +8043,14 @@ var FieldSideBar = () => {
|
|
|
7556
8043
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
|
|
7557
8044
|
}
|
|
7558
8045
|
);
|
|
7559
|
-
return /* @__PURE__ */
|
|
8046
|
+
return /* @__PURE__ */ jsx55(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx55(Fields, {}) });
|
|
7560
8047
|
};
|
|
7561
8048
|
var PluginTab = ({
|
|
7562
8049
|
children,
|
|
7563
8050
|
visible,
|
|
7564
8051
|
mobileOnly
|
|
7565
8052
|
}) => {
|
|
7566
|
-
return /* @__PURE__ */
|
|
8053
|
+
return /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName("body"), children }) });
|
|
7567
8054
|
};
|
|
7568
8055
|
var Layout = ({ children }) => {
|
|
7569
8056
|
const {
|
|
@@ -7573,7 +8060,7 @@ var Layout = ({ children }) => {
|
|
|
7573
8060
|
plugins,
|
|
7574
8061
|
height
|
|
7575
8062
|
} = usePropsContext();
|
|
7576
|
-
const iframe =
|
|
8063
|
+
const iframe = useMemo24(
|
|
7577
8064
|
() => __spreadValues({
|
|
7578
8065
|
enabled: true,
|
|
7579
8066
|
waitForStyles: true
|
|
@@ -7623,11 +8110,11 @@ var Layout = ({ children }) => {
|
|
|
7623
8110
|
};
|
|
7624
8111
|
}, []);
|
|
7625
8112
|
const overrides = useAppStore((s) => s.overrides);
|
|
7626
|
-
const CustomPuck =
|
|
8113
|
+
const CustomPuck = useMemo24(
|
|
7627
8114
|
() => overrides.puck || DefaultOverride,
|
|
7628
8115
|
[overrides]
|
|
7629
8116
|
);
|
|
7630
|
-
const [mounted, setMounted] =
|
|
8117
|
+
const [mounted, setMounted] = useState24(false);
|
|
7631
8118
|
useEffect28(() => {
|
|
7632
8119
|
setMounted(true);
|
|
7633
8120
|
}, []);
|
|
@@ -7656,12 +8143,12 @@ var Layout = ({ children }) => {
|
|
|
7656
8143
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
7657
8144
|
});
|
|
7658
8145
|
const appStoreApi = useAppStoreApi();
|
|
7659
|
-
const [mobilePanelHeightMode, setMobilePanelHeightMode] =
|
|
7660
|
-
const hasLegacySideBarPlugin =
|
|
8146
|
+
const [mobilePanelHeightMode, setMobilePanelHeightMode] = useState24("toggle");
|
|
8147
|
+
const hasLegacySideBarPlugin = useMemo24(
|
|
7661
8148
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
7662
8149
|
[plugins]
|
|
7663
8150
|
);
|
|
7664
|
-
const pluginItems =
|
|
8151
|
+
const pluginItems = useMemo24(() => {
|
|
7665
8152
|
const details = {};
|
|
7666
8153
|
const defaultPlugins = [blocksPlugin(), outlinePlugin()];
|
|
7667
8154
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
@@ -7680,7 +8167,7 @@ var Layout = ({ children }) => {
|
|
|
7680
8167
|
}
|
|
7681
8168
|
details[plugin.name] = {
|
|
7682
8169
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
7683
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */
|
|
8170
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx55(ToyBrick, {}),
|
|
7684
8171
|
onClick: () => {
|
|
7685
8172
|
var _a2;
|
|
7686
8173
|
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
@@ -7730,7 +8217,7 @@ var Layout = ({ children }) => {
|
|
|
7730
8217
|
id: instanceId,
|
|
7731
8218
|
style: { height },
|
|
7732
8219
|
children: [
|
|
7733
|
-
/* @__PURE__ */
|
|
8220
|
+
/* @__PURE__ */ jsx55(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx55(CustomPuck, { children: children || /* @__PURE__ */ jsx55(FrameProvider, { children: /* @__PURE__ */ jsx55(
|
|
7734
8221
|
"div",
|
|
7735
8222
|
{
|
|
7736
8223
|
className: getLayoutClassName({
|
|
@@ -7748,12 +8235,12 @@ var Layout = ({ children }) => {
|
|
|
7748
8235
|
className: getLayoutClassName("inner"),
|
|
7749
8236
|
style: layoutOptions,
|
|
7750
8237
|
children: [
|
|
7751
|
-
/* @__PURE__ */
|
|
7752
|
-
/* @__PURE__ */
|
|
8238
|
+
/* @__PURE__ */ jsx55("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsx55(Header, { hidePlugins: hasLegacySideBarPlugin }) }),
|
|
8239
|
+
/* @__PURE__ */ jsx55("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx55(
|
|
7753
8240
|
Nav,
|
|
7754
8241
|
{
|
|
7755
8242
|
items: pluginItems,
|
|
7756
|
-
mobileActions: leftSideBarVisible && mobilePanelHeightMode === "toggle" && /* @__PURE__ */
|
|
8243
|
+
mobileActions: leftSideBarVisible && mobilePanelHeightMode === "toggle" && /* @__PURE__ */ jsx55(
|
|
7757
8244
|
IconButton,
|
|
7758
8245
|
{
|
|
7759
8246
|
type: "button",
|
|
@@ -7763,12 +8250,12 @@ var Layout = ({ children }) => {
|
|
|
7763
8250
|
mobilePanelExpanded: !mobilePanelExpanded
|
|
7764
8251
|
});
|
|
7765
8252
|
},
|
|
7766
|
-
children: mobilePanelExpanded ? /* @__PURE__ */
|
|
8253
|
+
children: mobilePanelExpanded ? /* @__PURE__ */ jsx55(Minimize2, { size: 21 }) : /* @__PURE__ */ jsx55(Maximize2, { size: 21 })
|
|
7767
8254
|
}
|
|
7768
8255
|
)
|
|
7769
8256
|
}
|
|
7770
8257
|
) }),
|
|
7771
|
-
/* @__PURE__ */
|
|
8258
|
+
/* @__PURE__ */ jsx55(
|
|
7772
8259
|
Sidebar,
|
|
7773
8260
|
{
|
|
7774
8261
|
position: "left",
|
|
@@ -7777,20 +8264,20 @@ var Layout = ({ children }) => {
|
|
|
7777
8264
|
onResize: setLeftWidth,
|
|
7778
8265
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
7779
8266
|
children: Object.entries(pluginItems).map(
|
|
7780
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */
|
|
8267
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx55(
|
|
7781
8268
|
PluginTab,
|
|
7782
8269
|
{
|
|
7783
8270
|
visible: currentPlugin === id,
|
|
7784
8271
|
mobileOnly,
|
|
7785
|
-
children: /* @__PURE__ */
|
|
8272
|
+
children: /* @__PURE__ */ jsx55(Render2, {})
|
|
7786
8273
|
},
|
|
7787
8274
|
id
|
|
7788
8275
|
)
|
|
7789
8276
|
)
|
|
7790
8277
|
}
|
|
7791
8278
|
),
|
|
7792
|
-
/* @__PURE__ */
|
|
7793
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */
|
|
8279
|
+
/* @__PURE__ */ jsx55(Canvas, {}),
|
|
8280
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ jsx55(
|
|
7794
8281
|
Sidebar,
|
|
7795
8282
|
{
|
|
7796
8283
|
position: "right",
|
|
@@ -7798,7 +8285,7 @@ var Layout = ({ children }) => {
|
|
|
7798
8285
|
isVisible: rightSideBarVisible,
|
|
7799
8286
|
onResize: setRightWidth,
|
|
7800
8287
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
7801
|
-
children: /* @__PURE__ */
|
|
8288
|
+
children: /* @__PURE__ */ jsx55(FieldSideBar, {})
|
|
7802
8289
|
}
|
|
7803
8290
|
)
|
|
7804
8291
|
]
|
|
@@ -7806,19 +8293,19 @@ var Layout = ({ children }) => {
|
|
|
7806
8293
|
)
|
|
7807
8294
|
}
|
|
7808
8295
|
) }) }) }),
|
|
7809
|
-
/* @__PURE__ */
|
|
8296
|
+
/* @__PURE__ */ jsx55("div", { id: "puck-portal-root", className: getClassName34("portal") })
|
|
7810
8297
|
]
|
|
7811
8298
|
}
|
|
7812
8299
|
);
|
|
7813
8300
|
};
|
|
7814
8301
|
|
|
7815
8302
|
// components/Puck/index.tsx
|
|
7816
|
-
import { jsx as
|
|
8303
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
7817
8304
|
var propsContext = createContext8({});
|
|
7818
8305
|
function PropsProvider(props) {
|
|
7819
|
-
return /* @__PURE__ */
|
|
8306
|
+
return /* @__PURE__ */ jsx56(propsContext.Provider, { value: props, children: props.children });
|
|
7820
8307
|
}
|
|
7821
|
-
var usePropsContext = () =>
|
|
8308
|
+
var usePropsContext = () => useContext15(propsContext);
|
|
7822
8309
|
function PuckProvider({ children }) {
|
|
7823
8310
|
const {
|
|
7824
8311
|
config,
|
|
@@ -7833,16 +8320,18 @@ function PuckProvider({ children }) {
|
|
|
7833
8320
|
initialHistory: _initialHistory,
|
|
7834
8321
|
metadata,
|
|
7835
8322
|
onAction,
|
|
7836
|
-
fieldTransforms
|
|
8323
|
+
fieldTransforms,
|
|
8324
|
+
_experimentalFullScreenCanvas,
|
|
8325
|
+
_experimentalVirtualization
|
|
7837
8326
|
} = usePropsContext();
|
|
7838
|
-
const iframe =
|
|
8327
|
+
const iframe = useMemo25(
|
|
7839
8328
|
() => __spreadValues({
|
|
7840
8329
|
enabled: true,
|
|
7841
8330
|
waitForStyles: true
|
|
7842
8331
|
}, _iframe),
|
|
7843
8332
|
[_iframe]
|
|
7844
8333
|
);
|
|
7845
|
-
const [generatedAppState] =
|
|
8334
|
+
const [generatedAppState] = useState25(() => {
|
|
7846
8335
|
var _a, _b, _c;
|
|
7847
8336
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
7848
8337
|
let clientUiState = {};
|
|
@@ -7882,7 +8371,7 @@ function PuckProvider({ children }) {
|
|
|
7882
8371
|
return walkAppState(newAppState, config);
|
|
7883
8372
|
});
|
|
7884
8373
|
const { appendData = true } = _initialHistory || {};
|
|
7885
|
-
const [blendedHistories] =
|
|
8374
|
+
const [blendedHistories] = useState25(
|
|
7886
8375
|
[
|
|
7887
8376
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
7888
8377
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -7896,7 +8385,7 @@ function PuckProvider({ children }) {
|
|
|
7896
8385
|
});
|
|
7897
8386
|
})
|
|
7898
8387
|
);
|
|
7899
|
-
const initialHistoryIndex =
|
|
8388
|
+
const initialHistoryIndex = useMemo25(() => {
|
|
7900
8389
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
7901
8390
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
7902
8391
|
}
|
|
@@ -7907,7 +8396,7 @@ function PuckProvider({ children }) {
|
|
|
7907
8396
|
overrides,
|
|
7908
8397
|
plugins
|
|
7909
8398
|
});
|
|
7910
|
-
const loadedFieldTransforms =
|
|
8399
|
+
const loadedFieldTransforms = useMemo25(() => {
|
|
7911
8400
|
const _plugins = plugins || [];
|
|
7912
8401
|
const pluginFieldTransforms = _plugins.reduce(
|
|
7913
8402
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -7916,7 +8405,7 @@ function PuckProvider({ children }) {
|
|
|
7916
8405
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
7917
8406
|
}, [fieldTransforms, plugins]);
|
|
7918
8407
|
const instanceId = useSafeId();
|
|
7919
|
-
const generateAppStore =
|
|
8408
|
+
const generateAppStore = useCallback23(
|
|
7920
8409
|
(state) => {
|
|
7921
8410
|
return {
|
|
7922
8411
|
instanceId,
|
|
@@ -7926,6 +8415,8 @@ function PuckProvider({ children }) {
|
|
|
7926
8415
|
overrides: loadedOverrides,
|
|
7927
8416
|
viewports,
|
|
7928
8417
|
iframe,
|
|
8418
|
+
_experimentalFullScreenCanvas: !!_experimentalFullScreenCanvas,
|
|
8419
|
+
_experimentalVirtualization: !!_experimentalVirtualization,
|
|
7929
8420
|
onAction,
|
|
7930
8421
|
metadata,
|
|
7931
8422
|
fieldTransforms: loadedFieldTransforms
|
|
@@ -7939,12 +8430,14 @@ function PuckProvider({ children }) {
|
|
|
7939
8430
|
loadedOverrides,
|
|
7940
8431
|
viewports,
|
|
7941
8432
|
iframe,
|
|
8433
|
+
_experimentalFullScreenCanvas,
|
|
8434
|
+
_experimentalVirtualization,
|
|
7942
8435
|
onAction,
|
|
7943
8436
|
metadata,
|
|
7944
8437
|
loadedFieldTransforms
|
|
7945
8438
|
]
|
|
7946
8439
|
);
|
|
7947
|
-
const [appStore] =
|
|
8440
|
+
const [appStore] = useState25(
|
|
7948
8441
|
() => createAppStore(generateAppStore(initialAppState))
|
|
7949
8442
|
);
|
|
7950
8443
|
useEffect29(() => {
|
|
@@ -7955,13 +8448,13 @@ function PuckProvider({ children }) {
|
|
|
7955
8448
|
useEffect29(() => {
|
|
7956
8449
|
const state = appStore.getState().state;
|
|
7957
8450
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
7958
|
-
}, [
|
|
8451
|
+
}, [generateAppStore]);
|
|
7959
8452
|
useRegisterHistorySlice(appStore, {
|
|
7960
8453
|
histories: blendedHistories,
|
|
7961
8454
|
index: initialHistoryIndex,
|
|
7962
8455
|
initialAppState
|
|
7963
8456
|
});
|
|
7964
|
-
const previousData =
|
|
8457
|
+
const previousData = useRef16(null);
|
|
7965
8458
|
useEffect29(() => {
|
|
7966
8459
|
return appStore.subscribe(
|
|
7967
8460
|
(s) => s.state.data,
|
|
@@ -7978,12 +8471,14 @@ function PuckProvider({ children }) {
|
|
|
7978
8471
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
|
7979
8472
|
useEffect29(() => {
|
|
7980
8473
|
const { resolveAndCommitData } = appStore.getState();
|
|
7981
|
-
|
|
8474
|
+
setTimeout(() => {
|
|
8475
|
+
resolveAndCommitData();
|
|
8476
|
+
}, 0);
|
|
7982
8477
|
}, []);
|
|
7983
|
-
return /* @__PURE__ */
|
|
8478
|
+
return /* @__PURE__ */ jsx56(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx56(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
|
7984
8479
|
}
|
|
7985
8480
|
function Puck(props) {
|
|
7986
|
-
return /* @__PURE__ */
|
|
8481
|
+
return /* @__PURE__ */ jsx56(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx56(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx56(Layout, { children: props.children }) })) }));
|
|
7987
8482
|
}
|
|
7988
8483
|
Puck.Components = Components;
|
|
7989
8484
|
Puck.Fields = Fields;
|
|
@@ -7993,12 +8488,12 @@ Puck.Preview = Preview2;
|
|
|
7993
8488
|
|
|
7994
8489
|
// plugins/legacy-side-bar/index.tsx
|
|
7995
8490
|
init_react_import();
|
|
7996
|
-
import { jsx as
|
|
8491
|
+
import { jsx as jsx57, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7997
8492
|
var legacySideBarPlugin = () => ({
|
|
7998
8493
|
name: "legacy-side-bar",
|
|
7999
8494
|
render: () => /* @__PURE__ */ jsxs23("div", { style: { overflowY: "auto" }, children: [
|
|
8000
|
-
/* @__PURE__ */
|
|
8001
|
-
/* @__PURE__ */
|
|
8495
|
+
/* @__PURE__ */ jsx57(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx57(Components, {}) }),
|
|
8496
|
+
/* @__PURE__ */ jsx57(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx57(Outline, {}) })
|
|
8002
8497
|
] })
|
|
8003
8498
|
});
|
|
8004
8499
|
|