@measured/puck 0.19.0-canary.24030a9 → 0.19.0-canary.46835fd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-T6VJEBJD.mjs → chunk-7N5DRY4G.mjs} +44 -8
- package/dist/index.css +13 -0
- package/dist/index.d.mts +3 -14
- package/dist/index.d.ts +3 -14
- package/dist/index.js +415 -424
- package/dist/index.mjs +258 -302
- package/dist/{resolve-all-data-DleIzc4N.d.mts → resolve-all-data-3XjIPfNh.d.mts} +12 -1
- package/dist/{resolve-all-data-DleIzc4N.d.ts → resolve-all-data-3XjIPfNh.d.ts} +12 -1
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +37 -2
- package/dist/rsc.mjs +5 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -8,7 +8,6 @@ import {
|
|
8
8
|
__spreadProps,
|
9
9
|
__spreadValues,
|
10
10
|
__toESM,
|
11
|
-
defaultData,
|
12
11
|
getChanged,
|
13
12
|
init_react_import,
|
14
13
|
resolveAllData,
|
@@ -17,8 +16,9 @@ import {
|
|
17
16
|
rootAreaId,
|
18
17
|
rootDroppableId,
|
19
18
|
rootZone,
|
20
|
-
setupZone
|
21
|
-
|
19
|
+
setupZone,
|
20
|
+
transformProps
|
21
|
+
} from "./chunk-7N5DRY4G.mjs";
|
22
22
|
|
23
23
|
// ../../node_modules/classnames/index.js
|
24
24
|
var require_classnames = __commonJS({
|
@@ -215,7 +215,7 @@ import {
|
|
215
215
|
useContext as useContext3,
|
216
216
|
useEffect as useEffect11,
|
217
217
|
useMemo as useMemo5,
|
218
|
-
useState as
|
218
|
+
useState as useState8
|
219
219
|
} from "react";
|
220
220
|
|
221
221
|
// components/AutoField/fields/index.tsx
|
@@ -676,7 +676,7 @@ var IconButton = ({
|
|
676
676
|
};
|
677
677
|
|
678
678
|
// components/AutoField/fields/ArrayField/index.tsx
|
679
|
-
import { useCallback as useCallback2, useEffect as useEffect6,
|
679
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useState as useState3 } from "react";
|
680
680
|
|
681
681
|
// components/DragIcon/index.tsx
|
682
682
|
init_react_import();
|
@@ -1891,7 +1891,6 @@ function useAppStoreApi() {
|
|
1891
1891
|
// components/Sortable/index.tsx
|
1892
1892
|
init_react_import();
|
1893
1893
|
import { DragDropProvider } from "@dnd-kit/react";
|
1894
|
-
import { useState as useState3 } from "react";
|
1895
1894
|
|
1896
1895
|
// lib/dnd/dnd-kit/safe.ts
|
1897
1896
|
init_react_import();
|
@@ -1917,7 +1916,8 @@ function useDraggableSafe(input) {
|
|
1917
1916
|
function useSortableSafe(input) {
|
1918
1917
|
if (typeof window === "undefined") {
|
1919
1918
|
return { ref: () => {
|
1920
|
-
}, status: "idle"
|
1919
|
+
}, status: "idle", handleRef: () => {
|
1920
|
+
} };
|
1921
1921
|
}
|
1922
1922
|
return useSortable(input);
|
1923
1923
|
}
|
@@ -2201,23 +2201,26 @@ function patchWindow(window2) {
|
|
2201
2201
|
|
2202
2202
|
// lib/dnd/use-sensors.ts
|
2203
2203
|
import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
|
2204
|
-
var useSensors = (
|
2204
|
+
var useSensors = ({
|
2205
|
+
other,
|
2206
|
+
mouse,
|
2207
|
+
touch
|
2208
|
+
} = {
|
2209
|
+
touch: { delay: { value: 200, tolerance: 10 } },
|
2210
|
+
other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
|
2211
|
+
}) => {
|
2205
2212
|
const [sensors] = useState2(() => [
|
2206
2213
|
PointerSensor.configure({
|
2207
2214
|
activationConstraints(event, source) {
|
2208
2215
|
var _a;
|
2209
2216
|
const { pointerType, target } = event;
|
2210
2217
|
if (pointerType === "mouse" && isElement2(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
|
2211
|
-
return
|
2218
|
+
return mouse;
|
2212
2219
|
}
|
2213
|
-
const delay = { value: 200, tolerance: 10 };
|
2214
2220
|
if (pointerType === "touch") {
|
2215
|
-
return
|
2221
|
+
return touch;
|
2216
2222
|
}
|
2217
|
-
return
|
2218
|
-
delay,
|
2219
|
-
distance: { value: 5 }
|
2220
|
-
};
|
2223
|
+
return other;
|
2221
2224
|
}
|
2222
2225
|
})
|
2223
2226
|
]);
|
@@ -2563,31 +2566,24 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
2563
2566
|
};
|
2564
2567
|
|
2565
2568
|
// components/Sortable/index.tsx
|
2566
|
-
import { RestrictToElement } from "@dnd-kit/dom/modifiers";
|
2567
2569
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
2568
2570
|
var SortableProvider = ({
|
2569
|
-
container,
|
2570
2571
|
children,
|
2571
2572
|
onDragStart,
|
2572
2573
|
onDragEnd,
|
2573
2574
|
onMove
|
2574
2575
|
}) => {
|
2575
|
-
const
|
2576
|
-
|
2576
|
+
const sensors = useSensors({
|
2577
|
+
mouse: { distance: { value: 5 } }
|
2578
|
+
});
|
2577
2579
|
return /* @__PURE__ */ jsx5(
|
2578
2580
|
DragDropProvider,
|
2579
2581
|
{
|
2580
2582
|
sensors,
|
2581
|
-
modifiers: [
|
2582
|
-
RestrictToElement.configure({
|
2583
|
-
element() {
|
2584
|
-
return container.current;
|
2585
|
-
}
|
2586
|
-
})
|
2587
|
-
],
|
2588
2583
|
onDragStart,
|
2589
2584
|
onDragOver: (event, manager) => {
|
2590
2585
|
var _a, _b;
|
2586
|
+
event.preventDefault();
|
2591
2587
|
const { operation } = event;
|
2592
2588
|
const { source, target } = operation;
|
2593
2589
|
if (!source || !target) return;
|
@@ -2595,14 +2591,14 @@ var SortableProvider = ({
|
|
2595
2591
|
let targetIndex = target.data.index;
|
2596
2592
|
const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
|
2597
2593
|
if (sourceIndex !== targetIndex && source.id !== target.id) {
|
2598
|
-
const collisionPosition =
|
2594
|
+
const collisionPosition = collisionData.direction === "up" ? "before" : "after";
|
2599
2595
|
if (targetIndex >= sourceIndex) {
|
2600
2596
|
targetIndex = targetIndex - 1;
|
2601
2597
|
}
|
2602
2598
|
if (collisionPosition === "after") {
|
2603
2599
|
targetIndex = targetIndex + 1;
|
2604
2600
|
}
|
2605
|
-
|
2601
|
+
onMove({
|
2606
2602
|
source: sourceIndex,
|
2607
2603
|
target: targetIndex
|
2608
2604
|
});
|
@@ -2610,12 +2606,8 @@ var SortableProvider = ({
|
|
2610
2606
|
},
|
2611
2607
|
onDragEnd: () => {
|
2612
2608
|
setTimeout(() => {
|
2613
|
-
if (move.source !== -1 && move.target !== -1) {
|
2614
|
-
onMove(move);
|
2615
|
-
}
|
2616
2609
|
onDragEnd();
|
2617
2610
|
}, 250);
|
2618
|
-
setMove({ source: -1, target: -1 });
|
2619
2611
|
},
|
2620
2612
|
children
|
2621
2613
|
}
|
@@ -2628,7 +2620,11 @@ var Sortable = ({
|
|
2628
2620
|
children,
|
2629
2621
|
type = "item"
|
2630
2622
|
}) => {
|
2631
|
-
const {
|
2623
|
+
const {
|
2624
|
+
ref: sortableRef,
|
2625
|
+
status,
|
2626
|
+
handleRef
|
2627
|
+
} = useSortableSafe({
|
2632
2628
|
id,
|
2633
2629
|
type,
|
2634
2630
|
index,
|
@@ -2636,7 +2632,7 @@ var Sortable = ({
|
|
2636
2632
|
data: { index },
|
2637
2633
|
collisionDetector: createDynamicCollisionDetector("y")
|
2638
2634
|
});
|
2639
|
-
return children({ status, ref: sortableRef });
|
2635
|
+
return children({ status, ref: sortableRef, handleRef });
|
2640
2636
|
};
|
2641
2637
|
|
2642
2638
|
// components/AutoField/context.tsx
|
@@ -2712,10 +2708,12 @@ var ArrayField = ({
|
|
2712
2708
|
}),
|
2713
2709
|
openId: ""
|
2714
2710
|
};
|
2715
|
-
const [localState, setLocalState] =
|
2711
|
+
const [localState, setLocalState] = useState3({ arrayState, value });
|
2716
2712
|
useEffect6(() => {
|
2717
|
-
|
2718
|
-
|
2713
|
+
var _a;
|
2714
|
+
const _arrayState = (_a = appStore.getState().state.ui.arrayState[id]) != null ? _a : arrayState;
|
2715
|
+
setLocalState({ arrayState: _arrayState, value });
|
2716
|
+
}, [value]);
|
2719
2717
|
const appStore = useAppStoreApi();
|
2720
2718
|
const mapArrayStateToUi = useCallback2(
|
2721
2719
|
(partialArrayState) => {
|
@@ -2758,8 +2756,7 @@ var ArrayField = ({
|
|
2758
2756
|
setUi(mapArrayStateToUi(arrayState));
|
2759
2757
|
}
|
2760
2758
|
}, []);
|
2761
|
-
const [isDragging, setIsDragging] =
|
2762
|
-
const dndContainerRef = useRef(null);
|
2759
|
+
const [isDragging, setIsDragging] = useState3(false);
|
2763
2760
|
const canEdit = useAppStore(
|
2764
2761
|
(s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
|
2765
2762
|
);
|
@@ -2778,11 +2775,13 @@ var ArrayField = ({
|
|
2778
2775
|
children: /* @__PURE__ */ jsx7(
|
2779
2776
|
SortableProvider,
|
2780
2777
|
{
|
2781
|
-
container: dndContainerRef,
|
2782
2778
|
onDragStart: () => setIsDragging(true),
|
2783
|
-
onDragEnd: () =>
|
2779
|
+
onDragEnd: () => {
|
2780
|
+
setIsDragging(false);
|
2781
|
+
onChange(localState.value);
|
2782
|
+
},
|
2784
2783
|
onMove: (move) => {
|
2785
|
-
const newValue = reorder(value, move.source, move.target);
|
2784
|
+
const newValue = reorder(localState.value, move.source, move.target);
|
2786
2785
|
const newArrayStateItems = reorder(
|
2787
2786
|
arrayState.items,
|
2788
2787
|
move.source,
|
@@ -2795,7 +2794,6 @@ var ArrayField = ({
|
|
2795
2794
|
})
|
2796
2795
|
};
|
2797
2796
|
setUi(newUi, false);
|
2798
|
-
onChange(newValue, newUi);
|
2799
2797
|
setLocalState({
|
2800
2798
|
value: newValue,
|
2801
2799
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
@@ -2809,172 +2807,156 @@ var ArrayField = ({
|
|
2809
2807
|
addDisabled
|
2810
2808
|
}),
|
2811
2809
|
children: [
|
2812
|
-
/* @__PURE__ */ jsx7(
|
2813
|
-
|
2814
|
-
{
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2810
|
+
localState.arrayState.items.length > 0 && /* @__PURE__ */ jsx7("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
|
2811
|
+
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
2812
|
+
const data = Array.from(localState.value || [])[i] || {};
|
2813
|
+
return /* @__PURE__ */ jsx7(
|
2814
|
+
Sortable,
|
2815
|
+
{
|
2816
|
+
id: _arrayId,
|
2817
|
+
index: i,
|
2818
|
+
disabled: readOnly,
|
2819
|
+
children: ({ status, ref, handleRef }) => /* @__PURE__ */ jsxs3(
|
2820
|
+
"div",
|
2823
2821
|
{
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
{
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
setUi(
|
2852
|
-
mapArrayStateToUi({
|
2853
|
-
openId: _arrayId
|
2854
|
-
})
|
2855
|
-
);
|
2856
|
-
}
|
2857
|
-
},
|
2858
|
-
className: getClassNameItem("summary"),
|
2859
|
-
children: [
|
2860
|
-
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
2861
|
-
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
2862
|
-
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
2863
|
-
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2864
|
-
IconButton,
|
2865
|
-
{
|
2866
|
-
type: "button",
|
2867
|
-
disabled: !!addDisabled,
|
2868
|
-
onClick: (e) => {
|
2869
|
-
e.stopPropagation();
|
2870
|
-
const existingValue = [...value || []];
|
2871
|
-
existingValue.splice(
|
2872
|
-
i,
|
2873
|
-
0,
|
2874
|
-
existingValue[i]
|
2875
|
-
);
|
2876
|
-
onChange(
|
2877
|
-
existingValue,
|
2878
|
-
mapArrayStateToUi(
|
2879
|
-
regenerateArrayState(existingValue)
|
2880
|
-
)
|
2881
|
-
);
|
2882
|
-
},
|
2883
|
-
title: "Duplicate",
|
2884
|
-
children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
|
2885
|
-
}
|
2886
|
-
) }),
|
2887
|
-
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2888
|
-
IconButton,
|
2889
|
-
{
|
2890
|
-
type: "button",
|
2891
|
-
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
2892
|
-
onClick: (e) => {
|
2893
|
-
e.stopPropagation();
|
2894
|
-
const existingValue = [...value || []];
|
2895
|
-
const existingItems = [
|
2896
|
-
...arrayState.items || []
|
2897
|
-
];
|
2898
|
-
existingValue.splice(i, 1);
|
2899
|
-
existingItems.splice(i, 1);
|
2900
|
-
onChange(
|
2901
|
-
existingValue,
|
2902
|
-
mapArrayStateToUi({
|
2903
|
-
items: existingItems
|
2904
|
-
})
|
2905
|
-
);
|
2906
|
-
},
|
2907
|
-
title: "Delete",
|
2908
|
-
children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
|
2909
|
-
}
|
2910
|
-
) })
|
2911
|
-
] }),
|
2912
|
-
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
|
2913
|
-
] })
|
2914
|
-
]
|
2822
|
+
ref,
|
2823
|
+
className: getClassNameItem({
|
2824
|
+
isExpanded: arrayState.openId === _arrayId,
|
2825
|
+
isDragging: status === "dragging",
|
2826
|
+
readOnly
|
2827
|
+
}),
|
2828
|
+
children: [
|
2829
|
+
/* @__PURE__ */ jsxs3(
|
2830
|
+
"div",
|
2831
|
+
{
|
2832
|
+
ref: handleRef,
|
2833
|
+
onClick: (e) => {
|
2834
|
+
if (isDragging) return;
|
2835
|
+
e.preventDefault();
|
2836
|
+
e.stopPropagation();
|
2837
|
+
if (arrayState.openId === _arrayId) {
|
2838
|
+
setUi(
|
2839
|
+
mapArrayStateToUi({
|
2840
|
+
openId: ""
|
2841
|
+
})
|
2842
|
+
);
|
2843
|
+
} else {
|
2844
|
+
setUi(
|
2845
|
+
mapArrayStateToUi({
|
2846
|
+
openId: _arrayId
|
2847
|
+
})
|
2848
|
+
);
|
2915
2849
|
}
|
2916
|
-
|
2917
|
-
|
2918
|
-
|
2919
|
-
{
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2931
|
-
|
2932
|
-
|
2933
|
-
|
2934
|
-
|
2935
|
-
|
2850
|
+
},
|
2851
|
+
className: getClassNameItem("summary"),
|
2852
|
+
children: [
|
2853
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
2854
|
+
/* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
|
2855
|
+
!readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
|
2856
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2857
|
+
IconButton,
|
2858
|
+
{
|
2859
|
+
type: "button",
|
2860
|
+
disabled: !!addDisabled,
|
2861
|
+
onClick: (e) => {
|
2862
|
+
e.stopPropagation();
|
2863
|
+
const existingValue = [...value || []];
|
2864
|
+
existingValue.splice(
|
2865
|
+
i,
|
2866
|
+
0,
|
2867
|
+
existingValue[i]
|
2868
|
+
);
|
2869
|
+
const newUi = mapArrayStateToUi(
|
2870
|
+
regenerateArrayState(existingValue)
|
2871
|
+
);
|
2872
|
+
setUi(newUi, false);
|
2873
|
+
onChange(existingValue);
|
2874
|
+
},
|
2875
|
+
title: "Duplicate",
|
2876
|
+
children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
|
2877
|
+
}
|
2878
|
+
) }),
|
2879
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
|
2880
|
+
IconButton,
|
2936
2881
|
{
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
// May be used by custom fields
|
2882
|
+
type: "button",
|
2883
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
2884
|
+
onClick: (e) => {
|
2885
|
+
e.stopPropagation();
|
2886
|
+
const existingValue = [...value || []];
|
2887
|
+
const existingItems = [
|
2888
|
+
...arrayState.items || []
|
2889
|
+
];
|
2890
|
+
existingValue.splice(i, 1);
|
2891
|
+
existingItems.splice(i, 1);
|
2892
|
+
setUi(
|
2893
|
+
mapArrayStateToUi({
|
2894
|
+
items: existingItems
|
2951
2895
|
}),
|
2952
|
-
|
2953
|
-
|
2954
|
-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
|
2959
|
-
|
2960
|
-
|
2961
|
-
|
2962
|
-
|
2963
|
-
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2976
|
-
|
2977
|
-
|
2896
|
+
false
|
2897
|
+
);
|
2898
|
+
onChange(existingValue);
|
2899
|
+
},
|
2900
|
+
title: "Delete",
|
2901
|
+
children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
|
2902
|
+
}
|
2903
|
+
) })
|
2904
|
+
] }),
|
2905
|
+
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
|
2906
|
+
] })
|
2907
|
+
]
|
2908
|
+
}
|
2909
|
+
),
|
2910
|
+
/* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
|
2911
|
+
const subField = field.arrayFields[subName];
|
2912
|
+
const indexName = `${name}[${i}]`;
|
2913
|
+
const subPath = `${indexName}.${subName}`;
|
2914
|
+
const localIndexName = `${localName}[${i}]`;
|
2915
|
+
const localWildcardName = `${localName}[*]`;
|
2916
|
+
const localSubPath = `${localIndexName}.${subName}`;
|
2917
|
+
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
2918
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
2919
|
+
const label2 = subField.label || subName;
|
2920
|
+
return /* @__PURE__ */ jsx7(
|
2921
|
+
NestedFieldProvider,
|
2922
|
+
{
|
2923
|
+
name: localIndexName,
|
2924
|
+
wildcardName: localWildcardName,
|
2925
|
+
subName,
|
2926
|
+
readOnlyFields,
|
2927
|
+
children: /* @__PURE__ */ jsx7(
|
2928
|
+
AutoFieldPrivate,
|
2929
|
+
{
|
2930
|
+
name: subPath,
|
2931
|
+
label: label2,
|
2932
|
+
id: `${_arrayId}_${subName}`,
|
2933
|
+
readOnly: subReadOnly,
|
2934
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
2935
|
+
label: label2
|
2936
|
+
// May be used by custom fields
|
2937
|
+
}),
|
2938
|
+
value: data[subName],
|
2939
|
+
onChange: (val, ui) => {
|
2940
|
+
onChange(
|
2941
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
2942
|
+
[subName]: val
|
2943
|
+
})),
|
2944
|
+
ui
|
2945
|
+
);
|
2946
|
+
}
|
2947
|
+
}
|
2948
|
+
)
|
2949
|
+
},
|
2950
|
+
subPath
|
2951
|
+
);
|
2952
|
+
}) }) })
|
2953
|
+
]
|
2954
|
+
}
|
2955
|
+
)
|
2956
|
+
},
|
2957
|
+
_arrayId
|
2958
|
+
);
|
2959
|
+
}) }),
|
2978
2960
|
!addDisabled && /* @__PURE__ */ jsx7(
|
2979
2961
|
"button",
|
2980
2962
|
{
|
@@ -2988,7 +2970,8 @@ var ArrayField = ({
|
|
2988
2970
|
field.defaultItemProps || {}
|
2989
2971
|
];
|
2990
2972
|
const newArrayState = regenerateArrayState(newValue);
|
2991
|
-
|
2973
|
+
setUi(mapArrayStateToUi(newArrayState), false);
|
2974
|
+
onChange(newValue);
|
2992
2975
|
},
|
2993
2976
|
children: /* @__PURE__ */ jsx7(Plus, { size: 21 })
|
2994
2977
|
}
|
@@ -3072,7 +3055,7 @@ init_react_import();
|
|
3072
3055
|
import {
|
3073
3056
|
useMemo as useMemo2,
|
3074
3057
|
useEffect as useEffect9,
|
3075
|
-
useState as
|
3058
|
+
useState as useState6,
|
3076
3059
|
useCallback as useCallback3,
|
3077
3060
|
isValidElement
|
3078
3061
|
} from "react";
|
@@ -3083,7 +3066,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
|
|
3083
3066
|
|
3084
3067
|
// components/Modal/index.tsx
|
3085
3068
|
init_react_import();
|
3086
|
-
import { useEffect as useEffect7, useState as
|
3069
|
+
import { useEffect as useEffect7, useState as useState4 } from "react";
|
3087
3070
|
|
3088
3071
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
3089
3072
|
init_react_import();
|
@@ -3098,7 +3081,7 @@ var Modal = ({
|
|
3098
3081
|
onClose,
|
3099
3082
|
isOpen
|
3100
3083
|
}) => {
|
3101
|
-
const [rootEl, setRootEl] =
|
3084
|
+
const [rootEl, setRootEl] = useState4(null);
|
3102
3085
|
useEffect7(() => {
|
3103
3086
|
setRootEl(document.getElementById("puck-portal-root"));
|
3104
3087
|
}, []);
|
@@ -3146,7 +3129,7 @@ init_react_import();
|
|
3146
3129
|
|
3147
3130
|
// components/Button/Button.tsx
|
3148
3131
|
init_react_import();
|
3149
|
-
import { useEffect as useEffect8, useState as
|
3132
|
+
import { useEffect as useEffect8, useState as useState5 } from "react";
|
3150
3133
|
|
3151
3134
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
3152
3135
|
init_react_import();
|
@@ -3196,7 +3179,7 @@ var Button = (_a) => {
|
|
3196
3179
|
"size",
|
3197
3180
|
"loading"
|
3198
3181
|
]);
|
3199
|
-
const [loading, setLoading] =
|
3182
|
+
const [loading, setLoading] = useState5(loadingProp);
|
3200
3183
|
useEffect8(() => setLoading(loadingProp), [loadingProp]);
|
3201
3184
|
const ElementType = href ? "a" : type ? "button" : "span";
|
3202
3185
|
const dataAttrs = filterDataAttrs(props);
|
@@ -3252,12 +3235,12 @@ var ExternalInput = ({
|
|
3252
3235
|
mapRow = (val) => val,
|
3253
3236
|
filterFields
|
3254
3237
|
} = field || {};
|
3255
|
-
const [data, setData] =
|
3256
|
-
const [isOpen, setOpen] =
|
3257
|
-
const [isLoading, setIsLoading] =
|
3238
|
+
const [data, setData] = useState6([]);
|
3239
|
+
const [isOpen, setOpen] = useState6(false);
|
3240
|
+
const [isLoading, setIsLoading] = useState6(true);
|
3258
3241
|
const hasFilterFields = !!filterFields;
|
3259
|
-
const [filters, setFilters] =
|
3260
|
-
const [filtersToggled, setFiltersToggled] =
|
3242
|
+
const [filters, setFilters] = useState6(field.initialFilters || {});
|
3243
|
+
const [filtersToggled, setFiltersToggled] = useState6(hasFilterFields);
|
3261
3244
|
const mappedData = useMemo2(() => {
|
3262
3245
|
return data.map(mapRow);
|
3263
3246
|
}, [data]);
|
@@ -3272,7 +3255,7 @@ var ExternalInput = ({
|
|
3272
3255
|
}
|
3273
3256
|
return Array.from(validKeys);
|
3274
3257
|
}, [mappedData]);
|
3275
|
-
const [searchQuery, setSearchQuery] =
|
3258
|
+
const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
|
3276
3259
|
const search = useCallback3(
|
3277
3260
|
(query, filters2) => __async(void 0, null, function* () {
|
3278
3261
|
setIsLoading(true);
|
@@ -3761,12 +3744,12 @@ var ObjectField = ({
|
|
3761
3744
|
|
3762
3745
|
// lib/use-safe-id.ts
|
3763
3746
|
init_react_import();
|
3764
|
-
import React2, { useState as
|
3747
|
+
import React2, { useState as useState7 } from "react";
|
3765
3748
|
var useSafeId = () => {
|
3766
3749
|
if (typeof React2.useId !== "undefined") {
|
3767
3750
|
return React2.useId();
|
3768
3751
|
}
|
3769
|
-
const [id] =
|
3752
|
+
const [id] = useState7(generateId());
|
3770
3753
|
return id;
|
3771
3754
|
};
|
3772
3755
|
|
@@ -3919,7 +3902,7 @@ function AutoFieldInternal(props) {
|
|
3919
3902
|
function AutoFieldPrivate(props) {
|
3920
3903
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
|
3921
3904
|
const { value, onChange } = props;
|
3922
|
-
const [localValue, setLocalValue] =
|
3905
|
+
const [localValue, setLocalValue] = useState8(value);
|
3923
3906
|
const onChangeLocal = useCallback4(
|
3924
3907
|
(val, ui) => {
|
3925
3908
|
setLocalValue(val);
|
@@ -3959,7 +3942,7 @@ init_react_import();
|
|
3959
3942
|
var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
|
3960
3943
|
|
3961
3944
|
// components/Drawer/index.tsx
|
3962
|
-
import {
|
3945
|
+
import { useMemo as useMemo9, useState as useState15 } from "react";
|
3963
3946
|
|
3964
3947
|
// components/DragDropContext/index.tsx
|
3965
3948
|
init_react_import();
|
@@ -3969,9 +3952,8 @@ import {
|
|
3969
3952
|
useCallback as useCallback10,
|
3970
3953
|
useContext as useContext7,
|
3971
3954
|
useEffect as useEffect17,
|
3972
|
-
useId,
|
3973
3955
|
useRef as useRef4,
|
3974
|
-
useState as
|
3956
|
+
useState as useState14
|
3975
3957
|
} from "react";
|
3976
3958
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
3977
3959
|
|
@@ -3994,7 +3976,7 @@ import {
|
|
3994
3976
|
useEffect as useEffect12,
|
3995
3977
|
useMemo as useMemo7,
|
3996
3978
|
useRef as useRef2,
|
3997
|
-
useState as
|
3979
|
+
useState as useState10
|
3998
3980
|
} from "react";
|
3999
3981
|
|
4000
3982
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -4029,7 +4011,7 @@ import {
|
|
4029
4011
|
createContext as createContext3,
|
4030
4012
|
useCallback as useCallback5,
|
4031
4013
|
useMemo as useMemo6,
|
4032
|
-
useState as
|
4014
|
+
useState as useState9
|
4033
4015
|
} from "react";
|
4034
4016
|
import { createStore as createStore2 } from "zustand";
|
4035
4017
|
import { Fragment as Fragment5, jsx as jsx19 } from "react/jsx-runtime";
|
@@ -4054,8 +4036,8 @@ var DropZoneProvider = ({
|
|
4054
4036
|
children,
|
4055
4037
|
value
|
4056
4038
|
}) => {
|
4057
|
-
const [hoveringComponent, setHoveringComponent] =
|
4058
|
-
const [activeZones, setActiveZones] =
|
4039
|
+
const [hoveringComponent, setHoveringComponent] = useState9();
|
4040
|
+
const [activeZones, setActiveZones] = useState9({});
|
4059
4041
|
const dispatch = useAppStore((s) => s.dispatch);
|
4060
4042
|
const registerZone = useCallback5(
|
4061
4043
|
(zoneCompound) => {
|
@@ -4163,7 +4145,7 @@ var DraggableComponent = ({
|
|
4163
4145
|
const dispatch = useAppStore((s) => s.dispatch);
|
4164
4146
|
const iframe = useAppStore((s) => s.iframe);
|
4165
4147
|
const ctx = useContext5(dropZoneContext);
|
4166
|
-
const [localZones, setLocalZones] =
|
4148
|
+
const [localZones, setLocalZones] = useState10({});
|
4167
4149
|
const registerLocalZone = useCallback6(
|
4168
4150
|
(zoneCompound2, active) => {
|
4169
4151
|
var _a;
|
@@ -4204,7 +4186,7 @@ var DraggableComponent = ({
|
|
4204
4186
|
);
|
4205
4187
|
const canCollide = permissions.drag || userIsDragging;
|
4206
4188
|
const disabled = !isEnabled || !canCollide;
|
4207
|
-
const [dragAxis, setDragAxis] =
|
4189
|
+
const [dragAxis, setDragAxis] = useState10(userDragAxis || autoDragAxis);
|
4208
4190
|
const { ref: sortableRef, status } = useSortableSafe({
|
4209
4191
|
id,
|
4210
4192
|
index,
|
@@ -4240,7 +4222,7 @@ var DraggableComponent = ({
|
|
4240
4222
|
},
|
4241
4223
|
[sortableRef]
|
4242
4224
|
);
|
4243
|
-
const [portalEl, setPortalEl] =
|
4225
|
+
const [portalEl, setPortalEl] = useState10();
|
4244
4226
|
useEffect12(() => {
|
4245
4227
|
var _a, _b, _c;
|
4246
4228
|
setPortalEl(
|
@@ -4267,7 +4249,7 @@ var DraggableComponent = ({
|
|
4267
4249
|
};
|
4268
4250
|
return style2;
|
4269
4251
|
}, [ref.current]);
|
4270
|
-
const [style, setStyle] =
|
4252
|
+
const [style, setStyle] = useState10();
|
4271
4253
|
const sync = useCallback6(() => {
|
4272
4254
|
setStyle(getStyle());
|
4273
4255
|
}, [ref.current, iframe]);
|
@@ -4336,7 +4318,7 @@ var DraggableComponent = ({
|
|
4336
4318
|
zone: zoneCompound
|
4337
4319
|
});
|
4338
4320
|
}, [index, zoneCompound]);
|
4339
|
-
const [hover, setHover] =
|
4321
|
+
const [hover, setHover] = useState10(false);
|
4340
4322
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
4341
4323
|
useEffect12(() => {
|
4342
4324
|
if (!ref.current) {
|
@@ -4397,7 +4379,7 @@ var DraggableComponent = ({
|
|
4397
4379
|
};
|
4398
4380
|
}
|
4399
4381
|
}, [disabled, ref]);
|
4400
|
-
const [isVisible, setIsVisible] =
|
4382
|
+
const [isVisible, setIsVisible] = useState10(false);
|
4401
4383
|
useEffect12(() => {
|
4402
4384
|
sync();
|
4403
4385
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
@@ -4414,10 +4396,18 @@ var DraggableComponent = ({
|
|
4414
4396
|
const rect = el.getBoundingClientRect();
|
4415
4397
|
const diffLeft = rect.x;
|
4416
4398
|
const exceedsBoundsLeft = diffLeft < 0;
|
4399
|
+
const diffTop = rect.y;
|
4400
|
+
const exceedsBoundsTop = diffTop < 0;
|
4417
4401
|
if (exceedsBoundsLeft) {
|
4418
4402
|
el.style.transformOrigin = "left top";
|
4419
4403
|
el.style.left = "0px";
|
4420
4404
|
}
|
4405
|
+
if (exceedsBoundsTop) {
|
4406
|
+
el.style.top = "12px";
|
4407
|
+
if (!exceedsBoundsLeft) {
|
4408
|
+
el.style.transformOrigin = "right top";
|
4409
|
+
}
|
4410
|
+
}
|
4421
4411
|
}
|
4422
4412
|
}
|
4423
4413
|
},
|
@@ -4516,15 +4506,15 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
|
|
4516
4506
|
|
4517
4507
|
// components/DropZone/lib/use-min-empty-height.ts
|
4518
4508
|
init_react_import();
|
4519
|
-
import { useEffect as useEffect13, useState as
|
4509
|
+
import { useEffect as useEffect13, useState as useState11 } from "react";
|
4520
4510
|
var useMinEmptyHeight = ({
|
4521
4511
|
zoneCompound,
|
4522
4512
|
userMinEmptyHeight,
|
4523
4513
|
ref
|
4524
4514
|
}) => {
|
4525
4515
|
const appStore = useAppStoreApi();
|
4526
|
-
const [prevHeight, setPrevHeight] =
|
4527
|
-
const [isAnimating, setIsAnimating] =
|
4516
|
+
const [prevHeight, setPrevHeight] = useState11(0);
|
4517
|
+
const [isAnimating, setIsAnimating] = useState11(false);
|
4528
4518
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
4529
4519
|
var _a, _b;
|
4530
4520
|
return {
|
@@ -4570,7 +4560,7 @@ function assignRefs(refs, node) {
|
|
4570
4560
|
|
4571
4561
|
// components/DropZone/lib/use-content-with-preview.ts
|
4572
4562
|
init_react_import();
|
4573
|
-
import { useEffect as useEffect14, useState as
|
4563
|
+
import { useEffect as useEffect14, useState as useState12 } from "react";
|
4574
4564
|
|
4575
4565
|
// lib/dnd/use-rendered-callback.ts
|
4576
4566
|
init_react_import();
|
@@ -4601,8 +4591,8 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4601
4591
|
}
|
4602
4592
|
);
|
4603
4593
|
const isDragging = useAppStore((s) => s.state.ui.isDragging);
|
4604
|
-
const [contentIdsWithPreview, setContentIdsWithPreview] =
|
4605
|
-
const [localPreview, setLocalPreview] =
|
4594
|
+
const [contentIdsWithPreview, setContentIdsWithPreview] = useState12(contentIds);
|
4595
|
+
const [localPreview, setLocalPreview] = useState12(
|
4606
4596
|
preview
|
4607
4597
|
);
|
4608
4598
|
const updateContent = useRenderedCallback(
|
@@ -4645,13 +4635,13 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4645
4635
|
|
4646
4636
|
// components/DropZone/lib/use-drag-axis.ts
|
4647
4637
|
init_react_import();
|
4648
|
-
import { useCallback as useCallback8, useEffect as useEffect15, useState as
|
4638
|
+
import { useCallback as useCallback8, useEffect as useEffect15, useState as useState13 } from "react";
|
4649
4639
|
var GRID_DRAG_AXIS = "dynamic";
|
4650
4640
|
var FLEX_ROW_DRAG_AXIS = "x";
|
4651
4641
|
var DEFAULT_DRAG_AXIS = "y";
|
4652
4642
|
var useDragAxis = (ref, collisionAxis) => {
|
4653
4643
|
const status = useAppStore((s) => s.status);
|
4654
|
-
const [dragAxis, setDragAxis] =
|
4644
|
+
const [dragAxis, setDragAxis] = useState13(
|
4655
4645
|
collisionAxis || DEFAULT_DRAG_AXIS
|
4656
4646
|
);
|
4657
4647
|
const calculateDragAxis = useCallback8(() => {
|
@@ -5431,10 +5421,10 @@ var DragDropContextClient = ({
|
|
5431
5421
|
const resolveData2 = useAppStore((s) => s.resolveData);
|
5432
5422
|
const metadata = useAppStore((s) => s.metadata);
|
5433
5423
|
const appStore = useAppStoreApi();
|
5434
|
-
const id =
|
5424
|
+
const id = useSafeId();
|
5435
5425
|
const debouncedParamsRef = useRef4(null);
|
5436
5426
|
const tempDisableFallback = useTempDisableFallback(100);
|
5437
|
-
const [zoneStore] =
|
5427
|
+
const [zoneStore] = useState14(
|
5438
5428
|
() => createStore3(() => ({
|
5439
5429
|
zoneDepthIndex: {},
|
5440
5430
|
nextZoneDepthIndex: {},
|
@@ -5503,7 +5493,7 @@ var DragDropContextClient = ({
|
|
5503
5493
|
);
|
5504
5494
|
}
|
5505
5495
|
}, []);
|
5506
|
-
const [plugins] =
|
5496
|
+
const [plugins] = useState14(() => [
|
5507
5497
|
...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
|
5508
5498
|
createNestedDroppablePlugin(
|
5509
5499
|
{
|
@@ -5551,7 +5541,7 @@ var DragDropContextClient = ({
|
|
5551
5541
|
)
|
5552
5542
|
]);
|
5553
5543
|
const sensors = useSensors();
|
5554
|
-
const [dragListeners, setDragListeners] =
|
5544
|
+
const [dragListeners, setDragListeners] = useState14({});
|
5555
5545
|
const dragMode = useRef4(null);
|
5556
5546
|
const initialSelector = useRef4(void 0);
|
5557
5547
|
return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
|
@@ -5846,7 +5836,7 @@ var DrawerItem = ({
|
|
5846
5836
|
isDragDisabled
|
5847
5837
|
}) => {
|
5848
5838
|
const resolvedId = id || name;
|
5849
|
-
const [dynamicId, setDynamicId] =
|
5839
|
+
const [dynamicId, setDynamicId] = useState15(generateId(resolvedId));
|
5850
5840
|
if (typeof index !== "undefined") {
|
5851
5841
|
console.error(
|
5852
5842
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -5885,7 +5875,7 @@ var Drawer = ({
|
|
5885
5875
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
5886
5876
|
);
|
5887
5877
|
}
|
5888
|
-
const id =
|
5878
|
+
const id = useSafeId();
|
5889
5879
|
const { ref } = useDroppableSafe({
|
5890
5880
|
id,
|
5891
5881
|
type: "void",
|
@@ -5913,7 +5903,7 @@ import {
|
|
5913
5903
|
useContext as useContext11,
|
5914
5904
|
useEffect as useEffect25,
|
5915
5905
|
useMemo as useMemo18,
|
5916
|
-
useState as
|
5906
|
+
useState as useState22
|
5917
5907
|
} from "react";
|
5918
5908
|
|
5919
5909
|
// components/SidebarSection/index.tsx
|
@@ -6213,7 +6203,7 @@ init_react_import();
|
|
6213
6203
|
|
6214
6204
|
// lib/use-component-list.tsx
|
6215
6205
|
init_react_import();
|
6216
|
-
import { useEffect as useEffect18, useState as
|
6206
|
+
import { useEffect as useEffect18, useState as useState16 } from "react";
|
6217
6207
|
|
6218
6208
|
// components/ComponentList/index.tsx
|
6219
6209
|
init_react_import();
|
@@ -6284,7 +6274,7 @@ ComponentList.Item = ComponentListItem;
|
|
6284
6274
|
// lib/use-component-list.tsx
|
6285
6275
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
6286
6276
|
var useComponentList = () => {
|
6287
|
-
const [componentList, setComponentList] =
|
6277
|
+
const [componentList, setComponentList] = useState16();
|
6288
6278
|
const config = useAppStore((s) => s.config);
|
6289
6279
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
6290
6280
|
useEffect18(() => {
|
@@ -6375,7 +6365,7 @@ import {
|
|
6375
6365
|
createContext as createContext5,
|
6376
6366
|
useContext as useContext8,
|
6377
6367
|
useEffect as useEffect19,
|
6378
|
-
useState as
|
6368
|
+
useState as useState17
|
6379
6369
|
} from "react";
|
6380
6370
|
import hash from "object-hash";
|
6381
6371
|
import { createPortal as createPortal3 } from "react-dom";
|
@@ -6603,10 +6593,10 @@ function AutoFrame(_a) {
|
|
6603
6593
|
"onNotReady",
|
6604
6594
|
"frameRef"
|
6605
6595
|
]);
|
6606
|
-
const [loaded, setLoaded] =
|
6607
|
-
const [ctx, setCtx] =
|
6608
|
-
const [mountTarget, setMountTarget] =
|
6609
|
-
const [stylesLoaded, setStylesLoaded] =
|
6596
|
+
const [loaded, setLoaded] = useState17(false);
|
6597
|
+
const [ctx, setCtx] = useState17({});
|
6598
|
+
const [mountTarget, setMountTarget] = useState17();
|
6599
|
+
const [stylesLoaded, setStylesLoaded] = useState17(false);
|
6610
6600
|
useEffect19(() => {
|
6611
6601
|
var _a2;
|
6612
6602
|
if (frameRef.current) {
|
@@ -7152,12 +7142,12 @@ import {
|
|
7152
7142
|
useEffect as useEffect22,
|
7153
7143
|
useMemo as useMemo16,
|
7154
7144
|
useRef as useRef6,
|
7155
|
-
useState as
|
7145
|
+
useState as useState19
|
7156
7146
|
} from "react";
|
7157
7147
|
|
7158
7148
|
// components/ViewportControls/index.tsx
|
7159
7149
|
init_react_import();
|
7160
|
-
import { useEffect as useEffect21, useMemo as useMemo15, useState as
|
7150
|
+
import { useEffect as useEffect21, useMemo as useMemo15, useState as useState18 } from "react";
|
7161
7151
|
|
7162
7152
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
7163
7153
|
init_react_import();
|
@@ -7180,7 +7170,7 @@ var ViewportButton = ({
|
|
7180
7170
|
onClick
|
7181
7171
|
}) => {
|
7182
7172
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
7183
|
-
const [isActive, setIsActive] =
|
7173
|
+
const [isActive, setIsActive] = useState18(false);
|
7184
7174
|
useEffect21(() => {
|
7185
7175
|
setIsActive(width === viewports.current.width);
|
7186
7176
|
}, [width, viewports.current.width]);
|
@@ -7365,7 +7355,7 @@ var Canvas = () => {
|
|
7365
7355
|
}))
|
7366
7356
|
);
|
7367
7357
|
const frameRef = useRef6(null);
|
7368
|
-
const [showTransition, setShowTransition] =
|
7358
|
+
const [showTransition, setShowTransition] = useState19(false);
|
7369
7359
|
const defaultRender = useMemo16(() => {
|
7370
7360
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
|
7371
7361
|
return PuckDefault;
|
@@ -7424,7 +7414,7 @@ var Canvas = () => {
|
|
7424
7414
|
window.removeEventListener("resize", cb);
|
7425
7415
|
};
|
7426
7416
|
}, []);
|
7427
|
-
const [showLoader, setShowLoader] =
|
7417
|
+
const [showLoader, setShowLoader] = useState19(false);
|
7428
7418
|
useEffect22(() => {
|
7429
7419
|
setTimeout(() => {
|
7430
7420
|
setShowLoader(true);
|
@@ -7554,10 +7544,10 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment14, { chil
|
|
7554
7544
|
|
7555
7545
|
// lib/use-inject-css.ts
|
7556
7546
|
init_react_import();
|
7557
|
-
import { useEffect as useEffect23, useState as
|
7547
|
+
import { useEffect as useEffect23, useState as useState20 } from "react";
|
7558
7548
|
var styles = ``;
|
7559
7549
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7560
|
-
const [el, setEl] =
|
7550
|
+
const [el, setEl] = useState20();
|
7561
7551
|
useEffect23(() => {
|
7562
7552
|
setEl(document.createElement("style"));
|
7563
7553
|
}, []);
|
@@ -7599,7 +7589,7 @@ var usePreviewModeHotkeys = () => {
|
|
7599
7589
|
|
7600
7590
|
// lib/use-puck.ts
|
7601
7591
|
init_react_import();
|
7602
|
-
import { createContext as createContext6, useContext as useContext10, useEffect as useEffect24, useState as
|
7592
|
+
import { createContext as createContext6, useContext as useContext10, useEffect as useEffect24, useState as useState21 } from "react";
|
7603
7593
|
import { createStore as createStore4, useStore as useStore3 } from "zustand";
|
7604
7594
|
var generateUsePuck = (store) => {
|
7605
7595
|
const history = {
|
@@ -7628,7 +7618,7 @@ var UsePuckStoreContext = createContext6(
|
|
7628
7618
|
null
|
7629
7619
|
);
|
7630
7620
|
var useRegisterUsePuckStore = (appStore) => {
|
7631
|
-
const [usePuckStore] =
|
7621
|
+
const [usePuckStore] = useState21(
|
7632
7622
|
() => createStore4(() => generateUsePuck(appStore.getState()))
|
7633
7623
|
);
|
7634
7624
|
useEffect24(() => {
|
@@ -7710,7 +7700,7 @@ function PuckProvider({ children }) {
|
|
7710
7700
|
enabled: true,
|
7711
7701
|
waitForStyles: true
|
7712
7702
|
}, _iframe);
|
7713
|
-
const [generatedAppState] =
|
7703
|
+
const [generatedAppState] = useState22(() => {
|
7714
7704
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
7715
7705
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7716
7706
|
let clientUiState = {};
|
@@ -7803,7 +7793,7 @@ function PuckProvider({ children }) {
|
|
7803
7793
|
onAction,
|
7804
7794
|
metadata
|
7805
7795
|
]);
|
7806
|
-
const [appStore] =
|
7796
|
+
const [appStore] = useState22(() => createAppStore(generateAppStore()));
|
7807
7797
|
useEffect25(() => {
|
7808
7798
|
appStore.setState(__spreadValues({}, generateAppStore()));
|
7809
7799
|
}, [
|
@@ -7856,7 +7846,7 @@ function PuckLayout({ children }) {
|
|
7856
7846
|
const rightSideBarVisible = useAppStore(
|
7857
7847
|
(s) => s.state.ui.rightSideBarVisible
|
7858
7848
|
);
|
7859
|
-
const [menuOpen, setMenuOpen] =
|
7849
|
+
const [menuOpen, setMenuOpen] = useState22(false);
|
7860
7850
|
const appStore = useAppStoreApi();
|
7861
7851
|
useEffect25(() => {
|
7862
7852
|
return appStore.subscribe((s) => {
|
@@ -7946,7 +7936,7 @@ function PuckLayout({ children }) {
|
|
7946
7936
|
() => overrides.headerActions || defaultHeaderActionsRender,
|
7947
7937
|
[overrides]
|
7948
7938
|
);
|
7949
|
-
const [mounted, setMounted] =
|
7939
|
+
const [mounted, setMounted] = useState22(false);
|
7950
7940
|
useEffect25(() => {
|
7951
7941
|
setMounted(true);
|
7952
7942
|
}, []);
|
@@ -8111,40 +8101,6 @@ var migrations = [
|
|
8111
8101
|
function migrate(data) {
|
8112
8102
|
return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
|
8113
8103
|
}
|
8114
|
-
|
8115
|
-
// lib/transform-props.ts
|
8116
|
-
init_react_import();
|
8117
|
-
function transformProps(data, propTransforms) {
|
8118
|
-
const mapItem = (item) => {
|
8119
|
-
if (propTransforms[item.type]) {
|
8120
|
-
return __spreadProps(__spreadValues({}, item), {
|
8121
|
-
props: propTransforms[item.type](item.props)
|
8122
|
-
});
|
8123
|
-
}
|
8124
|
-
return item;
|
8125
|
-
};
|
8126
|
-
const defaultedData = defaultData(data);
|
8127
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
8128
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
8129
|
-
if (propTransforms["root"]) {
|
8130
|
-
if (defaultedData.root.props) {
|
8131
|
-
newRoot.props = propTransforms["root"](rootProps);
|
8132
|
-
} else {
|
8133
|
-
newRoot = propTransforms["root"](rootProps);
|
8134
|
-
}
|
8135
|
-
}
|
8136
|
-
const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
|
8137
|
-
root: newRoot,
|
8138
|
-
content: defaultedData.content.map(mapItem),
|
8139
|
-
zones: Object.keys(data.zones || {}).reduce(
|
8140
|
-
(acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
|
8141
|
-
[zoneKey]: data.zones[zoneKey].map(mapItem)
|
8142
|
-
}),
|
8143
|
-
{}
|
8144
|
-
)
|
8145
|
-
});
|
8146
|
-
return afterPropTransforms;
|
8147
|
-
}
|
8148
8104
|
export {
|
8149
8105
|
Action,
|
8150
8106
|
ActionBar,
|