@measured/puck 0.18.0-canary.beb05b5 → 0.18.0-canary.cfe4ca8

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  resolveRootData,
17
17
  rootDroppableId,
18
18
  setupZone
19
- } from "./chunk-EXKSBUY5.mjs";
19
+ } from "./chunk-CHWFBYEM.mjs";
20
20
 
21
21
  // ../../node_modules/classnames/index.js
22
22
  var require_classnames = __commonJS({
@@ -205,13 +205,14 @@ 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": "_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" };
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 {
212
212
  useCallback as useCallback5,
213
+ useContext as useContext3,
213
214
  useEffect as useEffect9,
214
- useMemo as useMemo4,
215
+ useMemo as useMemo5,
215
216
  useState as useState11
216
217
  } from "react";
217
218
 
@@ -1085,7 +1086,7 @@ init_react_import();
1085
1086
  import { DragDropProvider } from "@dnd-kit/react";
1086
1087
  import { useState as useState5 } from "react";
1087
1088
 
1088
- // lib/dnd-kit/safe.ts
1089
+ // lib/dnd/dnd-kit/safe.ts
1089
1090
  init_react_import();
1090
1091
  import {
1091
1092
  useDraggable,
@@ -1165,8 +1166,53 @@ var Sortable = ({
1165
1166
  return children({ status, ref: sortableRef });
1166
1167
  };
1167
1168
 
1169
+ // components/AutoField/context.tsx
1170
+ init_react_import();
1171
+ import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
1172
+ import { jsx as jsx7 } from "react/jsx-runtime";
1173
+ var NestedFieldContext = createContext2({});
1174
+ var useNestedFieldContext = () => {
1175
+ const context = useContext2(NestedFieldContext);
1176
+ return __spreadProps(__spreadValues({}, context), {
1177
+ readOnlyFields: context.readOnlyFields || {}
1178
+ });
1179
+ };
1180
+ var NestedFieldProvider = ({
1181
+ children,
1182
+ name,
1183
+ subName,
1184
+ wildcardName = name,
1185
+ readOnlyFields
1186
+ }) => {
1187
+ const subPath = `${name}.${subName}`;
1188
+ const wildcardSubPath = `${wildcardName}.${subName}`;
1189
+ const subReadOnlyFields = useMemo(
1190
+ () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
1191
+ const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
1192
+ if (isLocal) {
1193
+ const subPathPattern = new RegExp(
1194
+ `^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
1195
+ );
1196
+ const localName = readOnlyKey.replace(subPathPattern, "");
1197
+ return __spreadProps(__spreadValues({}, acc), {
1198
+ [localName]: readOnlyFields[readOnlyKey]
1199
+ });
1200
+ }
1201
+ return acc;
1202
+ }, {}),
1203
+ [name, subName, wildcardName, readOnlyFields]
1204
+ );
1205
+ return /* @__PURE__ */ jsx7(
1206
+ NestedFieldContext.Provider,
1207
+ {
1208
+ value: { readOnlyFields: subReadOnlyFields, localName: subName },
1209
+ children
1210
+ }
1211
+ );
1212
+ };
1213
+
1168
1214
  // components/AutoField/fields/ArrayField/index.tsx
1169
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1215
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1170
1216
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
1171
1217
  var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
1172
1218
  var ArrayField = ({
@@ -1177,10 +1223,10 @@ var ArrayField = ({
1177
1223
  label,
1178
1224
  readOnly,
1179
1225
  id,
1180
- Label: Label2 = (props) => /* @__PURE__ */ jsx7("div", __spreadValues({}, props))
1226
+ Label: Label2 = (props) => /* @__PURE__ */ jsx8("div", __spreadValues({}, props))
1181
1227
  }) => {
1182
1228
  const { state, setUi, selectedItem, getPermissions } = useAppContext();
1183
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
1229
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
1184
1230
  const value = _value;
1185
1231
  const arrayState = state.ui.arrayState[id] || {
1186
1232
  items: Array.from(value || []).map((item, idx) => {
@@ -1240,14 +1286,14 @@ var ArrayField = ({
1240
1286
  return null;
1241
1287
  }
1242
1288
  const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
1243
- return /* @__PURE__ */ jsx7(
1289
+ return /* @__PURE__ */ jsx8(
1244
1290
  Label2,
1245
1291
  {
1246
1292
  label: label || name,
1247
- icon: /* @__PURE__ */ jsx7(List, { size: 16 }),
1293
+ icon: /* @__PURE__ */ jsx8(List, { size: 16 }),
1248
1294
  el: "div",
1249
1295
  readOnly,
1250
- children: /* @__PURE__ */ jsx7(
1296
+ children: /* @__PURE__ */ jsx8(
1251
1297
  SortableProvider,
1252
1298
  {
1253
1299
  onMove: (move) => {
@@ -1283,7 +1329,7 @@ var ArrayField = ({
1283
1329
  localState.arrayState.items.map((item, i) => {
1284
1330
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1285
1331
  const data = Array.from(localState.value || [])[i] || {};
1286
- return /* @__PURE__ */ jsx7(
1332
+ return /* @__PURE__ */ jsx8(
1287
1333
  Sortable,
1288
1334
  {
1289
1335
  id: _arrayId,
@@ -1324,7 +1370,7 @@ var ArrayField = ({
1324
1370
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
1325
1371
  /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("rhs"), children: [
1326
1372
  !readOnly && /* @__PURE__ */ jsxs3("div", { className: getClassNameItem("actions"), children: [
1327
- /* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
1373
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
1328
1374
  IconButton,
1329
1375
  {
1330
1376
  type: "button",
@@ -1341,10 +1387,10 @@ var ArrayField = ({
1341
1387
  );
1342
1388
  },
1343
1389
  title: "Duplicate",
1344
- children: /* @__PURE__ */ jsx7(Copy, { size: 16 })
1390
+ children: /* @__PURE__ */ jsx8(Copy, { size: 16 })
1345
1391
  }
1346
1392
  ) }),
1347
- /* @__PURE__ */ jsx7("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx7(
1393
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ jsx8(
1348
1394
  IconButton,
1349
1395
  {
1350
1396
  type: "button",
@@ -1365,39 +1411,56 @@ var ArrayField = ({
1365
1411
  );
1366
1412
  },
1367
1413
  title: "Delete",
1368
- children: /* @__PURE__ */ jsx7(Trash, { size: 16 })
1414
+ children: /* @__PURE__ */ jsx8(Trash, { size: 16 })
1369
1415
  }
1370
1416
  ) })
1371
1417
  ] }),
1372
- /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(DragIcon, {}) })
1418
+ /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(DragIcon, {}) })
1373
1419
  ] })
1374
1420
  ]
1375
1421
  }
1376
1422
  ),
1377
- /* @__PURE__ */ jsx7("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx7("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((fieldName) => {
1378
- const subField = field.arrayFields[fieldName];
1379
- const subFieldName = `${name}[${i}].${fieldName}`;
1380
- const wildcardFieldName = `${name}[*].${fieldName}`;
1381
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
1382
- return /* @__PURE__ */ jsx7(
1383
- AutoFieldPrivate,
1423
+ /* @__PURE__ */ jsx8("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ jsx8("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
1424
+ const subField = field.arrayFields[subName];
1425
+ const indexName = `${name}[${i}]`;
1426
+ const subPath = `${indexName}.${subName}`;
1427
+ const localIndexName = `${localName}[${i}]`;
1428
+ const localWildcardName = `${localName}[*]`;
1429
+ const localSubPath = `${localIndexName}.${subName}`;
1430
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
1431
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
1432
+ const label2 = subField.label || subName;
1433
+ return /* @__PURE__ */ jsx8(
1434
+ NestedFieldProvider,
1384
1435
  {
1385
- name: subFieldName,
1386
- label: subField.label || fieldName,
1387
- id: `${_arrayId}_${fieldName}`,
1388
- readOnly: subReadOnly,
1389
- field: subField,
1390
- value: data[fieldName],
1391
- onChange: (val, ui) => {
1392
- onChange(
1393
- replace(value, i, __spreadProps(__spreadValues({}, data), {
1394
- [fieldName]: val
1395
- })),
1396
- ui
1397
- );
1398
- }
1436
+ name: localIndexName,
1437
+ wildcardName: localWildcardName,
1438
+ subName,
1439
+ readOnlyFields,
1440
+ children: /* @__PURE__ */ jsx8(
1441
+ AutoFieldPrivate,
1442
+ {
1443
+ name: subPath,
1444
+ label: label2,
1445
+ id: `${_arrayId}_${subName}`,
1446
+ readOnly: subReadOnly,
1447
+ field: __spreadProps(__spreadValues({}, subField), {
1448
+ label: label2
1449
+ // May be used by custom fields
1450
+ }),
1451
+ value: data[subName],
1452
+ onChange: (val, ui) => {
1453
+ onChange(
1454
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
1455
+ [subName]: val
1456
+ })),
1457
+ ui
1458
+ );
1459
+ }
1460
+ }
1461
+ )
1399
1462
  },
1400
- subFieldName
1463
+ subPath
1401
1464
  );
1402
1465
  }) }) })
1403
1466
  ]
@@ -1407,7 +1470,7 @@ var ArrayField = ({
1407
1470
  _arrayId
1408
1471
  );
1409
1472
  }),
1410
- !addDisabled && /* @__PURE__ */ jsx7(
1473
+ !addDisabled && /* @__PURE__ */ jsx8(
1411
1474
  "button",
1412
1475
  {
1413
1476
  type: "button",
@@ -1421,7 +1484,7 @@ var ArrayField = ({
1421
1484
  const newArrayState = regenerateArrayState(newValue);
1422
1485
  onChange(newValue, mapArrayStateToUi(newArrayState));
1423
1486
  },
1424
- children: /* @__PURE__ */ jsx7(Plus, { size: 21 })
1487
+ children: /* @__PURE__ */ jsx8(Plus, { size: 21 })
1425
1488
  }
1426
1489
  )
1427
1490
  ]
@@ -1435,7 +1498,7 @@ var ArrayField = ({
1435
1498
 
1436
1499
  // components/AutoField/fields/DefaultField/index.tsx
1437
1500
  init_react_import();
1438
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1501
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1439
1502
  var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
1440
1503
  var DefaultField = ({
1441
1504
  field,
@@ -1447,16 +1510,16 @@ var DefaultField = ({
1447
1510
  Label: Label2,
1448
1511
  id
1449
1512
  }) => {
1450
- return /* @__PURE__ */ jsx8(
1513
+ return /* @__PURE__ */ jsx9(
1451
1514
  Label2,
1452
1515
  {
1453
1516
  label: label || name,
1454
1517
  icon: /* @__PURE__ */ jsxs4(Fragment2, { children: [
1455
- field.type === "text" && /* @__PURE__ */ jsx8(Type, { size: 16 }),
1456
- field.type === "number" && /* @__PURE__ */ jsx8(Hash, { size: 16 })
1518
+ field.type === "text" && /* @__PURE__ */ jsx9(Type, { size: 16 }),
1519
+ field.type === "number" && /* @__PURE__ */ jsx9(Hash, { size: 16 })
1457
1520
  ] }),
1458
1521
  readOnly,
1459
- children: /* @__PURE__ */ jsx8(
1522
+ children: /* @__PURE__ */ jsx9(
1460
1523
  "input",
1461
1524
  {
1462
1525
  className: getClassName6("input"),
@@ -1467,7 +1530,14 @@ var DefaultField = ({
1467
1530
  value: typeof value === "undefined" ? "" : value.toString(),
1468
1531
  onChange: (e) => {
1469
1532
  if (field.type === "number") {
1470
- onChange(Number(e.currentTarget.value));
1533
+ const numberValue = Number(e.currentTarget.value);
1534
+ if (typeof field.min !== "undefined" && numberValue < field.min) {
1535
+ return;
1536
+ }
1537
+ if (typeof field.max !== "undefined" && numberValue > field.max) {
1538
+ return;
1539
+ }
1540
+ onChange(numberValue);
1471
1541
  } else {
1472
1542
  onChange(e.currentTarget.value);
1473
1543
  }
@@ -1490,7 +1560,7 @@ import { useEffect as useEffect8 } from "react";
1490
1560
  // components/ExternalInput/index.tsx
1491
1561
  init_react_import();
1492
1562
  import {
1493
- useMemo,
1563
+ useMemo as useMemo2,
1494
1564
  useEffect as useEffect7,
1495
1565
  useState as useState9,
1496
1566
  useCallback as useCallback4,
@@ -1511,7 +1581,7 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
1511
1581
 
1512
1582
  // components/Modal/index.tsx
1513
1583
  import { createPortal } from "react-dom";
1514
- import { jsx as jsx9 } from "react/jsx-runtime";
1584
+ import { jsx as jsx10 } from "react/jsx-runtime";
1515
1585
  var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
1516
1586
  var Modal = ({
1517
1587
  children,
@@ -1523,10 +1593,10 @@ var Modal = ({
1523
1593
  setRootEl(document.getElementById("puck-portal-root"));
1524
1594
  }, []);
1525
1595
  if (!rootEl) {
1526
- return /* @__PURE__ */ jsx9("div", {});
1596
+ return /* @__PURE__ */ jsx10("div", {});
1527
1597
  }
1528
1598
  return createPortal(
1529
- /* @__PURE__ */ jsx9("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx9(
1599
+ /* @__PURE__ */ jsx10("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx10(
1530
1600
  "div",
1531
1601
  {
1532
1602
  className: getClassName7("inner"),
@@ -1546,11 +1616,11 @@ init_react_import();
1546
1616
  var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
1547
1617
 
1548
1618
  // components/Heading/index.tsx
1549
- import { jsx as jsx10 } from "react/jsx-runtime";
1619
+ import { jsx as jsx11 } from "react/jsx-runtime";
1550
1620
  var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
1551
1621
  var Heading = ({ children, rank, size = "m" }) => {
1552
1622
  const Tag = rank ? `h${rank}` : "span";
1553
- return /* @__PURE__ */ jsx10(
1623
+ return /* @__PURE__ */ jsx11(
1554
1624
  Tag,
1555
1625
  {
1556
1626
  className: getClassName8({
@@ -1586,7 +1656,7 @@ var filterDataAttrs = (props) => {
1586
1656
  };
1587
1657
 
1588
1658
  // components/Button/Button.tsx
1589
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1659
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
1590
1660
  var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
1591
1661
  var Button = (_a) => {
1592
1662
  var _b = _a, {
@@ -1645,9 +1715,9 @@ var Button = (_a) => {
1645
1715
  href
1646
1716
  }, dataAttrs), {
1647
1717
  children: [
1648
- icon && /* @__PURE__ */ jsx11("div", { className: getClassName9("icon"), children: icon }),
1718
+ icon && /* @__PURE__ */ jsx12("div", { className: getClassName9("icon"), children: icon }),
1649
1719
  children,
1650
- loading && /* @__PURE__ */ jsx11("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx11(Loader, { size: 14 }) })
1720
+ loading && /* @__PURE__ */ jsx12("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ jsx12(Loader, { size: 14 }) })
1651
1721
  ]
1652
1722
  })
1653
1723
  );
@@ -1655,7 +1725,7 @@ var Button = (_a) => {
1655
1725
  };
1656
1726
 
1657
1727
  // components/ExternalInput/index.tsx
1658
- import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1728
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1659
1729
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
1660
1730
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
1661
1731
  var dataCache = {};
@@ -1678,10 +1748,10 @@ var ExternalInput = ({
1678
1748
  const hasFilterFields = !!filterFields;
1679
1749
  const [filters, setFilters] = useState9(field.initialFilters || {});
1680
1750
  const [filtersToggled, setFiltersToggled] = useState9(hasFilterFields);
1681
- const mappedData = useMemo(() => {
1751
+ const mappedData = useMemo2(() => {
1682
1752
  return data.map(mapRow);
1683
1753
  }, [data]);
1684
- const keys = useMemo(() => {
1754
+ const keys = useMemo2(() => {
1685
1755
  const validKeys = /* @__PURE__ */ new Set();
1686
1756
  for (const item of mappedData) {
1687
1757
  for (const key of Object.keys(item)) {
@@ -1728,7 +1798,7 @@ var ExternalInput = ({
1728
1798
  id,
1729
1799
  children: [
1730
1800
  /* @__PURE__ */ jsxs6("div", { className: getClassName10("actions"), children: [
1731
- /* @__PURE__ */ jsx12(
1801
+ /* @__PURE__ */ jsx13(
1732
1802
  "button",
1733
1803
  {
1734
1804
  type: "button",
@@ -1736,12 +1806,12 @@ var ExternalInput = ({
1736
1806
  className: getClassName10("button"),
1737
1807
  disabled: readOnly,
1738
1808
  children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsxs6(Fragment3, { children: [
1739
- /* @__PURE__ */ jsx12(Link, { size: "16" }),
1740
- /* @__PURE__ */ jsx12("span", { children: field.placeholder })
1809
+ /* @__PURE__ */ jsx13(Link, { size: "16" }),
1810
+ /* @__PURE__ */ jsx13("span", { children: field.placeholder })
1741
1811
  ] })
1742
1812
  }
1743
1813
  ),
1744
- value && /* @__PURE__ */ jsx12(
1814
+ value && /* @__PURE__ */ jsx13(
1745
1815
  "button",
1746
1816
  {
1747
1817
  type: "button",
@@ -1750,11 +1820,11 @@ var ExternalInput = ({
1750
1820
  onChange(null);
1751
1821
  },
1752
1822
  disabled: readOnly,
1753
- children: /* @__PURE__ */ jsx12(LockOpen, { size: 16 })
1823
+ children: /* @__PURE__ */ jsx13(LockOpen, { size: 16 })
1754
1824
  }
1755
1825
  )
1756
1826
  ] }),
1757
- /* @__PURE__ */ jsx12(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs6(
1827
+ /* @__PURE__ */ jsx13(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs6(
1758
1828
  "form",
1759
1829
  {
1760
1830
  className: getClassNameModal({
@@ -1768,11 +1838,11 @@ var ExternalInput = ({
1768
1838
  search(searchQuery, filters);
1769
1839
  },
1770
1840
  children: [
1771
- /* @__PURE__ */ jsx12("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs6("div", { className: getClassNameModal("searchForm"), children: [
1841
+ /* @__PURE__ */ jsx13("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs6("div", { className: getClassNameModal("searchForm"), children: [
1772
1842
  /* @__PURE__ */ jsxs6("label", { className: getClassNameModal("search"), children: [
1773
- /* @__PURE__ */ jsx12("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
1774
- /* @__PURE__ */ jsx12("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx12(Search, { size: "18" }) }),
1775
- /* @__PURE__ */ jsx12(
1843
+ /* @__PURE__ */ jsx13("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
1844
+ /* @__PURE__ */ jsx13("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx13(Search, { size: "18" }) }),
1845
+ /* @__PURE__ */ jsx13(
1776
1846
  "input",
1777
1847
  {
1778
1848
  className: getClassNameModal("searchInput"),
@@ -1788,8 +1858,8 @@ var ExternalInput = ({
1788
1858
  )
1789
1859
  ] }),
1790
1860
  /* @__PURE__ */ jsxs6("div", { className: getClassNameModal("searchActions"), children: [
1791
- /* @__PURE__ */ jsx12(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
1792
- hasFilterFields && /* @__PURE__ */ jsx12("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx12(
1861
+ /* @__PURE__ */ jsx13(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
1862
+ hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx13(
1793
1863
  IconButton,
1794
1864
  {
1795
1865
  title: "Toggle filters",
@@ -1798,15 +1868,15 @@ var ExternalInput = ({
1798
1868
  e.stopPropagation();
1799
1869
  setFiltersToggled(!filtersToggled);
1800
1870
  },
1801
- children: /* @__PURE__ */ jsx12(SlidersHorizontal, { size: 20 })
1871
+ children: /* @__PURE__ */ jsx13(SlidersHorizontal, { size: 20 })
1802
1872
  }
1803
1873
  ) })
1804
1874
  ] })
1805
- ] }) : /* @__PURE__ */ jsx12(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
1875
+ ] }) : /* @__PURE__ */ jsx13(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
1806
1876
  /* @__PURE__ */ jsxs6("div", { className: getClassNameModal("grid"), children: [
1807
- hasFilterFields && /* @__PURE__ */ jsx12("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1877
+ hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1808
1878
  const filterField = filterFields[fieldName];
1809
- return /* @__PURE__ */ jsx12(
1879
+ return /* @__PURE__ */ jsx13(
1810
1880
  AutoFieldPrivate,
1811
1881
  {
1812
1882
  field: filterField,
@@ -1825,7 +1895,7 @@ var ExternalInput = ({
1825
1895
  }) }),
1826
1896
  /* @__PURE__ */ jsxs6("div", { className: getClassNameModal("tableWrapper"), children: [
1827
1897
  /* @__PURE__ */ jsxs6("table", { className: getClassNameModal("table"), children: [
1828
- /* @__PURE__ */ jsx12("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx12("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx12(
1898
+ /* @__PURE__ */ jsx13("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx13("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx13(
1829
1899
  "th",
1830
1900
  {
1831
1901
  className: getClassNameModal("th"),
@@ -1834,8 +1904,8 @@ var ExternalInput = ({
1834
1904
  },
1835
1905
  key
1836
1906
  )) }) }),
1837
- /* @__PURE__ */ jsx12("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
1838
- return /* @__PURE__ */ jsx12(
1907
+ /* @__PURE__ */ jsx13("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
1908
+ return /* @__PURE__ */ jsx13(
1839
1909
  "tr",
1840
1910
  {
1841
1911
  style: { whiteSpace: "nowrap" },
@@ -1844,16 +1914,16 @@ var ExternalInput = ({
1844
1914
  onChange(mapProp(data[i]));
1845
1915
  setOpen(false);
1846
1916
  },
1847
- children: keys.map((key) => /* @__PURE__ */ jsx12("td", { className: getClassNameModal("td"), children: item[key] }, key))
1917
+ children: keys.map((key) => /* @__PURE__ */ jsx13("td", { className: getClassNameModal("td"), children: item[key] }, key))
1848
1918
  },
1849
1919
  i
1850
1920
  );
1851
1921
  }) })
1852
1922
  ] }),
1853
- /* @__PURE__ */ jsx12("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx12(Loader, { size: 24 }) })
1923
+ /* @__PURE__ */ jsx13("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx13(Loader, { size: 24 }) })
1854
1924
  ] })
1855
1925
  ] }),
1856
- /* @__PURE__ */ jsx12("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx12(Footer, { items: mappedData }) })
1926
+ /* @__PURE__ */ jsx13("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx13(Footer, { items: mappedData }) })
1857
1927
  ]
1858
1928
  }
1859
1929
  ) })
@@ -1863,7 +1933,7 @@ var ExternalInput = ({
1863
1933
  };
1864
1934
 
1865
1935
  // components/AutoField/fields/ExternalField/index.tsx
1866
- import { jsx as jsx13 } from "react/jsx-runtime";
1936
+ import { jsx as jsx14 } from "react/jsx-runtime";
1867
1937
  var ExternalField = ({
1868
1938
  field,
1869
1939
  onChange,
@@ -1887,7 +1957,7 @@ var ExternalField = ({
1887
1957
  if (field.type !== "external") {
1888
1958
  return null;
1889
1959
  }
1890
- return /* @__PURE__ */ jsx13(Label2, { label: label || name, icon: /* @__PURE__ */ jsx13(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx13(
1960
+ return /* @__PURE__ */ jsx14(Label2, { label: label || name, icon: /* @__PURE__ */ jsx14(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ jsx14(
1891
1961
  ExternalInput,
1892
1962
  {
1893
1963
  name,
@@ -1912,7 +1982,7 @@ var ExternalField = ({
1912
1982
 
1913
1983
  // components/AutoField/fields/RadioField/index.tsx
1914
1984
  init_react_import();
1915
- import { useMemo as useMemo2 } from "react";
1985
+ import { useMemo as useMemo3 } from "react";
1916
1986
 
1917
1987
  // lib/safe-json-parse.ts
1918
1988
  init_react_import();
@@ -1926,7 +1996,7 @@ var safeJsonParse = (str) => {
1926
1996
  };
1927
1997
 
1928
1998
  // components/AutoField/fields/RadioField/index.tsx
1929
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
1999
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1930
2000
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
1931
2001
  var RadioField = ({
1932
2002
  field,
@@ -1938,26 +2008,26 @@ var RadioField = ({
1938
2008
  label,
1939
2009
  Label: Label2
1940
2010
  }) => {
1941
- const flatOptions = useMemo2(
2011
+ const flatOptions = useMemo3(
1942
2012
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
1943
2013
  [field]
1944
2014
  );
1945
2015
  if (field.type !== "radio" || !field.options) {
1946
2016
  return null;
1947
2017
  }
1948
- return /* @__PURE__ */ jsx14(
2018
+ return /* @__PURE__ */ jsx15(
1949
2019
  Label2,
1950
2020
  {
1951
- icon: /* @__PURE__ */ jsx14(CircleCheckBig, { size: 16 }),
2021
+ icon: /* @__PURE__ */ jsx15(CircleCheckBig, { size: 16 }),
1952
2022
  label: label || name,
1953
2023
  readOnly,
1954
2024
  el: "div",
1955
- children: /* @__PURE__ */ jsx14("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs7(
2025
+ children: /* @__PURE__ */ jsx15("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ jsxs7(
1956
2026
  "label",
1957
2027
  {
1958
2028
  className: getClassName11("radio"),
1959
2029
  children: [
1960
- /* @__PURE__ */ jsx14(
2030
+ /* @__PURE__ */ jsx15(
1961
2031
  "input",
1962
2032
  {
1963
2033
  type: "radio",
@@ -1977,7 +2047,7 @@ var RadioField = ({
1977
2047
  checked: value === option.value
1978
2048
  }
1979
2049
  ),
1980
- /* @__PURE__ */ jsx14("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2050
+ /* @__PURE__ */ jsx15("div", { className: getClassName11("radioInner"), children: option.label || option.value })
1981
2051
  ]
1982
2052
  },
1983
2053
  option.label + option.value
@@ -1988,8 +2058,8 @@ var RadioField = ({
1988
2058
 
1989
2059
  // components/AutoField/fields/SelectField/index.tsx
1990
2060
  init_react_import();
1991
- import { useMemo as useMemo3 } from "react";
1992
- import { jsx as jsx15 } from "react/jsx-runtime";
2061
+ import { useMemo as useMemo4 } from "react";
2062
+ import { jsx as jsx16 } from "react/jsx-runtime";
1993
2063
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
1994
2064
  var SelectField = ({
1995
2065
  field,
@@ -2001,20 +2071,20 @@ var SelectField = ({
2001
2071
  readOnly,
2002
2072
  id
2003
2073
  }) => {
2004
- const flatOptions = useMemo3(
2074
+ const flatOptions = useMemo4(
2005
2075
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
2006
2076
  [field]
2007
2077
  );
2008
2078
  if (field.type !== "select" || !field.options) {
2009
2079
  return null;
2010
2080
  }
2011
- return /* @__PURE__ */ jsx15(
2081
+ return /* @__PURE__ */ jsx16(
2012
2082
  Label2,
2013
2083
  {
2014
2084
  label: label || name,
2015
- icon: /* @__PURE__ */ jsx15(ChevronDown, { size: 16 }),
2085
+ icon: /* @__PURE__ */ jsx16(ChevronDown, { size: 16 }),
2016
2086
  readOnly,
2017
- children: /* @__PURE__ */ jsx15(
2087
+ children: /* @__PURE__ */ jsx16(
2018
2088
  "select",
2019
2089
  {
2020
2090
  id,
@@ -2031,7 +2101,7 @@ var SelectField = ({
2031
2101
  }
2032
2102
  },
2033
2103
  value,
2034
- children: field.options.map((option) => /* @__PURE__ */ jsx15(
2104
+ children: field.options.map((option) => /* @__PURE__ */ jsx16(
2035
2105
  "option",
2036
2106
  {
2037
2107
  label: option.label,
@@ -2047,7 +2117,7 @@ var SelectField = ({
2047
2117
 
2048
2118
  // components/AutoField/fields/TextareaField/index.tsx
2049
2119
  init_react_import();
2050
- import { jsx as jsx16 } from "react/jsx-runtime";
2120
+ import { jsx as jsx17 } from "react/jsx-runtime";
2051
2121
  var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
2052
2122
  var TextareaField = ({
2053
2123
  onChange,
@@ -2058,7 +2128,7 @@ var TextareaField = ({
2058
2128
  Label: Label2,
2059
2129
  id
2060
2130
  }) => {
2061
- return /* @__PURE__ */ jsx16(Label2, { label: label || name, icon: /* @__PURE__ */ jsx16(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx16(
2131
+ return /* @__PURE__ */ jsx17(Label2, { label: label || name, icon: /* @__PURE__ */ jsx17(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ jsx17(
2062
2132
  "textarea",
2063
2133
  {
2064
2134
  id,
@@ -2085,7 +2155,7 @@ init_react_import();
2085
2155
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2086
2156
 
2087
2157
  // components/AutoField/fields/ObjectField/index.tsx
2088
- import { jsx as jsx17 } from "react/jsx-runtime";
2158
+ import { jsx as jsx18 } from "react/jsx-runtime";
2089
2159
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2090
2160
  var ObjectField = ({
2091
2161
  field,
@@ -2097,43 +2167,54 @@ var ObjectField = ({
2097
2167
  readOnly,
2098
2168
  id
2099
2169
  }) => {
2100
- const { selectedItem } = useAppContext();
2170
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
2101
2171
  if (field.type !== "object" || !field.objectFields) {
2102
2172
  return null;
2103
2173
  }
2104
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
2105
2174
  const data = value || {};
2106
- return /* @__PURE__ */ jsx17(
2175
+ return /* @__PURE__ */ jsx18(
2107
2176
  Label2,
2108
2177
  {
2109
2178
  label: label || name,
2110
- icon: /* @__PURE__ */ jsx17(EllipsisVertical, { size: 16 }),
2179
+ icon: /* @__PURE__ */ jsx18(EllipsisVertical, { size: 16 }),
2111
2180
  el: "div",
2112
2181
  readOnly,
2113
- children: /* @__PURE__ */ jsx17("div", { className: getClassName14(), children: /* @__PURE__ */ jsx17("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
2114
- const subField = field.objectFields[fieldName];
2115
- const subFieldName = `${name}.${fieldName}`;
2116
- const wildcardFieldName = `${name}.${fieldName}`;
2117
- const subReadOnly = readOnly ? readOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
2118
- return /* @__PURE__ */ jsx17(
2119
- AutoFieldPrivate,
2182
+ children: /* @__PURE__ */ jsx18("div", { className: getClassName14(), children: /* @__PURE__ */ jsx18("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
2183
+ const subField = field.objectFields[subName];
2184
+ const subPath = `${name}.${subName}`;
2185
+ const localSubPath = `${localName || name}.${subName}`;
2186
+ const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
2187
+ const label2 = subField.label || subName;
2188
+ return /* @__PURE__ */ jsx18(
2189
+ NestedFieldProvider,
2120
2190
  {
2121
- name: subFieldName,
2122
- label: subField.label || fieldName,
2123
- id: `${id}_${fieldName}`,
2124
- readOnly: subReadOnly,
2125
- field: subField,
2126
- value: data[fieldName],
2127
- onChange: (val, ui) => {
2128
- onChange(
2129
- __spreadProps(__spreadValues({}, data), {
2130
- [fieldName]: val
2191
+ name: localName || id,
2192
+ subName,
2193
+ readOnlyFields,
2194
+ children: /* @__PURE__ */ jsx18(
2195
+ AutoFieldPrivate,
2196
+ {
2197
+ name: subPath,
2198
+ label: subPath,
2199
+ id: `${id}_${subName}`,
2200
+ readOnly: subReadOnly,
2201
+ field: __spreadProps(__spreadValues({}, subField), {
2202
+ label: label2
2203
+ // May be used by custom fields
2131
2204
  }),
2132
- ui
2133
- );
2134
- }
2205
+ value: data[subName],
2206
+ onChange: (val, ui) => {
2207
+ onChange(
2208
+ __spreadProps(__spreadValues({}, data), {
2209
+ [subName]: val
2210
+ }),
2211
+ ui
2212
+ );
2213
+ }
2214
+ }
2215
+ )
2135
2216
  },
2136
- subFieldName
2217
+ subPath
2137
2218
  );
2138
2219
  }) }) })
2139
2220
  }
@@ -2159,7 +2240,7 @@ var useSafeId = () => {
2159
2240
  };
2160
2241
 
2161
2242
  // components/AutoField/index.tsx
2162
- import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
2243
+ import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
2163
2244
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2164
2245
  var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2165
2246
  var FieldLabel = ({
@@ -2173,14 +2254,14 @@ var FieldLabel = ({
2173
2254
  const El = el;
2174
2255
  return /* @__PURE__ */ jsxs8(El, { className, children: [
2175
2256
  /* @__PURE__ */ jsxs8("div", { className: getClassName15("label"), children: [
2176
- icon ? /* @__PURE__ */ jsx18("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx18(Fragment4, {}),
2257
+ icon ? /* @__PURE__ */ jsx19("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ jsx19(Fragment4, {}),
2177
2258
  label,
2178
- readOnly && /* @__PURE__ */ jsx18("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx18(Lock, { size: "12" }) })
2259
+ readOnly && /* @__PURE__ */ jsx19("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ jsx19(Lock, { size: "12" }) })
2179
2260
  ] }),
2180
2261
  children
2181
2262
  ] });
2182
2263
  };
2183
- var FieldLabelInternal2 = ({
2264
+ var FieldLabelInternal = ({
2184
2265
  children,
2185
2266
  icon,
2186
2267
  label,
@@ -2188,14 +2269,14 @@ var FieldLabelInternal2 = ({
2188
2269
  readOnly
2189
2270
  }) => {
2190
2271
  const { overrides } = useAppContext();
2191
- const Wrapper = useMemo4(
2272
+ const Wrapper = useMemo5(
2192
2273
  () => overrides.fieldLabel || FieldLabel,
2193
2274
  [overrides]
2194
2275
  );
2195
2276
  if (!label) {
2196
- return /* @__PURE__ */ jsx18(Fragment4, { children });
2277
+ return /* @__PURE__ */ jsx19(Fragment4, { children });
2197
2278
  }
2198
- return /* @__PURE__ */ jsx18(
2279
+ return /* @__PURE__ */ jsx19(
2199
2280
  Wrapper,
2200
2281
  {
2201
2282
  label,
@@ -2209,8 +2290,9 @@ var FieldLabelInternal2 = ({
2209
2290
  };
2210
2291
  function AutoFieldInternal(props) {
2211
2292
  var _a, _b, _c, _d, _e, _f, _g, _h;
2212
- const { dispatch, overrides } = useAppContext();
2213
- const { id, Label: Label2 = FieldLabelInternal2 } = props;
2293
+ const { dispatch, overrides, selectedItem } = useAppContext();
2294
+ const nestedFieldContext = useContext3(NestedFieldContext);
2295
+ const { id, Label: Label2 = FieldLabelInternal } = props;
2214
2296
  const field = props.field;
2215
2297
  const label = field.label;
2216
2298
  const defaultId = useSafeId();
@@ -2270,20 +2352,29 @@ function AutoFieldInternal(props) {
2270
2352
  return null;
2271
2353
  }
2272
2354
  const CustomField = field.render;
2273
- return /* @__PURE__ */ jsx18("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx18("div", { className: getClassName15(), children: /* @__PURE__ */ jsx18(CustomField, __spreadValues({}, mergedProps)) }) });
2355
+ return /* @__PURE__ */ jsx19("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ jsx19("div", { className: getClassName15(), children: /* @__PURE__ */ jsx19(CustomField, __spreadValues({}, mergedProps)) }) });
2274
2356
  }
2275
2357
  const children = defaultFields[field.type](mergedProps);
2276
2358
  const Render2 = render[field.type];
2277
- return /* @__PURE__ */ jsx18(
2278
- "div",
2359
+ return /* @__PURE__ */ jsx19(
2360
+ NestedFieldContext.Provider,
2279
2361
  {
2280
- className: getClassNameWrapper(),
2281
- onFocus,
2282
- onBlur,
2283
- onClick: (e) => {
2284
- e.stopPropagation();
2362
+ value: {
2363
+ readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
2364
+ localName: nestedFieldContext.localName
2285
2365
  },
2286
- children: /* @__PURE__ */ jsx18(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2366
+ children: /* @__PURE__ */ jsx19(
2367
+ "div",
2368
+ {
2369
+ className: getClassNameWrapper(),
2370
+ onFocus,
2371
+ onBlur,
2372
+ onClick: (e) => {
2373
+ e.stopPropagation();
2374
+ },
2375
+ children: /* @__PURE__ */ jsx19(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2376
+ }
2377
+ )
2287
2378
  }
2288
2379
  );
2289
2380
  }
@@ -2311,11 +2402,11 @@ function AutoFieldPrivate(props) {
2311
2402
  value: localValue,
2312
2403
  onChange: onChangeLocal
2313
2404
  };
2314
- return /* @__PURE__ */ jsx18(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2405
+ return /* @__PURE__ */ jsx19(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2315
2406
  }
2316
2407
  function AutoField(props) {
2317
- const DefaultLabel = useMemo4(() => {
2318
- const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx18(
2408
+ const DefaultLabel = useMemo5(() => {
2409
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx19(
2319
2410
  "div",
2320
2411
  __spreadProps(__spreadValues({}, labelProps), {
2321
2412
  className: getClassName15({ readOnly: props.readOnly })
@@ -2323,7 +2414,7 @@ function AutoField(props) {
2323
2414
  );
2324
2415
  return DefaultLabel2;
2325
2416
  }, [props.readOnly]);
2326
- return /* @__PURE__ */ jsx18(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2417
+ return /* @__PURE__ */ jsx19(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2327
2418
  }
2328
2419
 
2329
2420
  // components/Drawer/index.tsx
@@ -2334,18 +2425,19 @@ init_react_import();
2334
2425
  var styles_module_default10 = { "Drawer": "_Drawer_fkqfo_1", "Drawer-draggable": "_Drawer-draggable_fkqfo_8", "Drawer-draggableBg": "_Drawer-draggableBg_fkqfo_12", "Drawer-draggableFg": "_Drawer-draggableFg_fkqfo_21", "DrawerItem-draggable": "_DrawerItem-draggable_fkqfo_25", "DrawerItem--disabled": "_DrawerItem--disabled_fkqfo_38", "DrawerItem": "_DrawerItem_fkqfo_25", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_fkqfo_48", "DrawerItem-name": "_DrawerItem-name_fkqfo_66" };
2335
2426
 
2336
2427
  // components/Drawer/index.tsx
2337
- import { useMemo as useMemo8, useState as useState17 } from "react";
2428
+ import { useId as useId2, useMemo as useMemo9, useState as useState18 } from "react";
2338
2429
 
2339
2430
  // components/DragDropContext/index.tsx
2340
2431
  init_react_import();
2341
2432
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
2342
2433
  import {
2343
- createContext as createContext3,
2344
- useCallback as useCallback9,
2345
- useContext as useContext4,
2346
- useEffect as useEffect13,
2347
- useRef as useRef5,
2348
- useState as useState16
2434
+ createContext as createContext4,
2435
+ useCallback as useCallback11,
2436
+ useContext as useContext7,
2437
+ useEffect as useEffect15,
2438
+ useId,
2439
+ useRef as useRef4,
2440
+ useState as useState17
2349
2441
  } from "react";
2350
2442
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2351
2443
 
@@ -2353,23 +2445,22 @@ import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2353
2445
  init_react_import();
2354
2446
  import {
2355
2447
  forwardRef as forwardRef3,
2356
- useCallback as useCallback8,
2357
- useContext as useContext3,
2358
- useEffect as useEffect12,
2359
- useMemo as useMemo7,
2360
- useRef as useRef4,
2361
- useState as useState15
2448
+ useCallback as useCallback10,
2449
+ useContext as useContext6,
2450
+ useEffect as useEffect14,
2451
+ useMemo as useMemo8,
2452
+ useRef as useRef3
2362
2453
  } from "react";
2363
2454
 
2364
2455
  // components/DraggableComponent/index.tsx
2365
2456
  init_react_import();
2366
2457
  import {
2367
- useCallback as useCallback6,
2368
- useContext as useContext2,
2458
+ useCallback as useCallback7,
2459
+ useContext as useContext5,
2369
2460
  useEffect as useEffect10,
2370
- useMemo as useMemo5,
2371
- useRef as useRef3,
2372
- useState as useState12
2461
+ useMemo as useMemo7,
2462
+ useRef as useRef2,
2463
+ useState as useState13
2373
2464
  } from "react";
2374
2465
 
2375
2466
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
@@ -2379,18 +2470,18 @@ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8
2379
2470
  // components/DraggableComponent/index.tsx
2380
2471
  import { createPortal as createPortal2 } from "react-dom";
2381
2472
 
2382
- // components/DraggableComponent/collision/dynamic/index.ts
2473
+ // lib/dnd/collision/dynamic/index.ts
2383
2474
  init_react_import();
2384
2475
  import {
2385
2476
  CollisionPriority as CollisionPriority7,
2386
2477
  CollisionType as CollisionType7
2387
2478
  } from "@dnd-kit/abstract";
2388
2479
 
2389
- // components/DraggableComponent/collision/directional/index.ts
2480
+ // lib/dnd/collision/directional/index.ts
2390
2481
  init_react_import();
2391
2482
  import { CollisionType } from "@dnd-kit/abstract";
2392
2483
 
2393
- // components/DraggableComponent/collision/collision-debug.ts
2484
+ // lib/dnd/collision/collision-debug.ts
2394
2485
  init_react_import();
2395
2486
  var DEBUG = false;
2396
2487
  var debugElements = {};
@@ -2439,7 +2530,7 @@ var collisionDebug = (a, b, id, color, label) => {
2439
2530
  });
2440
2531
  };
2441
2532
 
2442
- // components/DraggableComponent/collision/directional/index.ts
2533
+ // lib/dnd/collision/directional/index.ts
2443
2534
  var distanceChange = "increasing";
2444
2535
  var directionalCollision = (input, previous) => {
2445
2536
  var _a;
@@ -2472,7 +2563,7 @@ var directionalCollision = (input, previous) => {
2472
2563
  return null;
2473
2564
  };
2474
2565
 
2475
- // components/DraggableComponent/collision/dynamic/get-direction.ts
2566
+ // lib/dnd/collision/dynamic/get-direction.ts
2476
2567
  init_react_import();
2477
2568
  var getDirection = (dragAxis, delta) => {
2478
2569
  if (dragAxis === "dynamic") {
@@ -2487,7 +2578,7 @@ var getDirection = (dragAxis, delta) => {
2487
2578
  return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
2488
2579
  };
2489
2580
 
2490
- // components/DraggableComponent/collision/dynamic/get-midpoint-impact.ts
2581
+ // lib/dnd/collision/dynamic/get-midpoint-impact.ts
2491
2582
  init_react_import();
2492
2583
  var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
2493
2584
  const dragRect = dragShape.boundingRectangle;
@@ -2506,7 +2597,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
2506
2597
  return dragRect.right - offset >= dropCenter.x;
2507
2598
  };
2508
2599
 
2509
- // components/DraggableComponent/collision/dynamic/track-movement-interval.ts
2600
+ // lib/dnd/collision/dynamic/track-movement-interval.ts
2510
2601
  init_react_import();
2511
2602
  import { Point } from "@dnd-kit/geometry";
2512
2603
  var INTERVAL_SENSITIVITY = 10;
@@ -2610,7 +2701,14 @@ var closestCorners = (input) => {
2610
2701
  };
2611
2702
  };
2612
2703
 
2613
- // components/DraggableComponent/collision/dynamic/index.ts
2704
+ // lib/dnd/collision/dynamic/store.ts
2705
+ init_react_import();
2706
+ import { createStore } from "zustand/vanilla";
2707
+ var collisionStore = createStore(() => ({
2708
+ fallbackEnabled: false
2709
+ }));
2710
+
2711
+ // lib/dnd/collision/dynamic/index.ts
2614
2712
  var flushNext = "";
2615
2713
  var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
2616
2714
  var _a, _b, _c, _d, _e;
@@ -2622,6 +2720,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2622
2720
  return null;
2623
2721
  }
2624
2722
  const { center: dragCenter } = dragShape;
2723
+ const { fallbackEnabled } = collisionStore.getState();
2625
2724
  const interval = trackMovementInterval(position.current, dragAxis);
2626
2725
  dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
2627
2726
  direction: interval.direction
@@ -2667,7 +2766,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2667
2766
  flushNext = "";
2668
2767
  return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
2669
2768
  }
2670
- if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2769
+ if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2671
2770
  const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
2672
2771
  const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
2673
2772
  if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
@@ -2728,8 +2827,107 @@ function getDeepScrollPosition(element) {
2728
2827
  return totalScroll;
2729
2828
  }
2730
2829
 
2830
+ // components/DropZone/context.tsx
2831
+ init_react_import();
2832
+ import {
2833
+ createContext as createContext3,
2834
+ useCallback as useCallback6,
2835
+ useMemo as useMemo6,
2836
+ useState as useState12
2837
+ } from "react";
2838
+ import { createStore as createStore2 } from "zustand";
2839
+ import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
2840
+ var dropZoneContext = createContext3(null);
2841
+ var ZoneStoreContext = createContext3(
2842
+ createStore2(() => ({
2843
+ zoneDepthIndex: {},
2844
+ nextZoneDepthIndex: {},
2845
+ areaDepthIndex: {},
2846
+ nextAreaDepthIndex: {},
2847
+ draggedItem: null,
2848
+ previewIndex: {}
2849
+ }))
2850
+ );
2851
+ var ZoneStoreProvider = ({
2852
+ children,
2853
+ store
2854
+ }) => {
2855
+ return /* @__PURE__ */ jsx20(ZoneStoreContext.Provider, { value: store, children });
2856
+ };
2857
+ var DropZoneProvider = ({
2858
+ children,
2859
+ value
2860
+ }) => {
2861
+ const [hoveringComponent, setHoveringComponent] = useState12();
2862
+ const [areasWithZones, setAreasWithZones] = useState12(
2863
+ {}
2864
+ );
2865
+ const [activeZones, setActiveZones] = useState12({});
2866
+ const { dispatch } = useAppContext();
2867
+ const registerZoneArea = useCallback6(
2868
+ (area) => {
2869
+ setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
2870
+ },
2871
+ [setAreasWithZones]
2872
+ );
2873
+ const registerZone = useCallback6(
2874
+ (zoneCompound) => {
2875
+ if (!dispatch) {
2876
+ return;
2877
+ }
2878
+ dispatch({
2879
+ type: "registerZone",
2880
+ zone: zoneCompound
2881
+ });
2882
+ setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
2883
+ },
2884
+ [setActiveZones, dispatch]
2885
+ );
2886
+ const unregisterZone = useCallback6(
2887
+ (zoneCompound) => {
2888
+ if (!dispatch) {
2889
+ return;
2890
+ }
2891
+ dispatch({
2892
+ type: "unregisterZone",
2893
+ zone: zoneCompound
2894
+ });
2895
+ setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
2896
+ [zoneCompound]: false
2897
+ }));
2898
+ },
2899
+ [setActiveZones, dispatch]
2900
+ );
2901
+ const memoValue = useMemo6(
2902
+ () => __spreadValues({
2903
+ hoveringComponent,
2904
+ setHoveringComponent,
2905
+ registerZoneArea,
2906
+ areasWithZones,
2907
+ registerZone,
2908
+ unregisterZone,
2909
+ activeZones
2910
+ }, value),
2911
+ [value, hoveringComponent, areasWithZones, activeZones]
2912
+ );
2913
+ return /* @__PURE__ */ jsx20(Fragment5, { children: memoValue && /* @__PURE__ */ jsx20(dropZoneContext.Provider, { value: memoValue, children }) });
2914
+ };
2915
+
2916
+ // lib/use-context-store.ts
2917
+ init_react_import();
2918
+ import { useContext as useContext4 } from "react";
2919
+ import { useStore } from "zustand";
2920
+ import { useShallow } from "zustand/react/shallow";
2921
+ function useContextStore(context, selector) {
2922
+ const store = useContext4(context);
2923
+ if (!store) {
2924
+ throw new Error("useContextStore must be used inside context");
2925
+ }
2926
+ return useStore(store, useShallow(selector));
2927
+ }
2928
+
2731
2929
  // components/DraggableComponent/index.tsx
2732
- import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
2930
+ import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
2733
2931
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
2734
2932
  var DEBUG2 = false;
2735
2933
  var space = 8;
@@ -2743,9 +2941,9 @@ var DefaultActionBar = ({
2743
2941
  }) => /* @__PURE__ */ jsxs9(ActionBar, { children: [
2744
2942
  /* @__PURE__ */ jsxs9(ActionBar.Group, { children: [
2745
2943
  parentAction,
2746
- label && /* @__PURE__ */ jsx19(ActionBar.Label, { label })
2944
+ label && /* @__PURE__ */ jsx21(ActionBar.Label, { label })
2747
2945
  ] }),
2748
- /* @__PURE__ */ jsx19(ActionBar.Group, { children })
2946
+ /* @__PURE__ */ jsx21(ActionBar.Group, { children })
2749
2947
  ] });
2750
2948
  var convertIdToSelector = (id, zoneCompound, data) => {
2751
2949
  const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
@@ -2780,9 +2978,9 @@ var DraggableComponent = ({
2780
2978
  iframe,
2781
2979
  state
2782
2980
  } = useAppContext();
2783
- const ctx = useContext2(dropZoneContext);
2784
- const [localZones, setLocalZones] = useState12({});
2785
- const registerLocalZone = useCallback6(
2981
+ const ctx = useContext5(dropZoneContext);
2982
+ const [localZones, setLocalZones] = useState13({});
2983
+ const registerLocalZone = useCallback7(
2786
2984
  (zoneCompound2, active) => {
2787
2985
  var _a;
2788
2986
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -2792,7 +2990,7 @@ var DraggableComponent = ({
2792
2990
  },
2793
2991
  [setLocalZones]
2794
2992
  );
2795
- const unregisterLocalZone = useCallback6(
2993
+ const unregisterLocalZone = useCallback7(
2796
2994
  (zoneCompound2) => {
2797
2995
  var _a;
2798
2996
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -2806,7 +3004,7 @@ var DraggableComponent = ({
2806
3004
  );
2807
3005
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
2808
3006
  const { path = [] } = ctx || {};
2809
- const [canDrag, setCanDrag] = useState12(false);
3007
+ const [canDrag, setCanDrag] = useState13(false);
2810
3008
  useEffect10(() => {
2811
3009
  var _a;
2812
3010
  const item = getItem({ index, zone: zoneCompound }, state.data);
@@ -2817,10 +3015,13 @@ var DraggableComponent = ({
2817
3015
  setCanDrag((_a = perms.drag) != null ? _a : true);
2818
3016
  }
2819
3017
  }, [state, index, zoneCompound, getPermissions]);
2820
- const userIsDragging = !!(ctx == null ? void 0 : ctx.draggedItem);
3018
+ const userIsDragging = useContextStore(
3019
+ ZoneStoreContext,
3020
+ (s) => !!s.draggedItem
3021
+ );
2821
3022
  const canCollide = canDrag || userIsDragging;
2822
3023
  const disabled = !isEnabled || !canCollide;
2823
- const [dragAxis, setDragAxis] = useState12(userDragAxis || autoDragAxis);
3024
+ const [dragAxis, setDragAxis] = useState13(userDragAxis || autoDragAxis);
2824
3025
  const { ref: sortableRef, status } = useSortableSafe({
2825
3026
  id,
2826
3027
  index,
@@ -2846,8 +3047,8 @@ var DraggableComponent = ({
2846
3047
  }
2847
3048
  });
2848
3049
  const thisIsDragging = status === "dragging";
2849
- const ref = useRef3(null);
2850
- const refSetter = useCallback6(
3050
+ const ref = useRef2(null);
3051
+ const refSetter = useCallback7(
2851
3052
  (el) => {
2852
3053
  sortableRef(el);
2853
3054
  if (el) {
@@ -2856,14 +3057,14 @@ var DraggableComponent = ({
2856
3057
  },
2857
3058
  [sortableRef]
2858
3059
  );
2859
- const [portalEl, setPortalEl] = useState12();
3060
+ const [portalEl, setPortalEl] = useState13();
2860
3061
  useEffect10(() => {
2861
3062
  var _a, _b, _c;
2862
3063
  setPortalEl(
2863
3064
  iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
2864
3065
  );
2865
3066
  }, [iframe.enabled, ref.current]);
2866
- const getStyle = useCallback6(() => {
3067
+ const getStyle = useCallback7(() => {
2867
3068
  var _a, _b, _c;
2868
3069
  if (!ref.current) return;
2869
3070
  const rect = ref.current.getBoundingClientRect();
@@ -2883,8 +3084,8 @@ var DraggableComponent = ({
2883
3084
  };
2884
3085
  return style2;
2885
3086
  }, [ref.current]);
2886
- const [style, setStyle] = useState12();
2887
- const sync = useCallback6(() => {
3087
+ const [style, setStyle] = useState13();
3088
+ const sync = useCallback7(() => {
2888
3089
  setStyle(getStyle());
2889
3090
  }, [ref.current, iframe]);
2890
3091
  useEffect10(() => {
@@ -2897,19 +3098,21 @@ var DraggableComponent = ({
2897
3098
  }
2898
3099
  }, [ref.current]);
2899
3100
  useEffect10(() => {
2900
- ctx == null ? void 0 : ctx.registerPath({
2901
- index,
2902
- zone: zoneCompound
2903
- });
3101
+ if (isSelected) {
3102
+ ctx == null ? void 0 : ctx.registerPath({
3103
+ index,
3104
+ zone: zoneCompound
3105
+ });
3106
+ }
2904
3107
  }, [isSelected]);
2905
- const CustomActionBar = useMemo5(
3108
+ const CustomActionBar = useMemo7(
2906
3109
  () => overrides.actionBar || DefaultActionBar,
2907
3110
  [overrides.actionBar]
2908
3111
  );
2909
3112
  const permissions = getPermissions({
2910
3113
  item: selectedItem
2911
3114
  });
2912
- const onClick = useCallback6(
3115
+ const onClick = useCallback7(
2913
3116
  (e) => {
2914
3117
  e.stopPropagation();
2915
3118
  dispatch({
@@ -2921,7 +3124,7 @@ var DraggableComponent = ({
2921
3124
  },
2922
3125
  [index, zoneCompound, id]
2923
3126
  );
2924
- const onSelectParent = useCallback6(() => {
3127
+ const onSelectParent = useCallback7(() => {
2925
3128
  if (!(ctx == null ? void 0 : ctx.areaId)) {
2926
3129
  return;
2927
3130
  }
@@ -2939,21 +3142,21 @@ var DraggableComponent = ({
2939
3142
  }
2940
3143
  });
2941
3144
  }, [ctx, path]);
2942
- const onDuplicate = useCallback6(() => {
3145
+ const onDuplicate = useCallback7(() => {
2943
3146
  dispatch({
2944
3147
  type: "duplicate",
2945
3148
  sourceIndex: index,
2946
3149
  sourceZone: zoneCompound
2947
3150
  });
2948
3151
  }, [index, zoneCompound]);
2949
- const onDelete = useCallback6(() => {
3152
+ const onDelete = useCallback7(() => {
2950
3153
  dispatch({
2951
3154
  type: "remove",
2952
3155
  index,
2953
3156
  zone: zoneCompound
2954
3157
  });
2955
3158
  }, [index, zoneCompound]);
2956
- const [hover, setHover] = useState12(false);
3159
+ const [hover, setHover] = useState13(false);
2957
3160
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
2958
3161
  useEffect10(() => {
2959
3162
  if (!ref.current) {
@@ -3014,7 +3217,7 @@ var DraggableComponent = ({
3014
3217
  };
3015
3218
  }
3016
3219
  }, [disabled, ref]);
3017
- const [isVisible, setIsVisible] = useState12(false);
3220
+ const [isVisible, setIsVisible] = useState13(false);
3018
3221
  useEffect10(() => {
3019
3222
  sync();
3020
3223
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
@@ -3023,7 +3226,7 @@ var DraggableComponent = ({
3023
3226
  setIsVisible(false);
3024
3227
  }
3025
3228
  }, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
3026
- const syncActionsPosition = useCallback6(
3229
+ const syncActionsPosition = useCallback7(
3027
3230
  (el) => {
3028
3231
  if (el) {
3029
3232
  const view = el.ownerDocument.defaultView;
@@ -3054,7 +3257,7 @@ var DraggableComponent = ({
3054
3257
  }
3055
3258
  setDragAxis(autoDragAxis);
3056
3259
  }, [ref, userDragAxis, autoDragAxis]);
3057
- const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx19(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ jsx19(CornerLeftUp, { size: 16 }) });
3260
+ const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ jsx21(CornerLeftUp, { size: 16 }) });
3058
3261
  return /* @__PURE__ */ jsxs9(
3059
3262
  DropZoneProvider,
3060
3263
  {
@@ -3081,15 +3284,15 @@ var DraggableComponent = ({
3081
3284
  "data-puck-overlay": true,
3082
3285
  children: [
3083
3286
  debug,
3084
- isLoading && /* @__PURE__ */ jsx19("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ jsx19(Loader, {}) }),
3085
- /* @__PURE__ */ jsx19(
3287
+ isLoading && /* @__PURE__ */ jsx21("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ jsx21(Loader, {}) }),
3288
+ /* @__PURE__ */ jsx21(
3086
3289
  "div",
3087
3290
  {
3088
3291
  className: getClassName16("actionsOverlay"),
3089
3292
  style: {
3090
3293
  top: actionsOverlayTop / zoomConfig.zoom
3091
3294
  },
3092
- children: /* @__PURE__ */ jsx19(
3295
+ children: /* @__PURE__ */ jsx21(
3093
3296
  "div",
3094
3297
  {
3095
3298
  className: getClassName16("actions"),
@@ -3107,8 +3310,8 @@ var DraggableComponent = ({
3107
3310
  parentAction,
3108
3311
  label: DEBUG2 ? id : label,
3109
3312
  children: [
3110
- permissions.duplicate && /* @__PURE__ */ jsx19(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx19(Copy, { size: 16 }) }),
3111
- permissions.delete && /* @__PURE__ */ jsx19(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx19(Trash, { size: 16 }) })
3313
+ permissions.duplicate && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx21(Copy, { size: 16 }) }),
3314
+ permissions.delete && /* @__PURE__ */ jsx21(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx21(Trash, { size: 16 }) })
3112
3315
  ]
3113
3316
  }
3114
3317
  )
@@ -3116,7 +3319,7 @@ var DraggableComponent = ({
3116
3319
  )
3117
3320
  }
3118
3321
  ),
3119
- /* @__PURE__ */ jsx19("div", { className: getClassName16("overlay") })
3322
+ /* @__PURE__ */ jsx21("div", { className: getClassName16("overlay") })
3120
3323
  ]
3121
3324
  }
3122
3325
  ),
@@ -3132,98 +3335,26 @@ var DraggableComponent = ({
3132
3335
  init_react_import();
3133
3336
  var styles_module_default12 = { "DropZone": "_DropZone_kmkdc_1", "DropZone--isActive": "_DropZone--isActive_kmkdc_10", "DropZone--hasChildren": "_DropZone--hasChildren_kmkdc_14", "DropZone--userIsDragging": "_DropZone--userIsDragging_kmkdc_22", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_kmkdc_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_kmkdc_27", "DropZone--isRootZone": "_DropZone--isRootZone_kmkdc_27", "DropZone--isDestination": "_DropZone--isDestination_kmkdc_37", "DropZone-item": "_DropZone-item_kmkdc_49", "DropZone-hitbox": "_DropZone-hitbox_kmkdc_53", "DropZone--isEnabled": "_DropZone--isEnabled_kmkdc_61", "DropZone--isAnimating": "_DropZone--isAnimating_kmkdc_70" };
3134
3337
 
3135
- // components/DropZone/context.tsx
3136
- init_react_import();
3137
- import {
3138
- createContext as createContext2,
3139
- useCallback as useCallback7,
3140
- useMemo as useMemo6,
3141
- useState as useState13
3142
- } from "react";
3143
- import { Fragment as Fragment5, jsx as jsx20 } from "react/jsx-runtime";
3144
- var dropZoneContext = createContext2(null);
3145
- var DropZoneProvider = ({
3146
- children,
3147
- value
3148
- }) => {
3149
- const [hoveringComponent, setHoveringComponent] = useState13();
3150
- const [areasWithZones, setAreasWithZones] = useState13(
3151
- {}
3152
- );
3153
- const [activeZones, setActiveZones] = useState13({});
3154
- const { dispatch } = useAppContext();
3155
- const registerZoneArea = useCallback7(
3156
- (area) => {
3157
- setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
3158
- },
3159
- [setAreasWithZones]
3160
- );
3161
- const registerZone = useCallback7(
3162
- (zoneCompound) => {
3163
- if (!dispatch) {
3164
- return;
3165
- }
3166
- dispatch({
3167
- type: "registerZone",
3168
- zone: zoneCompound
3169
- });
3170
- setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
3171
- },
3172
- [setActiveZones, dispatch]
3173
- );
3174
- const unregisterZone = useCallback7(
3175
- (zoneCompound) => {
3176
- if (!dispatch) {
3177
- return;
3178
- }
3179
- dispatch({
3180
- type: "unregisterZone",
3181
- zone: zoneCompound
3182
- });
3183
- setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
3184
- [zoneCompound]: false
3185
- }));
3186
- },
3187
- [setActiveZones, dispatch]
3188
- );
3189
- const memoValue = useMemo6(
3190
- () => __spreadValues({
3191
- hoveringComponent,
3192
- setHoveringComponent,
3193
- registerZoneArea,
3194
- areasWithZones,
3195
- registerZone,
3196
- unregisterZone,
3197
- activeZones
3198
- }, value),
3199
- [value, hoveringComponent, areasWithZones, activeZones]
3200
- );
3201
- return /* @__PURE__ */ jsx20(Fragment5, { children: memoValue && /* @__PURE__ */ jsx20(dropZoneContext.Provider, { value: memoValue, children }) });
3202
- };
3203
-
3204
- // lib/insert.ts
3205
- init_react_import();
3206
- var insert = (list, index, item) => {
3207
- const result = Array.from(list);
3208
- result.splice(index, 0, item);
3209
- return result;
3210
- };
3211
-
3212
- // components/DropZone/use-min-empty-height.ts
3338
+ // components/DropZone/lib/use-min-empty-height.ts
3213
3339
  init_react_import();
3214
3340
  import { useEffect as useEffect11, useState as useState14 } from "react";
3215
3341
  var useMinEmptyHeight = ({
3216
- draggedItem,
3217
3342
  zoneCompound,
3218
3343
  userMinEmptyHeight,
3219
3344
  ref
3220
3345
  }) => {
3221
3346
  const [prevHeight, setPrevHeight] = useState14(0);
3222
3347
  const [isAnimating, setIsAnimating] = useState14(false);
3348
+ const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3349
+ var _a, _b;
3350
+ return {
3351
+ draggedItem: ((_a = s.draggedItem) == null ? void 0 : _a.data.zone) === zoneCompound ? s.draggedItem : null,
3352
+ isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
3353
+ };
3354
+ });
3223
3355
  useEffect11(() => {
3224
3356
  if (draggedItem && ref.current) {
3225
- const componentData = draggedItem.data;
3226
- if (componentData.zone === zoneCompound) {
3357
+ if (isZone) {
3227
3358
  const rect = ref.current.getBoundingClientRect();
3228
3359
  setPrevHeight(rect.height);
3229
3360
  setIsAnimating(true);
@@ -3253,15 +3384,131 @@ function assignRefs(refs, node) {
3253
3384
  });
3254
3385
  }
3255
3386
 
3256
- // components/DropZone/index.tsx
3257
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
3258
- var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
3259
- var DEBUG3 = false;
3387
+ // components/DropZone/lib/use-content-with-preview.ts
3388
+ init_react_import();
3389
+ import { useEffect as useEffect12, useState as useState15 } from "react";
3390
+
3391
+ // lib/dnd/use-rendered-callback.ts
3392
+ init_react_import();
3393
+ import { useDragDropManager } from "@dnd-kit/react";
3394
+ import { useCallback as useCallback8 } from "react";
3395
+ function useRenderedCallback(callback, deps) {
3396
+ const manager = useDragDropManager();
3397
+ return useCallback8(
3398
+ (...args) => __async(this, null, function* () {
3399
+ yield manager == null ? void 0 : manager.renderer.rendering;
3400
+ return callback(...args);
3401
+ }),
3402
+ [...deps, manager]
3403
+ );
3404
+ }
3405
+
3406
+ // lib/insert.ts
3407
+ init_react_import();
3408
+ var insert = (list, index, item) => {
3409
+ const result = Array.from(list);
3410
+ result.splice(index, 0, item);
3411
+ return result;
3412
+ };
3413
+
3414
+ // components/DropZone/lib/use-content-with-preview.ts
3415
+ var useContentWithPreview = (content, zoneCompound) => {
3416
+ const { draggedItemId, preview, previewExists } = useContextStore(
3417
+ ZoneStoreContext,
3418
+ (s) => {
3419
+ var _a;
3420
+ return {
3421
+ draggedItemId: (_a = s.draggedItem) == null ? void 0 : _a.id,
3422
+ preview: s.previewIndex[zoneCompound],
3423
+ previewExists: Object.keys(s.previewIndex || {}).length > 0
3424
+ };
3425
+ }
3426
+ );
3427
+ const [contentWithPreview, setContentWithPreview] = useState15(content);
3428
+ const updateContent = useRenderedCallback(
3429
+ (content2, preview2) => {
3430
+ if (preview2) {
3431
+ if (preview2.type === "insert") {
3432
+ setContentWithPreview(
3433
+ insert(
3434
+ content2.filter((item) => item.props.id !== preview2.props.id),
3435
+ preview2.index,
3436
+ {
3437
+ type: "preview",
3438
+ props: { id: preview2.props.id }
3439
+ }
3440
+ )
3441
+ );
3442
+ } else {
3443
+ setContentWithPreview(
3444
+ insert(
3445
+ content2.filter((item) => item.props.id !== preview2.props.id),
3446
+ preview2.index,
3447
+ {
3448
+ type: preview2.componentType,
3449
+ props: preview2.props
3450
+ }
3451
+ )
3452
+ );
3453
+ }
3454
+ } else {
3455
+ setContentWithPreview(
3456
+ previewExists ? content2.filter((item) => item.props.id !== draggedItemId) : content2
3457
+ );
3458
+ }
3459
+ },
3460
+ [draggedItemId, previewExists]
3461
+ );
3462
+ useEffect12(() => {
3463
+ updateContent(content, preview);
3464
+ }, [content, preview]);
3465
+ return contentWithPreview;
3466
+ };
3467
+
3468
+ // components/DropZone/lib/use-drag-axis.ts
3469
+ init_react_import();
3470
+ import { useCallback as useCallback9, useEffect as useEffect13, useState as useState16 } from "react";
3260
3471
  var GRID_DRAG_AXIS = "dynamic";
3261
3472
  var FLEX_ROW_DRAG_AXIS = "x";
3262
3473
  var DEFAULT_DRAG_AXIS = "y";
3474
+ var useDragAxis = (ref, collisionAxis) => {
3475
+ const { status } = useAppContext();
3476
+ const [dragAxis, setDragAxis] = useState16(
3477
+ collisionAxis || DEFAULT_DRAG_AXIS
3478
+ );
3479
+ const calculateDragAxis = useCallback9(() => {
3480
+ if (ref.current) {
3481
+ const computedStyle = window.getComputedStyle(ref.current);
3482
+ if (computedStyle.display === "grid") {
3483
+ setDragAxis(GRID_DRAG_AXIS);
3484
+ } else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
3485
+ setDragAxis(FLEX_ROW_DRAG_AXIS);
3486
+ } else {
3487
+ setDragAxis(DEFAULT_DRAG_AXIS);
3488
+ }
3489
+ }
3490
+ }, [ref.current]);
3491
+ useEffect13(() => {
3492
+ const onViewportChange = () => {
3493
+ calculateDragAxis();
3494
+ };
3495
+ window.addEventListener("viewportchange", onViewportChange);
3496
+ return () => {
3497
+ window.removeEventListener("viewportchange", onViewportChange);
3498
+ };
3499
+ }, []);
3500
+ useEffect13(calculateDragAxis, [status, collisionAxis]);
3501
+ return [dragAxis, calculateDragAxis];
3502
+ };
3503
+
3504
+ // components/DropZone/index.tsx
3505
+ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
3506
+ var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
3507
+ var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
3508
+ var RENDER_DEBUG = false;
3509
+ var DropZoneEditPure = (props) => /* @__PURE__ */ jsx22(DropZoneEdit, __spreadValues({}, props));
3263
3510
  var DropZoneEdit = forwardRef3(
3264
- function DropZoneEdit2({
3511
+ function DropZoneEditInternal({
3265
3512
  zone,
3266
3513
  allow,
3267
3514
  disallow,
@@ -3271,31 +3518,50 @@ var DropZoneEdit = forwardRef3(
3271
3518
  collisionAxis
3272
3519
  }, userRef) {
3273
3520
  const appContext2 = useAppContext();
3274
- const ctx = useContext3(dropZoneContext);
3521
+ const ctx = useContext6(dropZoneContext);
3275
3522
  const {
3276
3523
  // These all need setting via context
3277
3524
  data,
3278
3525
  config,
3279
3526
  areaId,
3280
- draggedItem,
3281
3527
  registerZoneArea,
3282
3528
  depth,
3283
3529
  registerLocalZone,
3284
3530
  unregisterLocalZone,
3285
- deepestZone = rootDroppableId,
3286
- deepestArea,
3287
- nextDeepestArea,
3288
3531
  path = [],
3289
3532
  activeZones
3290
3533
  } = ctx;
3291
- const { itemSelector } = appContext2.state.ui;
3292
3534
  let zoneCompound = rootDroppableId;
3293
- useEffect12(() => {
3535
+ if (areaId) {
3536
+ if (zone !== rootDroppableId) {
3537
+ zoneCompound = `${areaId}:${zone}`;
3538
+ }
3539
+ }
3540
+ const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
3541
+ const {
3542
+ isDeepestZone,
3543
+ inNextDeepestArea,
3544
+ draggedComponentType,
3545
+ userIsDragging,
3546
+ preview
3547
+ } = useContextStore(ZoneStoreContext, (s) => {
3548
+ var _a, _b, _c;
3549
+ return {
3550
+ isDeepestZone: (_a = s.zoneDepthIndex[zoneCompound]) != null ? _a : false,
3551
+ inNextDeepestArea: s.nextAreaDepthIndex[areaId || ""],
3552
+ draggedItemId: (_b = s.draggedItem) == null ? void 0 : _b.id,
3553
+ draggedComponentType: (_c = s.draggedItem) == null ? void 0 : _c.data.componentType,
3554
+ userIsDragging: !!s.draggedItem,
3555
+ preview: s.previewIndex[zoneCompound]
3556
+ };
3557
+ });
3558
+ const { itemSelector } = appContext2.state.ui;
3559
+ useEffect14(() => {
3294
3560
  if (areaId && registerZoneArea) {
3295
3561
  registerZoneArea(areaId);
3296
3562
  }
3297
3563
  }, [areaId]);
3298
- useEffect12(() => {
3564
+ useEffect14(() => {
3299
3565
  if (ctx == null ? void 0 : ctx.registerZone) {
3300
3566
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3301
3567
  }
@@ -3305,25 +3571,18 @@ var DropZoneEdit = forwardRef3(
3305
3571
  }
3306
3572
  };
3307
3573
  }, []);
3308
- if (areaId) {
3309
- if (zone !== rootDroppableId) {
3310
- zoneCompound = `${areaId}:${zone}`;
3311
- }
3312
- }
3313
- const content = useMemo7(() => {
3574
+ const content = useMemo8(() => {
3314
3575
  if (areaId && zone !== rootDroppableId) {
3315
3576
  return setupZone(data, zoneCompound).zones[zoneCompound];
3316
3577
  }
3317
3578
  return data.content || [];
3318
3579
  }, [data, zoneCompound]);
3319
- const ref = useRef4(null);
3320
- const acceptsTarget = useCallback8(
3321
- (target) => {
3322
- if (!target) {
3580
+ const ref = useRef3(null);
3581
+ const acceptsTarget = useCallback10(
3582
+ (componentType) => {
3583
+ if (!componentType) {
3323
3584
  return true;
3324
3585
  }
3325
- const data2 = target.data;
3326
- const { componentType } = data2;
3327
3586
  if (disallow) {
3328
3587
  const defaultedAllow = allow || [];
3329
3588
  const filteredDisallow = (disallow || []).filter(
@@ -3341,49 +3600,26 @@ var DropZoneEdit = forwardRef3(
3341
3600
  },
3342
3601
  [allow, disallow]
3343
3602
  );
3344
- useEffect12(() => {
3603
+ useEffect14(() => {
3345
3604
  if (registerLocalZone) {
3346
- registerLocalZone(zoneCompound, acceptsTarget(draggedItem));
3605
+ registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
3347
3606
  }
3348
3607
  return () => {
3349
3608
  if (unregisterLocalZone) {
3350
3609
  unregisterLocalZone(zoneCompound);
3351
3610
  }
3352
3611
  };
3353
- }, [draggedItem, zoneCompound]);
3354
- const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
3355
- const hoveringOverArea = nextDeepestArea ? nextDeepestArea === areaId : isRootZone;
3356
- const userIsDragging = !!draggedItem;
3612
+ }, [draggedComponentType, zoneCompound]);
3613
+ const hoveringOverArea = inNextDeepestArea || isRootZone;
3357
3614
  let isEnabled = true;
3358
- if (draggedItem) {
3359
- isEnabled = deepestZone === zoneCompound;
3615
+ if (userIsDragging) {
3616
+ isEnabled = isDeepestZone;
3360
3617
  }
3361
3618
  if (isEnabled) {
3362
- isEnabled = acceptsTarget(draggedItem);
3363
- }
3364
- const preview = useContext3(previewContext);
3365
- const previewInZone = (preview == null ? void 0 : preview.zone) === zoneCompound;
3366
- const contentWithPreview = useMemo7(() => {
3367
- let contentWithPreview2 = preview ? content.filter((item) => item.props.id !== preview.props.id) : content;
3368
- if (previewInZone) {
3369
- contentWithPreview2 = content.filter(
3370
- (item) => item.props.id !== preview.props.id
3371
- );
3372
- if (preview.type === "insert") {
3373
- contentWithPreview2 = insert(contentWithPreview2, preview.index, {
3374
- type: "preview",
3375
- props: { id: preview.props.id }
3376
- });
3377
- } else {
3378
- contentWithPreview2 = insert(contentWithPreview2, preview.index, {
3379
- type: preview.componentType,
3380
- props: preview.props
3381
- });
3382
- }
3383
- }
3384
- return contentWithPreview2;
3385
- }, [preview, content]);
3386
- const isDropEnabled = isEnabled && (previewInZone ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
3619
+ isEnabled = acceptsTarget(draggedComponentType);
3620
+ }
3621
+ const contentWithPreview = useContentWithPreview(content, zoneCompound);
3622
+ const isDropEnabled = isEnabled && (preview ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
3387
3623
  const droppableConfig = {
3388
3624
  id: zoneCompound,
3389
3625
  collisionPriority: isEnabled ? depth : 0,
@@ -3393,45 +3629,20 @@ var DropZoneEdit = forwardRef3(
3393
3629
  data: {
3394
3630
  areaId,
3395
3631
  depth,
3396
- isDroppableTarget: acceptsTarget(draggedItem),
3632
+ isDroppableTarget: acceptsTarget(draggedComponentType),
3397
3633
  path
3398
3634
  }
3399
3635
  };
3400
3636
  const { ref: dropRef } = useDroppableSafe(droppableConfig);
3401
3637
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
3402
3638
  const isAreaSelected = selectedItem && areaId === selectedItem.props.id;
3403
- const [dragAxis, setDragAxis] = useState15(
3404
- collisionAxis || DEFAULT_DRAG_AXIS
3405
- );
3406
- const calculateDragAxis = useCallback8(() => {
3407
- if (ref.current) {
3408
- const computedStyle = window.getComputedStyle(ref.current);
3409
- if (computedStyle.display === "grid") {
3410
- setDragAxis(GRID_DRAG_AXIS);
3411
- } else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
3412
- setDragAxis(FLEX_ROW_DRAG_AXIS);
3413
- } else {
3414
- setDragAxis(DEFAULT_DRAG_AXIS);
3415
- }
3416
- }
3417
- }, [ref.current]);
3418
- useEffect12(calculateDragAxis, [appContext2.status, collisionAxis]);
3419
- useEffect12(() => {
3420
- const onViewportChange = () => {
3421
- calculateDragAxis();
3422
- };
3423
- window.addEventListener("viewportchange", onViewportChange);
3424
- return () => {
3425
- window.removeEventListener("viewportchange", onViewportChange);
3426
- };
3427
- }, []);
3639
+ const [dragAxis] = useDragAxis(ref, collisionAxis);
3428
3640
  const [minEmptyHeight, isAnimating] = useMinEmptyHeight({
3429
- draggedItem,
3430
3641
  zoneCompound,
3431
3642
  userMinEmptyHeight,
3432
3643
  ref
3433
3644
  });
3434
- return /* @__PURE__ */ jsxs10(
3645
+ return /* @__PURE__ */ jsx22(
3435
3646
  "div",
3436
3647
  {
3437
3648
  className: `${getClassName17({
@@ -3451,88 +3662,84 @@ var DropZoneEdit = forwardRef3(
3451
3662
  "data-puck-dropzone": zoneCompound,
3452
3663
  "data-puck-dnd": zoneCompound,
3453
3664
  style: __spreadProps(__spreadValues({}, style), {
3454
- "--min-empty-height": `${minEmptyHeight}px`
3665
+ "--min-empty-height": `${minEmptyHeight}px`,
3666
+ backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
3455
3667
  }),
3456
- children: [
3457
- isRootZone && DEBUG3 && /* @__PURE__ */ jsxs10("div", { "data-puck-component": true, children: [
3458
- /* @__PURE__ */ jsx21("p", { children: deepestZone || rootDroppableId }),
3459
- /* @__PURE__ */ jsx21("p", { children: deepestArea || "No area" })
3460
- ] }),
3461
- contentWithPreview.map((item, i) => {
3462
- var _a, _b, _c, _d, _e;
3463
- const componentId = item.props.id;
3464
- const puckProps = {
3465
- renderDropZone: DropZone,
3466
- isEditing: true,
3467
- dragRef: null
3668
+ children: contentWithPreview.map((item, i) => {
3669
+ var _a, _b, _c, _d, _e, _f, _g;
3670
+ const componentId = item.props.id;
3671
+ const puckProps = {
3672
+ renderDropZone: DropZoneEditPure,
3673
+ isEditing: true,
3674
+ dragRef: null
3675
+ };
3676
+ const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
3677
+ puck: puckProps,
3678
+ editMode: true
3679
+ // DEPRECATED
3680
+ });
3681
+ const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
3682
+ let Render2 = config.components[item.type] && item.type !== "preview" ? config.components[item.type].render : () => /* @__PURE__ */ jsxs10("div", { style: { padding: 48, textAlign: "center" }, children: [
3683
+ "No configuration for ",
3684
+ item.type
3685
+ ] });
3686
+ const componentConfig = config.components[item.type];
3687
+ let componentType = item.type;
3688
+ let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
3689
+ if (item.type === "preview") {
3690
+ let Preview4 = function() {
3691
+ return /* @__PURE__ */ jsx22(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
3468
3692
  };
3469
- const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
3470
- puck: puckProps,
3471
- editMode: true
3472
- // DEPRECATED
3473
- });
3474
- const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
3475
- let Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ jsxs10("div", { style: { padding: 48, textAlign: "center" }, children: [
3476
- "No configuration for ",
3477
- item.type
3478
- ] });
3479
- const componentConfig = config.components[item.type];
3480
- let componentType = item.type;
3481
- let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
3482
- if (item.type === "preview") {
3483
- let Preview3 = function() {
3484
- return /* @__PURE__ */ jsx21(DrawerItemInner, { name: label });
3485
- };
3486
- var Preview2 = Preview3;
3487
- componentType = preview.componentType;
3488
- label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
3489
- Render2 = Preview3;
3490
- }
3491
- return /* @__PURE__ */ jsx21(
3492
- DropZoneProvider,
3493
- {
3494
- value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
3495
- children: /* @__PURE__ */ jsx21(
3496
- DraggableComponent,
3497
- {
3498
- id: componentId,
3499
- componentType,
3500
- zoneCompound,
3501
- depth: depth + 1,
3502
- index: i,
3503
- isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
3504
- isSelected,
3505
- label,
3506
- isEnabled,
3507
- autoDragAxis: dragAxis,
3508
- userDragAxis: collisionAxis,
3509
- inDroppableZone: acceptsTarget(draggedItem),
3510
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ jsx21(
3511
- Render2,
3512
- __spreadProps(__spreadValues({}, defaultedProps), {
3513
- puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
3514
- dragRef
3515
- })
3693
+ var Preview3 = Preview4;
3694
+ componentType = (_c = preview == null ? void 0 : preview.componentType) != null ? _c : "__preview";
3695
+ label = (_f = (_e = (_d = config.components[componentType]) == null ? void 0 : _d.label) != null ? _e : componentType) != null ? _f : "Preview";
3696
+ Render2 = Preview4;
3697
+ }
3698
+ return /* @__PURE__ */ jsx22(
3699
+ DropZoneProvider,
3700
+ {
3701
+ value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
3702
+ children: /* @__PURE__ */ jsx22(
3703
+ DraggableComponent,
3704
+ {
3705
+ id: componentId,
3706
+ componentType,
3707
+ zoneCompound,
3708
+ depth: depth + 1,
3709
+ index: i,
3710
+ isLoading: ((_g = appContext2.componentState[componentId]) == null ? void 0 : _g.loadingCount) > 0,
3711
+ isSelected,
3712
+ label,
3713
+ isEnabled,
3714
+ autoDragAxis: dragAxis,
3715
+ userDragAxis: collisionAxis,
3716
+ inDroppableZone: acceptsTarget(draggedComponentType),
3717
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ jsx22(
3718
+ Render2,
3719
+ __spreadProps(__spreadValues({}, defaultedProps), {
3720
+ puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
3721
+ dragRef
3516
3722
  })
3517
- ) : /* @__PURE__ */ jsx21("div", { ref: dragRef, children: /* @__PURE__ */ jsx21(Render2, __spreadValues({}, defaultedProps)) })
3518
- }
3519
- )
3520
- },
3521
- componentId
3522
- );
3523
- })
3524
- ]
3723
+ })
3724
+ ) : /* @__PURE__ */ jsx22("div", { ref: dragRef, children: /* @__PURE__ */ jsx22(Render2, __spreadValues({}, defaultedProps)) })
3725
+ }
3726
+ )
3727
+ },
3728
+ componentId
3729
+ );
3730
+ })
3525
3731
  }
3526
3732
  );
3527
3733
  }
3528
3734
  );
3735
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx22(DropZoneRender, __spreadValues({}, props));
3529
3736
  var DropZoneRender = forwardRef3(
3530
- function DropZoneRender2({ className, style, zone }, ref) {
3531
- const ctx = useContext3(dropZoneContext);
3737
+ function DropZoneRenderInternal({ className, style, zone }, ref) {
3738
+ const ctx = useContext6(dropZoneContext);
3532
3739
  const { data, areaId = "root", config } = ctx || {};
3533
3740
  let zoneCompound = rootDroppableId;
3534
3741
  let content = (data == null ? void 0 : data.content) || [];
3535
- useEffect12(() => {
3742
+ useEffect14(() => {
3536
3743
  if (ctx == null ? void 0 : ctx.registerZone) {
3537
3744
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3538
3745
  }
@@ -3549,10 +3756,10 @@ var DropZoneRender = forwardRef3(
3549
3756
  zoneCompound = `${areaId}:${zone}`;
3550
3757
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3551
3758
  }
3552
- return /* @__PURE__ */ jsx21("div", { className, style, ref, children: content.map((item) => {
3759
+ return /* @__PURE__ */ jsx22("div", { className, style, ref, children: content.map((item) => {
3553
3760
  const Component = config.components[item.type];
3554
3761
  if (Component) {
3555
- return /* @__PURE__ */ jsx21(
3762
+ return /* @__PURE__ */ jsx22(
3556
3763
  DropZoneProvider,
3557
3764
  {
3558
3765
  value: {
@@ -3562,10 +3769,12 @@ var DropZoneRender = forwardRef3(
3562
3769
  depth: 1,
3563
3770
  path: []
3564
3771
  },
3565
- children: /* @__PURE__ */ jsx21(
3772
+ children: /* @__PURE__ */ jsx22(
3566
3773
  Component.render,
3567
3774
  __spreadProps(__spreadValues({}, item.props), {
3568
- puck: { renderDropZone: DropZoneRender2 }
3775
+ puck: {
3776
+ renderDropZone: DropZoneRenderPure
3777
+ }
3569
3778
  })
3570
3779
  )
3571
3780
  },
@@ -3578,11 +3787,11 @@ var DropZoneRender = forwardRef3(
3578
3787
  );
3579
3788
  var DropZone = forwardRef3(
3580
3789
  function DropZone2(props, ref) {
3581
- const ctx = useContext3(dropZoneContext);
3790
+ const ctx = useContext6(dropZoneContext);
3582
3791
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
3583
- return /* @__PURE__ */ jsx21(Fragment6, { children: /* @__PURE__ */ jsx21(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3792
+ return /* @__PURE__ */ jsx22(Fragment6, { children: /* @__PURE__ */ jsx22(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3584
3793
  }
3585
- return /* @__PURE__ */ jsx21(Fragment6, { children: /* @__PURE__ */ jsx21(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3794
+ return /* @__PURE__ */ jsx22(Fragment6, { children: /* @__PURE__ */ jsx22(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3586
3795
  }
3587
3796
  );
3588
3797
 
@@ -3598,7 +3807,7 @@ var getZoneId = (zoneCompound) => {
3598
3807
  return [rootDroppableId, zoneCompound];
3599
3808
  };
3600
3809
 
3601
- // components/DragDropContext/NestedDroppablePlugin.ts
3810
+ // lib/dnd/NestedDroppablePlugin.ts
3602
3811
  init_react_import();
3603
3812
  import { Plugin } from "@dnd-kit/abstract";
3604
3813
  import { effects } from "@dnd-kit/state";
@@ -3640,7 +3849,49 @@ var getFrame = () => {
3640
3849
  return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
3641
3850
  };
3642
3851
 
3643
- // components/DragDropContext/NestedDroppablePlugin.ts
3852
+ // lib/global-position.ts
3853
+ init_react_import();
3854
+ var GlobalPosition = class {
3855
+ constructor(target, original) {
3856
+ this.scaleFactor = 1;
3857
+ this.frameEl = null;
3858
+ this.frameRect = null;
3859
+ var _a;
3860
+ this.target = target;
3861
+ this.original = original;
3862
+ this.frameEl = document.querySelector("iframe");
3863
+ if (this.frameEl) {
3864
+ this.frameRect = this.frameEl.getBoundingClientRect();
3865
+ this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
3866
+ }
3867
+ }
3868
+ get x() {
3869
+ return this.original.x;
3870
+ }
3871
+ get y() {
3872
+ return this.original.y;
3873
+ }
3874
+ get global() {
3875
+ if (document !== this.target.ownerDocument && this.frameRect) {
3876
+ return {
3877
+ x: this.x * this.scaleFactor + this.frameRect.left,
3878
+ y: this.y * this.scaleFactor + this.frameRect.top
3879
+ };
3880
+ }
3881
+ return this.original;
3882
+ }
3883
+ get frame() {
3884
+ if (document === this.target.ownerDocument && this.frameRect) {
3885
+ return {
3886
+ x: (this.x - this.frameRect.left) / this.scaleFactor,
3887
+ y: (this.y - this.frameRect.top) / this.scaleFactor
3888
+ };
3889
+ }
3890
+ return this.original;
3891
+ }
3892
+ };
3893
+
3894
+ // lib/dnd/NestedDroppablePlugin.ts
3644
3895
  var depthSort = (candidates) => {
3645
3896
  return candidates.sort((a, b) => {
3646
3897
  const aData = a.data;
@@ -3669,10 +3920,12 @@ var getZoneId2 = (candidate) => {
3669
3920
  }
3670
3921
  return id;
3671
3922
  };
3672
- var getPointerCollisions = (position, manager, ownerDocument) => {
3673
- var _a;
3923
+ var getPointerCollisions = (position, manager) => {
3674
3924
  const candidates = [];
3675
- let elements = ownerDocument.elementsFromPoint(position.x, position.y);
3925
+ let elements = position.target.ownerDocument.elementsFromPoint(
3926
+ position.x,
3927
+ position.y
3928
+ );
3676
3929
  const previewFrame = elements.find(
3677
3930
  (el) => el.getAttribute("data-puck-preview")
3678
3931
  );
@@ -3681,17 +3934,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
3681
3934
  elements = [drawer];
3682
3935
  }
3683
3936
  if (previewFrame) {
3684
- const iframe = previewFrame.querySelector("iframe");
3685
- if (iframe) {
3686
- const rect = iframe.getBoundingClientRect();
3687
- const frame = getFrame();
3688
- if (frame) {
3689
- const scaleFactor = rect.width / (((_a = iframe.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
3690
- elements = frame.elementsFromPoint(
3691
- (position.x - rect.left) / scaleFactor,
3692
- (position.y - rect.top) / scaleFactor
3693
- );
3694
- }
3937
+ const frame = getFrame();
3938
+ if (frame) {
3939
+ elements = frame.elementsFromPoint(position.frame.x, position.frame.y);
3695
3940
  }
3696
3941
  }
3697
3942
  if (elements) {
@@ -3708,9 +3953,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
3708
3953
  }
3709
3954
  return candidates;
3710
3955
  };
3711
- var findDeepestCandidate = (position, manager, ownerDocument) => {
3956
+ var findDeepestCandidate = (position, manager) => {
3712
3957
  var _a;
3713
- const candidates = getPointerCollisions(position, manager, ownerDocument);
3958
+ const candidates = getPointerCollisions(position, manager);
3714
3959
  if (candidates.length > 0) {
3715
3960
  const sortedCandidates = depthSort(candidates);
3716
3961
  const draggable = manager.dragOperation.source;
@@ -3755,9 +4000,7 @@ var findDeepestCandidate = (position, manager, ownerDocument) => {
3755
4000
  area: null
3756
4001
  };
3757
4002
  };
3758
- var createNestedDroppablePlugin = ({
3759
- onChange
3760
- }) => class NestedDroppablePlugin extends Plugin {
4003
+ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends Plugin {
3761
4004
  constructor(manager, options) {
3762
4005
  super(manager);
3763
4006
  if (typeof window === "undefined") {
@@ -3765,16 +4008,19 @@ var createNestedDroppablePlugin = ({
3765
4008
  }
3766
4009
  const cleanupEffect = effects(() => {
3767
4010
  const handleMove = (event) => {
3768
- const position = {
4011
+ const target = event.originalTarget || event.target;
4012
+ const position = new GlobalPosition(target, {
3769
4013
  x: event.clientX,
3770
4014
  y: event.clientY
3771
- };
3772
- const target = event.originalTarget || event.target;
3773
- const ownerDocument = target == null ? void 0 : target.ownerDocument;
3774
- onChange(
3775
- findDeepestCandidate(position, manager, ownerDocument),
3776
- manager
4015
+ });
4016
+ const elements = document.elementsFromPoint(
4017
+ position.global.x,
4018
+ position.global.y
3777
4019
  );
4020
+ const overEl = elements.some((el) => el.id === id);
4021
+ if (overEl) {
4022
+ onChange(findDeepestCandidate(position, manager), manager);
4023
+ }
3778
4024
  };
3779
4025
  const handleMoveThrottled = throttle(handleMove, 50);
3780
4026
  const handlePointerMove = (event) => {
@@ -4104,6 +4350,11 @@ var reduceUi = (ui, action) => {
4104
4350
  itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
4105
4351
  });
4106
4352
  }
4353
+ if (action.type === "remove") {
4354
+ return __spreadProps(__spreadValues({}, ui), {
4355
+ itemSelector: null
4356
+ });
4357
+ }
4107
4358
  return ui;
4108
4359
  };
4109
4360
 
@@ -4191,7 +4442,7 @@ var insertComponent = (componentType, zone, index, {
4191
4442
  import { useDebouncedCallback as useDebouncedCallback2 } from "use-debounce";
4192
4443
  import { isElement as isElement2 } from "@dnd-kit/dom/utilities";
4193
4444
 
4194
- // components/DragDropContext/PointerSensor.ts
4445
+ // lib/dnd/PointerSensor.ts
4195
4446
  init_react_import();
4196
4447
  import { batch, effect } from "@dnd-kit/state";
4197
4448
  import { Sensor, configurator } from "@dnd-kit/abstract";
@@ -4363,6 +4614,9 @@ var _PointerSensor = class _PointerSensor extends Sensor {
4363
4614
  }
4364
4615
  }
4365
4616
  handlePointerUp(event) {
4617
+ if (!this.source) {
4618
+ return;
4619
+ }
4366
4620
  event.preventDefault();
4367
4621
  event.stopPropagation();
4368
4622
  const { status } = this.manager.dragOperation;
@@ -4462,13 +4716,15 @@ function patchWindow(window2) {
4462
4716
  }
4463
4717
 
4464
4718
  // components/DragDropContext/index.tsx
4465
- import { jsx as jsx22 } from "react/jsx-runtime";
4466
- var dragListenerContext = createContext3({
4719
+ import { createStore as createStore3 } from "zustand";
4720
+ import { jsx as jsx23 } from "react/jsx-runtime";
4721
+ var DEBUG3 = false;
4722
+ var dragListenerContext = createContext4({
4467
4723
  dragListeners: {}
4468
4724
  });
4469
4725
  function useDragListener(type, fn, deps = []) {
4470
- const { setDragListeners } = useContext4(dragListenerContext);
4471
- useEffect13(() => {
4726
+ const { setDragListeners } = useContext7(dragListenerContext);
4727
+ useEffect15(() => {
4472
4728
  if (setDragListeners) {
4473
4729
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4474
4730
  [type]: [...old[type] || [], fn]
@@ -4476,80 +4732,147 @@ function useDragListener(type, fn, deps = []) {
4476
4732
  }
4477
4733
  }, deps);
4478
4734
  }
4479
- var previewContext = createContext3(null);
4480
4735
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4736
+ var useTempDisableFallback = (timeout3) => {
4737
+ const lastFallbackDisable = useRef4(null);
4738
+ return useCallback11((manager) => {
4739
+ collisionStore.setState({ fallbackEnabled: false });
4740
+ const fallbackId = generateId();
4741
+ lastFallbackDisable.current = fallbackId;
4742
+ setTimeout(() => {
4743
+ if (lastFallbackDisable.current === fallbackId) {
4744
+ collisionStore.setState({ fallbackEnabled: true });
4745
+ manager.collisionObserver.forceUpdate(true);
4746
+ }
4747
+ }, timeout3);
4748
+ }, []);
4749
+ };
4481
4750
  var DragDropContextClient = ({
4482
4751
  children,
4483
4752
  disableAutoScroll
4484
4753
  }) => {
4485
4754
  const { state, config, dispatch, resolveData } = useAppContext();
4486
- const [preview, setPreview] = useState16(null);
4487
- const previewRef = useRef5(null);
4755
+ const id = useId();
4488
4756
  const { data } = state;
4489
- const [deepest, setDeepest] = useState16(null);
4490
- const [nextDeepest, setNextDeepest] = useState16(null);
4491
- const deepestRef = useRef5(deepest);
4492
- const debouncedParamsRef = useRef5(null);
4493
- const setDeepestAndCollide = useCallback9(
4757
+ const debouncedParamsRef = useRef4(null);
4758
+ const tempDisableFallback = useTempDisableFallback(100);
4759
+ const [zoneStore] = useState17(
4760
+ () => createStore3(() => ({
4761
+ zoneDepthIndex: {},
4762
+ nextZoneDepthIndex: {},
4763
+ areaDepthIndex: {},
4764
+ nextAreaDepthIndex: {},
4765
+ draggedItem: null,
4766
+ previewIndex: {}
4767
+ }))
4768
+ );
4769
+ const getChanged2 = useCallback11(
4770
+ (params, id2) => {
4771
+ const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4772
+ const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
4773
+ const stateHasArea = Object.keys(areaDepthIndex).length > 0;
4774
+ let zoneChanged = false;
4775
+ let areaChanged = false;
4776
+ if (params.zone && !zoneDepthIndex[params.zone]) {
4777
+ zoneChanged = true;
4778
+ } else if (!params.zone && stateHasZone) {
4779
+ zoneChanged = true;
4780
+ }
4781
+ if (params.area && !areaDepthIndex[params.area]) {
4782
+ areaChanged = true;
4783
+ } else if (!params.area && stateHasArea) {
4784
+ areaChanged = true;
4785
+ }
4786
+ return { zoneChanged, areaChanged };
4787
+ },
4788
+ [zoneStore]
4789
+ );
4790
+ const setDeepestAndCollide = useCallback11(
4494
4791
  (params, manager) => {
4495
- setDeepest(params);
4792
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4793
+ if (!zoneChanged && !areaChanged) return;
4794
+ zoneStore.setState({
4795
+ zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
4796
+ areaDepthIndex: params.area ? { [params.area]: true } : {}
4797
+ });
4798
+ tempDisableFallback(manager);
4496
4799
  setTimeout(() => {
4497
4800
  manager.collisionObserver.forceUpdate(true);
4498
4801
  }, 50);
4499
4802
  debouncedParamsRef.current = null;
4500
4803
  },
4501
- []
4804
+ [zoneStore]
4502
4805
  );
4503
4806
  const setDeepestDb = useDebouncedCallback2(
4504
4807
  setDeepestAndCollide,
4505
4808
  AREA_CHANGE_DEBOUNCE_MS
4506
4809
  );
4507
- useEffect13(() => {
4508
- deepestRef.current = deepest;
4509
- }, [deepest]);
4510
4810
  const cancelDb = () => {
4511
4811
  setDeepestDb.cancel();
4512
4812
  debouncedParamsRef.current = null;
4513
4813
  };
4514
- const [plugins] = useState16(() => [
4515
- ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4516
- createNestedDroppablePlugin({
4517
- onChange: (params, manager) => {
4518
- const lastParams = deepestRef.current;
4519
- const areaChanged = params.area !== (lastParams == null ? void 0 : lastParams.area);
4520
- const zoneChanged = params.zone !== (lastParams == null ? void 0 : lastParams.zone);
4521
- const isDragging = manager.dragOperation.status.dragging;
4522
- if (areaChanged || zoneChanged) {
4523
- setNextDeepest(params);
4524
- }
4525
- if (params.zone !== "void" && (lastParams == null ? void 0 : lastParams.zone) === "void") {
4526
- setDeepest(params);
4527
- manager.collisionObserver.forceUpdate(true);
4528
- return;
4814
+ useEffect15(() => {
4815
+ if (DEBUG3) {
4816
+ zoneStore.subscribe(
4817
+ (s) => {
4818
+ var _a, _b;
4819
+ return console.log(
4820
+ s.previewIndex,
4821
+ (_a = Object.entries(s.zoneDepthIndex || {})[0]) == null ? void 0 : _a[0],
4822
+ (_b = Object.entries(s.areaDepthIndex || {})[0]) == null ? void 0 : _b[0]
4823
+ );
4529
4824
  }
4530
- if (areaChanged) {
4531
- if (isDragging) {
4532
- const debouncedParams = debouncedParamsRef.current;
4533
- const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
4534
- if (!isSameParams) {
4825
+ );
4826
+ }
4827
+ }, []);
4828
+ const [plugins] = useState17(() => [
4829
+ ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4830
+ createNestedDroppablePlugin(
4831
+ {
4832
+ onChange: (params, manager) => {
4833
+ const state2 = zoneStore.getState();
4834
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4835
+ const isDragging = manager.dragOperation.status.dragging;
4836
+ if (areaChanged || zoneChanged) {
4837
+ let nextZoneDepthIndex = {};
4838
+ let nextAreaDepthIndex = {};
4839
+ if (params.zone) {
4840
+ nextZoneDepthIndex = { [params.zone]: true };
4841
+ }
4842
+ if (params.area) {
4843
+ nextAreaDepthIndex = { [params.area]: true };
4844
+ }
4845
+ zoneStore.setState({ nextZoneDepthIndex, nextAreaDepthIndex });
4846
+ }
4847
+ if (params.zone !== "void" && (state2 == null ? void 0 : state2.zoneDepthIndex["void"])) {
4848
+ setDeepestAndCollide(params, manager);
4849
+ return;
4850
+ }
4851
+ if (areaChanged) {
4852
+ if (isDragging) {
4853
+ const debouncedParams = debouncedParamsRef.current;
4854
+ const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
4855
+ if (!isSameParams) {
4856
+ cancelDb();
4857
+ setDeepestDb(params, manager);
4858
+ debouncedParamsRef.current = params;
4859
+ }
4860
+ } else {
4535
4861
  cancelDb();
4536
- setDeepestDb(params, manager);
4537
- debouncedParamsRef.current = params;
4862
+ setDeepestAndCollide(params, manager);
4538
4863
  }
4539
- } else {
4540
- cancelDb();
4864
+ return;
4865
+ }
4866
+ if (zoneChanged) {
4541
4867
  setDeepestAndCollide(params, manager);
4542
4868
  }
4543
- return;
4869
+ cancelDb();
4544
4870
  }
4545
- if (zoneChanged) {
4546
- setDeepestAndCollide(params, manager);
4547
- }
4548
- cancelDb();
4549
- }
4550
- })
4871
+ },
4872
+ id
4873
+ )
4551
4874
  ]);
4552
- const [sensors] = useState16(() => [
4875
+ const [sensors] = useState17(() => [
4553
4876
  PointerSensor.configure({
4554
4877
  activationConstraints(event, source) {
4555
4878
  var _a;
@@ -4568,11 +4891,10 @@ var DragDropContextClient = ({
4568
4891
  }
4569
4892
  })
4570
4893
  ]);
4571
- const [draggedItem, setDraggedItem] = useState16();
4572
- const [dragListeners, setDragListeners] = useState16({});
4573
- const [pathData, setPathData] = useState16();
4574
- const dragMode = useRef5(null);
4575
- const registerPath = useCallback9(
4894
+ const [dragListeners, setDragListeners] = useState17({});
4895
+ const [pathData, setPathData] = useState17();
4896
+ const dragMode = useRef4(null);
4897
+ const registerPath = useCallback11(
4576
4898
  (selector) => {
4577
4899
  const item = getItem(selector, data);
4578
4900
  if (!item) {
@@ -4594,41 +4916,41 @@ var DragDropContextClient = ({
4594
4916
  },
4595
4917
  [data, setPathData]
4596
4918
  );
4597
- const initialSelector = useRef5(void 0);
4598
- return /* @__PURE__ */ jsx22(
4919
+ const initialSelector = useRef4(void 0);
4920
+ return /* @__PURE__ */ jsx23("div", { id, children: /* @__PURE__ */ jsx23(
4599
4921
  dragListenerContext.Provider,
4600
4922
  {
4601
4923
  value: {
4602
4924
  dragListeners,
4603
4925
  setDragListeners
4604
4926
  },
4605
- children: /* @__PURE__ */ jsx22(previewContext.Provider, { value: preview, children: /* @__PURE__ */ jsx22(
4927
+ children: /* @__PURE__ */ jsx23(
4606
4928
  DragDropProvider2,
4607
4929
  {
4608
4930
  plugins,
4609
4931
  sensors,
4610
4932
  onDragEnd: (event, manager) => {
4933
+ var _a;
4611
4934
  const { source, target } = event.operation;
4612
- deepestRef.current = null;
4613
4935
  if (!source) {
4614
- setDraggedItem(null);
4936
+ zoneStore.setState({ draggedItem: null });
4615
4937
  return;
4616
4938
  }
4617
4939
  const { zone, index } = source.data;
4618
- const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
4619
- previewRef.current = null;
4940
+ const { previewIndex = {} } = zoneStore.getState() || {};
4941
+ const thisPreview = ((_a = previewIndex[zone]) == null ? void 0 : _a.props.id) === source.id ? previewIndex[zone] : null;
4620
4942
  setTimeout(() => {
4621
- var _a, _b;
4622
- setDraggedItem(null);
4943
+ var _a2, _b;
4944
+ zoneStore.setState({ draggedItem: null });
4623
4945
  if (event.canceled || (target == null ? void 0 : target.type) === "void") {
4624
- setPreview(null);
4625
- (_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
4946
+ zoneStore.setState({ previewIndex: {} });
4947
+ (_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
4626
4948
  fn(event, manager);
4627
4949
  });
4628
4950
  return;
4629
4951
  }
4630
4952
  if (thisPreview) {
4631
- setPreview(null);
4953
+ zoneStore.setState({ previewIndex: {} });
4632
4954
  if (thisPreview.type === "insert") {
4633
4955
  insertComponent(
4634
4956
  thisPreview.componentType,
@@ -4663,8 +4985,9 @@ var DragDropContextClient = ({
4663
4985
  }, 250);
4664
4986
  },
4665
4987
  onDragOver: (event, manager) => {
4666
- var _a, _b, _c, _d;
4988
+ var _a, _b, _c, _d, _e;
4667
4989
  event.preventDefault();
4990
+ const draggedItem = (_a = zoneStore.getState()) == null ? void 0 : _a.draggedItem;
4668
4991
  if (!draggedItem) return;
4669
4992
  cancelDb();
4670
4993
  const { source, target } = event.operation;
@@ -4680,7 +5003,7 @@ var DragDropContextClient = ({
4680
5003
  const targetData = target.data;
4681
5004
  targetZone = targetData.zone;
4682
5005
  targetIndex = targetData.index;
4683
- const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[targetId];
5006
+ const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
4684
5007
  const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
4685
5008
  if (targetIndex >= sourceIndex && sourceZone === targetZone) {
4686
5009
  targetIndex = targetIndex - 1;
@@ -4692,23 +5015,26 @@ var DragDropContextClient = ({
4692
5015
  targetZone = target.id.toString();
4693
5016
  targetIndex = 0;
4694
5017
  }
4695
- if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
5018
+ if (targetId === sourceId || ((_d = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _d.path.find((path) => {
4696
5019
  const [pathId] = path.split(":");
4697
5020
  return pathId === sourceId;
4698
5021
  }))) {
4699
5022
  return;
4700
5023
  }
4701
5024
  if (dragMode.current === "new") {
4702
- previewRef.current = {
4703
- componentType: sourceData.componentType,
4704
- type: "insert",
4705
- index: targetIndex,
4706
- zone: targetZone,
4707
- props: {
4708
- id: source.id.toString()
5025
+ zoneStore.setState({
5026
+ previewIndex: {
5027
+ [targetZone]: {
5028
+ componentType: sourceData.componentType,
5029
+ type: "insert",
5030
+ index: targetIndex,
5031
+ zone: targetZone,
5032
+ props: {
5033
+ id: source.id.toString()
5034
+ }
5035
+ }
4709
5036
  }
4710
- };
4711
- setPreview(previewRef.current);
5037
+ });
4712
5038
  } else {
4713
5039
  if (!initialSelector.current) {
4714
5040
  initialSelector.current = {
@@ -4718,17 +5044,20 @@ var DragDropContextClient = ({
4718
5044
  }
4719
5045
  const item = getItem(initialSelector.current, data);
4720
5046
  if (item) {
4721
- previewRef.current = {
4722
- componentType: sourceData.componentType,
4723
- type: "move",
4724
- index: targetIndex,
4725
- zone: targetZone,
4726
- props: item.props
4727
- };
4728
- setPreview(previewRef.current);
5047
+ zoneStore.setState({
5048
+ previewIndex: {
5049
+ [targetZone]: {
5050
+ componentType: sourceData.componentType,
5051
+ type: "move",
5052
+ index: targetIndex,
5053
+ zone: targetZone,
5054
+ props: item.props
5055
+ }
5056
+ }
5057
+ });
4729
5058
  }
4730
5059
  }
4731
- (_d = dragListeners.dragover) == null ? void 0 : _d.forEach((fn) => {
5060
+ (_e = dragListeners.dragover) == null ? void 0 : _e.forEach((fn) => {
4732
5061
  fn(event, manager);
4733
5062
  });
4734
5063
  },
@@ -4738,45 +5067,61 @@ var DragDropContextClient = ({
4738
5067
  type: "setUi",
4739
5068
  ui: { itemSelector: null, isDragging: true }
4740
5069
  });
5070
+ const { source } = event.operation;
5071
+ if (source && source.type !== "void") {
5072
+ const sourceData = source.data;
5073
+ const item = getItem(
5074
+ {
5075
+ zone: sourceData.zone,
5076
+ index: sourceData.index
5077
+ },
5078
+ data
5079
+ );
5080
+ if (item) {
5081
+ zoneStore.setState({
5082
+ previewIndex: {
5083
+ [sourceData.zone]: {
5084
+ componentType: sourceData.componentType,
5085
+ type: "move",
5086
+ index: sourceData.index,
5087
+ zone: sourceData.zone,
5088
+ props: item.props
5089
+ }
5090
+ }
5091
+ });
5092
+ }
5093
+ }
4741
5094
  (_a = dragListeners.dragstart) == null ? void 0 : _a.forEach((fn) => {
4742
5095
  fn(event, manager);
4743
5096
  });
4744
5097
  },
4745
5098
  onBeforeDragStart: (event) => {
4746
5099
  var _a;
4747
- if (draggedItem) {
4748
- console.warn("New drag started before previous drag cleaned up");
4749
- }
4750
5100
  const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.data.type) === "drawer";
4751
5101
  dragMode.current = isNewComponent ? "new" : "existing";
4752
5102
  initialSelector.current = void 0;
4753
- setDraggedItem(event.operation.source);
5103
+ zoneStore.setState({ draggedItem: event.operation.source });
4754
5104
  },
4755
- children: /* @__PURE__ */ jsx22(
5105
+ children: /* @__PURE__ */ jsx23(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx23(
4756
5106
  DropZoneProvider,
4757
5107
  {
4758
5108
  value: {
4759
5109
  data,
4760
5110
  config,
4761
- draggedItem,
4762
5111
  mode: "edit",
4763
5112
  areaId: "root",
4764
5113
  depth: 0,
4765
5114
  registerPath,
4766
5115
  pathData,
4767
- deepestZone: deepest == null ? void 0 : deepest.zone,
4768
- deepestArea: deepest == null ? void 0 : deepest.area,
4769
- nextDeepestZone: nextDeepest == null ? void 0 : nextDeepest.zone,
4770
- nextDeepestArea: nextDeepest == null ? void 0 : nextDeepest.area,
4771
5116
  path: []
4772
5117
  },
4773
5118
  children
4774
5119
  }
4775
- )
5120
+ ) })
4776
5121
  }
4777
- ) })
5122
+ )
4778
5123
  }
4779
- );
5124
+ ) });
4780
5125
  };
4781
5126
  var DragDropContext = ({
4782
5127
  children,
@@ -4786,11 +5131,11 @@ var DragDropContext = ({
4786
5131
  if (status === "LOADING") {
4787
5132
  return children;
4788
5133
  }
4789
- return /* @__PURE__ */ jsx22(DragDropContextClient, { disableAutoScroll, children });
5134
+ return /* @__PURE__ */ jsx23(DragDropContextClient, { disableAutoScroll, children });
4790
5135
  };
4791
5136
 
4792
5137
  // components/Drawer/index.tsx
4793
- import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
5138
+ import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
4794
5139
  var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
4795
5140
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
4796
5141
  var DrawerItemInner = ({
@@ -4800,11 +5145,11 @@ var DrawerItemInner = ({
4800
5145
  dragRef,
4801
5146
  isDragDisabled
4802
5147
  }) => {
4803
- const CustomInner = useMemo8(
4804
- () => children || (({ children: children2 }) => /* @__PURE__ */ jsx23("div", { className: getClassNameItem2("default"), children: children2 })),
5148
+ const CustomInner = useMemo9(
5149
+ () => children || (({ children: children2 }) => /* @__PURE__ */ jsx24("div", { className: getClassNameItem2("default"), children: children2 })),
4805
5150
  [children]
4806
5151
  );
4807
- return /* @__PURE__ */ jsx23(
5152
+ return /* @__PURE__ */ jsx24(
4808
5153
  "div",
4809
5154
  {
4810
5155
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -4812,9 +5157,9 @@ var DrawerItemInner = ({
4812
5157
  onMouseDown: (e) => e.preventDefault(),
4813
5158
  "data-testid": dragRef ? `drawer-item:${name}` : "",
4814
5159
  "data-puck-drawer-item": true,
4815
- children: /* @__PURE__ */ jsx23(CustomInner, { name, children: /* @__PURE__ */ jsx23("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs11("div", { className: getClassNameItem2("draggable"), children: [
4816
- /* @__PURE__ */ jsx23("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
4817
- /* @__PURE__ */ jsx23("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx23(DragIcon, {}) })
5160
+ children: /* @__PURE__ */ jsx24(CustomInner, { name, children: /* @__PURE__ */ jsx24("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs11("div", { className: getClassNameItem2("draggable"), children: [
5161
+ /* @__PURE__ */ jsx24("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
5162
+ /* @__PURE__ */ jsx24("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx24(DragIcon, {}) })
4818
5163
  ] }) }) })
4819
5164
  }
4820
5165
  );
@@ -4832,8 +5177,8 @@ var DrawerItemDraggable = ({
4832
5177
  disabled: isDragDisabled
4833
5178
  });
4834
5179
  return /* @__PURE__ */ jsxs11("div", { className: getClassName18("draggable"), children: [
4835
- /* @__PURE__ */ jsx23("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ jsx23(DrawerItemInner, { name, label, children }) }),
4836
- /* @__PURE__ */ jsx23("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ jsx23(
5180
+ /* @__PURE__ */ jsx24("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ jsx24(DrawerItemInner, { name, label, children }) }),
5181
+ /* @__PURE__ */ jsx24("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ jsx24(
4837
5182
  DrawerItemInner,
4838
5183
  {
4839
5184
  name,
@@ -4854,7 +5199,7 @@ var DrawerItem = ({
4854
5199
  isDragDisabled
4855
5200
  }) => {
4856
5201
  const resolvedId = id || name;
4857
- const [dynamicId, setDynamicId] = useState17(generateId(resolvedId));
5202
+ const [dynamicId, setDynamicId] = useState18(generateId(resolvedId));
4858
5203
  if (typeof index !== "undefined") {
4859
5204
  console.error(
4860
5205
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -4867,7 +5212,7 @@ var DrawerItem = ({
4867
5212
  },
4868
5213
  [resolvedId]
4869
5214
  );
4870
- return /* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsx23(
5215
+ return /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24(
4871
5216
  DrawerItemDraggable,
4872
5217
  {
4873
5218
  name,
@@ -4893,14 +5238,14 @@ var Drawer = ({
4893
5238
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
4894
5239
  );
4895
5240
  }
4896
- const [id] = useState17(generateId());
5241
+ const id = useId2();
4897
5242
  const { ref } = useDroppableSafe({
4898
5243
  id,
4899
5244
  type: "void",
4900
5245
  collisionPriority: 0
4901
5246
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
4902
5247
  });
4903
- return /* @__PURE__ */ jsx23(
5248
+ return /* @__PURE__ */ jsx24(
4904
5249
  "div",
4905
5250
  {
4906
5251
  className: getClassName18(),
@@ -4916,11 +5261,11 @@ Drawer.Item = DrawerItem;
4916
5261
  // components/Puck/index.tsx
4917
5262
  init_react_import();
4918
5263
  import {
4919
- useCallback as useCallback15,
4920
- useEffect as useEffect21,
4921
- useMemo as useMemo17,
5264
+ useCallback as useCallback17,
5265
+ useEffect as useEffect23,
5266
+ useMemo as useMemo18,
4922
5267
  useReducer,
4923
- useState as useState25
5268
+ useState as useState26
4924
5269
  } from "react";
4925
5270
 
4926
5271
  // components/SidebarSection/index.tsx
@@ -4932,7 +5277,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
4932
5277
 
4933
5278
  // lib/use-breadcrumbs.ts
4934
5279
  init_react_import();
4935
- import { useContext as useContext5, useMemo as useMemo9 } from "react";
5280
+ import { useContext as useContext8, useMemo as useMemo10 } from "react";
4936
5281
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
4937
5282
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
4938
5283
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -4982,8 +5327,8 @@ var useBreadcrumbs = (renderCount) => {
4982
5327
  state: { data },
4983
5328
  selectedItem
4984
5329
  } = useAppContext();
4985
- const dzContext = useContext5(dropZoneContext);
4986
- return useMemo9(() => {
5330
+ const dzContext = useContext8(dropZoneContext);
5331
+ return useMemo10(() => {
4987
5332
  const breadcrumbs = convertPathDataToBreadcrumbs(
4988
5333
  selectedItem,
4989
5334
  dzContext == null ? void 0 : dzContext.pathData,
@@ -4997,7 +5342,7 @@ var useBreadcrumbs = (renderCount) => {
4997
5342
  };
4998
5343
 
4999
5344
  // components/SidebarSection/index.tsx
5000
- import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
5345
+ import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
5001
5346
  var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
5002
5347
  var SidebarSection = ({
5003
5348
  children,
@@ -5016,9 +5361,9 @@ var SidebarSection = ({
5016
5361
  className: getClassName19({ noBorderTop, noPadding }),
5017
5362
  style: { background },
5018
5363
  children: [
5019
- /* @__PURE__ */ jsx24("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumbs"), children: [
5364
+ /* @__PURE__ */ jsx25("div", { className: getClassName19("title"), children: /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumbs"), children: [
5020
5365
  showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs12("div", { className: getClassName19("breadcrumb"), children: [
5021
- /* @__PURE__ */ jsx24(
5366
+ /* @__PURE__ */ jsx25(
5022
5367
  "button",
5023
5368
  {
5024
5369
  type: "button",
@@ -5027,12 +5372,12 @@ var SidebarSection = ({
5027
5372
  children: breadcrumb.label
5028
5373
  }
5029
5374
  ),
5030
- /* @__PURE__ */ jsx24(ChevronRight, { size: 16 })
5375
+ /* @__PURE__ */ jsx25(ChevronRight, { size: 16 })
5031
5376
  ] }, i)) : null,
5032
- /* @__PURE__ */ jsx24("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx24(Heading, { rank: "2", size: "xs", children: title }) })
5377
+ /* @__PURE__ */ jsx25("div", { className: getClassName19("heading"), children: /* @__PURE__ */ jsx25(Heading, { rank: "2", size: "xs", children: title }) })
5033
5378
  ] }) }),
5034
- /* @__PURE__ */ jsx24("div", { className: getClassName19("content"), children }),
5035
- isLoading && /* @__PURE__ */ jsx24("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx24(Loader, { size: 32 }) })
5379
+ /* @__PURE__ */ jsx25("div", { className: getClassName19("content"), children }),
5380
+ isLoading && /* @__PURE__ */ jsx25("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx25(Loader, { size: 32 }) })
5036
5381
  ]
5037
5382
  }
5038
5383
  );
@@ -5063,7 +5408,7 @@ init_react_import();
5063
5408
  var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
5064
5409
 
5065
5410
  // components/MenuBar/index.tsx
5066
- import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
5411
+ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
5067
5412
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
5068
5413
  function MenuBar({
5069
5414
  appState,
@@ -5077,7 +5422,7 @@ function MenuBar({
5077
5422
  history: { back, forward, historyStore }
5078
5423
  } = useAppContext();
5079
5424
  const { hasFuture = false, hasPast = false } = historyStore || {};
5080
- return /* @__PURE__ */ jsx25(
5425
+ return /* @__PURE__ */ jsx26(
5081
5426
  "div",
5082
5427
  {
5083
5428
  className: getClassName20({ menuOpen }),
@@ -5093,10 +5438,10 @@ function MenuBar({
5093
5438
  },
5094
5439
  children: /* @__PURE__ */ jsxs13("div", { className: getClassName20("inner"), children: [
5095
5440
  /* @__PURE__ */ jsxs13("div", { className: getClassName20("history"), children: [
5096
- /* @__PURE__ */ jsx25(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx25(Undo2, { size: 21 }) }),
5097
- /* @__PURE__ */ jsx25(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx25(Redo2, { size: 21 }) })
5441
+ /* @__PURE__ */ jsx26(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx26(Undo2, { size: 21 }) }),
5442
+ /* @__PURE__ */ jsx26(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ jsx26(Redo2, { size: 21 }) })
5098
5443
  ] }),
5099
- /* @__PURE__ */ jsx25(Fragment7, { children: renderHeaderActions && renderHeaderActions({
5444
+ /* @__PURE__ */ jsx26(Fragment7, { children: renderHeaderActions && renderHeaderActions({
5100
5445
  state: appState,
5101
5446
  dispatch
5102
5447
  }) })
@@ -5107,25 +5452,25 @@ function MenuBar({
5107
5452
 
5108
5453
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
5109
5454
  init_react_import();
5110
- var styles_module_default15 = { "Puck": "_Puck_1g88c_19", "Puck-portal": "_Puck-portal_1g88c_24", "PuckLayout": "_PuckLayout_1g88c_31", "PuckLayout-inner": "_PuckLayout-inner_1g88c_39", "PuckLayout--mounted": "_PuckLayout--mounted_1g88c_51", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1g88c_55", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1g88c_61", "PuckLayout-mounted": "_PuckLayout-mounted_1g88c_75", "PuckLayout-header": "_PuckLayout-header_1g88c_116", "PuckLayout-headerInner": "_PuckLayout-headerInner_1g88c_125", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_1g88c_135", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_1g88c_142", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_1g88c_143", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_1g88c_147", "PuckLayout-headerPath": "_PuckLayout-headerPath_1g88c_151", "PuckLayout-headerTools": "_PuckLayout-headerTools_1g88c_158", "PuckLayout-menuButton": "_PuckLayout-menuButton_1g88c_164", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_1g88c_169", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_1g88c_143", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_1g88c_142" };
5455
+ var styles_module_default15 = { "Puck": "_Puck_12s9r_19", "Puck-portal": "_Puck-portal_12s9r_24", "PuckLayout-inner": "_PuckLayout-inner_12s9r_31", "PuckLayout--mounted": "_PuckLayout--mounted_12s9r_43", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_12s9r_47", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_12s9r_53", "PuckLayout-mounted": "_PuckLayout-mounted_12s9r_67", "PuckLayout": "_PuckLayout_12s9r_31", "PuckLayout-header": "_PuckLayout-header_12s9r_108", "PuckLayout-headerInner": "_PuckLayout-headerInner_12s9r_117", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_12s9r_127", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_12s9r_134", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_12s9r_135", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_12s9r_139", "PuckLayout-headerPath": "_PuckLayout-headerPath_12s9r_143", "PuckLayout-headerTools": "_PuckLayout-headerTools_12s9r_150", "PuckLayout-menuButton": "_PuckLayout-menuButton_12s9r_156", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_12s9r_161", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_12s9r_135", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_12s9r_134" };
5111
5456
 
5112
5457
  // components/Puck/components/Fields/index.tsx
5113
5458
  init_react_import();
5114
5459
 
5115
5460
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
5116
5461
  init_react_import();
5117
- 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" };
5462
+ 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" };
5118
5463
 
5119
5464
  // components/Puck/components/Fields/index.tsx
5120
- import { useCallback as useCallback10, useEffect as useEffect14, useMemo as useMemo10, useState as useState18 } from "react";
5465
+ import { useCallback as useCallback12, useEffect as useEffect16, useMemo as useMemo11, useState as useState19 } from "react";
5121
5466
 
5122
5467
  // lib/use-parent.ts
5123
5468
  init_react_import();
5124
- import { useContext as useContext6 } from "react";
5469
+ import { useContext as useContext9 } from "react";
5125
5470
  var useParent = (itemSelector) => {
5126
5471
  var _a;
5127
5472
  const { selectedItem, state } = useAppContext();
5128
- const { pathData } = useContext6(dropZoneContext) || {};
5473
+ const { pathData } = useContext9(dropZoneContext) || {};
5129
5474
  const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
5130
5475
  const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
5131
5476
  const lastItem = breadcrumbs[breadcrumbs.length - 1];
@@ -5134,7 +5479,7 @@ var useParent = (itemSelector) => {
5134
5479
  };
5135
5480
 
5136
5481
  // components/Puck/components/Fields/index.tsx
5137
- import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
5482
+ import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
5138
5483
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
5139
5484
  var defaultPageFields = {
5140
5485
  title: { type: "text" }
@@ -5142,7 +5487,7 @@ var defaultPageFields = {
5142
5487
  var DefaultFields = ({
5143
5488
  children
5144
5489
  }) => {
5145
- return /* @__PURE__ */ jsx26(Fragment8, { children });
5490
+ return /* @__PURE__ */ jsx27(Fragment8, { children });
5146
5491
  };
5147
5492
  var useResolvedFields = () => {
5148
5493
  var _a, _b;
@@ -5151,20 +5496,20 @@ var useResolvedFields = () => {
5151
5496
  const { data } = state;
5152
5497
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
5153
5498
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
5154
- const defaultFields = useMemo10(
5499
+ const defaultFields = useMemo11(
5155
5500
  () => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
5156
5501
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5157
5502
  );
5158
5503
  const rootProps = data.root.props || data.root;
5159
- const [lastSelectedData, setLastSelectedData] = useState18({});
5160
- const [resolvedFields, setResolvedFields] = useState18(defaultFields);
5161
- const [fieldsLoading, setFieldsLoading] = useState18(false);
5504
+ const [lastSelectedData, setLastSelectedData] = useState19({});
5505
+ const [resolvedFields, setResolvedFields] = useState19(defaultFields);
5506
+ const [fieldsLoading, setFieldsLoading] = useState19(false);
5162
5507
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5163
5508
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5164
5509
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5165
5510
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5166
5511
  const hasResolver = hasComponentResolver || hasRootResolver;
5167
- const resolveFields = useCallback10(
5512
+ const resolveFields = useCallback12(
5168
5513
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
5169
5514
  var _a2;
5170
5515
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
@@ -5200,22 +5545,36 @@ var useResolvedFields = () => {
5200
5545
  lastData
5201
5546
  });
5202
5547
  }),
5203
- [data, config, componentData, selectedItem, resolvedFields, state]
5548
+ [data, config, componentData, selectedItem, resolvedFields, state, parent]
5204
5549
  );
5205
- useEffect14(() => {
5206
- if (hasResolver) {
5207
- setFieldsLoading(true);
5208
- resolveFields(defaultFields).then((fields) => {
5209
- setResolvedFields(fields || {});
5210
- setFieldsLoading(false);
5211
- });
5212
- } else {
5213
- setResolvedFields(defaultFields);
5550
+ const [hasParent, setHasParent] = useState19(false);
5551
+ useEffect16(() => {
5552
+ setHasParent(!!parent);
5553
+ }, [parent]);
5554
+ useEffect16(() => {
5555
+ 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" || hasParent) {
5557
+ if (hasResolver) {
5558
+ setFieldsLoading(true);
5559
+ resolveFields(defaultFields).then((fields) => {
5560
+ setResolvedFields(fields || {});
5561
+ setFieldsLoading(false);
5562
+ });
5563
+ return;
5564
+ }
5214
5565
  }
5215
- }, [data, defaultFields, selectedItem, hasResolver]);
5566
+ setResolvedFields(defaultFields);
5567
+ }, [
5568
+ data,
5569
+ defaultFields,
5570
+ state.ui.itemSelector,
5571
+ selectedItem,
5572
+ hasResolver,
5573
+ hasParent
5574
+ ]);
5216
5575
  return [resolvedFields, fieldsLoading];
5217
5576
  };
5218
- var Fields = () => {
5577
+ var Fields = ({ wrapFields = true }) => {
5219
5578
  var _a, _b;
5220
5579
  const {
5221
5580
  selectedItem,
@@ -5233,16 +5592,16 @@ var Fields = () => {
5233
5592
  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;
5234
5593
  const isLoading = fieldsResolving || componentResolving;
5235
5594
  const rootProps = data.root.props || data.root;
5236
- const Wrapper = useMemo10(() => overrides.fields || DefaultFields, [overrides]);
5595
+ const Wrapper = useMemo11(() => overrides.fields || DefaultFields, [overrides]);
5237
5596
  return /* @__PURE__ */ jsxs14(
5238
5597
  "form",
5239
5598
  {
5240
- className: getClassName21(),
5599
+ className: getClassName21({ wrapFields }),
5241
5600
  onSubmit: (e) => {
5242
5601
  e.preventDefault();
5243
5602
  },
5244
5603
  children: [
5245
- /* @__PURE__ */ jsx26(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5604
+ /* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5246
5605
  const field = fields[fieldName];
5247
5606
  if (!(field == null ? void 0 : field.type)) return null;
5248
5607
  const onChange = (value, updatedUi) => {
@@ -5313,7 +5672,7 @@ var Fields = () => {
5313
5672
  item: selectedItem
5314
5673
  });
5315
5674
  const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
5316
- return /* @__PURE__ */ jsx26(
5675
+ return /* @__PURE__ */ jsx27("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx27(
5317
5676
  AutoFieldPrivate,
5318
5677
  {
5319
5678
  field,
@@ -5322,16 +5681,15 @@ var Fields = () => {
5322
5681
  readOnly: !edit || readOnly[fieldName],
5323
5682
  value: selectedItem.props[fieldName],
5324
5683
  onChange
5325
- },
5326
- id
5327
- );
5684
+ }
5685
+ ) }, id);
5328
5686
  } else {
5329
5687
  const readOnly = data.root.readOnly || {};
5330
5688
  const { edit } = getPermissions({
5331
5689
  root: true
5332
5690
  });
5333
5691
  const id = `root_${field.type}_${fieldName}`;
5334
- return /* @__PURE__ */ jsx26(
5692
+ return /* @__PURE__ */ jsx27("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx27(
5335
5693
  AutoFieldPrivate,
5336
5694
  {
5337
5695
  field,
@@ -5340,12 +5698,11 @@ var Fields = () => {
5340
5698
  readOnly: !edit || readOnly[fieldName],
5341
5699
  value: rootProps[fieldName],
5342
5700
  onChange
5343
- },
5344
- id
5345
- );
5701
+ }
5702
+ ) }, id);
5346
5703
  }
5347
5704
  }) }),
5348
- isLoading && /* @__PURE__ */ jsx26("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx26("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx26(Loader, { size: 16 }) }) })
5705
+ isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
5349
5706
  ]
5350
5707
  }
5351
5708
  );
@@ -5356,7 +5713,7 @@ init_react_import();
5356
5713
 
5357
5714
  // lib/use-component-list.tsx
5358
5715
  init_react_import();
5359
- import { useEffect as useEffect15, useState as useState19 } from "react";
5716
+ import { useEffect as useEffect17, useState as useState20 } from "react";
5360
5717
 
5361
5718
  // components/ComponentList/index.tsx
5362
5719
  init_react_import();
@@ -5366,7 +5723,7 @@ init_react_import();
5366
5723
  var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
5367
5724
 
5368
5725
  // components/ComponentList/index.tsx
5369
- import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
5726
+ import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
5370
5727
  var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
5371
5728
  var ComponentListItem = ({
5372
5729
  name,
@@ -5376,7 +5733,7 @@ var ComponentListItem = ({
5376
5733
  const canInsert = getPermissions({
5377
5734
  type: name
5378
5735
  }).insert;
5379
- return /* @__PURE__ */ jsx27(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5736
+ return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5380
5737
  };
5381
5738
  var ComponentList = ({
5382
5739
  children,
@@ -5400,14 +5757,14 @@ var ComponentList = ({
5400
5757
  }),
5401
5758
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
5402
5759
  children: [
5403
- /* @__PURE__ */ jsx27("div", { children: title }),
5404
- /* @__PURE__ */ jsx27("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx27(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx27(ChevronDown, { size: 12 }) })
5760
+ /* @__PURE__ */ jsx28("div", { children: title }),
5761
+ /* @__PURE__ */ jsx28("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
5405
5762
  ]
5406
5763
  }
5407
5764
  ),
5408
- /* @__PURE__ */ jsx27("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx27(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5765
+ /* @__PURE__ */ jsx28("div", { className: getClassName22("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5409
5766
  var _a;
5410
- return /* @__PURE__ */ jsx27(
5767
+ return /* @__PURE__ */ jsx28(
5411
5768
  ComponentListItem,
5412
5769
  {
5413
5770
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -5421,10 +5778,10 @@ var ComponentList = ({
5421
5778
  ComponentList.Item = ComponentListItem;
5422
5779
 
5423
5780
  // lib/use-component-list.tsx
5424
- import { jsx as jsx28 } from "react/jsx-runtime";
5781
+ import { jsx as jsx29 } from "react/jsx-runtime";
5425
5782
  var useComponentList = (config, ui) => {
5426
- const [componentList, setComponentList] = useState19();
5427
- useEffect15(() => {
5783
+ const [componentList, setComponentList] = useState20();
5784
+ useEffect17(() => {
5428
5785
  var _a, _b, _c;
5429
5786
  if (Object.keys(ui.componentList).length > 0) {
5430
5787
  const matchedComponents = [];
@@ -5434,7 +5791,7 @@ var useComponentList = (config, ui) => {
5434
5791
  if (category.visible === false || !category.components) {
5435
5792
  return null;
5436
5793
  }
5437
- return /* @__PURE__ */ jsx28(
5794
+ return /* @__PURE__ */ jsx29(
5438
5795
  ComponentList,
5439
5796
  {
5440
5797
  id: categoryKey,
@@ -5443,7 +5800,7 @@ var useComponentList = (config, ui) => {
5443
5800
  var _a2;
5444
5801
  matchedComponents.push(componentName);
5445
5802
  const componentConf = config.components[componentName] || {};
5446
- return /* @__PURE__ */ jsx28(
5803
+ return /* @__PURE__ */ jsx29(
5447
5804
  ComponentList.Item,
5448
5805
  {
5449
5806
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -5463,7 +5820,7 @@ var useComponentList = (config, ui) => {
5463
5820
  );
5464
5821
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
5465
5822
  _componentList.push(
5466
- /* @__PURE__ */ jsx28(
5823
+ /* @__PURE__ */ jsx29(
5467
5824
  ComponentList,
5468
5825
  {
5469
5826
  id: "other",
@@ -5471,7 +5828,7 @@ var useComponentList = (config, ui) => {
5471
5828
  children: remainingComponents.map((componentName, i) => {
5472
5829
  var _a2;
5473
5830
  const componentConf = config.components[componentName] || {};
5474
- return /* @__PURE__ */ jsx28(
5831
+ return /* @__PURE__ */ jsx29(
5475
5832
  ComponentList.Item,
5476
5833
  {
5477
5834
  name: componentName,
@@ -5493,30 +5850,30 @@ var useComponentList = (config, ui) => {
5493
5850
  };
5494
5851
 
5495
5852
  // components/Puck/components/Components/index.tsx
5496
- import { useMemo as useMemo11 } from "react";
5497
- import { jsx as jsx29 } from "react/jsx-runtime";
5853
+ import { useMemo as useMemo12 } from "react";
5854
+ import { jsx as jsx30 } from "react/jsx-runtime";
5498
5855
  var Components = () => {
5499
5856
  const { config, state, overrides } = useAppContext();
5500
5857
  const componentList = useComponentList(config, state.ui);
5501
- const Wrapper = useMemo11(() => overrides.components || "div", [overrides]);
5502
- return /* @__PURE__ */ jsx29(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx29(ComponentList, { id: "all" }) });
5858
+ const Wrapper = useMemo12(() => overrides.components || "div", [overrides]);
5859
+ return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
5503
5860
  };
5504
5861
 
5505
5862
  // components/Puck/components/Preview/index.tsx
5506
5863
  init_react_import();
5507
- import { useCallback as useCallback11, useEffect as useEffect17, useRef as useRef7, useMemo as useMemo12 } from "react";
5864
+ import { useCallback as useCallback13, useEffect as useEffect19, useRef as useRef6, useMemo as useMemo13 } from "react";
5508
5865
 
5509
5866
  // components/AutoFrame/index.tsx
5510
5867
  init_react_import();
5511
5868
  import {
5512
- createContext as createContext4,
5513
- useContext as useContext7,
5514
- useEffect as useEffect16,
5515
- useState as useState20
5869
+ createContext as createContext5,
5870
+ useContext as useContext10,
5871
+ useEffect as useEffect18,
5872
+ useState as useState21
5516
5873
  } from "react";
5517
5874
  import hash from "object-hash";
5518
5875
  import { createPortal as createPortal3 } from "react-dom";
5519
- import { Fragment as Fragment9, jsx as jsx30 } from "react/jsx-runtime";
5876
+ import { Fragment as Fragment9, jsx as jsx31 } from "react/jsx-runtime";
5520
5877
  var styleSelector = 'style, link[rel="stylesheet"]';
5521
5878
  var collectStyles = (doc) => {
5522
5879
  const collected = [];
@@ -5559,7 +5916,7 @@ var CopyHostStyles = ({
5559
5916
  onStylesLoaded = () => null
5560
5917
  }) => {
5561
5918
  const { document: doc, window: win } = useFrame();
5562
- useEffect16(() => {
5919
+ useEffect18(() => {
5563
5920
  if (!win || !doc) {
5564
5921
  return () => {
5565
5922
  };
@@ -5716,10 +6073,10 @@ var CopyHostStyles = ({
5716
6073
  observer.disconnect();
5717
6074
  };
5718
6075
  }, []);
5719
- return /* @__PURE__ */ jsx30(Fragment9, { children });
6076
+ return /* @__PURE__ */ jsx31(Fragment9, { children });
5720
6077
  };
5721
- var autoFrameContext = createContext4({});
5722
- var useFrame = () => useContext7(autoFrameContext);
6078
+ var autoFrameContext = createContext5({});
6079
+ var useFrame = () => useContext10(autoFrameContext);
5723
6080
  function AutoFrame(_a) {
5724
6081
  var _b = _a, {
5725
6082
  children,
@@ -5736,10 +6093,10 @@ function AutoFrame(_a) {
5736
6093
  "onStylesLoaded",
5737
6094
  "frameRef"
5738
6095
  ]);
5739
- const [loaded, setLoaded] = useState20(false);
5740
- const [ctx, setCtx] = useState20({});
5741
- const [mountTarget, setMountTarget] = useState20();
5742
- useEffect16(() => {
6096
+ const [loaded, setLoaded] = useState21(false);
6097
+ const [ctx, setCtx] = useState21({});
6098
+ const [mountTarget, setMountTarget] = useState21();
6099
+ useEffect18(() => {
5743
6100
  var _a2;
5744
6101
  if (frameRef.current) {
5745
6102
  setCtx({
@@ -5751,7 +6108,7 @@ function AutoFrame(_a) {
5751
6108
  );
5752
6109
  }
5753
6110
  }, [frameRef, loaded]);
5754
- return /* @__PURE__ */ jsx30(
6111
+ return /* @__PURE__ */ jsx31(
5755
6112
  "iframe",
5756
6113
  __spreadProps(__spreadValues({}, props), {
5757
6114
  className,
@@ -5761,7 +6118,7 @@ function AutoFrame(_a) {
5761
6118
  onLoad: () => {
5762
6119
  setLoaded(true);
5763
6120
  },
5764
- children: /* @__PURE__ */ jsx30(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx30(CopyHostStyles, { debug, onStylesLoaded, children: createPortal3(children, mountTarget) }) })
6121
+ children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(CopyHostStyles, { debug, onStylesLoaded, children: createPortal3(children, mountTarget) }) })
5765
6122
  })
5766
6123
  );
5767
6124
  }
@@ -5774,7 +6131,7 @@ var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPrev
5774
6131
 
5775
6132
  // components/Render/index.tsx
5776
6133
  init_react_import();
5777
- import { jsx as jsx31 } from "react/jsx-runtime";
6134
+ import { jsx as jsx32 } from "react/jsx-runtime";
5778
6135
  function Render({
5779
6136
  config,
5780
6137
  data
@@ -5787,7 +6144,7 @@ function Render({
5787
6144
  const rootProps = defaultedData.root.props || defaultedData.root;
5788
6145
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
5789
6146
  if ((_a = config.root) == null ? void 0 : _a.render) {
5790
- return /* @__PURE__ */ jsx31(
6147
+ return /* @__PURE__ */ jsx32(
5791
6148
  DropZoneProvider,
5792
6149
  {
5793
6150
  value: {
@@ -5797,7 +6154,7 @@ function Render({
5797
6154
  depth: 0,
5798
6155
  path: []
5799
6156
  },
5800
- children: /* @__PURE__ */ jsx31(
6157
+ children: /* @__PURE__ */ jsx32(
5801
6158
  config.root.render,
5802
6159
  __spreadProps(__spreadValues({}, rootProps), {
5803
6160
  puck: {
@@ -5807,13 +6164,13 @@ function Render({
5807
6164
  title,
5808
6165
  editMode: false,
5809
6166
  id: "puck-root",
5810
- children: /* @__PURE__ */ jsx31(DropZone, { zone: rootDroppableId })
6167
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
5811
6168
  })
5812
6169
  )
5813
6170
  }
5814
6171
  );
5815
6172
  }
5816
- return /* @__PURE__ */ jsx31(
6173
+ return /* @__PURE__ */ jsx32(
5817
6174
  DropZoneProvider,
5818
6175
  {
5819
6176
  value: {
@@ -5823,17 +6180,17 @@ function Render({
5823
6180
  depth: 0,
5824
6181
  path: []
5825
6182
  },
5826
- children: /* @__PURE__ */ jsx31(DropZone, { zone: rootDroppableId })
6183
+ children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
5827
6184
  }
5828
6185
  );
5829
6186
  }
5830
6187
 
5831
6188
  // components/Puck/components/Preview/index.tsx
5832
- import { Fragment as Fragment10, jsx as jsx32 } from "react/jsx-runtime";
6189
+ import { Fragment as Fragment10, jsx as jsx33 } from "react/jsx-runtime";
5833
6190
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
5834
6191
  var useBubbleIframeEvents = (ref) => {
5835
6192
  const { status } = useAppContext();
5836
- useEffect17(() => {
6193
+ useEffect19(() => {
5837
6194
  var _a;
5838
6195
  if (ref.current && status === "READY") {
5839
6196
  const iframe = ref.current;
@@ -5870,22 +6227,22 @@ var useBubbleIframeEvents = (ref) => {
5870
6227
  }
5871
6228
  }, [status]);
5872
6229
  };
5873
- var Preview = ({ id = "puck-preview" }) => {
6230
+ var Preview2 = ({ id = "puck-preview" }) => {
5874
6231
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
5875
- const Page = useCallback11(
6232
+ const Page = useCallback13(
5876
6233
  (pageProps) => {
5877
6234
  var _a, _b;
5878
6235
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
5879
6236
  id: "puck-root"
5880
- }, pageProps)) : /* @__PURE__ */ jsx32(Fragment10, { children: pageProps.children });
6237
+ }, pageProps)) : /* @__PURE__ */ jsx33(Fragment10, { children: pageProps.children });
5881
6238
  },
5882
6239
  [config.root]
5883
6240
  );
5884
- const Frame = useMemo12(() => overrides.iframe, [overrides]);
6241
+ const Frame = useMemo13(() => overrides.iframe, [overrides]);
5885
6242
  const rootProps = state.data.root.props || state.data.root;
5886
- const ref = useRef7(null);
6243
+ const ref = useRef6(null);
5887
6244
  useBubbleIframeEvents(ref);
5888
- const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx32(
6245
+ const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ jsx33(
5889
6246
  Page,
5890
6247
  __spreadProps(__spreadValues({}, rootProps), {
5891
6248
  puck: {
@@ -5894,10 +6251,10 @@ var Preview = ({ id = "puck-preview" }) => {
5894
6251
  dragRef: null
5895
6252
  },
5896
6253
  editMode: true,
5897
- children: /* @__PURE__ */ jsx32(DropZone, { zone: rootDroppableId })
6254
+ children: /* @__PURE__ */ jsx33(DropZone, { zone: rootDroppableId })
5898
6255
  })
5899
- ) : /* @__PURE__ */ jsx32(Render, { data: state.data, config });
5900
- return /* @__PURE__ */ jsx32(
6256
+ ) : /* @__PURE__ */ jsx33(Render, { data: state.data, config });
6257
+ return /* @__PURE__ */ jsx33(
5901
6258
  "div",
5902
6259
  {
5903
6260
  className: getClassName23(),
@@ -5906,7 +6263,7 @@ var Preview = ({ id = "puck-preview" }) => {
5906
6263
  onClick: () => {
5907
6264
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
5908
6265
  },
5909
- children: iframe.enabled ? /* @__PURE__ */ jsx32(
6266
+ children: iframe.enabled ? /* @__PURE__ */ jsx33(
5910
6267
  AutoFrame_default,
5911
6268
  {
5912
6269
  id: "preview-frame",
@@ -5916,14 +6273,14 @@ var Preview = ({ id = "puck-preview" }) => {
5916
6273
  setStatus("READY");
5917
6274
  },
5918
6275
  frameRef: ref,
5919
- children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6276
+ children: /* @__PURE__ */ jsx33(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
5920
6277
  if (Frame) {
5921
- return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
6278
+ return /* @__PURE__ */ jsx33(Frame, { document: document2, children: inner });
5922
6279
  }
5923
6280
  return inner;
5924
6281
  } })
5925
6282
  }
5926
- ) : /* @__PURE__ */ jsx32(
6283
+ ) : /* @__PURE__ */ jsx33(
5927
6284
  "div",
5928
6285
  {
5929
6286
  id: "preview-frame",
@@ -5980,7 +6337,7 @@ var scrollIntoView = (el) => {
5980
6337
  };
5981
6338
 
5982
6339
  // components/LayerTree/index.tsx
5983
- import { useContext as useContext8 } from "react";
6340
+ import { useContext as useContext11 } from "react";
5984
6341
 
5985
6342
  // lib/is-child-of-zone.ts
5986
6343
  init_react_import();
@@ -6013,7 +6370,7 @@ var onScrollEnd = (frame, cb) => {
6013
6370
  };
6014
6371
 
6015
6372
  // components/LayerTree/index.tsx
6016
- import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
6373
+ import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
6017
6374
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
6018
6375
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
6019
6376
  var LayerTree = ({
@@ -6026,15 +6383,15 @@ var LayerTree = ({
6026
6383
  label
6027
6384
  }) => {
6028
6385
  const zones = data.zones || {};
6029
- const ctx = useContext8(dropZoneContext);
6386
+ const ctx = useContext11(dropZoneContext);
6030
6387
  return /* @__PURE__ */ jsxs16(Fragment11, { children: [
6031
6388
  label && /* @__PURE__ */ jsxs16("div", { className: getClassName24("zoneTitle"), children: [
6032
- /* @__PURE__ */ jsx33("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
6389
+ /* @__PURE__ */ jsx34("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx34(Layers, { size: "16" }) }),
6033
6390
  " ",
6034
6391
  label
6035
6392
  ] }),
6036
6393
  /* @__PURE__ */ jsxs16("ul", { className: getClassName24(), children: [
6037
- zoneContent.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName24("helper"), children: "No items" }),
6394
+ zoneContent.length === 0 && /* @__PURE__ */ jsx34("div", { className: getClassName24("helper"), children: "No items" }),
6038
6395
  zoneContent.map((item, i) => {
6039
6396
  var _a;
6040
6397
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -6057,7 +6414,7 @@ var LayerTree = ({
6057
6414
  childIsSelected
6058
6415
  }),
6059
6416
  children: [
6060
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs16(
6417
+ /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs16(
6061
6418
  "button",
6062
6419
  {
6063
6420
  type: "button",
@@ -6096,22 +6453,22 @@ var LayerTree = ({
6096
6453
  setHoveringComponent(null);
6097
6454
  },
6098
6455
  children: [
6099
- containsZone && /* @__PURE__ */ jsx33(
6456
+ containsZone && /* @__PURE__ */ jsx34(
6100
6457
  "div",
6101
6458
  {
6102
6459
  className: getClassNameLayer("chevron"),
6103
6460
  title: isSelected ? "Collapse" : "Expand",
6104
- children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
6461
+ children: /* @__PURE__ */ jsx34(ChevronDown, { size: "12" })
6105
6462
  }
6106
6463
  ),
6107
6464
  /* @__PURE__ */ jsxs16("div", { className: getClassNameLayer("title"), children: [
6108
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx33(Type, { size: "16" }) : /* @__PURE__ */ jsx33(LayoutGrid, { size: "16" }) }),
6109
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label2 })
6465
+ /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ jsx34(Type, { size: "16" }) : /* @__PURE__ */ jsx34(LayoutGrid, { size: "16" }) }),
6466
+ /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("name"), children: label2 })
6110
6467
  ] })
6111
6468
  ]
6112
6469
  }
6113
6470
  ) }),
6114
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(
6471
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ jsx34("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx34(
6115
6472
  LayerTree,
6116
6473
  {
6117
6474
  config,
@@ -6133,13 +6490,13 @@ var LayerTree = ({
6133
6490
  };
6134
6491
 
6135
6492
  // components/Puck/components/Outline/index.tsx
6136
- import { useCallback as useCallback12, useMemo as useMemo13 } from "react";
6137
- import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs17 } from "react/jsx-runtime";
6493
+ import { useCallback as useCallback14, useMemo as useMemo14 } from "react";
6494
+ import { Fragment as Fragment12, jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
6138
6495
  var Outline = () => {
6139
6496
  const { dispatch, state, overrides, config } = useAppContext();
6140
6497
  const { data, ui } = state;
6141
6498
  const { itemSelector } = ui;
6142
- const setItemSelector = useCallback12(
6499
+ const setItemSelector = useCallback14(
6143
6500
  (newItemSelector) => {
6144
6501
  dispatch({
6145
6502
  type: "setUi",
@@ -6148,9 +6505,9 @@ var Outline = () => {
6148
6505
  },
6149
6506
  []
6150
6507
  );
6151
- const Wrapper = useMemo13(() => overrides.outline || "div", [overrides]);
6152
- return /* @__PURE__ */ jsx34(Wrapper, { children: /* @__PURE__ */ jsx34(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
6153
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx34(
6508
+ const Wrapper = useMemo14(() => overrides.outline || "div", [overrides]);
6509
+ return /* @__PURE__ */ jsx35(Wrapper, { children: /* @__PURE__ */ jsx35(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ jsxs17(Fragment12, { children: [
6510
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ jsx35(
6154
6511
  LayerTree,
6155
6512
  {
6156
6513
  config,
@@ -6163,7 +6520,7 @@ var Outline = () => {
6163
6520
  ),
6164
6521
  Object.entries(findZonesForArea(data, "root")).map(
6165
6522
  ([zoneKey, zone]) => {
6166
- return /* @__PURE__ */ jsx34(
6523
+ return /* @__PURE__ */ jsx35(
6167
6524
  LayerTree,
6168
6525
  {
6169
6526
  config,
@@ -6262,19 +6619,19 @@ function usePuckHistory({
6262
6619
 
6263
6620
  // lib/use-history-store.ts
6264
6621
  init_react_import();
6265
- import { useState as useState21 } from "react";
6622
+ import { useState as useState22 } from "react";
6266
6623
  import { useDebouncedCallback as useDebouncedCallback3 } from "use-debounce";
6267
6624
  var EMPTY_HISTORY_INDEX = 0;
6268
6625
  function useHistoryStore(initialHistory) {
6269
6626
  var _a, _b;
6270
- const [histories, setHistories] = useState21(
6627
+ const [histories, setHistories] = useState22(
6271
6628
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6272
6629
  );
6273
6630
  const updateHistories = (histories2) => {
6274
6631
  setHistories(histories2);
6275
6632
  setIndex(histories2.length - 1);
6276
6633
  };
6277
- const [index, setIndex] = useState21(
6634
+ const [index, setIndex] = useState22(
6278
6635
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6279
6636
  );
6280
6637
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6435,27 +6792,27 @@ var getBox = function getBox2(el) {
6435
6792
 
6436
6793
  // components/Puck/components/Canvas/index.tsx
6437
6794
  import {
6438
- useCallback as useCallback13,
6439
- useEffect as useEffect19,
6440
- useMemo as useMemo15,
6441
- useRef as useRef8,
6442
- useState as useState23
6795
+ useCallback as useCallback15,
6796
+ useEffect as useEffect21,
6797
+ useMemo as useMemo16,
6798
+ useRef as useRef7,
6799
+ useState as useState24
6443
6800
  } from "react";
6444
6801
 
6445
6802
  // components/ViewportControls/index.tsx
6446
6803
  init_react_import();
6447
- import { useEffect as useEffect18, useMemo as useMemo14, useState as useState22 } from "react";
6804
+ import { useEffect as useEffect20, useMemo as useMemo15, useState as useState23 } from "react";
6448
6805
 
6449
6806
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6450
6807
  init_react_import();
6451
6808
  var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
6452
6809
 
6453
6810
  // components/ViewportControls/index.tsx
6454
- import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
6811
+ import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
6455
6812
  var icons = {
6456
- Smartphone: /* @__PURE__ */ jsx35(Smartphone, { size: 16 }),
6457
- Tablet: /* @__PURE__ */ jsx35(Tablet, { size: 16 }),
6458
- Monitor: /* @__PURE__ */ jsx35(Monitor, { size: 16 })
6813
+ Smartphone: /* @__PURE__ */ jsx36(Smartphone, { size: 16 }),
6814
+ Tablet: /* @__PURE__ */ jsx36(Tablet, { size: 16 }),
6815
+ Monitor: /* @__PURE__ */ jsx36(Monitor, { size: 16 })
6459
6816
  };
6460
6817
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
6461
6818
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -6467,11 +6824,11 @@ var ViewportButton = ({
6467
6824
  onClick
6468
6825
  }) => {
6469
6826
  const { state } = useAppContext();
6470
- const [isActive, setIsActive] = useState22(false);
6471
- useEffect18(() => {
6827
+ const [isActive, setIsActive] = useState23(false);
6828
+ useEffect20(() => {
6472
6829
  setIsActive(width === state.ui.viewports.current.width);
6473
6830
  }, [width, state.ui.viewports.current.width]);
6474
- return /* @__PURE__ */ jsx35("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx35(
6831
+ return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
6475
6832
  IconButton,
6476
6833
  {
6477
6834
  title,
@@ -6480,7 +6837,7 @@ var ViewportButton = ({
6480
6837
  e.stopPropagation();
6481
6838
  onClick({ width, height });
6482
6839
  },
6483
- children: /* @__PURE__ */ jsx35("span", { className: getClassNameButton("inner"), children })
6840
+ children: /* @__PURE__ */ jsx36("span", { className: getClassNameButton("inner"), children })
6484
6841
  }
6485
6842
  ) });
6486
6843
  };
@@ -6504,7 +6861,7 @@ var ViewportControls = ({
6504
6861
  const defaultsContainAutoZoom = defaultZoomOptions.find(
6505
6862
  (option) => option.value === autoZoom
6506
6863
  );
6507
- const zoomOptions = useMemo14(
6864
+ const zoomOptions = useMemo15(
6508
6865
  () => [
6509
6866
  ...defaultZoomOptions,
6510
6867
  ...defaultsContainAutoZoom ? [] : [
@@ -6517,7 +6874,7 @@ var ViewportControls = ({
6517
6874
  [autoZoom]
6518
6875
  );
6519
6876
  return /* @__PURE__ */ jsxs18("div", { className: getClassName25(), children: [
6520
- viewports.map((viewport, i) => /* @__PURE__ */ jsx35(
6877
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx36(
6521
6878
  ViewportButton,
6522
6879
  {
6523
6880
  height: viewport.height,
@@ -6528,8 +6885,8 @@ var ViewportControls = ({
6528
6885
  },
6529
6886
  i
6530
6887
  )),
6531
- /* @__PURE__ */ jsx35("div", { className: getClassName25("divider") }),
6532
- /* @__PURE__ */ jsx35(
6888
+ /* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
6889
+ /* @__PURE__ */ jsx36(
6533
6890
  IconButton,
6534
6891
  {
6535
6892
  title: "Zoom viewport out",
@@ -6543,10 +6900,10 @@ var ViewportControls = ({
6543
6900
  )].value
6544
6901
  );
6545
6902
  },
6546
- children: /* @__PURE__ */ jsx35(ZoomOut, { size: 16 })
6903
+ children: /* @__PURE__ */ jsx36(ZoomOut, { size: 16 })
6547
6904
  }
6548
6905
  ),
6549
- /* @__PURE__ */ jsx35(
6906
+ /* @__PURE__ */ jsx36(
6550
6907
  IconButton,
6551
6908
  {
6552
6909
  title: "Zoom viewport in",
@@ -6560,11 +6917,11 @@ var ViewportControls = ({
6560
6917
  )].value
6561
6918
  );
6562
6919
  },
6563
- children: /* @__PURE__ */ jsx35(ZoomIn, { size: 16 })
6920
+ children: /* @__PURE__ */ jsx36(ZoomIn, { size: 16 })
6564
6921
  }
6565
6922
  ),
6566
- /* @__PURE__ */ jsx35("div", { className: getClassName25("divider") }),
6567
- /* @__PURE__ */ jsx35(
6923
+ /* @__PURE__ */ jsx36("div", { className: getClassName25("divider") }),
6924
+ /* @__PURE__ */ jsx36(
6568
6925
  "select",
6569
6926
  {
6570
6927
  className: getClassName25("zoomSelect"),
@@ -6572,7 +6929,7 @@ var ViewportControls = ({
6572
6929
  onChange: (e) => {
6573
6930
  onZoom(parseFloat(e.currentTarget.value));
6574
6931
  },
6575
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx35(
6932
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx36(
6576
6933
  "option",
6577
6934
  {
6578
6935
  value: option.value,
@@ -6620,24 +6977,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
6620
6977
  };
6621
6978
 
6622
6979
  // components/Puck/components/Canvas/index.tsx
6623
- import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
6980
+ import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
6624
6981
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
6625
6982
  var ZOOM_ON_CHANGE = true;
6626
6983
  var Canvas = () => {
6627
6984
  const { status, iframe } = useAppContext();
6628
6985
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
6629
6986
  const { ui } = state;
6630
- const frameRef = useRef8(null);
6631
- const [showTransition, setShowTransition] = useState23(false);
6632
- const defaultRender = useMemo15(() => {
6633
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment13, { children });
6987
+ const frameRef = useRef7(null);
6988
+ const [showTransition, setShowTransition] = useState24(false);
6989
+ const defaultRender = useMemo16(() => {
6990
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
6634
6991
  return PuckDefault;
6635
6992
  }, []);
6636
- const CustomPreview = useMemo15(
6993
+ const CustomPreview = useMemo16(
6637
6994
  () => overrides.preview || defaultRender,
6638
6995
  [overrides]
6639
6996
  );
6640
- const getFrameDimensions = useCallback13(() => {
6997
+ const getFrameDimensions = useCallback15(() => {
6641
6998
  if (frameRef.current) {
6642
6999
  const frame = frameRef.current;
6643
7000
  const box = getBox(frame);
@@ -6645,7 +7002,7 @@ var Canvas = () => {
6645
7002
  }
6646
7003
  return { width: 0, height: 0 };
6647
7004
  }, [frameRef]);
6648
- const resetAutoZoom = useCallback13(
7005
+ const resetAutoZoom = useCallback15(
6649
7006
  (ui2 = state.ui) => {
6650
7007
  if (frameRef.current) {
6651
7008
  setZoomConfig(
@@ -6655,11 +7012,11 @@ var Canvas = () => {
6655
7012
  },
6656
7013
  [frameRef, zoomConfig, state.ui]
6657
7014
  );
6658
- useEffect19(() => {
7015
+ useEffect21(() => {
6659
7016
  setShowTransition(false);
6660
7017
  resetAutoZoom();
6661
7018
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
6662
- useEffect19(() => {
7019
+ useEffect21(() => {
6663
7020
  const { height: frameHeight } = getFrameDimensions();
6664
7021
  if (ui.viewports.current.height === "auto") {
6665
7022
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -6667,13 +7024,13 @@ var Canvas = () => {
6667
7024
  }));
6668
7025
  }
6669
7026
  }, [zoomConfig.zoom]);
6670
- useEffect19(() => {
7027
+ useEffect21(() => {
6671
7028
  if (ZOOM_ON_CHANGE) {
6672
7029
  setShowTransition(true);
6673
7030
  resetAutoZoom(ui);
6674
7031
  }
6675
7032
  }, [ui.viewports.current.width]);
6676
- useEffect19(() => {
7033
+ useEffect21(() => {
6677
7034
  const cb = () => {
6678
7035
  setShowTransition(false);
6679
7036
  resetAutoZoom();
@@ -6683,8 +7040,8 @@ var Canvas = () => {
6683
7040
  window.removeEventListener("resize", cb);
6684
7041
  };
6685
7042
  }, []);
6686
- const [showLoader, setShowLoader] = useState23(false);
6687
- useEffect19(() => {
7043
+ const [showLoader, setShowLoader] = useState24(false);
7044
+ useEffect21(() => {
6688
7045
  setTimeout(() => {
6689
7046
  setShowLoader(true);
6690
7047
  }, 500);
@@ -6702,7 +7059,7 @@ var Canvas = () => {
6702
7059
  recordHistory: true
6703
7060
  }),
6704
7061
  children: [
6705
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx36("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx36(
7062
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx37("div", { className: getClassName26("controls"), children: /* @__PURE__ */ jsx37(
6706
7063
  ViewportControls,
6707
7064
  {
6708
7065
  autoZoom: zoomConfig.autoZoom,
@@ -6729,7 +7086,7 @@ var Canvas = () => {
6729
7086
  }
6730
7087
  ) }),
6731
7088
  /* @__PURE__ */ jsxs19("div", { className: getClassName26("inner"), ref: frameRef, children: [
6732
- /* @__PURE__ */ jsx36(
7089
+ /* @__PURE__ */ jsx37(
6733
7090
  "div",
6734
7091
  {
6735
7092
  className: getClassName26("root"),
@@ -6750,10 +7107,10 @@ var Canvas = () => {
6750
7107
  })
6751
7108
  );
6752
7109
  },
6753
- children: /* @__PURE__ */ jsx36(CustomPreview, { children: /* @__PURE__ */ jsx36(Preview, {}) })
7110
+ children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview2, {}) })
6754
7111
  }
6755
7112
  ),
6756
- /* @__PURE__ */ jsx36("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx36(Loader, { size: 24 }) })
7113
+ /* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
6757
7114
  ] })
6758
7115
  ]
6759
7116
  }
@@ -6762,7 +7119,7 @@ var Canvas = () => {
6762
7119
 
6763
7120
  // lib/use-loaded-overrides.ts
6764
7121
  init_react_import();
6765
- import { useMemo as useMemo16 } from "react";
7122
+ import { useMemo as useMemo17 } from "react";
6766
7123
 
6767
7124
  // lib/load-overrides.ts
6768
7125
  init_react_import();
@@ -6801,26 +7158,26 @@ var useLoadedOverrides = ({
6801
7158
  overrides,
6802
7159
  plugins
6803
7160
  }) => {
6804
- return useMemo16(() => {
7161
+ return useMemo17(() => {
6805
7162
  return loadOverrides({ overrides, plugins });
6806
7163
  }, [plugins, overrides]);
6807
7164
  };
6808
7165
 
6809
7166
  // components/DefaultOverride/index.tsx
6810
7167
  init_react_import();
6811
- import { Fragment as Fragment14, jsx as jsx37 } from "react/jsx-runtime";
6812
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment14, { children });
7168
+ import { Fragment as Fragment14, jsx as jsx38 } from "react/jsx-runtime";
7169
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx38(Fragment14, { children });
6813
7170
 
6814
7171
  // lib/use-inject-css.ts
6815
7172
  init_react_import();
6816
- import { useEffect as useEffect20, useState as useState24 } from "react";
7173
+ import { useEffect as useEffect22, useState as useState25 } from "react";
6817
7174
  var styles = ``;
6818
7175
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
6819
- const [el, setEl] = useState24();
6820
- useEffect20(() => {
7176
+ const [el, setEl] = useState25();
7177
+ useEffect22(() => {
6821
7178
  setEl(document.createElement("style"));
6822
7179
  }, []);
6823
- useEffect20(() => {
7180
+ useEffect22(() => {
6824
7181
  var _a;
6825
7182
  if (!el || typeof window === "undefined") {
6826
7183
  return;
@@ -6840,10 +7197,10 @@ var useInjectGlobalCss = (iframeEnabled) => {
6840
7197
 
6841
7198
  // lib/use-preview-mode-hotkeys.ts
6842
7199
  init_react_import();
6843
- import { useCallback as useCallback14 } from "react";
7200
+ import { useCallback as useCallback16 } from "react";
6844
7201
  import { useHotkeys as useHotkeys2 } from "react-hotkeys-hook";
6845
7202
  var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
6846
- const toggleInteractive = useCallback14(() => {
7203
+ const toggleInteractive = useCallback16(() => {
6847
7204
  dispatch({
6848
7205
  type: "setUi",
6849
7206
  ui: (ui) => ({
@@ -6866,7 +7223,7 @@ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
6866
7223
  };
6867
7224
 
6868
7225
  // components/Puck/index.tsx
6869
- import { Fragment as Fragment15, jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
7226
+ import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs20 } from "react/jsx-runtime";
6870
7227
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
6871
7228
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
6872
7229
  function Puck({
@@ -6895,7 +7252,7 @@ function Puck({
6895
7252
  waitForStyles: true
6896
7253
  }, _iframe);
6897
7254
  useInjectGlobalCss(iframe.enabled);
6898
- const [generatedAppState] = useState25(() => {
7255
+ const [generatedAppState] = useState26(() => {
6899
7256
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
6900
7257
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
6901
7258
  let clientUiState = {};
@@ -6967,7 +7324,7 @@ function Puck({
6967
7324
  histories,
6968
7325
  index: initialHistoryIndex
6969
7326
  });
6970
- const [reducer] = useState25(
7327
+ const [reducer] = useState26(
6971
7328
  () => createReducer({
6972
7329
  config,
6973
7330
  record: historyStore.record,
@@ -6985,14 +7342,14 @@ function Puck({
6985
7342
  historyStore,
6986
7343
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
6987
7344
  });
6988
- const [menuOpen, setMenuOpen] = useState25(false);
7345
+ const [menuOpen, setMenuOpen] = useState26(false);
6989
7346
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
6990
7347
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
6991
- useEffect21(() => {
7348
+ useEffect23(() => {
6992
7349
  if (onChange) onChange(data);
6993
7350
  }, [data]);
6994
7351
  const rootProps = data.root.props || data.root;
6995
- const toggleSidebars = useCallback15(
7352
+ const toggleSidebars = useCallback17(
6996
7353
  (sidebar) => {
6997
7354
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
6998
7355
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7006,7 +7363,7 @@ function Puck({
7006
7363
  },
7007
7364
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7008
7365
  );
7009
- useEffect21(() => {
7366
+ useEffect23(() => {
7010
7367
  if (!window.matchMedia("(min-width: 638px)").matches) {
7011
7368
  dispatch({
7012
7369
  type: "setUi",
@@ -7029,7 +7386,7 @@ function Puck({
7029
7386
  window.removeEventListener("resize", handleResize);
7030
7387
  };
7031
7388
  }, []);
7032
- const defaultHeaderRender = useMemo17(() => {
7389
+ const defaultHeaderRender = useMemo18(() => {
7033
7390
  if (renderHeader) {
7034
7391
  console.warn(
7035
7392
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -7037,20 +7394,20 @@ function Puck({
7037
7394
  const RenderHeader = (_a2) => {
7038
7395
  var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
7039
7396
  const Comp = renderHeader;
7040
- return /* @__PURE__ */ jsx38(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7397
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7041
7398
  };
7042
7399
  return RenderHeader;
7043
7400
  }
7044
7401
  return DefaultOverride;
7045
7402
  }, [renderHeader]);
7046
- const defaultHeaderActionsRender = useMemo17(() => {
7403
+ const defaultHeaderActionsRender = useMemo18(() => {
7047
7404
  if (renderHeaderActions) {
7048
7405
  console.warn(
7049
7406
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
7050
7407
  );
7051
7408
  const RenderHeader = (props) => {
7052
7409
  const Comp = renderHeaderActions;
7053
- return /* @__PURE__ */ jsx38(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7410
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7054
7411
  };
7055
7412
  return RenderHeader;
7056
7413
  }
@@ -7060,27 +7417,27 @@ function Puck({
7060
7417
  overrides,
7061
7418
  plugins
7062
7419
  });
7063
- const CustomPuck = useMemo17(
7420
+ const CustomPuck = useMemo18(
7064
7421
  () => loadedOverrides.puck || DefaultOverride,
7065
7422
  [loadedOverrides]
7066
7423
  );
7067
- const CustomHeader = useMemo17(
7424
+ const CustomHeader = useMemo18(
7068
7425
  () => loadedOverrides.header || defaultHeaderRender,
7069
7426
  [loadedOverrides]
7070
7427
  );
7071
- const CustomHeaderActions = useMemo17(
7428
+ const CustomHeaderActions = useMemo18(
7072
7429
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7073
7430
  [loadedOverrides]
7074
7431
  );
7075
- const [mounted, setMounted] = useState25(false);
7076
- useEffect21(() => {
7432
+ const [mounted, setMounted] = useState26(false);
7433
+ useEffect23(() => {
7077
7434
  setMounted(true);
7078
7435
  }, []);
7079
7436
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
7080
7437
  const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
7081
7438
  usePreviewModeHotkeys(dispatch, iframe.enabled);
7082
7439
  return /* @__PURE__ */ jsxs20("div", { className: `Puck ${getClassName27()}`, children: [
7083
- /* @__PURE__ */ jsx38(
7440
+ /* @__PURE__ */ jsx39(
7084
7441
  AppProvider,
7085
7442
  {
7086
7443
  value: {
@@ -7102,7 +7459,7 @@ function Puck({
7102
7459
  getPermissions: () => ({}),
7103
7460
  refreshPermissions: () => null
7104
7461
  },
7105
- children: /* @__PURE__ */ jsx38(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx38(CustomPuck, { children: children || /* @__PURE__ */ jsx38(
7462
+ children: /* @__PURE__ */ jsx39(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx39(CustomPuck, { children: children || /* @__PURE__ */ jsx39(
7106
7463
  "div",
7107
7464
  {
7108
7465
  className: getLayoutClassName({
@@ -7112,59 +7469,59 @@ function Puck({
7112
7469
  rightSideBarVisible
7113
7470
  }),
7114
7471
  children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("inner"), children: [
7115
- /* @__PURE__ */ jsx38(
7472
+ /* @__PURE__ */ jsx39(
7116
7473
  CustomHeader,
7117
7474
  {
7118
- actions: /* @__PURE__ */ jsx38(Fragment15, { children: /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
7475
+ actions: /* @__PURE__ */ jsx39(Fragment15, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
7119
7476
  Button,
7120
7477
  {
7121
7478
  onClick: () => {
7122
7479
  onPublish && onPublish(data);
7123
7480
  },
7124
- icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
7481
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
7125
7482
  children: "Publish"
7126
7483
  }
7127
7484
  ) }) }),
7128
- children: /* @__PURE__ */ jsx38("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerInner"), children: [
7485
+ children: /* @__PURE__ */ jsx39("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerInner"), children: [
7129
7486
  /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerToggle"), children: [
7130
- /* @__PURE__ */ jsx38(
7487
+ /* @__PURE__ */ jsx39(
7131
7488
  "div",
7132
7489
  {
7133
7490
  className: getLayoutClassName("leftSideBarToggle"),
7134
- children: /* @__PURE__ */ jsx38(
7491
+ children: /* @__PURE__ */ jsx39(
7135
7492
  IconButton,
7136
7493
  {
7137
7494
  onClick: () => {
7138
7495
  toggleSidebars("left");
7139
7496
  },
7140
7497
  title: "Toggle left sidebar",
7141
- children: /* @__PURE__ */ jsx38(PanelLeft, { focusable: "false" })
7498
+ children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
7142
7499
  }
7143
7500
  )
7144
7501
  }
7145
7502
  ),
7146
- /* @__PURE__ */ jsx38(
7503
+ /* @__PURE__ */ jsx39(
7147
7504
  "div",
7148
7505
  {
7149
7506
  className: getLayoutClassName("rightSideBarToggle"),
7150
- children: /* @__PURE__ */ jsx38(
7507
+ children: /* @__PURE__ */ jsx39(
7151
7508
  IconButton,
7152
7509
  {
7153
7510
  onClick: () => {
7154
7511
  toggleSidebars("right");
7155
7512
  },
7156
7513
  title: "Toggle right sidebar",
7157
- children: /* @__PURE__ */ jsx38(PanelRight, { focusable: "false" })
7514
+ children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
7158
7515
  }
7159
7516
  )
7160
7517
  }
7161
7518
  )
7162
7519
  ] }),
7163
- /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs20(Heading, { rank: "2", size: "xs", children: [
7520
+ /* @__PURE__ */ jsx39("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ jsxs20(Heading, { rank: "2", size: "xs", children: [
7164
7521
  headerTitle || rootProps.title || "Page",
7165
7522
  headerPath && /* @__PURE__ */ jsxs20(Fragment15, { children: [
7166
7523
  " ",
7167
- /* @__PURE__ */ jsx38(
7524
+ /* @__PURE__ */ jsx39(
7168
7525
  "code",
7169
7526
  {
7170
7527
  className: getLayoutClassName("headerPath"),
@@ -7174,30 +7531,30 @@ function Puck({
7174
7531
  ] })
7175
7532
  ] }) }),
7176
7533
  /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("headerTools"), children: [
7177
- /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ jsx38(
7534
+ /* @__PURE__ */ jsx39("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ jsx39(
7178
7535
  IconButton,
7179
7536
  {
7180
7537
  onClick: () => {
7181
7538
  return setMenuOpen(!menuOpen);
7182
7539
  },
7183
7540
  title: "Toggle menu bar",
7184
- children: menuOpen ? /* @__PURE__ */ jsx38(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx38(ChevronDown, { focusable: "false" })
7541
+ children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
7185
7542
  }
7186
7543
  ) }),
7187
- /* @__PURE__ */ jsx38(
7544
+ /* @__PURE__ */ jsx39(
7188
7545
  MenuBar,
7189
7546
  {
7190
7547
  appState,
7191
7548
  dispatch,
7192
7549
  onPublish,
7193
7550
  menuOpen,
7194
- renderHeaderActions: () => /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
7551
+ renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
7195
7552
  Button,
7196
7553
  {
7197
7554
  onClick: () => {
7198
7555
  onPublish && onPublish(data);
7199
7556
  },
7200
- icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
7557
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
7201
7558
  children: "Publish"
7202
7559
  }
7203
7560
  ) }),
@@ -7209,18 +7566,18 @@ function Puck({
7209
7566
  }
7210
7567
  ),
7211
7568
  /* @__PURE__ */ jsxs20("div", { className: getLayoutClassName("leftSideBar"), children: [
7212
- /* @__PURE__ */ jsx38(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx38(Components, {}) }),
7213
- /* @__PURE__ */ jsx38(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx38(Outline, {}) })
7569
+ /* @__PURE__ */ jsx39(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx39(Components, {}) }),
7570
+ /* @__PURE__ */ jsx39(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx39(Outline, {}) })
7214
7571
  ] }),
7215
- /* @__PURE__ */ jsx38(Canvas, {}),
7216
- /* @__PURE__ */ jsx38("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx38(
7572
+ /* @__PURE__ */ jsx39(Canvas, {}),
7573
+ /* @__PURE__ */ jsx39("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ jsx39(
7217
7574
  SidebarSection,
7218
7575
  {
7219
7576
  noPadding: true,
7220
7577
  noBorderTop: true,
7221
7578
  showBreadcrumbs: true,
7222
7579
  title: selectedItem ? selectedComponentLabel : "Page",
7223
- children: /* @__PURE__ */ jsx38(Fields, {})
7580
+ children: /* @__PURE__ */ jsx39(Fields, {})
7224
7581
  }
7225
7582
  ) })
7226
7583
  ] })
@@ -7228,13 +7585,13 @@ function Puck({
7228
7585
  ) }) })
7229
7586
  }
7230
7587
  ),
7231
- /* @__PURE__ */ jsx38("div", { id: "puck-portal-root", className: getClassName27("portal") })
7588
+ /* @__PURE__ */ jsx39("div", { id: "puck-portal-root", className: getClassName27("portal") })
7232
7589
  ] });
7233
7590
  }
7234
7591
  Puck.Components = Components;
7235
7592
  Puck.Fields = Fields;
7236
7593
  Puck.Outline = Outline;
7237
- Puck.Preview = Preview;
7594
+ Puck.Preview = Preview2;
7238
7595
 
7239
7596
  // lib/migrate.ts
7240
7597
  init_react_import();