@measured/puck 0.19.0-canary.59cb0d9 → 0.19.0-canary.706ea0c1
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/README.md +1 -0
- 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 +413 -366
- package/dist/index.mjs +270 -258
- package/dist/{resolve-all-data-wwgDuTnC.d.mts → resolve-all-data-3XjIPfNh.d.mts} +13 -1
- package/dist/{resolve-all-data-wwgDuTnC.d.ts → resolve-all-data-3XjIPfNh.d.ts} +13 -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 +5 -4
package/dist/index.js
CHANGED
@@ -311,7 +311,7 @@ init_react_import();
|
|
311
311
|
var styles_module_default2 = { "InputWrapper": "_InputWrapper_g5w3n_1", "Input-label": "_Input-label_g5w3n_5", "Input-labelIcon": "_Input-labelIcon_g5w3n_14", "Input-disabledIcon": "_Input-disabledIcon_g5w3n_21", "Input-input": "_Input-input_g5w3n_26", "Input": "_Input_g5w3n_1", "Input--readOnly": "_Input--readOnly_g5w3n_74", "Input-radioGroupItems": "_Input-radioGroupItems_g5w3n_85", "Input-radio": "_Input-radio_g5w3n_85", "Input-radioInner": "_Input-radioInner_g5w3n_102", "Input-radioInput": "_Input-radioInput_g5w3n_147" };
|
312
312
|
|
313
313
|
// components/AutoField/index.tsx
|
314
|
-
var
|
314
|
+
var import_react23 = require("react");
|
315
315
|
|
316
316
|
// components/AutoField/fields/index.tsx
|
317
317
|
init_react_import();
|
@@ -771,7 +771,7 @@ var IconButton = ({
|
|
771
771
|
};
|
772
772
|
|
773
773
|
// components/AutoField/fields/ArrayField/index.tsx
|
774
|
-
var
|
774
|
+
var import_react15 = require("react");
|
775
775
|
|
776
776
|
// components/DragIcon/index.tsx
|
777
777
|
init_react_import();
|
@@ -2098,7 +2098,6 @@ function useAppStoreApi() {
|
|
2098
2098
|
// components/Sortable/index.tsx
|
2099
2099
|
init_react_import();
|
2100
2100
|
var import_react13 = require("@dnd-kit/react");
|
2101
|
-
var import_react14 = require("react");
|
2102
2101
|
|
2103
2102
|
// lib/dnd/dnd-kit/safe.ts
|
2104
2103
|
init_react_import();
|
@@ -2121,7 +2120,8 @@ function useDraggableSafe(input) {
|
|
2121
2120
|
function useSortableSafe(input) {
|
2122
2121
|
if (typeof window === "undefined") {
|
2123
2122
|
return { ref: () => {
|
2124
|
-
}, status: "idle"
|
2123
|
+
}, status: "idle", handleRef: () => {
|
2124
|
+
} };
|
2125
2125
|
}
|
2126
2126
|
return (0, import_sortable.useSortable)(input);
|
2127
2127
|
}
|
@@ -2145,6 +2145,7 @@ var _PointerSensor = class _PointerSensor extends import_abstract.Sensor {
|
|
2145
2145
|
this.listeners = new import_utilities.Listeners();
|
2146
2146
|
this.cleanup = /* @__PURE__ */ new Set();
|
2147
2147
|
this.source = void 0;
|
2148
|
+
this.started = false;
|
2148
2149
|
__privateAdd(this, _clearTimeout);
|
2149
2150
|
this.handleCancel = this.handleCancel.bind(this);
|
2150
2151
|
this.handlePointerUp = this.handlePointerUp.bind(this);
|
@@ -2302,6 +2303,12 @@ var _PointerSensor = class _PointerSensor extends import_abstract.Sensor {
|
|
2302
2303
|
if (!status.idle) {
|
2303
2304
|
const canceled = !status.initialized;
|
2304
2305
|
this.manager.actions.stop({ canceled });
|
2306
|
+
} else if (this.started) {
|
2307
|
+
setTimeout(() => {
|
2308
|
+
if (!this.manager.dragOperation.status.idle) {
|
2309
|
+
this.manager.actions.stop({ canceled: false });
|
2310
|
+
}
|
2311
|
+
}, 10);
|
2305
2312
|
}
|
2306
2313
|
this.cleanup.forEach((cleanup) => cleanup());
|
2307
2314
|
this.cleanup.clear();
|
@@ -2316,12 +2323,13 @@ var _PointerSensor = class _PointerSensor extends import_abstract.Sensor {
|
|
2316
2323
|
var _a;
|
2317
2324
|
const { manager, initialCoordinates } = this;
|
2318
2325
|
(_a = __privateGet(this, _clearTimeout)) == null ? void 0 : _a.call(this);
|
2319
|
-
if (!initialCoordinates || manager.dragOperation.status.initialized) {
|
2326
|
+
if (!initialCoordinates || manager.dragOperation.status.initialized || this.started) {
|
2320
2327
|
return;
|
2321
2328
|
}
|
2322
2329
|
if (event.defaultPrevented) {
|
2323
2330
|
return;
|
2324
2331
|
}
|
2332
|
+
this.started = true;
|
2325
2333
|
event.preventDefault();
|
2326
2334
|
(0, import_state2.batch)(() => {
|
2327
2335
|
manager.actions.setDragSource(source.id);
|
@@ -2349,6 +2357,9 @@ var _PointerSensor = class _PointerSensor extends import_abstract.Sensor {
|
|
2349
2357
|
]);
|
2350
2358
|
ownerDocument.body.setPointerCapture(event.pointerId);
|
2351
2359
|
this.cleanup.add(unbind);
|
2360
|
+
this.cleanup.add(() => {
|
2361
|
+
this.started = false;
|
2362
|
+
});
|
2352
2363
|
}
|
2353
2364
|
handleDragStart(event) {
|
2354
2365
|
const { target } = event;
|
@@ -2396,23 +2407,26 @@ function patchWindow(window2) {
|
|
2396
2407
|
|
2397
2408
|
// lib/dnd/use-sensors.ts
|
2398
2409
|
var import_utilities2 = require("@dnd-kit/dom/utilities");
|
2399
|
-
var useSensors = (
|
2410
|
+
var useSensors = ({
|
2411
|
+
other,
|
2412
|
+
mouse,
|
2413
|
+
touch
|
2414
|
+
} = {
|
2415
|
+
touch: { delay: { value: 200, tolerance: 10 } },
|
2416
|
+
other: { delay: { value: 200, tolerance: 10 }, distance: { value: 5 } }
|
2417
|
+
}) => {
|
2400
2418
|
const [sensors] = (0, import_react12.useState)(() => [
|
2401
2419
|
PointerSensor.configure({
|
2402
2420
|
activationConstraints(event, source) {
|
2403
2421
|
var _a;
|
2404
2422
|
const { pointerType, target } = event;
|
2405
2423
|
if (pointerType === "mouse" && (0, import_utilities2.isElement)(target) && (source.handle === target || ((_a = source.handle) == null ? void 0 : _a.contains(target)))) {
|
2406
|
-
return
|
2424
|
+
return mouse;
|
2407
2425
|
}
|
2408
|
-
const delay = { value: 200, tolerance: 10 };
|
2409
2426
|
if (pointerType === "touch") {
|
2410
|
-
return
|
2427
|
+
return touch;
|
2411
2428
|
}
|
2412
|
-
return
|
2413
|
-
delay,
|
2414
|
-
distance: { value: 5 }
|
2415
|
-
};
|
2429
|
+
return other;
|
2416
2430
|
}
|
2417
2431
|
})
|
2418
2432
|
]);
|
@@ -2755,7 +2769,6 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
|
|
2755
2769
|
};
|
2756
2770
|
|
2757
2771
|
// components/Sortable/index.tsx
|
2758
|
-
var import_modifiers = require("@dnd-kit/dom/modifiers");
|
2759
2772
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
2760
2773
|
var SortableProvider = ({
|
2761
2774
|
children,
|
@@ -2763,22 +2776,20 @@ var SortableProvider = ({
|
|
2763
2776
|
onDragEnd,
|
2764
2777
|
onMove
|
2765
2778
|
}) => {
|
2766
|
-
const
|
2767
|
-
|
2779
|
+
const sensors = useSensors({
|
2780
|
+
mouse: { distance: { value: 5 } }
|
2781
|
+
});
|
2768
2782
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2769
2783
|
import_react13.DragDropProvider,
|
2770
2784
|
{
|
2771
2785
|
sensors,
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
}
|
2777
|
-
})
|
2778
|
-
],
|
2779
|
-
onDragStart,
|
2786
|
+
onDragStart: (event) => {
|
2787
|
+
var _a, _b;
|
2788
|
+
return onDragStart((_b = (_a = event.operation.source) == null ? void 0 : _a.id.toString()) != null ? _b : "");
|
2789
|
+
},
|
2780
2790
|
onDragOver: (event, manager) => {
|
2781
2791
|
var _a, _b;
|
2792
|
+
event.preventDefault();
|
2782
2793
|
const { operation } = event;
|
2783
2794
|
const { source, target } = operation;
|
2784
2795
|
if (!source || !target) return;
|
@@ -2786,14 +2797,14 @@ var SortableProvider = ({
|
|
2786
2797
|
let targetIndex = target.data.index;
|
2787
2798
|
const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[target.id];
|
2788
2799
|
if (sourceIndex !== targetIndex && source.id !== target.id) {
|
2789
|
-
const collisionPosition =
|
2800
|
+
const collisionPosition = collisionData.direction === "up" ? "before" : "after";
|
2790
2801
|
if (targetIndex >= sourceIndex) {
|
2791
2802
|
targetIndex = targetIndex - 1;
|
2792
2803
|
}
|
2793
2804
|
if (collisionPosition === "after") {
|
2794
2805
|
targetIndex = targetIndex + 1;
|
2795
2806
|
}
|
2796
|
-
|
2807
|
+
onMove({
|
2797
2808
|
source: sourceIndex,
|
2798
2809
|
target: targetIndex
|
2799
2810
|
});
|
@@ -2801,12 +2812,8 @@ var SortableProvider = ({
|
|
2801
2812
|
},
|
2802
2813
|
onDragEnd: () => {
|
2803
2814
|
setTimeout(() => {
|
2804
|
-
if (move.source !== -1 && move.target !== -1) {
|
2805
|
-
onMove(move);
|
2806
|
-
}
|
2807
2815
|
onDragEnd();
|
2808
2816
|
}, 250);
|
2809
|
-
setMove({ source: -1, target: -1 });
|
2810
2817
|
},
|
2811
2818
|
children
|
2812
2819
|
}
|
@@ -2819,7 +2826,11 @@ var Sortable = ({
|
|
2819
2826
|
children,
|
2820
2827
|
type = "item"
|
2821
2828
|
}) => {
|
2822
|
-
const {
|
2829
|
+
const {
|
2830
|
+
ref: sortableRef,
|
2831
|
+
status,
|
2832
|
+
handleRef
|
2833
|
+
} = useSortableSafe({
|
2823
2834
|
id,
|
2824
2835
|
type,
|
2825
2836
|
index,
|
@@ -2827,16 +2838,16 @@ var Sortable = ({
|
|
2827
2838
|
data: { index },
|
2828
2839
|
collisionDetector: createDynamicCollisionDetector("y")
|
2829
2840
|
});
|
2830
|
-
return children({ status, ref: sortableRef });
|
2841
|
+
return children({ status, ref: sortableRef, handleRef });
|
2831
2842
|
};
|
2832
2843
|
|
2833
2844
|
// components/AutoField/context.tsx
|
2834
2845
|
init_react_import();
|
2835
|
-
var
|
2846
|
+
var import_react14 = require("react");
|
2836
2847
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
2837
|
-
var NestedFieldContext = (0,
|
2848
|
+
var NestedFieldContext = (0, import_react14.createContext)({});
|
2838
2849
|
var useNestedFieldContext = () => {
|
2839
|
-
const context = (0,
|
2850
|
+
const context = (0, import_react14.useContext)(NestedFieldContext);
|
2840
2851
|
return __spreadProps(__spreadValues({}, context), {
|
2841
2852
|
readOnlyFields: context.readOnlyFields || {}
|
2842
2853
|
});
|
@@ -2850,7 +2861,7 @@ var NestedFieldProvider = ({
|
|
2850
2861
|
}) => {
|
2851
2862
|
const subPath = `${name}.${subName}`;
|
2852
2863
|
const wildcardSubPath = `${wildcardName}.${subName}`;
|
2853
|
-
const subReadOnlyFields = (0,
|
2864
|
+
const subReadOnlyFields = (0, import_react14.useMemo)(
|
2854
2865
|
() => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
|
2855
2866
|
const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
|
2856
2867
|
if (isLocal) {
|
@@ -2885,6 +2896,7 @@ var ArrayField = ({
|
|
2885
2896
|
value: _value,
|
2886
2897
|
name,
|
2887
2898
|
label,
|
2899
|
+
labelIcon,
|
2888
2900
|
readOnly,
|
2889
2901
|
id,
|
2890
2902
|
Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", __spreadValues({}, props))
|
@@ -2902,12 +2914,14 @@ var ArrayField = ({
|
|
2902
2914
|
}),
|
2903
2915
|
openId: ""
|
2904
2916
|
};
|
2905
|
-
const [localState, setLocalState] = (0,
|
2906
|
-
(0,
|
2907
|
-
|
2908
|
-
|
2917
|
+
const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
|
2918
|
+
(0, import_react15.useEffect)(() => {
|
2919
|
+
var _a;
|
2920
|
+
const _arrayState = (_a = appStore.getState().state.ui.arrayState[id]) != null ? _a : arrayState;
|
2921
|
+
setLocalState({ arrayState: _arrayState, value });
|
2922
|
+
}, [value]);
|
2909
2923
|
const appStore = useAppStoreApi();
|
2910
|
-
const mapArrayStateToUi = (0,
|
2924
|
+
const mapArrayStateToUi = (0, import_react15.useCallback)(
|
2911
2925
|
(partialArrayState) => {
|
2912
2926
|
const state = appStore.getState().state;
|
2913
2927
|
return {
|
@@ -2918,13 +2932,13 @@ var ArrayField = ({
|
|
2918
2932
|
},
|
2919
2933
|
[arrayState, appStore]
|
2920
2934
|
);
|
2921
|
-
const getHighestIndex = (0,
|
2935
|
+
const getHighestIndex = (0, import_react15.useCallback)(() => {
|
2922
2936
|
return arrayState.items.reduce(
|
2923
2937
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
2924
2938
|
-1
|
2925
2939
|
);
|
2926
2940
|
}, [arrayState]);
|
2927
|
-
const regenerateArrayState = (0,
|
2941
|
+
const regenerateArrayState = (0, import_react15.useCallback)(
|
2928
2942
|
(value2) => {
|
2929
2943
|
let highestIndex = getHighestIndex();
|
2930
2944
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
@@ -2943,16 +2957,18 @@ var ArrayField = ({
|
|
2943
2957
|
},
|
2944
2958
|
[arrayState]
|
2945
2959
|
);
|
2946
|
-
(0,
|
2960
|
+
(0, import_react15.useEffect)(() => {
|
2947
2961
|
if (arrayState.items.length > 0) {
|
2948
2962
|
setUi(mapArrayStateToUi(arrayState));
|
2949
2963
|
}
|
2950
2964
|
}, []);
|
2951
|
-
const [
|
2965
|
+
const [draggedItem, setDraggedItem] = (0, import_react15.useState)("");
|
2966
|
+
const isDragging = !!draggedItem;
|
2952
2967
|
const canEdit = useAppStore(
|
2953
2968
|
(s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
|
2954
2969
|
);
|
2955
2970
|
const forceReadOnly = !canEdit;
|
2971
|
+
const valueRef = (0, import_react15.useRef)(value);
|
2956
2972
|
if (field.type !== "array" || !field.arrayFields) {
|
2957
2973
|
return null;
|
2958
2974
|
}
|
@@ -2961,16 +2977,22 @@ var ArrayField = ({
|
|
2961
2977
|
Label2,
|
2962
2978
|
{
|
2963
2979
|
label: label || name,
|
2964
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
|
2980
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
|
2965
2981
|
el: "div",
|
2966
2982
|
readOnly,
|
2967
2983
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
2968
2984
|
SortableProvider,
|
2969
2985
|
{
|
2970
|
-
onDragStart: () =>
|
2971
|
-
onDragEnd: () =>
|
2986
|
+
onDragStart: (id2) => setDraggedItem(id2),
|
2987
|
+
onDragEnd: () => {
|
2988
|
+
setDraggedItem("");
|
2989
|
+
onChange(valueRef.current);
|
2990
|
+
},
|
2972
2991
|
onMove: (move) => {
|
2973
|
-
|
2992
|
+
if (arrayState.items[move.source]._arrayId !== draggedItem) {
|
2993
|
+
return;
|
2994
|
+
}
|
2995
|
+
const newValue = reorder(localState.value, move.source, move.target);
|
2974
2996
|
const newArrayStateItems = reorder(
|
2975
2997
|
arrayState.items,
|
2976
2998
|
move.source,
|
@@ -2983,11 +3005,11 @@ var ArrayField = ({
|
|
2983
3005
|
})
|
2984
3006
|
};
|
2985
3007
|
setUi(newUi, false);
|
2986
|
-
onChange(newValue, newUi);
|
2987
3008
|
setLocalState({
|
2988
3009
|
value: newValue,
|
2989
3010
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
2990
3011
|
});
|
3012
|
+
valueRef.current = newValue;
|
2991
3013
|
},
|
2992
3014
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
2993
3015
|
"div",
|
@@ -2996,11 +3018,8 @@ var ArrayField = ({
|
|
2996
3018
|
hasItems: Array.isArray(value) && value.length > 0,
|
2997
3019
|
addDisabled
|
2998
3020
|
}),
|
2999
|
-
onClick: (e) => {
|
3000
|
-
e.preventDefault();
|
3001
|
-
},
|
3002
3021
|
children: [
|
3003
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
|
3022
|
+
localState.arrayState.items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
|
3004
3023
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
3005
3024
|
const data = Array.from(localState.value || [])[i] || {};
|
3006
3025
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
@@ -3009,7 +3028,7 @@ var ArrayField = ({
|
|
3009
3028
|
id: _arrayId,
|
3010
3029
|
index: i,
|
3011
3030
|
disabled: readOnly,
|
3012
|
-
children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
3031
|
+
children: ({ status, ref, handleRef }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
3013
3032
|
"div",
|
3014
3033
|
{
|
3015
3034
|
ref,
|
@@ -3022,6 +3041,7 @@ var ArrayField = ({
|
|
3022
3041
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
3023
3042
|
"div",
|
3024
3043
|
{
|
3044
|
+
ref: handleRef,
|
3025
3045
|
onClick: (e) => {
|
3026
3046
|
if (isDragging) return;
|
3027
3047
|
e.preventDefault();
|
@@ -3058,12 +3078,11 @@ var ArrayField = ({
|
|
3058
3078
|
0,
|
3059
3079
|
existingValue[i]
|
3060
3080
|
);
|
3061
|
-
|
3062
|
-
existingValue
|
3063
|
-
mapArrayStateToUi(
|
3064
|
-
regenerateArrayState(existingValue)
|
3065
|
-
)
|
3081
|
+
const newUi = mapArrayStateToUi(
|
3082
|
+
regenerateArrayState(existingValue)
|
3066
3083
|
);
|
3084
|
+
setUi(newUi, false);
|
3085
|
+
onChange(existingValue);
|
3067
3086
|
},
|
3068
3087
|
title: "Duplicate",
|
3069
3088
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 })
|
@@ -3082,12 +3101,13 @@ var ArrayField = ({
|
|
3082
3101
|
];
|
3083
3102
|
existingValue.splice(i, 1);
|
3084
3103
|
existingItems.splice(i, 1);
|
3085
|
-
|
3086
|
-
existingValue,
|
3104
|
+
setUi(
|
3087
3105
|
mapArrayStateToUi({
|
3088
3106
|
items: existingItems
|
3089
|
-
})
|
3107
|
+
}),
|
3108
|
+
false
|
3090
3109
|
);
|
3110
|
+
onChange(existingValue);
|
3091
3111
|
},
|
3092
3112
|
title: "Delete",
|
3093
3113
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 })
|
@@ -3099,58 +3119,49 @@ var ArrayField = ({
|
|
3099
3119
|
]
|
3100
3120
|
}
|
3101
3121
|
),
|
3102
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3103
|
-
|
3104
|
-
{
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3122
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
|
3123
|
+
const subField = field.arrayFields[subName];
|
3124
|
+
const indexName = `${name}[${i}]`;
|
3125
|
+
const subPath = `${indexName}.${subName}`;
|
3126
|
+
const localIndexName = `${localName}[${i}]`;
|
3127
|
+
const localWildcardName = `${localName}[*]`;
|
3128
|
+
const localSubPath = `${localIndexName}.${subName}`;
|
3129
|
+
const localWildcardSubPath = `${localWildcardName}.${subName}`;
|
3130
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
|
3131
|
+
const label2 = subField.label || subName;
|
3132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3133
|
+
NestedFieldProvider,
|
3134
|
+
{
|
3135
|
+
name: localIndexName,
|
3136
|
+
wildcardName: localWildcardName,
|
3137
|
+
subName,
|
3138
|
+
readOnlyFields,
|
3139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3140
|
+
AutoFieldPrivate,
|
3121
3141
|
{
|
3122
|
-
name:
|
3123
|
-
|
3124
|
-
subName
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
}
|
3146
|
-
}
|
3147
|
-
)
|
3148
|
-
},
|
3149
|
-
subPath
|
3150
|
-
);
|
3151
|
-
})
|
3152
|
-
}
|
3153
|
-
) })
|
3142
|
+
name: subPath,
|
3143
|
+
label: label2,
|
3144
|
+
id: `${_arrayId}_${subName}`,
|
3145
|
+
readOnly: subReadOnly,
|
3146
|
+
field: __spreadProps(__spreadValues({}, subField), {
|
3147
|
+
label: label2
|
3148
|
+
// May be used by custom fields
|
3149
|
+
}),
|
3150
|
+
value: data[subName],
|
3151
|
+
onChange: (val, ui) => {
|
3152
|
+
onChange(
|
3153
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
3154
|
+
[subName]: val
|
3155
|
+
})),
|
3156
|
+
ui
|
3157
|
+
);
|
3158
|
+
}
|
3159
|
+
}
|
3160
|
+
)
|
3161
|
+
},
|
3162
|
+
subPath
|
3163
|
+
);
|
3164
|
+
}) }) })
|
3154
3165
|
]
|
3155
3166
|
}
|
3156
3167
|
)
|
@@ -3171,7 +3182,8 @@ var ArrayField = ({
|
|
3171
3182
|
field.defaultItemProps || {}
|
3172
3183
|
];
|
3173
3184
|
const newArrayState = regenerateArrayState(newValue);
|
3174
|
-
|
3185
|
+
setUi(mapArrayStateToUi(newArrayState), false);
|
3186
|
+
onChange(newValue);
|
3175
3187
|
},
|
3176
3188
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Plus, { size: 21 })
|
3177
3189
|
}
|
@@ -3196,6 +3208,7 @@ var DefaultField = ({
|
|
3196
3208
|
value: _value,
|
3197
3209
|
name,
|
3198
3210
|
label,
|
3211
|
+
labelIcon,
|
3199
3212
|
Label: Label2,
|
3200
3213
|
id
|
3201
3214
|
}) => {
|
@@ -3204,7 +3217,7 @@ var DefaultField = ({
|
|
3204
3217
|
Label2,
|
3205
3218
|
{
|
3206
3219
|
label: label || name,
|
3207
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
3220
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
3208
3221
|
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Type, { size: 16 }),
|
3209
3222
|
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hash, { size: 16 })
|
3210
3223
|
] }),
|
@@ -3247,11 +3260,11 @@ var DefaultField = ({
|
|
3247
3260
|
|
3248
3261
|
// components/AutoField/fields/ExternalField/index.tsx
|
3249
3262
|
init_react_import();
|
3250
|
-
var
|
3263
|
+
var import_react19 = require("react");
|
3251
3264
|
|
3252
3265
|
// components/ExternalInput/index.tsx
|
3253
3266
|
init_react_import();
|
3254
|
-
var
|
3267
|
+
var import_react18 = require("react");
|
3255
3268
|
|
3256
3269
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
3257
3270
|
init_react_import();
|
@@ -3259,7 +3272,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
|
|
3259
3272
|
|
3260
3273
|
// components/Modal/index.tsx
|
3261
3274
|
init_react_import();
|
3262
|
-
var
|
3275
|
+
var import_react16 = require("react");
|
3263
3276
|
|
3264
3277
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
3265
3278
|
init_react_import();
|
@@ -3274,8 +3287,8 @@ var Modal = ({
|
|
3274
3287
|
onClose,
|
3275
3288
|
isOpen
|
3276
3289
|
}) => {
|
3277
|
-
const [rootEl, setRootEl] = (0,
|
3278
|
-
(0,
|
3290
|
+
const [rootEl, setRootEl] = (0, import_react16.useState)(null);
|
3291
|
+
(0, import_react16.useEffect)(() => {
|
3279
3292
|
setRootEl(document.getElementById("puck-portal-root"));
|
3280
3293
|
}, []);
|
3281
3294
|
if (!rootEl) {
|
@@ -3322,7 +3335,7 @@ init_react_import();
|
|
3322
3335
|
|
3323
3336
|
// components/Button/Button.tsx
|
3324
3337
|
init_react_import();
|
3325
|
-
var
|
3338
|
+
var import_react17 = require("react");
|
3326
3339
|
|
3327
3340
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
3328
3341
|
init_react_import();
|
@@ -3372,8 +3385,8 @@ var Button = (_a) => {
|
|
3372
3385
|
"size",
|
3373
3386
|
"loading"
|
3374
3387
|
]);
|
3375
|
-
const [loading, setLoading] = (0,
|
3376
|
-
(0,
|
3388
|
+
const [loading, setLoading] = (0, import_react17.useState)(loadingProp);
|
3389
|
+
(0, import_react17.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
3377
3390
|
const ElementType = href ? "a" : type ? "button" : "span";
|
3378
3391
|
const dataAttrs = filterDataAttrs(props);
|
3379
3392
|
const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
@@ -3428,28 +3441,28 @@ var ExternalInput = ({
|
|
3428
3441
|
mapRow = (val) => val,
|
3429
3442
|
filterFields
|
3430
3443
|
} = field || {};
|
3431
|
-
const [data, setData] = (0,
|
3432
|
-
const [isOpen, setOpen] = (0,
|
3433
|
-
const [isLoading, setIsLoading] = (0,
|
3444
|
+
const [data, setData] = (0, import_react18.useState)([]);
|
3445
|
+
const [isOpen, setOpen] = (0, import_react18.useState)(false);
|
3446
|
+
const [isLoading, setIsLoading] = (0, import_react18.useState)(true);
|
3434
3447
|
const hasFilterFields = !!filterFields;
|
3435
|
-
const [filters, setFilters] = (0,
|
3436
|
-
const [filtersToggled, setFiltersToggled] = (0,
|
3437
|
-
const mappedData = (0,
|
3448
|
+
const [filters, setFilters] = (0, import_react18.useState)(field.initialFilters || {});
|
3449
|
+
const [filtersToggled, setFiltersToggled] = (0, import_react18.useState)(hasFilterFields);
|
3450
|
+
const mappedData = (0, import_react18.useMemo)(() => {
|
3438
3451
|
return data.map(mapRow);
|
3439
3452
|
}, [data]);
|
3440
|
-
const keys = (0,
|
3453
|
+
const keys = (0, import_react18.useMemo)(() => {
|
3441
3454
|
const validKeys = /* @__PURE__ */ new Set();
|
3442
3455
|
for (const item of mappedData) {
|
3443
3456
|
for (const key of Object.keys(item)) {
|
3444
|
-
if (typeof item[key] === "string" || typeof item[key] === "number" || (0,
|
3457
|
+
if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react18.isValidElement)(item[key])) {
|
3445
3458
|
validKeys.add(key);
|
3446
3459
|
}
|
3447
3460
|
}
|
3448
3461
|
}
|
3449
3462
|
return Array.from(validKeys);
|
3450
3463
|
}, [mappedData]);
|
3451
|
-
const [searchQuery, setSearchQuery] = (0,
|
3452
|
-
const search = (0,
|
3464
|
+
const [searchQuery, setSearchQuery] = (0, import_react18.useState)(field.initialQuery || "");
|
3465
|
+
const search = (0, import_react18.useCallback)(
|
3453
3466
|
(query, filters2) => __async(void 0, null, function* () {
|
3454
3467
|
setIsLoading(true);
|
3455
3468
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
@@ -3462,7 +3475,7 @@ var ExternalInput = ({
|
|
3462
3475
|
}),
|
3463
3476
|
[id, field]
|
3464
3477
|
);
|
3465
|
-
const Footer = (0,
|
3478
|
+
const Footer = (0, import_react18.useCallback)(
|
3466
3479
|
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: getClassNameModal("footer"), children: [
|
3467
3480
|
props.items.length,
|
3468
3481
|
" result",
|
@@ -3470,7 +3483,7 @@ var ExternalInput = ({
|
|
3470
3483
|
] }),
|
3471
3484
|
[field.renderFooter]
|
3472
3485
|
);
|
3473
|
-
(0,
|
3486
|
+
(0, import_react18.useEffect)(() => {
|
3474
3487
|
search(searchQuery, filters);
|
3475
3488
|
}, []);
|
3476
3489
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
@@ -3634,6 +3647,7 @@ var ExternalField = ({
|
|
3634
3647
|
value,
|
3635
3648
|
name,
|
3636
3649
|
label,
|
3650
|
+
labelIcon,
|
3637
3651
|
Label: Label2,
|
3638
3652
|
id,
|
3639
3653
|
readOnly
|
@@ -3641,7 +3655,7 @@ var ExternalField = ({
|
|
3641
3655
|
var _a, _b, _c;
|
3642
3656
|
const validField = field;
|
3643
3657
|
const deprecatedField = field;
|
3644
|
-
(0,
|
3658
|
+
(0, import_react19.useEffect)(() => {
|
3645
3659
|
if (deprecatedField.adaptor) {
|
3646
3660
|
console.error(
|
3647
3661
|
"Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
|
@@ -3651,32 +3665,40 @@ var ExternalField = ({
|
|
3651
3665
|
if (field.type !== "external") {
|
3652
3666
|
return null;
|
3653
3667
|
}
|
3654
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3655
|
-
|
3668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3669
|
+
Label2,
|
3656
3670
|
{
|
3657
|
-
name,
|
3658
|
-
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
|
3663
|
-
|
3664
|
-
|
3665
|
-
|
3666
|
-
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
|
3671
|
+
label: label || name,
|
3672
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: 16 }),
|
3673
|
+
el: "div",
|
3674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3675
|
+
ExternalInput,
|
3676
|
+
{
|
3677
|
+
name,
|
3678
|
+
field: __spreadProps(__spreadValues({}, validField), {
|
3679
|
+
// DEPRECATED
|
3680
|
+
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
3681
|
+
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
3682
|
+
mapRow: validField.mapRow,
|
3683
|
+
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
3684
|
+
return yield deprecatedField.adaptor.fetchList(
|
3685
|
+
deprecatedField.adaptorParams
|
3686
|
+
);
|
3687
|
+
}) : validField.fetchList
|
3688
|
+
}),
|
3689
|
+
onChange,
|
3690
|
+
value,
|
3691
|
+
id,
|
3692
|
+
readOnly
|
3693
|
+
}
|
3694
|
+
)
|
3673
3695
|
}
|
3674
|
-
)
|
3696
|
+
);
|
3675
3697
|
};
|
3676
3698
|
|
3677
3699
|
// components/AutoField/fields/RadioField/index.tsx
|
3678
3700
|
init_react_import();
|
3679
|
-
var
|
3701
|
+
var import_react20 = require("react");
|
3680
3702
|
|
3681
3703
|
// lib/safe-json-parse.ts
|
3682
3704
|
init_react_import();
|
@@ -3700,9 +3722,10 @@ var RadioField = ({
|
|
3700
3722
|
name,
|
3701
3723
|
id,
|
3702
3724
|
label,
|
3725
|
+
labelIcon,
|
3703
3726
|
Label: Label2
|
3704
3727
|
}) => {
|
3705
|
-
const flatOptions = (0,
|
3728
|
+
const flatOptions = (0, import_react20.useMemo)(
|
3706
3729
|
() => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
|
3707
3730
|
[field]
|
3708
3731
|
);
|
@@ -3712,7 +3735,7 @@ var RadioField = ({
|
|
3712
3735
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
3713
3736
|
Label2,
|
3714
3737
|
{
|
3715
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
|
3738
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
|
3716
3739
|
label: label || name,
|
3717
3740
|
readOnly,
|
3718
3741
|
el: "div",
|
@@ -3752,20 +3775,21 @@ var RadioField = ({
|
|
3752
3775
|
|
3753
3776
|
// components/AutoField/fields/SelectField/index.tsx
|
3754
3777
|
init_react_import();
|
3755
|
-
var
|
3778
|
+
var import_react21 = require("react");
|
3756
3779
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
3757
3780
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
3758
3781
|
var SelectField = ({
|
3759
3782
|
field,
|
3760
3783
|
onChange,
|
3761
3784
|
label,
|
3785
|
+
labelIcon,
|
3762
3786
|
Label: Label2,
|
3763
3787
|
value,
|
3764
3788
|
name,
|
3765
3789
|
readOnly,
|
3766
3790
|
id
|
3767
3791
|
}) => {
|
3768
|
-
const flatOptions = (0,
|
3792
|
+
const flatOptions = (0, import_react21.useMemo)(
|
3769
3793
|
() => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
|
3770
3794
|
[field]
|
3771
3795
|
);
|
@@ -3776,7 +3800,7 @@ var SelectField = ({
|
|
3776
3800
|
Label2,
|
3777
3801
|
{
|
3778
3802
|
label: label || name,
|
3779
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
|
3803
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
|
3780
3804
|
readOnly,
|
3781
3805
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
3782
3806
|
"select",
|
@@ -3820,24 +3844,33 @@ var TextareaField = ({
|
|
3820
3844
|
value,
|
3821
3845
|
name,
|
3822
3846
|
label,
|
3847
|
+
labelIcon,
|
3823
3848
|
Label: Label2,
|
3824
3849
|
id
|
3825
3850
|
}) => {
|
3826
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
3827
|
-
|
3851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
3852
|
+
Label2,
|
3828
3853
|
{
|
3829
|
-
|
3830
|
-
|
3831
|
-
autoComplete: "off",
|
3832
|
-
name,
|
3833
|
-
value: typeof value === "undefined" ? "" : value,
|
3834
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
3854
|
+
label: label || name,
|
3855
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
|
3835
3856
|
readOnly,
|
3836
|
-
|
3837
|
-
|
3838
|
-
|
3857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
3858
|
+
"textarea",
|
3859
|
+
{
|
3860
|
+
id,
|
3861
|
+
className: getClassName13("input"),
|
3862
|
+
autoComplete: "off",
|
3863
|
+
name,
|
3864
|
+
value: typeof value === "undefined" ? "" : value,
|
3865
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
3866
|
+
readOnly,
|
3867
|
+
tabIndex: readOnly ? -1 : void 0,
|
3868
|
+
rows: 5,
|
3869
|
+
placeholder: field.type === "textarea" ? field.placeholder : void 0
|
3870
|
+
}
|
3871
|
+
)
|
3839
3872
|
}
|
3840
|
-
)
|
3873
|
+
);
|
3841
3874
|
};
|
3842
3875
|
|
3843
3876
|
// components/AutoField/fields/ObjectField/index.tsx
|
@@ -3856,6 +3889,7 @@ var ObjectField = ({
|
|
3856
3889
|
value,
|
3857
3890
|
name,
|
3858
3891
|
label,
|
3892
|
+
labelIcon,
|
3859
3893
|
Label: Label2,
|
3860
3894
|
readOnly,
|
3861
3895
|
id
|
@@ -3869,7 +3903,7 @@ var ObjectField = ({
|
|
3869
3903
|
Label2,
|
3870
3904
|
{
|
3871
3905
|
label: label || name,
|
3872
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
|
3906
|
+
icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
|
3873
3907
|
el: "div",
|
3874
3908
|
readOnly,
|
3875
3909
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
@@ -3916,12 +3950,12 @@ var ObjectField = ({
|
|
3916
3950
|
|
3917
3951
|
// lib/use-safe-id.ts
|
3918
3952
|
init_react_import();
|
3919
|
-
var
|
3953
|
+
var import_react22 = __toESM(require("react"));
|
3920
3954
|
var useSafeId = () => {
|
3921
|
-
if (typeof
|
3922
|
-
return
|
3955
|
+
if (typeof import_react22.default.useId !== "undefined") {
|
3956
|
+
return import_react22.default.useId();
|
3923
3957
|
}
|
3924
|
-
const [id] = (0,
|
3958
|
+
const [id] = (0, import_react22.useState)(generateId());
|
3925
3959
|
return id;
|
3926
3960
|
};
|
3927
3961
|
|
@@ -3955,7 +3989,7 @@ var FieldLabelInternal = ({
|
|
3955
3989
|
readOnly
|
3956
3990
|
}) => {
|
3957
3991
|
const overrides = useAppStore((s) => s.overrides);
|
3958
|
-
const Wrapper = (0,
|
3992
|
+
const Wrapper = (0, import_react23.useMemo)(
|
3959
3993
|
() => overrides.fieldLabel || FieldLabel,
|
3960
3994
|
[overrides]
|
3961
3995
|
);
|
@@ -3982,10 +4016,11 @@ function AutoFieldInternal(props) {
|
|
3982
4016
|
var _a2;
|
3983
4017
|
return (_a2 = s.selectedItem) == null ? void 0 : _a2.readOnly;
|
3984
4018
|
});
|
3985
|
-
const nestedFieldContext = (0,
|
4019
|
+
const nestedFieldContext = (0, import_react23.useContext)(NestedFieldContext);
|
3986
4020
|
const { id, Label: Label2 = FieldLabelInternal } = props;
|
3987
4021
|
const field = props.field;
|
3988
4022
|
const label = field.label;
|
4023
|
+
const labelIcon = field.labelIcon;
|
3989
4024
|
const defaultId = useSafeId();
|
3990
4025
|
const resolvedId = id || defaultId;
|
3991
4026
|
const defaultFields = {
|
@@ -4011,10 +4046,11 @@ function AutoFieldInternal(props) {
|
|
4011
4046
|
const mergedProps = __spreadProps(__spreadValues({}, props), {
|
4012
4047
|
field,
|
4013
4048
|
label,
|
4049
|
+
labelIcon,
|
4014
4050
|
Label: Label2,
|
4015
4051
|
id: resolvedId
|
4016
4052
|
});
|
4017
|
-
const onFocus = (0,
|
4053
|
+
const onFocus = (0, import_react23.useCallback)(
|
4018
4054
|
(e) => {
|
4019
4055
|
if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
|
4020
4056
|
e.stopPropagation();
|
@@ -4028,7 +4064,7 @@ function AutoFieldInternal(props) {
|
|
4028
4064
|
},
|
4029
4065
|
[mergedProps.name]
|
4030
4066
|
);
|
4031
|
-
const onBlur = (0,
|
4067
|
+
const onBlur = (0, import_react23.useCallback)((e) => {
|
4032
4068
|
if ("name" in e.target) {
|
4033
4069
|
dispatch({
|
4034
4070
|
type: "setUi",
|
@@ -4072,12 +4108,15 @@ function AutoFieldInternal(props) {
|
|
4072
4108
|
function AutoFieldPrivate(props) {
|
4073
4109
|
const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
|
4074
4110
|
const { value, onChange } = props;
|
4075
|
-
const [localValue, setLocalValue] = (0,
|
4076
|
-
const onChangeLocal = (0,
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4111
|
+
const [localValue, setLocalValue] = (0, import_react23.useState)(value);
|
4112
|
+
const onChangeLocal = (0, import_react23.useCallback)(
|
4113
|
+
(val, ui) => {
|
4114
|
+
setLocalValue(val);
|
4115
|
+
onChange(val, ui);
|
4116
|
+
},
|
4117
|
+
[onChange]
|
4118
|
+
);
|
4119
|
+
(0, import_react23.useEffect)(() => {
|
4081
4120
|
if (!isFocused) {
|
4082
4121
|
setLocalValue(value);
|
4083
4122
|
}
|
@@ -4089,7 +4128,7 @@ function AutoFieldPrivate(props) {
|
|
4089
4128
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
4090
4129
|
}
|
4091
4130
|
function AutoField(props) {
|
4092
|
-
const DefaultLabel = (0,
|
4131
|
+
const DefaultLabel = (0, import_react23.useMemo)(() => {
|
4093
4132
|
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
4094
4133
|
"div",
|
4095
4134
|
__spreadProps(__spreadValues({}, labelProps), {
|
@@ -4109,21 +4148,21 @@ init_react_import();
|
|
4109
4148
|
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" };
|
4110
4149
|
|
4111
4150
|
// components/Drawer/index.tsx
|
4112
|
-
var
|
4151
|
+
var import_react36 = require("react");
|
4113
4152
|
|
4114
4153
|
// components/DragDropContext/index.tsx
|
4115
4154
|
init_react_import();
|
4116
|
-
var
|
4117
|
-
var
|
4155
|
+
var import_react34 = require("@dnd-kit/react");
|
4156
|
+
var import_react35 = require("react");
|
4118
4157
|
var import_dom = require("@dnd-kit/dom");
|
4119
4158
|
|
4120
4159
|
// components/DropZone/index.tsx
|
4121
4160
|
init_react_import();
|
4122
|
-
var
|
4161
|
+
var import_react33 = require("react");
|
4123
4162
|
|
4124
4163
|
// components/DraggableComponent/index.tsx
|
4125
4164
|
init_react_import();
|
4126
|
-
var
|
4165
|
+
var import_react26 = require("react");
|
4127
4166
|
|
4128
4167
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
4129
4168
|
init_react_import();
|
@@ -4153,11 +4192,11 @@ function getDeepScrollPosition(element) {
|
|
4153
4192
|
|
4154
4193
|
// components/DropZone/context.tsx
|
4155
4194
|
init_react_import();
|
4156
|
-
var
|
4195
|
+
var import_react24 = require("react");
|
4157
4196
|
var import_zustand3 = require("zustand");
|
4158
4197
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
4159
|
-
var dropZoneContext = (0,
|
4160
|
-
var ZoneStoreContext = (0,
|
4198
|
+
var dropZoneContext = (0, import_react24.createContext)(null);
|
4199
|
+
var ZoneStoreContext = (0, import_react24.createContext)(
|
4161
4200
|
(0, import_zustand3.createStore)(() => ({
|
4162
4201
|
zoneDepthIndex: {},
|
4163
4202
|
nextZoneDepthIndex: {},
|
@@ -4177,10 +4216,10 @@ var DropZoneProvider = ({
|
|
4177
4216
|
children,
|
4178
4217
|
value
|
4179
4218
|
}) => {
|
4180
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
4181
|
-
const [activeZones, setActiveZones] = (0,
|
4219
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react24.useState)();
|
4220
|
+
const [activeZones, setActiveZones] = (0, import_react24.useState)({});
|
4182
4221
|
const dispatch = useAppStore((s) => s.dispatch);
|
4183
|
-
const registerZone = (0,
|
4222
|
+
const registerZone = (0, import_react24.useCallback)(
|
4184
4223
|
(zoneCompound) => {
|
4185
4224
|
if (!dispatch) {
|
4186
4225
|
return;
|
@@ -4193,7 +4232,7 @@ var DropZoneProvider = ({
|
|
4193
4232
|
},
|
4194
4233
|
[setActiveZones, dispatch]
|
4195
4234
|
);
|
4196
|
-
const unregisterZone = (0,
|
4235
|
+
const unregisterZone = (0, import_react24.useCallback)(
|
4197
4236
|
(zoneCompound) => {
|
4198
4237
|
if (!dispatch) {
|
4199
4238
|
return;
|
@@ -4208,7 +4247,7 @@ var DropZoneProvider = ({
|
|
4208
4247
|
},
|
4209
4248
|
[setActiveZones, dispatch]
|
4210
4249
|
);
|
4211
|
-
const memoValue = (0,
|
4250
|
+
const memoValue = (0, import_react24.useMemo)(
|
4212
4251
|
() => __spreadValues({
|
4213
4252
|
hoveringComponent,
|
4214
4253
|
setHoveringComponent,
|
@@ -4223,11 +4262,11 @@ var DropZoneProvider = ({
|
|
4223
4262
|
|
4224
4263
|
// lib/use-context-store.ts
|
4225
4264
|
init_react_import();
|
4226
|
-
var
|
4265
|
+
var import_react25 = require("react");
|
4227
4266
|
var import_zustand4 = require("zustand");
|
4228
4267
|
var import_shallow = require("zustand/react/shallow");
|
4229
4268
|
function useContextStore(context, selector) {
|
4230
|
-
const store = (0,
|
4269
|
+
const store = (0, import_react25.useContext)(context);
|
4231
4270
|
if (!store) {
|
4232
4271
|
throw new Error("useContextStore must be used inside context");
|
4233
4272
|
}
|
@@ -4285,9 +4324,9 @@ var DraggableComponent = ({
|
|
4285
4324
|
);
|
4286
4325
|
const dispatch = useAppStore((s) => s.dispatch);
|
4287
4326
|
const iframe = useAppStore((s) => s.iframe);
|
4288
|
-
const ctx = (0,
|
4289
|
-
const [localZones, setLocalZones] = (0,
|
4290
|
-
const registerLocalZone = (0,
|
4327
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
4328
|
+
const [localZones, setLocalZones] = (0, import_react26.useState)({});
|
4329
|
+
const registerLocalZone = (0, import_react26.useCallback)(
|
4291
4330
|
(zoneCompound2, active) => {
|
4292
4331
|
var _a;
|
4293
4332
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
@@ -4297,7 +4336,7 @@ var DraggableComponent = ({
|
|
4297
4336
|
},
|
4298
4337
|
[setLocalZones]
|
4299
4338
|
);
|
4300
|
-
const unregisterLocalZone = (0,
|
4339
|
+
const unregisterLocalZone = (0, import_react26.useCallback)(
|
4301
4340
|
(zoneCompound2) => {
|
4302
4341
|
var _a;
|
4303
4342
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
@@ -4327,7 +4366,7 @@ var DraggableComponent = ({
|
|
4327
4366
|
);
|
4328
4367
|
const canCollide = permissions.drag || userIsDragging;
|
4329
4368
|
const disabled = !isEnabled || !canCollide;
|
4330
|
-
const [dragAxis, setDragAxis] = (0,
|
4369
|
+
const [dragAxis, setDragAxis] = (0, import_react26.useState)(userDragAxis || autoDragAxis);
|
4331
4370
|
const { ref: sortableRef, status } = useSortableSafe({
|
4332
4371
|
id,
|
4333
4372
|
index,
|
@@ -4353,8 +4392,8 @@ var DraggableComponent = ({
|
|
4353
4392
|
}
|
4354
4393
|
});
|
4355
4394
|
const thisIsDragging = status === "dragging";
|
4356
|
-
const ref = (0,
|
4357
|
-
const refSetter = (0,
|
4395
|
+
const ref = (0, import_react26.useRef)(null);
|
4396
|
+
const refSetter = (0, import_react26.useCallback)(
|
4358
4397
|
(el) => {
|
4359
4398
|
sortableRef(el);
|
4360
4399
|
if (el) {
|
@@ -4363,14 +4402,14 @@ var DraggableComponent = ({
|
|
4363
4402
|
},
|
4364
4403
|
[sortableRef]
|
4365
4404
|
);
|
4366
|
-
const [portalEl, setPortalEl] = (0,
|
4367
|
-
(0,
|
4405
|
+
const [portalEl, setPortalEl] = (0, import_react26.useState)();
|
4406
|
+
(0, import_react26.useEffect)(() => {
|
4368
4407
|
var _a, _b, _c;
|
4369
4408
|
setPortalEl(
|
4370
4409
|
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
|
4371
4410
|
);
|
4372
4411
|
}, [iframe.enabled, ref.current]);
|
4373
|
-
const getStyle = (0,
|
4412
|
+
const getStyle = (0, import_react26.useCallback)(() => {
|
4374
4413
|
var _a, _b, _c;
|
4375
4414
|
if (!ref.current) return;
|
4376
4415
|
const rect = ref.current.getBoundingClientRect();
|
@@ -4390,11 +4429,11 @@ var DraggableComponent = ({
|
|
4390
4429
|
};
|
4391
4430
|
return style2;
|
4392
4431
|
}, [ref.current]);
|
4393
|
-
const [style, setStyle] = (0,
|
4394
|
-
const sync = (0,
|
4432
|
+
const [style, setStyle] = (0, import_react26.useState)();
|
4433
|
+
const sync = (0, import_react26.useCallback)(() => {
|
4395
4434
|
setStyle(getStyle());
|
4396
4435
|
}, [ref.current, iframe]);
|
4397
|
-
(0,
|
4436
|
+
(0, import_react26.useEffect)(() => {
|
4398
4437
|
if (ref.current && !userIsDragging) {
|
4399
4438
|
const observer = new ResizeObserver(sync);
|
4400
4439
|
observer.observe(ref.current);
|
@@ -4404,18 +4443,18 @@ var DraggableComponent = ({
|
|
4404
4443
|
}
|
4405
4444
|
}, [ref.current, userIsDragging]);
|
4406
4445
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
4407
|
-
(0,
|
4446
|
+
(0, import_react26.useEffect)(() => {
|
4408
4447
|
var _a;
|
4409
4448
|
registerNode(id, { methods: { sync }, element: (_a = ref.current) != null ? _a : null });
|
4410
4449
|
return () => {
|
4411
4450
|
registerNode(id, { methods: { sync: () => null }, element: null });
|
4412
4451
|
};
|
4413
4452
|
}, [id, zoneCompound, index, componentType, sync]);
|
4414
|
-
const CustomActionBar = (0,
|
4453
|
+
const CustomActionBar = (0, import_react26.useMemo)(
|
4415
4454
|
() => overrides.actionBar || DefaultActionBar,
|
4416
4455
|
[overrides.actionBar]
|
4417
4456
|
);
|
4418
|
-
const onClick = (0,
|
4457
|
+
const onClick = (0, import_react26.useCallback)(
|
4419
4458
|
(e) => {
|
4420
4459
|
e.stopPropagation();
|
4421
4460
|
dispatch({
|
@@ -4428,7 +4467,7 @@ var DraggableComponent = ({
|
|
4428
4467
|
[index, zoneCompound, id]
|
4429
4468
|
);
|
4430
4469
|
const appStore = useAppStoreApi();
|
4431
|
-
const onSelectParent = (0,
|
4470
|
+
const onSelectParent = (0, import_react26.useCallback)(() => {
|
4432
4471
|
const { nodes } = appStore.getState().nodes;
|
4433
4472
|
const node = nodes[id];
|
4434
4473
|
const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
|
@@ -4445,23 +4484,23 @@ var DraggableComponent = ({
|
|
4445
4484
|
}
|
4446
4485
|
});
|
4447
4486
|
}, [ctx, path]);
|
4448
|
-
const onDuplicate = (0,
|
4487
|
+
const onDuplicate = (0, import_react26.useCallback)(() => {
|
4449
4488
|
dispatch({
|
4450
4489
|
type: "duplicate",
|
4451
4490
|
sourceIndex: index,
|
4452
4491
|
sourceZone: zoneCompound
|
4453
4492
|
});
|
4454
4493
|
}, [index, zoneCompound]);
|
4455
|
-
const onDelete = (0,
|
4494
|
+
const onDelete = (0, import_react26.useCallback)(() => {
|
4456
4495
|
dispatch({
|
4457
4496
|
type: "remove",
|
4458
4497
|
index,
|
4459
4498
|
zone: zoneCompound
|
4460
4499
|
});
|
4461
4500
|
}, [index, zoneCompound]);
|
4462
|
-
const [hover, setHover] = (0,
|
4501
|
+
const [hover, setHover] = (0, import_react26.useState)(false);
|
4463
4502
|
const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
|
4464
|
-
(0,
|
4503
|
+
(0, import_react26.useEffect)(() => {
|
4465
4504
|
if (!ref.current) {
|
4466
4505
|
return;
|
4467
4506
|
}
|
@@ -4511,7 +4550,7 @@ var DraggableComponent = ({
|
|
4511
4550
|
thisIsDragging,
|
4512
4551
|
inDroppableZone
|
4513
4552
|
]);
|
4514
|
-
(0,
|
4553
|
+
(0, import_react26.useEffect)(() => {
|
4515
4554
|
if (ref.current && disabled) {
|
4516
4555
|
ref.current.setAttribute("data-puck-disabled", "");
|
4517
4556
|
return () => {
|
@@ -4520,8 +4559,8 @@ var DraggableComponent = ({
|
|
4520
4559
|
};
|
4521
4560
|
}
|
4522
4561
|
}, [disabled, ref]);
|
4523
|
-
const [isVisible, setIsVisible] = (0,
|
4524
|
-
(0,
|
4562
|
+
const [isVisible, setIsVisible] = (0, import_react26.useState)(false);
|
4563
|
+
(0, import_react26.useEffect)(() => {
|
4525
4564
|
sync();
|
4526
4565
|
if ((isSelected || hover || indicativeHover) && !userIsDragging) {
|
4527
4566
|
setIsVisible(true);
|
@@ -4529,7 +4568,7 @@ var DraggableComponent = ({
|
|
4529
4568
|
setIsVisible(false);
|
4530
4569
|
}
|
4531
4570
|
}, [isSelected, hover, indicativeHover, iframe, userIsDragging]);
|
4532
|
-
const syncActionsPosition = (0,
|
4571
|
+
const syncActionsPosition = (0, import_react26.useCallback)(
|
4533
4572
|
(el) => {
|
4534
4573
|
if (el) {
|
4535
4574
|
const view = el.ownerDocument.defaultView;
|
@@ -4537,16 +4576,24 @@ var DraggableComponent = ({
|
|
4537
4576
|
const rect = el.getBoundingClientRect();
|
4538
4577
|
const diffLeft = rect.x;
|
4539
4578
|
const exceedsBoundsLeft = diffLeft < 0;
|
4579
|
+
const diffTop = rect.y;
|
4580
|
+
const exceedsBoundsTop = diffTop < 0;
|
4540
4581
|
if (exceedsBoundsLeft) {
|
4541
4582
|
el.style.transformOrigin = "left top";
|
4542
4583
|
el.style.left = "0px";
|
4543
4584
|
}
|
4585
|
+
if (exceedsBoundsTop) {
|
4586
|
+
el.style.top = "12px";
|
4587
|
+
if (!exceedsBoundsLeft) {
|
4588
|
+
el.style.transformOrigin = "right top";
|
4589
|
+
}
|
4590
|
+
}
|
4544
4591
|
}
|
4545
4592
|
}
|
4546
4593
|
},
|
4547
4594
|
[zoom]
|
4548
4595
|
);
|
4549
|
-
(0,
|
4596
|
+
(0, import_react26.useEffect)(() => {
|
4550
4597
|
if (userDragAxis) {
|
4551
4598
|
setDragAxis(userDragAxis);
|
4552
4599
|
return;
|
@@ -4639,15 +4686,15 @@ var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isAc
|
|
4639
4686
|
|
4640
4687
|
// components/DropZone/lib/use-min-empty-height.ts
|
4641
4688
|
init_react_import();
|
4642
|
-
var
|
4689
|
+
var import_react27 = require("react");
|
4643
4690
|
var useMinEmptyHeight = ({
|
4644
4691
|
zoneCompound,
|
4645
4692
|
userMinEmptyHeight,
|
4646
4693
|
ref
|
4647
4694
|
}) => {
|
4648
4695
|
const appStore = useAppStoreApi();
|
4649
|
-
const [prevHeight, setPrevHeight] = (0,
|
4650
|
-
const [isAnimating, setIsAnimating] = (0,
|
4696
|
+
const [prevHeight, setPrevHeight] = (0, import_react27.useState)(0);
|
4697
|
+
const [isAnimating, setIsAnimating] = (0, import_react27.useState)(false);
|
4651
4698
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
4652
4699
|
var _a, _b;
|
4653
4700
|
return {
|
@@ -4655,7 +4702,7 @@ var useMinEmptyHeight = ({
|
|
4655
4702
|
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
4656
4703
|
};
|
4657
4704
|
});
|
4658
|
-
(0,
|
4705
|
+
(0, import_react27.useEffect)(() => {
|
4659
4706
|
if (draggedItem && ref.current) {
|
4660
4707
|
if (isZone) {
|
4661
4708
|
const rect = ref.current.getBoundingClientRect();
|
@@ -4693,15 +4740,15 @@ function assignRefs(refs, node) {
|
|
4693
4740
|
|
4694
4741
|
// components/DropZone/lib/use-content-with-preview.ts
|
4695
4742
|
init_react_import();
|
4696
|
-
var
|
4743
|
+
var import_react30 = require("react");
|
4697
4744
|
|
4698
4745
|
// lib/dnd/use-rendered-callback.ts
|
4699
4746
|
init_react_import();
|
4700
|
-
var
|
4701
|
-
var
|
4747
|
+
var import_react28 = require("@dnd-kit/react");
|
4748
|
+
var import_react29 = require("react");
|
4702
4749
|
function useRenderedCallback(callback, deps) {
|
4703
|
-
const manager = (0,
|
4704
|
-
return (0,
|
4750
|
+
const manager = (0, import_react28.useDragDropManager)();
|
4751
|
+
return (0, import_react29.useCallback)(
|
4705
4752
|
(...args) => __async(this, null, function* () {
|
4706
4753
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
4707
4754
|
return callback(...args);
|
@@ -4724,8 +4771,8 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4724
4771
|
}
|
4725
4772
|
);
|
4726
4773
|
const isDragging = useAppStore((s) => s.state.ui.isDragging);
|
4727
|
-
const [contentIdsWithPreview, setContentIdsWithPreview] = (0,
|
4728
|
-
const [localPreview, setLocalPreview] = (0,
|
4774
|
+
const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react30.useState)(contentIds);
|
4775
|
+
const [localPreview, setLocalPreview] = (0, import_react30.useState)(
|
4729
4776
|
preview
|
4730
4777
|
);
|
4731
4778
|
const updateContent = useRenderedCallback(
|
@@ -4760,7 +4807,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4760
4807
|
},
|
4761
4808
|
[draggedItemId, previewExists]
|
4762
4809
|
);
|
4763
|
-
(0,
|
4810
|
+
(0, import_react30.useEffect)(() => {
|
4764
4811
|
updateContent(contentIds, preview, isDragging);
|
4765
4812
|
}, [contentIds, preview, isDragging]);
|
4766
4813
|
return [contentIdsWithPreview, localPreview];
|
@@ -4768,16 +4815,16 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
4768
4815
|
|
4769
4816
|
// components/DropZone/lib/use-drag-axis.ts
|
4770
4817
|
init_react_import();
|
4771
|
-
var
|
4818
|
+
var import_react31 = require("react");
|
4772
4819
|
var GRID_DRAG_AXIS = "dynamic";
|
4773
4820
|
var FLEX_ROW_DRAG_AXIS = "x";
|
4774
4821
|
var DEFAULT_DRAG_AXIS = "y";
|
4775
4822
|
var useDragAxis = (ref, collisionAxis) => {
|
4776
4823
|
const status = useAppStore((s) => s.status);
|
4777
|
-
const [dragAxis, setDragAxis] = (0,
|
4824
|
+
const [dragAxis, setDragAxis] = (0, import_react31.useState)(
|
4778
4825
|
collisionAxis || DEFAULT_DRAG_AXIS
|
4779
4826
|
);
|
4780
|
-
const calculateDragAxis = (0,
|
4827
|
+
const calculateDragAxis = (0, import_react31.useCallback)(() => {
|
4781
4828
|
if (ref.current) {
|
4782
4829
|
const computedStyle = window.getComputedStyle(ref.current);
|
4783
4830
|
if (computedStyle.display === "grid") {
|
@@ -4789,7 +4836,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
4789
4836
|
}
|
4790
4837
|
}
|
4791
4838
|
}, [ref.current]);
|
4792
|
-
(0,
|
4839
|
+
(0, import_react31.useEffect)(() => {
|
4793
4840
|
const onViewportChange = () => {
|
4794
4841
|
calculateDragAxis();
|
4795
4842
|
};
|
@@ -4798,7 +4845,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
4798
4845
|
window.removeEventListener("viewportchange", onViewportChange);
|
4799
4846
|
};
|
4800
4847
|
}, []);
|
4801
|
-
(0,
|
4848
|
+
(0, import_react31.useEffect)(calculateDragAxis, [status, collisionAxis]);
|
4802
4849
|
return [dragAxis, calculateDragAxis];
|
4803
4850
|
};
|
4804
4851
|
|
@@ -4807,9 +4854,9 @@ var import_shallow3 = require("zustand/react/shallow");
|
|
4807
4854
|
|
4808
4855
|
// components/Render/index.tsx
|
4809
4856
|
init_react_import();
|
4810
|
-
var
|
4857
|
+
var import_react32 = __toESM(require("react"));
|
4811
4858
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
4812
|
-
var renderContext =
|
4859
|
+
var renderContext = import_react32.default.createContext({
|
4813
4860
|
config: { components: {} },
|
4814
4861
|
data: { root: {}, content: [] },
|
4815
4862
|
metadata: {}
|
@@ -4888,7 +4935,7 @@ var DropZoneChild = ({
|
|
4888
4935
|
dragRef: null,
|
4889
4936
|
metadata
|
4890
4937
|
};
|
4891
|
-
const ctx = (0,
|
4938
|
+
const ctx = (0, import_react33.useContext)(dropZoneContext);
|
4892
4939
|
const { depth } = ctx;
|
4893
4940
|
const contentItem = useAppStore(
|
4894
4941
|
(0, import_shallow3.useShallow)((s) => {
|
@@ -4917,7 +4964,7 @@ var DropZoneChild = ({
|
|
4917
4964
|
}
|
4918
4965
|
);
|
4919
4966
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
4920
|
-
const renderPreview = (0,
|
4967
|
+
const renderPreview = (0, import_react33.useMemo)(
|
4921
4968
|
() => function Preview4() {
|
4922
4969
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: overrides.componentItem });
|
4923
4970
|
},
|
@@ -4964,7 +5011,7 @@ var DropZoneChild = ({
|
|
4964
5011
|
}
|
4965
5012
|
);
|
4966
5013
|
};
|
4967
|
-
var DropZoneEdit = (0,
|
5014
|
+
var DropZoneEdit = (0, import_react33.forwardRef)(
|
4968
5015
|
function DropZoneEditInternal({
|
4969
5016
|
zone,
|
4970
5017
|
allow,
|
@@ -4974,7 +5021,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
4974
5021
|
minEmptyHeight: userMinEmptyHeight = 128,
|
4975
5022
|
collisionAxis
|
4976
5023
|
}, userRef) {
|
4977
|
-
const ctx = (0,
|
5024
|
+
const ctx = (0, import_react33.useContext)(dropZoneContext);
|
4978
5025
|
const {
|
4979
5026
|
// These all need setting via context
|
4980
5027
|
areaId,
|
@@ -5011,7 +5058,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5011
5058
|
userIsDragging: !!s.draggedItem
|
5012
5059
|
};
|
5013
5060
|
});
|
5014
|
-
(0,
|
5061
|
+
(0, import_react33.useEffect)(() => {
|
5015
5062
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
5016
5063
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
5017
5064
|
}
|
@@ -5030,8 +5077,8 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5030
5077
|
return content.map(({ props }) => props.id);
|
5031
5078
|
})
|
5032
5079
|
);
|
5033
|
-
const ref = (0,
|
5034
|
-
const acceptsTarget = (0,
|
5080
|
+
const ref = (0, import_react33.useRef)(null);
|
5081
|
+
const acceptsTarget = (0, import_react33.useCallback)(
|
5035
5082
|
(componentType) => {
|
5036
5083
|
if (!componentType) {
|
5037
5084
|
return true;
|
@@ -5053,7 +5100,7 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5053
5100
|
},
|
5054
5101
|
[allow, disallow]
|
5055
5102
|
);
|
5056
|
-
(0,
|
5103
|
+
(0, import_react33.useEffect)(() => {
|
5057
5104
|
if (registerLocalZone) {
|
5058
5105
|
registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
|
5059
5106
|
}
|
@@ -5143,14 +5190,14 @@ var DropZoneEdit = (0, import_react34.forwardRef)(
|
|
5143
5190
|
}
|
5144
5191
|
);
|
5145
5192
|
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadValues({}, props));
|
5146
|
-
var DropZoneRender = (0,
|
5193
|
+
var DropZoneRender = (0, import_react33.forwardRef)(
|
5147
5194
|
function DropZoneRenderInternal({ className, style, zone }, ref) {
|
5148
|
-
const ctx = (0,
|
5195
|
+
const ctx = (0, import_react33.useContext)(dropZoneContext);
|
5149
5196
|
const { areaId = "root" } = ctx || {};
|
5150
|
-
const { config, data, metadata } = (0,
|
5197
|
+
const { config, data, metadata } = (0, import_react33.useContext)(renderContext);
|
5151
5198
|
let zoneCompound = rootDroppableId;
|
5152
5199
|
let content = (data == null ? void 0 : data.content) || [];
|
5153
|
-
(0,
|
5200
|
+
(0, import_react33.useEffect)(() => {
|
5154
5201
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
5155
5202
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
5156
5203
|
}
|
@@ -5195,9 +5242,9 @@ var DropZoneRender = (0, import_react34.forwardRef)(
|
|
5195
5242
|
}
|
5196
5243
|
);
|
5197
5244
|
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, __spreadValues({}, props));
|
5198
|
-
var DropZone = (0,
|
5245
|
+
var DropZone = (0, import_react33.forwardRef)(
|
5199
5246
|
function DropZone2(props, ref) {
|
5200
|
-
const ctx = (0,
|
5247
|
+
const ctx = (0, import_react33.useContext)(dropZoneContext);
|
5201
5248
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
5202
5249
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
5203
5250
|
}
|
@@ -5517,12 +5564,12 @@ function getDeepDir(el) {
|
|
5517
5564
|
// components/DragDropContext/index.tsx
|
5518
5565
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
5519
5566
|
var DEBUG3 = false;
|
5520
|
-
var dragListenerContext = (0,
|
5567
|
+
var dragListenerContext = (0, import_react35.createContext)({
|
5521
5568
|
dragListeners: {}
|
5522
5569
|
});
|
5523
5570
|
function useDragListener(type, fn, deps = []) {
|
5524
|
-
const { setDragListeners } = (0,
|
5525
|
-
(0,
|
5571
|
+
const { setDragListeners } = (0, import_react35.useContext)(dragListenerContext);
|
5572
|
+
(0, import_react35.useEffect)(() => {
|
5526
5573
|
if (setDragListeners) {
|
5527
5574
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
5528
5575
|
[type]: [...old[type] || [], fn]
|
@@ -5532,8 +5579,8 @@ function useDragListener(type, fn, deps = []) {
|
|
5532
5579
|
}
|
5533
5580
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
5534
5581
|
var useTempDisableFallback = (timeout3) => {
|
5535
|
-
const lastFallbackDisable = (0,
|
5536
|
-
return (0,
|
5582
|
+
const lastFallbackDisable = (0, import_react35.useRef)(null);
|
5583
|
+
return (0, import_react35.useCallback)((manager) => {
|
5537
5584
|
collisionStore.setState({ fallbackEnabled: false });
|
5538
5585
|
const fallbackId = generateId();
|
5539
5586
|
lastFallbackDisable.current = fallbackId;
|
@@ -5554,10 +5601,10 @@ var DragDropContextClient = ({
|
|
5554
5601
|
const resolveData2 = useAppStore((s) => s.resolveData);
|
5555
5602
|
const metadata = useAppStore((s) => s.metadata);
|
5556
5603
|
const appStore = useAppStoreApi();
|
5557
|
-
const id = (
|
5558
|
-
const debouncedParamsRef = (0,
|
5604
|
+
const id = useSafeId();
|
5605
|
+
const debouncedParamsRef = (0, import_react35.useRef)(null);
|
5559
5606
|
const tempDisableFallback = useTempDisableFallback(100);
|
5560
|
-
const [zoneStore] = (0,
|
5607
|
+
const [zoneStore] = (0, import_react35.useState)(
|
5561
5608
|
() => (0, import_zustand5.createStore)(() => ({
|
5562
5609
|
zoneDepthIndex: {},
|
5563
5610
|
nextZoneDepthIndex: {},
|
@@ -5567,7 +5614,7 @@ var DragDropContextClient = ({
|
|
5567
5614
|
previewIndex: {}
|
5568
5615
|
}))
|
5569
5616
|
);
|
5570
|
-
const getChanged2 = (0,
|
5617
|
+
const getChanged2 = (0, import_react35.useCallback)(
|
5571
5618
|
(params, id2) => {
|
5572
5619
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
5573
5620
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
@@ -5588,7 +5635,7 @@ var DragDropContextClient = ({
|
|
5588
5635
|
},
|
5589
5636
|
[zoneStore]
|
5590
5637
|
);
|
5591
|
-
const setDeepestAndCollide = (0,
|
5638
|
+
const setDeepestAndCollide = (0, import_react35.useCallback)(
|
5592
5639
|
(params, manager) => {
|
5593
5640
|
const { zoneChanged, areaChanged } = getChanged2(params, id);
|
5594
5641
|
if (!zoneChanged && !areaChanged) return;
|
@@ -5612,7 +5659,7 @@ var DragDropContextClient = ({
|
|
5612
5659
|
setDeepestDb.cancel();
|
5613
5660
|
debouncedParamsRef.current = null;
|
5614
5661
|
};
|
5615
|
-
(0,
|
5662
|
+
(0, import_react35.useEffect)(() => {
|
5616
5663
|
if (DEBUG3) {
|
5617
5664
|
zoneStore.subscribe(
|
5618
5665
|
(s) => {
|
@@ -5626,7 +5673,7 @@ var DragDropContextClient = ({
|
|
5626
5673
|
);
|
5627
5674
|
}
|
5628
5675
|
}, []);
|
5629
|
-
const [plugins] = (0,
|
5676
|
+
const [plugins] = (0, import_react35.useState)(() => [
|
5630
5677
|
...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
|
5631
5678
|
createNestedDroppablePlugin(
|
5632
5679
|
{
|
@@ -5674,9 +5721,9 @@ var DragDropContextClient = ({
|
|
5674
5721
|
)
|
5675
5722
|
]);
|
5676
5723
|
const sensors = useSensors();
|
5677
|
-
const [dragListeners, setDragListeners] = (0,
|
5678
|
-
const dragMode = (0,
|
5679
|
-
const initialSelector = (0,
|
5724
|
+
const [dragListeners, setDragListeners] = (0, import_react35.useState)({});
|
5725
|
+
const dragMode = (0, import_react35.useRef)(null);
|
5726
|
+
const initialSelector = (0, import_react35.useRef)(void 0);
|
5680
5727
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
5681
5728
|
dragListenerContext.Provider,
|
5682
5729
|
{
|
@@ -5685,7 +5732,7 @@ var DragDropContextClient = ({
|
|
5685
5732
|
setDragListeners
|
5686
5733
|
},
|
5687
5734
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
5688
|
-
|
5735
|
+
import_react34.DragDropProvider,
|
5689
5736
|
{
|
5690
5737
|
plugins,
|
5691
5738
|
sensors,
|
@@ -5915,7 +5962,7 @@ var DrawerItemInner = ({
|
|
5915
5962
|
dragRef,
|
5916
5963
|
isDragDisabled
|
5917
5964
|
}) => {
|
5918
|
-
const CustomInner = (0,
|
5965
|
+
const CustomInner = (0, import_react36.useMemo)(
|
5919
5966
|
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
5920
5967
|
[children]
|
5921
5968
|
);
|
@@ -5969,7 +6016,7 @@ var DrawerItem = ({
|
|
5969
6016
|
isDragDisabled
|
5970
6017
|
}) => {
|
5971
6018
|
const resolvedId = id || name;
|
5972
|
-
const [dynamicId, setDynamicId] = (0,
|
6019
|
+
const [dynamicId, setDynamicId] = (0, import_react36.useState)(generateId(resolvedId));
|
5973
6020
|
if (typeof index !== "undefined") {
|
5974
6021
|
console.error(
|
5975
6022
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
@@ -6008,7 +6055,7 @@ var Drawer = ({
|
|
6008
6055
|
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
6009
6056
|
);
|
6010
6057
|
}
|
6011
|
-
const id = (
|
6058
|
+
const id = useSafeId();
|
6012
6059
|
const { ref } = useDroppableSafe({
|
6013
6060
|
id,
|
6014
6061
|
type: "void",
|
@@ -6030,7 +6077,7 @@ Drawer.Item = DrawerItem;
|
|
6030
6077
|
|
6031
6078
|
// components/Puck/index.tsx
|
6032
6079
|
init_react_import();
|
6033
|
-
var
|
6080
|
+
var import_react51 = require("react");
|
6034
6081
|
|
6035
6082
|
// components/SidebarSection/index.tsx
|
6036
6083
|
init_react_import();
|
@@ -6041,7 +6088,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_8boj8_1", "Si
|
|
6041
6088
|
|
6042
6089
|
// lib/use-breadcrumbs.ts
|
6043
6090
|
init_react_import();
|
6044
|
-
var
|
6091
|
+
var import_react37 = require("react");
|
6045
6092
|
var useBreadcrumbs = (renderCount) => {
|
6046
6093
|
const selectedId = useAppStore((s) => {
|
6047
6094
|
var _a;
|
@@ -6053,7 +6100,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
6053
6100
|
return (_a = s.nodes.nodes[selectedId]) == null ? void 0 : _a.path;
|
6054
6101
|
});
|
6055
6102
|
const appStore = useAppStoreApi();
|
6056
|
-
return (0,
|
6103
|
+
return (0, import_react37.useMemo)(() => {
|
6057
6104
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
6058
6105
|
var _a, _b;
|
6059
6106
|
const [componentId] = zoneCompound.split(":");
|
@@ -6178,7 +6225,7 @@ init_react_import();
|
|
6178
6225
|
var styles_module_default16 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
|
6179
6226
|
|
6180
6227
|
// components/Puck/components/Fields/index.tsx
|
6181
|
-
var
|
6228
|
+
var import_react38 = require("react");
|
6182
6229
|
var import_shallow4 = require("zustand/react/shallow");
|
6183
6230
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
6184
6231
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
@@ -6273,7 +6320,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
6273
6320
|
})
|
6274
6321
|
);
|
6275
6322
|
const appStore = useAppStoreApi();
|
6276
|
-
const onChange = (0,
|
6323
|
+
const onChange = (0, import_react38.useCallback)(createOnChange(fieldName, appStore), [
|
6277
6324
|
fieldName
|
6278
6325
|
]);
|
6279
6326
|
if (!field || !id) return null;
|
@@ -6308,7 +6355,7 @@ var Fields = ({ wrapFields = true }) => {
|
|
6308
6355
|
(0, import_shallow4.useShallow)((s) => Object.keys(s.fields.fields))
|
6309
6356
|
);
|
6310
6357
|
const isLoading = fieldsLoading || componentResolving;
|
6311
|
-
const Wrapper = (0,
|
6358
|
+
const Wrapper = (0, import_react38.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
6312
6359
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
6313
6360
|
"form",
|
6314
6361
|
{
|
@@ -6329,7 +6376,7 @@ init_react_import();
|
|
6329
6376
|
|
6330
6377
|
// lib/use-component-list.tsx
|
6331
6378
|
init_react_import();
|
6332
|
-
var
|
6379
|
+
var import_react39 = require("react");
|
6333
6380
|
|
6334
6381
|
// components/ComponentList/index.tsx
|
6335
6382
|
init_react_import();
|
@@ -6400,10 +6447,10 @@ ComponentList.Item = ComponentListItem;
|
|
6400
6447
|
// lib/use-component-list.tsx
|
6401
6448
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
6402
6449
|
var useComponentList = () => {
|
6403
|
-
const [componentList, setComponentList] = (0,
|
6450
|
+
const [componentList, setComponentList] = (0, import_react39.useState)();
|
6404
6451
|
const config = useAppStore((s) => s.config);
|
6405
6452
|
const uiComponentList = useAppStore((s) => s.state.ui.componentList);
|
6406
|
-
(0,
|
6453
|
+
(0, import_react39.useEffect)(() => {
|
6407
6454
|
var _a, _b, _c;
|
6408
6455
|
if (Object.keys(uiComponentList).length > 0) {
|
6409
6456
|
const matchedComponents = [];
|
@@ -6472,22 +6519,22 @@ var useComponentList = () => {
|
|
6472
6519
|
};
|
6473
6520
|
|
6474
6521
|
// components/Puck/components/Components/index.tsx
|
6475
|
-
var
|
6522
|
+
var import_react40 = require("react");
|
6476
6523
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
6477
6524
|
var Components = () => {
|
6478
6525
|
const overrides = useAppStore((s) => s.overrides);
|
6479
6526
|
const componentList = useComponentList();
|
6480
|
-
const Wrapper = (0,
|
6527
|
+
const Wrapper = (0, import_react40.useMemo)(() => overrides.components || "div", [overrides]);
|
6481
6528
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
|
6482
6529
|
};
|
6483
6530
|
|
6484
6531
|
// components/Puck/components/Preview/index.tsx
|
6485
6532
|
init_react_import();
|
6486
|
-
var
|
6533
|
+
var import_react42 = require("react");
|
6487
6534
|
|
6488
6535
|
// components/AutoFrame/index.tsx
|
6489
6536
|
init_react_import();
|
6490
|
-
var
|
6537
|
+
var import_react41 = require("react");
|
6491
6538
|
var import_object_hash = __toESM(require("object-hash"));
|
6492
6539
|
var import_react_dom3 = require("react-dom");
|
6493
6540
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
@@ -6533,7 +6580,7 @@ var CopyHostStyles = ({
|
|
6533
6580
|
onStylesLoaded = () => null
|
6534
6581
|
}) => {
|
6535
6582
|
const { document: doc, window: win } = useFrame();
|
6536
|
-
(0,
|
6583
|
+
(0, import_react41.useEffect)(() => {
|
6537
6584
|
if (!win || !doc) {
|
6538
6585
|
return () => {
|
6539
6586
|
};
|
@@ -6692,8 +6739,8 @@ var CopyHostStyles = ({
|
|
6692
6739
|
}, []);
|
6693
6740
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
6694
6741
|
};
|
6695
|
-
var autoFrameContext = (0,
|
6696
|
-
var useFrame = () => (0,
|
6742
|
+
var autoFrameContext = (0, import_react41.createContext)({});
|
6743
|
+
var useFrame = () => (0, import_react41.useContext)(autoFrameContext);
|
6697
6744
|
function AutoFrame(_a) {
|
6698
6745
|
var _b = _a, {
|
6699
6746
|
children,
|
@@ -6714,11 +6761,11 @@ function AutoFrame(_a) {
|
|
6714
6761
|
"onNotReady",
|
6715
6762
|
"frameRef"
|
6716
6763
|
]);
|
6717
|
-
const [loaded, setLoaded] = (0,
|
6718
|
-
const [ctx, setCtx] = (0,
|
6719
|
-
const [mountTarget, setMountTarget] = (0,
|
6720
|
-
const [stylesLoaded, setStylesLoaded] = (0,
|
6721
|
-
(0,
|
6764
|
+
const [loaded, setLoaded] = (0, import_react41.useState)(false);
|
6765
|
+
const [ctx, setCtx] = (0, import_react41.useState)({});
|
6766
|
+
const [mountTarget, setMountTarget] = (0, import_react41.useState)();
|
6767
|
+
const [stylesLoaded, setStylesLoaded] = (0, import_react41.useState)(false);
|
6768
|
+
(0, import_react41.useEffect)(() => {
|
6722
6769
|
var _a2;
|
6723
6770
|
if (frameRef.current) {
|
6724
6771
|
const doc = frameRef.current.contentDocument;
|
@@ -6770,7 +6817,7 @@ var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6770
6817
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
6771
6818
|
var useBubbleIframeEvents = (ref) => {
|
6772
6819
|
const status = useAppStore((s) => s.status);
|
6773
|
-
(0,
|
6820
|
+
(0, import_react42.useEffect)(() => {
|
6774
6821
|
if (ref.current && status === "READY") {
|
6775
6822
|
const iframe = ref.current;
|
6776
6823
|
const handlePointerMove = (event) => {
|
@@ -6819,7 +6866,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
6819
6866
|
const renderData = useAppStore(
|
6820
6867
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
6821
6868
|
);
|
6822
|
-
const Page = (0,
|
6869
|
+
const Page = (0, import_react42.useCallback)(
|
6823
6870
|
(pageProps) => {
|
6824
6871
|
var _a, _b;
|
6825
6872
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
@@ -6828,9 +6875,9 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
6828
6875
|
},
|
6829
6876
|
[config.root]
|
6830
6877
|
);
|
6831
|
-
const Frame = (0,
|
6878
|
+
const Frame = (0, import_react42.useMemo)(() => overrides.iframe, [overrides]);
|
6832
6879
|
const rootProps = root.props || root;
|
6833
|
-
const ref = (0,
|
6880
|
+
const ref = (0, import_react42.useRef)(null);
|
6834
6881
|
useBubbleIframeEvents(ref);
|
6835
6882
|
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
6836
6883
|
Page,
|
@@ -6845,7 +6892,7 @@ var Preview3 = ({ id = "puck-preview" }) => {
|
|
6845
6892
|
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZonePure, { zone: rootDroppableId })
|
6846
6893
|
})
|
6847
6894
|
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Render, { data: renderData, config });
|
6848
|
-
(0,
|
6895
|
+
(0, import_react42.useEffect)(() => {
|
6849
6896
|
if (!iframe.enabled) {
|
6850
6897
|
setStatus("READY");
|
6851
6898
|
}
|
@@ -6936,7 +6983,7 @@ var scrollIntoView = (el) => {
|
|
6936
6983
|
};
|
6937
6984
|
|
6938
6985
|
// components/LayerTree/index.tsx
|
6939
|
-
var
|
6986
|
+
var import_react43 = require("react");
|
6940
6987
|
|
6941
6988
|
// lib/on-scroll-end.ts
|
6942
6989
|
init_react_import();
|
@@ -6971,7 +7018,7 @@ var LayerTree = ({
|
|
6971
7018
|
label
|
6972
7019
|
}) => {
|
6973
7020
|
const zones = data.zones || {};
|
6974
|
-
const ctx = (0,
|
7021
|
+
const ctx = (0, import_react43.useContext)(dropZoneContext);
|
6975
7022
|
const nodes = useAppStore((s) => s.nodes.nodes);
|
6976
7023
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
6977
7024
|
label && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
@@ -7083,7 +7130,7 @@ var LayerTree = ({
|
|
7083
7130
|
};
|
7084
7131
|
|
7085
7132
|
// components/Puck/components/Outline/index.tsx
|
7086
|
-
var
|
7133
|
+
var import_react44 = require("react");
|
7087
7134
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
7088
7135
|
var Outline = () => {
|
7089
7136
|
const state = useAppStore((s) => s.state);
|
@@ -7092,7 +7139,7 @@ var Outline = () => {
|
|
7092
7139
|
const { data, ui } = state;
|
7093
7140
|
const { itemSelector } = ui;
|
7094
7141
|
const appStore = useAppStoreApi();
|
7095
|
-
const setItemSelector = (0,
|
7142
|
+
const setItemSelector = (0, import_react44.useCallback)(
|
7096
7143
|
(newItemSelector) => {
|
7097
7144
|
const { dispatch } = appStore.getState();
|
7098
7145
|
dispatch({
|
@@ -7102,7 +7149,7 @@ var Outline = () => {
|
|
7102
7149
|
},
|
7103
7150
|
[appStore]
|
7104
7151
|
);
|
7105
|
-
const Wrapper = (0,
|
7152
|
+
const Wrapper = (0, import_react44.useMemo)(() => outlineOverride || "div", [outlineOverride]);
|
7106
7153
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
7107
7154
|
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
7108
7155
|
LayerTree,
|
@@ -7258,11 +7305,11 @@ var getBox = function getBox2(el) {
|
|
7258
7305
|
};
|
7259
7306
|
|
7260
7307
|
// components/Puck/components/Canvas/index.tsx
|
7261
|
-
var
|
7308
|
+
var import_react46 = require("react");
|
7262
7309
|
|
7263
7310
|
// components/ViewportControls/index.tsx
|
7264
7311
|
init_react_import();
|
7265
|
-
var
|
7312
|
+
var import_react45 = require("react");
|
7266
7313
|
|
7267
7314
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
7268
7315
|
init_react_import();
|
@@ -7285,8 +7332,8 @@ var ViewportButton = ({
|
|
7285
7332
|
onClick
|
7286
7333
|
}) => {
|
7287
7334
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
7288
|
-
const [isActive, setIsActive] = (0,
|
7289
|
-
(0,
|
7335
|
+
const [isActive, setIsActive] = (0, import_react45.useState)(false);
|
7336
|
+
(0, import_react45.useEffect)(() => {
|
7290
7337
|
setIsActive(width === viewports.current.width);
|
7291
7338
|
}, [width, viewports.current.width]);
|
7292
7339
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
@@ -7322,7 +7369,7 @@ var ViewportControls = ({
|
|
7322
7369
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
7323
7370
|
(option) => option.value === autoZoom
|
7324
7371
|
);
|
7325
|
-
const zoomOptions = (0,
|
7372
|
+
const zoomOptions = (0, import_react45.useMemo)(
|
7326
7373
|
() => [
|
7327
7374
|
...defaultZoomOptions,
|
7328
7375
|
...defaultsContainAutoZoom ? [] : [
|
@@ -7469,17 +7516,17 @@ var Canvas = () => {
|
|
7469
7516
|
viewports: s.state.ui.viewports
|
7470
7517
|
}))
|
7471
7518
|
);
|
7472
|
-
const frameRef = (0,
|
7473
|
-
const [showTransition, setShowTransition] = (0,
|
7474
|
-
const defaultRender = (0,
|
7519
|
+
const frameRef = (0, import_react46.useRef)(null);
|
7520
|
+
const [showTransition, setShowTransition] = (0, import_react46.useState)(false);
|
7521
|
+
const defaultRender = (0, import_react46.useMemo)(() => {
|
7475
7522
|
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
7476
7523
|
return PuckDefault;
|
7477
7524
|
}, []);
|
7478
|
-
const CustomPreview = (0,
|
7525
|
+
const CustomPreview = (0, import_react46.useMemo)(
|
7479
7526
|
() => overrides.preview || defaultRender,
|
7480
7527
|
[overrides]
|
7481
7528
|
);
|
7482
|
-
const getFrameDimensions = (0,
|
7529
|
+
const getFrameDimensions = (0, import_react46.useCallback)(() => {
|
7483
7530
|
if (frameRef.current) {
|
7484
7531
|
const frame = frameRef.current;
|
7485
7532
|
const box = getBox(frame);
|
@@ -7487,7 +7534,7 @@ var Canvas = () => {
|
|
7487
7534
|
}
|
7488
7535
|
return { width: 0, height: 0 };
|
7489
7536
|
}, [frameRef]);
|
7490
|
-
const resetAutoZoom = (0,
|
7537
|
+
const resetAutoZoom = (0, import_react46.useCallback)(
|
7491
7538
|
(newViewports = viewports) => {
|
7492
7539
|
if (frameRef.current) {
|
7493
7540
|
setZoomConfig(
|
@@ -7501,11 +7548,11 @@ var Canvas = () => {
|
|
7501
7548
|
},
|
7502
7549
|
[frameRef, zoomConfig, viewports]
|
7503
7550
|
);
|
7504
|
-
(0,
|
7551
|
+
(0, import_react46.useEffect)(() => {
|
7505
7552
|
setShowTransition(false);
|
7506
7553
|
resetAutoZoom(viewports);
|
7507
7554
|
}, [frameRef, leftSideBarVisible, rightSideBarVisible]);
|
7508
|
-
(0,
|
7555
|
+
(0, import_react46.useEffect)(() => {
|
7509
7556
|
const { height: frameHeight } = getFrameDimensions();
|
7510
7557
|
if (viewports.current.height === "auto") {
|
7511
7558
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -7513,13 +7560,13 @@ var Canvas = () => {
|
|
7513
7560
|
}));
|
7514
7561
|
}
|
7515
7562
|
}, [zoomConfig.zoom]);
|
7516
|
-
(0,
|
7563
|
+
(0, import_react46.useEffect)(() => {
|
7517
7564
|
if (ZOOM_ON_CHANGE) {
|
7518
7565
|
setShowTransition(true);
|
7519
7566
|
resetAutoZoom(viewports);
|
7520
7567
|
}
|
7521
7568
|
}, [viewports.current.width]);
|
7522
|
-
(0,
|
7569
|
+
(0, import_react46.useEffect)(() => {
|
7523
7570
|
const cb = () => {
|
7524
7571
|
setShowTransition(false);
|
7525
7572
|
resetAutoZoom();
|
@@ -7529,8 +7576,8 @@ var Canvas = () => {
|
|
7529
7576
|
window.removeEventListener("resize", cb);
|
7530
7577
|
};
|
7531
7578
|
}, []);
|
7532
|
-
const [showLoader, setShowLoader] = (0,
|
7533
|
-
(0,
|
7579
|
+
const [showLoader, setShowLoader] = (0, import_react46.useState)(false);
|
7580
|
+
(0, import_react46.useEffect)(() => {
|
7534
7581
|
setTimeout(() => {
|
7535
7582
|
setShowLoader(true);
|
7536
7583
|
}, 500);
|
@@ -7608,7 +7655,7 @@ var Canvas = () => {
|
|
7608
7655
|
|
7609
7656
|
// lib/use-loaded-overrides.ts
|
7610
7657
|
init_react_import();
|
7611
|
-
var
|
7658
|
+
var import_react47 = require("react");
|
7612
7659
|
|
7613
7660
|
// lib/load-overrides.ts
|
7614
7661
|
init_react_import();
|
@@ -7647,7 +7694,7 @@ var useLoadedOverrides = ({
|
|
7647
7694
|
overrides,
|
7648
7695
|
plugins
|
7649
7696
|
}) => {
|
7650
|
-
return (0,
|
7697
|
+
return (0, import_react47.useMemo)(() => {
|
7651
7698
|
return loadOverrides({ overrides, plugins });
|
7652
7699
|
}, [plugins, overrides]);
|
7653
7700
|
};
|
@@ -7659,14 +7706,14 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37
|
|
7659
7706
|
|
7660
7707
|
// lib/use-inject-css.ts
|
7661
7708
|
init_react_import();
|
7662
|
-
var
|
7709
|
+
var import_react48 = require("react");
|
7663
7710
|
var styles = ``;
|
7664
7711
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7665
|
-
const [el, setEl] = (0,
|
7666
|
-
(0,
|
7712
|
+
const [el, setEl] = (0, import_react48.useState)();
|
7713
|
+
(0, import_react48.useEffect)(() => {
|
7667
7714
|
setEl(document.createElement("style"));
|
7668
7715
|
}, []);
|
7669
|
-
(0,
|
7716
|
+
(0, import_react48.useEffect)(() => {
|
7670
7717
|
var _a;
|
7671
7718
|
if (!el || typeof window === "undefined") {
|
7672
7719
|
return;
|
@@ -7686,10 +7733,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
7686
7733
|
|
7687
7734
|
// lib/use-preview-mode-hotkeys.ts
|
7688
7735
|
init_react_import();
|
7689
|
-
var
|
7736
|
+
var import_react49 = require("react");
|
7690
7737
|
var usePreviewModeHotkeys = () => {
|
7691
7738
|
const appStore = useAppStoreApi();
|
7692
|
-
const toggleInteractive = (0,
|
7739
|
+
const toggleInteractive = (0, import_react49.useCallback)(() => {
|
7693
7740
|
const dispatch = appStore.getState().dispatch;
|
7694
7741
|
dispatch({
|
7695
7742
|
type: "setUi",
|
@@ -7704,7 +7751,7 @@ var usePreviewModeHotkeys = () => {
|
|
7704
7751
|
|
7705
7752
|
// lib/use-puck.ts
|
7706
7753
|
init_react_import();
|
7707
|
-
var
|
7754
|
+
var import_react50 = require("react");
|
7708
7755
|
var import_zustand6 = require("zustand");
|
7709
7756
|
var generateUsePuck = (store) => {
|
7710
7757
|
const history = {
|
@@ -7729,14 +7776,14 @@ var generateUsePuck = (store) => {
|
|
7729
7776
|
const get = () => storeData;
|
7730
7777
|
return __spreadProps(__spreadValues({}, storeData), { get });
|
7731
7778
|
};
|
7732
|
-
var UsePuckStoreContext = (0,
|
7779
|
+
var UsePuckStoreContext = (0, import_react50.createContext)(
|
7733
7780
|
null
|
7734
7781
|
);
|
7735
7782
|
var useRegisterUsePuckStore = (appStore) => {
|
7736
|
-
const [usePuckStore] = (0,
|
7783
|
+
const [usePuckStore] = (0, import_react50.useState)(
|
7737
7784
|
() => (0, import_zustand6.createStore)(() => generateUsePuck(appStore.getState()))
|
7738
7785
|
);
|
7739
|
-
(0,
|
7786
|
+
(0, import_react50.useEffect)(() => {
|
7740
7787
|
return appStore.subscribe(
|
7741
7788
|
(store) => {
|
7742
7789
|
const pickedStore = {
|
@@ -7758,7 +7805,7 @@ var useRegisterUsePuckStore = (appStore) => {
|
|
7758
7805
|
};
|
7759
7806
|
function createUsePuck() {
|
7760
7807
|
return function usePuck2(selector) {
|
7761
|
-
const usePuckApi = (0,
|
7808
|
+
const usePuckApi = (0, import_react50.useContext)(UsePuckStoreContext);
|
7762
7809
|
if (!usePuckApi) {
|
7763
7810
|
throw new Error("usePuck must be used inside <Puck>.");
|
7764
7811
|
}
|
@@ -7770,7 +7817,7 @@ function createUsePuck() {
|
|
7770
7817
|
};
|
7771
7818
|
}
|
7772
7819
|
function usePuck() {
|
7773
|
-
(0,
|
7820
|
+
(0, import_react50.useEffect)(() => {
|
7774
7821
|
console.warn(
|
7775
7822
|
"You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
|
7776
7823
|
);
|
@@ -7791,11 +7838,11 @@ var FieldSideBar = () => {
|
|
7791
7838
|
);
|
7792
7839
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {}) });
|
7793
7840
|
};
|
7794
|
-
var propsContext = (0,
|
7841
|
+
var propsContext = (0, import_react51.createContext)({});
|
7795
7842
|
function PropsProvider(props) {
|
7796
7843
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(propsContext.Provider, { value: props, children: props.children });
|
7797
7844
|
}
|
7798
|
-
var usePropsContext = () => (0,
|
7845
|
+
var usePropsContext = () => (0, import_react51.useContext)(propsContext);
|
7799
7846
|
function PuckProvider({ children }) {
|
7800
7847
|
const {
|
7801
7848
|
config,
|
@@ -7815,7 +7862,7 @@ function PuckProvider({ children }) {
|
|
7815
7862
|
enabled: true,
|
7816
7863
|
waitForStyles: true
|
7817
7864
|
}, _iframe);
|
7818
|
-
const [generatedAppState] = (0,
|
7865
|
+
const [generatedAppState] = (0, import_react51.useState)(() => {
|
7819
7866
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
7820
7867
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7821
7868
|
let clientUiState = {};
|
@@ -7887,7 +7934,7 @@ function PuckProvider({ children }) {
|
|
7887
7934
|
overrides,
|
7888
7935
|
plugins
|
7889
7936
|
});
|
7890
|
-
const generateAppStore = (0,
|
7937
|
+
const generateAppStore = (0, import_react51.useCallback)(() => {
|
7891
7938
|
return {
|
7892
7939
|
state: initialAppState,
|
7893
7940
|
config,
|
@@ -7908,8 +7955,8 @@ function PuckProvider({ children }) {
|
|
7908
7955
|
onAction,
|
7909
7956
|
metadata
|
7910
7957
|
]);
|
7911
|
-
const [appStore] = (0,
|
7912
|
-
(0,
|
7958
|
+
const [appStore] = (0, import_react51.useState)(() => createAppStore(generateAppStore()));
|
7959
|
+
(0, import_react51.useEffect)(() => {
|
7913
7960
|
appStore.setState(__spreadValues({}, generateAppStore()));
|
7914
7961
|
}, [
|
7915
7962
|
initialAppState,
|
@@ -7926,7 +7973,7 @@ function PuckProvider({ children }) {
|
|
7926
7973
|
index: initialHistoryIndex,
|
7927
7974
|
initialAppState
|
7928
7975
|
});
|
7929
|
-
(0,
|
7976
|
+
(0, import_react51.useEffect)(() => {
|
7930
7977
|
appStore.subscribe((s) => {
|
7931
7978
|
if (onChange) onChange(s.state.data);
|
7932
7979
|
});
|
@@ -7934,11 +7981,11 @@ function PuckProvider({ children }) {
|
|
7934
7981
|
useRegisterNodesSlice(appStore);
|
7935
7982
|
useRegisterPermissionsSlice(appStore, permissions);
|
7936
7983
|
const uPuckStore = useRegisterUsePuckStore(appStore);
|
7937
|
-
(0,
|
7984
|
+
(0, import_react51.useEffect)(() => {
|
7938
7985
|
const { state, resolveData: resolveData2 } = appStore.getState();
|
7939
7986
|
resolveData2(state);
|
7940
7987
|
}, []);
|
7941
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UsePuckStoreContext, { value: uPuckStore, children }) });
|
7988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
|
7942
7989
|
}
|
7943
7990
|
function PuckLayout({ children }) {
|
7944
7991
|
const {
|
@@ -7961,9 +8008,9 @@ function PuckLayout({ children }) {
|
|
7961
8008
|
const rightSideBarVisible = useAppStore(
|
7962
8009
|
(s) => s.state.ui.rightSideBarVisible
|
7963
8010
|
);
|
7964
|
-
const [menuOpen, setMenuOpen] = (0,
|
8011
|
+
const [menuOpen, setMenuOpen] = (0, import_react51.useState)(false);
|
7965
8012
|
const appStore = useAppStoreApi();
|
7966
|
-
(0,
|
8013
|
+
(0, import_react51.useEffect)(() => {
|
7967
8014
|
return appStore.subscribe((s) => {
|
7968
8015
|
if (onChange) onChange(s.state.data);
|
7969
8016
|
});
|
@@ -7972,7 +8019,7 @@ function PuckLayout({ children }) {
|
|
7972
8019
|
(s) => s.state.data.root.props || s.state.data.root.props
|
7973
8020
|
);
|
7974
8021
|
const dispatch = useAppStore((s) => s.dispatch);
|
7975
|
-
const toggleSidebars = (0,
|
8022
|
+
const toggleSidebars = (0, import_react51.useCallback)(
|
7976
8023
|
(sidebar) => {
|
7977
8024
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
7978
8025
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -7986,7 +8033,7 @@ function PuckLayout({ children }) {
|
|
7986
8033
|
},
|
7987
8034
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
7988
8035
|
);
|
7989
|
-
(0,
|
8036
|
+
(0, import_react51.useEffect)(() => {
|
7990
8037
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
7991
8038
|
dispatch({
|
7992
8039
|
type: "setUi",
|
@@ -8009,7 +8056,7 @@ function PuckLayout({ children }) {
|
|
8009
8056
|
window.removeEventListener("resize", handleResize);
|
8010
8057
|
};
|
8011
8058
|
}, []);
|
8012
|
-
const defaultHeaderRender = (0,
|
8059
|
+
const defaultHeaderRender = (0, import_react51.useMemo)(() => {
|
8013
8060
|
if (renderHeader) {
|
8014
8061
|
console.warn(
|
8015
8062
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -8024,7 +8071,7 @@ function PuckLayout({ children }) {
|
|
8024
8071
|
}
|
8025
8072
|
return DefaultOverride;
|
8026
8073
|
}, [renderHeader]);
|
8027
|
-
const defaultHeaderActionsRender = (0,
|
8074
|
+
const defaultHeaderActionsRender = (0, import_react51.useMemo)(() => {
|
8028
8075
|
if (renderHeaderActions) {
|
8029
8076
|
console.warn(
|
8030
8077
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
@@ -8039,25 +8086,25 @@ function PuckLayout({ children }) {
|
|
8039
8086
|
return DefaultOverride;
|
8040
8087
|
}, [renderHeader]);
|
8041
8088
|
const overrides = useAppStore((s) => s.overrides);
|
8042
|
-
const CustomPuck = (0,
|
8089
|
+
const CustomPuck = (0, import_react51.useMemo)(
|
8043
8090
|
() => overrides.puck || DefaultOverride,
|
8044
8091
|
[overrides]
|
8045
8092
|
);
|
8046
|
-
const CustomHeader = (0,
|
8093
|
+
const CustomHeader = (0, import_react51.useMemo)(
|
8047
8094
|
() => overrides.header || defaultHeaderRender,
|
8048
8095
|
[overrides]
|
8049
8096
|
);
|
8050
|
-
const CustomHeaderActions = (0,
|
8097
|
+
const CustomHeaderActions = (0, import_react51.useMemo)(
|
8051
8098
|
() => overrides.headerActions || defaultHeaderActionsRender,
|
8052
8099
|
[overrides]
|
8053
8100
|
);
|
8054
|
-
const [mounted, setMounted] = (0,
|
8055
|
-
(0,
|
8101
|
+
const [mounted, setMounted] = (0, import_react51.useState)(false);
|
8102
|
+
(0, import_react51.useEffect)(() => {
|
8056
8103
|
setMounted(true);
|
8057
8104
|
}, []);
|
8058
8105
|
const ready = useAppStore((s) => s.status === "READY");
|
8059
8106
|
useMonitorHotkeys();
|
8060
|
-
(0,
|
8107
|
+
(0, import_react51.useEffect)(() => {
|
8061
8108
|
if (ready && iframe.enabled) {
|
8062
8109
|
const frameDoc = getFrame();
|
8063
8110
|
if (frameDoc) {
|