@measured/puck 0.18.0-canary.63b8b9a → 0.18.0-canary.88863c3
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 +3 -3
- package/dist/index.css +44 -47
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +196 -137
- package/dist/index.mjs +187 -128
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -308,7 +308,7 @@ init_react_import();
|
|
308
308
|
|
309
309
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
310
310
|
init_react_import();
|
311
|
-
var styles_module_default2 = { "InputWrapper": "
|
311
|
+
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" };
|
312
312
|
|
313
313
|
// components/AutoField/index.tsx
|
314
314
|
var import_react20 = require("react");
|
@@ -1697,12 +1697,13 @@ var DefaultField = ({
|
|
1697
1697
|
field,
|
1698
1698
|
onChange,
|
1699
1699
|
readOnly,
|
1700
|
-
value,
|
1700
|
+
value: _value,
|
1701
1701
|
name,
|
1702
1702
|
label,
|
1703
1703
|
Label: Label2,
|
1704
1704
|
id
|
1705
1705
|
}) => {
|
1706
|
+
const value = _value;
|
1706
1707
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
1707
1708
|
Label2,
|
1708
1709
|
{
|
@@ -1720,7 +1721,7 @@ var DefaultField = ({
|
|
1720
1721
|
type: field.type,
|
1721
1722
|
title: label || name,
|
1722
1723
|
name,
|
1723
|
-
value:
|
1724
|
+
value: (value == null ? void 0 : value.toString) ? value.toString() : "",
|
1724
1725
|
onChange: (e) => {
|
1725
1726
|
if (field.type === "number") {
|
1726
1727
|
const numberValue = Number(e.currentTarget.value);
|
@@ -3255,13 +3256,19 @@ var DraggableComponent = ({
|
|
3255
3256
|
}
|
3256
3257
|
}, [ref.current]);
|
3257
3258
|
(0, import_react23.useEffect)(() => {
|
3258
|
-
|
3259
|
-
|
3259
|
+
ctx == null ? void 0 : ctx.registerPath(
|
3260
|
+
id,
|
3261
|
+
{
|
3260
3262
|
index,
|
3261
3263
|
zone: zoneCompound
|
3262
|
-
}
|
3263
|
-
|
3264
|
-
|
3264
|
+
},
|
3265
|
+
componentType
|
3266
|
+
);
|
3267
|
+
return () => {
|
3268
|
+
var _a;
|
3269
|
+
(_a = ctx == null ? void 0 : ctx.unregisterPath) == null ? void 0 : _a.call(ctx, id);
|
3270
|
+
};
|
3271
|
+
}, [id, zoneCompound, index, componentType]);
|
3265
3272
|
const CustomActionBar = (0, import_react23.useMemo)(
|
3266
3273
|
() => overrides.actionBar || DefaultActionBar,
|
3267
3274
|
[overrides.actionBar]
|
@@ -3823,7 +3830,7 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3823
3830
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
|
3824
3831
|
}),
|
3825
3832
|
children: contentWithPreview.map((item, i) => {
|
3826
|
-
var _a, _b, _c, _d, _e;
|
3833
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
3827
3834
|
const componentId = item.props.id;
|
3828
3835
|
const puckProps = {
|
3829
3836
|
renderDropZone: DropZoneEditPure,
|
@@ -3843,13 +3850,13 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3843
3850
|
const componentConfig = config.components[item.type];
|
3844
3851
|
let componentType = item.type;
|
3845
3852
|
let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
3846
|
-
if (item.type === "preview"
|
3853
|
+
if (item.type === "preview") {
|
3847
3854
|
let Preview4 = function() {
|
3848
3855
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
|
3849
3856
|
};
|
3850
3857
|
var Preview3 = Preview4;
|
3851
|
-
componentType = preview.componentType;
|
3852
|
-
label = (
|
3858
|
+
componentType = (_c = preview == null ? void 0 : preview.componentType) != null ? _c : "__preview";
|
3859
|
+
label = (_f = (_e = (_d = config.components[componentType]) == null ? void 0 : _d.label) != null ? _e : componentType) != null ? _f : "Preview";
|
3853
3860
|
Render2 = Preview4;
|
3854
3861
|
}
|
3855
3862
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
@@ -3864,7 +3871,7 @@ var DropZoneEdit = (0, import_react29.forwardRef)(
|
|
3864
3871
|
zoneCompound,
|
3865
3872
|
depth: depth + 1,
|
3866
3873
|
index: i,
|
3867
|
-
isLoading: ((
|
3874
|
+
isLoading: ((_g = appContext2.componentState[componentId]) == null ? void 0 : _g.loadingCount) > 0,
|
3868
3875
|
isSelected,
|
3869
3876
|
label,
|
3870
3877
|
isEnabled,
|
@@ -4507,6 +4514,11 @@ var reduceUi = (ui, action) => {
|
|
4507
4514
|
itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
|
4508
4515
|
});
|
4509
4516
|
}
|
4517
|
+
if (action.type === "remove") {
|
4518
|
+
return __spreadProps(__spreadValues({}, ui), {
|
4519
|
+
itemSelector: null
|
4520
|
+
});
|
4521
|
+
}
|
4510
4522
|
return ui;
|
4511
4523
|
};
|
4512
4524
|
|
@@ -5038,27 +5050,33 @@ var DragDropContextClient = ({
|
|
5038
5050
|
const [pathData, setPathData] = (0, import_react31.useState)();
|
5039
5051
|
const dragMode = (0, import_react31.useRef)(null);
|
5040
5052
|
const registerPath = (0, import_react31.useCallback)(
|
5041
|
-
(selector) => {
|
5042
|
-
const item = getItem(selector, data);
|
5043
|
-
if (!item) {
|
5044
|
-
return;
|
5045
|
-
}
|
5053
|
+
(id2, selector, label) => {
|
5046
5054
|
const [area] = getZoneId(selector.zone);
|
5047
5055
|
setPathData((latestPathData = {}) => {
|
5048
5056
|
const parentPathData = latestPathData[area] || { path: [] };
|
5049
5057
|
return __spreadProps(__spreadValues({}, latestPathData), {
|
5050
|
-
[
|
5058
|
+
[id2]: {
|
5051
5059
|
path: [
|
5052
5060
|
...parentPathData.path,
|
5053
5061
|
...selector.zone ? [selector.zone] : []
|
5054
5062
|
],
|
5055
|
-
label
|
5063
|
+
label
|
5056
5064
|
}
|
5057
5065
|
});
|
5058
5066
|
});
|
5059
5067
|
},
|
5060
5068
|
[data, setPathData]
|
5061
5069
|
);
|
5070
|
+
const unregisterPath = (0, import_react31.useCallback)(
|
5071
|
+
(id2) => {
|
5072
|
+
setPathData((latestPathData = {}) => {
|
5073
|
+
const newPathData = __spreadValues({}, latestPathData);
|
5074
|
+
delete newPathData[id2];
|
5075
|
+
return newPathData;
|
5076
|
+
});
|
5077
|
+
},
|
5078
|
+
[data, setPathData]
|
5079
|
+
);
|
5062
5080
|
const initialSelector = (0, import_react31.useRef)(void 0);
|
5063
5081
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
5064
5082
|
dragListenerContext.Provider,
|
@@ -5255,6 +5273,7 @@ var DragDropContextClient = ({
|
|
5255
5273
|
areaId: "root",
|
5256
5274
|
depth: 0,
|
5257
5275
|
registerPath,
|
5276
|
+
unregisterPath,
|
5258
5277
|
pathData,
|
5259
5278
|
path: []
|
5260
5279
|
},
|
@@ -5403,7 +5422,7 @@ Drawer.Item = DrawerItem;
|
|
5403
5422
|
|
5404
5423
|
// components/Puck/index.tsx
|
5405
5424
|
init_react_import();
|
5406
|
-
var
|
5425
|
+
var import_react50 = require("react");
|
5407
5426
|
|
5408
5427
|
// components/SidebarSection/index.tsx
|
5409
5428
|
init_react_import();
|
@@ -5596,36 +5615,61 @@ init_react_import();
|
|
5596
5615
|
|
5597
5616
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
5598
5617
|
init_react_import();
|
5599
|
-
var styles_module_default16 = { "PuckFields": "
|
5618
|
+
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" };
|
5600
5619
|
|
5601
5620
|
// components/Puck/components/Fields/index.tsx
|
5602
|
-
var
|
5621
|
+
var import_react37 = require("react");
|
5622
|
+
|
5623
|
+
// lib/use-resolved-fields.ts
|
5624
|
+
init_react_import();
|
5625
|
+
var import_react36 = require("react");
|
5603
5626
|
|
5604
5627
|
// lib/use-parent.ts
|
5605
5628
|
init_react_import();
|
5606
5629
|
var import_react34 = require("react");
|
5607
|
-
var
|
5630
|
+
var getParent = (itemSelector, pathData, data) => {
|
5608
5631
|
var _a;
|
5609
|
-
|
5610
|
-
const
|
5611
|
-
const
|
5612
|
-
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
5632
|
+
if (!itemSelector) return null;
|
5633
|
+
const item = getItem(itemSelector, data);
|
5634
|
+
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, data);
|
5613
5635
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
5614
|
-
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector,
|
5636
|
+
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, data)) != null ? _a : null : null;
|
5615
5637
|
return parent || null;
|
5616
5638
|
};
|
5639
|
+
var useGetParent = () => {
|
5640
|
+
const { state } = useAppContext();
|
5641
|
+
const { pathData } = (0, import_react34.useContext)(dropZoneContext) || {};
|
5642
|
+
return (0, import_react34.useCallback)(
|
5643
|
+
() => getParent(state.ui.itemSelector, pathData, state.data),
|
5644
|
+
[state.ui.itemSelector, pathData, state.data]
|
5645
|
+
);
|
5646
|
+
};
|
5647
|
+
var useParent = () => {
|
5648
|
+
return useGetParent()();
|
5649
|
+
};
|
5617
5650
|
|
5618
|
-
//
|
5619
|
-
|
5620
|
-
var
|
5651
|
+
// lib/use-on-value-change.ts
|
5652
|
+
init_react_import();
|
5653
|
+
var import_react35 = require("react");
|
5654
|
+
function useOnValueChange(value, onChange, compare = Object.is, deps = []) {
|
5655
|
+
const tracked = (0, import_react35.useRef)(value);
|
5656
|
+
(0, import_react35.useEffect)(() => {
|
5657
|
+
const oldValue = tracked.current;
|
5658
|
+
if (!compare(value, oldValue)) {
|
5659
|
+
tracked.current = value;
|
5660
|
+
onChange(value, oldValue);
|
5661
|
+
}
|
5662
|
+
}, [onChange, compare, value, ...deps]);
|
5663
|
+
}
|
5664
|
+
|
5665
|
+
// lib/selector-is.ts
|
5666
|
+
init_react_import();
|
5667
|
+
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);
|
5668
|
+
|
5669
|
+
// lib/use-resolved-fields.ts
|
5621
5670
|
var defaultPageFields = {
|
5622
5671
|
title: { type: "text" }
|
5623
5672
|
};
|
5624
|
-
var DefaultFields = ({
|
5625
|
-
children
|
5626
|
-
}) => {
|
5627
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
|
5628
|
-
};
|
5629
5673
|
var useResolvedFields = () => {
|
5630
5674
|
var _a, _b;
|
5631
5675
|
const { selectedItem, state, config } = useAppContext();
|
@@ -5633,20 +5677,21 @@ var useResolvedFields = () => {
|
|
5633
5677
|
const { data } = state;
|
5634
5678
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
5635
5679
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
5636
|
-
const defaultFields = (0,
|
5680
|
+
const defaultFields = (0, import_react36.useMemo)(
|
5637
5681
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
5638
5682
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
5639
5683
|
);
|
5640
5684
|
const rootProps = data.root.props || data.root;
|
5641
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
5642
|
-
const [resolvedFields, setResolvedFields] = (0,
|
5643
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
5685
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react36.useState)({});
|
5686
|
+
const [resolvedFields, setResolvedFields] = (0, import_react36.useState)(defaultFields);
|
5687
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react36.useState)(false);
|
5688
|
+
const lastFields = (0, import_react36.useRef)(defaultFields);
|
5644
5689
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
5645
5690
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
5646
5691
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
5647
5692
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
5648
5693
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
5649
|
-
const resolveFields = (0,
|
5694
|
+
const resolveFields = (0, import_react36.useCallback)(
|
5650
5695
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
5651
5696
|
var _a2;
|
5652
5697
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
@@ -5658,7 +5703,7 @@ var useResolvedFields = () => {
|
|
5658
5703
|
{
|
5659
5704
|
changed,
|
5660
5705
|
fields,
|
5661
|
-
lastFields:
|
5706
|
+
lastFields: lastFields.current,
|
5662
5707
|
lastData,
|
5663
5708
|
appState: state,
|
5664
5709
|
parent
|
@@ -5669,7 +5714,7 @@ var useResolvedFields = () => {
|
|
5669
5714
|
return yield config.root.resolveFields(componentData, {
|
5670
5715
|
changed,
|
5671
5716
|
fields,
|
5672
|
-
lastFields:
|
5717
|
+
lastFields: lastFields.current,
|
5673
5718
|
lastData,
|
5674
5719
|
appState: state,
|
5675
5720
|
parent
|
@@ -5678,40 +5723,56 @@ var useResolvedFields = () => {
|
|
5678
5723
|
return defaultResolveFields(componentData, {
|
5679
5724
|
changed,
|
5680
5725
|
fields,
|
5681
|
-
lastFields:
|
5726
|
+
lastFields: lastFields.current,
|
5682
5727
|
lastData
|
5683
5728
|
});
|
5684
5729
|
}),
|
5685
|
-
[data, config, componentData, selectedItem,
|
5730
|
+
[data, config, componentData, selectedItem, state, parent]
|
5686
5731
|
);
|
5687
|
-
const
|
5688
|
-
(0, import_react35.useEffect)(() => {
|
5689
|
-
setHasParent(!!parent);
|
5690
|
-
}, [parent]);
|
5691
|
-
(0, import_react35.useEffect)(() => {
|
5732
|
+
const triggerResolver = (0, import_react36.useCallback)(() => {
|
5692
5733
|
var _a2, _b2;
|
5693
|
-
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" ||
|
5734
|
+
if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || parent) {
|
5694
5735
|
if (hasResolver) {
|
5695
5736
|
setFieldsLoading(true);
|
5696
5737
|
resolveFields(defaultFields).then((fields) => {
|
5697
5738
|
setResolvedFields(fields || {});
|
5739
|
+
lastFields.current = fields;
|
5698
5740
|
setFieldsLoading(false);
|
5699
5741
|
});
|
5700
|
-
|
5701
|
-
setResolvedFields(defaultFields);
|
5742
|
+
return;
|
5702
5743
|
}
|
5703
5744
|
}
|
5704
|
-
|
5705
|
-
|
5706
|
-
|
5745
|
+
setResolvedFields(defaultFields);
|
5746
|
+
}, [defaultFields, state.ui.itemSelector, hasResolver, parent]);
|
5747
|
+
useOnValueChange(
|
5707
5748
|
state.ui.itemSelector,
|
5708
|
-
|
5709
|
-
|
5710
|
-
|
5711
|
-
|
5749
|
+
() => {
|
5750
|
+
lastFields.current = defaultFields;
|
5751
|
+
},
|
5752
|
+
selectorIs
|
5753
|
+
);
|
5754
|
+
useOnValueChange(
|
5755
|
+
{ data, parent, itemSelector: state.ui.itemSelector },
|
5756
|
+
() => {
|
5757
|
+
triggerResolver();
|
5758
|
+
},
|
5759
|
+
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
5760
|
+
);
|
5761
|
+
(0, import_react36.useEffect)(() => {
|
5762
|
+
triggerResolver();
|
5763
|
+
}, []);
|
5712
5764
|
return [resolvedFields, fieldsLoading];
|
5713
5765
|
};
|
5714
|
-
|
5766
|
+
|
5767
|
+
// components/Puck/components/Fields/index.tsx
|
5768
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
5769
|
+
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
5770
|
+
var DefaultFields = ({
|
5771
|
+
children
|
5772
|
+
}) => {
|
5773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
|
5774
|
+
};
|
5775
|
+
var Fields = ({ wrapFields = true }) => {
|
5715
5776
|
var _a, _b;
|
5716
5777
|
const {
|
5717
5778
|
selectedItem,
|
@@ -5729,11 +5790,11 @@ var Fields = () => {
|
|
5729
5790
|
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;
|
5730
5791
|
const isLoading = fieldsResolving || componentResolving;
|
5731
5792
|
const rootProps = data.root.props || data.root;
|
5732
|
-
const Wrapper = (0,
|
5793
|
+
const Wrapper = (0, import_react37.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
5733
5794
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
5734
5795
|
"form",
|
5735
5796
|
{
|
5736
|
-
className: getClassName21(),
|
5797
|
+
className: getClassName21({ wrapFields }),
|
5737
5798
|
onSubmit: (e) => {
|
5738
5799
|
e.preventDefault();
|
5739
5800
|
},
|
@@ -5809,7 +5870,7 @@ var Fields = () => {
|
|
5809
5870
|
item: selectedItem
|
5810
5871
|
});
|
5811
5872
|
const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
|
5812
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
5873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
5813
5874
|
AutoFieldPrivate,
|
5814
5875
|
{
|
5815
5876
|
field,
|
@@ -5818,16 +5879,15 @@ var Fields = () => {
|
|
5818
5879
|
readOnly: !edit || readOnly[fieldName],
|
5819
5880
|
value: selectedItem.props[fieldName],
|
5820
5881
|
onChange
|
5821
|
-
}
|
5822
|
-
|
5823
|
-
);
|
5882
|
+
}
|
5883
|
+
) }, id);
|
5824
5884
|
} else {
|
5825
5885
|
const readOnly = data.root.readOnly || {};
|
5826
5886
|
const { edit } = getPermissions({
|
5827
5887
|
root: true
|
5828
5888
|
});
|
5829
5889
|
const id = `root_${field.type}_${fieldName}`;
|
5830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
5890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("field"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
5831
5891
|
AutoFieldPrivate,
|
5832
5892
|
{
|
5833
5893
|
field,
|
@@ -5836,9 +5896,8 @@ var Fields = () => {
|
|
5836
5896
|
readOnly: !edit || readOnly[fieldName],
|
5837
5897
|
value: rootProps[fieldName],
|
5838
5898
|
onChange
|
5839
|
-
}
|
5840
|
-
|
5841
|
-
);
|
5899
|
+
}
|
5900
|
+
) }, id);
|
5842
5901
|
}
|
5843
5902
|
}) }),
|
5844
5903
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Loader, { size: 16 }) }) })
|
@@ -5852,7 +5911,7 @@ init_react_import();
|
|
5852
5911
|
|
5853
5912
|
// lib/use-component-list.tsx
|
5854
5913
|
init_react_import();
|
5855
|
-
var
|
5914
|
+
var import_react38 = require("react");
|
5856
5915
|
|
5857
5916
|
// components/ComponentList/index.tsx
|
5858
5917
|
init_react_import();
|
@@ -5919,8 +5978,8 @@ ComponentList.Item = ComponentListItem;
|
|
5919
5978
|
// lib/use-component-list.tsx
|
5920
5979
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
5921
5980
|
var useComponentList = (config, ui) => {
|
5922
|
-
const [componentList, setComponentList] = (0,
|
5923
|
-
(0,
|
5981
|
+
const [componentList, setComponentList] = (0, import_react38.useState)();
|
5982
|
+
(0, import_react38.useEffect)(() => {
|
5924
5983
|
var _a, _b, _c;
|
5925
5984
|
if (Object.keys(ui.componentList).length > 0) {
|
5926
5985
|
const matchedComponents = [];
|
@@ -5989,22 +6048,22 @@ var useComponentList = (config, ui) => {
|
|
5989
6048
|
};
|
5990
6049
|
|
5991
6050
|
// components/Puck/components/Components/index.tsx
|
5992
|
-
var
|
6051
|
+
var import_react39 = require("react");
|
5993
6052
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
5994
6053
|
var Components = () => {
|
5995
6054
|
const { config, state, overrides } = useAppContext();
|
5996
6055
|
const componentList = useComponentList(config, state.ui);
|
5997
|
-
const Wrapper = (0,
|
6056
|
+
const Wrapper = (0, import_react39.useMemo)(() => overrides.components || "div", [overrides]);
|
5998
6057
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
|
5999
6058
|
};
|
6000
6059
|
|
6001
6060
|
// components/Puck/components/Preview/index.tsx
|
6002
6061
|
init_react_import();
|
6003
|
-
var
|
6062
|
+
var import_react41 = require("react");
|
6004
6063
|
|
6005
6064
|
// components/AutoFrame/index.tsx
|
6006
6065
|
init_react_import();
|
6007
|
-
var
|
6066
|
+
var import_react40 = require("react");
|
6008
6067
|
var import_object_hash = __toESM(require("object-hash"));
|
6009
6068
|
var import_react_dom3 = require("react-dom");
|
6010
6069
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
@@ -6050,7 +6109,7 @@ var CopyHostStyles = ({
|
|
6050
6109
|
onStylesLoaded = () => null
|
6051
6110
|
}) => {
|
6052
6111
|
const { document: doc, window: win } = useFrame();
|
6053
|
-
(0,
|
6112
|
+
(0, import_react40.useEffect)(() => {
|
6054
6113
|
if (!win || !doc) {
|
6055
6114
|
return () => {
|
6056
6115
|
};
|
@@ -6209,8 +6268,8 @@ var CopyHostStyles = ({
|
|
6209
6268
|
}, []);
|
6210
6269
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
6211
6270
|
};
|
6212
|
-
var autoFrameContext = (0,
|
6213
|
-
var useFrame = () => (0,
|
6271
|
+
var autoFrameContext = (0, import_react40.createContext)({});
|
6272
|
+
var useFrame = () => (0, import_react40.useContext)(autoFrameContext);
|
6214
6273
|
function AutoFrame(_a) {
|
6215
6274
|
var _b = _a, {
|
6216
6275
|
children,
|
@@ -6227,10 +6286,10 @@ function AutoFrame(_a) {
|
|
6227
6286
|
"onStylesLoaded",
|
6228
6287
|
"frameRef"
|
6229
6288
|
]);
|
6230
|
-
const [loaded, setLoaded] = (0,
|
6231
|
-
const [ctx, setCtx] = (0,
|
6232
|
-
const [mountTarget, setMountTarget] = (0,
|
6233
|
-
(0,
|
6289
|
+
const [loaded, setLoaded] = (0, import_react40.useState)(false);
|
6290
|
+
const [ctx, setCtx] = (0, import_react40.useState)({});
|
6291
|
+
const [mountTarget, setMountTarget] = (0, import_react40.useState)();
|
6292
|
+
(0, import_react40.useEffect)(() => {
|
6234
6293
|
var _a2;
|
6235
6294
|
if (frameRef.current) {
|
6236
6295
|
setCtx({
|
@@ -6324,7 +6383,7 @@ var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6324
6383
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
6325
6384
|
var useBubbleIframeEvents = (ref) => {
|
6326
6385
|
const { status } = useAppContext();
|
6327
|
-
(0,
|
6386
|
+
(0, import_react41.useEffect)(() => {
|
6328
6387
|
var _a;
|
6329
6388
|
if (ref.current && status === "READY") {
|
6330
6389
|
const iframe = ref.current;
|
@@ -6363,7 +6422,7 @@ var useBubbleIframeEvents = (ref) => {
|
|
6363
6422
|
};
|
6364
6423
|
var Preview2 = ({ id = "puck-preview" }) => {
|
6365
6424
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
6366
|
-
const Page = (0,
|
6425
|
+
const Page = (0, import_react41.useCallback)(
|
6367
6426
|
(pageProps) => {
|
6368
6427
|
var _a, _b;
|
6369
6428
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
@@ -6372,9 +6431,9 @@ var Preview2 = ({ id = "puck-preview" }) => {
|
|
6372
6431
|
},
|
6373
6432
|
[config.root]
|
6374
6433
|
);
|
6375
|
-
const Frame = (0,
|
6434
|
+
const Frame = (0, import_react41.useMemo)(() => overrides.iframe, [overrides]);
|
6376
6435
|
const rootProps = state.data.root.props || state.data.root;
|
6377
|
-
const ref = (0,
|
6436
|
+
const ref = (0, import_react41.useRef)(null);
|
6378
6437
|
useBubbleIframeEvents(ref);
|
6379
6438
|
const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
6380
6439
|
Page,
|
@@ -6471,7 +6530,7 @@ var scrollIntoView = (el) => {
|
|
6471
6530
|
};
|
6472
6531
|
|
6473
6532
|
// components/LayerTree/index.tsx
|
6474
|
-
var
|
6533
|
+
var import_react42 = require("react");
|
6475
6534
|
|
6476
6535
|
// lib/is-child-of-zone.ts
|
6477
6536
|
init_react_import();
|
@@ -6517,7 +6576,7 @@ var LayerTree = ({
|
|
6517
6576
|
label
|
6518
6577
|
}) => {
|
6519
6578
|
const zones = data.zones || {};
|
6520
|
-
const ctx = (0,
|
6579
|
+
const ctx = (0, import_react42.useContext)(dropZoneContext);
|
6521
6580
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
6522
6581
|
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
6523
6582
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
@@ -6624,13 +6683,13 @@ var LayerTree = ({
|
|
6624
6683
|
};
|
6625
6684
|
|
6626
6685
|
// components/Puck/components/Outline/index.tsx
|
6627
|
-
var
|
6686
|
+
var import_react43 = require("react");
|
6628
6687
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
6629
6688
|
var Outline = () => {
|
6630
6689
|
const { dispatch, state, overrides, config } = useAppContext();
|
6631
6690
|
const { data, ui } = state;
|
6632
6691
|
const { itemSelector } = ui;
|
6633
|
-
const setItemSelector = (0,
|
6692
|
+
const setItemSelector = (0, import_react43.useCallback)(
|
6634
6693
|
(newItemSelector) => {
|
6635
6694
|
dispatch({
|
6636
6695
|
type: "setUi",
|
@@ -6639,7 +6698,7 @@ var Outline = () => {
|
|
6639
6698
|
},
|
6640
6699
|
[]
|
6641
6700
|
);
|
6642
|
-
const Wrapper = (0,
|
6701
|
+
const Wrapper = (0, import_react43.useMemo)(() => overrides.outline || "div", [overrides]);
|
6643
6702
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
6644
6703
|
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
6645
6704
|
LayerTree,
|
@@ -6753,19 +6812,19 @@ function usePuckHistory({
|
|
6753
6812
|
|
6754
6813
|
// lib/use-history-store.ts
|
6755
6814
|
init_react_import();
|
6756
|
-
var
|
6815
|
+
var import_react44 = require("react");
|
6757
6816
|
var import_use_debounce3 = require("use-debounce");
|
6758
6817
|
var EMPTY_HISTORY_INDEX = 0;
|
6759
6818
|
function useHistoryStore(initialHistory) {
|
6760
6819
|
var _a, _b;
|
6761
|
-
const [histories, setHistories] = (0,
|
6820
|
+
const [histories, setHistories] = (0, import_react44.useState)(
|
6762
6821
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
6763
6822
|
);
|
6764
6823
|
const updateHistories = (histories2) => {
|
6765
6824
|
setHistories(histories2);
|
6766
6825
|
setIndex(histories2.length - 1);
|
6767
6826
|
};
|
6768
|
-
const [index, setIndex] = (0,
|
6827
|
+
const [index, setIndex] = (0, import_react44.useState)(
|
6769
6828
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
6770
6829
|
);
|
6771
6830
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -6925,11 +6984,11 @@ var getBox = function getBox2(el) {
|
|
6925
6984
|
};
|
6926
6985
|
|
6927
6986
|
// components/Puck/components/Canvas/index.tsx
|
6928
|
-
var
|
6987
|
+
var import_react46 = require("react");
|
6929
6988
|
|
6930
6989
|
// components/ViewportControls/index.tsx
|
6931
6990
|
init_react_import();
|
6932
|
-
var
|
6991
|
+
var import_react45 = require("react");
|
6933
6992
|
|
6934
6993
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
6935
6994
|
init_react_import();
|
@@ -6952,8 +7011,8 @@ var ViewportButton = ({
|
|
6952
7011
|
onClick
|
6953
7012
|
}) => {
|
6954
7013
|
const { state } = useAppContext();
|
6955
|
-
const [isActive, setIsActive] = (0,
|
6956
|
-
(0,
|
7014
|
+
const [isActive, setIsActive] = (0, import_react45.useState)(false);
|
7015
|
+
(0, import_react45.useEffect)(() => {
|
6957
7016
|
setIsActive(width === state.ui.viewports.current.width);
|
6958
7017
|
}, [width, state.ui.viewports.current.width]);
|
6959
7018
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
@@ -6989,7 +7048,7 @@ var ViewportControls = ({
|
|
6989
7048
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
6990
7049
|
(option) => option.value === autoZoom
|
6991
7050
|
);
|
6992
|
-
const zoomOptions = (0,
|
7051
|
+
const zoomOptions = (0, import_react45.useMemo)(
|
6993
7052
|
() => [
|
6994
7053
|
...defaultZoomOptions,
|
6995
7054
|
...defaultsContainAutoZoom ? [] : [
|
@@ -7112,17 +7171,17 @@ var Canvas = () => {
|
|
7112
7171
|
const { status, iframe } = useAppContext();
|
7113
7172
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
7114
7173
|
const { ui } = state;
|
7115
|
-
const frameRef = (0,
|
7116
|
-
const [showTransition, setShowTransition] = (0,
|
7117
|
-
const defaultRender = (0,
|
7174
|
+
const frameRef = (0, import_react46.useRef)(null);
|
7175
|
+
const [showTransition, setShowTransition] = (0, import_react46.useState)(false);
|
7176
|
+
const defaultRender = (0, import_react46.useMemo)(() => {
|
7118
7177
|
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
7119
7178
|
return PuckDefault;
|
7120
7179
|
}, []);
|
7121
|
-
const CustomPreview = (0,
|
7180
|
+
const CustomPreview = (0, import_react46.useMemo)(
|
7122
7181
|
() => overrides.preview || defaultRender,
|
7123
7182
|
[overrides]
|
7124
7183
|
);
|
7125
|
-
const getFrameDimensions = (0,
|
7184
|
+
const getFrameDimensions = (0, import_react46.useCallback)(() => {
|
7126
7185
|
if (frameRef.current) {
|
7127
7186
|
const frame = frameRef.current;
|
7128
7187
|
const box = getBox(frame);
|
@@ -7130,7 +7189,7 @@ var Canvas = () => {
|
|
7130
7189
|
}
|
7131
7190
|
return { width: 0, height: 0 };
|
7132
7191
|
}, [frameRef]);
|
7133
|
-
const resetAutoZoom = (0,
|
7192
|
+
const resetAutoZoom = (0, import_react46.useCallback)(
|
7134
7193
|
(ui2 = state.ui) => {
|
7135
7194
|
if (frameRef.current) {
|
7136
7195
|
setZoomConfig(
|
@@ -7140,11 +7199,11 @@ var Canvas = () => {
|
|
7140
7199
|
},
|
7141
7200
|
[frameRef, zoomConfig, state.ui]
|
7142
7201
|
);
|
7143
|
-
(0,
|
7202
|
+
(0, import_react46.useEffect)(() => {
|
7144
7203
|
setShowTransition(false);
|
7145
7204
|
resetAutoZoom();
|
7146
7205
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
7147
|
-
(0,
|
7206
|
+
(0, import_react46.useEffect)(() => {
|
7148
7207
|
const { height: frameHeight } = getFrameDimensions();
|
7149
7208
|
if (ui.viewports.current.height === "auto") {
|
7150
7209
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -7152,13 +7211,13 @@ var Canvas = () => {
|
|
7152
7211
|
}));
|
7153
7212
|
}
|
7154
7213
|
}, [zoomConfig.zoom]);
|
7155
|
-
(0,
|
7214
|
+
(0, import_react46.useEffect)(() => {
|
7156
7215
|
if (ZOOM_ON_CHANGE) {
|
7157
7216
|
setShowTransition(true);
|
7158
7217
|
resetAutoZoom(ui);
|
7159
7218
|
}
|
7160
7219
|
}, [ui.viewports.current.width]);
|
7161
|
-
(0,
|
7220
|
+
(0, import_react46.useEffect)(() => {
|
7162
7221
|
const cb = () => {
|
7163
7222
|
setShowTransition(false);
|
7164
7223
|
resetAutoZoom();
|
@@ -7168,8 +7227,8 @@ var Canvas = () => {
|
|
7168
7227
|
window.removeEventListener("resize", cb);
|
7169
7228
|
};
|
7170
7229
|
}, []);
|
7171
|
-
const [showLoader, setShowLoader] = (0,
|
7172
|
-
(0,
|
7230
|
+
const [showLoader, setShowLoader] = (0, import_react46.useState)(false);
|
7231
|
+
(0, import_react46.useEffect)(() => {
|
7173
7232
|
setTimeout(() => {
|
7174
7233
|
setShowLoader(true);
|
7175
7234
|
}, 500);
|
@@ -7247,7 +7306,7 @@ var Canvas = () => {
|
|
7247
7306
|
|
7248
7307
|
// lib/use-loaded-overrides.ts
|
7249
7308
|
init_react_import();
|
7250
|
-
var
|
7309
|
+
var import_react47 = require("react");
|
7251
7310
|
|
7252
7311
|
// lib/load-overrides.ts
|
7253
7312
|
init_react_import();
|
@@ -7286,7 +7345,7 @@ var useLoadedOverrides = ({
|
|
7286
7345
|
overrides,
|
7287
7346
|
plugins
|
7288
7347
|
}) => {
|
7289
|
-
return (0,
|
7348
|
+
return (0, import_react47.useMemo)(() => {
|
7290
7349
|
return loadOverrides({ overrides, plugins });
|
7291
7350
|
}, [plugins, overrides]);
|
7292
7351
|
};
|
@@ -7298,14 +7357,14 @@ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38
|
|
7298
7357
|
|
7299
7358
|
// lib/use-inject-css.ts
|
7300
7359
|
init_react_import();
|
7301
|
-
var
|
7360
|
+
var import_react48 = require("react");
|
7302
7361
|
var styles = ``;
|
7303
7362
|
var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
|
7304
|
-
const [el, setEl] = (0,
|
7305
|
-
(0,
|
7363
|
+
const [el, setEl] = (0, import_react48.useState)();
|
7364
|
+
(0, import_react48.useEffect)(() => {
|
7306
7365
|
setEl(document.createElement("style"));
|
7307
7366
|
}, []);
|
7308
|
-
(0,
|
7367
|
+
(0, import_react48.useEffect)(() => {
|
7309
7368
|
var _a;
|
7310
7369
|
if (!el || typeof window === "undefined") {
|
7311
7370
|
return;
|
@@ -7325,10 +7384,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
7325
7384
|
|
7326
7385
|
// lib/use-preview-mode-hotkeys.ts
|
7327
7386
|
init_react_import();
|
7328
|
-
var
|
7387
|
+
var import_react49 = require("react");
|
7329
7388
|
var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
|
7330
7389
|
var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
|
7331
|
-
const toggleInteractive = (0,
|
7390
|
+
const toggleInteractive = (0, import_react49.useCallback)(() => {
|
7332
7391
|
dispatch({
|
7333
7392
|
type: "setUi",
|
7334
7393
|
ui: (ui) => ({
|
@@ -7380,7 +7439,7 @@ function Puck({
|
|
7380
7439
|
waitForStyles: true
|
7381
7440
|
}, _iframe);
|
7382
7441
|
useInjectGlobalCss(iframe.enabled);
|
7383
|
-
const [generatedAppState] = (0,
|
7442
|
+
const [generatedAppState] = (0, import_react50.useState)(() => {
|
7384
7443
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
7385
7444
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
7386
7445
|
let clientUiState = {};
|
@@ -7452,14 +7511,14 @@ function Puck({
|
|
7452
7511
|
histories,
|
7453
7512
|
index: initialHistoryIndex
|
7454
7513
|
});
|
7455
|
-
const [reducer] = (0,
|
7514
|
+
const [reducer] = (0, import_react50.useState)(
|
7456
7515
|
() => createReducer({
|
7457
7516
|
config,
|
7458
7517
|
record: historyStore.record,
|
7459
7518
|
onAction
|
7460
7519
|
})
|
7461
7520
|
);
|
7462
|
-
const [appState, dispatch] = (0,
|
7521
|
+
const [appState, dispatch] = (0, import_react50.useReducer)(
|
7463
7522
|
reducer,
|
7464
7523
|
flushZones(initialAppState)
|
7465
7524
|
);
|
@@ -7470,14 +7529,14 @@ function Puck({
|
|
7470
7529
|
historyStore,
|
7471
7530
|
iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
|
7472
7531
|
});
|
7473
|
-
const [menuOpen, setMenuOpen] = (0,
|
7532
|
+
const [menuOpen, setMenuOpen] = (0, import_react50.useState)(false);
|
7474
7533
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
7475
7534
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
7476
|
-
(0,
|
7535
|
+
(0, import_react50.useEffect)(() => {
|
7477
7536
|
if (onChange) onChange(data);
|
7478
7537
|
}, [data]);
|
7479
7538
|
const rootProps = data.root.props || data.root;
|
7480
|
-
const toggleSidebars = (0,
|
7539
|
+
const toggleSidebars = (0, import_react50.useCallback)(
|
7481
7540
|
(sidebar) => {
|
7482
7541
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
7483
7542
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -7491,7 +7550,7 @@ function Puck({
|
|
7491
7550
|
},
|
7492
7551
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
7493
7552
|
);
|
7494
|
-
(0,
|
7553
|
+
(0, import_react50.useEffect)(() => {
|
7495
7554
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
7496
7555
|
dispatch({
|
7497
7556
|
type: "setUi",
|
@@ -7514,7 +7573,7 @@ function Puck({
|
|
7514
7573
|
window.removeEventListener("resize", handleResize);
|
7515
7574
|
};
|
7516
7575
|
}, []);
|
7517
|
-
const defaultHeaderRender = (0,
|
7576
|
+
const defaultHeaderRender = (0, import_react50.useMemo)(() => {
|
7518
7577
|
if (renderHeader) {
|
7519
7578
|
console.warn(
|
7520
7579
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -7528,7 +7587,7 @@ function Puck({
|
|
7528
7587
|
}
|
7529
7588
|
return DefaultOverride;
|
7530
7589
|
}, [renderHeader]);
|
7531
|
-
const defaultHeaderActionsRender = (0,
|
7590
|
+
const defaultHeaderActionsRender = (0, import_react50.useMemo)(() => {
|
7532
7591
|
if (renderHeaderActions) {
|
7533
7592
|
console.warn(
|
7534
7593
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
@@ -7545,20 +7604,20 @@ function Puck({
|
|
7545
7604
|
overrides,
|
7546
7605
|
plugins
|
7547
7606
|
});
|
7548
|
-
const CustomPuck = (0,
|
7607
|
+
const CustomPuck = (0, import_react50.useMemo)(
|
7549
7608
|
() => loadedOverrides.puck || DefaultOverride,
|
7550
7609
|
[loadedOverrides]
|
7551
7610
|
);
|
7552
|
-
const CustomHeader = (0,
|
7611
|
+
const CustomHeader = (0, import_react50.useMemo)(
|
7553
7612
|
() => loadedOverrides.header || defaultHeaderRender,
|
7554
7613
|
[loadedOverrides]
|
7555
7614
|
);
|
7556
|
-
const CustomHeaderActions = (0,
|
7615
|
+
const CustomHeaderActions = (0, import_react50.useMemo)(
|
7557
7616
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
7558
7617
|
[loadedOverrides]
|
7559
7618
|
);
|
7560
|
-
const [mounted, setMounted] = (0,
|
7561
|
-
(0,
|
7619
|
+
const [mounted, setMounted] = (0, import_react50.useState)(false);
|
7620
|
+
(0, import_react50.useEffect)(() => {
|
7562
7621
|
setMounted(true);
|
7563
7622
|
}, []);
|
7564
7623
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|