@measured/puck 0.18.0-canary.d253d54 → 0.18.0-canary.f27871b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -311,7 +311,7 @@ init_react_import();
311
311
  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" };
312
312
 
313
313
  // components/AutoField/index.tsx
314
- var import_react19 = require("react");
314
+ var import_react20 = require("react");
315
315
 
316
316
  // components/AutoField/fields/index.tsx
317
317
  init_react_import();
@@ -771,7 +771,7 @@ var IconButton = ({
771
771
  };
772
772
 
773
773
  // components/AutoField/fields/ArrayField/index.tsx
774
- var import_react11 = require("react");
774
+ var import_react12 = require("react");
775
775
 
776
776
  // components/DragIcon/index.tsx
777
777
  init_react_import();
@@ -988,13 +988,11 @@ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __asy
988
988
  onResolveStart(item);
989
989
  }
990
990
  const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
991
- const { readOnly: existingReadOnly = {} } = item || {};
992
- const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
993
991
  const resolvedItem = __spreadProps(__spreadValues({}, item), {
994
992
  props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
995
993
  });
996
- if (Object.keys(newReadOnly).length) {
997
- resolvedItem.readOnly = newReadOnly;
994
+ if (Object.keys(readOnly).length) {
995
+ resolvedItem.readOnly = readOnly;
998
996
  }
999
997
  cache.lastChange[item.props.id] = {
1000
998
  item,
@@ -1161,6 +1159,7 @@ var defaultAppState = {
1161
1159
  itemSelector: null,
1162
1160
  componentList: {},
1163
1161
  isDragging: false,
1162
+ previewMode: "edit",
1164
1163
  viewports: {
1165
1164
  current: {
1166
1165
  width: defaultViewports[0].width,
@@ -1283,7 +1282,7 @@ init_react_import();
1283
1282
  var import_react9 = require("@dnd-kit/react");
1284
1283
  var import_react10 = require("react");
1285
1284
 
1286
- // lib/dnd-kit/safe.ts
1285
+ // lib/dnd/dnd-kit/safe.ts
1287
1286
  init_react_import();
1288
1287
  var import_react8 = require("@dnd-kit/react");
1289
1288
  var import_sortable = require("@dnd-kit/react/sortable");
@@ -1360,8 +1359,53 @@ var Sortable = ({
1360
1359
  return children({ status, ref: sortableRef });
1361
1360
  };
1362
1361
 
1363
- // components/AutoField/fields/ArrayField/index.tsx
1362
+ // components/AutoField/context.tsx
1363
+ init_react_import();
1364
+ var import_react11 = require("react");
1364
1365
  var import_jsx_runtime7 = require("react/jsx-runtime");
1366
+ var NestedFieldContext = (0, import_react11.createContext)({});
1367
+ var useNestedFieldContext = () => {
1368
+ const context = (0, import_react11.useContext)(NestedFieldContext);
1369
+ return __spreadProps(__spreadValues({}, context), {
1370
+ readOnlyFields: context.readOnlyFields || {}
1371
+ });
1372
+ };
1373
+ var NestedFieldProvider = ({
1374
+ children,
1375
+ name,
1376
+ subName,
1377
+ wildcardName = name,
1378
+ readOnlyFields
1379
+ }) => {
1380
+ const subPath = `${name}.${subName}`;
1381
+ const wildcardSubPath = `${wildcardName}.${subName}`;
1382
+ const subReadOnlyFields = (0, import_react11.useMemo)(
1383
+ () => Object.keys(readOnlyFields).reduce((acc, readOnlyKey) => {
1384
+ const isLocal = readOnlyKey.indexOf(subPath) > -1 || readOnlyKey.indexOf(wildcardSubPath) > -1;
1385
+ if (isLocal) {
1386
+ const subPathPattern = new RegExp(
1387
+ `^(${name}|${wildcardName}).`.replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\./g, "\\.").replace(/\*/g, "\\*")
1388
+ );
1389
+ const localName = readOnlyKey.replace(subPathPattern, "");
1390
+ return __spreadProps(__spreadValues({}, acc), {
1391
+ [localName]: readOnlyFields[readOnlyKey]
1392
+ });
1393
+ }
1394
+ return acc;
1395
+ }, {}),
1396
+ [name, subName, wildcardName, readOnlyFields]
1397
+ );
1398
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1399
+ NestedFieldContext.Provider,
1400
+ {
1401
+ value: { readOnlyFields: subReadOnlyFields, localName: subName },
1402
+ children
1403
+ }
1404
+ );
1405
+ };
1406
+
1407
+ // components/AutoField/fields/ArrayField/index.tsx
1408
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1365
1409
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
1366
1410
  var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
1367
1411
  var ArrayField = ({
@@ -1372,10 +1416,10 @@ var ArrayField = ({
1372
1416
  label,
1373
1417
  readOnly,
1374
1418
  id,
1375
- Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", __spreadValues({}, props))
1419
+ Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", __spreadValues({}, props))
1376
1420
  }) => {
1377
1421
  const { state, setUi, selectedItem, getPermissions } = useAppContext();
1378
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
1422
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
1379
1423
  const value = _value;
1380
1424
  const arrayState = state.ui.arrayState[id] || {
1381
1425
  items: Array.from(value || []).map((item, idx) => {
@@ -1386,11 +1430,11 @@ var ArrayField = ({
1386
1430
  }),
1387
1431
  openId: ""
1388
1432
  };
1389
- const [localState, setLocalState] = (0, import_react11.useState)({ arrayState, value });
1390
- (0, import_react11.useEffect)(() => {
1433
+ const [localState, setLocalState] = (0, import_react12.useState)({ arrayState, value });
1434
+ (0, import_react12.useEffect)(() => {
1391
1435
  setLocalState({ arrayState, value });
1392
1436
  }, [value, state.ui.arrayState[id]]);
1393
- const mapArrayStateToUi = (0, import_react11.useCallback)(
1437
+ const mapArrayStateToUi = (0, import_react12.useCallback)(
1394
1438
  (partialArrayState) => {
1395
1439
  return {
1396
1440
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
@@ -1400,13 +1444,13 @@ var ArrayField = ({
1400
1444
  },
1401
1445
  [arrayState]
1402
1446
  );
1403
- const getHighestIndex = (0, import_react11.useCallback)(() => {
1447
+ const getHighestIndex = (0, import_react12.useCallback)(() => {
1404
1448
  return arrayState.items.reduce(
1405
1449
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
1406
1450
  -1
1407
1451
  );
1408
1452
  }, [arrayState]);
1409
- const regenerateArrayState = (0, import_react11.useCallback)(
1453
+ const regenerateArrayState = (0, import_react12.useCallback)(
1410
1454
  (value2) => {
1411
1455
  let highestIndex = getHighestIndex();
1412
1456
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -1425,7 +1469,7 @@ var ArrayField = ({
1425
1469
  },
1426
1470
  [arrayState]
1427
1471
  );
1428
- (0, import_react11.useEffect)(() => {
1472
+ (0, import_react12.useEffect)(() => {
1429
1473
  if (arrayState.items.length > 0) {
1430
1474
  setUi(mapArrayStateToUi(arrayState));
1431
1475
  }
@@ -1435,14 +1479,14 @@ var ArrayField = ({
1435
1479
  return null;
1436
1480
  }
1437
1481
  const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
1438
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1482
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1439
1483
  Label2,
1440
1484
  {
1441
1485
  label: label || name,
1442
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
1486
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(List, { size: 16 }),
1443
1487
  el: "div",
1444
1488
  readOnly,
1445
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1489
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1446
1490
  SortableProvider,
1447
1491
  {
1448
1492
  onMove: (move) => {
@@ -1464,7 +1508,7 @@ var ArrayField = ({
1464
1508
  arrayState: __spreadProps(__spreadValues({}, arrayState), { items: newArrayStateItems })
1465
1509
  });
1466
1510
  },
1467
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1511
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1468
1512
  "div",
1469
1513
  {
1470
1514
  className: getClassName5({
@@ -1478,13 +1522,13 @@ var ArrayField = ({
1478
1522
  localState.arrayState.items.map((item, i) => {
1479
1523
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
1480
1524
  const data = Array.from(localState.value || [])[i] || {};
1481
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1525
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1482
1526
  Sortable,
1483
1527
  {
1484
1528
  id: _arrayId,
1485
1529
  index: i,
1486
1530
  disabled: readOnly,
1487
- children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1531
+ children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1488
1532
  "div",
1489
1533
  {
1490
1534
  ref,
@@ -1494,7 +1538,7 @@ var ArrayField = ({
1494
1538
  readOnly
1495
1539
  }),
1496
1540
  children: [
1497
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1541
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1498
1542
  "div",
1499
1543
  {
1500
1544
  onClick: (e) => {
@@ -1517,9 +1561,9 @@ var ArrayField = ({
1517
1561
  className: getClassNameItem("summary"),
1518
1562
  children: [
1519
1563
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
1520
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("rhs"), children: [
1521
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("actions"), children: [
1522
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1564
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
1565
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("actions"), children: [
1566
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1523
1567
  IconButton,
1524
1568
  {
1525
1569
  type: "button",
@@ -1536,10 +1580,10 @@ var ArrayField = ({
1536
1580
  );
1537
1581
  },
1538
1582
  title: "Duplicate",
1539
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 })
1583
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Copy, { size: 16 })
1540
1584
  }
1541
1585
  ) }),
1542
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1586
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1543
1587
  IconButton,
1544
1588
  {
1545
1589
  type: "button",
@@ -1560,39 +1604,56 @@ var ArrayField = ({
1560
1604
  );
1561
1605
  },
1562
1606
  title: "Delete",
1563
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 })
1607
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Trash, { size: 16 })
1564
1608
  }
1565
1609
  ) })
1566
1610
  ] }),
1567
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DragIcon, {}) })
1611
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
1568
1612
  ] })
1569
1613
  ]
1570
1614
  }
1571
1615
  ),
1572
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((fieldName) => {
1573
- const subField = field.arrayFields[fieldName];
1574
- const subFieldName = `${name}[${i}].${fieldName}`;
1575
- const wildcardFieldName = `${name}[*].${fieldName}`;
1576
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
1577
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1578
- AutoFieldPrivate,
1616
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map((subName) => {
1617
+ const subField = field.arrayFields[subName];
1618
+ const indexName = `${name}[${i}]`;
1619
+ const subPath = `${indexName}.${subName}`;
1620
+ const localIndexName = `${localName}[${i}]`;
1621
+ const localWildcardName = `${localName}[*]`;
1622
+ const localSubPath = `${localIndexName}.${subName}`;
1623
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
1624
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
1625
+ const label2 = subField.label || subName;
1626
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1627
+ NestedFieldProvider,
1579
1628
  {
1580
- name: subFieldName,
1581
- label: subField.label || fieldName,
1582
- id: `${_arrayId}_${fieldName}`,
1583
- readOnly: subReadOnly,
1584
- field: subField,
1585
- value: data[fieldName],
1586
- onChange: (val, ui) => {
1587
- onChange(
1588
- replace(value, i, __spreadProps(__spreadValues({}, data), {
1589
- [fieldName]: val
1590
- })),
1591
- ui
1592
- );
1593
- }
1629
+ name: localIndexName,
1630
+ wildcardName: localWildcardName,
1631
+ subName,
1632
+ readOnlyFields,
1633
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1634
+ AutoFieldPrivate,
1635
+ {
1636
+ name: subPath,
1637
+ label: label2,
1638
+ id: `${_arrayId}_${subName}`,
1639
+ readOnly: subReadOnly,
1640
+ field: __spreadProps(__spreadValues({}, subField), {
1641
+ label: label2
1642
+ // May be used by custom fields
1643
+ }),
1644
+ value: data[subName],
1645
+ onChange: (val, ui) => {
1646
+ onChange(
1647
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
1648
+ [subName]: val
1649
+ })),
1650
+ ui
1651
+ );
1652
+ }
1653
+ }
1654
+ )
1594
1655
  },
1595
- subFieldName
1656
+ subPath
1596
1657
  );
1597
1658
  }) }) })
1598
1659
  ]
@@ -1602,7 +1663,7 @@ var ArrayField = ({
1602
1663
  _arrayId
1603
1664
  );
1604
1665
  }),
1605
- !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1666
+ !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1606
1667
  "button",
1607
1668
  {
1608
1669
  type: "button",
@@ -1616,7 +1677,7 @@ var ArrayField = ({
1616
1677
  const newArrayState = regenerateArrayState(newValue);
1617
1678
  onChange(newValue, mapArrayStateToUi(newArrayState));
1618
1679
  },
1619
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Plus, { size: 21 })
1680
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Plus, { size: 21 })
1620
1681
  }
1621
1682
  )
1622
1683
  ]
@@ -1630,7 +1691,7 @@ var ArrayField = ({
1630
1691
 
1631
1692
  // components/AutoField/fields/DefaultField/index.tsx
1632
1693
  init_react_import();
1633
- var import_jsx_runtime8 = require("react/jsx-runtime");
1694
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1634
1695
  var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
1635
1696
  var DefaultField = ({
1636
1697
  field,
@@ -1642,16 +1703,16 @@ var DefaultField = ({
1642
1703
  Label: Label2,
1643
1704
  id
1644
1705
  }) => {
1645
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1706
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1646
1707
  Label2,
1647
1708
  {
1648
1709
  label: label || name,
1649
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1650
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Type, { size: 16 }),
1651
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hash, { size: 16 })
1710
+ icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1711
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Type, { size: 16 }),
1712
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Hash, { size: 16 })
1652
1713
  ] }),
1653
1714
  readOnly,
1654
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1715
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1655
1716
  "input",
1656
1717
  {
1657
1718
  className: getClassName6("input"),
@@ -1662,7 +1723,14 @@ var DefaultField = ({
1662
1723
  value: typeof value === "undefined" ? "" : value.toString(),
1663
1724
  onChange: (e) => {
1664
1725
  if (field.type === "number") {
1665
- onChange(Number(e.currentTarget.value));
1726
+ const numberValue = Number(e.currentTarget.value);
1727
+ if (typeof field.min !== "undefined" && numberValue < field.min) {
1728
+ return;
1729
+ }
1730
+ if (typeof field.max !== "undefined" && numberValue > field.max) {
1731
+ return;
1732
+ }
1733
+ onChange(numberValue);
1666
1734
  } else {
1667
1735
  onChange(e.currentTarget.value);
1668
1736
  }
@@ -1680,11 +1748,11 @@ var DefaultField = ({
1680
1748
 
1681
1749
  // components/AutoField/fields/ExternalField/index.tsx
1682
1750
  init_react_import();
1683
- var import_react15 = require("react");
1751
+ var import_react16 = require("react");
1684
1752
 
1685
1753
  // components/ExternalInput/index.tsx
1686
1754
  init_react_import();
1687
- var import_react14 = require("react");
1755
+ var import_react15 = require("react");
1688
1756
 
1689
1757
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
1690
1758
  init_react_import();
@@ -1692,7 +1760,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
1692
1760
 
1693
1761
  // components/Modal/index.tsx
1694
1762
  init_react_import();
1695
- var import_react12 = require("react");
1763
+ var import_react13 = require("react");
1696
1764
 
1697
1765
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
1698
1766
  init_react_import();
@@ -1700,22 +1768,22 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
1700
1768
 
1701
1769
  // components/Modal/index.tsx
1702
1770
  var import_react_dom = require("react-dom");
1703
- var import_jsx_runtime9 = require("react/jsx-runtime");
1771
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1704
1772
  var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
1705
1773
  var Modal = ({
1706
1774
  children,
1707
1775
  onClose,
1708
1776
  isOpen
1709
1777
  }) => {
1710
- const [rootEl, setRootEl] = (0, import_react12.useState)(null);
1711
- (0, import_react12.useEffect)(() => {
1778
+ const [rootEl, setRootEl] = (0, import_react13.useState)(null);
1779
+ (0, import_react13.useEffect)(() => {
1712
1780
  setRootEl(document.getElementById("puck-portal-root"));
1713
1781
  }, []);
1714
1782
  if (!rootEl) {
1715
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {});
1783
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
1716
1784
  }
1717
1785
  return (0, import_react_dom.createPortal)(
1718
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1786
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1719
1787
  "div",
1720
1788
  {
1721
1789
  className: getClassName7("inner"),
@@ -1735,11 +1803,11 @@ init_react_import();
1735
1803
  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" };
1736
1804
 
1737
1805
  // components/Heading/index.tsx
1738
- var import_jsx_runtime10 = require("react/jsx-runtime");
1806
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1739
1807
  var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
1740
1808
  var Heading = ({ children, rank, size = "m" }) => {
1741
1809
  const Tag = rank ? `h${rank}` : "span";
1742
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1810
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1743
1811
  Tag,
1744
1812
  {
1745
1813
  className: getClassName8({
@@ -1755,7 +1823,7 @@ init_react_import();
1755
1823
 
1756
1824
  // components/Button/Button.tsx
1757
1825
  init_react_import();
1758
- var import_react13 = require("react");
1826
+ var import_react14 = require("react");
1759
1827
 
1760
1828
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
1761
1829
  init_react_import();
@@ -1775,7 +1843,7 @@ var filterDataAttrs = (props) => {
1775
1843
  };
1776
1844
 
1777
1845
  // components/Button/Button.tsx
1778
- var import_jsx_runtime11 = require("react/jsx-runtime");
1846
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1779
1847
  var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
1780
1848
  var Button = (_a) => {
1781
1849
  var _b = _a, {
@@ -1805,11 +1873,11 @@ var Button = (_a) => {
1805
1873
  "size",
1806
1874
  "loading"
1807
1875
  ]);
1808
- const [loading, setLoading] = (0, import_react13.useState)(loadingProp);
1809
- (0, import_react13.useEffect)(() => setLoading(loadingProp), [loadingProp]);
1876
+ const [loading, setLoading] = (0, import_react14.useState)(loadingProp);
1877
+ (0, import_react14.useEffect)(() => setLoading(loadingProp), [loadingProp]);
1810
1878
  const ElementType = href ? "a" : type ? "button" : "span";
1811
1879
  const dataAttrs = filterDataAttrs(props);
1812
- const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1880
+ const el = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1813
1881
  ElementType,
1814
1882
  __spreadProps(__spreadValues({
1815
1883
  className: getClassName9({
@@ -1834,9 +1902,9 @@ var Button = (_a) => {
1834
1902
  href
1835
1903
  }, dataAttrs), {
1836
1904
  children: [
1837
- icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("icon"), children: icon }),
1905
+ icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("icon"), children: icon }),
1838
1906
  children,
1839
- loading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loader, { size: 14 }) })
1907
+ loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 14 }) })
1840
1908
  ]
1841
1909
  })
1842
1910
  );
@@ -1844,7 +1912,7 @@ var Button = (_a) => {
1844
1912
  };
1845
1913
 
1846
1914
  // components/ExternalInput/index.tsx
1847
- var import_jsx_runtime12 = require("react/jsx-runtime");
1915
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1848
1916
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
1849
1917
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
1850
1918
  var dataCache = {};
@@ -1861,28 +1929,28 @@ var ExternalInput = ({
1861
1929
  mapRow = (val) => val,
1862
1930
  filterFields
1863
1931
  } = field || {};
1864
- const [data, setData] = (0, import_react14.useState)([]);
1865
- const [isOpen, setOpen] = (0, import_react14.useState)(false);
1866
- const [isLoading, setIsLoading] = (0, import_react14.useState)(true);
1932
+ const [data, setData] = (0, import_react15.useState)([]);
1933
+ const [isOpen, setOpen] = (0, import_react15.useState)(false);
1934
+ const [isLoading, setIsLoading] = (0, import_react15.useState)(true);
1867
1935
  const hasFilterFields = !!filterFields;
1868
- const [filters, setFilters] = (0, import_react14.useState)(field.initialFilters || {});
1869
- const [filtersToggled, setFiltersToggled] = (0, import_react14.useState)(hasFilterFields);
1870
- const mappedData = (0, import_react14.useMemo)(() => {
1936
+ const [filters, setFilters] = (0, import_react15.useState)(field.initialFilters || {});
1937
+ const [filtersToggled, setFiltersToggled] = (0, import_react15.useState)(hasFilterFields);
1938
+ const mappedData = (0, import_react15.useMemo)(() => {
1871
1939
  return data.map(mapRow);
1872
1940
  }, [data]);
1873
- const keys = (0, import_react14.useMemo)(() => {
1941
+ const keys = (0, import_react15.useMemo)(() => {
1874
1942
  const validKeys = /* @__PURE__ */ new Set();
1875
1943
  for (const item of mappedData) {
1876
1944
  for (const key of Object.keys(item)) {
1877
- if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react14.isValidElement)(item[key])) {
1945
+ if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react15.isValidElement)(item[key])) {
1878
1946
  validKeys.add(key);
1879
1947
  }
1880
1948
  }
1881
1949
  }
1882
1950
  return Array.from(validKeys);
1883
1951
  }, [mappedData]);
1884
- const [searchQuery, setSearchQuery] = (0, import_react14.useState)(field.initialQuery || "");
1885
- const search = (0, import_react14.useCallback)(
1952
+ const [searchQuery, setSearchQuery] = (0, import_react15.useState)(field.initialQuery || "");
1953
+ const search = (0, import_react15.useCallback)(
1886
1954
  (query, filters2) => __async(void 0, null, function* () {
1887
1955
  setIsLoading(true);
1888
1956
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -1895,18 +1963,18 @@ var ExternalInput = ({
1895
1963
  }),
1896
1964
  [id, field]
1897
1965
  );
1898
- const Footer = (0, import_react14.useCallback)(
1899
- (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: getClassNameModal("footer"), children: [
1966
+ const Footer = (0, import_react15.useCallback)(
1967
+ (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: getClassNameModal("footer"), children: [
1900
1968
  props.items.length,
1901
1969
  " result",
1902
1970
  props.items.length === 1 ? "" : "s"
1903
1971
  ] }),
1904
1972
  [field.renderFooter]
1905
1973
  );
1906
- (0, import_react14.useEffect)(() => {
1974
+ (0, import_react15.useEffect)(() => {
1907
1975
  search(searchQuery, filters);
1908
1976
  }, []);
1909
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1977
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1910
1978
  "div",
1911
1979
  {
1912
1980
  className: getClassName10({
@@ -1916,21 +1984,21 @@ var ExternalInput = ({
1916
1984
  }),
1917
1985
  id,
1918
1986
  children: [
1919
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("actions"), children: [
1920
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1987
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("actions"), children: [
1988
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1921
1989
  "button",
1922
1990
  {
1923
1991
  type: "button",
1924
1992
  onClick: () => setOpen(true),
1925
1993
  className: getClassName10("button"),
1926
1994
  disabled: readOnly,
1927
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1928
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Link, { size: "16" }),
1929
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: field.placeholder })
1995
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1996
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: "16" }),
1997
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: field.placeholder })
1930
1998
  ] })
1931
1999
  }
1932
2000
  ),
1933
- value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2001
+ value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1934
2002
  "button",
1935
2003
  {
1936
2004
  type: "button",
@@ -1939,11 +2007,11 @@ var ExternalInput = ({
1939
2007
  onChange(null);
1940
2008
  },
1941
2009
  disabled: readOnly,
1942
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LockOpen, { size: 16 })
2010
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LockOpen, { size: 16 })
1943
2011
  }
1944
2012
  )
1945
2013
  ] }),
1946
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2014
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1947
2015
  "form",
1948
2016
  {
1949
2017
  className: getClassNameModal({
@@ -1957,11 +2025,11 @@ var ExternalInput = ({
1957
2025
  search(searchQuery, filters);
1958
2026
  },
1959
2027
  children: [
1960
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
1961
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: getClassNameModal("search"), children: [
1962
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
1963
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Search, { size: "18" }) }),
1964
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2028
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
2029
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: getClassNameModal("search"), children: [
2030
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
2031
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Search, { size: "18" }) }),
2032
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1965
2033
  "input",
1966
2034
  {
1967
2035
  className: getClassNameModal("searchInput"),
@@ -1976,9 +2044,9 @@ var ExternalInput = ({
1976
2044
  }
1977
2045
  )
1978
2046
  ] }),
1979
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
1980
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
1981
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2047
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
2048
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
2049
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1982
2050
  IconButton,
1983
2051
  {
1984
2052
  title: "Toggle filters",
@@ -1987,15 +2055,15 @@ var ExternalInput = ({
1987
2055
  e.stopPropagation();
1988
2056
  setFiltersToggled(!filtersToggled);
1989
2057
  },
1990
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlidersHorizontal, { size: 20 })
2058
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlidersHorizontal, { size: 20 })
1991
2059
  }
1992
2060
  ) })
1993
2061
  ] })
1994
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
1995
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("grid"), children: [
1996
- hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
2062
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
2063
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("grid"), children: [
2064
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1997
2065
  const filterField = filterFields[fieldName];
1998
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2066
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1999
2067
  AutoFieldPrivate,
2000
2068
  {
2001
2069
  field: filterField,
@@ -2012,9 +2080,9 @@ var ExternalInput = ({
2012
2080
  fieldName
2013
2081
  );
2014
2082
  }) }),
2015
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
2016
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
2017
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2083
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
2084
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: getClassNameModal("table"), children: [
2085
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2018
2086
  "th",
2019
2087
  {
2020
2088
  className: getClassNameModal("th"),
@@ -2023,8 +2091,8 @@ var ExternalInput = ({
2023
2091
  },
2024
2092
  key
2025
2093
  )) }) }),
2026
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
2027
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2094
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
2095
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2028
2096
  "tr",
2029
2097
  {
2030
2098
  style: { whiteSpace: "nowrap" },
@@ -2033,16 +2101,16 @@ var ExternalInput = ({
2033
2101
  onChange(mapProp(data[i]));
2034
2102
  setOpen(false);
2035
2103
  },
2036
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
2104
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
2037
2105
  },
2038
2106
  i
2039
2107
  );
2040
2108
  }) })
