@measured/puck 0.17.0-canary.8ea38c3 → 0.17.0-canary.f71da6d
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 +85 -83
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +191 -119
- package/dist/index.mjs +127 -56
- package/dist/{resolve-all-data-CaVk1fIL.d.mts → resolve-all-data-C7aAQCY3.d.mts} +7 -0
- package/dist/{resolve-all-data-CaVk1fIL.d.ts → resolve-all-data-C7aAQCY3.d.ts} +7 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -276,7 +276,7 @@ init_react_import();
|
|
276
276
|
|
277
277
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
278
278
|
init_react_import();
|
279
|
-
var styles_module_default2 = { "Input": "
|
279
|
+
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1l5m8_1", "Input": "_Input_1l5m8_1", "Input-label": "_Input-label_1l5m8_26", "Input-labelIcon": "_Input-labelIcon_1l5m8_35", "Input-disabledIcon": "_Input-disabledIcon_1l5m8_42", "Input-input": "_Input-input_1l5m8_47", "Input--readOnly": "_Input--readOnly_1l5m8_91", "Input-radioGroupItems": "_Input-radioGroupItems_1l5m8_102", "Input-radio": "_Input-radio_1l5m8_102", "Input-radioInner": "_Input-radioInner_1l5m8_119", "Input-radioInput": "_Input-radioInput_1l5m8_164" };
|
280
280
|
|
281
281
|
// components/AutoField/index.tsx
|
282
282
|
var import_react13 = require("react");
|
@@ -1071,7 +1071,8 @@ var defaultAppState = {
|
|
1071
1071
|
},
|
1072
1072
|
options: [],
|
1073
1073
|
controlsVisible: true
|
1074
|
-
}
|
1074
|
+
},
|
1075
|
+
field: { focus: null }
|
1075
1076
|
}
|
1076
1077
|
};
|
1077
1078
|
var defaultContext = {
|
@@ -1415,11 +1416,13 @@ var ArrayField = ({
|
|
1415
1416
|
event.source.index,
|
1416
1417
|
(_b = event.destination) == null ? void 0 : _b.index
|
1417
1418
|
);
|
1418
|
-
|
1419
|
+
const newUi = {
|
1419
1420
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
1420
1421
|
[id]: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
1421
1422
|
})
|
1422
|
-
}
|
1423
|
+
};
|
1424
|
+
setUi(newUi, false);
|
1425
|
+
onChange(newValue, newUi);
|
1423
1426
|
setLocalState({
|
1424
1427
|
value: newValue,
|
1425
1428
|
arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
|
@@ -1485,32 +1488,60 @@ var ArrayField = ({
|
|
1485
1488
|
children: [
|
1486
1489
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
1487
1490
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
1488
|
-
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
e
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1491
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("actions"), children: [
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
1493
|
+
IconButton,
|
1494
|
+
{
|
1495
|
+
type: "button",
|
1496
|
+
disabled: !!addDisabled,
|
1497
|
+
onClick: (e) => {
|
1498
|
+
e.stopPropagation();
|
1499
|
+
const existingValue = [
|
1500
|
+
...value || []
|
1501
|
+
];
|
1502
|
+
existingValue.splice(
|
1503
|
+
i,
|
1504
|
+
0,
|
1505
|
+
existingValue[i]
|
1506
|
+
);
|
1507
|
+
onChange(
|
1508
|
+
existingValue,
|
1509
|
+
mapArrayStateToUi(
|
1510
|
+
regenerateArrayState(existingValue)
|
1511
|
+
)
|
1512
|
+
);
|
1513
|
+
},
|
1514
|
+
title: "Duplicate",
|
1515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { size: 16 })
|
1516
|
+
}
|
1517
|
+
) }),
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
1519
|
+
IconButton,
|
1520
|
+
{
|
1521
|
+
type: "button",
|
1522
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
1523
|
+
onClick: (e) => {
|
1524
|
+
e.stopPropagation();
|
1525
|
+
const existingValue = [
|
1526
|
+
...value || []
|
1527
|
+
];
|
1528
|
+
const existingItems = [
|
1529
|
+
...arrayState.items || []
|
1530
|
+
];
|
1531
|
+
existingValue.splice(i, 1);
|
1532
|
+
existingItems.splice(i, 1);
|
1533
|
+
onChange(
|
1534
|
+
existingValue,
|
1535
|
+
mapArrayStateToUi({
|
1536
|
+
items: existingItems
|
1537
|
+
})
|
1538
|
+
);
|
1539
|
+
},
|
1540
|
+
title: "Delete",
|
1541
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Trash, { size: 16 })
|
1542
|
+
}
|
1543
|
+
) })
|
1544
|
+
] }),
|
1514
1545
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DragIcon, {}) })
|
1515
1546
|
] })
|
1516
1547
|
]
|
@@ -1636,7 +1667,7 @@ var import_react10 = require("react");
|
|
1636
1667
|
|
1637
1668
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
1638
1669
|
init_react_import();
|
1639
|
-
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-
|
1670
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_8wgzm_1", "ExternalInput-button": "_ExternalInput-button_8wgzm_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_8wgzm_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_8wgzm_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_8wgzm_35", "ExternalInput": "_ExternalInput_8wgzm_1", "ExternalInputModal": "_ExternalInputModal_8wgzm_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_8wgzm_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_8wgzm_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_8wgzm_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_8wgzm_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_8wgzm_133", "ExternalInputModal-table": "_ExternalInputModal-table_8wgzm_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_8wgzm_149", "ExternalInputModal-th": "_ExternalInputModal-th_8wgzm_149", "ExternalInputModal-td": "_ExternalInputModal-td_8wgzm_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_8wgzm_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_8wgzm_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_8wgzm_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_8wgzm_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_8wgzm_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_8wgzm_227", "ExternalInputModal-search": "_ExternalInputModal-search_8wgzm_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_8wgzm_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_8wgzm_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_8wgzm_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_8wgzm_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_8wgzm_326", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_8wgzm_330", "ExternalInputModal-footer": "_ExternalInputModal-footer_8wgzm_330" };
|
1640
1671
|
|
1641
1672
|
// components/Modal/index.tsx
|
1642
1673
|
init_react_import();
|
@@ -1814,6 +1845,14 @@ var ExternalInput = ({
|
|
1814
1845
|
}),
|
1815
1846
|
[id, field]
|
1816
1847
|
);
|
1848
|
+
const Footer = (0, import_react10.useCallback)(
|
1849
|
+
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: getClassNameModal("footer"), children: [
|
1850
|
+
props.items.length,
|
1851
|
+
" result",
|
1852
|
+
props.items.length === 1 ? "" : "s"
|
1853
|
+
] }),
|
1854
|
+
[field.renderFooter]
|
1855
|
+
);
|
1817
1856
|
(0, import_react10.useEffect)(() => {
|
1818
1857
|
search(searchQuery, filters);
|
1819
1858
|
}, []);
|
@@ -1953,11 +1992,7 @@ var ExternalInput = ({
|
|
1953
1992
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader, { size: 24 }) })
|
1954
1993
|
] })
|
1955
1994
|
] }),
|
1956
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.
|
1957
|
-
mappedData.length,
|
1958
|
-
" result",
|
1959
|
-
mappedData.length === 1 ? "" : "s"
|
1960
|
-
] })
|
1995
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Footer, { items: mappedData }) })
|
1961
1996
|
]
|
1962
1997
|
}
|
1963
1998
|
) })
|
@@ -2237,6 +2272,7 @@ var useSafeId = () => {
|
|
2237
2272
|
// components/AutoField/index.tsx
|
2238
2273
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
2239
2274
|
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
2275
|
+
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
|
2240
2276
|
var FieldLabel = ({
|
2241
2277
|
children,
|
2242
2278
|
icon,
|
@@ -2284,7 +2320,7 @@ var FieldLabelInternal2 = ({
|
|
2284
2320
|
};
|
2285
2321
|
function AutoFieldInternal(props) {
|
2286
2322
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
2287
|
-
const { overrides } = useAppContext();
|
2323
|
+
const { dispatch, overrides } = useAppContext();
|
2288
2324
|
const { id, Label = FieldLabelInternal2 } = props;
|
2289
2325
|
const field = props.field;
|
2290
2326
|
const label = field.label;
|
@@ -2316,23 +2352,45 @@ function AutoFieldInternal(props) {
|
|
2316
2352
|
Label,
|
2317
2353
|
id: resolvedId
|
2318
2354
|
});
|
2355
|
+
const onFocus = (0, import_react13.useCallback)(
|
2356
|
+
(e) => {
|
2357
|
+
if (mergedProps.name && e.target.nodeName === "INPUT") {
|
2358
|
+
e.stopPropagation();
|
2359
|
+
dispatch({
|
2360
|
+
type: "setUi",
|
2361
|
+
ui: {
|
2362
|
+
field: { focus: mergedProps.name }
|
2363
|
+
}
|
2364
|
+
});
|
2365
|
+
}
|
2366
|
+
},
|
2367
|
+
[mergedProps.name]
|
2368
|
+
);
|
2369
|
+
const onBlur = (0, import_react13.useCallback)((e) => {
|
2370
|
+
if ("name" in e.target) {
|
2371
|
+
dispatch({
|
2372
|
+
type: "setUi",
|
2373
|
+
ui: {
|
2374
|
+
field: { focus: null }
|
2375
|
+
}
|
2376
|
+
});
|
2377
|
+
}
|
2378
|
+
}, []);
|
2319
2379
|
if (field.type === "custom") {
|
2320
2380
|
if (!field.render) {
|
2321
2381
|
return null;
|
2322
2382
|
}
|
2323
2383
|
const CustomField = field.render;
|
2324
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues({}, mergedProps)) });
|
2384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
|
2325
2385
|
}
|
2326
2386
|
const children = defaultFields[field.type](mergedProps);
|
2327
2387
|
const Render2 = render[field.type];
|
2328
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
2388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children })) });
|
2329
2389
|
}
|
2330
|
-
var RECENT_CHANGE_TIMEOUT = 200;
|
2331
2390
|
function AutoFieldPrivate(props) {
|
2391
|
+
const { state } = useAppContext();
|
2332
2392
|
const { value, onChange } = props;
|
2333
2393
|
const [localValue, setLocalValue] = (0, import_react13.useState)(value);
|
2334
|
-
const [recentlyChanged, setRecentlyChanged] = (0, import_react13.useState)(false);
|
2335
|
-
const timeoutRef = (0, import_react13.useRef)();
|
2336
2394
|
const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
|
2337
2395
|
(val, ui) => {
|
2338
2396
|
onChange(val, ui);
|
@@ -2342,15 +2400,10 @@ function AutoFieldPrivate(props) {
|
|
2342
2400
|
);
|
2343
2401
|
const onChangeLocal = (0, import_react13.useCallback)((val, ui) => {
|
2344
2402
|
setLocalValue(val);
|
2345
|
-
setRecentlyChanged(true);
|
2346
|
-
clearTimeout(timeoutRef.current);
|
2347
|
-
timeoutRef.current = setTimeout(() => {
|
2348
|
-
setRecentlyChanged(false);
|
2349
|
-
}, RECENT_CHANGE_TIMEOUT);
|
2350
2403
|
onChangeDb(val, ui);
|
2351
2404
|
}, []);
|
2352
2405
|
(0, import_react13.useEffect)(() => {
|
2353
|
-
if (
|
2406
|
+
if (state.ui.field.focus !== props.name) {
|
2354
2407
|
setLocalValue(value);
|
2355
2408
|
}
|
2356
2409
|
}, [value]);
|
@@ -3075,7 +3128,7 @@ function DropZone(props) {
|
|
3075
3128
|
|
3076
3129
|
// components/Puck/index.tsx
|
3077
3130
|
init_react_import();
|
3078
|
-
var
|
3131
|
+
var import_react33 = require("react");
|
3079
3132
|
|
3080
3133
|
// lib/use-placeholder-style.ts
|
3081
3134
|
init_react_import();
|
@@ -3682,7 +3735,23 @@ init_react_import();
|
|
3682
3735
|
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
3683
3736
|
|
3684
3737
|
// components/Puck/components/Fields/index.tsx
|
3738
|
+
var import_react22 = require("react");
|
3739
|
+
|
3740
|
+
// lib/use-parent.ts
|
3741
|
+
init_react_import();
|
3685
3742
|
var import_react21 = require("react");
|
3743
|
+
var useParent = (itemSelector) => {
|
3744
|
+
var _a;
|
3745
|
+
const { selectedItem, state } = useAppContext();
|
3746
|
+
const { pathData } = (0, import_react21.useContext)(dropZoneContext) || {};
|
3747
|
+
const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
|
3748
|
+
const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
|
3749
|
+
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
3750
|
+
const parent = (lastItem == null ? void 0 : lastItem.selector) ? (_a = getItem(lastItem.selector, state.data)) != null ? _a : null : null;
|
3751
|
+
return parent || null;
|
3752
|
+
};
|
3753
|
+
|
3754
|
+
// components/Puck/components/Fields/index.tsx
|
3686
3755
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
3687
3756
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3688
3757
|
var defaultPageFields = {
|
@@ -3696,23 +3765,24 @@ var DefaultFields = ({
|
|
3696
3765
|
var useResolvedFields = () => {
|
3697
3766
|
var _a, _b;
|
3698
3767
|
const { selectedItem, state, config } = useAppContext();
|
3768
|
+
const parent = useParent();
|
3699
3769
|
const { data } = state;
|
3700
3770
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
3701
3771
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
3702
|
-
const defaultFields = (0,
|
3772
|
+
const defaultFields = (0, import_react22.useMemo)(
|
3703
3773
|
() => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
|
3704
3774
|
[selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
|
3705
3775
|
);
|
3706
3776
|
const rootProps = data.root.props || data.root;
|
3707
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
3708
|
-
const [resolvedFields, setResolvedFields] = (0,
|
3709
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
3777
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react22.useState)({});
|
3778
|
+
const [resolvedFields, setResolvedFields] = (0, import_react22.useState)(defaultFields);
|
3779
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react22.useState)(false);
|
3710
3780
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
3711
3781
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
3712
3782
|
const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
|
3713
3783
|
const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
|
3714
3784
|
const hasResolver = hasComponentResolver || hasRootResolver;
|
3715
|
-
const resolveFields = (0,
|
3785
|
+
const resolveFields = (0, import_react22.useCallback)(
|
3716
3786
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
3717
3787
|
var _a2;
|
3718
3788
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
@@ -3726,7 +3796,8 @@ var useResolvedFields = () => {
|
|
3726
3796
|
fields,
|
3727
3797
|
lastFields: resolvedFields,
|
3728
3798
|
lastData,
|
3729
|
-
appState: state
|
3799
|
+
appState: state,
|
3800
|
+
parent
|
3730
3801
|
}
|
3731
3802
|
);
|
3732
3803
|
}
|
@@ -3736,7 +3807,8 @@ var useResolvedFields = () => {
|
|
3736
3807
|
fields,
|
3737
3808
|
lastFields: resolvedFields,
|
3738
3809
|
lastData,
|
3739
|
-
appState: state
|
3810
|
+
appState: state,
|
3811
|
+
parent
|
3740
3812
|
});
|
3741
3813
|
}
|
3742
3814
|
return defaultResolveFields(componentData, {
|
@@ -3748,7 +3820,7 @@ var useResolvedFields = () => {
|
|
3748
3820
|
}),
|
3749
3821
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
3750
3822
|
);
|
3751
|
-
(0,
|
3823
|
+
(0, import_react22.useEffect)(() => {
|
3752
3824
|
if (hasResolver) {
|
3753
3825
|
setFieldsLoading(true);
|
3754
3826
|
resolveFields(defaultFields).then((fields) => {
|
@@ -3758,7 +3830,7 @@ var useResolvedFields = () => {
|
|
3758
3830
|
} else {
|
3759
3831
|
setResolvedFields(defaultFields);
|
3760
3832
|
}
|
3761
|
-
}, [data, defaultFields,
|
3833
|
+
}, [data, defaultFields, selectedItem, hasResolver]);
|
3762
3834
|
return [resolvedFields, fieldsLoading];
|
3763
3835
|
};
|
3764
3836
|
var Fields = () => {
|
@@ -3779,7 +3851,7 @@ var Fields = () => {
|
|
3779
3851
|
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;
|
3780
3852
|
const isLoading = fieldsResolving || componentResolving;
|
3781
3853
|
const rootProps = data.root.props || data.root;
|
3782
|
-
const Wrapper = (0,
|
3854
|
+
const Wrapper = (0, import_react22.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
3783
3855
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
3784
3856
|
"form",
|
3785
3857
|
{
|
@@ -3900,7 +3972,7 @@ init_react_import();
|
|
3900
3972
|
|
3901
3973
|
// lib/use-component-list.tsx
|
3902
3974
|
init_react_import();
|
3903
|
-
var
|
3975
|
+
var import_react23 = require("react");
|
3904
3976
|
|
3905
3977
|
// components/ComponentList/index.tsx
|
3906
3978
|
init_react_import();
|
@@ -3978,8 +4050,8 @@ ComponentList.Item = ComponentListItem;
|
|
3978
4050
|
// lib/use-component-list.tsx
|
3979
4051
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
3980
4052
|
var useComponentList = (config, ui) => {
|
3981
|
-
const [componentList, setComponentList] = (0,
|
3982
|
-
(0,
|
4053
|
+
const [componentList, setComponentList] = (0, import_react23.useState)();
|
4054
|
+
(0, import_react23.useEffect)(() => {
|
3983
4055
|
var _a, _b, _c;
|
3984
4056
|
if (Object.keys(ui.componentList).length > 0) {
|
3985
4057
|
const matchedComponents = [];
|
@@ -4048,22 +4120,22 @@ var useComponentList = (config, ui) => {
|
|
4048
4120
|
};
|
4049
4121
|
|
4050
4122
|
// components/Puck/components/Components/index.tsx
|
4051
|
-
var
|
4123
|
+
var import_react24 = require("react");
|
4052
4124
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
4053
4125
|
var Components = () => {
|
4054
4126
|
const { config, state, overrides } = useAppContext();
|
4055
4127
|
const componentList = useComponentList(config, state.ui);
|
4056
|
-
const Wrapper = (0,
|
4128
|
+
const Wrapper = (0, import_react24.useMemo)(() => overrides.components || "div", [overrides]);
|
4057
4129
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
|
4058
4130
|
};
|
4059
4131
|
|
4060
4132
|
// components/Puck/components/Preview/index.tsx
|
4061
4133
|
init_react_import();
|
4062
|
-
var
|
4134
|
+
var import_react26 = require("react");
|
4063
4135
|
|
4064
4136
|
// components/AutoFrame/index.tsx
|
4065
4137
|
init_react_import();
|
4066
|
-
var
|
4138
|
+
var import_react25 = require("react");
|
4067
4139
|
var import_object_hash = __toESM(require("object-hash"));
|
4068
4140
|
var import_react_dom2 = require("react-dom");
|
4069
4141
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
@@ -4109,7 +4181,7 @@ var CopyHostStyles = ({
|
|
4109
4181
|
onStylesLoaded = () => null
|
4110
4182
|
}) => {
|
4111
4183
|
const { document: doc, window: win } = useFrame();
|
4112
|
-
(0,
|
4184
|
+
(0, import_react25.useEffect)(() => {
|
4113
4185
|
if (!win || !doc) {
|
4114
4186
|
return () => {
|
4115
4187
|
};
|
@@ -4268,8 +4340,8 @@ var CopyHostStyles = ({
|
|
4268
4340
|
}, []);
|
4269
4341
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
4270
4342
|
};
|
4271
|
-
var autoFrameContext = (0,
|
4272
|
-
var useFrame = () => (0,
|
4343
|
+
var autoFrameContext = (0, import_react25.createContext)({});
|
4344
|
+
var useFrame = () => (0, import_react25.useContext)(autoFrameContext);
|
4273
4345
|
function AutoFrame(_a) {
|
4274
4346
|
var _b = _a, {
|
4275
4347
|
children,
|
@@ -4284,11 +4356,11 @@ function AutoFrame(_a) {
|
|
4284
4356
|
"id",
|
4285
4357
|
"onStylesLoaded"
|
4286
4358
|
]);
|
4287
|
-
const [loaded, setLoaded] = (0,
|
4288
|
-
const [ctx, setCtx] = (0,
|
4289
|
-
const ref = (0,
|
4290
|
-
const [mountTarget, setMountTarget] = (0,
|
4291
|
-
(0,
|
4359
|
+
const [loaded, setLoaded] = (0, import_react25.useState)(false);
|
4360
|
+
const [ctx, setCtx] = (0, import_react25.useState)({});
|
4361
|
+
const ref = (0, import_react25.useRef)(null);
|
4362
|
+
const [mountTarget, setMountTarget] = (0, import_react25.useState)();
|
4363
|
+
(0, import_react25.useEffect)(() => {
|
4292
4364
|
var _a2;
|
4293
4365
|
if (ref.current) {
|
4294
4366
|
setCtx({
|
@@ -4324,7 +4396,7 @@ var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4324
4396
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
4325
4397
|
var Preview = ({ id = "puck-preview" }) => {
|
4326
4398
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
4327
|
-
const Page = (0,
|
4399
|
+
const Page = (0, import_react26.useCallback)(
|
4328
4400
|
(pageProps) => {
|
4329
4401
|
var _a, _b;
|
4330
4402
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
@@ -4333,7 +4405,7 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
4333
4405
|
},
|
4334
4406
|
[config.root]
|
4335
4407
|
);
|
4336
|
-
const Frame = (0,
|
4408
|
+
const Frame = (0, import_react26.useMemo)(() => overrides.iframe, [overrides]);
|
4337
4409
|
const rootProps = state.data.root.props || state.data.root;
|
4338
4410
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
4339
4411
|
"div",
|
@@ -4422,7 +4494,7 @@ var scrollIntoView = (el) => {
|
|
4422
4494
|
};
|
4423
4495
|
|
4424
4496
|
// components/LayerTree/index.tsx
|
4425
|
-
var
|
4497
|
+
var import_react27 = require("react");
|
4426
4498
|
|
4427
4499
|
// lib/is-child-of-zone.ts
|
4428
4500
|
init_react_import();
|
@@ -4449,7 +4521,7 @@ var LayerTree = ({
|
|
4449
4521
|
label
|
4450
4522
|
}) => {
|
4451
4523
|
const zones = data.zones || {};
|
4452
|
-
const ctx = (0,
|
4524
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
4453
4525
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
4454
4526
|
label && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
4455
4527
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Layers, { size: "16" }) }),
|
@@ -4555,13 +4627,13 @@ var LayerTree = ({
|
|
4555
4627
|
};
|
4556
4628
|
|
4557
4629
|
// components/Puck/components/Outline/index.tsx
|
4558
|
-
var
|
4630
|
+
var import_react28 = require("react");
|
4559
4631
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
4560
4632
|
var Outline = () => {
|
4561
4633
|
const { dispatch, state, overrides, config } = useAppContext();
|
4562
4634
|
const { data, ui } = state;
|
4563
4635
|
const { itemSelector } = ui;
|
4564
|
-
const setItemSelector = (0,
|
4636
|
+
const setItemSelector = (0, import_react28.useCallback)(
|
4565
4637
|
(newItemSelector) => {
|
4566
4638
|
dispatch({
|
4567
4639
|
type: "setUi",
|
@@ -4570,7 +4642,7 @@ var Outline = () => {
|
|
4570
4642
|
},
|
4571
4643
|
[]
|
4572
4644
|
);
|
4573
|
-
const Wrapper = (0,
|
4645
|
+
const Wrapper = (0, import_react28.useMemo)(() => overrides.outline || "div", [overrides]);
|
4574
4646
|
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: [
|
4575
4647
|
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
4576
4648
|
LayerTree,
|
@@ -4659,19 +4731,19 @@ function usePuckHistory({
|
|
4659
4731
|
|
4660
4732
|
// lib/use-history-store.ts
|
4661
4733
|
init_react_import();
|
4662
|
-
var
|
4734
|
+
var import_react29 = require("react");
|
4663
4735
|
var import_use_debounce3 = require("use-debounce");
|
4664
4736
|
var EMPTY_HISTORY_INDEX = 0;
|
4665
4737
|
function useHistoryStore(initialHistory) {
|
4666
4738
|
var _a, _b;
|
4667
|
-
const [histories, setHistories] = (0,
|
4739
|
+
const [histories, setHistories] = (0, import_react29.useState)(
|
4668
4740
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
4669
4741
|
);
|
4670
4742
|
const updateHistories = (histories2) => {
|
4671
4743
|
setHistories(histories2);
|
4672
4744
|
setIndex(histories2.length - 1);
|
4673
4745
|
};
|
4674
|
-
const [index, setIndex] = (0,
|
4746
|
+
const [index, setIndex] = (0, import_react29.useState)(
|
4675
4747
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
4676
4748
|
);
|
4677
4749
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -4831,11 +4903,11 @@ var getBox = function getBox2(el) {
|
|
4831
4903
|
};
|
4832
4904
|
|
4833
4905
|
// components/Puck/components/Canvas/index.tsx
|
4834
|
-
var
|
4906
|
+
var import_react31 = require("react");
|
4835
4907
|
|
4836
4908
|
// components/ViewportControls/index.tsx
|
4837
4909
|
init_react_import();
|
4838
|
-
var
|
4910
|
+
var import_react30 = require("react");
|
4839
4911
|
|
4840
4912
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
4841
4913
|
init_react_import();
|
@@ -4858,8 +4930,8 @@ var ViewportButton = ({
|
|
4858
4930
|
onClick
|
4859
4931
|
}) => {
|
4860
4932
|
const { state } = useAppContext();
|
4861
|
-
const [isActive, setIsActive] = (0,
|
4862
|
-
(0,
|
4933
|
+
const [isActive, setIsActive] = (0, import_react30.useState)(false);
|
4934
|
+
(0, import_react30.useEffect)(() => {
|
4863
4935
|
setIsActive(width === state.ui.viewports.current.width);
|
4864
4936
|
}, [width, state.ui.viewports.current.width]);
|
4865
4937
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
@@ -4895,7 +4967,7 @@ var ViewportControls = ({
|
|
4895
4967
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
4896
4968
|
(option) => option.value === autoZoom
|
4897
4969
|
);
|
4898
|
-
const zoomOptions = (0,
|
4970
|
+
const zoomOptions = (0, import_react30.useMemo)(
|
4899
4971
|
() => [
|
4900
4972
|
...defaultZoomOptions,
|
4901
4973
|
...defaultsContainAutoZoom ? [] : [
|
@@ -5018,17 +5090,17 @@ var Canvas = () => {
|
|
5018
5090
|
const { status, iframe } = useAppContext();
|
5019
5091
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
5020
5092
|
const { ui } = state;
|
5021
|
-
const frameRef = (0,
|
5022
|
-
const [showTransition, setShowTransition] = (0,
|
5023
|
-
const defaultRender = (0,
|
5093
|
+
const frameRef = (0, import_react31.useRef)(null);
|
5094
|
+
const [showTransition, setShowTransition] = (0, import_react31.useState)(false);
|
5095
|
+
const defaultRender = (0, import_react31.useMemo)(() => {
|
5024
5096
|
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
5025
5097
|
return PuckDefault;
|
5026
5098
|
}, []);
|
5027
|
-
const CustomPreview = (0,
|
5099
|
+
const CustomPreview = (0, import_react31.useMemo)(
|
5028
5100
|
() => overrides.preview || defaultRender,
|
5029
5101
|
[overrides]
|
5030
5102
|
);
|
5031
|
-
const getFrameDimensions = (0,
|
5103
|
+
const getFrameDimensions = (0, import_react31.useCallback)(() => {
|
5032
5104
|
if (frameRef.current) {
|
5033
5105
|
const frame = frameRef.current;
|
5034
5106
|
const box = getBox(frame);
|
@@ -5036,7 +5108,7 @@ var Canvas = () => {
|
|
5036
5108
|
}
|
5037
5109
|
return { width: 0, height: 0 };
|
5038
5110
|
}, [frameRef]);
|
5039
|
-
const resetAutoZoom = (0,
|
5111
|
+
const resetAutoZoom = (0, import_react31.useCallback)(
|
5040
5112
|
(ui2 = state.ui) => {
|
5041
5113
|
if (frameRef.current) {
|
5042
5114
|
setZoomConfig(
|
@@ -5046,11 +5118,11 @@ var Canvas = () => {
|
|
5046
5118
|
},
|
5047
5119
|
[frameRef, zoomConfig, state.ui]
|
5048
5120
|
);
|
5049
|
-
(0,
|
5121
|
+
(0, import_react31.useEffect)(() => {
|
5050
5122
|
setShowTransition(false);
|
5051
5123
|
resetAutoZoom();
|
5052
5124
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
5053
|
-
(0,
|
5125
|
+
(0, import_react31.useEffect)(() => {
|
5054
5126
|
const { height: frameHeight } = getFrameDimensions();
|
5055
5127
|
if (ui.viewports.current.height === "auto") {
|
5056
5128
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -5058,13 +5130,13 @@ var Canvas = () => {
|
|
5058
5130
|
}));
|
5059
5131
|
}
|
5060
5132
|
}, [zoomConfig.zoom]);
|
5061
|
-
(0,
|
5133
|
+
(0, import_react31.useEffect)(() => {
|
5062
5134
|
if (ZOOM_ON_CHANGE) {
|
5063
5135
|
setShowTransition(true);
|
5064
5136
|
resetAutoZoom(ui);
|
5065
5137
|
}
|
5066
5138
|
}, [ui.viewports.current.width]);
|
5067
|
-
(0,
|
5139
|
+
(0, import_react31.useEffect)(() => {
|
5068
5140
|
const observer = new ResizeObserver(() => {
|
5069
5141
|
setShowTransition(false);
|
5070
5142
|
resetAutoZoom();
|
@@ -5076,8 +5148,8 @@ var Canvas = () => {
|
|
5076
5148
|
observer.disconnect();
|
5077
5149
|
};
|
5078
5150
|
}, []);
|
5079
|
-
const [showLoader, setShowLoader] = (0,
|
5080
|
-
(0,
|
5151
|
+
const [showLoader, setShowLoader] = (0, import_react31.useState)(false);
|
5152
|
+
(0, import_react31.useEffect)(() => {
|
5081
5153
|
setTimeout(() => {
|
5082
5154
|
setShowLoader(true);
|
5083
5155
|
}, 500);
|
@@ -5180,7 +5252,7 @@ var insertComponent = (componentType, zone, index, {
|
|
5180
5252
|
|
5181
5253
|
// lib/use-loaded-overrides.ts
|
5182
5254
|
init_react_import();
|
5183
|
-
var
|
5255
|
+
var import_react32 = require("react");
|
5184
5256
|
|
5185
5257
|
// lib/load-overrides.ts
|
5186
5258
|
init_react_import();
|
@@ -5219,7 +5291,7 @@ var useLoadedOverrides = ({
|
|
5219
5291
|
overrides,
|
5220
5292
|
plugins
|
5221
5293
|
}) => {
|
5222
|
-
return (0,
|
5294
|
+
return (0, import_react32.useMemo)(() => {
|
5223
5295
|
return loadOverrides({ overrides, plugins });
|
5224
5296
|
}, [plugins, overrides]);
|
5225
5297
|
};
|
@@ -5258,7 +5330,7 @@ function Puck({
|
|
5258
5330
|
enabled: true,
|
5259
5331
|
waitForStyles: true
|
5260
5332
|
}, _iframe);
|
5261
|
-
const [generatedAppState] = (0,
|
5333
|
+
const [generatedAppState] = (0, import_react33.useState)(() => {
|
5262
5334
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
5263
5335
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
5264
5336
|
let clientUiState = {};
|
@@ -5330,22 +5402,22 @@ function Puck({
|
|
5330
5402
|
histories,
|
5331
5403
|
index: initialHistoryIndex
|
5332
5404
|
});
|
5333
|
-
const [reducer] = (0,
|
5405
|
+
const [reducer] = (0, import_react33.useState)(
|
5334
5406
|
() => createReducer({
|
5335
5407
|
config,
|
5336
5408
|
record: historyStore.record,
|
5337
5409
|
onAction
|
5338
5410
|
})
|
5339
5411
|
);
|
5340
|
-
const [appState, dispatch] = (0,
|
5412
|
+
const [appState, dispatch] = (0, import_react33.useReducer)(
|
5341
5413
|
reducer,
|
5342
5414
|
flushZones(initialAppState)
|
5343
5415
|
);
|
5344
5416
|
const { data, ui } = appState;
|
5345
5417
|
const history = usePuckHistory({ dispatch, initialAppState, historyStore });
|
5346
|
-
const [menuOpen, setMenuOpen] = (0,
|
5418
|
+
const [menuOpen, setMenuOpen] = (0, import_react33.useState)(false);
|
5347
5419
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
5348
|
-
const setItemSelector = (0,
|
5420
|
+
const setItemSelector = (0, import_react33.useCallback)(
|
5349
5421
|
(newItemSelector) => {
|
5350
5422
|
if (newItemSelector === itemSelector) return;
|
5351
5423
|
dispatch({
|
@@ -5357,13 +5429,13 @@ function Puck({
|
|
5357
5429
|
[itemSelector]
|
5358
5430
|
);
|
5359
5431
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
5360
|
-
(0,
|
5432
|
+
(0, import_react33.useEffect)(() => {
|
5361
5433
|
if (onChange) onChange(data);
|
5362
5434
|
}, [data]);
|
5363
5435
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
5364
|
-
const [draggedItem, setDraggedItem] = (0,
|
5436
|
+
const [draggedItem, setDraggedItem] = (0, import_react33.useState)();
|
5365
5437
|
const rootProps = data.root.props || data.root;
|
5366
|
-
const toggleSidebars = (0,
|
5438
|
+
const toggleSidebars = (0, import_react33.useCallback)(
|
5367
5439
|
(sidebar) => {
|
5368
5440
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
5369
5441
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -5377,7 +5449,7 @@ function Puck({
|
|
5377
5449
|
},
|
5378
5450
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
5379
5451
|
);
|
5380
|
-
(0,
|
5452
|
+
(0, import_react33.useEffect)(() => {
|
5381
5453
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
5382
5454
|
dispatch({
|
5383
5455
|
type: "setUi",
|
@@ -5400,7 +5472,7 @@ function Puck({
|
|
5400
5472
|
window.removeEventListener("resize", handleResize);
|
5401
5473
|
};
|
5402
5474
|
}, []);
|
5403
|
-
const defaultHeaderRender = (0,
|
5475
|
+
const defaultHeaderRender = (0, import_react33.useMemo)(() => {
|
5404
5476
|
if (renderHeader) {
|
5405
5477
|
console.warn(
|
5406
5478
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -5414,7 +5486,7 @@ function Puck({
|
|
5414
5486
|
}
|
5415
5487
|
return DefaultOverride;
|
5416
5488
|
}, [renderHeader]);
|
5417
|
-
const defaultHeaderActionsRender = (0,
|
5489
|
+
const defaultHeaderActionsRender = (0, import_react33.useMemo)(() => {
|
5418
5490
|
if (renderHeaderActions) {
|
5419
5491
|
console.warn(
|
5420
5492
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
@@ -5431,20 +5503,20 @@ function Puck({
|
|
5431
5503
|
overrides,
|
5432
5504
|
plugins
|
5433
5505
|
});
|
5434
|
-
const CustomPuck = (0,
|
5506
|
+
const CustomPuck = (0, import_react33.useMemo)(
|
5435
5507
|
() => loadedOverrides.puck || DefaultOverride,
|
5436
5508
|
[loadedOverrides]
|
5437
5509
|
);
|
5438
|
-
const CustomHeader = (0,
|
5510
|
+
const CustomHeader = (0, import_react33.useMemo)(
|
5439
5511
|
() => loadedOverrides.header || defaultHeaderRender,
|
5440
5512
|
[loadedOverrides]
|
5441
5513
|
);
|
5442
|
-
const CustomHeaderActions = (0,
|
5514
|
+
const CustomHeaderActions = (0, import_react33.useMemo)(
|
5443
5515
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
5444
5516
|
[loadedOverrides]
|
5445
5517
|
);
|
5446
|
-
const [mounted, setMounted] = (0,
|
5447
|
-
(0,
|
5518
|
+
const [mounted, setMounted] = (0, import_react33.useState)(false);
|
5519
|
+
(0, import_react33.useEffect)(() => {
|
5448
5520
|
setMounted(true);
|
5449
5521
|
}, []);
|
5450
5522
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|