@measured/puck 0.18.0-canary.f2e2eaa → 0.18.1-canary.0573b18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +45 -48
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +224 -144
- package/dist/index.mjs +215 -135
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -205,7 +205,7 @@ init_react_import();
|
|
205
205
|
|
206
206
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
207
207
|
init_react_import();
|
208
|
-
var styles_module_default2 = { "InputWrapper": "
|
208
|
+
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1h1p1_1", "Input-label": "_Input-label_1h1p1_5", "Input-labelIcon": "_Input-labelIcon_1h1p1_14", "Input-disabledIcon": "_Input-disabledIcon_1h1p1_21", "Input-input": "_Input-input_1h1p1_26", "Input": "_Input_1h1p1_1", "Input--readOnly": "_Input--readOnly_1h1p1_70", "Input-radioGroupItems": "_Input-radioGroupItems_1h1p1_81", "Input-radio": "_Input-radio_1h1p1_81", "Input-radioInner": "_Input-radioInner_1h1p1_98", "Input-radioInput": "_Input-radioInput_1h1p1_143" };
|
209
209
|
|
210
210
|
// components/AutoField/index.tsx
|
211
211
|
import {
|
@@ -1504,12 +1504,13 @@ var DefaultField = ({
|
|
1504
1504
|
field,
|
1505
1505
|
onChange,
|
1506
1506
|
readOnly,
|
1507
|
-
value,
|
1507
|
+
value: _value,
|
1508
1508
|
name,
|
1509
1509
|
label,
|
1510
1510
|
Label: Label2,
|
1511
1511
|
id
|
1512
1512
|
}) => {
|
1513
|
+
const value = _value;
|
1513
1514
|
return /* @__PURE__ */ jsx9(
|
1514
1515
|
Label2,
|
1515
1516
|
{
|
@@ -1527,7 +1528,7 @@ var DefaultField = ({
|
|
1527
1528
|
type: field.type,
|
1528
1529
|
title: label || name,
|
1529
1530
|
name,
|
1530
|
-
value:
|
1531
|
+
value: (value == null ? void 0 : value.toString) ? value.toString() : "",
|
1531
1532
|
onChange: (e) => {
|
1532
1533
|
if (field.type === "number") {
|
1533
1534
|
const numberValue = Number(e.currentTarget.value);
|
@@ -2436,7 +2437,7 @@ import {
|
|
2436
2437
|
useContext as useContext7,
|
2437
2438
|
useEffect as useEffect15,
|
2438
2439
|
useId,
|
2439
|
-
useRef as
|
2440
|
+
useRef as useRef3,
|
2440
2441
|
useState as useState17
|
2441
2442
|
} from "react";
|
2442
2443
|
import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
|
@@ -2449,7 +2450,7 @@ import {
|
|
2449
2450
|
useContext as useContext6,
|
2450
2451
|
useEffect as useEffect14,
|
2451
2452
|
useMemo as useMemo8,
|
2452
|
-
useRef as
|
2453
|
+
useRef as useRef2
|
2453
2454
|
} from "react";
|
2454
2455
|
|
2455
2456
|
// components/DraggableComponent/index.tsx
|
@@ -2459,7 +2460,7 @@ import {
|
|
2459
2460
|
useContext as useContext5,
|
2460
2461
|
useEffect as useEffect10,
|
2461
2462
|
useMemo as useMemo7,
|
2462
|
-
useRef
|
2463
|
+
useRef,
|
2463
2464
|
useState as useState13
|
2464
2465
|
} from "react";
|
2465
2466
|
|
@@ -3047,7 +3048,7 @@ var DraggableComponent = ({
|
|
3047
3048
|
}
|
3048
3049
|
});
|
3049
3050
|
const thisIsDragging = status === "dragging";
|
3050
|
-
const ref =
|
3051
|
+
const ref = useRef(null);
|
3051
3052
|
const refSetter = useCallback7(
|
3052
3053
|
(el) => {
|
3053
3054
|
sortableRef(el);
|
@@ -3098,13 +3099,19 @@ var DraggableComponent = ({
|
|
3098
3099
|
}
|
3099
3100
|
}, [ref.current]);
|
3100
3101
|
useEffect10(() => {
|
3101
|
-
|
3102
|
-
|
3102
|
+
ctx == null ? void 0 : ctx.registerPath(
|
3103
|
+
id,
|
3104
|
+
{
|
3103
3105
|
index,
|
3104
3106
|
zone: zoneCompound
|
3105
|
-
}
|
3106
|
-
|
3107
|
-
|
3107
|
+
},
|
3108
|
+
componentType
|
3109
|
+
);
|
3110
|
+
return () => {
|
3111
|
+
var _a;
|
3112
|
+
(_a = ctx == null ? void 0 : ctx.unregisterPath) == null ? void 0 : _a.call(ctx, id);
|
3113
|
+
};
|
3114
|
+
}, [id, zoneCompound, index, componentType]);
|
3108
3115
|
const CustomActionBar = useMemo7(
|
3109
3116
|
() => overrides.actionBar || DefaultActionBar,
|
3110
3117
|
[overrides.actionBar]
|
@@ -3424,9 +3431,20 @@ var useContentWithPreview = (content, zoneCompound) => {
|
|
3424
3431
|
};
|
3425
3432
|
}
|
3426
3433
|
);
|
3434
|
+
const {
|
3435
|
+
state: {
|
3436
|
+
ui: { isDragging }
|
3437
|
+
}
|
3438
|
+
} = useAppContext();
|
3427
3439
|
const [contentWithPreview, setContentWithPreview] = useState15(content);
|
3440
|
+
const [localPreview, setLocalPreview] = useState15(
|
3441
|
+
preview
|
3442
|
+
);
|
3428
3443
|
const updateContent = useRenderedCallback(
|
3429
|
-
(content2, preview2) => {
|
3444
|
+
(content2, preview2, isDragging2) => {
|
3445
|
+
if (isDragging2 && !previewExists) {
|
3446
|
+
return;
|
3447
|
+
}
|
3430
3448
|
if (preview2) {
|
3431
3449
|
if (preview2.type === "insert") {
|
3432
3450
|
setContentWithPreview(
|
@@ -3456,13 +3474,14 @@ var useContentWithPreview = (content, zoneCompound) => {
|
|
3456
3474
|
previewExists ? content2.filter((item) => item.props.id !== draggedItemId) : content2
|
3457
3475
|
);
|
3458
3476
|
}
|
3477
|
+
setLocalPreview(preview2);
|
3459
3478
|
},
|
3460
3479
|
[draggedItemId, previewExists]
|
3461
3480
|
);
|
3462
3481
|
useEffect12(() => {
|
3463
|
-
updateContent(content, preview);
|
3464
|
-
}, [content, preview]);
|
3465
|
-
return contentWithPreview;
|
3482
|
+
updateContent(content, preview, isDragging);
|
3483
|
+
}, [content, preview, isDragging]);
|
3484
|
+
return [contentWithPreview, localPreview];
|
3466
3485
|
};
|
3467
3486
|
|
3468
3487
|
// components/DropZone/lib/use-drag-axis.ts
|
@@ -3542,8 +3561,7 @@ var DropZoneEdit = forwardRef3(
|
|
3542
3561
|
isDeepestZone,
|
3543
3562
|
inNextDeepestArea,
|
3544
3563
|
draggedComponentType,
|
3545
|
-
userIsDragging
|
3546
|
-
preview
|
3564
|
+
userIsDragging
|
3547
3565
|
} = useContextStore(ZoneStoreContext, (s) => {
|
3548
3566
|
var _a, _b, _c;
|
3549
3567
|
return {
|
@@ -3551,8 +3569,7 @@ var DropZoneEdit = forwardRef3(
|
|
3551
3569
|
inNextDeepestArea: s.nextAreaDepthIndex[areaId || ""],
|
3552
3570
|
draggedItemId: (_b = s.draggedItem) == null ? void 0 : _b.id,
|
3553
3571
|
draggedComponentType: (_c = s.draggedItem) == null ? void 0 : _c.data.componentType,
|
3554
|
-
userIsDragging: !!s.draggedItem
|
3555
|
-
preview: s.previewIndex[zoneCompound]
|
3572
|
+
userIsDragging: !!s.draggedItem
|
3556
3573
|
};
|
3557
3574
|
});
|
3558
3575
|
const { itemSelector } = appContext2.state.ui;
|
@@ -3577,7 +3594,7 @@ var DropZoneEdit = forwardRef3(
|
|
3577
3594
|
}
|
3578
3595
|
return data.content || [];
|
3579
3596
|
}, [data, zoneCompound]);
|
3580
|
-
const ref =
|
3597
|
+
const ref = useRef2(null);
|
3581
3598
|
const acceptsTarget = useCallback10(
|
3582
3599
|
(componentType) => {
|
3583
3600
|
if (!componentType) {
|
@@ -3618,7 +3635,10 @@ var DropZoneEdit = forwardRef3(
|
|
3618
3635
|
if (isEnabled) {
|
3619
3636
|
isEnabled = acceptsTarget(draggedComponentType);
|
3620
3637
|
}
|
3621
|
-
const contentWithPreview = useContentWithPreview(
|
3638
|
+
const [contentWithPreview, preview] = useContentWithPreview(
|
3639
|
+
content,
|
3640
|
+
zoneCompound
|
3641
|
+
);
|
3622
3642
|
const isDropEnabled = isEnabled && (preview ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
|
3623
3643
|
const droppableConfig = {
|
3624
3644
|
id: zoneCompound,
|
@@ -3660,10 +3680,9 @@ var DropZoneEdit = forwardRef3(
|
|
3660
3680
|
},
|
3661
3681
|
"data-testid": `dropzone:${zoneCompound}`,
|
3662
3682
|
"data-puck-dropzone": zoneCompound,
|
3663
|
-
"data-puck-dnd": zoneCompound,
|
3664
3683
|
style: __spreadProps(__spreadValues({}, style), {
|
3665
3684
|
"--min-empty-height": `${minEmptyHeight}px`,
|
3666
|
-
backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
|
3685
|
+
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
3667
3686
|
}),
|
3668
3687
|
children: contentWithPreview.map((item, i) => {
|
3669
3688
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -3942,6 +3961,13 @@ var getPointerCollisions = (position, manager) => {
|
|
3942
3961
|
if (elements) {
|
3943
3962
|
for (let i = 0; i < elements.length; i++) {
|
3944
3963
|
const element = elements[i];
|
3964
|
+
const dropzoneId = element.getAttribute("data-puck-dropzone");
|
3965
|
+
if (dropzoneId) {
|
3966
|
+
const droppable = manager.registry.droppables.get(dropzoneId);
|
3967
|
+
if (droppable) {
|
3968
|
+
candidates.push(droppable);
|
3969
|
+
}
|
3970
|
+
}
|
3945
3971
|
const id = element.getAttribute("data-puck-dnd");
|
3946
3972
|
if (id) {
|
3947
3973
|
const droppable = manager.registry.droppables.get(id);
|
@@ -4734,7 +4760,7 @@ function useDragListener(type, fn, deps = []) {
|
|
4734
4760
|
}
|
4735
4761
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
4736
4762
|
var useTempDisableFallback = (timeout3) => {
|
4737
|
-
const lastFallbackDisable =
|
4763
|
+
const lastFallbackDisable = useRef3(null);
|
4738
4764
|
return useCallback11((manager) => {
|
4739
4765
|
collisionStore.setState({ fallbackEnabled: false });
|
4740
4766
|
const fallbackId = generateId();
|
@@ -4754,7 +4780,7 @@ var DragDropContextClient = ({
|
|
4754
4780
|
const { state, config, dispatch, resolveData } = useAppContext();
|
4755
4781
|
const id = useId();
|
4756
4782
|
const { data } = state;
|
4757
|
-
const debouncedParamsRef =
|
4783
|
+
const debouncedParamsRef = useRef3(null);
|
4758
4784
|
const tempDisableFallback = useTempDisableFallback(100);
|
4759
4785
|
const [zoneStore] = useState17(
|
4760
4786
|
() => createStore3(() => ({
|
@@ -4893,30 +4919,36 @@ var DragDropContextClient = ({
|
|
4893
4919
|
]);
|
4894
4920
|
const [dragListeners, setDragListeners] = useState17({});
|
4895
4921
|
const [pathData, setPathData] = useState17();
|
4896
|
-
const dragMode =
|
4922
|
+
const dragMode = useRef3(null);
|
4897
4923
|
const registerPath = useCallback11(
|
4898
|
-
(selector) => {
|
4899
|
-
const item = getItem(selector, data);
|
4900
|
-
if (!item) {
|
4901
|
-
return;
|
4902
|
-
}
|
4924
|
+
(id2, selector, label) => {
|
4903
4925
|
const [area] = getZoneId(selector.zone);
|
4904
4926
|
setPathData((latestPathData = {}) => {
|
4905
4927
|
const parentPathData = latestPathData[area] || { path: [] };
|
4906
4928
|
return __spreadProps(__spreadValues({}, latestPathData), {
|
4907
|
-
[
|
4929
|
+
[id2]: {
|
4908
4930
|
path: [
|
4909
4931
|
...parentPathData.path,
|
4910
4932
|
...selector.zone ? [selector.zone] : []
|
4911
4933
|
],
|
4912
|
-
label
|
4934
|
+
label
|
4913
4935
|
}
|
4914
4936
|
});
|
4915
4937
|
});
|
4916
4938
|
},
|
4917
4939
|
[data, setPathData]
|
4918
4940
|
);
|
4919
|
-
const
|
4941
|
+
const unregisterPath = useCallback11(
|
4942
|
+
(id2) => {
|
4943
|
+
setPathData((latestPathData = {}) => {
|
4944
|
+
const newPathData = __spreadValues({}, latestPathData);
|
4945
|
+
delete newPathData[id2];
|
4946
|
+
return newPathData;
|
4947
|
+
});
|
4948
|
+
},
|
4949
|
+
[data, setPathData]
|
4950
|
+
);
|
4951
|
+
const initialSelector = useRef3(void 0);
|
4920
4952
|
return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
|
4921
4953
|
dragListenerContext.Provider,
|
4922
4954
|
{
|
@@ -5112,6 +5144,7 @@ var DragDropContextClient = ({
|
|
5112
5144
|
areaId: "root",
|
5113
5145
|
depth: 0,
|
5114
5146
|
registerPath,
|
5147
|
+
unregisterPath,
|
5115
5148
|
pathData,
|
5116
5149
|
path: []
|
5117
5150
|
},
|
@@ -5261,9 +5294,9 @@ Drawer.Item = DrawerItem;
|
|
5261
5294
|
// components/Puck/index.tsx
|
5262
5295
|
init_react_import();
|
5263
5296
|
import {
|
5264
|
-
useCallback as
|
5265
|
-
useEffect as
|
5266
|
-
useMemo as
|
5297
|
+
useCallback as useCallback18,
|
5298
|
+
useEffect as useEffect24,
|
5299
|
+
useMemo as useMemo19,
|
5267
5300
|
useReducer,
|
5268
5301
|
useState as useState26
|
5269
5302
|
} from "react";
|
@@ -5459,36 +5492,61 @@ init_react_import();
|
|
5459
5492
|
|
5460
5493
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
5461
5494
|
init_react_import();
|
5462
|
-
var styles_module_default16 = { "PuckFields": "
|
5495
|
+
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" };
|
5463
5496
|
|
5464
5497
|
// components/Puck/components/Fields/index.tsx
|
5465
|
-
import {
|
5498
|
+
import { useMemo as useMemo12 } from "react";
|
5499
|
+
|
5500
|
+
// lib/use-resolved-fields.ts
|
5501
|
+
init_react_import();
|
5502
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef5, useState as useState19 } from "react";
|
5466
5503
|
|
5467
5504
|
// lib/use-parent.ts
|
5468
5505
|
init_react_import();
|
5469
|
-
import { useContext as useContext9 } from "react";
|
5470
|
-
var
|
5506
|
+
import { useCallback as useCallback12, useContext as useContext9 } from "react";
|
5507
|
+
var getParent = (itemSelector, pathData, data) => {
|
5471
5508
|
var _a;
|
5472
|
-
|
5473
|
-
const
|
5474
|
-
const
|
5475
|
-
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
5509
|
+
if (!itemSelector) return null;
|
5510
|
+
const item = getItem(itemSelector, data);
|
5511
|
+
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, data);
|
5476
5512
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
5477
|
-
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector,
|
5513
|
+
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, data)) != null ? _a : null : null;
|
5478
5514
|
return parent || null;
|
5479
5515
|
};
|
5516
|
+
var useGetParent = () => {
|
5517
|
+
const { state } = useAppContext();
|
5518
|
+
const { pathData } = useContext9(dropZoneContext) || {};
|
5519
|
+
return useCallback12(
|
5520
|
+
() => getParent(state.ui.itemSelector, pathData, state.data),
|
5521
|
+
[state.ui.itemSelector, pathData, state.data]
|
5522
|
+
);
|
5523
|
+
};
|
5524
|
+
var useParent = () => {
|
5525
|
+
return useGetParent()();
|
5526
|
+
};
|
5480
5527
|
|
5481
|
-
//
|
5482
|
-
|
5483
|
-
|
5528
|
+
// lib/use-on-value-change.ts
|
5529
|
+
init_react_import();
|
5530
|
+
import { useRef as useRef4, useEffect as useEffect16 } from "react";
|
5531
|
+
function useOnValueChange(value, onChange, compare = Object.is, deps = []) {
|
5532
|
+
const tracked = useRef4(value);
|
5533
|
+
useEffect16(() => {
|
5534
|
+
const oldValue = tracked.current;
|
5535
|
+
if (!compare(value, oldValue)) {
|
5536
|
+
tracked.current = value;
|
5537
|
+
onChange(value, oldValue);
|
5538
|
+
}
|
5539
|
+
}, [onChange, compare, value, ...deps]);
|
5540
|
+
}
|
5541
|
+
|
5542
|
+
// lib/selector-is.ts
|
5543
|
+
init_react_import();
|
5544
|
+
var selectorIs = (a, b) => (a == null ? void 0 : a.zone) === (b == null ? void 0 : b.zone) && (a == null ? void 0 : a.index) === (b == null ? void 0 : b.index);
|
5545
|
+
|
5546
|
+
// lib/use-resolved-fields.ts
|
5484
5547
|
var defaultPageFields = {
|
5485
5548
|
title: { type: "text" }
|
5486
5549
|
};
|
5487
|
-
var DefaultFields = ({
|
5488
|
-
children
|
5489
|
-
}) => {
|
5490
|
-
return /* @__PURE__ */ jsx27(Fragment8, { children });
|
5491
|
-
};
|
5492
5550
|
var useResolvedFields = () => {
|
5493
5551
|
var _a, _b;
|
5494
5552
|
const { selectedItem, state, config } = useAppContext();
|
@@ -5504,12 +5562,13 @@ var useResolvedFields = () => {
|
|
5504
5562
|
const [lastSelectedData, setLastSelectedData] = useState19({});
|
5505
5563
|
const [resolvedFields, setResolvedFields] = useState19(defaultFields);
|
5506
5564
|
const [fieldsLoading, setFieldsLoading] = useState19(false);
|
5565
|
+
const lastFields = useRef5(defaultFields);
|
5507
5566
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5508
5567
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
5509
5568
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
5510
5569
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
5511
5570
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
5512
|
-
const resolveFields =
|
5571
|
+
const resolveFields = useCallback13(
|
5513
5572
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
5514
5573
|
var _a2;
|
5515
5574
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
@@ -5521,7 +5580,7 @@ var useResolvedFields = () => {
|
|
5521
5580
|
{
|
5522
5581
|
changed,
|
5523
5582
|
fields,
|
5524
|
-
lastFields:
|
5583
|
+
lastFields: lastFields.current,
|
5525
5584
|
lastData,
|
5526
5585
|
appState: state,
|
5527
5586
|
parent
|
@@ -5532,7 +5591,7 @@ var useResolvedFields = () => {
|
|
5532
5591
|
return yield config.root.resolveFields(componentData, {
|
5533
5592
|
changed,
|
5534
5593
|
fields,
|
5535
|
-
lastFields:
|
5594
|
+
lastFields: lastFields.current,
|
5536
5595
|
lastData,
|
5537
5596
|
appState: state,
|
5538
5597
|
parent
|
@@ -5541,40 +5600,56 @@ var useResolvedFields = () => {
|
|
5541
5600
|
return defaultResolveFields(componentData, {
|
5542
5601
|
changed,
|
5543
5602
|
fields,
|
5544
|
-
lastFields:
|
5603
|
+
lastFields: lastFields.current,
|
5545
5604
|
lastData
|
5546
5605
|
});
|
5547
5606
|
}),
|
5548
|
-
[data, config, componentData, selectedItem,
|
5607
|
+
[data, config, componentData, selectedItem, state, parent]
|
5549
5608
|
);
|
5550
|
-
const
|
5551
|
-
useEffect16(() => {
|
5552
|
-
setHasParent(!!parent);
|
5553
|
-
}, [parent]);
|
5554
|
-
useEffect16(() => {
|
5609
|
+
const triggerResolver = useCallback13(() => {
|
5555
5610
|
var _a2, _b2;
|
5556
|
-
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" ||
|
5611
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || parent) {
|
5557
5612
|
if (hasResolver) {
|
5558
5613
|
setFieldsLoading(true);
|
5559
5614
|
resolveFields(defaultFields).then((fields) => {
|
5560
5615
|
setResolvedFields(fields || {});
|
5616
|
+
lastFields.current = fields;
|
5561
5617
|
setFieldsLoading(false);
|
5562
5618
|
});
|
5563
|
-
|
5564
|
-
setResolvedFields(defaultFields);
|
5619
|
+
return;
|
5565
5620
|
}
|
5566
5621
|
}
|
5567
|
-
|
5568
|
-
|
5569
|
-
|
5622
|
+
setResolvedFields(defaultFields);
|
5623
|
+
}, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
|
5624
|
+
useOnValueChange(
|
5570
5625
|
state.ui.itemSelector,
|
5571
|
-
|
5572
|
-
|
5573
|
-
|
5574
|
-
|
5626
|
+
() => {
|
5627
|
+
lastFields.current = defaultFields;
|
5628
|
+
},
|
5629
|
+
selectorIs
|
5630
|
+
);
|
5631
|
+
useOnValueChange(
|
5632
|
+
{ data, parent, itemSelector: state.ui.itemSelector },
|
5633
|
+
() => {
|
5634
|
+
triggerResolver();
|
5635
|
+
},
|
5636
|
+
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
5637
|
+
);
|
5638
|
+
useEffect17(() => {
|
5639
|
+
triggerResolver();
|
5640
|
+
}, []);
|
5575
5641
|
return [resolvedFields, fieldsLoading];
|
5576
5642
|
};
|
5577
|
-
|
5643
|
+
|
5644
|
+
// components/Puck/components/Fields/index.tsx
|
5645
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
5646
|
+
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
5647
|
+
var DefaultFields = ({
|
5648
|
+
children
|
5649
|
+
}) => {
|
5650
|
+
return /* @__PURE__ */ jsx27(Fragment8, { children });
|
5651
|
+
};
|
5652
|
+
var Fields = ({ wrapFields = true }) => {
|
5578
5653
|
var _a, _b;
|
5579
5654
|
const {
|
5580
5655
|
selectedItem,
|
@@ -5592,11 +5667,11 @@ var Fields = () => {
|
|
5592
5667
|
const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
|
5593
5668
|
const isLoading = fieldsResolving || componentResolving;
|
5594
5669
|
const rootProps = data.root.props || data.root;
|
5595
|
-
const Wrapper =
|
5670
|
+
const Wrapper = useMemo12(() => overrides.fields || DefaultFields, [overrides]);
|
5596
5671
|
return /* @__PURE__ */ jsxs14(
|
5597
5672
|
"form",
|
5598
5673
|
{
|
5599
|
-
className: getClassName21(),
|
5674
|
+
className: getClassName21({ wrapFields }),
|
5600
5675
|
onSubmit: (e) => {
|
5601
5676
|
e.preventDefault();
|
5602
5677
|
},
|
@@ -5615,7 +5690,7 @@ var Fields = () => {
|
|
5615
5690
|
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
5616
5691
|
[fieldName]: value
|
5617
5692
|
});
|
5618
|
-
if (itemSelector) {
|
5693
|
+
if (selectedItem && itemSelector) {
|
5619
5694
|
const replaceActionData = {
|
5620
5695
|
type: "replace",
|
5621
5696
|
destinationIndex: itemSelector.index,
|
@@ -5672,7 +5747,7 @@ var Fields = () => {
|
|
5672
5747
|
item: selectedItem
|
5673
5748
|
});
|
5674
5749
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
5675
|
-
return /* @__PURE__ */ jsx27(
|
5750
|
+
return /* @__PURE__ */ jsx27("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx27(
|
5676
5751
|
AutoFieldPrivate,
|
5677
5752
|
{
|
5678
5753
|
field,
|
@@ -5681,16 +5756,15 @@ var Fields = () => {
|
|
5681
5756
|
readOnly: !edit || readOnly[fieldName],
|
5682
5757
|
value: selectedItem.props[fieldName],
|
5683
5758
|
onChange
|
5684
|
-
}
|
5685
|
-
|
5686
|
-
);
|
5759
|
+
}
|
5760
|
+
) }, id);
|
5687
5761
|
} else {
|
5688
5762
|
const readOnly = data.root.readOnly || {};
|
5689
5763
|
const { edit } = getPermissions({
|
5690
5764
|
root: true
|
5691
5765
|
});
|
5692
5766
|
const id = `root_${field.type}_${fieldName}`;
|
5693
|
-
return /* @__PURE__ */ jsx27(
|
5767
|
+
return /* @__PURE__ */ jsx27("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx27(
|
5694
5768
|
AutoFieldPrivate,
|
5695
5769
|
{
|
5696
5770
|
field,
|
@@ -5699,9 +5773,8 @@ var Fields = () => {
|
|
5699
5773
|
readOnly: !edit || readOnly[fieldName],
|
5700
5774
|
value: rootProps[fieldName],
|
5701
5775
|
onChange
|
5702
|
-
}
|
5703
|
-
|
5704
|
-
);
|
5776
|
+
}
|
5777
|
+
) }, id);
|
5705
5778
|
}
|
5706
5779
|
}) }),
|
5707
5780
|
isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
|
@@ -5715,7 +5788,7 @@ init_react_import();
|
|
5715
5788
|
|
5716
5789
|
// lib/use-component-list.tsx
|
5717
5790
|
init_react_import();
|
5718
|
-
import { useEffect as
|
5791
|
+
import { useEffect as useEffect18, useState as useState20 } from "react";
|
5719
5792
|
|
5720
5793
|
// components/ComponentList/index.tsx
|
5721
5794
|
init_react_import();
|
@@ -5783,7 +5856,7 @@ ComponentList.Item = ComponentListItem;
|
|
5783
5856
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
5784
5857
|
var useComponentList = (config, ui) => {
|
5785
5858
|
const [componentList, setComponentList] = useState20();
|
5786
|
-
|
5859
|
+
useEffect18(() => {
|
5787
5860
|
var _a, _b, _c;
|
5788
5861
|
if (Object.keys(ui.componentList).length > 0) {
|
5789
5862
|
const matchedComponents = [];
|
@@ -5852,25 +5925,25 @@ var useComponentList = (config, ui) => {
|
|
5852
5925
|
};
|
5853
5926
|
|
5854
5927
|
// components/Puck/components/Components/index.tsx
|
5855
|
-
import { useMemo as
|
5928
|
+
import { useMemo as useMemo13 } from "react";
|
5856
5929
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
5857
5930
|
var Components = () => {
|
5858
5931
|
const { config, state, overrides } = useAppContext();
|
5859
5932
|
const componentList = useComponentList(config, state.ui);
|
5860
|
-
const Wrapper =
|
5933
|
+
const Wrapper = useMemo13(() => overrides.components || "div", [overrides]);
|
5861
5934
|
return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
|
5862
5935
|
};
|
5863
5936
|
|
5864
5937
|
// components/Puck/components/Preview/index.tsx
|
5865
5938
|
init_react_import();
|
5866
|
-
import { useCallback as
|
5939
|
+
import { useCallback as useCallback14, useEffect as useEffect20, useRef as useRef7, useMemo as useMemo14 } from "react";
|
5867
5940
|
|
5868
5941
|
// components/AutoFrame/index.tsx
|
5869
5942
|
init_react_import();
|
5870
5943
|
import {
|
5871
5944
|
createContext as createContext5,
|
5872
5945
|
useContext as useContext10,
|
5873
|
-
useEffect as
|
5946
|
+
useEffect as useEffect19,
|
5874
5947
|
useState as useState21
|
5875
5948
|
} from "react";
|
5876
5949
|
import hash from "object-hash";
|
@@ -5918,7 +5991,7 @@ var CopyHostStyles = ({
|
|
5918
5991
|
onStylesLoaded = () => null
|
5919
5992
|
}) => {
|
5920
5993
|
const { document: doc, window: win } = useFrame();
|
5921
|
-
|
5994
|
+
useEffect19(() => {
|
5922
5995
|
if (!win || !doc) {
|
5923
5996
|
return () => {
|
5924
5997
|
};
|
@@ -6098,7 +6171,7 @@ function AutoFrame(_a) {
|
|
6098
6171
|
const [loaded, setLoaded] = useState21(false);
|
6099
6172
|
const [ctx, setCtx] = useState21({});
|
6100
6173
|
const [mountTarget, setMountTarget] = useState21();
|
6101
|
-
|
6174
|
+
useEffect19(() => {
|
6102
6175
|
var _a2;
|
6103
6176
|
if (frameRef.current) {
|
6104
6177
|
setCtx({
|
@@ -6192,15 +6265,22 @@ import { Fragment as Fragment10, jsx as jsx33 } from "react/jsx-runtime";
|
|
6192
6265
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
6193
6266
|
var useBubbleIframeEvents = (ref) => {
|
6194
6267
|
const { status } = useAppContext();
|
6195
|
-
|
6268
|
+
useEffect20(() => {
|
6196
6269
|
var _a;
|
6197
6270
|
if (ref.current && status === "READY") {
|
6198
6271
|
const iframe = ref.current;
|
6199
6272
|
class BubbledPointerEventClass extends PointerEvent {
|
6200
6273
|
constructor(type, data) {
|
6201
6274
|
super(type, data);
|
6275
|
+
this._originalTarget = null;
|
6202
6276
|
this.originalTarget = data.originalTarget;
|
6203
6277
|
}
|
6278
|
+
set originalTarget(target) {
|
6279
|
+
this._originalTarget = target;
|
6280
|
+
}
|
6281
|
+
get originalTarget() {
|
6282
|
+
return this._originalTarget;
|
6283
|
+
}
|
6204
6284
|
}
|
6205
6285
|
const handlePointerMove = (event) => {
|
6206
6286
|
const evt = new BubbledPointerEventClass("pointermove", __spreadProps(__spreadValues({}, event), {
|
@@ -6231,7 +6311,7 @@ var useBubbleIframeEvents = (ref) => {
|
|
6231
6311
|
};
|
6232
6312
|
var Preview2 = ({ id = "puck-preview" }) => {
|
6233
6313
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
6234
|
-
const Page =
|
6314
|
+
const Page = useCallback14(
|
6235
6315
|
(pageProps) => {
|
6236
6316
|
var _a, _b;
|
6237
6317
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
@@ -6240,9 +6320,9 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
6240
6320
|
},
|
6241
6321
|
[config.root]
|
6242
6322
|
);
|
6243
|
-
const Frame =
|
6323
|
+
const Frame = useMemo14(() => overrides.iframe, [overrides]);
|
6244
6324
|
const rootProps = state.data.root.props || state.data.root;
|
6245
|
-
const ref =
|
6325
|
+
const ref = useRef7(null);
|
6246
6326
|
useBubbleIframeEvents(ref);
|
6247
6327
|
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx33(
|
6248
6328
|
Page,
|
@@ -6492,13 +6572,13 @@ var LayerTree = ({
|
|
6492
6572
|
};
|
6493
6573
|
|
6494
6574
|
// components/Puck/components/Outline/index.tsx
|
6495
|
-
import { useCallback as
|
6575
|
+
import { useCallback as useCallback15, useMemo as useMemo15 } from "react";
|
6496
6576
|
import { Fragment as Fragment12, jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
6497
6577
|
var Outline = () => {
|
6498
6578
|
const { dispatch, state, overrides, config } = useAppContext();
|
6499
6579
|
const { data, ui } = state;
|
6500
6580
|
const { itemSelector } = ui;
|
6501
|
-
const setItemSelector =
|
6581
|
+
const setItemSelector = useCallback15(
|
6502
6582
|
(newItemSelector) => {
|
6503
6583
|
dispatch({
|
6504
6584
|
type: "setUi",
|
@@ -6507,7 +6587,7 @@ var Outline = () => {
|
|
6507
6587
|
},
|
6508
6588
|
[]
|
6509
6589
|
);
|
6510
|
-
const Wrapper =
|
6590
|
+
const Wrapper = useMemo15(() => overrides.outline || "div", [overrides]);
|
6511
6591
|
return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
|
6512
6592
|
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
|
6513
6593
|
LayerTree,
|
@@ -6794,16 +6874,16 @@ var getBox = function getBox2(el) {
|
|
6794
6874
|
|
6795
6875
|
// components/Puck/components/Canvas/index.tsx
|
6796
6876
|
import {
|
6797
|
-
useCallback as
|
6798
|
-
useEffect as
|
6799
|
-
useMemo as
|
6800
|
-
useRef as
|
6877
|
+
useCallback as useCallback16,
|
6878
|
+
useEffect as useEffect22,
|
6879
|
+
useMemo as useMemo17,
|
6880
|
+
useRef as useRef8,
|
6801
6881
|
useState as useState24
|
6802
6882
|
} from "react";
|
6803
6883
|
|
6804
6884
|
// components/ViewportControls/index.tsx
|
6805
6885
|
init_react_import();
|
6806
|
-
import { useEffect as
|
6886
|
+
import { useEffect as useEffect21, useMemo as useMemo16, useState as useState23 } from "react";
|
6807
6887
|
|
6808
6888
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
6809
6889
|
init_react_import();
|
@@ -6827,7 +6907,7 @@ var ViewportButton = ({
|
|
6827
6907
|
}) => {
|
6828
6908
|
const { state } = useAppContext();
|
6829
6909
|
const [isActive, setIsActive] = useState23(false);
|
6830
|
-
|
6910
|
+
useEffect21(() => {
|
6831
6911
|
setIsActive(width === state.ui.viewports.current.width);
|
6832
6912
|
}, [width, state.ui.viewports.current.width]);
|
6833
6913
|
return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
|
@@ -6863,7 +6943,7 @@ var ViewportControls = ({
|
|
6863
6943
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
6864
6944
|
(option) => option.value === autoZoom
|
6865
6945
|
);
|
6866
|
-
const zoomOptions =
|
6946
|
+
const zoomOptions = useMemo16(
|
6867
6947
|
() => [
|
6868
6948
|
...defaultZoomOptions,
|
6869
6949
|
...defaultsContainAutoZoom ? [] : [
|
@@ -6986,17 +7066,17 @@ var Canvas = () => {
|
|
6986
7066
|
const { status, iframe } = useAppContext();
|
6987
7067
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
6988
7068
|
const { ui } = state;
|
6989
|
-
const frameRef =
|
7069
|
+
const frameRef = useRef8(null);
|
6990
7070
|
const [showTransition, setShowTransition] = useState24(false);
|
6991
|
-
const defaultRender =
|
7071
|
+
const defaultRender = useMemo17(() => {
|
6992
7072
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
|
6993
7073
|
return PuckDefault;
|
6994
7074
|
}, []);
|
6995
|
-
const CustomPreview =
|
7075
|
+
const CustomPreview = useMemo17(
|
6996
7076
|
() => overrides.preview || defaultRender,
|
6997
7077
|
[overrides]
|
6998
7078
|
);
|
6999
|
-
const getFrameDimensions =
|
7079
|
+
const getFrameDimensions = useCallback16(() => {
|
7000
7080
|
if (frameRef.current) {
|
7001
7081
|
const frame = frameRef.current;
|
7002
7082
|
const box = getBox(frame);
|
@@ -7004,7 +7084,7 @@ var Canvas = () => {
|
|
7004
7084
|
}
|
7005
7085
|
return { width: 0, height: 0 };
|
7006
7086
|
}, [frameRef]);
|
7007
|
-
const resetAutoZoom =
|
7087
|
+
const resetAutoZoom = useCallback16(
|
7008
7088
|
(ui2 = state.ui) => {
|
7009
7089
|
if (frameRef.current) {
|
7010
7090
|
setZoomConfig(
|
@@ -7014,11 +7094,11 @@ var Canvas = () => {
|
|
7014
7094
|
},
|
7015
7095
|
[frameRef, zoomConfig, state.ui]
|
7016
7096
|
);
|
7017
|
-
|
7097
|
+
useEffect22(() => {
|
7018
7098
|
setShowTransition(false);
|
7019
7099
|
resetAutoZoom();
|
7020
7100
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
7021
|
-
|
7101
|
+
useEffect22(() => {
|
7022
7102
|
const { height: frameHeight } = getFrameDimensions();
|
7023
7103
|
if (ui.viewports.current.height === "auto") {
|
7024
7104
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -7026,13 +7106,13 @@ var Canvas = () => {
|
|
7026
7106
|
}));
|
7027
7107
|
}
|
7028
7108
|
}, [zoomConfig.zoom]);
|
7029
|
-
|
7109
|
+
useEffect22(() => {
|
7030
7110
|
if (ZOOM_ON_CHANGE) {
|
7031
7111
|
setShowTransition(true);
|
7032
7112
|
resetAutoZoom(ui);
|
7033
7113
|
}
|
7034
7114
|
}, [ui.viewports.current.width]);
|
7035
|
-
|
7115
|
+
useEffect22(() => {
|
7036
7116
|
const cb = () => {
|
7037
7117
|
setShowTransition(false);
|
7038
7118
|
resetAutoZoom();
|
@@ -7043,7 +7123,7 @@ var Canvas = () => {
|
|
7043
7123
|
};
|
7044
7124
|
}, []);
|
7045
7125
|
const [showLoader, setShowLoader] = useState24(false);
|
7046
|
-
|
7126
|
+
useEffect22(() => {
|
7047
7127
|
setTimeout(() => {
|
7048
7128
|
setShowLoader(true);
|
7049
7129
|
}, 500);
|
@@ -7121,7 +7201,7 @@ var Canvas = () => {
|
|
7121
7201
|
|
7122
7202
|
// lib/use-loaded-overrides.ts
|
7123
7203
|
init_react_import();
|
7124
|
-
import { useMemo as
|
7204
|
+
import { useMemo as useMemo18 } from "react";
|
7125
7205
|
|
7126
7206
|
// lib/load-overrides.ts
|
7127
7207
|
init_react_import();
|
@@ -7160,7 +7240,7 @@ var useLoadedOverrides = ({
|
|
7160
7240
|
overrides,
|
7161
7241
|
plugins
|
7162
7242
|
}) => {
|
7163
|
-
return
|
7243
|
+
return useMemo18(() => {
|
7164
7244
|
return loadOverrides({ overrides, plugins });
|
7165
7245
|
}, [plugins, overrides]);
|
7166
7246
|
};
|
@@ -7172,14 +7252,14 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { chil
|
|
7172
7252
|
|
7173
7253
|
// lib/use-inject-css.ts
|
7174
7254
|
init_react_import();
|
7175
|
-
import { useEffect as
|
7255
|
+
import { useEffect as useEffect23, useState as useState25 } from "react";
|
7176
7256
|
var styles = ``;
|
7177
7257
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7178
7258
|
const [el, setEl] = useState25();
|
7179
|
-
|
7259
|
+
useEffect23(() => {
|
7180
7260
|
setEl(document.createElement("style"));
|
7181
7261
|
}, []);
|
7182
|
-
|
7262
|
+
useEffect23(() => {
|
7183
7263
|
var _a;
|
7184
7264
|
if (!el || typeof window === "undefined") {
|
7185
7265
|
return;
|
@@ -7199,10 +7279,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
7199
7279
|
|
7200
7280
|
// lib/use-preview-mode-hotkeys.ts
|
7201
7281
|
init_react_import();
|
7202
|
-
import { useCallback as
|
7282
|
+
import { useCallback as useCallback17 } from "react";
|
7203
7283
|
import { useHotkeys as useHotkeys2 } from "react-hotkeys-hook";
|
7204
7284
|
var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
7205
|
-
const toggleInteractive =
|
7285
|
+
const toggleInteractive = useCallback17(() => {
|
7206
7286
|
dispatch({
|
7207
7287
|
type: "setUi",
|
7208
7288
|
ui: (ui) => ({
|
@@ -7347,11 +7427,11 @@ function Puck({
|
|
7347
7427
|
const [menuOpen, setMenuOpen] = useState26(false);
|
7348
7428
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
7349
7429
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
7350
|
-
|
7430
|
+
useEffect24(() => {
|
7351
7431
|
if (onChange) onChange(data);
|
7352
7432
|
}, [data]);
|
7353
7433
|
const rootProps = data.root.props || data.root;
|
7354
|
-
const toggleSidebars =
|
7434
|
+
const toggleSidebars = useCallback18(
|
7355
7435
|
(sidebar) => {
|
7356
7436
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
7357
7437
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -7365,7 +7445,7 @@ function Puck({
|
|
7365
7445
|
},
|
7366
7446
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
7367
7447
|
);
|
7368
|
-
|
7448
|
+
useEffect24(() => {
|
7369
7449
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
7370
7450
|
dispatch({
|
7371
7451
|
type: "setUi",
|
@@ -7388,7 +7468,7 @@ function Puck({
|
|
7388
7468
|
window.removeEventListener("resize", handleResize);
|
7389
7469
|
};
|
7390
7470
|
}, []);
|
7391
|
-
const defaultHeaderRender =
|
7471
|
+
const defaultHeaderRender = useMemo19(() => {
|
7392
7472
|
if (renderHeader) {
|
7393
7473
|
console.warn(
|
7394
7474
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -7402,7 +7482,7 @@ function Puck({
|
|
7402
7482
|
}
|
7403
7483
|
return DefaultOverride;
|
7404
7484
|
}, [renderHeader]);
|
7405
|
-
const defaultHeaderActionsRender =
|
7485
|
+
const defaultHeaderActionsRender = useMemo19(() => {
|
7406
7486
|
if (renderHeaderActions) {
|
7407
7487
|
console.warn(
|
7408
7488
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
@@ -7419,20 +7499,20 @@ function Puck({
|
|
7419
7499
|
overrides,
|
7420
7500
|
plugins
|
7421
7501
|
});
|
7422
|
-
const CustomPuck =
|
7502
|
+
const CustomPuck = useMemo19(
|
7423
7503
|
() => loadedOverrides.puck || DefaultOverride,
|
7424
7504
|
[loadedOverrides]
|
7425
7505
|
);
|
7426
|
-
const CustomHeader =
|
7506
|
+
const CustomHeader = useMemo19(
|
7427
7507
|
() => loadedOverrides.header || defaultHeaderRender,
|
7428
7508
|
[loadedOverrides]
|
7429
7509
|
);
|
7430
|
-
const CustomHeaderActions =
|
7510
|
+
const CustomHeaderActions = useMemo19(
|
7431
7511
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7432
7512
|
[loadedOverrides]
|
7433
7513
|
);
|
7434
7514
|
const [mounted, setMounted] = useState26(false);
|
7435
|
-
|
7515
|
+
useEffect24(() => {
|
7436
7516
|
setMounted(true);
|
7437
7517
|
}, []);
|
7438
7518
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|