2041
2109
  ] }),
2042
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 24 }) })
2110
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 24 }) })
2043
2111
  ] })
2044
2112
  ] }),
2045
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Footer, { items: mappedData }) })
2113
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Footer, { items: mappedData }) })
2046
2114
  ]
2047
2115
  }
2048
2116
  ) })
@@ -2052,7 +2120,7 @@ var ExternalInput = ({
2052
2120
  };
2053
2121
 
2054
2122
  // components/AutoField/fields/ExternalField/index.tsx
2055
- var import_jsx_runtime13 = require("react/jsx-runtime");
2123
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2056
2124
  var ExternalField = ({
2057
2125
  field,
2058
2126
  onChange,
@@ -2066,7 +2134,7 @@ var ExternalField = ({
2066
2134
  var _a, _b, _c;
2067
2135
  const validField = field;
2068
2136
  const deprecatedField = field;
2069
- (0, import_react15.useEffect)(() => {
2137
+ (0, import_react16.useEffect)(() => {
2070
2138
  if (deprecatedField.adaptor) {
2071
2139
  console.error(
2072
2140
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -2076,7 +2144,7 @@ var ExternalField = ({
2076
2144
  if (field.type !== "external") {
2077
2145
  return null;
2078
2146
  }
2079
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2147
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2080
2148
  ExternalInput,
2081
2149
  {
2082
2150
  name,
@@ -2101,7 +2169,7 @@ var ExternalField = ({
2101
2169
 
2102
2170
  // components/AutoField/fields/RadioField/index.tsx
2103
2171
  init_react_import();
2104
- var import_react16 = require("react");
2172
+ var import_react17 = require("react");
2105
2173
 
2106
2174
  // lib/safe-json-parse.ts
2107
2175
  init_react_import();
@@ -2115,7 +2183,7 @@ var safeJsonParse = (str) => {
2115
2183
  };
2116
2184
 
2117
2185
  // components/AutoField/fields/RadioField/index.tsx
2118
- var import_jsx_runtime14 = require("react/jsx-runtime");
2186
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2119
2187
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
2120
2188
  var RadioField = ({
2121
2189
  field,
@@ -2127,26 +2195,26 @@ var RadioField = ({
2127
2195
  label,
2128
2196
  Label: Label2
2129
2197
  }) => {
2130
- const flatOptions = (0, import_react16.useMemo)(
2198
+ const flatOptions = (0, import_react17.useMemo)(
2131
2199
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
2132
2200
  [field]
2133
2201
  );
2134
2202
  if (field.type !== "radio" || !field.options) {
2135
2203
  return null;
2136
2204
  }
2137
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2205
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2138
2206
  Label2,
2139
2207
  {
2140
- icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
2208
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CircleCheckBig, { size: 16 }),
2141
2209
  label: label || name,
2142
2210
  readOnly,
2143
2211
  el: "div",
2144
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2212
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2145
2213
  "label",
2146
2214
  {
2147
2215
  className: getClassName11("radio"),
2148
2216
  children: [
2149
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2217
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2150
2218
  "input",
2151
2219
  {
2152
2220
  type: "radio",
@@ -2166,7 +2234,7 @@ var RadioField = ({
2166
2234
  checked: value === option.value
2167
2235
  }
2168
2236
  ),
2169
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2237
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2170
2238
  ]
2171
2239
  },
2172
2240
  option.label + option.value
@@ -2177,8 +2245,8 @@ var RadioField = ({
2177
2245
 
2178
2246
  // components/AutoField/fields/SelectField/index.tsx
2179
2247
  init_react_import();
2180
- var import_react17 = require("react");
2181
- var import_jsx_runtime15 = require("react/jsx-runtime");
2248
+ var import_react18 = require("react");
2249
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2182
2250
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
2183
2251
  var SelectField = ({
2184
2252
  field,
@@ -2190,20 +2258,20 @@ var SelectField = ({
2190
2258
  readOnly,
2191
2259
  id
2192
2260
  }) => {
2193
- const flatOptions = (0, import_react17.useMemo)(
2261
+ const flatOptions = (0, import_react18.useMemo)(
2194
2262
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
2195
2263
  [field]
2196
2264
  );
2197
2265
  if (field.type !== "select" || !field.options) {
2198
2266
  return null;
2199
2267
  }
2200
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2268
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2201
2269
  Label2,
2202
2270
  {
2203
2271
  label: label || name,
2204
- icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
2272
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDown, { size: 16 }),
2205
2273
  readOnly,
2206
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2274
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2207
2275
  "select",
2208
2276
  {
2209
2277
  id,
@@ -2220,7 +2288,7 @@ var SelectField = ({
2220
2288
  }
2221
2289
  },
2222
2290
  value,
2223
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2291
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2224
2292
  "option",
2225
2293
  {
2226
2294
  label: option.label,
@@ -2236,7 +2304,7 @@ var SelectField = ({
2236
2304
 
2237
2305
  // components/AutoField/fields/TextareaField/index.tsx
2238
2306
  init_react_import();
2239
- var import_jsx_runtime16 = require("react/jsx-runtime");
2307
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2240
2308
  var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
2241
2309
  var TextareaField = ({
2242
2310
  onChange,
@@ -2247,7 +2315,7 @@ var TextareaField = ({
2247
2315
  Label: Label2,
2248
2316
  id
2249
2317
  }) => {
2250
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2318
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2251
2319
  "textarea",
2252
2320
  {
2253
2321
  id,
@@ -2274,7 +2342,7 @@ init_react_import();
2274
2342
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2275
2343
 
2276
2344
  // components/AutoField/fields/ObjectField/index.tsx
2277
- var import_jsx_runtime17 = require("react/jsx-runtime");
2345
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2278
2346
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2279
2347
  var ObjectField = ({
2280
2348
  field,
@@ -2286,43 +2354,54 @@ var ObjectField = ({
2286
2354
  readOnly,
2287
2355
  id
2288
2356
  }) => {
2289
- const { selectedItem } = useAppContext();
2357
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
2290
2358
  if (field.type !== "object" || !field.objectFields) {
2291
2359
  return null;
2292
2360
  }
2293
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
2294
2361
  const data = value || {};
2295
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2362
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2296
2363
  Label2,
2297
2364
  {
2298
2365
  label: label || name,
2299
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
2366
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EllipsisVertical, { size: 16 }),
2300
2367
  el: "div",
2301
2368
  readOnly,
2302
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
2303
- const subField = field.objectFields[fieldName];
2304
- const subFieldName = `${name}.${fieldName}`;
2305
- const wildcardFieldName = `${name}.${fieldName}`;
2306
- const subReadOnly = readOnly ? readOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
2307
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2308
- AutoFieldPrivate,
2369
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
2370
+ const subField = field.objectFields[subName];
2371
+ const subPath = `${name}.${subName}`;
2372
+ const localSubPath = `${localName || name}.${subName}`;
2373
+ const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
2374
+ const label2 = subField.label || subName;
2375
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2376
+ NestedFieldProvider,
2309
2377
  {
2310
- name: subFieldName,
2311
- label: subField.label || fieldName,
2312
- id: `${id}_${fieldName}`,
2313
- readOnly: subReadOnly,
2314
- field: subField,
2315
- value: data[fieldName],
2316
- onChange: (val, ui) => {
2317
- onChange(
2318
- __spreadProps(__spreadValues({}, data), {
2319
- [fieldName]: val
2378
+ name: localName || id,
2379
+ subName,
2380
+ readOnlyFields,
2381
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2382
+ AutoFieldPrivate,
2383
+ {
2384
+ name: subPath,
2385
+ label: subPath,
2386
+ id: `${id}_${subName}`,
2387
+ readOnly: subReadOnly,
2388
+ field: __spreadProps(__spreadValues({}, subField), {
2389
+ label: label2
2390
+ // May be used by custom fields
2320
2391
  }),
2321
- ui
2322
- );
2323
- }
2392
+ value: data[subName],
2393
+ onChange: (val, ui) => {
2394
+ onChange(
2395
+ __spreadProps(__spreadValues({}, data), {
2396
+ [subName]: val
2397
+ }),
2398
+ ui
2399
+ );
2400
+ }
2401
+ }
2402
+ )
2324
2403
  },
2325
- subFieldName
2404
+ subPath
2326
2405
  );
2327
2406
  }) }) })
2328
2407
  }
@@ -2331,7 +2410,7 @@ var ObjectField = ({
2331
2410
 
2332
2411
  // lib/use-safe-id.ts
2333
2412
  init_react_import();
2334
- var import_react18 = __toESM(require("react"));
2413
+ var import_react19 = __toESM(require("react"));
2335
2414
 
2336
2415
  // lib/generate-id.ts
2337
2416
  init_react_import();
@@ -2340,15 +2419,15 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
2340
2419
 
2341
2420
  // lib/use-safe-id.ts
2342
2421
  var useSafeId = () => {
2343
- if (typeof import_react18.default.useId !== "undefined") {
2344
- return import_react18.default.useId();
2422
+ if (typeof import_react19.default.useId !== "undefined") {
2423
+ return import_react19.default.useId();
2345
2424
  }
2346
- const [id] = (0, import_react18.useState)(generateId());
2425
+ const [id] = (0, import_react19.useState)(generateId());
2347
2426
  return id;
2348
2427
  };
2349
2428
 
2350
2429
  // components/AutoField/index.tsx
2351
- var import_jsx_runtime18 = require("react/jsx-runtime");
2430
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2352
2431
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2353
2432
  var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2354
2433
  var FieldLabel = ({
@@ -2360,16 +2439,16 @@ var FieldLabel = ({
2360
2439
  className
2361
2440
  }) => {
2362
2441
  const El = el;
2363
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(El, { className, children: [
2364
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15("label"), children: [
2365
- icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, {}),
2442
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(El, { className, children: [
2443
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName15("label"), children: [
2444
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {}),
2366
2445
  label,
2367
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Lock, { size: "12" }) })
2446
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Lock, { size: "12" }) })
2368
2447
  ] }),
2369
2448
  children
2370
2449
  ] });
2371
2450
  };
2372
- var FieldLabelInternal2 = ({
2451
+ var FieldLabelInternal = ({
2373
2452
  children,
2374
2453
  icon,
2375
2454
  label,
@@ -2377,14 +2456,14 @@ var FieldLabelInternal2 = ({
2377
2456
  readOnly
2378
2457
  }) => {
2379
2458
  const { overrides } = useAppContext();
2380
- const Wrapper = (0, import_react19.useMemo)(
2459
+ const Wrapper = (0, import_react20.useMemo)(
2381
2460
  () => overrides.fieldLabel || FieldLabel,
2382
2461
  [overrides]
2383
2462
  );
2384
2463
  if (!label) {
2385
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
2464
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
2386
2465
  }
2387
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2466
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2388
2467
  Wrapper,
2389
2468
  {
2390
2469
  label,
@@ -2398,8 +2477,9 @@ var FieldLabelInternal2 = ({
2398
2477
  };
2399
2478
  function AutoFieldInternal(props) {
2400
2479
  var _a, _b, _c, _d, _e, _f, _g, _h;
2401
- const { dispatch, overrides } = useAppContext();
2402
- const { id, Label: Label2 = FieldLabelInternal2 } = props;
2480
+ const { dispatch, overrides, selectedItem } = useAppContext();
2481
+ const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
2482
+ const { id, Label: Label2 = FieldLabelInternal } = props;
2403
2483
  const field = props.field;
2404
2484
  const label = field.label;
2405
2485
  const defaultId = useSafeId();
@@ -2430,7 +2510,7 @@ function AutoFieldInternal(props) {
2430
2510
  Label: Label2,
2431
2511
  id: resolvedId
2432
2512
  });
2433
- const onFocus = (0, import_react19.useCallback)(
2513
+ const onFocus = (0, import_react20.useCallback)(
2434
2514
  (e) => {
2435
2515
  if (mergedProps.name && e.target.nodeName === "INPUT") {
2436
2516
  e.stopPropagation();
@@ -2444,7 +2524,7 @@ function AutoFieldInternal(props) {
2444
2524
  },
2445
2525
  [mergedProps.name]
2446
2526
  );
2447
- const onBlur = (0, import_react19.useCallback)((e) => {
2527
+ const onBlur = (0, import_react20.useCallback)((e) => {
2448
2528
  if ("name" in e.target) {
2449
2529
  dispatch({
2450
2530
  type: "setUi",
@@ -2459,27 +2539,36 @@ function AutoFieldInternal(props) {
2459
2539
  return null;
2460
2540
  }
2461
2541
  const CustomField = field.render;
2462
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
2542
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassNameWrapper(), onFocus, onBlur, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CustomField, __spreadValues({}, mergedProps)) }) });
2463
2543
  }
2464
2544
  const children = defaultFields[field.type](mergedProps);
2465
2545
  const Render2 = render[field.type];
2466
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2467
- "div",
2546
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2547
+ NestedFieldContext.Provider,
2468
2548
  {
2469
- className: getClassNameWrapper(),
2470
- onFocus,
2471
- onBlur,
2472
- onClick: (e) => {
2473
- e.stopPropagation();
2549
+ value: {
2550
+ readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
2551
+ localName: nestedFieldContext.localName
2474
2552
  },
2475
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2553
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2554
+ "div",
2555
+ {
2556
+ className: getClassNameWrapper(),
2557
+ onFocus,
2558
+ onBlur,
2559
+ onClick: (e) => {
2560
+ e.stopPropagation();
2561
+ },
2562
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2563
+ }
2564
+ )
2476
2565
  }
2477
2566
  );
2478
2567
  }
2479
2568
  function AutoFieldPrivate(props) {
2480
2569
  const { state } = useAppContext();
2481
2570
  const { value, onChange } = props;
2482
- const [localValue, setLocalValue] = (0, import_react19.useState)(value);
2571
+ const [localValue, setLocalValue] = (0, import_react20.useState)(value);
2483
2572
  const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
2484
2573
  (val, ui) => {
2485
2574
  onChange(val, ui);
@@ -2487,11 +2576,11 @@ function AutoFieldPrivate(props) {
2487
2576
  50,
2488
2577
  { leading: true }
2489
2578
  );
2490
- const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
2579
+ const onChangeLocal = (0, import_react20.useCallback)((val, ui) => {
2491
2580
  setLocalValue(val);
2492
2581
  onChangeDb(val, ui);
2493
2582
  }, []);
2494
- (0, import_react19.useEffect)(() => {
2583
+ (0, import_react20.useEffect)(() => {
2495
2584
  if (state.ui.field.focus !== props.name) {
2496
2585
  setLocalValue(value);
2497
2586
  }
@@ -2500,11 +2589,11 @@ function AutoFieldPrivate(props) {
2500
2589
  value: localValue,
2501
2590
  onChange: onChangeLocal
2502
2591
  };
2503
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2592
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2504
2593
  }
2505
2594
  function AutoField(props) {
2506
- const DefaultLabel = (0, import_react19.useMemo)(() => {
2507
- const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2595
+ const DefaultLabel = (0, import_react20.useMemo)(() => {
2596
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2508
2597
  "div",
2509
2598
  __spreadProps(__spreadValues({}, labelProps), {
2510
2599
  className: getClassName15({ readOnly: props.readOnly })
@@ -2512,7 +2601,7 @@ function AutoField(props) {
2512
2601
  );
2513
2602
  return DefaultLabel2;
2514
2603
  }, [props.readOnly]);
2515
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2604
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2516
2605
  }
2517
2606
 
2518
2607
  // components/Drawer/index.tsx
@@ -2523,64 +2612,38 @@ init_react_import();
2523
2612
  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" };
2524
2613
 
2525
2614
  // components/Drawer/index.tsx
2526
- var import_react27 = require("react");
2615
+ var import_react32 = require("react");
2527
2616
 
2528
2617
  // components/DragDropContext/index.tsx
2529
2618
  init_react_import();
2530
- var import_react25 = require("@dnd-kit/react");
2531
- var import_react26 = require("react");
2619
+ var import_react30 = require("@dnd-kit/react");
2620
+ var import_react31 = require("react");
2532
2621
  var import_dom = require("@dnd-kit/dom");
2533
2622
 
2534
2623
  // components/DropZone/index.tsx
2535
2624
  init_react_import();
2536
- var import_react24 = require("react");
2625
+ var import_react29 = require("react");
2537
2626
 
2538
2627
  // components/DraggableComponent/index.tsx
2539
2628
  init_react_import();
2540
- var import_react21 = require("react");
2629
+ var import_react23 = require("react");
2541
2630
 
2542
2631
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2543
2632
  init_react_import();
2544
2633
  var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1ukn8_1", "DraggableComponent-overlay": "_DraggableComponent-overlay_1ukn8_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1ukn8_29", "DraggableComponent--hover": "_DraggableComponent--hover_1ukn8_45", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1ukn8_45", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1ukn8_54", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1ukn8_66", "DraggableComponent-actions": "_DraggableComponent-actions_1ukn8_66" };
2545
2634
 
2546
- // lib/use-modifier-held.ts
2547
- init_react_import();
2548
- var import_react20 = require("react");
2549
- var useModifierHeld = (modifier) => {
2550
- const [modifierHeld, setModifierHeld] = (0, import_react20.useState)(false);
2551
- (0, import_react20.useEffect)(() => {
2552
- function downHandler({ key }) {
2553
- if (key === modifier) {
2554
- setModifierHeld(true);
2555
- }
2556
- }
2557
- function upHandler({ key }) {
2558
- if (key === modifier) {
2559
- setModifierHeld(false);
2560
- }
2561
- }
2562
- window.addEventListener("keydown", downHandler);
2563
- window.addEventListener("keyup", upHandler);
2564
- return () => {
2565
- window.removeEventListener("keydown", downHandler);
2566
- window.removeEventListener("keyup", upHandler);
2567
- };
2568
- }, [modifier]);
2569
- return modifierHeld;
2570
- };
2571
-
2572
2635
  // components/DraggableComponent/index.tsx
2573
2636
  var import_react_dom2 = require("react-dom");
2574
2637
 
2575
- // components/DraggableComponent/collision/dynamic/index.ts
2638
+ // lib/dnd/collision/dynamic/index.ts
2576
2639
  init_react_import();
2577
2640
  var import_abstract8 = require("@dnd-kit/abstract");
2578
2641
 
2579
- // components/DraggableComponent/collision/directional/index.ts
2642
+ // lib/dnd/collision/directional/index.ts
2580
2643
  init_react_import();
2581
2644
  var import_abstract = require("@dnd-kit/abstract");
2582
2645
 
2583
- // components/DraggableComponent/collision/collision-debug.ts
2646
+ // lib/dnd/collision/collision-debug.ts
2584
2647
  init_react_import();
2585
2648
  var DEBUG = false;
2586
2649
  var debugElements = {};
@@ -2629,7 +2692,7 @@ var collisionDebug = (a, b, id, color, label) => {
2629
2692
  });
2630
2693
  };
2631
2694
 
2632
- // components/DraggableComponent/collision/directional/index.ts
2695
+ // lib/dnd/collision/directional/index.ts
2633
2696
  var distanceChange = "increasing";
2634
2697
  var directionalCollision = (input, previous) => {
2635
2698
  var _a;
@@ -2662,7 +2725,7 @@ var directionalCollision = (input, previous) => {
2662
2725
  return null;
2663
2726
  };
2664
2727
 
2665
- // components/DraggableComponent/collision/dynamic/get-direction.ts
2728
+ // lib/dnd/collision/dynamic/get-direction.ts
2666
2729
  init_react_import();
2667
2730
  var getDirection = (dragAxis, delta) => {
2668
2731
  if (dragAxis === "dynamic") {
@@ -2677,7 +2740,7 @@ var getDirection = (dragAxis, delta) => {
2677
2740
  return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
2678
2741
  };
2679
2742
 
2680
- // components/DraggableComponent/collision/dynamic/get-midpoint-impact.ts
2743
+ // lib/dnd/collision/dynamic/get-midpoint-impact.ts
2681
2744
  init_react_import();
2682
2745
  var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
2683
2746
  const dragRect = dragShape.boundingRectangle;
@@ -2696,7 +2759,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
2696
2759
  return dragRect.right - offset >= dropCenter.x;
2697
2760
  };
2698
2761
 
2699
- // components/DraggableComponent/collision/dynamic/track-movement-interval.ts
2762
+ // lib/dnd/collision/dynamic/track-movement-interval.ts
2700
2763
  init_react_import();
2701
2764
  var import_geometry = require("@dnd-kit/geometry");
2702
2765
  var INTERVAL_SENSITIVITY = 10;
@@ -2800,7 +2863,14 @@ var closestCorners = (input) => {
2800
2863
  };
2801
2864
  };
2802
2865
 
2803
- // components/DraggableComponent/collision/dynamic/index.ts
2866
+ // lib/dnd/collision/dynamic/store.ts
2867
+ init_react_import();
2868
+ var import_vanilla = require("zustand/vanilla");
2869
+ var collisionStore = (0, import_vanilla.createStore)(() => ({
2870
+ fallbackEnabled: false
2871
+ }));
2872
+
2873
+ // lib/dnd/collision/dynamic/index.ts
2804
2874
  var flushNext = "";
2805
2875
  var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
2806
2876
  var _a, _b, _c, _d, _e;
@@ -2812,6 +2882,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2812
2882
  return null;
2813
2883
  }
2814
2884
  const { center: dragCenter } = dragShape;
2885
+ const { fallbackEnabled } = collisionStore.getState();
2815
2886
  const interval = trackMovementInterval(position.current, dragAxis);
2816
2887
  dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
2817
2888
  direction: interval.direction
@@ -2857,7 +2928,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2857
2928
  flushNext = "";
2858
2929
  return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
2859
2930
  }
2860
- if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2931
+ if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2861
2932
  const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
2862
2933
  const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
2863
2934
  if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
@@ -2918,8 +2989,102 @@ function getDeepScrollPosition(element) {
2918
2989
  return totalScroll;
2919
2990
  }
2920
2991
 
2992
+ // components/DropZone/context.tsx
2993
+ init_react_import();
2994
+ var import_react21 = require("react");
2995
+ var import_zustand = require("zustand");
2996
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2997
+ var dropZoneContext = (0, import_react21.createContext)(null);
2998
+ var ZoneStoreContext = (0, import_react21.createContext)(
2999
+ (0, import_zustand.createStore)(() => ({
3000
+ zoneDepthIndex: {},
3001
+ nextZoneDepthIndex: {},
3002
+ areaDepthIndex: {},
3003
+ nextAreaDepthIndex: {},
3004
+ draggedItem: null,
3005
+ previewIndex: {}
3006
+ }))
3007
+ );
3008
+ var ZoneStoreProvider = ({
3009
+ children,
3010
+ store
3011
+ }) => {
3012
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ZoneStoreContext.Provider, { value: store, children });
3013
+ };
3014
+ var DropZoneProvider = ({
3015
+ children,
3016
+ value
3017
+ }) => {
3018
+ const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
3019
+ const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
3020
+ {}
3021
+ );
3022
+ const [activeZones, setActiveZones] = (0, import_react21.useState)({});
3023
+ const { dispatch } = useAppContext();
3024
+ const registerZoneArea = (0, import_react21.useCallback)(
3025
+ (area) => {
3026
+ setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
3027
+ },
3028
+ [setAreasWithZones]
3029
+ );
3030
+ const registerZone = (0, import_react21.useCallback)(
3031
+ (zoneCompound) => {
3032
+ if (!dispatch) {
3033
+ return;
3034
+ }
3035
+ dispatch({
3036
+ type: "registerZone",
3037
+ zone: zoneCompound
3038
+ });
3039
+ setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
3040
+ },
3041
+ [setActiveZones, dispatch]
3042
+ );
3043
+ const unregisterZone = (0, import_react21.useCallback)(
3044
+ (zoneCompound) => {
3045
+ if (!dispatch) {
3046
+ return;
3047
+ }
3048
+ dispatch({
3049
+ type: "unregisterZone",
3050
+ zone: zoneCompound
3051
+ });
3052
+ setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
3053
+ [zoneCompound]: false
3054
+ }));
3055
+ },
3056
+ [setActiveZones, dispatch]
3057
+ );
3058
+ const memoValue = (0, import_react21.useMemo)(
3059
+ () => __spreadValues({
3060
+ hoveringComponent,
3061
+ setHoveringComponent,
3062
+ registerZoneArea,
3063
+ areasWithZones,
3064
+ registerZone,
3065
+ unregisterZone,
3066
+ activeZones
3067
+ }, value),
3068
+ [value, hoveringComponent, areasWithZones, activeZones]
3069
+ );
3070
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
3071
+ };
3072
+
3073
+ // lib/use-context-store.ts
3074
+ init_react_import();
3075
+ var import_react22 = require("react");
3076
+ var import_zustand2 = require("zustand");
3077
+ var import_shallow = require("zustand/react/shallow");
3078
+ function useContextStore(context, selector) {
3079
+ const store = (0, import_react22.useContext)(context);
3080
+ if (!store) {
3081
+ throw new Error("useContextStore must be used inside context");
3082
+ }
3083
+ return (0, import_zustand2.useStore)(store, (0, import_shallow.useShallow)(selector));
3084
+ }
3085
+
2921
3086
  // components/DraggableComponent/index.tsx
2922
- var import_jsx_runtime19 = require("react/jsx-runtime");
3087
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2923
3088
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
2924
3089
  var DEBUG2 = false;
2925
3090
  var space = 8;
@@ -2930,12 +3095,12 @@ var DefaultActionBar = ({
2930
3095
  label,
2931
3096
  children,
2932
3097
  parentAction
2933
- }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ActionBar, { children: [
2934
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ActionBar.Group, { children: [
3098
+ }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar, { children: [
3099
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar.Group, { children: [
2935
3100
  parentAction,
2936
- label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Label, { label })
3101
+ label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Label, { label })
2937
3102
  ] }),
2938
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Group, { children })
3103
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Group, { children })
2939
3104
  ] });
2940
3105
  var convertIdToSelector = (id, zoneCompound, data) => {
2941
3106
  const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
@@ -2970,10 +3135,9 @@ var DraggableComponent = ({
2970
3135
  iframe,
2971
3136
  state
2972
3137
  } = useAppContext();
2973
- const isModifierHeld = useModifierHeld("Alt");
2974
- const ctx = (0, import_react21.useContext)(dropZoneContext);
2975
- const [localZones, setLocalZones] = (0, import_react21.useState)({});
2976
- const registerLocalZone = (0, import_react21.useCallback)(
3138
+ const ctx = (0, import_react23.useContext)(dropZoneContext);
3139
+ const [localZones, setLocalZones] = (0, import_react23.useState)({});
3140
+ const registerLocalZone = (0, import_react23.useCallback)(
2977
3141
  (zoneCompound2, active) => {
2978
3142
  var _a;
2979
3143
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -2983,7 +3147,7 @@ var DraggableComponent = ({
2983
3147
  },
2984
3148
  [setLocalZones]
2985
3149
  );
2986
- const unregisterLocalZone = (0, import_react21.useCallback)(
3150
+ const unregisterLocalZone = (0, import_react23.useCallback)(
2987
3151
  (zoneCompound2) => {
2988
3152
  var _a;
2989
3153
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -2997,8 +3161,8 @@ var DraggableComponent = ({
2997
3161
  );
2998
3162
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
2999
3163
  const { path = [] } = ctx || {};
3000
- const [canDrag, setCanDrag] = (0, import_react21.useState)(false);
3001
- (0, import_react21.useEffect)(() => {
3164
+ const [canDrag, setCanDrag] = (0, import_react23.useState)(false);
3165
+ (0, import_react23.useEffect)(() => {
3002
3166
  var _a;
3003
3167
  const item = getItem({ index, zone: zoneCompound }, state.data);
3004
3168
  if (item) {
@@ -3008,10 +3172,13 @@ var DraggableComponent = ({
3008
3172
  setCanDrag((_a = perms.drag) != null ? _a : true);
3009
3173
  }
3010
3174
  }, [state, index, zoneCompound, getPermissions]);
3011
- const userIsDragging = !!(ctx == null ? void 0 : ctx.draggedItem);
3175
+ const userIsDragging = useContextStore(
3176
+ ZoneStoreContext,
3177
+ (s) => !!s.draggedItem
3178
+ );
3012
3179
  const canCollide = canDrag || userIsDragging;
3013
3180
  const disabled = !isEnabled || !canCollide;
3014
- const [dragAxis, setDragAxis] = (0, import_react21.useState)(userDragAxis || autoDragAxis);
3181
+ const [dragAxis, setDragAxis] = (0, import_react23.useState)(userDragAxis || autoDragAxis);
3015
3182
  const { ref: sortableRef, status } = useSortableSafe({
3016
3183
  id,
3017
3184
  index,
@@ -3037,8 +3204,8 @@ var DraggableComponent = ({
3037
3204
  }
3038
3205
  });
3039
3206
  const thisIsDragging = status === "dragging";
3040
- const ref = (0, import_react21.useRef)(null);
3041
- const refSetter = (0, import_react21.useCallback)(
3207
+ const ref = (0, import_react23.useRef)(null);
3208
+ const refSetter = (0, import_react23.useCallback)(
3042
3209
  (el) => {
3043
3210
  sortableRef(el);
3044
3211
  if (el) {
@@ -3047,14 +3214,14 @@ var DraggableComponent = ({
3047
3214
  },
3048
3215
  [sortableRef]
3049
3216
  );
3050
- const [portalEl, setPortalEl] = (0, import_react21.useState)();
3051
- (0, import_react21.useEffect)(() => {
3217
+ const [portalEl, setPortalEl] = (0, import_react23.useState)();
3218
+ (0, import_react23.useEffect)(() => {
3052
3219
  var _a, _b, _c;
3053
3220
  setPortalEl(
3054
3221
  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
3055
3222
  );
3056
3223
  }, [iframe.enabled, ref.current]);
3057
- const getStyle = (0, import_react21.useCallback)(() => {
3224
+ const getStyle = (0, import_react23.useCallback)(() => {
3058
3225
  var _a, _b, _c;
3059
3226
  if (!ref.current) return;
3060
3227
  const rect = ref.current.getBoundingClientRect();
@@ -3074,11 +3241,11 @@ var DraggableComponent = ({
3074
3241
  };
3075
3242
  return style2;
3076
3243
  }, [ref.current]);
3077
- const [style, setStyle] = (0, import_react21.useState)();
3078
- const sync = (0, import_react21.useCallback)(() => {
3244
+ const [style, setStyle] = (0, import_react23.useState)();
3245
+ const sync = (0, import_react23.useCallback)(() => {
3079
3246
  setStyle(getStyle());
3080
3247
  }, [ref.current, iframe]);
3081
- (0, import_react21.useEffect)(() => {
3248
+ (0, import_react23.useEffect)(() => {
3082
3249
  if (ref.current) {
3083
3250
  const observer = new ResizeObserver(sync);
3084
3251
  observer.observe(ref.current);
@@ -3087,20 +3254,22 @@ var DraggableComponent = ({
3087
3254
  };
3088
3255
  }
3089
3256
  }, [ref.current]);
3090
- (0, import_react21.useEffect)(() => {
3091
- ctx == null ? void 0 : ctx.registerPath({
3092
- index,
3093
- zone: zoneCompound
3094
- });
3257
+ (0, import_react23.useEffect)(() => {
3258
+ if (isSelected) {
3259
+ ctx == null ? void 0 : ctx.registerPath({
3260
+ index,
3261
+ zone: zoneCompound
3262
+ });
3263
+ }
3095
3264
  }, [isSelected]);
3096
- const CustomActionBar = (0, import_react21.useMemo)(
3265
+ const CustomActionBar = (0, import_react23.useMemo)(
3097
3266
  () => overrides.actionBar || DefaultActionBar,
3098
3267
  [overrides.actionBar]
3099
3268
  );
3100
3269
  const permissions = getPermissions({
3101
3270
  item: selectedItem
3102
3271
  });
3103
- const onClick = (0, import_react21.useCallback)(
3272
+ const onClick = (0, import_react23.useCallback)(
3104
3273
  (e) => {
3105
3274
  e.stopPropagation();
3106
3275
  dispatch({
@@ -3112,7 +3281,7 @@ var DraggableComponent = ({
3112
3281
  },
3113
3282
  [index, zoneCompound, id]
3114
3283
  );
3115
- const onSelectParent = (0, import_react21.useCallback)(() => {
3284
+ const onSelectParent = (0, import_react23.useCallback)(() => {
3116
3285
  if (!(ctx == null ? void 0 : ctx.areaId)) {
3117
3286
  return;
3118
3287
  }
@@ -3130,23 +3299,23 @@ var DraggableComponent = ({
3130
3299
  }
3131
3300
  });
3132
3301
  }, [ctx, path]);
3133
- const onDuplicate = (0, import_react21.useCallback)(() => {
3302
+ const onDuplicate = (0, import_react23.useCallback)(() => {
3134
3303
  dispatch({
3135
3304
  type: "duplicate",
3136
3305
  sourceIndex: index,
3137
3306
  sourceZone: zoneCompound
3138
3307
  });
3139
3308
  }, [index, zoneCompound]);
3140
- const onDelete = (0, import_react21.useCallback)(() => {
3309
+ const onDelete = (0, import_react23.useCallback)(() => {
3141
3310
  dispatch({
3142
3311
  type: "remove",
3143
3312
  index,
3144
3313
  zone: zoneCompound
3145
3314
  });
3146
3315
  }, [index, zoneCompound]);
3147
- const [hover, setHover] = (0, import_react21.useState)(false);
3316
+ const [hover, setHover] = (0, import_react23.useState)(false);
3148
3317
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3149
- (0, import_react21.useEffect)(() => {
3318
+ (0, import_react23.useEffect)(() => {
3150
3319
  if (!ref.current) {
3151
3320
  return;
3152
3321
  }
@@ -3196,7 +3365,7 @@ var DraggableComponent = ({
3196
3365
  thisIsDragging,
3197
3366
  inDroppableZone
3198
3367
  ]);
3199
- (0, import_react21.useEffect)(() => {
3368
+ (0, import_react23.useEffect)(() => {
3200
3369
  if (ref.current && disabled) {
3201
3370
  ref.current.setAttribute("data-puck-disabled", "");
3202
3371
  return () => {
@@ -3205,8 +3374,8 @@ var DraggableComponent = ({
3205
3374
  };
3206
3375
  }
3207
3376
  }, [disabled, ref]);
3208
- const [isVisible, setIsVisible] = (0, import_react21.useState)(false);
3209
- (0, import_react21.useEffect)(() => {
3377
+ const [isVisible, setIsVisible] = (0, import_react23.useState)(false);
3378
+ (0, import_react23.useEffect)(() => {
3210
3379
  sync();
3211
3380
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
3212
3381
  setIsVisible(true);
@@ -3214,7 +3383,7 @@ var DraggableComponent = ({
3214
3383
  setIsVisible(false);
3215
3384
  }
3216
3385
  }, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
3217
- const syncActionsPosition = (0, import_react21.useCallback)(
3386
+ const syncActionsPosition = (0, import_react23.useCallback)(
3218
3387
  (el) => {
3219
3388
  if (el) {
3220
3389
  const view = el.ownerDocument.defaultView;
@@ -3231,7 +3400,7 @@ var DraggableComponent = ({
3231
3400
  },
3232
3401
  [zoomConfig]
3233
3402
  );
3234
- (0, import_react21.useEffect)(() => {
3403
+ (0, import_react23.useEffect)(() => {
3235
3404
  if (userDragAxis) {
3236
3405
  setDragAxis(userDragAxis);
3237
3406
  return;
@@ -3245,8 +3414,8 @@ var DraggableComponent = ({
3245
3414
  }
3246
3415
  setDragAxis(autoDragAxis);
3247
3416
  }, [ref, userDragAxis, autoDragAxis]);
3248
- const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CornerLeftUp, { size: 16 }) });
3249
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3417
+ const parentAction = (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CornerLeftUp, { size: 16 }) });
3418
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3250
3419
  DropZoneProvider,
3251
3420
  {
3252
3421
  value: __spreadProps(__spreadValues({}, ctx), {
@@ -3260,28 +3429,27 @@ var DraggableComponent = ({
3260
3429
  }),
3261
3430
  children: [
3262
3431
  isVisible && (0, import_react_dom2.createPortal)(
3263
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3432
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3264
3433
  "div",
3265
3434
  {
3266
3435
  className: getClassName16({
3267
3436
  isSelected,
3268
3437
  isDragging: thisIsDragging,
3269
- isModifierHeld,
3270
3438
  hover: hover || indicativeHover
3271
3439
  }),
3272
3440
  style: __spreadValues({}, style),
3273
3441
  "data-puck-overlay": true,
3274
3442
  children: [
3275
3443
  debug,
3276
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Loader, {}) }),
3277
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3444
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, {}) }),
3445
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3278
3446
  "div",
3279
3447
  {
3280
3448
  className: getClassName16("actionsOverlay"),
3281
3449
  style: {
3282
3450
  top: actionsOverlayTop / zoomConfig.zoom
3283
3451
  },
3284
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3452
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3285
3453
  "div",
3286
3454
  {
3287
3455
  className: getClassName16("actions"),
@@ -3293,14 +3461,14 @@ var DraggableComponent = ({
3293
3461
  paddingRight: actionsSide
3294
3462
  },
3295
3463
  ref: syncActionsPosition,
3296
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3464
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3297
3465
  CustomActionBar,
3298
3466
  {
3299
3467
  parentAction,
3300
3468
  label: DEBUG2 ? id : label,
3301
3469
  children: [
3302
- permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Copy, { size: 16 }) }),
3303
- permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Trash, { size: 16 }) })
3470
+ permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
3471
+ permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash, { size: 16 }) })
3304
3472
  ]
3305
3473
  }
3306
3474
  )
@@ -3308,7 +3476,7 @@ var DraggableComponent = ({
3308
3476
  )
3309
3477
  }
3310
3478
  ),
3311
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("overlay") })
3479
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("overlay") })
3312
3480
  ]
3313
3481
  }
3314
3482
  ),
@@ -3324,96 +3492,29 @@ var DraggableComponent = ({
3324
3492
  init_react_import();
3325
3493
  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" };
3326
3494
 
3327
- // components/DropZone/context.tsx
3495
+ // components/DropZone/lib/use-min-empty-height.ts
3328
3496
  init_react_import();
3329
- var import_react22 = require("react");
3330
- var import_jsx_runtime20 = require("react/jsx-runtime");
3331
- var dropZoneContext = (0, import_react22.createContext)(null);
3332
- var DropZoneProvider = ({
3333
- children,
3334
- value
3497
+ var import_react24 = require("react");
3498
+ var useMinEmptyHeight = ({
3499
+ zoneCompound,
3500
+ userMinEmptyHeight,
3501
+ ref
3335
3502
  }) => {
3336
- const [hoveringComponent, setHoveringComponent] = (0, import_react22.useState)();
3337
- const [areasWithZones, setAreasWithZones] = (0, import_react22.useState)(
3338
- {}
3339
- );
3340
- const [activeZones, setActiveZones] = (0, import_react22.useState)({});
3341
- const { dispatch = null } = value ? value : {};
3342
- const registerZoneArea = (0, import_react22.useCallback)(
3343
- (area) => {
3344
- setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
3345
- },
3346
- [setAreasWithZones]
3347
- );
3348
- const registerZone = (0, import_react22.useCallback)(
3349
- (zoneCompound) => {
3350
- if (!dispatch) {
3351
- return;
3352
- }
3353
- dispatch({
3354
- type: "registerZone",
3355
- zone: zoneCompound
3356
- });
3357
- setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
3358
- },
3359
- [setActiveZones, dispatch]
3360
- );
3361
- const unregisterZone = (0, import_react22.useCallback)(
3362
- (zoneCompound) => {
3363
- if (!dispatch) {
3364
- return;
3365
- }
3366
- dispatch({
3367
- type: "unregisterZone",
3368
- zone: zoneCompound
3369
- });
3370
- setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
3371
- [zoneCompound]: false
3372
- }));
3373
- },
3374
- [setActiveZones, dispatch]
3375
- );
3376
- const memoValue = (0, import_react22.useMemo)(
3377
- () => __spreadValues({
3378
- hoveringComponent,
3379
- setHoveringComponent,
3380
- registerZoneArea,
3381
- areasWithZones,
3382
- registerZone,
3383
- unregisterZone,
3384
- activeZones
3385
- }, value),
3386
- [value, hoveringComponent, areasWithZones, activeZones]
3387
- );
3388
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
3389
- };
3390
-
3391
- // lib/insert.ts
3392
- init_react_import();
3393
- var insert = (list, index, item) => {
3394
- const result = Array.from(list);
3395
- result.splice(index, 0, item);
3396
- return result;
3397
- };
3398
-
3399
- // components/DropZone/use-min-empty-height.ts
3400
- init_react_import();
3401
- var import_react23 = require("react");
3402
- var useMinEmptyHeight = ({
3403
- draggedItem,
3404
- zoneCompound,
3405
- userMinEmptyHeight,
3406
- ref
3407
- }) => {
3408
- const [prevHeight, setPrevHeight] = (0, import_react23.useState)(0);
3409
- const [isAnimating, setIsAnimating] = (0, import_react23.useState)(false);
3410
- (0, import_react23.useEffect)(() => {
3411
- if (draggedItem && ref.current) {
3412
- const componentData = draggedItem.data;
3413
- if (componentData.zone === zoneCompound) {
3414
- const rect = ref.current.getBoundingClientRect();
3415
- setPrevHeight(rect.height);
3416
- setIsAnimating(true);
3503
+ const [prevHeight, setPrevHeight] = (0, import_react24.useState)(0);
3504
+ const [isAnimating, setIsAnimating] = (0, import_react24.useState)(false);
3505
+ const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3506
+ var _a, _b;
3507
+ return {
3508
+ draggedItem: ((_a = s.draggedItem) == null ? void 0 : _a.data.zone) === zoneCompound ? s.draggedItem : null,
3509
+ isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
3510
+ };
3511
+ });
3512
+ (0, import_react24.useEffect)(() => {
3513
+ if (draggedItem && ref.current) {
3514
+ if (isZone) {
3515
+ const rect = ref.current.getBoundingClientRect();
3516
+ setPrevHeight(rect.height);
3517
+ setIsAnimating(true);
3417
3518
  return;
3418
3519
  }
3419
3520
  }
@@ -3440,15 +3541,131 @@ function assignRefs(refs, node) {
3440
3541
  });
3441
3542
  }
3442
3543
 
3443
- // components/DropZone/index.tsx
3444
- var import_jsx_runtime21 = require("react/jsx-runtime");
3445
- var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
3446
- var DEBUG3 = false;
3544
+ // components/DropZone/lib/use-content-with-preview.ts
3545
+ init_react_import();
3546
+ var import_react27 = require("react");
3547
+
3548
+ // lib/dnd/use-rendered-callback.ts
3549
+ init_react_import();
3550
+ var import_react25 = require("@dnd-kit/react");
3551
+ var import_react26 = require("react");
3552
+ function useRenderedCallback(callback, deps) {
3553
+ const manager = (0, import_react25.useDragDropManager)();
3554
+ return (0, import_react26.useCallback)(
3555
+ (...args) => __async(this, null, function* () {
3556
+ yield manager == null ? void 0 : manager.renderer.rendering;
3557
+ return callback(...args);
3558
+ }),
3559
+ [...deps, manager]
3560
+ );
3561
+ }
3562
+
3563
+ // lib/insert.ts
3564
+ init_react_import();
3565
+ var insert = (list, index, item) => {
3566
+ const result = Array.from(list);
3567
+ result.splice(index, 0, item);
3568
+ return result;
3569
+ };
3570
+
3571
+ // components/DropZone/lib/use-content-with-preview.ts
3572
+ var useContentWithPreview = (content, zoneCompound) => {
3573
+ const { draggedItemId, preview, previewExists } = useContextStore(
3574
+ ZoneStoreContext,
3575
+ (s) => {
3576
+ var _a;
3577
+ return {
3578
+ draggedItemId: (_a = s.draggedItem) == null ? void 0 : _a.id,
3579
+ preview: s.previewIndex[zoneCompound],
3580
+ previewExists: Object.keys(s.previewIndex || {}).length > 0
3581
+ };
3582
+ }
3583
+ );
3584
+ const [contentWithPreview, setContentWithPreview] = (0, import_react27.useState)(content);
3585
+ const updateContent = useRenderedCallback(
3586
+ (content2, preview2) => {
3587
+ if (preview2) {
3588
+ if (preview2.type === "insert") {
3589
+ setContentWithPreview(
3590
+ insert(
3591
+ content2.filter((item) => item.props.id !== preview2.props.id),
3592
+ preview2.index,
3593
+ {
3594
+ type: "preview",
3595
+ props: { id: preview2.props.id }
3596
+ }
3597
+ )
3598
+ );
3599
+ } else {
3600
+ setContentWithPreview(
3601
+ insert(
3602
+ content2.filter((item) => item.props.id !== preview2.props.id),
3603
+ preview2.index,
3604
+ {
3605
+ type: preview2.componentType,
3606
+ props: preview2.props
3607
+ }
3608
+ )
3609
+ );
3610
+ }
3611
+ } else {
3612
+ setContentWithPreview(
3613
+ previewExists ? content2.filter((item) => item.props.id !== draggedItemId) : content2
3614
+ );
3615
+ }
3616
+ },
3617
+ [draggedItemId, previewExists]
3618
+ );
3619
+ (0, import_react27.useEffect)(() => {
3620
+ updateContent(content, preview);
3621
+ }, [content, preview]);
3622
+ return contentWithPreview;
3623
+ };
3624
+
3625
+ // components/DropZone/lib/use-drag-axis.ts
3626
+ init_react_import();
3627
+ var import_react28 = require("react");
3447
3628
  var GRID_DRAG_AXIS = "dynamic";
3448
3629
  var FLEX_ROW_DRAG_AXIS = "x";
3449
3630
  var DEFAULT_DRAG_AXIS = "y";
3450
- var DropZoneEdit = (0, import_react24.forwardRef)(
3451
- function DropZoneEdit2({
3631
+ var useDragAxis = (ref, collisionAxis) => {
3632
+ const { status } = useAppContext();
3633
+ const [dragAxis, setDragAxis] = (0, import_react28.useState)(
3634
+ collisionAxis || DEFAULT_DRAG_AXIS
3635
+ );
3636
+ const calculateDragAxis = (0, import_react28.useCallback)(() => {
3637
+ if (ref.current) {
3638
+ const computedStyle = window.getComputedStyle(ref.current);
3639
+ if (computedStyle.display === "grid") {
3640
+ setDragAxis(GRID_DRAG_AXIS);
3641
+ } else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
3642
+ setDragAxis(FLEX_ROW_DRAG_AXIS);
3643
+ } else {
3644
+ setDragAxis(DEFAULT_DRAG_AXIS);
3645
+ }
3646
+ }
3647
+ }, [ref.current]);
3648
+ (0, import_react28.useEffect)(() => {
3649
+ const onViewportChange = () => {
3650
+ calculateDragAxis();
3651
+ };
3652
+ window.addEventListener("viewportchange", onViewportChange);
3653
+ return () => {
3654
+ window.removeEventListener("viewportchange", onViewportChange);
3655
+ };
3656
+ }, []);
3657
+ (0, import_react28.useEffect)(calculateDragAxis, [status, collisionAxis]);
3658
+ return [dragAxis, calculateDragAxis];
3659
+ };
3660
+
3661
+ // components/DropZone/index.tsx
3662
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3663
+ var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
3664
+ var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
3665
+ var RENDER_DEBUG = false;
3666
+ var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadValues({}, props));
3667
+ var DropZoneEdit = (0, import_react29.forwardRef)(
3668
+ function DropZoneEditInternal({
3452
3669
  zone,
3453
3670
  allow,
3454
3671
  disallow,
@@ -3458,31 +3675,50 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3458
3675
  collisionAxis
3459
3676
  }, userRef) {
3460
3677
  const appContext2 = useAppContext();
3461
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3678
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3462
3679
  const {
3463
3680
  // These all need setting via context
3464
3681
  data,
3465
3682
  config,
3466
3683
  areaId,
3467
- draggedItem,
3468
3684
  registerZoneArea,
3469
3685
  depth,
3470
3686
  registerLocalZone,
3471
3687
  unregisterLocalZone,
3472
- deepestZone = rootDroppableId,
3473
- deepestArea,
3474
- nextDeepestArea,
3475
3688
  path = [],
3476
3689
  activeZones
3477
3690
  } = ctx;
3478
- const { itemSelector } = appContext2.state.ui;
3479
3691
  let zoneCompound = rootDroppableId;
3480
- (0, import_react24.useEffect)(() => {
3692
+ if (areaId) {
3693
+ if (zone !== rootDroppableId) {
3694
+ zoneCompound = `${areaId}:${zone}`;
3695
+ }
3696
+ }
3697
+ const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
3698
+ const {
3699
+ isDeepestZone,
3700
+ inNextDeepestArea,
3701
+ draggedComponentType,
3702
+ userIsDragging,
3703
+ preview
3704
+ } = useContextStore(ZoneStoreContext, (s) => {
3705
+ var _a, _b, _c;
3706
+ return {
3707
+ isDeepestZone: (_a = s.zoneDepthIndex[zoneCompound]) != null ? _a : false,
3708
+ inNextDeepestArea: s.nextAreaDepthIndex[areaId || ""],
3709
+ draggedItemId: (_b = s.draggedItem) == null ? void 0 : _b.id,
3710
+ draggedComponentType: (_c = s.draggedItem) == null ? void 0 : _c.data.componentType,
3711
+ userIsDragging: !!s.draggedItem,
3712
+ preview: s.previewIndex[zoneCompound]
3713
+ };
3714
+ });
3715
+ const { itemSelector } = appContext2.state.ui;
3716
+ (0, import_react29.useEffect)(() => {
3481
3717
  if (areaId && registerZoneArea) {
3482
3718
  registerZoneArea(areaId);
3483
3719
  }
3484
3720
  }, [areaId]);
3485
- (0, import_react24.useEffect)(() => {
3721
+ (0, import_react29.useEffect)(() => {
3486
3722
  if (ctx == null ? void 0 : ctx.registerZone) {
3487
3723
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3488
3724
  }
@@ -3492,25 +3728,18 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3492
3728
  }
3493
3729
  };
3494
3730
  }, []);
3495
- if (areaId) {
3496
- if (zone !== rootDroppableId) {
3497
- zoneCompound = `${areaId}:${zone}`;
3498
- }
3499
- }
3500
- const content = (0, import_react24.useMemo)(() => {
3731
+ const content = (0, import_react29.useMemo)(() => {
3501
3732
  if (areaId && zone !== rootDroppableId) {
3502
3733
  return setupZone(data, zoneCompound).zones[zoneCompound];
3503
3734
  }
3504
3735
  return data.content || [];
3505
3736
  }, [data, zoneCompound]);
3506
- const ref = (0, import_react24.useRef)(null);
3507
- const acceptsTarget = (0, import_react24.useCallback)(
3508
- (target) => {
3509
- if (!target) {
3737
+ const ref = (0, import_react29.useRef)(null);
3738
+ const acceptsTarget = (0, import_react29.useCallback)(
3739
+ (componentType) => {
3740
+ if (!componentType) {
3510
3741
  return true;
3511
3742
  }
3512
- const data2 = target.data;
3513
- const { componentType } = data2;
3514
3743
  if (disallow) {
3515
3744
  const defaultedAllow = allow || [];
3516
3745
  const filteredDisallow = (disallow || []).filter(
@@ -3528,49 +3757,26 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3528
3757
  },
3529
3758
  [allow, disallow]
3530
3759
  );
3531
- (0, import_react24.useEffect)(() => {
3760
+ (0, import_react29.useEffect)(() => {
3532
3761
  if (registerLocalZone) {
3533
- registerLocalZone(zoneCompound, acceptsTarget(draggedItem));
3762
+ registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
3534
3763
  }
3535
3764
  return () => {
3536
3765
  if (unregisterLocalZone) {
3537
3766
  unregisterLocalZone(zoneCompound);
3538
3767
  }
3539
3768
  };
3540
- }, [draggedItem, zoneCompound]);
3541
- const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
3542
- const hoveringOverArea = nextDeepestArea ? nextDeepestArea === areaId : isRootZone;
3543
- const userIsDragging = !!draggedItem;
3769
+ }, [draggedComponentType, zoneCompound]);
3770
+ const hoveringOverArea = inNextDeepestArea || isRootZone;
3544
3771
  let isEnabled = true;
3545
- if (draggedItem) {
3546
- isEnabled = deepestZone === zoneCompound;
3772
+ if (userIsDragging) {
3773
+ isEnabled = isDeepestZone;
3547
3774
  }
3548
3775
  if (isEnabled) {
3549
- isEnabled = acceptsTarget(draggedItem);
3550
- }
3551
- const preview = (0, import_react24.useContext)(previewContext);
3552
- const previewInZone = (preview == null ? void 0 : preview.zone) === zoneCompound;
3553
- const contentWithPreview = (0, import_react24.useMemo)(() => {
3554
- let contentWithPreview2 = preview ? content.filter((item) => item.props.id !== preview.props.id) : content;
3555
- if (previewInZone) {
3556
- contentWithPreview2 = content.filter(
3557
- (item) => item.props.id !== preview.props.id
3558
- );
3559
- if (preview.type === "insert") {
3560
- contentWithPreview2 = insert(contentWithPreview2, preview.index, {
3561
- type: "preview",
3562
- props: { id: preview.props.id }
3563
- });
3564
- } else {
3565
- contentWithPreview2 = insert(contentWithPreview2, preview.index, {
3566
- type: preview.componentType,
3567
- props: preview.props
3568
- });
3569
- }
3570
- }
3571
- return contentWithPreview2;
3572
- }, [preview, content]);
3573
- const isDropEnabled = isEnabled && (previewInZone ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
3776
+ isEnabled = acceptsTarget(draggedComponentType);
3777
+ }
3778
+ const contentWithPreview = useContentWithPreview(content, zoneCompound);
3779
+ const isDropEnabled = isEnabled && (preview ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
3574
3780
  const droppableConfig = {
3575
3781
  id: zoneCompound,
3576
3782
  collisionPriority: isEnabled ? depth : 0,
@@ -3580,45 +3786,20 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3580
3786
  data: {
3581
3787
  areaId,
3582
3788
  depth,
3583
- isDroppableTarget: acceptsTarget(draggedItem),
3789
+ isDroppableTarget: acceptsTarget(draggedComponentType),
3584
3790
  path
3585
3791
  }
3586
3792
  };
3587
3793
  const { ref: dropRef } = useDroppableSafe(droppableConfig);
3588
3794
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
3589
3795
  const isAreaSelected = selectedItem && areaId === selectedItem.props.id;
3590
- const [dragAxis, setDragAxis] = (0, import_react24.useState)(
3591
- collisionAxis || DEFAULT_DRAG_AXIS
3592
- );
3593
- const calculateDragAxis = (0, import_react24.useCallback)(() => {
3594
- if (ref.current) {
3595
- const computedStyle = window.getComputedStyle(ref.current);
3596
- if (computedStyle.display === "grid") {
3597
- setDragAxis(GRID_DRAG_AXIS);
3598
- } else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
3599
- setDragAxis(FLEX_ROW_DRAG_AXIS);
3600
- } else {
3601
- setDragAxis(DEFAULT_DRAG_AXIS);
3602
- }
3603
- }
3604
- }, [ref.current]);
3605
- (0, import_react24.useEffect)(calculateDragAxis, [appContext2.status, collisionAxis]);
3606
- (0, import_react24.useEffect)(() => {
3607
- const onViewportChange = () => {
3608
- calculateDragAxis();
3609
- };
3610
- window.addEventListener("viewportchange", onViewportChange);
3611
- return () => {
3612
- window.removeEventListener("viewportchange", onViewportChange);
3613
- };
3614
- }, []);
3796
+ const [dragAxis] = useDragAxis(ref, collisionAxis);
3615
3797
  const [minEmptyHeight, isAnimating] = useMinEmptyHeight({
3616
- draggedItem,
3617
3798
  zoneCompound,
3618
3799
  userMinEmptyHeight,
3619
3800
  ref
3620
3801
  });
3621
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3802
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3622
3803
  "div",
3623
3804
  {
3624
3805
  className: `${getClassName17({
@@ -3638,87 +3819,93 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3638
3819
  "data-puck-dropzone": zoneCompound,
3639
3820
  "data-puck-dnd": zoneCompound,
3640
3821
  style: __spreadProps(__spreadValues({}, style), {
3641
- "--min-empty-height": `${minEmptyHeight}px`
3822
+ "--min-empty-height": `${minEmptyHeight}px`,
3823
+ backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
3642
3824
  }),
3643
- children: [
3644
- isRootZone && DEBUG3 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { "data-puck-component": true, children: [
3645
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: deepestZone || rootDroppableId }),
3646
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: deepestArea || "No area" })
3647
- ] }),
3648
- contentWithPreview.map((item, i) => {
3649
- var _a, _b, _c, _d, _e;
3650
- const componentId = item.props.id;
3651
- const puckProps = {
3652
- renderDropZone: DropZone,
3653
- isEditing: true,
3654
- dragRef: null
3825
+ children: contentWithPreview.map((item, i) => {
3826
+ var _a, _b, _c, _d, _e, _f, _g;
3827
+ const componentId = item.props.id;
3828
+ const puckProps = {
3829
+ renderDropZone: DropZoneEditPure,
3830
+ isEditing: true,
3831
+ dragRef: null
3832
+ };
3833
+ const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
3834
+ puck: puckProps,
3835
+ editMode: true
3836
+ // DEPRECATED
3837
+ });
3838
+ const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
3839
+ let Render2 = config.components[item.type] && item.type !== "preview" ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
3840
+ "No configuration for ",
3841
+ item.type
3842
+ ] });
3843
+ const componentConfig = config.components[item.type];
3844
+ let componentType = item.type;
3845
+ let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
3846
+ if (item.type === "preview") {
3847
+ let Preview4 = function() {
3848
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
3655
3849
  };
3656
- const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
3657
- puck: puckProps,
3658
- editMode: true
3659
- // DEPRECATED
3660
- });
3661
- const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
3662
- let Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
3663
- "No configuration for ",
3664
- item.type
3665
- ] });
3666
- const componentConfig = config.components[item.type];
3667
- let componentType = item.type;
3668
- let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
3669
- if (item.type === "preview") {
3670
- let Preview3 = function() {
3671
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DrawerItemInner, { name: label });
3672
- };
3673
- var Preview2 = Preview3;
3674
- componentType = preview.componentType;
3675
- label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
3676
- Render2 = Preview3;
3677
- }
3678
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3679
- DropZoneProvider,
3680
- {
3681
- value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
3682
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3683
- DraggableComponent,
3684
- {
3685
- id: componentId,
3686
- componentType,
3687
- zoneCompound,
3688
- depth: depth + 1,
3689
- index: i,
3690
- isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
3691
- isSelected,
3692
- label,
3693
- isEnabled,
3694
- autoDragAxis: dragAxis,
3695
- userDragAxis: collisionAxis,
3696
- inDroppableZone: acceptsTarget(draggedItem),
3697
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3698
- Render2,
3699
- __spreadProps(__spreadValues({}, defaultedProps), {
3700
- puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
3701
- dragRef
3702
- })
3850
+ var Preview3 = Preview4;
3851
+ componentType = (_c = preview == null ? void 0 : preview.componentType) != null ? _c : "__preview";
3852
+ label = (_f = (_e = (_d = config.components[componentType]) == null ? void 0 : _d.label) != null ? _e : componentType) != null ? _f : "Preview";
3853
+ Render2 = Preview4;
3854
+ }
3855
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3856
+ DropZoneProvider,
3857
+ {
3858
+ value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
3859
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3860
+ DraggableComponent,
3861
+ {
3862
+ id: componentId,
3863
+ componentType,
3864
+ zoneCompound,
3865
+ depth: depth + 1,
3866
+ index: i,
3867
+ isLoading: ((_g = appContext2.componentState[componentId]) == null ? void 0 : _g.loadingCount) > 0,
3868
+ isSelected,
3869
+ label,
3870
+ isEnabled,
3871
+ autoDragAxis: dragAxis,
3872
+ userDragAxis: collisionAxis,
3873
+ inDroppableZone: acceptsTarget(draggedComponentType),
3874
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3875
+ Render2,
3876
+ __spreadProps(__spreadValues({}, defaultedProps), {
3877
+ puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
3878
+ dragRef
3703
3879
  })
3704
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadValues({}, defaultedProps)) })
3705
- }
3706
- )
3707
- },
3708
- componentId
3709
- );
3710
- })
3711
- ]
3880
+ })
3881
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Render2, __spreadValues({}, defaultedProps)) })
3882
+ }
3883
+ )
3884
+ },
3885
+ componentId
3886
+ );
3887
+ })
3712
3888
  }
3713
3889
  );
3714
3890
  }
3715
3891
  );
3716
- var DropZoneRender = (0, import_react24.forwardRef)(
3717
- function DropZoneRender2({ className, style, zone }, ref) {
3718
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3892
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadValues({}, props));
3893
+ var DropZoneRender = (0, import_react29.forwardRef)(
3894
+ function DropZoneRenderInternal({ className, style, zone }, ref) {
3895
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3719
3896
  const { data, areaId = "root", config } = ctx || {};
3720
3897
  let zoneCompound = rootDroppableId;
3721
3898
  let content = (data == null ? void 0 : data.content) || [];
3899
+ (0, import_react29.useEffect)(() => {
3900
+ if (ctx == null ? void 0 : ctx.registerZone) {
3901
+ ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3902
+ }
3903
+ return () => {
3904
+ if (ctx == null ? void 0 : ctx.unregisterZone) {
3905
+ ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
3906
+ }
3907
+ };
3908
+ }, []);
3722
3909
  if (!data || !config) {
3723
3910
  return null;
3724
3911
  }
@@ -3726,10 +3913,10 @@ var DropZoneRender = (0, import_react24.forwardRef)(
3726
3913
  zoneCompound = `${areaId}:${zone}`;
3727
3914
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3728
3915
  }
3729
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
3916
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
3730
3917
  const Component = config.components[item.type];
3731
3918
  if (Component) {
3732
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3919
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3733
3920
  DropZoneProvider,
3734
3921
  {
3735
3922
  value: {
@@ -3739,10 +3926,12 @@ var DropZoneRender = (0, import_react24.forwardRef)(
3739
3926
  depth: 1,
3740
3927
  path: []
3741
3928
  },
3742
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3929
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3743
3930
  Component.render,
3744
3931
  __spreadProps(__spreadValues({}, item.props), {
3745
- puck: { renderDropZone: DropZoneRender2 }
3932
+ puck: {
3933
+ renderDropZone: DropZoneRenderPure
3934
+ }
3746
3935
  })
3747
3936
  )
3748
3937
  },
@@ -3753,13 +3942,13 @@ var DropZoneRender = (0, import_react24.forwardRef)(
3753
3942
  }) });
3754
3943
  }
3755
3944
  );
3756
- var DropZone = (0, import_react24.forwardRef)(
3945
+ var DropZone = (0, import_react29.forwardRef)(
3757
3946
  function DropZone2(props, ref) {
3758
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3947
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3759
3948
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
3760
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3949
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3761
3950
  }
3762
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3951
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3763
3952
  }
3764
3953
  );
3765
3954
 
@@ -3775,7 +3964,7 @@ var getZoneId = (zoneCompound) => {
3775
3964
  return [rootDroppableId, zoneCompound];
3776
3965
  };
3777
3966
 
3778
- // components/DragDropContext/NestedDroppablePlugin.ts
3967
+ // lib/dnd/NestedDroppablePlugin.ts
3779
3968
  init_react_import();
3780
3969
  var import_abstract9 = require("@dnd-kit/abstract");
3781
3970
  var import_state = require("@dnd-kit/state");
@@ -3817,7 +4006,49 @@ var getFrame = () => {
3817
4006
  return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
3818
4007
  };
3819
4008
 
3820
- // components/DragDropContext/NestedDroppablePlugin.ts
4009
+ // lib/global-position.ts
4010
+ init_react_import();
4011
+ var GlobalPosition = class {
4012
+ constructor(target, original) {
4013
+ this.scaleFactor = 1;
4014
+ this.frameEl = null;
4015
+ this.frameRect = null;
4016
+ var _a;
4017
+ this.target = target;
4018
+ this.original = original;
4019
+ this.frameEl = document.querySelector("iframe");
4020
+ if (this.frameEl) {
4021
+ this.frameRect = this.frameEl.getBoundingClientRect();
4022
+ this.scaleFactor = this.frameRect.width / (((_a = this.frameEl.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
4023
+ }
4024
+ }
4025
+ get x() {
4026
+ return this.original.x;
4027
+ }
4028
+ get y() {
4029
+ return this.original.y;
4030
+ }
4031
+ get global() {
4032
+ if (document !== this.target.ownerDocument && this.frameRect) {
4033
+ return {
4034
+ x: this.x * this.scaleFactor + this.frameRect.left,
4035
+ y: this.y * this.scaleFactor + this.frameRect.top
4036
+ };
4037
+ }
4038
+ return this.original;
4039
+ }
4040
+ get frame() {
4041
+ if (document === this.target.ownerDocument && this.frameRect) {
4042
+ return {
4043
+ x: (this.x - this.frameRect.left) / this.scaleFactor,
4044
+ y: (this.y - this.frameRect.top) / this.scaleFactor
4045
+ };
4046
+ }
4047
+ return this.original;
4048
+ }
4049
+ };
4050
+
4051
+ // lib/dnd/NestedDroppablePlugin.ts
3821
4052
  var depthSort = (candidates) => {
3822
4053
  return candidates.sort((a, b) => {
3823
4054
  const aData = a.data;
@@ -3846,10 +4077,12 @@ var getZoneId2 = (candidate) => {
3846
4077
  }
3847
4078
  return id;
3848
4079
  };
3849
- var getPointerCollisions = (position, manager, ownerDocument) => {
3850
- var _a;
4080
+ var getPointerCollisions = (position, manager) => {
3851
4081
  const candidates = [];
3852
- let elements = ownerDocument.elementsFromPoint(position.x, position.y);
4082
+ let elements = position.target.ownerDocument.elementsFromPoint(
4083
+ position.x,
4084
+ position.y
4085
+ );
3853
4086
  const previewFrame = elements.find(
3854
4087
  (el) => el.getAttribute("data-puck-preview")
3855
4088
  );
@@ -3858,17 +4091,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
3858
4091
  elements = [drawer];
3859
4092
  }
3860
4093
  if (previewFrame) {
3861
- const iframe = previewFrame.querySelector("iframe");
3862
- if (iframe) {
3863
- const rect = iframe.getBoundingClientRect();
3864
- const frame = getFrame();
3865
- if (frame) {
3866
- const scaleFactor = rect.width / (((_a = iframe.contentWindow) == null ? void 0 : _a.innerWidth) || 1);
3867
- elements = frame.elementsFromPoint(
3868
- (position.x - rect.left) / scaleFactor,
3869
- (position.y - rect.top) / scaleFactor
3870
- );
3871
- }
4094
+ const frame = getFrame();
4095
+ if (frame) {
4096
+ elements = frame.elementsFromPoint(position.frame.x, position.frame.y);
3872
4097
  }
3873
4098
  }
3874
4099
  if (elements) {
@@ -3885,9 +4110,9 @@ var getPointerCollisions = (position, manager, ownerDocument) => {
3885
4110
  }
3886
4111
  return candidates;
3887
4112
  };
3888
- var findDeepestCandidate = (position, manager, ownerDocument) => {
4113
+ var findDeepestCandidate = (position, manager) => {
3889
4114
  var _a;
3890
- const candidates = getPointerCollisions(position, manager, ownerDocument);
4115
+ const candidates = getPointerCollisions(position, manager);
3891
4116
  if (candidates.length > 0) {
3892
4117
  const sortedCandidates = depthSort(candidates);
3893
4118
  const draggable = manager.dragOperation.source;
@@ -3932,9 +4157,7 @@ var findDeepestCandidate = (position, manager, ownerDocument) => {
3932
4157
  area: null
3933
4158
  };
3934
4159
  };
3935
- var createNestedDroppablePlugin = ({
3936
- onChange
3937
- }) => class NestedDroppablePlugin extends import_abstract9.Plugin {
4160
+ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract9.Plugin {
3938
4161
  constructor(manager, options) {
3939
4162
  super(manager);
3940
4163
  if (typeof window === "undefined") {
@@ -3942,16 +4165,19 @@ var createNestedDroppablePlugin = ({
3942
4165
  }
3943
4166
  const cleanupEffect = (0, import_state.effects)(() => {
3944
4167
  const handleMove = (event) => {
3945
- const position = {
4168
+ const target = event.originalTarget || event.target;
4169
+ const position = new GlobalPosition(target, {
3946
4170
  x: event.clientX,
3947
4171
  y: event.clientY
3948
- };
3949
- const target = event.originalTarget || event.target;
3950
- const ownerDocument = target == null ? void 0 : target.ownerDocument;
3951
- onChange(
3952
- findDeepestCandidate(position, manager, ownerDocument),
3953
- manager
4172
+ });
4173
+ const elements = document.elementsFromPoint(
4174
+ position.global.x,
4175
+ position.global.y
3954
4176
  );
4177
+ const overEl = elements.some((el) => el.id === id);
4178
+ if (overEl) {
4179
+ onChange(findDeepestCandidate(position, manager), manager);
4180
+ }
3955
4181
  };
3956
4182
  const handleMoveThrottled = throttle(handleMove, 50);
3957
4183
  const handlePointerMove = (event) => {
@@ -4281,6 +4507,11 @@ var reduceUi = (ui, action) => {
4281
4507
  itemSelector: { index: action.sourceIndex + 1, zone: action.sourceZone }
4282
4508
  });
4283
4509
  }
4510
+ if (action.type === "remove") {
4511
+ return __spreadProps(__spreadValues({}, ui), {
4512
+ itemSelector: null
4513
+ });
4514
+ }
4284
4515
  return ui;
4285
4516
  };
4286
4517
 
@@ -4368,7 +4599,7 @@ var insertComponent = (componentType, zone, index, {
4368
4599
  var import_use_debounce2 = require("use-debounce");
4369
4600
  var import_utilities2 = require("@dnd-kit/dom/utilities");
4370
4601
 
4371
- // components/DragDropContext/PointerSensor.ts
4602
+ // lib/dnd/PointerSensor.ts
4372
4603
  init_react_import();
4373
4604
  var import_state3 = require("@dnd-kit/state");
4374
4605
  var import_abstract10 = require("@dnd-kit/abstract");
@@ -4531,6 +4762,9 @@ var _PointerSensor = class _PointerSensor extends import_abstract10.Sensor {
4531
4762
  }
4532
4763
  }
4533
4764
  handlePointerUp(event) {
4765
+ if (!this.source) {
4766
+ return;
4767
+ }
4534
4768
  event.preventDefault();
4535
4769
  event.stopPropagation();
4536
4770
  const { status } = this.manager.dragOperation;
@@ -4630,13 +4864,15 @@ function patchWindow(window2) {
4630
4864
  }
4631
4865
 
4632
4866
  // components/DragDropContext/index.tsx
4633
- var import_jsx_runtime22 = require("react/jsx-runtime");
4634
- var dragListenerContext = (0, import_react26.createContext)({
4867
+ var import_zustand3 = require("zustand");
4868
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4869
+ var DEBUG3 = false;
4870
+ var dragListenerContext = (0, import_react31.createContext)({
4635
4871
  dragListeners: {}
4636
4872
  });
4637
4873
  function useDragListener(type, fn, deps = []) {
4638
- const { setDragListeners } = (0, import_react26.useContext)(dragListenerContext);
4639
- (0, import_react26.useEffect)(() => {
4874
+ const { setDragListeners } = (0, import_react31.useContext)(dragListenerContext);
4875
+ (0, import_react31.useEffect)(() => {
4640
4876
  if (setDragListeners) {
4641
4877
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4642
4878
  [type]: [...old[type] || [], fn]
@@ -4644,80 +4880,147 @@ function useDragListener(type, fn, deps = []) {
4644
4880
  }
4645
4881
  }, deps);
4646
4882
  }
4647
- var previewContext = (0, import_react26.createContext)(null);
4648
4883
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4884
+ var useTempDisableFallback = (timeout3) => {
4885
+ const lastFallbackDisable = (0, import_react31.useRef)(null);
4886
+ return (0, import_react31.useCallback)((manager) => {
4887
+ collisionStore.setState({ fallbackEnabled: false });
4888
+ const fallbackId = generateId();
4889
+ lastFallbackDisable.current = fallbackId;
4890
+ setTimeout(() => {
4891
+ if (lastFallbackDisable.current === fallbackId) {
4892
+ collisionStore.setState({ fallbackEnabled: true });
4893
+ manager.collisionObserver.forceUpdate(true);
4894
+ }
4895
+ }, timeout3);
4896
+ }, []);
4897
+ };
4649
4898
  var DragDropContextClient = ({
4650
4899
  children,
4651
4900
  disableAutoScroll
4652
4901
  }) => {
4653
4902
  const { state, config, dispatch, resolveData } = useAppContext();
4654
- const [preview, setPreview] = (0, import_react26.useState)(null);
4655
- const previewRef = (0, import_react26.useRef)(null);
4903
+ const id = (0, import_react31.useId)();
4656
4904
  const { data } = state;
4657
- const [deepest, setDeepest] = (0, import_react26.useState)(null);
4658
- const [nextDeepest, setNextDeepest] = (0, import_react26.useState)(null);
4659
- const deepestRef = (0, import_react26.useRef)(deepest);
4660
- const debouncedParamsRef = (0, import_react26.useRef)(null);
4661
- const setDeepestAndCollide = (0, import_react26.useCallback)(
4905
+ const debouncedParamsRef = (0, import_react31.useRef)(null);
4906
+ const tempDisableFallback = useTempDisableFallback(100);
4907
+ const [zoneStore] = (0, import_react31.useState)(
4908
+ () => (0, import_zustand3.createStore)(() => ({
4909
+ zoneDepthIndex: {},
4910
+ nextZoneDepthIndex: {},
4911
+ areaDepthIndex: {},
4912
+ nextAreaDepthIndex: {},
4913
+ draggedItem: null,
4914
+ previewIndex: {}
4915
+ }))
4916
+ );
4917
+ const getChanged2 = (0, import_react31.useCallback)(
4918
+ (params, id2) => {
4919
+ const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4920
+ const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
4921
+ const stateHasArea = Object.keys(areaDepthIndex).length > 0;
4922
+ let zoneChanged = false;
4923
+ let areaChanged = false;
4924
+ if (params.zone && !zoneDepthIndex[params.zone]) {
4925
+ zoneChanged = true;
4926
+ } else if (!params.zone && stateHasZone) {
4927
+ zoneChanged = true;
4928
+ }
4929
+ if (params.area && !areaDepthIndex[params.area]) {
4930
+ areaChanged = true;
4931
+ } else if (!params.area && stateHasArea) {
4932
+ areaChanged = true;
4933
+ }
4934
+ return { zoneChanged, areaChanged };
4935
+ },
4936
+ [zoneStore]
4937
+ );
4938
+ const setDeepestAndCollide = (0, import_react31.useCallback)(
4662
4939
  (params, manager) => {
4663
- setDeepest(params);
4940
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4941
+ if (!zoneChanged && !areaChanged) return;
4942
+ zoneStore.setState({
4943
+ zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
4944
+ areaDepthIndex: params.area ? { [params.area]: true } : {}
4945
+ });
4946
+ tempDisableFallback(manager);
4664
4947
  setTimeout(() => {
4665
4948
  manager.collisionObserver.forceUpdate(true);
4666
4949
  }, 50);
4667
4950
  debouncedParamsRef.current = null;
4668
4951
  },
4669
- []
4952
+ [zoneStore]
4670
4953
  );
4671
4954
  const setDeepestDb = (0, import_use_debounce2.useDebouncedCallback)(
4672
4955
  setDeepestAndCollide,
4673
4956
  AREA_CHANGE_DEBOUNCE_MS
4674
4957
  );
4675
- (0, import_react26.useEffect)(() => {
4676
- deepestRef.current = deepest;
4677
- }, [deepest]);
4678
4958
  const cancelDb = () => {
4679
4959
  setDeepestDb.cancel();
4680
4960
  debouncedParamsRef.current = null;
4681
4961
  };
4682
- const [plugins] = (0, import_react26.useState)(() => [
4683
- ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
4684
- createNestedDroppablePlugin({
4685
- onChange: (params, manager) => {
4686
- const lastParams = deepestRef.current;
4687
- const areaChanged = params.area !== (lastParams == null ? void 0 : lastParams.area);
4688
- const zoneChanged = params.zone !== (lastParams == null ? void 0 : lastParams.zone);
4689
- const isDragging = manager.dragOperation.status.dragging;
4690
- if (areaChanged || zoneChanged) {
4691
- setNextDeepest(params);
4692
- }
4693
- if (params.zone !== "void" && (lastParams == null ? void 0 : lastParams.zone) === "void") {
4694
- setDeepest(params);
4695
- manager.collisionObserver.forceUpdate(true);
4696
- return;
4962
+ (0, import_react31.useEffect)(() => {
4963
+ if (DEBUG3) {
4964
+ zoneStore.subscribe(
4965
+ (s) => {
4966
+ var _a, _b;
4967
+ return console.log(
4968
+ s.previewIndex,
4969
+ (_a = Object.entries(s.zoneDepthIndex || {})[0]) == null ? void 0 : _a[0],
4970
+ (_b = Object.entries(s.areaDepthIndex || {})[0]) == null ? void 0 : _b[0]
4971
+ );
4697
4972
  }
4698
- if (areaChanged) {
4699
- if (isDragging) {
4700
- const debouncedParams = debouncedParamsRef.current;
4701
- const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
4702
- if (!isSameParams) {
4973
+ );
4974
+ }
4975
+ }, []);
4976
+ const [plugins] = (0, import_react31.useState)(() => [
4977
+ ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
4978
+ createNestedDroppablePlugin(
4979
+ {
4980
+ onChange: (params, manager) => {
4981
+ const state2 = zoneStore.getState();
4982
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4983
+ const isDragging = manager.dragOperation.status.dragging;
4984
+ if (areaChanged || zoneChanged) {
4985
+ let nextZoneDepthIndex = {};
4986
+ let nextAreaDepthIndex = {};
4987
+ if (params.zone) {
4988
+ nextZoneDepthIndex = { [params.zone]: true };
4989
+ }
4990
+ if (params.area) {
4991
+ nextAreaDepthIndex = { [params.area]: true };
4992
+ }
4993
+ zoneStore.setState({ nextZoneDepthIndex, nextAreaDepthIndex });
4994
+ }
4995
+ if (params.zone !== "void" && (state2 == null ? void 0 : state2.zoneDepthIndex["void"])) {
4996
+ setDeepestAndCollide(params, manager);
4997
+ return;
4998
+ }
4999
+ if (areaChanged) {
5000
+ if (isDragging) {
5001
+ const debouncedParams = debouncedParamsRef.current;
5002
+ const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
5003
+ if (!isSameParams) {
5004
+ cancelDb();
5005
+ setDeepestDb(params, manager);
5006
+ debouncedParamsRef.current = params;
5007
+ }
5008
+ } else {
4703
5009
  cancelDb();
4704
- setDeepestDb(params, manager);
4705
- debouncedParamsRef.current = params;
5010
+ setDeepestAndCollide(params, manager);
4706
5011
  }
4707
- } else {
4708
- cancelDb();
5012
+ return;
5013
+ }
5014
+ if (zoneChanged) {
4709
5015
  setDeepestAndCollide(params, manager);
4710
5016
  }
4711
- return;
4712
- }
4713
- if (zoneChanged) {
4714
- setDeepestAndCollide(params, manager);
5017
+ cancelDb();
4715
5018
  }
4716
- cancelDb();
4717
- }
4718
- })
5019
+ },
5020
+ id
5021
+ )
4719
5022
  ]);
4720
- const [sensors] = (0, import_react26.useState)(() => [
5023
+ const [sensors] = (0, import_react31.useState)(() => [
4721
5024
  PointerSensor.configure({
4722
5025
  activationConstraints(event, source) {
4723
5026
  var _a;
@@ -4736,11 +5039,10 @@ var DragDropContextClient = ({
4736
5039
  }
4737
5040
  })
4738
5041
  ]);
4739
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
4740
- const [dragListeners, setDragListeners] = (0, import_react26.useState)({});
4741
- const [pathData, setPathData] = (0, import_react26.useState)();
4742
- const dragMode = (0, import_react26.useRef)(null);
4743
- const registerPath = (0, import_react26.useCallback)(
5042
+ const [dragListeners, setDragListeners] = (0, import_react31.useState)({});
5043
+ const [pathData, setPathData] = (0, import_react31.useState)();
5044
+ const dragMode = (0, import_react31.useRef)(null);
5045
+ const registerPath = (0, import_react31.useCallback)(
4744
5046
  (selector) => {
4745
5047
  const item = getItem(selector, data);
4746
5048
  if (!item) {
@@ -4762,41 +5064,41 @@ var DragDropContextClient = ({
4762
5064
  },
4763
5065
  [data, setPathData]
4764
5066
  );
4765
- const initialSelector = (0, import_react26.useRef)(void 0);
4766
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5067
+ const initialSelector = (0, import_react31.useRef)(void 0);
5068
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4767
5069
  dragListenerContext.Provider,
4768
5070
  {
4769
5071
  value: {
4770
5072
  dragListeners,
4771
5073
  setDragListeners
4772
5074
  },
4773
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(previewContext.Provider, { value: preview, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4774
- import_react25.DragDropProvider,
5075
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5076
+ import_react30.DragDropProvider,
4775
5077
  {
4776
5078
  plugins,
4777
5079
  sensors,
4778
5080
  onDragEnd: (event, manager) => {
5081
+ var _a;
4779
5082
  const { source, target } = event.operation;
4780
- deepestRef.current = null;
4781
5083
  if (!source) {
4782
- setDraggedItem(null);
5084
+ zoneStore.setState({ draggedItem: null });
4783
5085
  return;
4784
5086
  }
4785
5087
  const { zone, index } = source.data;
4786
- const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
4787
- previewRef.current = null;
5088
+ const { previewIndex = {} } = zoneStore.getState() || {};
5089
+ const thisPreview = ((_a = previewIndex[zone]) == null ? void 0 : _a.props.id) === source.id ? previewIndex[zone] : null;
4788
5090
  setTimeout(() => {
4789
- var _a, _b;
4790
- setDraggedItem(null);
5091
+ var _a2, _b;
5092
+ zoneStore.setState({ draggedItem: null });
4791
5093
  if (event.canceled || (target == null ? void 0 : target.type) === "void") {
4792
- setPreview(null);
4793
- (_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
5094
+ zoneStore.setState({ previewIndex: {} });
5095
+ (_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
4794
5096
  fn(event, manager);
4795
5097
  });
4796
5098
  return;
4797
5099
  }
4798
5100
  if (thisPreview) {
4799
- setPreview(null);
5101
+ zoneStore.setState({ previewIndex: {} });
4800
5102
  if (thisPreview.type === "insert") {
4801
5103
  insertComponent(
4802
5104
  thisPreview.componentType,
@@ -4831,8 +5133,9 @@ var DragDropContextClient = ({
4831
5133
  }, 250);
4832
5134
  },
4833
5135
  onDragOver: (event, manager) => {
4834
- var _a, _b, _c, _d;
5136
+ var _a, _b, _c, _d, _e;
4835
5137
  event.preventDefault();
5138
+ const draggedItem = (_a = zoneStore.getState()) == null ? void 0 : _a.draggedItem;
4836
5139
  if (!draggedItem) return;
4837
5140
  cancelDb();
4838
5141
  const { source, target } = event.operation;
@@ -4848,7 +5151,7 @@ var DragDropContextClient = ({
4848
5151
  const targetData = target.data;
4849
5152
  targetZone = targetData.zone;
4850
5153
  targetIndex = targetData.index;
4851
- const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[targetId];
5154
+ const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
4852
5155
  const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
4853
5156
  if (targetIndex >= sourceIndex && sourceZone === targetZone) {
4854
5157
  targetIndex = targetIndex - 1;
@@ -4860,23 +5163,26 @@ var DragDropContextClient = ({
4860
5163
  targetZone = target.id.toString();
4861
5164
  targetIndex = 0;
4862
5165
  }
4863
- if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
5166
+ if (targetId === sourceId || ((_d = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _d.path.find((path) => {
4864
5167
  const [pathId] = path.split(":");
4865
5168
  return pathId === sourceId;
4866
5169
  }))) {
4867
5170
  return;
4868
5171
  }
4869
5172
  if (dragMode.current === "new") {
4870
- previewRef.current = {
4871
- componentType: sourceData.componentType,
4872
- type: "insert",
4873
- index: targetIndex,
4874
- zone: targetZone,
4875
- props: {
4876
- id: source.id.toString()
5173
+ zoneStore.setState({
5174
+ previewIndex: {
5175
+ [targetZone]: {
5176
+ componentType: sourceData.componentType,
5177
+ type: "insert",
5178
+ index: targetIndex,
5179
+ zone: targetZone,
5180
+ props: {
5181
+ id: source.id.toString()
5182
+ }
5183
+ }
4877
5184
  }
4878
- };
4879
- setPreview(previewRef.current);
5185
+ });
4880
5186
  } else {
4881
5187
  if (!initialSelector.current) {
4882
5188
  initialSelector.current = {
@@ -4886,17 +5192,20 @@ var DragDropContextClient = ({
4886
5192
  }
4887
5193
  const item = getItem(initialSelector.current, data);
4888
5194
  if (item) {
4889
- previewRef.current = {
4890
- componentType: sourceData.componentType,
4891
- type: "move",
4892
- index: targetIndex,
4893
- zone: targetZone,
4894
- props: item.props
4895
- };
4896
- setPreview(previewRef.current);
5195
+ zoneStore.setState({
5196
+ previewIndex: {
5197
+ [targetZone]: {
5198
+ componentType: sourceData.componentType,
5199
+ type: "move",
5200
+ index: targetIndex,
5201
+ zone: targetZone,
5202
+ props: item.props
5203
+ }
5204
+ }
5205
+ });
4897
5206
  }
4898
5207
  }
4899
- (_d = dragListeners.dragover) == null ? void 0 : _d.forEach((fn) => {
5208
+ (_e = dragListeners.dragover) == null ? void 0 : _e.forEach((fn) => {
4900
5209
  fn(event, manager);
4901
5210
  });
4902
5211
  },
@@ -4906,46 +5215,61 @@ var DragDropContextClient = ({
4906
5215
  type: "setUi",
4907
5216
  ui: { itemSelector: null, isDragging: true }
4908
5217
  });
5218
+ const { source } = event.operation;
5219
+ if (source && source.type !== "void") {
5220
+ const sourceData = source.data;
5221
+ const item = getItem(
5222
+ {
5223
+ zone: sourceData.zone,
5224
+ index: sourceData.index
5225
+ },
5226
+ data
5227
+ );
5228
+ if (item) {
5229
+ zoneStore.setState({
5230
+ previewIndex: {
5231
+ [sourceData.zone]: {
5232
+ componentType: sourceData.componentType,
5233
+ type: "move",
5234
+ index: sourceData.index,
5235
+ zone: sourceData.zone,
5236
+ props: item.props
5237
+ }
5238
+ }
5239
+ });
5240
+ }
5241
+ }
4909
5242
  (_a = dragListeners.dragstart) == null ? void 0 : _a.forEach((fn) => {
4910
5243
  fn(event, manager);
4911
5244
  });
4912
5245
  },
4913
5246
  onBeforeDragStart: (event) => {
4914
5247
  var _a;
4915
- if (draggedItem) {
4916
- console.warn("New drag started before previous drag cleaned up");
4917
- }
4918
5248
  const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.data.type) === "drawer";
4919
5249
  dragMode.current = isNewComponent ? "new" : "existing";
4920
5250
  initialSelector.current = void 0;
4921
- setDraggedItem(event.operation.source);
5251
+ zoneStore.setState({ draggedItem: event.operation.source });
4922
5252
  },
4923
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5253
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4924
5254
  DropZoneProvider,
4925
5255
  {
4926
5256
  value: {
4927
5257
  data,
4928
5258
  config,
4929
- dispatch,
4930
- draggedItem,
4931
5259
  mode: "edit",
4932
5260
  areaId: "root",
4933
5261
  depth: 0,
4934
5262
  registerPath,
4935
5263
  pathData,
4936
- deepestZone: deepest == null ? void 0 : deepest.zone,
4937
- deepestArea: deepest == null ? void 0 : deepest.area,
4938
- nextDeepestZone: nextDeepest == null ? void 0 : nextDeepest.zone,
4939
- nextDeepestArea: nextDeepest == null ? void 0 : nextDeepest.area,
4940
5264
  path: []
4941
5265
  },
4942
5266
  children
4943
5267
  }
4944
- )
5268
+ ) })
4945
5269
  }
4946
- ) })
5270
+ )
4947
5271
  }
4948
- );
5272
+ ) });
4949
5273
  };
4950
5274
  var DragDropContext = ({
4951
5275
  children,
@@ -4955,11 +5279,11 @@ var DragDropContext = ({
4955
5279
  if (status === "LOADING") {
4956
5280
  return children;
4957
5281
  }
4958
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DragDropContextClient, { disableAutoScroll, children });
5282
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DragDropContextClient, { disableAutoScroll, children });
4959
5283
  };
4960
5284
 
4961
5285
  // components/Drawer/index.tsx
4962
- var import_jsx_runtime23 = require("react/jsx-runtime");
5286
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4963
5287
  var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
4964
5288
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
4965
5289
  var DrawerItemInner = ({
@@ -4969,11 +5293,11 @@ var DrawerItemInner = ({
4969
5293
  dragRef,
4970
5294
  isDragDisabled
4971
5295
  }) => {
4972
- const CustomInner = (0, import_react27.useMemo)(
4973
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
5296
+ const CustomInner = (0, import_react32.useMemo)(
5297
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
4974
5298
  [children]
4975
5299
  );
4976
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5300
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4977
5301
  "div",
4978
5302
  {
4979
5303
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -4981,9 +5305,9 @@ var DrawerItemInner = ({
4981
5305
  onMouseDown: (e) => e.preventDefault(),
4982
5306
  "data-testid": dragRef ? `drawer-item:${name}` : "",
4983
5307
  "data-puck-drawer-item": true,
4984
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
4985
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
4986
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DragIcon, {}) })
5308
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
5309
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
5310
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragIcon, {}) })
4987
5311
  ] }) }) })
4988
5312
  }
4989
5313
  );
@@ -5000,9 +5324,9 @@ var DrawerItemDraggable = ({
5000
5324
  data: { type: "drawer", componentType: name },
5001
5325
  disabled: isDragDisabled
5002
5326
  });
5003
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName18("draggable"), children: [
5004
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DrawerItemInner, { name, label, children }) }),
5005
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5327
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("draggable"), children: [
5328
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DrawerItemInner, { name, label, children }) }),
5329
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5006
5330
  DrawerItemInner,
5007
5331
  {
5008
5332
  name,
@@ -5023,7 +5347,7 @@ var DrawerItem = ({
5023
5347
  isDragDisabled
5024
5348
  }) => {
5025
5349
  const resolvedId = id || name;
5026
- const [dynamicId, setDynamicId] = (0, import_react27.useState)(generateId(resolvedId));
5350
+ const [dynamicId, setDynamicId] = (0, import_react32.useState)(generateId(resolvedId));
5027
5351
  if (typeof index !== "undefined") {
5028
5352
  console.error(
5029
5353
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5036,7 +5360,7 @@ var DrawerItem = ({
5036
5360
  },
5037
5361
  [resolvedId]
5038
5362
  );
5039
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5363
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5040
5364
  DrawerItemDraggable,
5041
5365
  {
5042
5366
  name,
@@ -5062,14 +5386,14 @@ var Drawer = ({
5062
5386
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
5063
5387
  );
5064
5388
  }
5065
- const [id] = (0, import_react27.useState)(generateId());
5389
+ const id = (0, import_react32.useId)();
5066
5390
  const { ref } = useDroppableSafe({
5067
5391
  id,
5068
5392
  type: "void",
5069
5393
  collisionPriority: 0
5070
5394
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
5071
5395
  });
5072
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5396
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5073
5397
  "div",
5074
5398
  {
5075
5399
  className: getClassName18(),
@@ -5084,7 +5408,7 @@ Drawer.Item = DrawerItem;
5084
5408
 
5085
5409
  // components/Puck/index.tsx
5086
5410
  init_react_import();
5087
- var import_react42 = require("react");
5411
+ var import_react48 = require("react");
5088
5412
 
5089
5413
  // components/SidebarSection/index.tsx
5090
5414
  init_react_import();
@@ -5095,7 +5419,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
5095
5419
 
5096
5420
  // lib/use-breadcrumbs.ts
5097
5421
  init_react_import();
5098
- var import_react28 = require("react");
5422
+ var import_react33 = require("react");
5099
5423
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
5100
5424
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
5101
5425
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -5145,8 +5469,8 @@ var useBreadcrumbs = (renderCount) => {
5145
5469
  state: { data },
5146
5470
  selectedItem
5147
5471
  } = useAppContext();
5148
- const dzContext = (0, import_react28.useContext)(dropZoneContext);
5149
- return (0, import_react28.useMemo)(() => {
5472
+ const dzContext = (0, import_react33.useContext)(dropZoneContext);
5473
+ return (0, import_react33.useMemo)(() => {
5150
5474
  const breadcrumbs = convertPathDataToBreadcrumbs(
5151
5475
  selectedItem,
5152
5476
  dzContext == null ? void 0 : dzContext.pathData,
@@ -5160,7 +5484,7 @@ var useBreadcrumbs = (renderCount) => {
5160
5484
  };
5161
5485
 
5162
5486
  // components/SidebarSection/index.tsx
5163
- var import_jsx_runtime24 = require("react/jsx-runtime");
5487
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5164
5488
  var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
5165
5489
  var SidebarSection = ({
5166
5490
  children,
@@ -5173,15 +5497,15 @@ var SidebarSection = ({
5173
5497
  }) => {
5174
5498
  const { setUi } = useAppContext();
5175
5499
  const breadcrumbs = useBreadcrumbs(1);
5176
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5500
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5177
5501
  "div",
5178
5502
  {
5179
5503
  className: getClassName19({ noBorderTop, noPadding }),
5180
5504
  style: { background },
5181
5505
  children: [
5182
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
5183
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5184
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5506
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
5507
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5508
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5185
5509
  "button",
5186
5510
  {
5187
5511
  type: "button",
@@ -5190,12 +5514,12 @@ var SidebarSection = ({
5190
5514
  children: breadcrumb.label
5191
5515
  }
5192
5516
  ),
5193
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronRight, { size: 16 })
5517
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronRight, { size: 16 })
5194
5518
  ] }, i)) : null,
5195
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
5519
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
5196
5520
  ] }) }),
5197
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("content"), children }),
5198
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Loader, { size: 32 }) })
5521
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("content"), children }),
5522
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Loader, { size: 32 }) })
5199
5523
  ]
5200
5524
  }
5201
5525
  );
@@ -5226,7 +5550,7 @@ init_react_import();
5226
5550
  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" };
5227
5551
 
5228
5552
  // components/MenuBar/index.tsx
5229
- var import_jsx_runtime25 = require("react/jsx-runtime");
5553
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5230
5554
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
5231
5555
  function MenuBar({
5232
5556
  appState,
@@ -5240,7 +5564,7 @@ function MenuBar({
5240
5564
  history: { back, forward, historyStore }
5241
5565
  } = useAppContext();
5242
5566
  const { hasFuture = false, hasPast = false } = historyStore || {};
5243
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5567
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5244
5568
  "div",
5245
5569
  {
5246
5570
  className: getClassName20({ menuOpen }),
@@ -5254,12 +5578,12 @@ function MenuBar({
5254
5578
  setMenuOpen(false);
5255
5579
  }
5256
5580
  },
5257
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName20("inner"), children: [
5258
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName20("history"), children: [
5259
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Undo2, { size: 21 }) }),
5260
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Redo2, { size: 21 }) })
5581
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("inner"), children: [
5582
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("history"), children: [
5583
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Undo2, { size: 21 }) }),
5584
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Redo2, { size: 21 }) })
5261
5585
  ] }),
5262
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: renderHeaderActions && renderHeaderActions({
5586
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: renderHeaderActions && renderHeaderActions({
5263
5587
  state: appState,
5264
5588
  dispatch
5265
5589
  }) })
@@ -5270,7 +5594,7 @@ function MenuBar({
5270
5594
 
5271
5595
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
5272
5596
  init_react_import();
5273
- 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" };
5597
+ 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" };
5274
5598
 
5275
5599
  // components/Puck/components/Fields/index.tsx
5276
5600
  init_react_import();
@@ -5280,15 +5604,15 @@ init_react_import();
5280
5604
  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" };
5281
5605
 
5282
5606
  // components/Puck/components/Fields/index.tsx
5283
- var import_react30 = require("react");
5607
+ var import_react35 = require("react");
5284
5608
 
5285
5609
  // lib/use-parent.ts
5286
5610
  init_react_import();
5287
- var import_react29 = require("react");
5611
+ var import_react34 = require("react");
5288
5612
  var useParent = (itemSelector) => {
5289
5613
  var _a;
5290
5614
  const { selectedItem, state } = useAppContext();
5291
- const { pathData } = (0, import_react29.useContext)(dropZoneContext) || {};
5615
+ const { pathData } = (0, import_react34.useContext)(dropZoneContext) || {};
5292
5616
  const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
5293
5617
  const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
5294
5618
  const lastItem = breadcrumbs[breadcrumbs.length - 1];
@@ -5297,7 +5621,7 @@ var useParent = (itemSelector) => {
5297
5621
  };
5298
5622
 
5299
5623
  // components/Puck/components/Fields/index.tsx
5300
- var import_jsx_runtime26 = require("react/jsx-runtime");
5624
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5301
5625
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
5302
5626
  var defaultPageFields = {
5303
5627
  title: { type: "text" }
@@ -5305,7 +5629,7 @@ var defaultPageFields = {
5305
5629
  var DefaultFields = ({
5306
5630
  children
5307
5631
  }) => {
5308
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
5632
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
5309
5633
  };
5310
5634
  var useResolvedFields = () => {
5311
5635
  var _a, _b;
@@ -5314,20 +5638,20 @@ var useResolvedFields = () => {
5314
5638
  const { data } = state;
5315
5639
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
5316
5640
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
5317
- const defaultFields = (0, import_react30.useMemo)(
5641
+ const defaultFields = (0, import_react35.useMemo)(
5318
5642
  () => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
5319
5643
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5320
5644
  );
5321
5645
  const rootProps = data.root.props || data.root;
5322
- const [lastSelectedData, setLastSelectedData] = (0, import_react30.useState)({});
5323
- const [resolvedFields, setResolvedFields] = (0, import_react30.useState)(defaultFields);
5324
- const [fieldsLoading, setFieldsLoading] = (0, import_react30.useState)(false);
5646
+ const [lastSelectedData, setLastSelectedData] = (0, import_react35.useState)({});
5647
+ const [resolvedFields, setResolvedFields] = (0, import_react35.useState)(defaultFields);
5648
+ const [fieldsLoading, setFieldsLoading] = (0, import_react35.useState)(false);
5325
5649
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5326
5650
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5327
5651
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5328
5652
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5329
5653
  const hasResolver = hasComponentResolver || hasRootResolver;
5330
- const resolveFields = (0, import_react30.useCallback)(
5654
+ const resolveFields = (0, import_react35.useCallback)(
5331
5655
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
5332
5656
  var _a2;
5333
5657
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
@@ -5363,19 +5687,33 @@ var useResolvedFields = () => {
5363
5687
  lastData
5364
5688
  });
5365
5689
  }),
5366
- [data, config, componentData, selectedItem, resolvedFields, state]
5690
+ [data, config, componentData, selectedItem, resolvedFields, state, parent]
5367
5691
  );
5368
- (0, import_react30.useEffect)(() => {
5369
- if (hasResolver) {
5370
- setFieldsLoading(true);
5371
- resolveFields(defaultFields).then((fields) => {
5372
- setResolvedFields(fields || {});
5373
- setFieldsLoading(false);
5374
- });
5375
- } else {
5376
- setResolvedFields(defaultFields);
5692
+ const [hasParent, setHasParent] = (0, import_react35.useState)(false);
5693
+ (0, import_react35.useEffect)(() => {
5694
+ setHasParent(!!parent);
5695
+ }, [parent]);
5696
+ (0, import_react35.useEffect)(() => {
5697
+ var _a2, _b2;
5698
+ if (!((_a2 = state.ui.itemSelector) == null ? void 0 : _a2.zone) || ((_b2 = state.ui.itemSelector) == null ? void 0 : _b2.zone) === "default-zone" || hasParent) {
5699
+ if (hasResolver) {
5700
+ setFieldsLoading(true);
5701
+ resolveFields(defaultFields).then((fields) => {
5702
+ setResolvedFields(fields || {});
5703
+ setFieldsLoading(false);
5704
+ });
5705
+ } else {
5706
+ setResolvedFields(defaultFields);
5707
+ }
5377
5708
  }
5378
- }, [data, defaultFields, selectedItem, hasResolver]);
5709
+ }, [
5710
+ data,
5711
+ defaultFields,
5712
+ state.ui.itemSelector,
5713
+ selectedItem,
5714
+ hasResolver,
5715
+ hasParent
5716
+ ]);
5379
5717
  return [resolvedFields, fieldsLoading];
5380
5718
  };
5381
5719
  var Fields = () => {
@@ -5396,8 +5734,8 @@ var Fields = () => {
5396
5734
  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;
5397
5735
  const isLoading = fieldsResolving || componentResolving;
5398
5736
  const rootProps = data.root.props || data.root;
5399
- const Wrapper = (0, import_react30.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5400
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5737
+ const Wrapper = (0, import_react35.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5738
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5401
5739
  "form",
5402
5740
  {
5403
5741
  className: getClassName21(),
@@ -5405,7 +5743,7 @@ var Fields = () => {
5405
5743
  e.preventDefault();
5406
5744
  },
5407
5745
  children: [
5408
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5746
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5409
5747
  const field = fields[fieldName];
5410
5748
  if (!(field == null ? void 0 : field.type)) return null;
5411
5749
  const onChange = (value, updatedUi) => {
@@ -5476,7 +5814,7 @@ var Fields = () => {
5476
5814
  item: selectedItem
5477
5815
  });
5478
5816
  const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
5479
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5817
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5480
5818
  AutoFieldPrivate,
5481
5819
  {
5482
5820
  field,
@@ -5494,7 +5832,7 @@ var Fields = () => {
5494
5832
  root: true
5495
5833
  });
5496
5834
  const id = `root_${field.type}_${fieldName}`;
5497
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5835
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5498
5836
  AutoFieldPrivate,
5499
5837
  {
5500
5838
  field,
@@ -5508,7 +5846,7 @@ var Fields = () => {
5508
5846
  );
5509
5847
  }
5510
5848
  }) }),
5511
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 16 }) }) })
5849
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Loader, { size: 16 }) }) })
5512
5850
  ]
5513
5851
  }
5514
5852
  );
@@ -5519,7 +5857,7 @@ init_react_import();
5519
5857
 
5520
5858
  // lib/use-component-list.tsx
5521
5859
  init_react_import();
5522
- var import_react31 = require("react");
5860
+ var import_react36 = require("react");
5523
5861
 
5524
5862
  // components/ComponentList/index.tsx
5525
5863
  init_react_import();
@@ -5529,7 +5867,7 @@ init_react_import();
5529
5867
  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" };
5530
5868
 
5531
5869
  // components/ComponentList/index.tsx
5532
- var import_jsx_runtime27 = require("react/jsx-runtime");
5870
+ var import_jsx_runtime28 = require("react/jsx-runtime");
5533
5871
  var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
5534
5872
  var ComponentListItem = ({
5535
5873
  name,
@@ -5539,7 +5877,7 @@ var ComponentListItem = ({
5539
5877
  const canInsert = getPermissions({
5540
5878
  type: name
5541
5879
  }).insert;
5542
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5880
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5543
5881
  };
5544
5882
  var ComponentList = ({
5545
5883
  children,
@@ -5548,8 +5886,8 @@ var ComponentList = ({
5548
5886
  }) => {
5549
5887
  const { config, state, setUi } = useAppContext();
5550
5888
  const { expanded = true } = state.ui.componentList[id] || {};
5551
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
5552
- title && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5889
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
5890
+ title && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5553
5891
  "button",
5554
5892
  {
5555
5893
  type: "button",
@@ -5563,14 +5901,14 @@ var ComponentList = ({
5563
5901
  }),
5564
5902
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
5565
5903
  children: [
5566
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: title }),
5567
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: 12 }) })
5904
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: title }),
5905
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronDown, { size: 12 }) })
5568
5906
  ]
5569
5907
  }
5570
5908
  ),
5571
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5909
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5572
5910
  var _a;
5573
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5911
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5574
5912
  ComponentListItem,
5575
5913
  {
5576
5914
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -5584,10 +5922,10 @@ var ComponentList = ({
5584
5922
  ComponentList.Item = ComponentListItem;
5585
5923
 
5586
5924
  // lib/use-component-list.tsx
5587
- var import_jsx_runtime28 = require("react/jsx-runtime");
5925
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5588
5926
  var useComponentList = (config, ui) => {
5589
- const [componentList, setComponentList] = (0, import_react31.useState)();
5590
- (0, import_react31.useEffect)(() => {
5927
+ const [componentList, setComponentList] = (0, import_react36.useState)();
5928
+ (0, import_react36.useEffect)(() => {
5591
5929
  var _a, _b, _c;
5592
5930
  if (Object.keys(ui.componentList).length > 0) {
5593
5931
  const matchedComponents = [];
@@ -5597,7 +5935,7 @@ var useComponentList = (config, ui) => {
5597
5935
  if (category.visible === false || !category.components) {
5598
5936
  return null;
5599
5937
  }
5600
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5938
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5601
5939
  ComponentList,
5602
5940
  {
5603
5941
  id: categoryKey,
@@ -5606,7 +5944,7 @@ var useComponentList = (config, ui) => {
5606
5944
  var _a2;
5607
5945
  matchedComponents.push(componentName);
5608
5946
  const componentConf = config.components[componentName] || {};
5609
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5947
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5610
5948
  ComponentList.Item,
5611
5949
  {
5612
5950
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -5626,7 +5964,7 @@ var useComponentList = (config, ui) => {
5626
5964
  );
5627
5965
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
5628
5966
  _componentList.push(
5629
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5967
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5630
5968
  ComponentList,
5631
5969
  {
5632
5970
  id: "other",
@@ -5634,7 +5972,7 @@ var useComponentList = (config, ui) => {
5634
5972
  children: remainingComponents.map((componentName, i) => {
5635
5973
  var _a2;
5636
5974
  const componentConf = config.components[componentName] || {};
5637
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5975
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5638
5976
  ComponentList.Item,
5639
5977
  {
5640
5978
  name: componentName,
@@ -5656,25 +5994,25 @@ var useComponentList = (config, ui) => {
5656
5994
  };
5657
5995
 
5658
5996
  // components/Puck/components/Components/index.tsx
5659
- var import_react32 = require("react");
5660
- var import_jsx_runtime29 = require("react/jsx-runtime");
5997
+ var import_react37 = require("react");
5998
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5661
5999
  var Components = () => {
5662
6000
  const { config, state, overrides } = useAppContext();
5663
6001
  const componentList = useComponentList(config, state.ui);
5664
- const Wrapper = (0, import_react32.useMemo)(() => overrides.components || "div", [overrides]);
5665
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ComponentList, { id: "all" }) });
6002
+ const Wrapper = (0, import_react37.useMemo)(() => overrides.components || "div", [overrides]);
6003
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
5666
6004
  };
5667
6005
 
5668
6006
  // components/Puck/components/Preview/index.tsx
5669
6007
  init_react_import();
5670
- var import_react34 = require("react");
6008
+ var import_react39 = require("react");
5671
6009
 
5672
6010
  // components/AutoFrame/index.tsx
5673
6011
  init_react_import();
5674
- var import_react33 = require("react");
6012
+ var import_react38 = require("react");
5675
6013
  var import_object_hash = __toESM(require("object-hash"));
5676
6014
  var import_react_dom3 = require("react-dom");
5677
- var import_jsx_runtime30 = require("react/jsx-runtime");
6015
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5678
6016
  var styleSelector = 'style, link[rel="stylesheet"]';
5679
6017
  var collectStyles = (doc) => {
5680
6018
  const collected = [];
@@ -5717,7 +6055,7 @@ var CopyHostStyles = ({
5717
6055
  onStylesLoaded = () => null
5718
6056
  }) => {
5719
6057
  const { document: doc, window: win } = useFrame();
5720
- (0, import_react33.useEffect)(() => {
6058
+ (0, import_react38.useEffect)(() => {
5721
6059
  if (!win || !doc) {
5722
6060
  return () => {
5723
6061
  };
@@ -5874,10 +6212,10 @@ var CopyHostStyles = ({
5874
6212
  observer.disconnect();
5875
6213
  };
5876
6214
  }, []);
5877
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
6215
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
5878
6216
  };
5879
- var autoFrameContext = (0, import_react33.createContext)({});
5880
- var useFrame = () => (0, import_react33.useContext)(autoFrameContext);
6217
+ var autoFrameContext = (0, import_react38.createContext)({});
6218
+ var useFrame = () => (0, import_react38.useContext)(autoFrameContext);
5881
6219
  function AutoFrame(_a) {
5882
6220
  var _b = _a, {
5883
6221
  children,
@@ -5894,10 +6232,10 @@ function AutoFrame(_a) {
5894
6232
  "onStylesLoaded",
5895
6233
  "frameRef"
5896
6234
  ]);
5897
- const [loaded, setLoaded] = (0, import_react33.useState)(false);
5898
- const [ctx, setCtx] = (0, import_react33.useState)({});
5899
- const [mountTarget, setMountTarget] = (0, import_react33.useState)();
5900
- (0, import_react33.useEffect)(() => {
6235
+ const [loaded, setLoaded] = (0, import_react38.useState)(false);
6236
+ const [ctx, setCtx] = (0, import_react38.useState)({});
6237
+ const [mountTarget, setMountTarget] = (0, import_react38.useState)();
6238
+ (0, import_react38.useEffect)(() => {
5901
6239
  var _a2;
5902
6240
  if (frameRef.current) {
5903
6241
  setCtx({
@@ -5909,7 +6247,7 @@ function AutoFrame(_a) {
5909
6247
  );
5910
6248
  }
5911
6249
  }, [frameRef, loaded]);
5912
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6250
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5913
6251
  "iframe",
5914
6252
  __spreadProps(__spreadValues({}, props), {
5915
6253
  className,
@@ -5919,7 +6257,7 @@ function AutoFrame(_a) {
5919
6257
  onLoad: () => {
5920
6258
  setLoaded(true);
5921
6259
  },
5922
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CopyHostStyles, { debug, onStylesLoaded, children: (0, import_react_dom3.createPortal)(children, mountTarget) }) })
6260
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CopyHostStyles, { debug, onStylesLoaded, children: (0, import_react_dom3.createPortal)(children, mountTarget) }) })
5923
6261
  })
5924
6262
  );
5925
6263
  }
@@ -5930,12 +6268,68 @@ var AutoFrame_default = AutoFrame;
5930
6268
  init_react_import();
5931
6269
  var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
5932
6270
 
6271
+ // components/Render/index.tsx
6272
+ init_react_import();
6273
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6274
+ function Render({
6275
+ config,
6276
+ data
6277
+ }) {
6278
+ var _a;
6279
+ const defaultedData = __spreadProps(__spreadValues({}, data), {
6280
+ root: data.root || {},
6281
+ content: data.content || []
6282
+ });
6283
+ const rootProps = defaultedData.root.props || defaultedData.root;
6284
+ const title = (rootProps == null ? void 0 : rootProps.title) || "";
6285
+ if ((_a = config.root) == null ? void 0 : _a.render) {
6286
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6287
+ DropZoneProvider,
6288
+ {
6289
+ value: {
6290
+ data: defaultedData,
6291
+ config,
6292
+ mode: "render",
6293
+ depth: 0,
6294
+ path: []
6295
+ },
6296
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6297
+ config.root.render,
6298
+ __spreadProps(__spreadValues({}, rootProps), {
6299
+ puck: {
6300
+ renderDropZone: DropZone,
6301
+ isEditing: false
6302
+ },
6303
+ title,
6304
+ editMode: false,
6305
+ id: "puck-root",
6306
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6307
+ })
6308
+ )
6309
+ }
6310
+ );
6311
+ }
6312
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6313
+ DropZoneProvider,
6314
+ {
6315
+ value: {
6316
+ data: defaultedData,
6317
+ config,
6318
+ mode: "render",
6319
+ depth: 0,
6320
+ path: []
6321
+ },
6322
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6323
+ }
6324
+ );
6325
+ }
6326
+
5933
6327
  // components/Puck/components/Preview/index.tsx
5934
- var import_jsx_runtime31 = require("react/jsx-runtime");
6328
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5935
6329
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
5936
6330
  var useBubbleIframeEvents = (ref) => {
5937
6331
  const { status } = useAppContext();
5938
- (0, import_react34.useEffect)(() => {
6332
+ (0, import_react39.useEffect)(() => {
5939
6333
  var _a;
5940
6334
  if (ref.current && status === "READY") {
5941
6335
  const iframe = ref.current;
@@ -5972,22 +6366,34 @@ var useBubbleIframeEvents = (ref) => {
5972
6366
  }
5973
6367
  }, [status]);
5974
6368
  };
5975
- var Preview = ({ id = "puck-preview" }) => {
6369
+ var Preview2 = ({ id = "puck-preview" }) => {
5976
6370
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
5977
- const Page = (0, import_react34.useCallback)(
6371
+ const Page = (0, import_react39.useCallback)(
5978
6372
  (pageProps) => {
5979
6373
  var _a, _b;
5980
6374
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
5981
6375
  id: "puck-root"
5982
- }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: pageProps.children });
6376
+ }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
5983
6377
  },
5984
6378
  [config.root]
5985
6379
  );
5986
- const Frame = (0, import_react34.useMemo)(() => overrides.iframe, [overrides]);
6380
+ const Frame = (0, import_react39.useMemo)(() => overrides.iframe, [overrides]);
5987
6381
  const rootProps = state.data.root.props || state.data.root;
5988
- const ref = (0, import_react34.useRef)(null);
6382
+ const ref = (0, import_react39.useRef)(null);
5989
6383
  useBubbleIframeEvents(ref);
5990
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6384
+ const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6385
+ Page,
6386
+ __spreadProps(__spreadValues({}, rootProps), {
6387
+ puck: {
6388
+ renderDropZone: DropZone,
6389
+ isEditing: true,
6390
+ dragRef: null
6391
+ },
6392
+ editMode: true,
6393
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
6394
+ })
6395
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: state.data, config });
6396
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5991
6397
  "div",
5992
6398
  {
5993
6399
  className: getClassName23(),
@@ -5996,7 +6402,7 @@ var Preview = ({ id = "puck-preview" }) => {
5996
6402
  onClick: () => {
5997
6403
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
5998
6404
  },
5999
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6405
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6000
6406
  AutoFrame_default,
6001
6407
  {
6002
6408
  id: "preview-frame",
@@ -6006,40 +6412,21 @@ var Preview = ({ id = "puck-preview" }) => {
6006
6412
  setStatus("READY");
6007
6413
  },
6008
6414
  frameRef: ref,
6009
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6010
- const inner = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6011
- Page,
6012
- __spreadProps(__spreadValues({}, rootProps), {
6013
- puck: {
6014
- renderDropZone: DropZone,
6015
- isEditing: true,
6016
- dragRef: null
6017
- },
6018
- editMode: true,
6019
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
6020
- })
6021
- );
6415
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6022
6416
  if (Frame) {
6023
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Frame, { document: document2, children: inner });
6417
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame, { document: document2, children: inner });
6024
6418
  }
6025
6419
  return inner;
6026
6420
  } })
6027
6421
  }
6028
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6422
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6029
6423
  "div",
6030
6424
  {
6031
6425
  id: "preview-frame",
6032
6426
  className: getClassName23("frame"),
6033
6427
  ref,
6034
6428
  "data-puck-entry": true,
6035
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6036
- Page,
6037
- __spreadProps(__spreadValues({}, rootProps), {
6038
- puck: { renderDropZone: DropZone, isEditing: true, dragRef: null },
6039
- editMode: true,
6040
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DropZone, { zone: rootDroppableId })
6041
- })
6042
- )
6429
+ children: inner
6043
6430
  }
6044
6431
  )
6045
6432
  }
@@ -6089,7 +6476,7 @@ var scrollIntoView = (el) => {
6089
6476
  };
6090
6477
 
6091
6478
  // components/LayerTree/index.tsx
6092
- var import_react35 = require("react");
6479
+ var import_react40 = require("react");
6093
6480
 
6094
6481
  // lib/is-child-of-zone.ts
6095
6482
  init_react_import();
@@ -6122,7 +6509,7 @@ var onScrollEnd = (frame, cb) => {
6122
6509
  };
6123
6510
 
6124
6511
  // components/LayerTree/index.tsx
6125
- var import_jsx_runtime32 = require("react/jsx-runtime");
6512
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6126
6513
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
6127
6514
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
6128
6515
  var LayerTree = ({
@@ -6135,15 +6522,15 @@ var LayerTree = ({
6135
6522
  label
6136
6523
  }) => {
6137
6524
  const zones = data.zones || {};
6138
- const ctx = (0, import_react35.useContext)(dropZoneContext);
6139
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6140
- label && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
6141
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Layers, { size: "16" }) }),
6525
+ const ctx = (0, import_react40.useContext)(dropZoneContext);
6526
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6527
+ label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
6528
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
6142
6529
  " ",
6143
6530
  label
6144
6531
  ] }),
6145
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("ul", { className: getClassName24(), children: [
6146
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
6532
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
6533
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
6147
6534
  zoneContent.map((item, i) => {
6148
6535
  var _a;
6149
6536
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -6156,7 +6543,7 @@ var LayerTree = ({
6156
6543
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
6157
6544
  const componentConfig = config.components[item.type];
6158
6545
  const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
6159
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6546
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6160
6547
  "li",
6161
6548
  {
6162
6549
  className: getClassNameLayer({
@@ -6166,7 +6553,7 @@ var LayerTree = ({
6166
6553
  childIsSelected
6167
6554
  }),
6168
6555
  children: [
6169
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6556
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6170
6557
  "button",
6171
6558
  {
6172
6559
  type: "button",
@@ -6205,22 +6592,22 @@ var LayerTree = ({
6205
6592
  setHoveringComponent(null);
6206
6593
  },
6207
6594
  children: [
6208
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6595
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6209
6596
  "div",
6210
6597
  {
6211
6598
  className: getClassNameLayer("chevron"),
6212
6599
  title: isSelected ? "Collapse" : "Expand",
6213
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDown, { size: "12" })
6600
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
6214
6601
  }
6215
6602
  ),
6216
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassNameLayer("title"), children: [
6217
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LayoutGrid, { size: "16" }) }),
6218
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
6603
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
6604
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
6605
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
6219
6606
  ] })
6220
6607
  ]
6221
6608
  }
6222
6609
  ) }),
6223
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6610
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6224
6611
  LayerTree,
6225
6612
  {
6226
6613
  config,
@@ -6242,13 +6629,13 @@ var LayerTree = ({
6242
6629
  };
6243
6630
 
6244
6631
  // components/Puck/components/Outline/index.tsx
6245
- var import_react36 = require("react");
6246
- var import_jsx_runtime33 = require("react/jsx-runtime");
6632
+ var import_react41 = require("react");
6633
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6247
6634
  var Outline = () => {
6248
6635
  const { dispatch, state, overrides, config } = useAppContext();
6249
6636
  const { data, ui } = state;
6250
6637
  const { itemSelector } = ui;
6251
- const setItemSelector = (0, import_react36.useCallback)(
6638
+ const setItemSelector = (0, import_react41.useCallback)(
6252
6639
  (newItemSelector) => {
6253
6640
  dispatch({
6254
6641
  type: "setUi",
@@ -6257,9 +6644,9 @@ var Outline = () => {
6257
6644
  },
6258
6645
  []
6259
6646
  );
6260
- const Wrapper = (0, import_react36.useMemo)(() => overrides.outline || "div", [overrides]);
6261
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6262
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6647
+ const Wrapper = (0, import_react41.useMemo)(() => overrides.outline || "div", [overrides]);
6648
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
6649
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6263
6650
  LayerTree,
6264
6651
  {
6265
6652
  config,
@@ -6272,7 +6659,7 @@ var Outline = () => {
6272
6659
  ),
6273
6660
  Object.entries(findZonesForArea(data, "root")).map(
6274
6661
  ([zoneKey, zone]) => {
6275
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6662
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6276
6663
  LayerTree,
6277
6664
  {
6278
6665
  config,
@@ -6371,19 +6758,19 @@ function usePuckHistory({
6371
6758
 
6372
6759
  // lib/use-history-store.ts
6373
6760
  init_react_import();
6374
- var import_react37 = require("react");
6761
+ var import_react42 = require("react");
6375
6762
  var import_use_debounce3 = require("use-debounce");
6376
6763
  var EMPTY_HISTORY_INDEX = 0;
6377
6764
  function useHistoryStore(initialHistory) {
6378
6765
  var _a, _b;
6379
- const [histories, setHistories] = (0, import_react37.useState)(
6766
+ const [histories, setHistories] = (0, import_react42.useState)(
6380
6767
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6381
6768
  );
6382
6769
  const updateHistories = (histories2) => {
6383
6770
  setHistories(histories2);
6384
6771
  setIndex(histories2.length - 1);
6385
6772
  };
6386
- const [index, setIndex] = (0, import_react37.useState)(
6773
+ const [index, setIndex] = (0, import_react42.useState)(
6387
6774
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6388
6775
  );
6389
6776
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6543,22 +6930,22 @@ var getBox = function getBox2(el) {
6543
6930
  };
6544
6931
 
6545
6932
  // components/Puck/components/Canvas/index.tsx
6546
- var import_react39 = require("react");
6933
+ var import_react44 = require("react");
6547
6934
 
6548
6935
  // components/ViewportControls/index.tsx
6549
6936
  init_react_import();
6550
- var import_react38 = require("react");
6937
+ var import_react43 = require("react");
6551
6938
 
6552
6939
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6553
6940
  init_react_import();
6554
6941
  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" };
6555
6942
 
6556
6943
  // components/ViewportControls/index.tsx
6557
- var import_jsx_runtime34 = require("react/jsx-runtime");
6944
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6558
6945
  var icons = {
6559
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Smartphone, { size: 16 }),
6560
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Tablet, { size: 16 }),
6561
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Monitor, { size: 16 })
6946
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
6947
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
6948
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
6562
6949
  };
6563
6950
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
6564
6951
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -6570,11 +6957,11 @@ var ViewportButton = ({
6570
6957
  onClick
6571
6958
  }) => {
6572
6959
  const { state } = useAppContext();
6573
- const [isActive, setIsActive] = (0, import_react38.useState)(false);
6574
- (0, import_react38.useEffect)(() => {
6960
+ const [isActive, setIsActive] = (0, import_react43.useState)(false);
6961
+ (0, import_react43.useEffect)(() => {
6575
6962
  setIsActive(width === state.ui.viewports.current.width);
6576
6963
  }, [width, state.ui.viewports.current.width]);
6577
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6964
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6578
6965
  IconButton,
6579
6966
  {
6580
6967
  title,
@@ -6583,7 +6970,7 @@ var ViewportButton = ({
6583
6970
  e.stopPropagation();
6584
6971
  onClick({ width, height });
6585
6972
  },
6586
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: getClassNameButton("inner"), children })
6973
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
6587
6974
  }
6588
6975
  ) });
6589
6976
  };
@@ -6607,7 +6994,7 @@ var ViewportControls = ({
6607
6994
  const defaultsContainAutoZoom = defaultZoomOptions.find(
6608
6995
  (option) => option.value === autoZoom
6609
6996
  );
6610
- const zoomOptions = (0, import_react38.useMemo)(
6997
+ const zoomOptions = (0, import_react43.useMemo)(
6611
6998
  () => [
6612
6999
  ...defaultZoomOptions,
6613
7000
  ...defaultsContainAutoZoom ? [] : [
@@ -6619,8 +7006,8 @@ var ViewportControls = ({
6619
7006
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
6620
7007
  [autoZoom]
6621
7008
  );
6622
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25(), children: [
6623
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7009
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
7010
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6624
7011
  ViewportButton,
6625
7012
  {
6626
7013
  height: viewport.height,
@@ -6631,8 +7018,8 @@ var ViewportControls = ({
6631
7018
  },
6632
7019
  i
6633
7020
  )),
6634
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("divider") }),
6635
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7021
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7022
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6636
7023
  IconButton,
6637
7024
  {
6638
7025
  title: "Zoom viewport out",
@@ -6646,10 +7033,10 @@ var ViewportControls = ({
6646
7033
  )].value
6647
7034
  );
6648
7035
  },
6649
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ZoomOut, { size: 16 })
7036
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
6650
7037
  }
6651
7038
  ),
6652
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7039
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6653
7040
  IconButton,
6654
7041
  {
6655
7042
  title: "Zoom viewport in",
@@ -6663,11 +7050,11 @@ var ViewportControls = ({
6663
7050
  )].value
6664
7051
  );
6665
7052
  },
6666
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ZoomIn, { size: 16 })
7053
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
6667
7054
  }
6668
7055
  ),
6669
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("divider") }),
6670
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7056
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
7057
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6671
7058
  "select",
6672
7059
  {
6673
7060
  className: getClassName25("zoomSelect"),
@@ -6675,7 +7062,7 @@ var ViewportControls = ({
6675
7062
  onChange: (e) => {
6676
7063
  onZoom(parseFloat(e.currentTarget.value));
6677
7064
  },
6678
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7065
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6679
7066
  "option",
6680
7067
  {
6681
7068
  value: option.value,
@@ -6723,24 +7110,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
6723
7110
  };
6724
7111
 
6725
7112
  // components/Puck/components/Canvas/index.tsx
6726
- var import_jsx_runtime35 = require("react/jsx-runtime");
7113
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6727
7114
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
6728
7115
  var ZOOM_ON_CHANGE = true;
6729
7116
  var Canvas = () => {
6730
7117
  const { status, iframe } = useAppContext();
6731
7118
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
6732
7119
  const { ui } = state;
6733
- const frameRef = (0, import_react39.useRef)(null);
6734
- const [showTransition, setShowTransition] = (0, import_react39.useState)(false);
6735
- const defaultRender = (0, import_react39.useMemo)(() => {
6736
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children });
7120
+ const frameRef = (0, import_react44.useRef)(null);
7121
+ const [showTransition, setShowTransition] = (0, import_react44.useState)(false);
7122
+ const defaultRender = (0, import_react44.useMemo)(() => {
7123
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
6737
7124
  return PuckDefault;
6738
7125
  }, []);
6739
- const CustomPreview = (0, import_react39.useMemo)(
7126
+ const CustomPreview = (0, import_react44.useMemo)(
6740
7127
  () => overrides.preview || defaultRender,
6741
7128
  [overrides]
6742
7129
  );
6743
- const getFrameDimensions = (0, import_react39.useCallback)(() => {
7130
+ const getFrameDimensions = (0, import_react44.useCallback)(() => {
6744
7131
  if (frameRef.current) {
6745
7132
  const frame = frameRef.current;
6746
7133
  const box = getBox(frame);
@@ -6748,7 +7135,7 @@ var Canvas = () => {
6748
7135
  }
6749
7136
  return { width: 0, height: 0 };
6750
7137
  }, [frameRef]);
6751
- const resetAutoZoom = (0, import_react39.useCallback)(
7138
+ const resetAutoZoom = (0, import_react44.useCallback)(
6752
7139
  (ui2 = state.ui) => {
6753
7140
  if (frameRef.current) {
6754
7141
  setZoomConfig(
@@ -6758,11 +7145,11 @@ var Canvas = () => {
6758
7145
  },
6759
7146
  [frameRef, zoomConfig, state.ui]
6760
7147
  );
6761
- (0, import_react39.useEffect)(() => {
7148
+ (0, import_react44.useEffect)(() => {
6762
7149
  setShowTransition(false);
6763
7150
  resetAutoZoom();
6764
7151
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
6765
- (0, import_react39.useEffect)(() => {
7152
+ (0, import_react44.useEffect)(() => {
6766
7153
  const { height: frameHeight } = getFrameDimensions();
6767
7154
  if (ui.viewports.current.height === "auto") {
6768
7155
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -6770,13 +7157,13 @@ var Canvas = () => {
6770
7157
  }));
6771
7158
  }
6772
7159
  }, [zoomConfig.zoom]);
6773
- (0, import_react39.useEffect)(() => {
7160
+ (0, import_react44.useEffect)(() => {
6774
7161
  if (ZOOM_ON_CHANGE) {
6775
7162
  setShowTransition(true);
6776
7163
  resetAutoZoom(ui);
6777
7164
  }
6778
7165
  }, [ui.viewports.current.width]);
6779
- (0, import_react39.useEffect)(() => {
7166
+ (0, import_react44.useEffect)(() => {
6780
7167
  const cb = () => {
6781
7168
  setShowTransition(false);
6782
7169
  resetAutoZoom();
@@ -6786,13 +7173,13 @@ var Canvas = () => {
6786
7173
  window.removeEventListener("resize", cb);
6787
7174
  };
6788
7175
  }, []);
6789
- const [showLoader, setShowLoader] = (0, import_react39.useState)(false);
6790
- (0, import_react39.useEffect)(() => {
7176
+ const [showLoader, setShowLoader] = (0, import_react44.useState)(false);
7177
+ (0, import_react44.useEffect)(() => {
6791
7178
  setTimeout(() => {
6792
7179
  setShowLoader(true);
6793
7180
  }, 500);
6794
7181
  }, []);
6795
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7182
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6796
7183
  "div",
6797
7184
  {
6798
7185
  className: getClassName26({
@@ -6805,7 +7192,7 @@ var Canvas = () => {
6805
7192
  recordHistory: true
6806
7193
  }),
6807
7194
  children: [
6808
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7195
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6809
7196
  ViewportControls,
6810
7197
  {
6811
7198
  autoZoom: zoomConfig.autoZoom,
@@ -6831,8 +7218,8 @@ var Canvas = () => {
6831
7218
  }
6832
7219
  }
6833
7220
  ) }),
6834
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
6835
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7221
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
7222
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6836
7223
  "div",
6837
7224
  {
6838
7225
  className: getClassName26("root"),
@@ -6853,10 +7240,10 @@ var Canvas = () => {
6853
7240
  })
6854
7241
  );
6855
7242
  },
6856
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Preview, {}) })
7243
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview2, {}) })
6857
7244
  }
6858
7245
  ),
6859
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loader, { size: 24 }) })
7246
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Loader, { size: 24 }) })
6860
7247
  ] })
6861
7248
  ]
6862
7249
  }
@@ -6865,7 +7252,7 @@ var Canvas = () => {
6865
7252
 
6866
7253
  // lib/use-loaded-overrides.ts
6867
7254
  init_react_import();
6868
- var import_react40 = require("react");
7255
+ var import_react45 = require("react");
6869
7256
 
6870
7257
  // lib/load-overrides.ts
6871
7258
  init_react_import();
@@ -6904,26 +7291,26 @@ var useLoadedOverrides = ({
6904
7291
  overrides,
6905
7292
  plugins
6906
7293
  }) => {
6907
- return (0, import_react40.useMemo)(() => {
7294
+ return (0, import_react45.useMemo)(() => {
6908
7295
  return loadOverrides({ overrides, plugins });
6909
7296
  }, [plugins, overrides]);
6910
7297
  };
6911
7298
 
6912
7299
  // components/DefaultOverride/index.tsx
6913
7300
  init_react_import();
6914
- var import_jsx_runtime36 = require("react/jsx-runtime");
6915
- var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
7301
+ var import_jsx_runtime38 = require("react/jsx-runtime");
7302
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
6916
7303
 
6917
7304
  // lib/use-inject-css.ts
6918
7305
  init_react_import();
6919
- var import_react41 = require("react");
7306
+ var import_react46 = require("react");
6920
7307
  var styles = ``;
6921
7308
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
6922
- const [el, setEl] = (0, import_react41.useState)();
6923
- (0, import_react41.useEffect)(() => {
7309
+ const [el, setEl] = (0, import_react46.useState)();
7310
+ (0, import_react46.useEffect)(() => {
6924
7311
  setEl(document.createElement("style"));
6925
7312
  }, []);
6926
- (0, import_react41.useEffect)(() => {
7313
+ (0, import_react46.useEffect)(() => {
6927
7314
  var _a;
6928
7315
  if (!el || typeof window === "undefined") {
6929
7316
  return;
@@ -6941,8 +7328,35 @@ var useInjectGlobalCss = (iframeEnabled) => {
6941
7328
  return useInjectStyleSheet(styles, iframeEnabled);
6942
7329
  };
6943
7330
 
7331
+ // lib/use-preview-mode-hotkeys.ts
7332
+ init_react_import();
7333
+ var import_react47 = require("react");
7334
+ var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
7335
+ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7336
+ const toggleInteractive = (0, import_react47.useCallback)(() => {
7337
+ dispatch({
7338
+ type: "setUi",
7339
+ ui: (ui) => ({
7340
+ previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
7341
+ })
7342
+ });
7343
+ }, [dispatch]);
7344
+ const toggleInteractiveIframe = () => {
7345
+ if (iframeEnabled) {
7346
+ toggleInteractive();
7347
+ }
7348
+ };
7349
+ const frame = getFrame();
7350
+ const resolvedFrame = typeof window !== "undefined" && frame !== document ? frame : void 0;
7351
+ (0, import_react_hotkeys_hook2.useHotkeys)("meta+i", toggleInteractive, { preventDefault: true });
7352
+ (0, import_react_hotkeys_hook2.useHotkeys)("meta+i", toggleInteractiveIframe, {
7353
+ preventDefault: true,
7354
+ document: resolvedFrame
7355
+ });
7356
+ };
7357
+
6944
7358
  // components/Puck/index.tsx
6945
- var import_jsx_runtime37 = require("react/jsx-runtime");
7359
+ var import_jsx_runtime39 = require("react/jsx-runtime");
6946
7360
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
6947
7361
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
6948
7362
  function Puck({
@@ -6971,7 +7385,7 @@ function Puck({
6971
7385
  waitForStyles: true
6972
7386
  }, _iframe);
6973
7387
  useInjectGlobalCss(iframe.enabled);
6974
- const [generatedAppState] = (0, import_react42.useState)(() => {
7388
+ const [generatedAppState] = (0, import_react48.useState)(() => {
6975
7389
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
6976
7390
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
6977
7391
  let clientUiState = {};
@@ -7043,14 +7457,14 @@ function Puck({
7043
7457
  histories,
7044
7458
  index: initialHistoryIndex
7045
7459
  });
7046
- const [reducer] = (0, import_react42.useState)(
7460
+ const [reducer] = (0, import_react48.useState)(
7047
7461
  () => createReducer({
7048
7462
  config,
7049
7463
  record: historyStore.record,
7050
7464
  onAction
7051
7465
  })
7052
7466
  );
7053
- const [appState, dispatch] = (0, import_react42.useReducer)(
7467
+ const [appState, dispatch] = (0, import_react48.useReducer)(
7054
7468
  reducer,
7055
7469
  flushZones(initialAppState)
7056
7470
  );
@@ -7061,14 +7475,14 @@ function Puck({
7061
7475
  historyStore,
7062
7476
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7063
7477
  });
7064
- const [menuOpen, setMenuOpen] = (0, import_react42.useState)(false);
7478
+ const [menuOpen, setMenuOpen] = (0, import_react48.useState)(false);
7065
7479
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7066
7480
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7067
- (0, import_react42.useEffect)(() => {
7481
+ (0, import_react48.useEffect)(() => {
7068
7482
  if (onChange) onChange(data);
7069
7483
  }, [data]);
7070
7484
  const rootProps = data.root.props || data.root;
7071
- const toggleSidebars = (0, import_react42.useCallback)(
7485
+ const toggleSidebars = (0, import_react48.useCallback)(
7072
7486
  (sidebar) => {
7073
7487
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
7074
7488
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7082,7 +7496,7 @@ function Puck({
7082
7496
  },
7083
7497
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7084
7498
  );
7085
- (0, import_react42.useEffect)(() => {
7499
+ (0, import_react48.useEffect)(() => {
7086
7500
  if (!window.matchMedia("(min-width: 638px)").matches) {
7087
7501
  dispatch({
7088
7502
  type: "setUi",
@@ -7105,7 +7519,7 @@ function Puck({
7105
7519
  window.removeEventListener("resize", handleResize);
7106
7520
  };
7107
7521
  }, []);
7108
- const defaultHeaderRender = (0, import_react42.useMemo)(() => {
7522
+ const defaultHeaderRender = (0, import_react48.useMemo)(() => {
7109
7523
  if (renderHeader) {
7110
7524
  console.warn(
7111
7525
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -7113,20 +7527,20 @@ function Puck({
7113
7527
  const RenderHeader = (_a2) => {
7114
7528
  var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
7115
7529
  const Comp = renderHeader;
7116
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7530
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7117
7531
  };
7118
7532
  return RenderHeader;
7119
7533
  }
7120
7534
  return DefaultOverride;
7121
7535
  }, [renderHeader]);
7122
- const defaultHeaderActionsRender = (0, import_react42.useMemo)(() => {
7536
+ const defaultHeaderActionsRender = (0, import_react48.useMemo)(() => {
7123
7537
  if (renderHeaderActions) {
7124
7538
  console.warn(
7125
7539
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
7126
7540
  );
7127
7541
  const RenderHeader = (props) => {
7128
7542
  const Comp = renderHeaderActions;
7129
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7543
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7130
7544
  };
7131
7545
  return RenderHeader;
7132
7546
  }
@@ -7136,26 +7550,27 @@ function Puck({
7136
7550
  overrides,
7137
7551
  plugins
7138
7552
  });
7139
- const CustomPuck = (0, import_react42.useMemo)(
7553
+ const CustomPuck = (0, import_react48.useMemo)(
7140
7554
  () => loadedOverrides.puck || DefaultOverride,
7141
7555
  [loadedOverrides]
7142
7556
  );
7143
- const CustomHeader = (0, import_react42.useMemo)(
7557
+ const CustomHeader = (0, import_react48.useMemo)(
7144
7558
  () => loadedOverrides.header || defaultHeaderRender,
7145
7559
  [loadedOverrides]
7146
7560
  );
7147
- const CustomHeaderActions = (0, import_react42.useMemo)(
7561
+ const CustomHeaderActions = (0, import_react48.useMemo)(
7148
7562
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7149
7563
  [loadedOverrides]
7150
7564
  );
7151
- const [mounted, setMounted] = (0, import_react42.useState)(false);
7152
- (0, import_react42.useEffect)(() => {
7565
+ const [mounted, setMounted] = (0, import_react48.useState)(false);
7566
+ (0, import_react48.useEffect)(() => {
7153
7567
  setMounted(true);
7154
7568
  }, []);
7155
7569
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
7156
7570
  const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
7157
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
7158
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7571
+ usePreviewModeHotkeys(dispatch, iframe.enabled);
7572
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
7573
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7159
7574
  AppProvider,
7160
7575
  {
7161
7576
  value: {
@@ -7177,7 +7592,7 @@ function Puck({
7177
7592
  getPermissions: () => ({}),
7178
7593
  refreshPermissions: () => null
7179
7594
  },
7180
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7595
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7181
7596
  "div",
7182
7597
  {
7183
7598
  className: getLayoutClassName({
@@ -7186,60 +7601,60 @@ function Puck({
7186
7601
  mounted,
7187
7602
  rightSideBarVisible
7188
7603
  }),
7189
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("inner"), children: [
7190
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7604
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("inner"), children: [
7605
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7191
7606
  CustomHeader,
7192
7607
  {
7193
- actions: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7608
+ actions: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7194
7609
  Button,
7195
7610
  {
7196
7611
  onClick: () => {
7197
7612
  onPublish && onPublish(data);
7198
7613
  },
7199
- icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Globe, { size: "14px" }),
7614
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
7200
7615
  children: "Publish"
7201
7616
  }
7202
7617
  ) }) }),
7203
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
7204
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
7205
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7618
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
7619
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
7620
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7206
7621
  "div",
7207
7622
  {
7208
7623
  className: getLayoutClassName("leftSideBarToggle"),
7209
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7624
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7210
7625
  IconButton,
7211
7626
  {
7212
7627
  onClick: () => {
7213
7628
  toggleSidebars("left");
7214
7629
  },
7215
7630
  title: "Toggle left sidebar",
7216
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PanelLeft, { focusable: "false" })
7631
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelLeft, { focusable: "false" })
7217
7632
  }
7218
7633
  )
7219
7634
  }
7220
7635
  ),
7221
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7636
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7222
7637
  "div",
7223
7638
  {
7224
7639
  className: getLayoutClassName("rightSideBarToggle"),
7225
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7640
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7226
7641
  IconButton,
7227
7642
  {
7228
7643
  onClick: () => {
7229
7644
  toggleSidebars("right");
7230
7645
  },
7231
7646
  title: "Toggle right sidebar",
7232
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PanelRight, { focusable: "false" })
7647
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelRight, { focusable: "false" })
7233
7648
  }
7234
7649
  )
7235
7650
  }
7236
7651
  )
7237
7652
  ] }),
7238
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Heading, { rank: "2", size: "xs", children: [
7653
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Heading, { rank: "2", size: "xs", children: [
7239
7654
  headerTitle || rootProps.title || "Page",
7240
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7655
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
7241
7656
  " ",
7242
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7657
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7243
7658
  "code",
7244
7659
  {
7245
7660
  className: getLayoutClassName("headerPath"),
@@ -7248,31 +7663,31 @@ function Puck({
7248
7663
  )
7249
7664
  ] })
7250
7665
  ] }) }),
7251
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
7252
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7666
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
7667
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7253
7668
  IconButton,
7254
7669
  {
7255
7670
  onClick: () => {
7256
7671
  return setMenuOpen(!menuOpen);
7257
7672
  },
7258
7673
  title: "Toggle menu bar",
7259
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDown, { focusable: "false" })
7674
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { focusable: "false" })
7260
7675
  }
7261
7676
  ) }),
7262
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7677
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7263
7678
  MenuBar,
7264
7679
  {
7265
7680
  appState,
7266
7681
  dispatch,
7267
7682
  onPublish,
7268
7683
  menuOpen,
7269
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7684
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7270
7685
  Button,
7271
7686
  {
7272
7687
  onClick: () => {
7273
7688
  onPublish && onPublish(data);
7274
7689
  },
7275
- icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Globe, { size: "14px" }),
7690
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
7276
7691
  children: "Publish"
7277
7692
  }
7278
7693
  ) }),
@@ -7283,19 +7698,19 @@ function Puck({
7283
7698
  ] }) })
7284
7699
  }
7285
7700
  ),
7286
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
7287
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Components, {}) }),
7288
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Outline, {}) })
7701
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
7702
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Components, {}) }),
7703
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Outline, {}) })
7289
7704
  ] }),
7290
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Canvas, {}),
7291
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7705
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Canvas, {}),
7706
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7292
7707
  SidebarSection,
7293
7708
  {
7294
7709
  noPadding: true,
7295
7710
  noBorderTop: true,
7296
7711
  showBreadcrumbs: true,
7297
7712
  title: selectedItem ? selectedComponentLabel : "Page",
7298
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Fields, {})
7713
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Fields, {})
7299
7714
  }
7300
7715
  ) })
7301
7716
  ] })
@@ -7303,69 +7718,13 @@ function Puck({
7303
7718
  ) }) })
7304
7719
  }
7305
7720
  ),
7306
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
7721
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
7307
7722
  ] });
7308
7723
  }
7309
7724
  Puck.Components = Components;
7310
7725
  Puck.Fields = Fields;
7311
7726
  Puck.Outline = Outline;
7312
- Puck.Preview = Preview;
7313
-
7314
- // components/Render/index.tsx
7315
- init_react_import();
7316
- var import_jsx_runtime38 = require("react/jsx-runtime");
7317
- function Render({
7318
- config,
7319
- data
7320
- }) {
7321
- var _a;
7322
- const defaultedData = __spreadProps(__spreadValues({}, data), {
7323
- root: data.root || {},
7324
- content: data.content || []
7325
- });
7326
- const rootProps = defaultedData.root.props || defaultedData.root;
7327
- const title = (rootProps == null ? void 0 : rootProps.title) || "";
7328
- if ((_a = config.root) == null ? void 0 : _a.render) {
7329
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7330
- DropZoneProvider,
7331
- {
7332
- value: {
7333
- data: defaultedData,
7334
- config,
7335
- mode: "render",
7336
- depth: 0,
7337
- path: []
7338
- },
7339
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7340
- config.root.render,
7341
- __spreadProps(__spreadValues({}, rootProps), {
7342
- puck: {
7343
- renderDropZone: DropZone,
7344
- isEditing: false
7345
- },
7346
- title,
7347
- editMode: false,
7348
- id: "puck-root",
7349
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DropZone, { zone: rootDroppableId })
7350
- })
7351
- )
7352
- }
7353
- );
7354
- }
7355
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7356
- DropZoneProvider,
7357
- {
7358
- value: {
7359
- data: defaultedData,
7360
- config,
7361
- mode: "render",
7362
- depth: 0,
7363
- path: []
7364
- },
7365
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DropZone, { zone: rootDroppableId })
7366
- }
7367
- );
7368
- }
7727
+ Puck.Preview = Preview2;
7369
7728
 
7370
7729
  // lib/migrate.ts
7371
7730
  init_react_import();