@measured/puck 0.18.0-canary.b355ddd → 0.18.0-canary.c6df5b2

Sign up to get free protection for your applications and to get access to all the features.
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"),
@@ -1680,11 +1741,11 @@ var DefaultField = ({
1680
1741
 
1681
1742
  // components/AutoField/fields/ExternalField/index.tsx
1682
1743
  init_react_import();
1683
- var import_react15 = require("react");
1744
+ var import_react16 = require("react");
1684
1745
 
1685
1746
  // components/ExternalInput/index.tsx
1686
1747
  init_react_import();
1687
- var import_react14 = require("react");
1748
+ var import_react15 = require("react");
1688
1749
 
1689
1750
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
1690
1751
  init_react_import();
@@ -1692,7 +1753,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
1692
1753
 
1693
1754
  // components/Modal/index.tsx
1694
1755
  init_react_import();
1695
- var import_react12 = require("react");
1756
+ var import_react13 = require("react");
1696
1757
 
1697
1758
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
1698
1759
  init_react_import();
@@ -1700,22 +1761,22 @@ var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Mod
1700
1761
 
1701
1762
  // components/Modal/index.tsx
1702
1763
  var import_react_dom = require("react-dom");
1703
- var import_jsx_runtime9 = require("react/jsx-runtime");
1764
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1704
1765
  var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
1705
1766
  var Modal = ({
1706
1767
  children,
1707
1768
  onClose,
1708
1769
  isOpen
1709
1770
  }) => {
1710
- const [rootEl, setRootEl] = (0, import_react12.useState)(null);
1711
- (0, import_react12.useEffect)(() => {
1771
+ const [rootEl, setRootEl] = (0, import_react13.useState)(null);
1772
+ (0, import_react13.useEffect)(() => {
1712
1773
  setRootEl(document.getElementById("puck-portal-root"));
1713
1774
  }, []);
1714
1775
  if (!rootEl) {
1715
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {});
1776
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
1716
1777
  }
1717
1778
  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)(
1779
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1719
1780
  "div",
1720
1781
  {
1721
1782
  className: getClassName7("inner"),
@@ -1735,11 +1796,11 @@ init_react_import();
1735
1796
  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
1797
 
1737
1798
  // components/Heading/index.tsx
1738
- var import_jsx_runtime10 = require("react/jsx-runtime");
1799
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1739
1800
  var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
1740
1801
  var Heading = ({ children, rank, size = "m" }) => {
1741
1802
  const Tag = rank ? `h${rank}` : "span";
1742
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1803
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1743
1804
  Tag,
1744
1805
  {
1745
1806
  className: getClassName8({
@@ -1755,7 +1816,7 @@ init_react_import();
1755
1816
 
1756
1817
  // components/Button/Button.tsx
1757
1818
  init_react_import();
1758
- var import_react13 = require("react");
1819
+ var import_react14 = require("react");
1759
1820
 
1760
1821
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
1761
1822
  init_react_import();
@@ -1775,7 +1836,7 @@ var filterDataAttrs = (props) => {
1775
1836
  };
1776
1837
 
1777
1838
  // components/Button/Button.tsx
1778
- var import_jsx_runtime11 = require("react/jsx-runtime");
1839
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1779
1840
  var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
1780
1841
  var Button = (_a) => {
1781
1842
  var _b = _a, {
@@ -1805,11 +1866,11 @@ var Button = (_a) => {
1805
1866
  "size",
1806
1867
  "loading"
1807
1868
  ]);
1808
- const [loading, setLoading] = (0, import_react13.useState)(loadingProp);
1809
- (0, import_react13.useEffect)(() => setLoading(loadingProp), [loadingProp]);
1869
+ const [loading, setLoading] = (0, import_react14.useState)(loadingProp);
1870
+ (0, import_react14.useEffect)(() => setLoading(loadingProp), [loadingProp]);
1810
1871
  const ElementType = href ? "a" : type ? "button" : "span";
1811
1872
  const dataAttrs = filterDataAttrs(props);
1812
- const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1873
+ const el = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1813
1874
  ElementType,
1814
1875
  __spreadProps(__spreadValues({
1815
1876
  className: getClassName9({
@@ -1834,9 +1895,9 @@ var Button = (_a) => {
1834
1895
  href
1835
1896
  }, dataAttrs), {
1836
1897
  children: [
1837
- icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("icon"), children: icon }),
1898
+ icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("icon"), children: icon }),
1838
1899
  children,
1839
- loading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loader, { size: 14 }) })
1900
+ loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 14 }) })
1840
1901
  ]
1841
1902
  })
1842
1903
  );
@@ -1844,7 +1905,7 @@ var Button = (_a) => {
1844
1905
  };
1845
1906
 
1846
1907
  // components/ExternalInput/index.tsx
1847
- var import_jsx_runtime12 = require("react/jsx-runtime");
1908
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1848
1909
  var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
1849
1910
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
1850
1911
  var dataCache = {};
@@ -1861,28 +1922,28 @@ var ExternalInput = ({
1861
1922
  mapRow = (val) => val,
1862
1923
  filterFields
1863
1924
  } = 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);
1925
+ const [data, setData] = (0, import_react15.useState)([]);
1926
+ const [isOpen, setOpen] = (0, import_react15.useState)(false);
1927
+ const [isLoading, setIsLoading] = (0, import_react15.useState)(true);
1867
1928
  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)(() => {
1929
+ const [filters, setFilters] = (0, import_react15.useState)(field.initialFilters || {});
1930
+ const [filtersToggled, setFiltersToggled] = (0, import_react15.useState)(hasFilterFields);
1931
+ const mappedData = (0, import_react15.useMemo)(() => {
1871
1932
  return data.map(mapRow);
1872
1933
  }, [data]);
1873
- const keys = (0, import_react14.useMemo)(() => {
1934
+ const keys = (0, import_react15.useMemo)(() => {
1874
1935
  const validKeys = /* @__PURE__ */ new Set();
1875
1936
  for (const item of mappedData) {
1876
1937
  for (const key of Object.keys(item)) {
1877
- if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react14.isValidElement)(item[key])) {
1938
+ if (typeof item[key] === "string" || typeof item[key] === "number" || (0, import_react15.isValidElement)(item[key])) {
1878
1939
  validKeys.add(key);
1879
1940
  }
1880
1941
  }
1881
1942
  }
1882
1943
  return Array.from(validKeys);
1883
1944
  }, [mappedData]);
1884
- const [searchQuery, setSearchQuery] = (0, import_react14.useState)(field.initialQuery || "");
1885
- const search = (0, import_react14.useCallback)(
1945
+ const [searchQuery, setSearchQuery] = (0, import_react15.useState)(field.initialQuery || "");
1946
+ const search = (0, import_react15.useCallback)(
1886
1947
  (query, filters2) => __async(void 0, null, function* () {
1887
1948
  setIsLoading(true);
1888
1949
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -1895,18 +1956,18 @@ var ExternalInput = ({
1895
1956
  }),
1896
1957
  [id, field]
1897
1958
  );
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: [
1959
+ const Footer = (0, import_react15.useCallback)(
1960
+ (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: getClassNameModal("footer"), children: [
1900
1961
  props.items.length,
1901
1962
  " result",
1902
1963
  props.items.length === 1 ? "" : "s"
1903
1964
  ] }),
1904
1965
  [field.renderFooter]
1905
1966
  );
1906
- (0, import_react14.useEffect)(() => {
1967
+ (0, import_react15.useEffect)(() => {
1907
1968
  search(searchQuery, filters);
1908
1969
  }, []);
1909
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1970
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1910
1971
  "div",
1911
1972
  {
1912
1973
  className: getClassName10({
@@ -1916,21 +1977,21 @@ var ExternalInput = ({
1916
1977
  }),
1917
1978
  id,
1918
1979
  children: [
1919
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("actions"), children: [
1920
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1980
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("actions"), children: [
1981
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1921
1982
  "button",
1922
1983
  {
1923
1984
  type: "button",
1924
1985
  onClick: () => setOpen(true),
1925
1986
  className: getClassName10("button"),
1926
1987
  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 })
1988
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1989
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: "16" }),
1990
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: field.placeholder })
1930
1991
  ] })
1931
1992
  }
1932
1993
  ),
1933
- value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1994
+ value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1934
1995
  "button",
1935
1996
  {
1936
1997
  type: "button",
@@ -1939,11 +2000,11 @@ var ExternalInput = ({
1939
2000
  onChange(null);
1940
2001
  },
1941
2002
  disabled: readOnly,
1942
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LockOpen, { size: 16 })
2003
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LockOpen, { size: 16 })
1943
2004
  }
1944
2005
  )
1945
2006
  ] }),
1946
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2007
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1947
2008
  "form",
1948
2009
  {
1949
2010
  className: getClassNameModal({
@@ -1957,11 +2018,11 @@ var ExternalInput = ({
1957
2018
  search(searchQuery, filters);
1958
2019
  },
1959
2020
  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)(
2021
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
2022
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: getClassNameModal("search"), children: [
2023
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
2024
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Search, { size: "18" }) }),
2025
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1965
2026
  "input",
1966
2027
  {
1967
2028
  className: getClassNameModal("searchInput"),
@@ -1976,9 +2037,9 @@ var ExternalInput = ({
1976
2037
  }
1977
2038
  )
1978
2039
  ] }),
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)(
2040
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
2041
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
2042
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1982
2043
  IconButton,
1983
2044
  {
1984
2045
  title: "Toggle filters",
@@ -1987,15 +2048,15 @@ var ExternalInput = ({
1987
2048
  e.stopPropagation();
1988
2049
  setFiltersToggled(!filtersToggled);
1989
2050
  },
1990
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlidersHorizontal, { size: 20 })
2051
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlidersHorizontal, { size: 20 })
1991
2052
  }
1992
2053
  ) })
1993
2054
  ] })
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) => {
2055
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
2056
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("grid"), children: [
2057
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1997
2058
  const filterField = filterFields[fieldName];
1998
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2059
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1999
2060
  AutoFieldPrivate,
2000
2061
  {
2001
2062
  field: filterField,
@@ -2012,9 +2073,9 @@ var ExternalInput = ({
2012
2073
  fieldName
2013
2074
  );
2014
2075
  }) }),
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)(
2076
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
2077
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: getClassNameModal("table"), children: [
2078
+ /* @__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
2079
  "th",
2019
2080
  {
2020
2081
  className: getClassNameModal("th"),
@@ -2023,8 +2084,8 @@ var ExternalInput = ({
2023
2084
  },
2024
2085
  key
2025
2086
  )) }) }),
2026
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
2027
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2087
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
2088
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2028
2089
  "tr",
2029
2090
  {
2030
2091
  style: { whiteSpace: "nowrap" },
@@ -2033,16 +2094,16 @@ var ExternalInput = ({
2033
2094
  onChange(mapProp(data[i]));
2034
2095
  setOpen(false);
2035
2096
  },
2036
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
2097
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
2037
2098
  },
2038
2099
  i
2039
2100
  );
2040
2101
  }) })
2041
2102
  ] }),
2042
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Loader, { size: 24 }) })
2103
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 24 }) })
2043
2104
  ] })
2044
2105
  ] }),
2045
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Footer, { items: mappedData }) })
2106
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Footer, { items: mappedData }) })
2046
2107
  ]
2047
2108
  }
2048
2109
  ) })
@@ -2052,7 +2113,7 @@ var ExternalInput = ({
2052
2113
  };
2053
2114
 
2054
2115
  // components/AutoField/fields/ExternalField/index.tsx
2055
- var import_jsx_runtime13 = require("react/jsx-runtime");
2116
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2056
2117
  var ExternalField = ({
2057
2118
  field,
2058
2119
  onChange,
@@ -2066,7 +2127,7 @@ var ExternalField = ({
2066
2127
  var _a, _b, _c;
2067
2128
  const validField = field;
2068
2129
  const deprecatedField = field;
2069
- (0, import_react15.useEffect)(() => {
2130
+ (0, import_react16.useEffect)(() => {
2070
2131
  if (deprecatedField.adaptor) {
2071
2132
  console.error(
2072
2133
  "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 +2137,7 @@ var ExternalField = ({
2076
2137
  if (field.type !== "external") {
2077
2138
  return null;
2078
2139
  }
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)(
2140
+ 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
2141
  ExternalInput,
2081
2142
  {
2082
2143
  name,
@@ -2101,7 +2162,7 @@ var ExternalField = ({
2101
2162
 
2102
2163
  // components/AutoField/fields/RadioField/index.tsx
2103
2164
  init_react_import();
2104
- var import_react16 = require("react");
2165
+ var import_react17 = require("react");
2105
2166
 
2106
2167
  // lib/safe-json-parse.ts
2107
2168
  init_react_import();
@@ -2115,7 +2176,7 @@ var safeJsonParse = (str) => {
2115
2176
  };
2116
2177
 
2117
2178
  // components/AutoField/fields/RadioField/index.tsx
2118
- var import_jsx_runtime14 = require("react/jsx-runtime");
2179
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2119
2180
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
2120
2181
  var RadioField = ({
2121
2182
  field,
@@ -2127,26 +2188,26 @@ var RadioField = ({
2127
2188
  label,
2128
2189
  Label: Label2
2129
2190
  }) => {
2130
- const flatOptions = (0, import_react16.useMemo)(
2191
+ const flatOptions = (0, import_react17.useMemo)(
2131
2192
  () => field.type === "radio" ? field.options.map(({ value: value2 }) => value2) : [],
2132
2193
  [field]
2133
2194
  );
2134
2195
  if (field.type !== "radio" || !field.options) {
2135
2196
  return null;
2136
2197
  }
2137
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2198
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2138
2199
  Label2,
2139
2200
  {
2140
- icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
2201
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CircleCheckBig, { size: 16 }),
2141
2202
  label: label || name,
2142
2203
  readOnly,
2143
2204
  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)(
2205
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2145
2206
  "label",
2146
2207
  {
2147
2208
  className: getClassName11("radio"),
2148
2209
  children: [
2149
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2210
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2150
2211
  "input",
2151
2212
  {
2152
2213
  type: "radio",
@@ -2166,7 +2227,7 @@ var RadioField = ({
2166
2227
  checked: value === option.value
2167
2228
  }
2168
2229
  ),
2169
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2230
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
2170
2231
  ]
2171
2232
  },
2172
2233
  option.label + option.value
@@ -2177,8 +2238,8 @@ var RadioField = ({
2177
2238
 
2178
2239
  // components/AutoField/fields/SelectField/index.tsx
2179
2240
  init_react_import();
2180
- var import_react17 = require("react");
2181
- var import_jsx_runtime15 = require("react/jsx-runtime");
2241
+ var import_react18 = require("react");
2242
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2182
2243
  var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
2183
2244
  var SelectField = ({
2184
2245
  field,
@@ -2190,20 +2251,20 @@ var SelectField = ({
2190
2251
  readOnly,
2191
2252
  id
2192
2253
  }) => {
2193
- const flatOptions = (0, import_react17.useMemo)(
2254
+ const flatOptions = (0, import_react18.useMemo)(
2194
2255
  () => field.type === "select" ? field.options.map(({ value: value2 }) => value2) : [],
2195
2256
  [field]
2196
2257
  );
2197
2258
  if (field.type !== "select" || !field.options) {
2198
2259
  return null;
2199
2260
  }
2200
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2261
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2201
2262
  Label2,
2202
2263
  {
2203
2264
  label: label || name,
2204
- icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
2265
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDown, { size: 16 }),
2205
2266
  readOnly,
2206
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2267
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2207
2268
  "select",
2208
2269
  {
2209
2270
  id,
@@ -2220,7 +2281,7 @@ var SelectField = ({
2220
2281
  }
2221
2282
  },
2222
2283
  value,
2223
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2284
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2224
2285
  "option",
2225
2286
  {
2226
2287
  label: option.label,
@@ -2236,7 +2297,7 @@ var SelectField = ({
2236
2297
 
2237
2298
  // components/AutoField/fields/TextareaField/index.tsx
2238
2299
  init_react_import();
2239
- var import_jsx_runtime16 = require("react/jsx-runtime");
2300
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2240
2301
  var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
2241
2302
  var TextareaField = ({
2242
2303
  onChange,
@@ -2247,7 +2308,7 @@ var TextareaField = ({
2247
2308
  Label: Label2,
2248
2309
  id
2249
2310
  }) => {
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)(
2311
+ 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
2312
  "textarea",
2252
2313
  {
2253
2314
  id,
@@ -2274,7 +2335,7 @@ init_react_import();
2274
2335
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2275
2336
 
2276
2337
  // components/AutoField/fields/ObjectField/index.tsx
2277
- var import_jsx_runtime17 = require("react/jsx-runtime");
2338
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2278
2339
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2279
2340
  var ObjectField = ({
2280
2341
  field,
@@ -2286,43 +2347,54 @@ var ObjectField = ({
2286
2347
  readOnly,
2287
2348
  id
2288
2349
  }) => {
2289
- const { selectedItem } = useAppContext();
2350
+ const { readOnlyFields, localName = name } = useNestedFieldContext();
2290
2351
  if (field.type !== "object" || !field.objectFields) {
2291
2352
  return null;
2292
2353
  }
2293
- const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
2294
2354
  const data = value || {};
2295
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2355
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2296
2356
  Label2,
2297
2357
  {
2298
2358
  label: label || name,
2299
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
2359
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EllipsisVertical, { size: 16 }),
2300
2360
  el: "div",
2301
2361
  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,
2362
+ 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) => {
2363
+ const subField = field.objectFields[subName];
2364
+ const subPath = `${name}.${subName}`;
2365
+ const localSubPath = `${localName || name}.${subName}`;
2366
+ const subReadOnly = readOnly ? readOnly : readOnlyFields[localSubPath];
2367
+ const label2 = subField.label || subName;
2368
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2369
+ NestedFieldProvider,
2309
2370
  {
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
2371
+ name: localName || id,
2372
+ subName,
2373
+ readOnlyFields,
2374
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2375
+ AutoFieldPrivate,
2376
+ {
2377
+ name: subPath,
2378
+ label: subPath,
2379
+ id: `${id}_${subName}`,
2380
+ readOnly: subReadOnly,
2381
+ field: __spreadProps(__spreadValues({}, subField), {
2382
+ label: label2
2383
+ // May be used by custom fields
2320
2384
  }),
2321
- ui
2322
- );
2323
- }
2385
+ value: data[subName],
2386
+ onChange: (val, ui) => {
2387
+ onChange(
2388
+ __spreadProps(__spreadValues({}, data), {
2389
+ [subName]: val
2390
+ }),
2391
+ ui
2392
+ );
2393
+ }
2394
+ }
2395
+ )
2324
2396
  },
2325
- subFieldName
2397
+ subPath
2326
2398
  );
2327
2399
  }) }) })
2328
2400
  }
@@ -2331,7 +2403,7 @@ var ObjectField = ({
2331
2403
 
2332
2404
  // lib/use-safe-id.ts
2333
2405
  init_react_import();
2334
- var import_react18 = __toESM(require("react"));
2406
+ var import_react19 = __toESM(require("react"));
2335
2407
 
2336
2408
  // lib/generate-id.ts
2337
2409
  init_react_import();
@@ -2340,15 +2412,15 @@ var generateId = (type) => type ? `${type}-${(0, import_uuid.v4)()}` : (0, impor
2340
2412
 
2341
2413
  // lib/use-safe-id.ts
2342
2414
  var useSafeId = () => {
2343
- if (typeof import_react18.default.useId !== "undefined") {
2344
- return import_react18.default.useId();
2415
+ if (typeof import_react19.default.useId !== "undefined") {
2416
+ return import_react19.default.useId();
2345
2417
  }
2346
- const [id] = (0, import_react18.useState)(generateId());
2418
+ const [id] = (0, import_react19.useState)(generateId());
2347
2419
  return id;
2348
2420
  };
2349
2421
 
2350
2422
  // components/AutoField/index.tsx
2351
- var import_jsx_runtime18 = require("react/jsx-runtime");
2423
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2352
2424
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
2353
2425
  var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default2);
2354
2426
  var FieldLabel = ({
@@ -2360,16 +2432,16 @@ var FieldLabel = ({
2360
2432
  className
2361
2433
  }) => {
2362
2434
  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, {}),
2435
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(El, { className, children: [
2436
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName15("label"), children: [
2437
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {}),
2366
2438
  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" }) })
2439
+ 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
2440
  ] }),
2369
2441
  children
2370
2442
  ] });
2371
2443
  };
2372
- var FieldLabelInternal2 = ({
2444
+ var FieldLabelInternal = ({
2373
2445
  children,
2374
2446
  icon,
2375
2447
  label,
@@ -2377,14 +2449,14 @@ var FieldLabelInternal2 = ({
2377
2449
  readOnly
2378
2450
  }) => {
2379
2451
  const { overrides } = useAppContext();
2380
- const Wrapper = (0, import_react19.useMemo)(
2452
+ const Wrapper = (0, import_react20.useMemo)(
2381
2453
  () => overrides.fieldLabel || FieldLabel,
2382
2454
  [overrides]
2383
2455
  );
2384
2456
  if (!label) {
2385
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
2457
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
2386
2458
  }
2387
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2459
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2388
2460
  Wrapper,
2389
2461
  {
2390
2462
  label,
@@ -2398,8 +2470,8 @@ var FieldLabelInternal2 = ({
2398
2470
  };
2399
2471
  function AutoFieldInternal(props) {
2400
2472
  var _a, _b, _c, _d, _e, _f, _g, _h;
2401
- const { dispatch, overrides } = useAppContext();
2402
- const { id, Label: Label2 = FieldLabelInternal2 } = props;
2473
+ const { dispatch, overrides, selectedItem } = useAppContext();
2474
+ const { id, Label: Label2 = FieldLabelInternal } = props;
2403
2475
  const field = props.field;
2404
2476
  const label = field.label;
2405
2477
  const defaultId = useSafeId();
@@ -2430,7 +2502,7 @@ function AutoFieldInternal(props) {
2430
2502
  Label: Label2,
2431
2503
  id: resolvedId
2432
2504
  });
2433
- const onFocus = (0, import_react19.useCallback)(
2505
+ const onFocus = (0, import_react20.useCallback)(
2434
2506
  (e) => {
2435
2507
  if (mergedProps.name && e.target.nodeName === "INPUT") {
2436
2508
  e.stopPropagation();
@@ -2444,7 +2516,7 @@ function AutoFieldInternal(props) {
2444
2516
  },
2445
2517
  [mergedProps.name]
2446
2518
  );
2447
- const onBlur = (0, import_react19.useCallback)((e) => {
2519
+ const onBlur = (0, import_react20.useCallback)((e) => {
2448
2520
  if ("name" in e.target) {
2449
2521
  dispatch({
2450
2522
  type: "setUi",
@@ -2459,27 +2531,37 @@ function AutoFieldInternal(props) {
2459
2531
  return null;
2460
2532
  }
2461
2533
  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)) }) });
2534
+ 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
2535
  }
2464
2536
  const children = defaultFields[field.type](mergedProps);
2465
2537
  const Render2 = render[field.type];
2466
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2467
- "div",
2538
+ const nestedFieldContext = (0, import_react20.useContext)(NestedFieldContext);
2539
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2540
+ NestedFieldContext.Provider,
2468
2541
  {
2469
- className: getClassNameWrapper(),
2470
- onFocus,
2471
- onBlur,
2472
- onClick: (e) => {
2473
- e.stopPropagation();
2542
+ value: {
2543
+ readOnlyFields: nestedFieldContext.readOnlyFields || (selectedItem == null ? void 0 : selectedItem.readOnly) || {},
2544
+ localName: nestedFieldContext.localName
2474
2545
  },
2475
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2546
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2547
+ "div",
2548
+ {
2549
+ className: getClassNameWrapper(),
2550
+ onFocus,
2551
+ onBlur,
2552
+ onClick: (e) => {
2553
+ e.stopPropagation();
2554
+ },
2555
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }))
2556
+ }
2557
+ )
2476
2558
  }
2477
2559
  );
2478
2560
  }
2479
2561
  function AutoFieldPrivate(props) {
2480
2562
  const { state } = useAppContext();
2481
2563
  const { value, onChange } = props;
2482
- const [localValue, setLocalValue] = (0, import_react19.useState)(value);
2564
+ const [localValue, setLocalValue] = (0, import_react20.useState)(value);
2483
2565
  const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
2484
2566
  (val, ui) => {
2485
2567
  onChange(val, ui);
@@ -2487,11 +2569,11 @@ function AutoFieldPrivate(props) {
2487
2569
  50,
2488
2570
  { leading: true }
2489
2571
  );
2490
- const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
2572
+ const onChangeLocal = (0, import_react20.useCallback)((val, ui) => {
2491
2573
  setLocalValue(val);
2492
2574
  onChangeDb(val, ui);
2493
2575
  }, []);
2494
- (0, import_react19.useEffect)(() => {
2576
+ (0, import_react20.useEffect)(() => {
2495
2577
  if (state.ui.field.focus !== props.name) {
2496
2578
  setLocalValue(value);
2497
2579
  }
@@ -2500,11 +2582,11 @@ function AutoFieldPrivate(props) {
2500
2582
  value: localValue,
2501
2583
  onChange: onChangeLocal
2502
2584
  };
2503
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2585
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2504
2586
  }
2505
2587
  function AutoField(props) {
2506
- const DefaultLabel = (0, import_react19.useMemo)(() => {
2507
- const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2588
+ const DefaultLabel = (0, import_react20.useMemo)(() => {
2589
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2508
2590
  "div",
2509
2591
  __spreadProps(__spreadValues({}, labelProps), {
2510
2592
  className: getClassName15({ readOnly: props.readOnly })
@@ -2512,7 +2594,7 @@ function AutoField(props) {
2512
2594
  );
2513
2595
  return DefaultLabel2;
2514
2596
  }, [props.readOnly]);
2515
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2597
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2516
2598
  }
2517
2599
 
2518
2600
  // components/Drawer/index.tsx
@@ -2523,64 +2605,38 @@ init_react_import();
2523
2605
  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
2606
 
2525
2607
  // components/Drawer/index.tsx
2526
- var import_react27 = require("react");
2608
+ var import_react32 = require("react");
2527
2609
 
2528
2610
  // components/DragDropContext/index.tsx
2529
2611
  init_react_import();
2530
- var import_react25 = require("@dnd-kit/react");
2531
- var import_react26 = require("react");
2612
+ var import_react30 = require("@dnd-kit/react");
2613
+ var import_react31 = require("react");
2532
2614
  var import_dom = require("@dnd-kit/dom");
2533
2615
 
2534
2616
  // components/DropZone/index.tsx
2535
2617
  init_react_import();
2536
- var import_react24 = require("react");
2618
+ var import_react29 = require("react");
2537
2619
 
2538
2620
  // components/DraggableComponent/index.tsx
2539
2621
  init_react_import();
2540
- var import_react21 = require("react");
2622
+ var import_react23 = require("react");
2541
2623
 
2542
2624
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
2543
2625
  init_react_import();
2544
2626
  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
2627
 
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
2628
  // components/DraggableComponent/index.tsx
2573
2629
  var import_react_dom2 = require("react-dom");
2574
2630
 
2575
- // components/DraggableComponent/collision/dynamic/index.ts
2631
+ // lib/dnd/collision/dynamic/index.ts
2576
2632
  init_react_import();
2577
2633
  var import_abstract8 = require("@dnd-kit/abstract");
2578
2634
 
2579
- // components/DraggableComponent/collision/directional/index.ts
2635
+ // lib/dnd/collision/directional/index.ts
2580
2636
  init_react_import();
2581
2637
  var import_abstract = require("@dnd-kit/abstract");
2582
2638
 
2583
- // components/DraggableComponent/collision/collision-debug.ts
2639
+ // lib/dnd/collision/collision-debug.ts
2584
2640
  init_react_import();
2585
2641
  var DEBUG = false;
2586
2642
  var debugElements = {};
@@ -2629,7 +2685,7 @@ var collisionDebug = (a, b, id, color, label) => {
2629
2685
  });
2630
2686
  };
2631
2687
 
2632
- // components/DraggableComponent/collision/directional/index.ts
2688
+ // lib/dnd/collision/directional/index.ts
2633
2689
  var distanceChange = "increasing";
2634
2690
  var directionalCollision = (input, previous) => {
2635
2691
  var _a;
@@ -2662,7 +2718,7 @@ var directionalCollision = (input, previous) => {
2662
2718
  return null;
2663
2719
  };
2664
2720
 
2665
- // components/DraggableComponent/collision/dynamic/get-direction.ts
2721
+ // lib/dnd/collision/dynamic/get-direction.ts
2666
2722
  init_react_import();
2667
2723
  var getDirection = (dragAxis, delta) => {
2668
2724
  if (dragAxis === "dynamic") {
@@ -2677,7 +2733,7 @@ var getDirection = (dragAxis, delta) => {
2677
2733
  return delta.y === 0 ? null : delta.y > 0 ? "down" : "up";
2678
2734
  };
2679
2735
 
2680
- // components/DraggableComponent/collision/dynamic/get-midpoint-impact.ts
2736
+ // lib/dnd/collision/dynamic/get-midpoint-impact.ts
2681
2737
  init_react_import();
2682
2738
  var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0) => {
2683
2739
  const dragRect = dragShape.boundingRectangle;
@@ -2696,7 +2752,7 @@ var getMidpointImpact = (dragShape, dropShape, direction, offsetMultiplier = 0)
2696
2752
  return dragRect.right - offset >= dropCenter.x;
2697
2753
  };
2698
2754
 
2699
- // components/DraggableComponent/collision/dynamic/track-movement-interval.ts
2755
+ // lib/dnd/collision/dynamic/track-movement-interval.ts
2700
2756
  init_react_import();
2701
2757
  var import_geometry = require("@dnd-kit/geometry");
2702
2758
  var INTERVAL_SENSITIVITY = 10;
@@ -2800,7 +2856,14 @@ var closestCorners = (input) => {
2800
2856
  };
2801
2857
  };
2802
2858
 
2803
- // components/DraggableComponent/collision/dynamic/index.ts
2859
+ // lib/dnd/collision/dynamic/store.ts
2860
+ init_react_import();
2861
+ var import_vanilla = require("zustand/vanilla");
2862
+ var collisionStore = (0, import_vanilla.createStore)(() => ({
2863
+ fallbackEnabled: false
2864
+ }));
2865
+
2866
+ // lib/dnd/collision/dynamic/index.ts
2804
2867
  var flushNext = "";
2805
2868
  var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input) => {
2806
2869
  var _a, _b, _c, _d, _e;
@@ -2812,6 +2875,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2812
2875
  return null;
2813
2876
  }
2814
2877
  const { center: dragCenter } = dragShape;
2878
+ const { fallbackEnabled } = collisionStore.getState();
2815
2879
  const interval = trackMovementInterval(position.current, dragAxis);
2816
2880
  dragOperation.data = __spreadProps(__spreadValues({}, dragOperation.data), {
2817
2881
  direction: interval.direction
@@ -2857,7 +2921,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2857
2921
  flushNext = "";
2858
2922
  return __spreadProps(__spreadValues({}, collision), { id: shouldFlushId ? "flush" : collision.id });
2859
2923
  }
2860
- if (((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2924
+ if (fallbackEnabled && ((_c = dragOperation.source) == null ? void 0 : _c.id) !== droppable.id) {
2861
2925
  const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
2862
2926
  const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
2863
2927
  if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
@@ -2918,8 +2982,102 @@ function getDeepScrollPosition(element) {
2918
2982
  return totalScroll;
2919
2983
  }
2920
2984
 
2985
+ // components/DropZone/context.tsx
2986
+ init_react_import();
2987
+ var import_react21 = require("react");
2988
+ var import_zustand = require("zustand");
2989
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2990
+ var dropZoneContext = (0, import_react21.createContext)(null);
2991
+ var ZoneStoreContext = (0, import_react21.createContext)(
2992
+ (0, import_zustand.createStore)(() => ({
2993
+ zoneDepthIndex: {},
2994
+ nextZoneDepthIndex: {},
2995
+ areaDepthIndex: {},
2996
+ nextAreaDepthIndex: {},
2997
+ draggedItem: null,
2998
+ previewIndex: {}
2999
+ }))
3000
+ );
3001
+ var ZoneStoreProvider = ({
3002
+ children,
3003
+ store
3004
+ }) => {
3005
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ZoneStoreContext.Provider, { value: store, children });
3006
+ };
3007
+ var DropZoneProvider = ({
3008
+ children,
3009
+ value
3010
+ }) => {
3011
+ const [hoveringComponent, setHoveringComponent] = (0, import_react21.useState)();
3012
+ const [areasWithZones, setAreasWithZones] = (0, import_react21.useState)(
3013
+ {}
3014
+ );
3015
+ const [activeZones, setActiveZones] = (0, import_react21.useState)({});
3016
+ const { dispatch } = useAppContext();
3017
+ const registerZoneArea = (0, import_react21.useCallback)(
3018
+ (area) => {
3019
+ setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
3020
+ },
3021
+ [setAreasWithZones]
3022
+ );
3023
+ const registerZone = (0, import_react21.useCallback)(
3024
+ (zoneCompound) => {
3025
+ if (!dispatch) {
3026
+ return;
3027
+ }
3028
+ dispatch({
3029
+ type: "registerZone",
3030
+ zone: zoneCompound
3031
+ });
3032
+ setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), { [zoneCompound]: true }));
3033
+ },
3034
+ [setActiveZones, dispatch]
3035
+ );
3036
+ const unregisterZone = (0, import_react21.useCallback)(
3037
+ (zoneCompound) => {
3038
+ if (!dispatch) {
3039
+ return;
3040
+ }
3041
+ dispatch({
3042
+ type: "unregisterZone",
3043
+ zone: zoneCompound
3044
+ });
3045
+ setActiveZones((latest) => __spreadProps(__spreadValues({}, latest), {
3046
+ [zoneCompound]: false
3047
+ }));
3048
+ },
3049
+ [setActiveZones, dispatch]
3050
+ );
3051
+ const memoValue = (0, import_react21.useMemo)(
3052
+ () => __spreadValues({
3053
+ hoveringComponent,
3054
+ setHoveringComponent,
3055
+ registerZoneArea,
3056
+ areasWithZones,
3057
+ registerZone,
3058
+ unregisterZone,
3059
+ activeZones
3060
+ }, value),
3061
+ [value, hoveringComponent, areasWithZones, activeZones]
3062
+ );
3063
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
3064
+ };
3065
+
3066
+ // lib/use-context-store.ts
3067
+ init_react_import();
3068
+ var import_react22 = require("react");
3069
+ var import_zustand2 = require("zustand");
3070
+ var import_shallow = require("zustand/react/shallow");
3071
+ function useContextStore(context, selector) {
3072
+ const store = (0, import_react22.useContext)(context);
3073
+ if (!store) {
3074
+ throw new Error("useContextStore must be used inside context");
3075
+ }
3076
+ return (0, import_zustand2.useStore)(store, (0, import_shallow.useShallow)(selector));
3077
+ }
3078
+
2921
3079
  // components/DraggableComponent/index.tsx
2922
- var import_jsx_runtime19 = require("react/jsx-runtime");
3080
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2923
3081
  var getClassName16 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
2924
3082
  var DEBUG2 = false;
2925
3083
  var space = 8;
@@ -2930,12 +3088,12 @@ var DefaultActionBar = ({
2930
3088
  label,
2931
3089
  children,
2932
3090
  parentAction
2933
- }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ActionBar, { children: [
2934
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ActionBar.Group, { children: [
3091
+ }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar, { children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ActionBar.Group, { children: [
2935
3093
  parentAction,
2936
- label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Label, { label })
3094
+ label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Label, { label })
2937
3095
  ] }),
2938
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ActionBar.Group, { children })
3096
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Group, { children })
2939
3097
  ] });
2940
3098
  var convertIdToSelector = (id, zoneCompound, data) => {
2941
3099
  const content = zoneCompound && data.zones && zoneCompound !== "default-zone" ? data.zones[zoneCompound] : data.content;
@@ -2970,10 +3128,9 @@ var DraggableComponent = ({
2970
3128
  iframe,
2971
3129
  state
2972
3130
  } = 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)(
3131
+ const ctx = (0, import_react23.useContext)(dropZoneContext);
3132
+ const [localZones, setLocalZones] = (0, import_react23.useState)({});
3133
+ const registerLocalZone = (0, import_react23.useCallback)(
2977
3134
  (zoneCompound2, active) => {
2978
3135
  var _a;
2979
3136
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -2983,7 +3140,7 @@ var DraggableComponent = ({
2983
3140
  },
2984
3141
  [setLocalZones]
2985
3142
  );
2986
- const unregisterLocalZone = (0, import_react21.useCallback)(
3143
+ const unregisterLocalZone = (0, import_react23.useCallback)(
2987
3144
  (zoneCompound2) => {
2988
3145
  var _a;
2989
3146
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -2997,8 +3154,8 @@ var DraggableComponent = ({
2997
3154
  );
2998
3155
  const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
2999
3156
  const { path = [] } = ctx || {};
3000
- const [canDrag, setCanDrag] = (0, import_react21.useState)(false);
3001
- (0, import_react21.useEffect)(() => {
3157
+ const [canDrag, setCanDrag] = (0, import_react23.useState)(false);
3158
+ (0, import_react23.useEffect)(() => {
3002
3159
  var _a;
3003
3160
  const item = getItem({ index, zone: zoneCompound }, state.data);
3004
3161
  if (item) {
@@ -3008,10 +3165,13 @@ var DraggableComponent = ({
3008
3165
  setCanDrag((_a = perms.drag) != null ? _a : true);
3009
3166
  }
3010
3167
  }, [state, index, zoneCompound, getPermissions]);
3011
- const userIsDragging = !!(ctx == null ? void 0 : ctx.draggedItem);
3168
+ const userIsDragging = useContextStore(
3169
+ ZoneStoreContext,
3170
+ (s) => !!s.draggedItem
3171
+ );
3012
3172
  const canCollide = canDrag || userIsDragging;
3013
3173
  const disabled = !isEnabled || !canCollide;
3014
- const [dragAxis, setDragAxis] = (0, import_react21.useState)(userDragAxis || autoDragAxis);
3174
+ const [dragAxis, setDragAxis] = (0, import_react23.useState)(userDragAxis || autoDragAxis);
3015
3175
  const { ref: sortableRef, status } = useSortableSafe({
3016
3176
  id,
3017
3177
  index,
@@ -3037,8 +3197,8 @@ var DraggableComponent = ({
3037
3197
  }
3038
3198
  });
3039
3199
  const thisIsDragging = status === "dragging";
3040
- const ref = (0, import_react21.useRef)(null);
3041
- const refSetter = (0, import_react21.useCallback)(
3200
+ const ref = (0, import_react23.useRef)(null);
3201
+ const refSetter = (0, import_react23.useCallback)(
3042
3202
  (el) => {
3043
3203
  sortableRef(el);
3044
3204
  if (el) {
@@ -3047,14 +3207,14 @@ var DraggableComponent = ({
3047
3207
  },
3048
3208
  [sortableRef]
3049
3209
  );
3050
- const [portalEl, setPortalEl] = (0, import_react21.useState)();
3051
- (0, import_react21.useEffect)(() => {
3210
+ const [portalEl, setPortalEl] = (0, import_react23.useState)();
3211
+ (0, import_react23.useEffect)(() => {
3052
3212
  var _a, _b, _c;
3053
3213
  setPortalEl(
3054
3214
  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
3215
  );
3056
3216
  }, [iframe.enabled, ref.current]);
3057
- const getStyle = (0, import_react21.useCallback)(() => {
3217
+ const getStyle = (0, import_react23.useCallback)(() => {
3058
3218
  var _a, _b, _c;
3059
3219
  if (!ref.current) return;
3060
3220
  const rect = ref.current.getBoundingClientRect();
@@ -3074,11 +3234,11 @@ var DraggableComponent = ({
3074
3234
  };
3075
3235
  return style2;
3076
3236
  }, [ref.current]);
3077
- const [style, setStyle] = (0, import_react21.useState)();
3078
- const sync = (0, import_react21.useCallback)(() => {
3237
+ const [style, setStyle] = (0, import_react23.useState)();
3238
+ const sync = (0, import_react23.useCallback)(() => {
3079
3239
  setStyle(getStyle());
3080
3240
  }, [ref.current, iframe]);
3081
- (0, import_react21.useEffect)(() => {
3241
+ (0, import_react23.useEffect)(() => {
3082
3242
  if (ref.current) {
3083
3243
  const observer = new ResizeObserver(sync);
3084
3244
  observer.observe(ref.current);
@@ -3087,20 +3247,22 @@ var DraggableComponent = ({
3087
3247
  };
3088
3248
  }
3089
3249
  }, [ref.current]);
3090
- (0, import_react21.useEffect)(() => {
3091
- ctx == null ? void 0 : ctx.registerPath({
3092
- index,
3093
- zone: zoneCompound
3094
- });
3250
+ (0, import_react23.useEffect)(() => {
3251
+ if (isSelected) {
3252
+ ctx == null ? void 0 : ctx.registerPath({
3253
+ index,
3254
+ zone: zoneCompound
3255
+ });
3256
+ }
3095
3257
  }, [isSelected]);
3096
- const CustomActionBar = (0, import_react21.useMemo)(
3258
+ const CustomActionBar = (0, import_react23.useMemo)(
3097
3259
  () => overrides.actionBar || DefaultActionBar,
3098
3260
  [overrides.actionBar]
3099
3261
  );
3100
3262
  const permissions = getPermissions({
3101
3263
  item: selectedItem
3102
3264
  });
3103
- const onClick = (0, import_react21.useCallback)(
3265
+ const onClick = (0, import_react23.useCallback)(
3104
3266
  (e) => {
3105
3267
  e.stopPropagation();
3106
3268
  dispatch({
@@ -3112,7 +3274,7 @@ var DraggableComponent = ({
3112
3274
  },
3113
3275
  [index, zoneCompound, id]
3114
3276
  );
3115
- const onSelectParent = (0, import_react21.useCallback)(() => {
3277
+ const onSelectParent = (0, import_react23.useCallback)(() => {
3116
3278
  if (!(ctx == null ? void 0 : ctx.areaId)) {
3117
3279
  return;
3118
3280
  }
@@ -3130,23 +3292,23 @@ var DraggableComponent = ({
3130
3292
  }
3131
3293
  });
3132
3294
  }, [ctx, path]);
3133
- const onDuplicate = (0, import_react21.useCallback)(() => {
3295
+ const onDuplicate = (0, import_react23.useCallback)(() => {
3134
3296
  dispatch({
3135
3297
  type: "duplicate",
3136
3298
  sourceIndex: index,
3137
3299
  sourceZone: zoneCompound
3138
3300
  });
3139
3301
  }, [index, zoneCompound]);
3140
- const onDelete = (0, import_react21.useCallback)(() => {
3302
+ const onDelete = (0, import_react23.useCallback)(() => {
3141
3303
  dispatch({
3142
3304
  type: "remove",
3143
3305
  index,
3144
3306
  zone: zoneCompound
3145
3307
  });
3146
3308
  }, [index, zoneCompound]);
3147
- const [hover, setHover] = (0, import_react21.useState)(false);
3309
+ const [hover, setHover] = (0, import_react23.useState)(false);
3148
3310
  const indicativeHover = (ctx == null ? void 0 : ctx.hoveringComponent) === id;
3149
- (0, import_react21.useEffect)(() => {
3311
+ (0, import_react23.useEffect)(() => {
3150
3312
  if (!ref.current) {
3151
3313
  return;
3152
3314
  }
@@ -3196,7 +3358,7 @@ var DraggableComponent = ({
3196
3358
  thisIsDragging,
3197
3359
  inDroppableZone
3198
3360
  ]);
3199
- (0, import_react21.useEffect)(() => {
3361
+ (0, import_react23.useEffect)(() => {
3200
3362
  if (ref.current && disabled) {
3201
3363
  ref.current.setAttribute("data-puck-disabled", "");
3202
3364
  return () => {
@@ -3205,8 +3367,8 @@ var DraggableComponent = ({
3205
3367
  };
3206
3368
  }
3207
3369
  }, [disabled, ref]);
3208
- const [isVisible, setIsVisible] = (0, import_react21.useState)(false);
3209
- (0, import_react21.useEffect)(() => {
3370
+ const [isVisible, setIsVisible] = (0, import_react23.useState)(false);
3371
+ (0, import_react23.useEffect)(() => {
3210
3372
  sync();
3211
3373
  if ((isSelected || hover || indicativeHover) && !userIsDragging) {
3212
3374
  setIsVisible(true);
@@ -3214,7 +3376,7 @@ var DraggableComponent = ({
3214
3376
  setIsVisible(false);
3215
3377
  }
3216
3378
  }, [isSelected, hover, indicativeHover, iframe, state.data, userIsDragging]);
3217
- const syncActionsPosition = (0, import_react21.useCallback)(
3379
+ const syncActionsPosition = (0, import_react23.useCallback)(
3218
3380
  (el) => {
3219
3381
  if (el) {
3220
3382
  const view = el.ownerDocument.defaultView;
@@ -3231,7 +3393,7 @@ var DraggableComponent = ({
3231
3393
  },
3232
3394
  [zoomConfig]
3233
3395
  );
3234
- (0, import_react21.useEffect)(() => {
3396
+ (0, import_react23.useEffect)(() => {
3235
3397
  if (userDragAxis) {
3236
3398
  setDragAxis(userDragAxis);
3237
3399
  return;
@@ -3245,8 +3407,8 @@ var DraggableComponent = ({
3245
3407
  }
3246
3408
  setDragAxis(autoDragAxis);
3247
3409
  }, [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)(
3410
+ 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 }) });
3411
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3250
3412
  DropZoneProvider,
3251
3413
  {
3252
3414
  value: __spreadProps(__spreadValues({}, ctx), {
@@ -3260,28 +3422,27 @@ var DraggableComponent = ({
3260
3422
  }),
3261
3423
  children: [
3262
3424
  isVisible && (0, import_react_dom2.createPortal)(
3263
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3425
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3264
3426
  "div",
3265
3427
  {
3266
3428
  className: getClassName16({
3267
3429
  isSelected,
3268
3430
  isDragging: thisIsDragging,
3269
- isModifierHeld,
3270
3431
  hover: hover || indicativeHover
3271
3432
  }),
3272
3433
  style: __spreadValues({}, style),
3273
3434
  "data-puck-overlay": true,
3274
3435
  children: [
3275
3436
  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)(
3437
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader, {}) }),
3438
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3278
3439
  "div",
3279
3440
  {
3280
3441
  className: getClassName16("actionsOverlay"),
3281
3442
  style: {
3282
3443
  top: actionsOverlayTop / zoomConfig.zoom
3283
3444
  },
3284
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3445
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3285
3446
  "div",
3286
3447
  {
3287
3448
  className: getClassName16("actions"),
@@ -3293,14 +3454,14 @@ var DraggableComponent = ({
3293
3454
  paddingRight: actionsSide
3294
3455
  },
3295
3456
  ref: syncActionsPosition,
3296
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3457
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3297
3458
  CustomActionBar,
3298
3459
  {
3299
3460
  parentAction,
3300
3461
  label: DEBUG2 ? id : label,
3301
3462
  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 }) })
3463
+ permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Copy, { size: 16 }) }),
3464
+ 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
3465
  ]
3305
3466
  }
3306
3467
  )
@@ -3308,7 +3469,7 @@ var DraggableComponent = ({
3308
3469
  )
3309
3470
  }
3310
3471
  ),
3311
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("overlay") })
3472
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName16("overlay") })
3312
3473
  ]
3313
3474
  }
3314
3475
  ),
@@ -3324,96 +3485,29 @@ var DraggableComponent = ({
3324
3485
  init_react_import();
3325
3486
  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
3487
 
3327
- // components/DropZone/context.tsx
3488
+ // components/DropZone/lib/use-min-empty-height.ts
3328
3489
  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
3490
+ var import_react24 = require("react");
3491
+ var useMinEmptyHeight = ({
3492
+ zoneCompound,
3493
+ userMinEmptyHeight,
3494
+ ref
3335
3495
  }) => {
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);
3496
+ const [prevHeight, setPrevHeight] = (0, import_react24.useState)(0);
3497
+ const [isAnimating, setIsAnimating] = (0, import_react24.useState)(false);
3498
+ const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
3499
+ var _a, _b;
3500
+ return {
3501
+ draggedItem: ((_a = s.draggedItem) == null ? void 0 : _a.data.zone) === zoneCompound ? s.draggedItem : null,
3502
+ isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
3503
+ };
3504
+ });
3505
+ (0, import_react24.useEffect)(() => {
3506
+ if (draggedItem && ref.current) {
3507
+ if (isZone) {
3508
+ const rect = ref.current.getBoundingClientRect();
3509
+ setPrevHeight(rect.height);
3510
+ setIsAnimating(true);
3417
3511
  return;
3418
3512
  }
3419
3513
  }
@@ -3440,14 +3534,129 @@ function assignRefs(refs, node) {
3440
3534
  });
3441
3535
  }
3442
3536
 
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;
3537
+ // components/DropZone/lib/use-content-with-preview.ts
3538
+ init_react_import();
3539
+ var import_react27 = require("react");
3540
+
3541
+ // lib/dnd/use-rendered-callback.ts
3542
+ init_react_import();
3543
+ var import_react25 = require("@dnd-kit/react");
3544
+ var import_react26 = require("react");
3545
+ function useRenderedCallback(callback, deps) {
3546
+ const manager = (0, import_react25.useDragDropManager)();
3547
+ return (0, import_react26.useCallback)(
3548
+ (...args) => __async(this, null, function* () {
3549
+ yield manager == null ? void 0 : manager.renderer.rendering;
3550
+ return callback(...args);
3551
+ }),
3552
+ [...deps, manager]
3553
+ );
3554
+ }
3555
+
3556
+ // lib/insert.ts
3557
+ init_react_import();
3558
+ var insert = (list, index, item) => {
3559
+ const result = Array.from(list);
3560
+ result.splice(index, 0, item);
3561
+ return result;
3562
+ };
3563
+
3564
+ // components/DropZone/lib/use-content-with-preview.ts
3565
+ var useContentWithPreview = (content, zoneCompound) => {
3566
+ const { draggedItemId, preview, previewExists } = useContextStore(
3567
+ ZoneStoreContext,
3568
+ (s) => {
3569
+ var _a;
3570
+ return {
3571
+ draggedItemId: (_a = s.draggedItem) == null ? void 0 : _a.id,
3572
+ preview: s.previewIndex[zoneCompound],
3573
+ previewExists: Object.keys(s.previewIndex || {}).length > 0
3574
+ };
3575
+ }
3576
+ );
3577
+ const [contentWithPreview, setContentWithPreview] = (0, import_react27.useState)(content);
3578
+ const updateContent = useRenderedCallback(
3579
+ (content2, preview2) => {
3580
+ if (preview2) {
3581
+ if (preview2.type === "insert") {
3582
+ setContentWithPreview(
3583
+ insert(
3584
+ content2.filter((item) => item.props.id !== preview2.props.id),
3585
+ preview2.index,
3586
+ {
3587
+ type: "preview",
3588
+ props: { id: preview2.props.id }
3589
+ }
3590
+ )
3591
+ );
3592
+ } else {
3593
+ setContentWithPreview(
3594
+ insert(
3595
+ content2.filter((item) => item.props.id !== preview2.props.id),
3596
+ preview2.index,
3597
+ {
3598
+ type: preview2.componentType,
3599
+ props: preview2.props
3600
+ }
3601
+ )
3602
+ );
3603
+ }
3604
+ } else {
3605
+ setContentWithPreview(
3606
+ previewExists ? content2.filter((item) => item.props.id !== draggedItemId) : content2
3607
+ );
3608
+ }
3609
+ },
3610
+ [draggedItemId, previewExists]
3611
+ );
3612
+ (0, import_react27.useEffect)(() => {
3613
+ updateContent(content, preview);
3614
+ }, [content, preview]);
3615
+ return contentWithPreview;
3616
+ };
3617
+
3618
+ // components/DropZone/lib/use-drag-axis.ts
3619
+ init_react_import();
3620
+ var import_react28 = require("react");
3447
3621
  var GRID_DRAG_AXIS = "dynamic";
3448
3622
  var FLEX_ROW_DRAG_AXIS = "x";
3449
3623
  var DEFAULT_DRAG_AXIS = "y";
3450
- var DropZoneEdit = (0, import_react24.forwardRef)(
3624
+ var useDragAxis = (ref, collisionAxis) => {
3625
+ const { status } = useAppContext();
3626
+ const [dragAxis, setDragAxis] = (0, import_react28.useState)(
3627
+ collisionAxis || DEFAULT_DRAG_AXIS
3628
+ );
3629
+ const calculateDragAxis = (0, import_react28.useCallback)(() => {
3630
+ if (ref.current) {
3631
+ const computedStyle = window.getComputedStyle(ref.current);
3632
+ if (computedStyle.display === "grid") {
3633
+ setDragAxis(GRID_DRAG_AXIS);
3634
+ } else if (computedStyle.display === "flex" && computedStyle.flexDirection === "row") {
3635
+ setDragAxis(FLEX_ROW_DRAG_AXIS);
3636
+ } else {
3637
+ setDragAxis(DEFAULT_DRAG_AXIS);
3638
+ }
3639
+ }
3640
+ }, [ref.current]);
3641
+ (0, import_react28.useEffect)(() => {
3642
+ const onViewportChange = () => {
3643
+ calculateDragAxis();
3644
+ };
3645
+ window.addEventListener("viewportchange", onViewportChange);
3646
+ return () => {
3647
+ window.removeEventListener("viewportchange", onViewportChange);
3648
+ };
3649
+ }, []);
3650
+ (0, import_react28.useEffect)(calculateDragAxis, [status, collisionAxis]);
3651
+ return [dragAxis, calculateDragAxis];
3652
+ };
3653
+
3654
+ // components/DropZone/index.tsx
3655
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3656
+ var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
3657
+ var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
3658
+ var RENDER_DEBUG = false;
3659
+ var DropZoneEdit = (0, import_react29.forwardRef)(
3451
3660
  function DropZoneEdit2({
3452
3661
  zone,
3453
3662
  allow,
@@ -3458,31 +3667,50 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3458
3667
  collisionAxis
3459
3668
  }, userRef) {
3460
3669
  const appContext2 = useAppContext();
3461
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3670
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3462
3671
  const {
3463
3672
  // These all need setting via context
3464
3673
  data,
3465
3674
  config,
3466
3675
  areaId,
3467
- draggedItem,
3468
3676
  registerZoneArea,
3469
3677
  depth,
3470
3678
  registerLocalZone,
3471
3679
  unregisterLocalZone,
3472
- deepestZone = rootDroppableId,
3473
- deepestArea,
3474
- nextDeepestArea,
3475
3680
  path = [],
3476
3681
  activeZones
3477
3682
  } = ctx;
3478
- const { itemSelector } = appContext2.state.ui;
3479
3683
  let zoneCompound = rootDroppableId;
3480
- (0, import_react24.useEffect)(() => {
3684
+ if (areaId) {
3685
+ if (zone !== rootDroppableId) {
3686
+ zoneCompound = `${areaId}:${zone}`;
3687
+ }
3688
+ }
3689
+ const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
3690
+ const {
3691
+ isDeepestZone,
3692
+ inNextDeepestArea,
3693
+ draggedComponentType,
3694
+ userIsDragging,
3695
+ preview
3696
+ } = useContextStore(ZoneStoreContext, (s) => {
3697
+ var _a, _b, _c;
3698
+ return {
3699
+ isDeepestZone: (_a = s.zoneDepthIndex[zoneCompound]) != null ? _a : false,
3700
+ inNextDeepestArea: s.nextAreaDepthIndex[areaId || ""],
3701
+ draggedItemId: (_b = s.draggedItem) == null ? void 0 : _b.id,
3702
+ draggedComponentType: (_c = s.draggedItem) == null ? void 0 : _c.data.componentType,
3703
+ userIsDragging: !!s.draggedItem,
3704
+ preview: s.previewIndex[zoneCompound]
3705
+ };
3706
+ });
3707
+ const { itemSelector } = appContext2.state.ui;
3708
+ (0, import_react29.useEffect)(() => {
3481
3709
  if (areaId && registerZoneArea) {
3482
3710
  registerZoneArea(areaId);
3483
3711
  }
3484
3712
  }, [areaId]);
3485
- (0, import_react24.useEffect)(() => {
3713
+ (0, import_react29.useEffect)(() => {
3486
3714
  if (ctx == null ? void 0 : ctx.registerZone) {
3487
3715
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3488
3716
  }
@@ -3492,25 +3720,18 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3492
3720
  }
3493
3721
  };
3494
3722
  }, []);
3495
- if (areaId) {
3496
- if (zone !== rootDroppableId) {
3497
- zoneCompound = `${areaId}:${zone}`;
3498
- }
3499
- }
3500
- const content = (0, import_react24.useMemo)(() => {
3723
+ const content = (0, import_react29.useMemo)(() => {
3501
3724
  if (areaId && zone !== rootDroppableId) {
3502
3725
  return setupZone(data, zoneCompound).zones[zoneCompound];
3503
3726
  }
3504
3727
  return data.content || [];
3505
3728
  }, [data, zoneCompound]);
3506
- const ref = (0, import_react24.useRef)(null);
3507
- const acceptsTarget = (0, import_react24.useCallback)(
3508
- (target) => {
3509
- if (!target) {
3729
+ const ref = (0, import_react29.useRef)(null);
3730
+ const acceptsTarget = (0, import_react29.useCallback)(
3731
+ (componentType) => {
3732
+ if (!componentType) {
3510
3733
  return true;
3511
3734
  }
3512
- const data2 = target.data;
3513
- const { componentType } = data2;
3514
3735
  if (disallow) {
3515
3736
  const defaultedAllow = allow || [];
3516
3737
  const filteredDisallow = (disallow || []).filter(
@@ -3528,49 +3749,26 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3528
3749
  },
3529
3750
  [allow, disallow]
3530
3751
  );
3531
- (0, import_react24.useEffect)(() => {
3752
+ (0, import_react29.useEffect)(() => {
3532
3753
  if (registerLocalZone) {
3533
- registerLocalZone(zoneCompound, acceptsTarget(draggedItem));
3754
+ registerLocalZone(zoneCompound, acceptsTarget(draggedComponentType));
3534
3755
  }
3535
3756
  return () => {
3536
3757
  if (unregisterLocalZone) {
3537
3758
  unregisterLocalZone(zoneCompound);
3538
3759
  }
3539
3760
  };
3540
- }, [draggedItem, zoneCompound]);
3541
- const isRootZone = zoneCompound === rootDroppableId || zone === rootDroppableId || areaId === "root";
3542
- const hoveringOverArea = nextDeepestArea ? nextDeepestArea === areaId : isRootZone;
3543
- const userIsDragging = !!draggedItem;
3761
+ }, [draggedComponentType, zoneCompound]);
3762
+ const hoveringOverArea = inNextDeepestArea || isRootZone;
3544
3763
  let isEnabled = true;
3545
- if (draggedItem) {
3546
- isEnabled = deepestZone === zoneCompound;
3764
+ if (userIsDragging) {
3765
+ isEnabled = isDeepestZone;
3547
3766
  }
3548
3767
  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);
3768
+ isEnabled = acceptsTarget(draggedComponentType);
3769
+ }
3770
+ const contentWithPreview = useContentWithPreview(content, zoneCompound);
3771
+ const isDropEnabled = isEnabled && (preview ? contentWithPreview.length === 1 : contentWithPreview.length === 0);
3574
3772
  const droppableConfig = {
3575
3773
  id: zoneCompound,
3576
3774
  collisionPriority: isEnabled ? depth : 0,
@@ -3580,45 +3778,20 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3580
3778
  data: {
3581
3779
  areaId,
3582
3780
  depth,
3583
- isDroppableTarget: acceptsTarget(draggedItem),
3781
+ isDroppableTarget: acceptsTarget(draggedComponentType),
3584
3782
  path
3585
3783
  }
3586
3784
  };
3587
3785
  const { ref: dropRef } = useDroppableSafe(droppableConfig);
3588
3786
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
3589
3787
  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
- }, []);
3788
+ const [dragAxis] = useDragAxis(ref, collisionAxis);
3615
3789
  const [minEmptyHeight, isAnimating] = useMinEmptyHeight({
3616
- draggedItem,
3617
3790
  zoneCompound,
3618
3791
  userMinEmptyHeight,
3619
3792
  ref
3620
3793
  });
3621
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3794
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3622
3795
  "div",
3623
3796
  {
3624
3797
  className: `${getClassName17({
@@ -3638,87 +3811,92 @@ var DropZoneEdit = (0, import_react24.forwardRef)(
3638
3811
  "data-puck-dropzone": zoneCompound,
3639
3812
  "data-puck-dnd": zoneCompound,
3640
3813
  style: __spreadProps(__spreadValues({}, style), {
3641
- "--min-empty-height": `${minEmptyHeight}px`
3814
+ "--min-empty-height": `${minEmptyHeight}px`,
3815
+ backgroundColor: RENDER_DEBUG ? getRandomColor() : void 0
3642
3816
  }),
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
3817
+ children: contentWithPreview.map((item, i) => {
3818
+ var _a, _b, _c, _d, _e;
3819
+ const componentId = item.props.id;
3820
+ const puckProps = {
3821
+ renderDropZone: DropZone,
3822
+ isEditing: true,
3823
+ dragRef: null
3824
+ };
3825
+ const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a = config.components[item.type]) == null ? void 0 : _a.defaultProps), item.props), {
3826
+ puck: puckProps,
3827
+ editMode: true
3828
+ // DEPRECATED
3829
+ });
3830
+ const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
3831
+ 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: [
3832
+ "No configuration for ",
3833
+ item.type
3834
+ ] });
3835
+ const componentConfig = config.components[item.type];
3836
+ let componentType = item.type;
3837
+ let label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
3838
+ if (item.type === "preview" && preview) {
3839
+ let Preview4 = function() {
3840
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DrawerItemInner, { name: label, children: appContext2.overrides.componentItem });
3655
3841
  };
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
- })
3842
+ var Preview3 = Preview4;
3843
+ componentType = preview.componentType;
3844
+ label = (_d = (_c = config.components[componentType]) == null ? void 0 : _c.label) != null ? _d : preview.componentType;
3845
+ Render2 = Preview4;
3846
+ }
3847
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3848
+ DropZoneProvider,
3849
+ {
3850
+ value: __spreadProps(__spreadValues({}, ctx), { path: [...path, zoneCompound] }),
3851
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3852
+ DraggableComponent,
3853
+ {
3854
+ id: componentId,
3855
+ componentType,
3856
+ zoneCompound,
3857
+ depth: depth + 1,
3858
+ index: i,
3859
+ isLoading: ((_e = appContext2.componentState[componentId]) == null ? void 0 : _e.loadingCount) > 0,
3860
+ isSelected,
3861
+ label,
3862
+ isEnabled,
3863
+ autoDragAxis: dragAxis,
3864
+ userDragAxis: collisionAxis,
3865
+ inDroppableZone: acceptsTarget(draggedComponentType),
3866
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3867
+ Render2,
3868
+ __spreadProps(__spreadValues({}, defaultedProps), {
3869
+ puck: __spreadProps(__spreadValues({}, defaultedProps.puck), {
3870
+ dragRef
3703
3871
  })
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
- ]
3872
+ })
3873
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { ref: dragRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Render2, __spreadValues({}, defaultedProps)) })
3874
+ }
3875
+ )
3876
+ },
3877
+ componentId
3878
+ );
3879
+ })
3712
3880
  }
3713
3881
  );
3714
3882
  }
3715
3883
  );
3716
- var DropZoneRender = (0, import_react24.forwardRef)(
3884
+ var DropZoneRender = (0, import_react29.forwardRef)(
3717
3885
  function DropZoneRender2({ className, style, zone }, ref) {
3718
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3886
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3719
3887
  const { data, areaId = "root", config } = ctx || {};
3720
3888
  let zoneCompound = rootDroppableId;
3721
3889
  let content = (data == null ? void 0 : data.content) || [];
3890
+ (0, import_react29.useEffect)(() => {
3891
+ if (ctx == null ? void 0 : ctx.registerZone) {
3892
+ ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3893
+ }
3894
+ return () => {
3895
+ if (ctx == null ? void 0 : ctx.unregisterZone) {
3896
+ ctx == null ? void 0 : ctx.unregisterZone(zoneCompound);
3897
+ }
3898
+ };
3899
+ }, []);
3722
3900
  if (!data || !config) {
3723
3901
  return null;
3724
3902
  }
@@ -3726,10 +3904,10 @@ var DropZoneRender = (0, import_react24.forwardRef)(
3726
3904
  zoneCompound = `${areaId}:${zone}`;
3727
3905
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3728
3906
  }
3729
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style, ref, children: content.map((item) => {
3907
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className, style, ref, children: content.map((item) => {
3730
3908
  const Component = config.components[item.type];
3731
3909
  if (Component) {
3732
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3910
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3733
3911
  DropZoneProvider,
3734
3912
  {
3735
3913
  value: {
@@ -3739,7 +3917,7 @@ var DropZoneRender = (0, import_react24.forwardRef)(
3739
3917
  depth: 1,
3740
3918
  path: []
3741
3919
  },
3742
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3920
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3743
3921
  Component.render,
3744
3922
  __spreadProps(__spreadValues({}, item.props), {
3745
3923
  puck: { renderDropZone: DropZoneRender2 }
@@ -3753,13 +3931,13 @@ var DropZoneRender = (0, import_react24.forwardRef)(
3753
3931
  }) });
3754
3932
  }
3755
3933
  );
3756
- var DropZone = (0, import_react24.forwardRef)(
3934
+ var DropZone = (0, import_react29.forwardRef)(
3757
3935
  function DropZone2(props, ref) {
3758
- const ctx = (0, import_react24.useContext)(dropZoneContext);
3936
+ const ctx = (0, import_react29.useContext)(dropZoneContext);
3759
3937
  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 })) });
3938
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3761
3939
  }
3762
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3940
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3763
3941
  }
3764
3942
  );
3765
3943
 
@@ -3775,7 +3953,7 @@ var getZoneId = (zoneCompound) => {
3775
3953
  return [rootDroppableId, zoneCompound];
3776
3954
  };
3777
3955
 
3778
- // components/DragDropContext/NestedDroppablePlugin.ts
3956
+ // lib/dnd/NestedDroppablePlugin.ts
3779
3957
  init_react_import();
3780
3958
  var import_abstract9 = require("@dnd-kit/abstract");
3781
3959
  var import_state = require("@dnd-kit/state");
@@ -3817,7 +3995,7 @@ var getFrame = () => {
3817
3995
  return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
3818
3996
  };
3819
3997
 
3820
- // components/DragDropContext/NestedDroppablePlugin.ts
3998
+ // lib/dnd/NestedDroppablePlugin.ts
3821
3999
  var depthSort = (candidates) => {
3822
4000
  return candidates.sort((a, b) => {
3823
4001
  const aData = a.data;
@@ -3932,9 +4110,7 @@ var findDeepestCandidate = (position, manager, ownerDocument) => {
3932
4110
  area: null
3933
4111
  };
3934
4112
  };
3935
- var createNestedDroppablePlugin = ({
3936
- onChange
3937
- }) => class NestedDroppablePlugin extends import_abstract9.Plugin {
4113
+ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract9.Plugin {
3938
4114
  constructor(manager, options) {
3939
4115
  super(manager);
3940
4116
  if (typeof window === "undefined") {
@@ -3948,10 +4124,17 @@ var createNestedDroppablePlugin = ({
3948
4124
  };
3949
4125
  const target = event.originalTarget || event.target;
3950
4126
  const ownerDocument = target == null ? void 0 : target.ownerDocument;
3951
- onChange(
3952
- findDeepestCandidate(position, manager, ownerDocument),
3953
- manager
4127
+ const elements = document.elementsFromPoint(
4128
+ event.clientX,
4129
+ event.clientY
3954
4130
  );
4131
+ const overEl = elements.some((el) => el.id === id);
4132
+ if (overEl) {
4133
+ onChange(
4134
+ findDeepestCandidate(position, manager, ownerDocument),
4135
+ manager
4136
+ );
4137
+ }
3955
4138
  };
3956
4139
  const handleMoveThrottled = throttle(handleMove, 50);
3957
4140
  const handlePointerMove = (event) => {
@@ -4368,7 +4551,7 @@ var insertComponent = (componentType, zone, index, {
4368
4551
  var import_use_debounce2 = require("use-debounce");
4369
4552
  var import_utilities2 = require("@dnd-kit/dom/utilities");
4370
4553
 
4371
- // components/DragDropContext/PointerSensor.ts
4554
+ // lib/dnd/PointerSensor.ts
4372
4555
  init_react_import();
4373
4556
  var import_state3 = require("@dnd-kit/state");
4374
4557
  var import_abstract10 = require("@dnd-kit/abstract");
@@ -4630,13 +4813,15 @@ function patchWindow(window2) {
4630
4813
  }
4631
4814
 
4632
4815
  // components/DragDropContext/index.tsx
4633
- var import_jsx_runtime22 = require("react/jsx-runtime");
4634
- var dragListenerContext = (0, import_react26.createContext)({
4816
+ var import_zustand3 = require("zustand");
4817
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4818
+ var DEBUG3 = false;
4819
+ var dragListenerContext = (0, import_react31.createContext)({
4635
4820
  dragListeners: {}
4636
4821
  });
4637
4822
  function useDragListener(type, fn, deps = []) {
4638
- const { setDragListeners } = (0, import_react26.useContext)(dragListenerContext);
4639
- (0, import_react26.useEffect)(() => {
4823
+ const { setDragListeners } = (0, import_react31.useContext)(dragListenerContext);
4824
+ (0, import_react31.useEffect)(() => {
4640
4825
  if (setDragListeners) {
4641
4826
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4642
4827
  [type]: [...old[type] || [], fn]
@@ -4644,80 +4829,147 @@ function useDragListener(type, fn, deps = []) {
4644
4829
  }
4645
4830
  }, deps);
4646
4831
  }
4647
- var previewContext = (0, import_react26.createContext)(null);
4648
4832
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4833
+ var useTempDisableFallback = (timeout3) => {
4834
+ const lastFallbackDisable = (0, import_react31.useRef)(null);
4835
+ return (0, import_react31.useCallback)((manager) => {
4836
+ collisionStore.setState({ fallbackEnabled: false });
4837
+ const fallbackId = generateId();
4838
+ lastFallbackDisable.current = fallbackId;
4839
+ setTimeout(() => {
4840
+ if (lastFallbackDisable.current === fallbackId) {
4841
+ collisionStore.setState({ fallbackEnabled: true });
4842
+ manager.collisionObserver.forceUpdate(true);
4843
+ }
4844
+ }, timeout3);
4845
+ }, []);
4846
+ };
4649
4847
  var DragDropContextClient = ({
4650
4848
  children,
4651
4849
  disableAutoScroll
4652
4850
  }) => {
4653
4851
  const { state, config, dispatch, resolveData } = useAppContext();
4654
- const [preview, setPreview] = (0, import_react26.useState)(null);
4655
- const previewRef = (0, import_react26.useRef)(null);
4852
+ const id = (0, import_react31.useId)();
4656
4853
  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)(
4854
+ const debouncedParamsRef = (0, import_react31.useRef)(null);
4855
+ const tempDisableFallback = useTempDisableFallback(100);
4856
+ const [zoneStore] = (0, import_react31.useState)(
4857
+ () => (0, import_zustand3.createStore)(() => ({
4858
+ zoneDepthIndex: {},
4859
+ nextZoneDepthIndex: {},
4860
+ areaDepthIndex: {},
4861
+ nextAreaDepthIndex: {},
4862
+ draggedItem: null,
4863
+ previewIndex: {}
4864
+ }))
4865
+ );
4866
+ const getChanged2 = (0, import_react31.useCallback)(
4867
+ (params, id2) => {
4868
+ const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4869
+ const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
4870
+ const stateHasArea = Object.keys(areaDepthIndex).length > 0;
4871
+ let zoneChanged = false;
4872
+ let areaChanged = false;
4873
+ if (params.zone && !zoneDepthIndex[params.zone]) {
4874
+ zoneChanged = true;
4875
+ } else if (!params.zone && stateHasZone) {
4876
+ zoneChanged = true;
4877
+ }
4878
+ if (params.area && !areaDepthIndex[params.area]) {
4879
+ areaChanged = true;
4880
+ } else if (!params.area && stateHasArea) {
4881
+ areaChanged = true;
4882
+ }
4883
+ return { zoneChanged, areaChanged };
4884
+ },
4885
+ [zoneStore]
4886
+ );
4887
+ const setDeepestAndCollide = (0, import_react31.useCallback)(
4662
4888
  (params, manager) => {
4663
- setDeepest(params);
4889
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4890
+ if (!zoneChanged && !areaChanged) return;
4891
+ zoneStore.setState({
4892
+ zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
4893
+ areaDepthIndex: params.area ? { [params.area]: true } : {}
4894
+ });
4895
+ tempDisableFallback(manager);
4664
4896
  setTimeout(() => {
4665
4897
  manager.collisionObserver.forceUpdate(true);
4666
4898
  }, 50);
4667
4899
  debouncedParamsRef.current = null;
4668
4900
  },
4669
- []
4901
+ [zoneStore]
4670
4902
  );
4671
4903
  const setDeepestDb = (0, import_use_debounce2.useDebouncedCallback)(
4672
4904
  setDeepestAndCollide,
4673
4905
  AREA_CHANGE_DEBOUNCE_MS
4674
4906
  );
4675
- (0, import_react26.useEffect)(() => {
4676
- deepestRef.current = deepest;
4677
- }, [deepest]);
4678
4907
  const cancelDb = () => {
4679
4908
  setDeepestDb.cancel();
4680
4909
  debouncedParamsRef.current = null;
4681
4910
  };
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;
4911
+ (0, import_react31.useEffect)(() => {
4912
+ if (DEBUG3) {
4913
+ zoneStore.subscribe(
4914
+ (s) => {
4915
+ var _a, _b;
4916
+ return console.log(
4917
+ s.previewIndex,
4918
+ (_a = Object.entries(s.zoneDepthIndex || {})[0]) == null ? void 0 : _a[0],
4919
+ (_b = Object.entries(s.areaDepthIndex || {})[0]) == null ? void 0 : _b[0]
4920
+ );
4697
4921
  }
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) {
4922
+ );
4923
+ }
4924
+ }, []);
4925
+ const [plugins] = (0, import_react31.useState)(() => [
4926
+ ...disableAutoScroll ? import_dom.defaultPreset.plugins.filter((plugin) => plugin !== import_dom.AutoScroller) : import_dom.defaultPreset.plugins,
4927
+ createNestedDroppablePlugin(
4928
+ {
4929
+ onChange: (params, manager) => {
4930
+ const state2 = zoneStore.getState();
4931
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4932
+ const isDragging = manager.dragOperation.status.dragging;
4933
+ if (areaChanged || zoneChanged) {
4934
+ let nextZoneDepthIndex = {};
4935
+ let nextAreaDepthIndex = {};
4936
+ if (params.zone) {
4937
+ nextZoneDepthIndex = { [params.zone]: true };
4938
+ }
4939
+ if (params.area) {
4940
+ nextAreaDepthIndex = { [params.area]: true };
4941
+ }
4942
+ zoneStore.setState({ nextZoneDepthIndex, nextAreaDepthIndex });
4943
+ }
4944
+ if (params.zone !== "void" && (state2 == null ? void 0 : state2.zoneDepthIndex["void"])) {
4945
+ setDeepestAndCollide(params, manager);
4946
+ return;
4947
+ }
4948
+ if (areaChanged) {
4949
+ if (isDragging) {
4950
+ const debouncedParams = debouncedParamsRef.current;
4951
+ const isSameParams = debouncedParams && debouncedParams.area === params.area && debouncedParams.zone === params.zone;
4952
+ if (!isSameParams) {
4953
+ cancelDb();
4954
+ setDeepestDb(params, manager);
4955
+ debouncedParamsRef.current = params;
4956
+ }
4957
+ } else {
4703
4958
  cancelDb();
4704
- setDeepestDb(params, manager);
4705
- debouncedParamsRef.current = params;
4959
+ setDeepestAndCollide(params, manager);
4706
4960
  }
4707
- } else {
4708
- cancelDb();
4961
+ return;
4962
+ }
4963
+ if (zoneChanged) {
4709
4964
  setDeepestAndCollide(params, manager);
4710
4965
  }
4711
- return;
4712
- }
4713
- if (zoneChanged) {
4714
- setDeepestAndCollide(params, manager);
4966
+ cancelDb();
4715
4967
  }
4716
- cancelDb();
4717
- }
4718
- })
4968
+ },
4969
+ id
4970
+ )
4719
4971
  ]);
4720
- const [sensors] = (0, import_react26.useState)(() => [
4972
+ const [sensors] = (0, import_react31.useState)(() => [
4721
4973
  PointerSensor.configure({
4722
4974
  activationConstraints(event, source) {
4723
4975
  var _a;
@@ -4736,11 +4988,10 @@ var DragDropContextClient = ({
4736
4988
  }
4737
4989
  })
4738
4990
  ]);
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)(
4991
+ const [dragListeners, setDragListeners] = (0, import_react31.useState)({});
4992
+ const [pathData, setPathData] = (0, import_react31.useState)();
4993
+ const dragMode = (0, import_react31.useRef)(null);
4994
+ const registerPath = (0, import_react31.useCallback)(
4744
4995
  (selector) => {
4745
4996
  const item = getItem(selector, data);
4746
4997
  if (!item) {
@@ -4762,41 +5013,41 @@ var DragDropContextClient = ({
4762
5013
  },
4763
5014
  [data, setPathData]
4764
5015
  );
4765
- const initialSelector = (0, import_react26.useRef)(void 0);
4766
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5016
+ const initialSelector = (0, import_react31.useRef)(void 0);
5017
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { id, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4767
5018
  dragListenerContext.Provider,
4768
5019
  {
4769
5020
  value: {
4770
5021
  dragListeners,
4771
5022
  setDragListeners
4772
5023
  },
4773
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(previewContext.Provider, { value: preview, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4774
- import_react25.DragDropProvider,
5024
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5025
+ import_react30.DragDropProvider,
4775
5026
  {
4776
5027
  plugins,
4777
5028
  sensors,
4778
5029
  onDragEnd: (event, manager) => {
5030
+ var _a;
4779
5031
  const { source, target } = event.operation;
4780
- deepestRef.current = null;
4781
5032
  if (!source) {
4782
- setDraggedItem(null);
5033
+ zoneStore.setState({ draggedItem: null });
4783
5034
  return;
4784
5035
  }
4785
5036
  const { zone, index } = source.data;
4786
- const thisPreview = previewRef.current ? __spreadValues({}, previewRef.current) : null;
4787
- previewRef.current = null;
5037
+ const { previewIndex = {} } = zoneStore.getState() || {};
5038
+ const thisPreview = ((_a = previewIndex[zone]) == null ? void 0 : _a.props.id) === source.id ? previewIndex[zone] : null;
4788
5039
  setTimeout(() => {
4789
- var _a, _b;
4790
- setDraggedItem(null);
5040
+ var _a2, _b;
5041
+ zoneStore.setState({ draggedItem: null });
4791
5042
  if (event.canceled || (target == null ? void 0 : target.type) === "void") {
4792
- setPreview(null);
4793
- (_a = dragListeners.dragend) == null ? void 0 : _a.forEach((fn) => {
5043
+ zoneStore.setState({ previewIndex: {} });
5044
+ (_a2 = dragListeners.dragend) == null ? void 0 : _a2.forEach((fn) => {
4794
5045
  fn(event, manager);
4795
5046
  });
4796
5047
  return;
4797
5048
  }
4798
5049
  if (thisPreview) {
4799
- setPreview(null);
5050
+ zoneStore.setState({ previewIndex: {} });
4800
5051
  if (thisPreview.type === "insert") {
4801
5052
  insertComponent(
4802
5053
  thisPreview.componentType,
@@ -4831,8 +5082,9 @@ var DragDropContextClient = ({
4831
5082
  }, 250);
4832
5083
  },
4833
5084
  onDragOver: (event, manager) => {
4834
- var _a, _b, _c, _d;
5085
+ var _a, _b, _c, _d, _e;
4835
5086
  event.preventDefault();
5087
+ const draggedItem = (_a = zoneStore.getState()) == null ? void 0 : _a.draggedItem;
4836
5088
  if (!draggedItem) return;
4837
5089
  cancelDb();
4838
5090
  const { source, target } = event.operation;
@@ -4848,7 +5100,7 @@ var DragDropContextClient = ({
4848
5100
  const targetData = target.data;
4849
5101
  targetZone = targetData.zone;
4850
5102
  targetIndex = targetData.index;
4851
- const collisionData = (_b = (_a = manager.dragOperation.data) == null ? void 0 : _a.collisionMap) == null ? void 0 : _b[targetId];
5103
+ const collisionData = (_c = (_b = manager.dragOperation.data) == null ? void 0 : _b.collisionMap) == null ? void 0 : _c[targetId];
4852
5104
  const collisionPosition = (collisionData == null ? void 0 : collisionData.direction) === "up" || (collisionData == null ? void 0 : collisionData.direction) === "left" ? "before" : "after";
4853
5105
  if (targetIndex >= sourceIndex && sourceZone === targetZone) {
4854
5106
  targetIndex = targetIndex - 1;
@@ -4860,23 +5112,26 @@ var DragDropContextClient = ({
4860
5112
  targetZone = target.id.toString();
4861
5113
  targetIndex = 0;
4862
5114
  }
4863
- if (targetId === sourceId || ((_c = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _c.path.find((path) => {
5115
+ if (targetId === sourceId || ((_d = pathData == null ? void 0 : pathData[target.id]) == null ? void 0 : _d.path.find((path) => {
4864
5116
  const [pathId] = path.split(":");
4865
5117
  return pathId === sourceId;
4866
5118
  }))) {
4867
5119
  return;
4868
5120
  }
4869
5121
  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()
5122
+ zoneStore.setState({
5123
+ previewIndex: {
5124
+ [targetZone]: {
5125
+ componentType: sourceData.componentType,
5126
+ type: "insert",
5127
+ index: targetIndex,
5128
+ zone: targetZone,
5129
+ props: {
5130
+ id: source.id.toString()
5131
+ }
5132
+ }
4877
5133
  }
4878
- };
4879
- setPreview(previewRef.current);
5134
+ });
4880
5135
  } else {
4881
5136
  if (!initialSelector.current) {
4882
5137
  initialSelector.current = {
@@ -4886,17 +5141,20 @@ var DragDropContextClient = ({
4886
5141
  }
4887
5142
  const item = getItem(initialSelector.current, data);
4888
5143
  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);
5144
+ zoneStore.setState({
5145
+ previewIndex: {
5146
+ [targetZone]: {
5147
+ componentType: sourceData.componentType,
5148
+ type: "move",
5149
+ index: targetIndex,
5150
+ zone: targetZone,
5151
+ props: item.props
5152
+ }
5153
+ }
5154
+ });
4897
5155
  }
4898
5156
  }
4899
- (_d = dragListeners.dragover) == null ? void 0 : _d.forEach((fn) => {
5157
+ (_e = dragListeners.dragover) == null ? void 0 : _e.forEach((fn) => {
4900
5158
  fn(event, manager);
4901
5159
  });
4902
5160
  },
@@ -4906,46 +5164,61 @@ var DragDropContextClient = ({
4906
5164
  type: "setUi",
4907
5165
  ui: { itemSelector: null, isDragging: true }
4908
5166
  });
5167
+ const { source } = event.operation;
5168
+ if (source && source.type !== "void") {
5169
+ const sourceData = source.data;
5170
+ const item = getItem(
5171
+ {
5172
+ zone: sourceData.zone,
5173
+ index: sourceData.index
5174
+ },
5175
+ data
5176
+ );
5177
+ if (item) {
5178
+ zoneStore.setState({
5179
+ previewIndex: {
5180
+ [sourceData.zone]: {
5181
+ componentType: sourceData.componentType,
5182
+ type: "move",
5183
+ index: sourceData.index,
5184
+ zone: sourceData.zone,
5185
+ props: item.props
5186
+ }
5187
+ }
5188
+ });
5189
+ }
5190
+ }
4909
5191
  (_a = dragListeners.dragstart) == null ? void 0 : _a.forEach((fn) => {
4910
5192
  fn(event, manager);
4911
5193
  });
4912
5194
  },
4913
5195
  onBeforeDragStart: (event) => {
4914
5196
  var _a;
4915
- if (draggedItem) {
4916
- console.warn("New drag started before previous drag cleaned up");
4917
- }
4918
5197
  const isNewComponent = ((_a = event.operation.source) == null ? void 0 : _a.data.type) === "drawer";
4919
5198
  dragMode.current = isNewComponent ? "new" : "existing";
4920
5199
  initialSelector.current = void 0;
4921
- setDraggedItem(event.operation.source);
5200
+ zoneStore.setState({ draggedItem: event.operation.source });
4922
5201
  },
4923
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
5202
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4924
5203
  DropZoneProvider,
4925
5204
  {
4926
5205
  value: {
4927
5206
  data,
4928
5207
  config,
4929
- dispatch,
4930
- draggedItem,
4931
5208
  mode: "edit",
4932
5209
  areaId: "root",
4933
5210
  depth: 0,
4934
5211
  registerPath,
4935
5212
  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
5213
  path: []
4941
5214
  },
4942
5215
  children
4943
5216
  }
4944
- )
5217
+ ) })
4945
5218
  }
4946
- ) })
5219
+ )
4947
5220
  }
4948
- );
5221
+ ) });
4949
5222
  };
4950
5223
  var DragDropContext = ({
4951
5224
  children,
@@ -4955,11 +5228,11 @@ var DragDropContext = ({
4955
5228
  if (status === "LOADING") {
4956
5229
  return children;
4957
5230
  }
4958
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DragDropContextClient, { disableAutoScroll, children });
5231
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DragDropContextClient, { disableAutoScroll, children });
4959
5232
  };
4960
5233
 
4961
5234
  // components/Drawer/index.tsx
4962
- var import_jsx_runtime23 = require("react/jsx-runtime");
5235
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4963
5236
  var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
4964
5237
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
4965
5238
  var DrawerItemInner = ({
@@ -4969,11 +5242,11 @@ var DrawerItemInner = ({
4969
5242
  dragRef,
4970
5243
  isDragDisabled
4971
5244
  }) => {
4972
- const CustomInner = (0, import_react27.useMemo)(
4973
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
5245
+ const CustomInner = (0, import_react32.useMemo)(
5246
+ () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
4974
5247
  [children]
4975
5248
  );
4976
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5249
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4977
5250
  "div",
4978
5251
  {
4979
5252
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -4981,9 +5254,9 @@ var DrawerItemInner = ({
4981
5254
  onMouseDown: (e) => e.preventDefault(),
4982
5255
  "data-testid": dragRef ? `drawer-item:${name}` : "",
4983
5256
  "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, {}) })
5257
+ 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: [
5258
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
5259
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DragIcon, {}) })
4987
5260
  ] }) }) })
4988
5261
  }
4989
5262
  );
@@ -5000,9 +5273,9 @@ var DrawerItemDraggable = ({
5000
5273
  data: { type: "drawer", componentType: name },
5001
5274
  disabled: isDragDisabled
5002
5275
  });
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)(
5276
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("draggable"), children: [
5277
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DrawerItemInner, { name, label, children }) }),
5278
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5006
5279
  DrawerItemInner,
5007
5280
  {
5008
5281
  name,
@@ -5023,7 +5296,7 @@ var DrawerItem = ({
5023
5296
  isDragDisabled
5024
5297
  }) => {
5025
5298
  const resolvedId = id || name;
5026
- const [dynamicId, setDynamicId] = (0, import_react27.useState)(generateId(resolvedId));
5299
+ const [dynamicId, setDynamicId] = (0, import_react32.useState)(generateId(resolvedId));
5027
5300
  if (typeof index !== "undefined") {
5028
5301
  console.error(
5029
5302
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -5036,7 +5309,7 @@ var DrawerItem = ({
5036
5309
  },
5037
5310
  [resolvedId]
5038
5311
  );
5039
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5312
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5040
5313
  DrawerItemDraggable,
5041
5314
  {
5042
5315
  name,
@@ -5062,14 +5335,14 @@ var Drawer = ({
5062
5335
  "Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
5063
5336
  );
5064
5337
  }
5065
- const [id] = (0, import_react27.useState)(generateId());
5338
+ const [id] = (0, import_react32.useState)(generateId());
5066
5339
  const { ref } = useDroppableSafe({
5067
5340
  id,
5068
5341
  type: "void",
5069
5342
  collisionPriority: 0
5070
5343
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
5071
5344
  });
5072
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5345
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5073
5346
  "div",
5074
5347
  {
5075
5348
  className: getClassName18(),
@@ -5084,7 +5357,7 @@ Drawer.Item = DrawerItem;
5084
5357
 
5085
5358
  // components/Puck/index.tsx
5086
5359
  init_react_import();
5087
- var import_react42 = require("react");
5360
+ var import_react48 = require("react");
5088
5361
 
5089
5362
  // components/SidebarSection/index.tsx
5090
5363
  init_react_import();
@@ -5095,7 +5368,7 @@ var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "Si
5095
5368
 
5096
5369
  // lib/use-breadcrumbs.ts
5097
5370
  init_react_import();
5098
- var import_react28 = require("react");
5371
+ var import_react33 = require("react");
5099
5372
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
5100
5373
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
5101
5374
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -5145,8 +5418,8 @@ var useBreadcrumbs = (renderCount) => {
5145
5418
  state: { data },
5146
5419
  selectedItem
5147
5420
  } = useAppContext();
5148
- const dzContext = (0, import_react28.useContext)(dropZoneContext);
5149
- return (0, import_react28.useMemo)(() => {
5421
+ const dzContext = (0, import_react33.useContext)(dropZoneContext);
5422
+ return (0, import_react33.useMemo)(() => {
5150
5423
  const breadcrumbs = convertPathDataToBreadcrumbs(
5151
5424
  selectedItem,
5152
5425
  dzContext == null ? void 0 : dzContext.pathData,
@@ -5160,7 +5433,7 @@ var useBreadcrumbs = (renderCount) => {
5160
5433
  };
5161
5434
 
5162
5435
  // components/SidebarSection/index.tsx
5163
- var import_jsx_runtime24 = require("react/jsx-runtime");
5436
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5164
5437
  var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
5165
5438
  var SidebarSection = ({
5166
5439
  children,
@@ -5173,15 +5446,15 @@ var SidebarSection = ({
5173
5446
  }) => {
5174
5447
  const { setUi } = useAppContext();
5175
5448
  const breadcrumbs = useBreadcrumbs(1);
5176
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5449
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5177
5450
  "div",
5178
5451
  {
5179
5452
  className: getClassName19({ noBorderTop, noPadding }),
5180
5453
  style: { background },
5181
5454
  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)(
5455
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
5456
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
5457
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5185
5458
  "button",
5186
5459
  {
5187
5460
  type: "button",
@@ -5190,12 +5463,12 @@ var SidebarSection = ({
5190
5463
  children: breadcrumb.label
5191
5464
  }
5192
5465
  ),
5193
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronRight, { size: 16 })
5466
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronRight, { size: 16 })
5194
5467
  ] }, 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 }) })
5468
+ /* @__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
5469
  ] }) }),
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 }) })
5470
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("content"), children }),
5471
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Loader, { size: 32 }) })
5199
5472
  ]
5200
5473
  }
5201
5474
  );
@@ -5226,7 +5499,7 @@ init_react_import();
5226
5499
  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
5500
 
5228
5501
  // components/MenuBar/index.tsx
5229
- var import_jsx_runtime25 = require("react/jsx-runtime");
5502
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5230
5503
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
5231
5504
  function MenuBar({
5232
5505
  appState,
@@ -5240,7 +5513,7 @@ function MenuBar({
5240
5513
  history: { back, forward, historyStore }
5241
5514
  } = useAppContext();
5242
5515
  const { hasFuture = false, hasPast = false } = historyStore || {};
5243
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5516
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5244
5517
  "div",
5245
5518
  {
5246
5519
  className: getClassName20({ menuOpen }),
@@ -5254,12 +5527,12 @@ function MenuBar({
5254
5527
  setMenuOpen(false);
5255
5528
  }
5256
5529
  },
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 }) })
5530
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("inner"), children: [
5531
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20("history"), children: [
5532
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Undo2, { size: 21 }) }),
5533
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Redo2, { size: 21 }) })
5261
5534
  ] }),
5262
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: renderHeaderActions && renderHeaderActions({
5535
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: renderHeaderActions && renderHeaderActions({
5263
5536
  state: appState,
5264
5537
  dispatch
5265
5538
  }) })
@@ -5270,7 +5543,7 @@ function MenuBar({
5270
5543
 
5271
5544
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
5272
5545
  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" };
5546
+ 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
5547
 
5275
5548
  // components/Puck/components/Fields/index.tsx
5276
5549
  init_react_import();
@@ -5280,15 +5553,15 @@ init_react_import();
5280
5553
  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
5554
 
5282
5555
  // components/Puck/components/Fields/index.tsx
5283
- var import_react30 = require("react");
5556
+ var import_react35 = require("react");
5284
5557
 
5285
5558
  // lib/use-parent.ts
5286
5559
  init_react_import();
5287
- var import_react29 = require("react");
5560
+ var import_react34 = require("react");
5288
5561
  var useParent = (itemSelector) => {
5289
5562
  var _a;
5290
5563
  const { selectedItem, state } = useAppContext();
5291
- const { pathData } = (0, import_react29.useContext)(dropZoneContext) || {};
5564
+ const { pathData } = (0, import_react34.useContext)(dropZoneContext) || {};
5292
5565
  const item = itemSelector ? getItem(itemSelector, state.data) : selectedItem;
5293
5566
  const breadcrumbs = convertPathDataToBreadcrumbs(item, pathData, state.data);
5294
5567
  const lastItem = breadcrumbs[breadcrumbs.length - 1];
@@ -5297,7 +5570,7 @@ var useParent = (itemSelector) => {
5297
5570
  };
5298
5571
 
5299
5572
  // components/Puck/components/Fields/index.tsx
5300
- var import_jsx_runtime26 = require("react/jsx-runtime");
5573
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5301
5574
  var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
5302
5575
  var defaultPageFields = {
5303
5576
  title: { type: "text" }
@@ -5305,7 +5578,7 @@ var defaultPageFields = {
5305
5578
  var DefaultFields = ({
5306
5579
  children
5307
5580
  }) => {
5308
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children });
5581
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
5309
5582
  };
5310
5583
  var useResolvedFields = () => {
5311
5584
  var _a, _b;
@@ -5314,20 +5587,20 @@ var useResolvedFields = () => {
5314
5587
  const { data } = state;
5315
5588
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
5316
5589
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
5317
- const defaultFields = (0, import_react30.useMemo)(
5590
+ const defaultFields = (0, import_react35.useMemo)(
5318
5591
  () => (selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields) || {},
5319
5592
  [selectedItem, rootFields, componentConfig == null ? void 0 : componentConfig.fields]
5320
5593
  );
5321
5594
  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);
5595
+ const [lastSelectedData, setLastSelectedData] = (0, import_react35.useState)({});
5596
+ const [resolvedFields, setResolvedFields] = (0, import_react35.useState)(defaultFields);
5597
+ const [fieldsLoading, setFieldsLoading] = (0, import_react35.useState)(false);
5325
5598
  const defaultResolveFields = (_componentData, _params) => defaultFields;
5326
5599
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
5327
5600
  const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
5328
5601
  const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
5329
5602
  const hasResolver = hasComponentResolver || hasRootResolver;
5330
- const resolveFields = (0, import_react30.useCallback)(
5603
+ const resolveFields = (0, import_react35.useCallback)(
5331
5604
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
5332
5605
  var _a2;
5333
5606
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
@@ -5365,7 +5638,7 @@ var useResolvedFields = () => {
5365
5638
  }),
5366
5639
  [data, config, componentData, selectedItem, resolvedFields, state]
5367
5640
  );
5368
- (0, import_react30.useEffect)(() => {
5641
+ (0, import_react35.useEffect)(() => {
5369
5642
  if (hasResolver) {
5370
5643
  setFieldsLoading(true);
5371
5644
  resolveFields(defaultFields).then((fields) => {
@@ -5396,8 +5669,8 @@ var Fields = () => {
5396
5669
  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
5670
  const isLoading = fieldsResolving || componentResolving;
5398
5671
  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)(
5672
+ const Wrapper = (0, import_react35.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
5673
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5401
5674
  "form",
5402
5675
  {
5403
5676
  className: getClassName21(),
@@ -5405,7 +5678,7 @@ var Fields = () => {
5405
5678
  e.preventDefault();
5406
5679
  },
5407
5680
  children: [
5408
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5681
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
5409
5682
  const field = fields[fieldName];
5410
5683
  if (!(field == null ? void 0 : field.type)) return null;
5411
5684
  const onChange = (value, updatedUi) => {
@@ -5476,7 +5749,7 @@ var Fields = () => {
5476
5749
  item: selectedItem
5477
5750
  });
5478
5751
  const id = `${selectedItem.props.id}_${field.type}_${fieldName}`;
5479
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5752
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5480
5753
  AutoFieldPrivate,
5481
5754
  {
5482
5755
  field,
@@ -5494,7 +5767,7 @@ var Fields = () => {
5494
5767
  root: true
5495
5768
  });
5496
5769
  const id = `root_${field.type}_${fieldName}`;
5497
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5770
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5498
5771
  AutoFieldPrivate,
5499
5772
  {
5500
5773
  field,
@@ -5508,7 +5781,7 @@ var Fields = () => {
5508
5781
  );
5509
5782
  }
5510
5783
  }) }),
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 }) }) })
5784
+ 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
5785
  ]
5513
5786
  }
5514
5787
  );
@@ -5519,7 +5792,7 @@ init_react_import();
5519
5792
 
5520
5793
  // lib/use-component-list.tsx
5521
5794
  init_react_import();
5522
- var import_react31 = require("react");
5795
+ var import_react36 = require("react");
5523
5796
 
5524
5797
  // components/ComponentList/index.tsx
5525
5798
  init_react_import();
@@ -5529,7 +5802,7 @@ init_react_import();
5529
5802
  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
5803
 
5531
5804
  // components/ComponentList/index.tsx
5532
- var import_jsx_runtime27 = require("react/jsx-runtime");
5805
+ var import_jsx_runtime28 = require("react/jsx-runtime");
5533
5806
  var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
5534
5807
  var ComponentListItem = ({
5535
5808
  name,
@@ -5539,7 +5812,7 @@ var ComponentListItem = ({
5539
5812
  const canInsert = getPermissions({
5540
5813
  type: name
5541
5814
  }).insert;
5542
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5815
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: overrides.componentItem });
5543
5816
  };
5544
5817
  var ComponentList = ({
5545
5818
  children,
@@ -5548,8 +5821,8 @@ var ComponentList = ({
5548
5821
  }) => {
5549
5822
  const { config, state, setUi } = useAppContext();
5550
5823
  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)(
5824
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
5825
+ title && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5553
5826
  "button",
5554
5827
  {
5555
5828
  type: "button",
@@ -5563,14 +5836,14 @@ var ComponentList = ({
5563
5836
  }),
5564
5837
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
5565
5838
  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 }) })
5839
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: title }),
5840
+ /* @__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
5841
  ]
5569
5842
  }
5570
5843
  ),
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) => {
5844
+ /* @__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
5845
  var _a;
5573
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5846
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5574
5847
  ComponentListItem,
5575
5848
  {
5576
5849
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -5584,10 +5857,10 @@ var ComponentList = ({
5584
5857
  ComponentList.Item = ComponentListItem;
5585
5858
 
5586
5859
  // lib/use-component-list.tsx
5587
- var import_jsx_runtime28 = require("react/jsx-runtime");
5860
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5588
5861
  var useComponentList = (config, ui) => {
5589
- const [componentList, setComponentList] = (0, import_react31.useState)();
5590
- (0, import_react31.useEffect)(() => {
5862
+ const [componentList, setComponentList] = (0, import_react36.useState)();
5863
+ (0, import_react36.useEffect)(() => {
5591
5864
  var _a, _b, _c;
5592
5865
  if (Object.keys(ui.componentList).length > 0) {
5593
5866
  const matchedComponents = [];
@@ -5597,7 +5870,7 @@ var useComponentList = (config, ui) => {
5597
5870
  if (category.visible === false || !category.components) {
5598
5871
  return null;
5599
5872
  }
5600
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5873
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5601
5874
  ComponentList,
5602
5875
  {
5603
5876
  id: categoryKey,
@@ -5606,7 +5879,7 @@ var useComponentList = (config, ui) => {
5606
5879
  var _a2;
5607
5880
  matchedComponents.push(componentName);
5608
5881
  const componentConf = config.components[componentName] || {};
5609
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5882
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5610
5883
  ComponentList.Item,
5611
5884
  {
5612
5885
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -5626,7 +5899,7 @@ var useComponentList = (config, ui) => {
5626
5899
  );
5627
5900
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
5628
5901
  _componentList.push(
5629
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5902
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5630
5903
  ComponentList,
5631
5904
  {
5632
5905
  id: "other",
@@ -5634,7 +5907,7 @@ var useComponentList = (config, ui) => {
5634
5907
  children: remainingComponents.map((componentName, i) => {
5635
5908
  var _a2;
5636
5909
  const componentConf = config.components[componentName] || {};
5637
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5910
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5638
5911
  ComponentList.Item,
5639
5912
  {
5640
5913
  name: componentName,
@@ -5656,25 +5929,25 @@ var useComponentList = (config, ui) => {
5656
5929
  };
5657
5930
 
5658
5931
  // components/Puck/components/Components/index.tsx
5659
- var import_react32 = require("react");
5660
- var import_jsx_runtime29 = require("react/jsx-runtime");
5932
+ var import_react37 = require("react");
5933
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5661
5934
  var Components = () => {
5662
5935
  const { config, state, overrides } = useAppContext();
5663
5936
  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" }) });
5937
+ const Wrapper = (0, import_react37.useMemo)(() => overrides.components || "div", [overrides]);
5938
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentList, { id: "all" }) });
5666
5939
  };
5667
5940
 
5668
5941
  // components/Puck/components/Preview/index.tsx
5669
5942
  init_react_import();
5670
- var import_react34 = require("react");
5943
+ var import_react39 = require("react");
5671
5944
 
5672
5945
  // components/AutoFrame/index.tsx
5673
5946
  init_react_import();
5674
- var import_react33 = require("react");
5947
+ var import_react38 = require("react");
5675
5948
  var import_object_hash = __toESM(require("object-hash"));
5676
5949
  var import_react_dom3 = require("react-dom");
5677
- var import_jsx_runtime30 = require("react/jsx-runtime");
5950
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5678
5951
  var styleSelector = 'style, link[rel="stylesheet"]';
5679
5952
  var collectStyles = (doc) => {
5680
5953
  const collected = [];
@@ -5717,7 +5990,7 @@ var CopyHostStyles = ({
5717
5990
  onStylesLoaded = () => null
5718
5991
  }) => {
5719
5992
  const { document: doc, window: win } = useFrame();
5720
- (0, import_react33.useEffect)(() => {
5993
+ (0, import_react38.useEffect)(() => {
5721
5994
  if (!win || !doc) {
5722
5995
  return () => {
5723
5996
  };
@@ -5874,10 +6147,10 @@ var CopyHostStyles = ({
5874
6147
  observer.disconnect();
5875
6148
  };
5876
6149
  }, []);
5877
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
6150
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
5878
6151
  };
5879
- var autoFrameContext = (0, import_react33.createContext)({});
5880
- var useFrame = () => (0, import_react33.useContext)(autoFrameContext);
6152
+ var autoFrameContext = (0, import_react38.createContext)({});
6153
+ var useFrame = () => (0, import_react38.useContext)(autoFrameContext);
5881
6154
  function AutoFrame(_a) {
5882
6155
  var _b = _a, {
5883
6156
  children,
@@ -5894,10 +6167,10 @@ function AutoFrame(_a) {
5894
6167
  "onStylesLoaded",
5895
6168
  "frameRef"
5896
6169
  ]);
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)(() => {
6170
+ const [loaded, setLoaded] = (0, import_react38.useState)(false);
6171
+ const [ctx, setCtx] = (0, import_react38.useState)({});
6172
+ const [mountTarget, setMountTarget] = (0, import_react38.useState)();
6173
+ (0, import_react38.useEffect)(() => {
5901
6174
  var _a2;
5902
6175
  if (frameRef.current) {
5903
6176
  setCtx({
@@ -5909,7 +6182,7 @@ function AutoFrame(_a) {
5909
6182
  );
5910
6183
  }
5911
6184
  }, [frameRef, loaded]);
5912
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6185
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5913
6186
  "iframe",
5914
6187
  __spreadProps(__spreadValues({}, props), {
5915
6188
  className,
@@ -5919,7 +6192,7 @@ function AutoFrame(_a) {
5919
6192
  onLoad: () => {
5920
6193
  setLoaded(true);
5921
6194
  },
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) }) })
6195
+ 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
6196
  })
5924
6197
  );
5925
6198
  }
@@ -5930,12 +6203,68 @@ var AutoFrame_default = AutoFrame;
5930
6203
  init_react_import();
5931
6204
  var styles_module_default18 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
5932
6205
 
6206
+ // components/Render/index.tsx
6207
+ init_react_import();
6208
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6209
+ function Render({
6210
+ config,
6211
+ data
6212
+ }) {
6213
+ var _a;
6214
+ const defaultedData = __spreadProps(__spreadValues({}, data), {
6215
+ root: data.root || {},
6216
+ content: data.content || []
6217
+ });
6218
+ const rootProps = defaultedData.root.props || defaultedData.root;
6219
+ const title = (rootProps == null ? void 0 : rootProps.title) || "";
6220
+ if ((_a = config.root) == null ? void 0 : _a.render) {
6221
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6222
+ DropZoneProvider,
6223
+ {
6224
+ value: {
6225
+ data: defaultedData,
6226
+ config,
6227
+ mode: "render",
6228
+ depth: 0,
6229
+ path: []
6230
+ },
6231
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6232
+ config.root.render,
6233
+ __spreadProps(__spreadValues({}, rootProps), {
6234
+ puck: {
6235
+ renderDropZone: DropZone,
6236
+ isEditing: false
6237
+ },
6238
+ title,
6239
+ editMode: false,
6240
+ id: "puck-root",
6241
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6242
+ })
6243
+ )
6244
+ }
6245
+ );
6246
+ }
6247
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6248
+ DropZoneProvider,
6249
+ {
6250
+ value: {
6251
+ data: defaultedData,
6252
+ config,
6253
+ mode: "render",
6254
+ depth: 0,
6255
+ path: []
6256
+ },
6257
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DropZone, { zone: rootDroppableId })
6258
+ }
6259
+ );
6260
+ }
6261
+
5933
6262
  // components/Puck/components/Preview/index.tsx
5934
- var import_jsx_runtime31 = require("react/jsx-runtime");
6263
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5935
6264
  var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
5936
6265
  var useBubbleIframeEvents = (ref) => {
5937
6266
  const { status } = useAppContext();
5938
- (0, import_react34.useEffect)(() => {
6267
+ (0, import_react39.useEffect)(() => {
5939
6268
  var _a;
5940
6269
  if (ref.current && status === "READY") {
5941
6270
  const iframe = ref.current;
@@ -5972,22 +6301,34 @@ var useBubbleIframeEvents = (ref) => {
5972
6301
  }
5973
6302
  }, [status]);
5974
6303
  };
5975
- var Preview = ({ id = "puck-preview" }) => {
6304
+ var Preview2 = ({ id = "puck-preview" }) => {
5976
6305
  const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
5977
- const Page = (0, import_react34.useCallback)(
6306
+ const Page = (0, import_react39.useCallback)(
5978
6307
  (pageProps) => {
5979
6308
  var _a, _b;
5980
6309
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
5981
6310
  id: "puck-root"
5982
- }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: pageProps.children });
6311
+ }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
5983
6312
  },
5984
6313
  [config.root]
5985
6314
  );
5986
- const Frame = (0, import_react34.useMemo)(() => overrides.iframe, [overrides]);
6315
+ const Frame = (0, import_react39.useMemo)(() => overrides.iframe, [overrides]);
5987
6316
  const rootProps = state.data.root.props || state.data.root;
5988
- const ref = (0, import_react34.useRef)(null);
6317
+ const ref = (0, import_react39.useRef)(null);
5989
6318
  useBubbleIframeEvents(ref);
5990
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6319
+ const inner = state.ui.previewMode === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6320
+ Page,
6321
+ __spreadProps(__spreadValues({}, rootProps), {
6322
+ puck: {
6323
+ renderDropZone: DropZone,
6324
+ isEditing: true,
6325
+ dragRef: null
6326
+ },
6327
+ editMode: true,
6328
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
6329
+ })
6330
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Render, { data: state.data, config });
6331
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5991
6332
  "div",
5992
6333
  {
5993
6334
  className: getClassName23(),
@@ -5996,7 +6337,7 @@ var Preview = ({ id = "puck-preview" }) => {
5996
6337
  onClick: () => {
5997
6338
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
5998
6339
  },
5999
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6340
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6000
6341
  AutoFrame_default,
6001
6342
  {
6002
6343
  id: "preview-frame",
@@ -6006,40 +6347,21 @@ var Preview = ({ id = "puck-preview" }) => {
6006
6347
  setStatus("READY");
6007
6348
  },
6008
6349
  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
- );
6350
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6022
6351
  if (Frame) {
6023
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Frame, { document: document2, children: inner });
6352
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame, { document: document2, children: inner });
6024
6353
  }
6025
6354
  return inner;
6026
6355
  } })
6027
6356
  }
6028
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6357
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6029
6358
  "div",
6030
6359
  {
6031
6360
  id: "preview-frame",
6032
6361
  className: getClassName23("frame"),
6033
6362
  ref,
6034
6363
  "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
- )
6364
+ children: inner
6043
6365
  }
6044
6366
  )
6045
6367
  }
@@ -6089,7 +6411,7 @@ var scrollIntoView = (el) => {
6089
6411
  };
6090
6412
 
6091
6413
  // components/LayerTree/index.tsx
6092
- var import_react35 = require("react");
6414
+ var import_react40 = require("react");
6093
6415
 
6094
6416
  // lib/is-child-of-zone.ts
6095
6417
  init_react_import();
@@ -6122,7 +6444,7 @@ var onScrollEnd = (frame, cb) => {
6122
6444
  };
6123
6445
 
6124
6446
  // components/LayerTree/index.tsx
6125
- var import_jsx_runtime32 = require("react/jsx-runtime");
6447
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6126
6448
  var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
6127
6449
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
6128
6450
  var LayerTree = ({
@@ -6135,15 +6457,15 @@ var LayerTree = ({
6135
6457
  label
6136
6458
  }) => {
6137
6459
  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" }) }),
6460
+ const ctx = (0, import_react40.useContext)(dropZoneContext);
6461
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
6462
+ label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
6463
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
6142
6464
  " ",
6143
6465
  label
6144
6466
  ] }),
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" }),
6467
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
6468
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
6147
6469
  zoneContent.map((item, i) => {
6148
6470
  var _a;
6149
6471
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -6156,7 +6478,7 @@ var LayerTree = ({
6156
6478
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
6157
6479
  const componentConfig = config.components[item.type];
6158
6480
  const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
6159
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6481
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6160
6482
  "li",
6161
6483
  {
6162
6484
  className: getClassNameLayer({
@@ -6166,7 +6488,7 @@ var LayerTree = ({
6166
6488
  childIsSelected
6167
6489
  }),
6168
6490
  children: [
6169
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6491
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
6170
6492
  "button",
6171
6493
  {
6172
6494
  type: "button",
@@ -6205,22 +6527,22 @@ var LayerTree = ({
6205
6527
  setHoveringComponent(null);
6206
6528
  },
6207
6529
  children: [
6208
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6530
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6209
6531
  "div",
6210
6532
  {
6211
6533
  className: getClassNameLayer("chevron"),
6212
6534
  title: isSelected ? "Collapse" : "Expand",
6213
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDown, { size: "12" })
6535
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
6214
6536
  }
6215
6537
  ),
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 })
6538
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
6539
+ /* @__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" }) }),
6540
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
6219
6541
  ] })
6220
6542
  ]
6221
6543
  }
6222
6544
  ) }),
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)(
6545
+ 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
6546
  LayerTree,
6225
6547
  {
6226
6548
  config,
@@ -6242,13 +6564,13 @@ var LayerTree = ({
6242
6564
  };
6243
6565
 
6244
6566
  // components/Puck/components/Outline/index.tsx
6245
- var import_react36 = require("react");
6246
- var import_jsx_runtime33 = require("react/jsx-runtime");
6567
+ var import_react41 = require("react");
6568
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6247
6569
  var Outline = () => {
6248
6570
  const { dispatch, state, overrides, config } = useAppContext();
6249
6571
  const { data, ui } = state;
6250
6572
  const { itemSelector } = ui;
6251
- const setItemSelector = (0, import_react36.useCallback)(
6573
+ const setItemSelector = (0, import_react41.useCallback)(
6252
6574
  (newItemSelector) => {
6253
6575
  dispatch({
6254
6576
  type: "setUi",
@@ -6257,9 +6579,9 @@ var Outline = () => {
6257
6579
  },
6258
6580
  []
6259
6581
  );
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)(
6582
+ const Wrapper = (0, import_react41.useMemo)(() => overrides.outline || "div", [overrides]);
6583
+ 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: [
6584
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6263
6585
  LayerTree,
6264
6586
  {
6265
6587
  config,
@@ -6272,7 +6594,7 @@ var Outline = () => {
6272
6594
  ),
6273
6595
  Object.entries(findZonesForArea(data, "root")).map(
6274
6596
  ([zoneKey, zone]) => {
6275
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6597
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6276
6598
  LayerTree,
6277
6599
  {
6278
6600
  config,
@@ -6371,19 +6693,19 @@ function usePuckHistory({
6371
6693
 
6372
6694
  // lib/use-history-store.ts
6373
6695
  init_react_import();
6374
- var import_react37 = require("react");
6696
+ var import_react42 = require("react");
6375
6697
  var import_use_debounce3 = require("use-debounce");
6376
6698
  var EMPTY_HISTORY_INDEX = 0;
6377
6699
  function useHistoryStore(initialHistory) {
6378
6700
  var _a, _b;
6379
- const [histories, setHistories] = (0, import_react37.useState)(
6701
+ const [histories, setHistories] = (0, import_react42.useState)(
6380
6702
  (_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
6381
6703
  );
6382
6704
  const updateHistories = (histories2) => {
6383
6705
  setHistories(histories2);
6384
6706
  setIndex(histories2.length - 1);
6385
6707
  };
6386
- const [index, setIndex] = (0, import_react37.useState)(
6708
+ const [index, setIndex] = (0, import_react42.useState)(
6387
6709
  (_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
6388
6710
  );
6389
6711
  const hasPast = index > EMPTY_HISTORY_INDEX;
@@ -6543,22 +6865,22 @@ var getBox = function getBox2(el) {
6543
6865
  };
6544
6866
 
6545
6867
  // components/Puck/components/Canvas/index.tsx
6546
- var import_react39 = require("react");
6868
+ var import_react44 = require("react");
6547
6869
 
6548
6870
  // components/ViewportControls/index.tsx
6549
6871
  init_react_import();
6550
- var import_react38 = require("react");
6872
+ var import_react43 = require("react");
6551
6873
 
6552
6874
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6553
6875
  init_react_import();
6554
6876
  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
6877
 
6556
6878
  // components/ViewportControls/index.tsx
6557
- var import_jsx_runtime34 = require("react/jsx-runtime");
6879
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6558
6880
  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 })
6881
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
6882
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
6883
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
6562
6884
  };
6563
6885
  var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
6564
6886
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
@@ -6570,11 +6892,11 @@ var ViewportButton = ({
6570
6892
  onClick
6571
6893
  }) => {
6572
6894
  const { state } = useAppContext();
6573
- const [isActive, setIsActive] = (0, import_react38.useState)(false);
6574
- (0, import_react38.useEffect)(() => {
6895
+ const [isActive, setIsActive] = (0, import_react43.useState)(false);
6896
+ (0, import_react43.useEffect)(() => {
6575
6897
  setIsActive(width === state.ui.viewports.current.width);
6576
6898
  }, [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)(
6899
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6578
6900
  IconButton,
6579
6901
  {
6580
6902
  title,
@@ -6583,7 +6905,7 @@ var ViewportButton = ({
6583
6905
  e.stopPropagation();
6584
6906
  onClick({ width, height });
6585
6907
  },
6586
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: getClassNameButton("inner"), children })
6908
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
6587
6909
  }
6588
6910
  ) });
6589
6911
  };
@@ -6607,7 +6929,7 @@ var ViewportControls = ({
6607
6929
  const defaultsContainAutoZoom = defaultZoomOptions.find(
6608
6930
  (option) => option.value === autoZoom
6609
6931
  );
6610
- const zoomOptions = (0, import_react38.useMemo)(
6932
+ const zoomOptions = (0, import_react43.useMemo)(
6611
6933
  () => [
6612
6934
  ...defaultZoomOptions,
6613
6935
  ...defaultsContainAutoZoom ? [] : [
@@ -6619,8 +6941,8 @@ var ViewportControls = ({
6619
6941
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
6620
6942
  [autoZoom]
6621
6943
  );
6622
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25(), children: [
6623
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6944
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
6945
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6624
6946
  ViewportButton,
6625
6947
  {
6626
6948
  height: viewport.height,
@@ -6631,8 +6953,8 @@ var ViewportControls = ({
6631
6953
  },
6632
6954
  i
6633
6955
  )),
6634
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("divider") }),
6635
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6956
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
6957
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6636
6958
  IconButton,
6637
6959
  {
6638
6960
  title: "Zoom viewport out",
@@ -6646,10 +6968,10 @@ var ViewportControls = ({
6646
6968
  )].value
6647
6969
  );
6648
6970
  },
6649
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ZoomOut, { size: 16 })
6971
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
6650
6972
  }
6651
6973
  ),
6652
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6974
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6653
6975
  IconButton,
6654
6976
  {
6655
6977
  title: "Zoom viewport in",
@@ -6663,11 +6985,11 @@ var ViewportControls = ({
6663
6985
  )].value
6664
6986
  );
6665
6987
  },
6666
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ZoomIn, { size: 16 })
6988
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
6667
6989
  }
6668
6990
  ),
6669
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("divider") }),
6670
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6991
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
6992
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6671
6993
  "select",
6672
6994
  {
6673
6995
  className: getClassName25("zoomSelect"),
@@ -6675,7 +6997,7 @@ var ViewportControls = ({
6675
6997
  onChange: (e) => {
6676
6998
  onZoom(parseFloat(e.currentTarget.value));
6677
6999
  },
6678
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
7000
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6679
7001
  "option",
6680
7002
  {
6681
7003
  value: option.value,
@@ -6723,24 +7045,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
6723
7045
  };
6724
7046
 
6725
7047
  // components/Puck/components/Canvas/index.tsx
6726
- var import_jsx_runtime35 = require("react/jsx-runtime");
7048
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6727
7049
  var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
6728
7050
  var ZOOM_ON_CHANGE = true;
6729
7051
  var Canvas = () => {
6730
7052
  const { status, iframe } = useAppContext();
6731
7053
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
6732
7054
  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 });
7055
+ const frameRef = (0, import_react44.useRef)(null);
7056
+ const [showTransition, setShowTransition] = (0, import_react44.useState)(false);
7057
+ const defaultRender = (0, import_react44.useMemo)(() => {
7058
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
6737
7059
  return PuckDefault;
6738
7060
  }, []);
6739
- const CustomPreview = (0, import_react39.useMemo)(
7061
+ const CustomPreview = (0, import_react44.useMemo)(
6740
7062
  () => overrides.preview || defaultRender,
6741
7063
  [overrides]
6742
7064
  );
6743
- const getFrameDimensions = (0, import_react39.useCallback)(() => {
7065
+ const getFrameDimensions = (0, import_react44.useCallback)(() => {
6744
7066
  if (frameRef.current) {
6745
7067
  const frame = frameRef.current;
6746
7068
  const box = getBox(frame);
@@ -6748,7 +7070,7 @@ var Canvas = () => {
6748
7070
  }
6749
7071
  return { width: 0, height: 0 };
6750
7072
  }, [frameRef]);
6751
- const resetAutoZoom = (0, import_react39.useCallback)(
7073
+ const resetAutoZoom = (0, import_react44.useCallback)(
6752
7074
  (ui2 = state.ui) => {
6753
7075
  if (frameRef.current) {
6754
7076
  setZoomConfig(
@@ -6758,11 +7080,11 @@ var Canvas = () => {
6758
7080
  },
6759
7081
  [frameRef, zoomConfig, state.ui]
6760
7082
  );
6761
- (0, import_react39.useEffect)(() => {
7083
+ (0, import_react44.useEffect)(() => {
6762
7084
  setShowTransition(false);
6763
7085
  resetAutoZoom();
6764
7086
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
6765
- (0, import_react39.useEffect)(() => {
7087
+ (0, import_react44.useEffect)(() => {
6766
7088
  const { height: frameHeight } = getFrameDimensions();
6767
7089
  if (ui.viewports.current.height === "auto") {
6768
7090
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -6770,13 +7092,13 @@ var Canvas = () => {
6770
7092
  }));
6771
7093
  }
6772
7094
  }, [zoomConfig.zoom]);
6773
- (0, import_react39.useEffect)(() => {
7095
+ (0, import_react44.useEffect)(() => {
6774
7096
  if (ZOOM_ON_CHANGE) {
6775
7097
  setShowTransition(true);
6776
7098
  resetAutoZoom(ui);
6777
7099
  }
6778
7100
  }, [ui.viewports.current.width]);
6779
- (0, import_react39.useEffect)(() => {
7101
+ (0, import_react44.useEffect)(() => {
6780
7102
  const cb = () => {
6781
7103
  setShowTransition(false);
6782
7104
  resetAutoZoom();
@@ -6786,13 +7108,13 @@ var Canvas = () => {
6786
7108
  window.removeEventListener("resize", cb);
6787
7109
  };
6788
7110
  }, []);
6789
- const [showLoader, setShowLoader] = (0, import_react39.useState)(false);
6790
- (0, import_react39.useEffect)(() => {
7111
+ const [showLoader, setShowLoader] = (0, import_react44.useState)(false);
7112
+ (0, import_react44.useEffect)(() => {
6791
7113
  setTimeout(() => {
6792
7114
  setShowLoader(true);
6793
7115
  }, 500);
6794
7116
  }, []);
6795
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
7117
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6796
7118
  "div",
6797
7119
  {
6798
7120
  className: getClassName26({
@@ -6805,7 +7127,7 @@ var Canvas = () => {
6805
7127
  recordHistory: true
6806
7128
  }),
6807
7129
  children: [
6808
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7130
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6809
7131
  ViewportControls,
6810
7132
  {
6811
7133
  autoZoom: zoomConfig.autoZoom,
@@ -6831,8 +7153,8 @@ var Canvas = () => {
6831
7153
  }
6832
7154
  }
6833
7155
  ) }),
6834
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
6835
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
7156
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getClassName26("inner"), ref: frameRef, children: [
7157
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
6836
7158
  "div",
6837
7159
  {
6838
7160
  className: getClassName26("root"),
@@ -6853,10 +7175,10 @@ var Canvas = () => {
6853
7175
  })
6854
7176
  );
6855
7177
  },
6856
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Preview, {}) })
7178
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview2, {}) })
6857
7179
  }
6858
7180
  ),
6859
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loader, { size: 24 }) })
7181
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Loader, { size: 24 }) })
6860
7182
  ] })
6861
7183
  ]
6862
7184
  }
@@ -6865,7 +7187,7 @@ var Canvas = () => {
6865
7187
 
6866
7188
  // lib/use-loaded-overrides.ts
6867
7189
  init_react_import();
6868
- var import_react40 = require("react");
7190
+ var import_react45 = require("react");
6869
7191
 
6870
7192
  // lib/load-overrides.ts
6871
7193
  init_react_import();
@@ -6904,29 +7226,26 @@ var useLoadedOverrides = ({
6904
7226
  overrides,
6905
7227
  plugins
6906
7228
  }) => {
6907
- return (0, import_react40.useMemo)(() => {
7229
+ return (0, import_react45.useMemo)(() => {
6908
7230
  return loadOverrides({ overrides, plugins });
6909
7231
  }, [plugins, overrides]);
6910
7232
  };
6911
7233
 
6912
7234
  // components/DefaultOverride/index.tsx
6913
7235
  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 });
6916
-
6917
- // components/Puck/index.tsx
6918
- var import_dom2 = require("@dnd-kit/dom");
7236
+ var import_jsx_runtime38 = require("react/jsx-runtime");
7237
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children });
6919
7238
 
6920
7239
  // lib/use-inject-css.ts
6921
7240
  init_react_import();
6922
- var import_react41 = require("react");
7241
+ var import_react46 = require("react");
6923
7242
  var styles = ``;
6924
7243
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
6925
- const [el, setEl] = (0, import_react41.useState)();
6926
- (0, import_react41.useEffect)(() => {
7244
+ const [el, setEl] = (0, import_react46.useState)();
7245
+ (0, import_react46.useEffect)(() => {
6927
7246
  setEl(document.createElement("style"));
6928
7247
  }, []);
6929
- (0, import_react41.useEffect)(() => {
7248
+ (0, import_react46.useEffect)(() => {
6930
7249
  var _a;
6931
7250
  if (!el || typeof window === "undefined") {
6932
7251
  return;
@@ -6944,8 +7263,35 @@ var useInjectGlobalCss = (iframeEnabled) => {
6944
7263
  return useInjectStyleSheet(styles, iframeEnabled);
6945
7264
  };
6946
7265
 
7266
+ // lib/use-preview-mode-hotkeys.ts
7267
+ init_react_import();
7268
+ var import_react47 = require("react");
7269
+ var import_react_hotkeys_hook2 = require("react-hotkeys-hook");
7270
+ var usePreviewModeHotkeys = (dispatch, iframeEnabled) => {
7271
+ const toggleInteractive = (0, import_react47.useCallback)(() => {
7272
+ dispatch({
7273
+ type: "setUi",
7274
+ ui: (ui) => ({
7275
+ previewMode: ui.previewMode === "edit" ? "interactive" : "edit"
7276
+ })
7277
+ });
7278
+ }, [dispatch]);
7279
+ const toggleInteractiveIframe = () => {
7280
+ if (iframeEnabled) {
7281
+ toggleInteractive();
7282
+ }
7283
+ };
7284
+ const frame = getFrame();
7285
+ const resolvedFrame = typeof window !== "undefined" && frame !== document ? frame : void 0;
7286
+ (0, import_react_hotkeys_hook2.useHotkeys)("meta+i", toggleInteractive, { preventDefault: true });
7287
+ (0, import_react_hotkeys_hook2.useHotkeys)("meta+i", toggleInteractiveIframe, {
7288
+ preventDefault: true,
7289
+ document: resolvedFrame
7290
+ });
7291
+ };
7292
+
6947
7293
  // components/Puck/index.tsx
6948
- var import_jsx_runtime37 = require("react/jsx-runtime");
7294
+ var import_jsx_runtime39 = require("react/jsx-runtime");
6949
7295
  var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
6950
7296
  var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
6951
7297
  function Puck({
@@ -6974,7 +7320,7 @@ function Puck({
6974
7320
  waitForStyles: true
6975
7321
  }, _iframe);
6976
7322
  useInjectGlobalCss(iframe.enabled);
6977
- const [generatedAppState] = (0, import_react42.useState)(() => {
7323
+ const [generatedAppState] = (0, import_react48.useState)(() => {
6978
7324
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
6979
7325
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
6980
7326
  let clientUiState = {};
@@ -7046,14 +7392,14 @@ function Puck({
7046
7392
  histories,
7047
7393
  index: initialHistoryIndex
7048
7394
  });
7049
- const [reducer] = (0, import_react42.useState)(
7395
+ const [reducer] = (0, import_react48.useState)(
7050
7396
  () => createReducer({
7051
7397
  config,
7052
7398
  record: historyStore.record,
7053
7399
  onAction
7054
7400
  })
7055
7401
  );
7056
- const [appState, dispatch] = (0, import_react42.useReducer)(
7402
+ const [appState, dispatch] = (0, import_react48.useReducer)(
7057
7403
  reducer,
7058
7404
  flushZones(initialAppState)
7059
7405
  );
@@ -7064,14 +7410,14 @@ function Puck({
7064
7410
  historyStore,
7065
7411
  iframeEnabled: (_a = _iframe == null ? void 0 : _iframe.enabled) != null ? _a : true
7066
7412
  });
7067
- const [menuOpen, setMenuOpen] = (0, import_react42.useState)(false);
7413
+ const [menuOpen, setMenuOpen] = (0, import_react48.useState)(false);
7068
7414
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
7069
7415
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
7070
- (0, import_react42.useEffect)(() => {
7416
+ (0, import_react48.useEffect)(() => {
7071
7417
  if (onChange) onChange(data);
7072
7418
  }, [data]);
7073
7419
  const rootProps = data.root.props || data.root;
7074
- const toggleSidebars = (0, import_react42.useCallback)(
7420
+ const toggleSidebars = (0, import_react48.useCallback)(
7075
7421
  (sidebar) => {
7076
7422
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
7077
7423
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -7085,7 +7431,7 @@ function Puck({
7085
7431
  },
7086
7432
  [dispatch, leftSideBarVisible, rightSideBarVisible]
7087
7433
  );
7088
- (0, import_react42.useEffect)(() => {
7434
+ (0, import_react48.useEffect)(() => {
7089
7435
  if (!window.matchMedia("(min-width: 638px)").matches) {
7090
7436
  dispatch({
7091
7437
  type: "setUi",
@@ -7108,7 +7454,7 @@ function Puck({
7108
7454
  window.removeEventListener("resize", handleResize);
7109
7455
  };
7110
7456
  }, []);
7111
- const defaultHeaderRender = (0, import_react42.useMemo)(() => {
7457
+ const defaultHeaderRender = (0, import_react48.useMemo)(() => {
7112
7458
  if (renderHeader) {
7113
7459
  console.warn(
7114
7460
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -7116,20 +7462,20 @@ function Puck({
7116
7462
  const RenderHeader = (_a2) => {
7117
7463
  var _b2 = _a2, { actions } = _b2, props = __objRest(_b2, ["actions"]);
7118
7464
  const Comp = renderHeader;
7119
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7465
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7120
7466
  };
7121
7467
  return RenderHeader;
7122
7468
  }
7123
7469
  return DefaultOverride;
7124
7470
  }, [renderHeader]);
7125
- const defaultHeaderActionsRender = (0, import_react42.useMemo)(() => {
7471
+ const defaultHeaderActionsRender = (0, import_react48.useMemo)(() => {
7126
7472
  if (renderHeaderActions) {
7127
7473
  console.warn(
7128
7474
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
7129
7475
  );
7130
7476
  const RenderHeader = (props) => {
7131
7477
  const Comp = renderHeaderActions;
7132
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7478
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7133
7479
  };
7134
7480
  return RenderHeader;
7135
7481
  }
@@ -7139,27 +7485,27 @@ function Puck({
7139
7485
  overrides,
7140
7486
  plugins
7141
7487
  });
7142
- const CustomPuck = (0, import_react42.useMemo)(
7488
+ const CustomPuck = (0, import_react48.useMemo)(
7143
7489
  () => loadedOverrides.puck || DefaultOverride,
7144
7490
  [loadedOverrides]
7145
7491
  );
7146
- const CustomHeader = (0, import_react42.useMemo)(
7492
+ const CustomHeader = (0, import_react48.useMemo)(
7147
7493
  () => loadedOverrides.header || defaultHeaderRender,
7148
7494
  [loadedOverrides]
7149
7495
  );
7150
- const CustomHeaderActions = (0, import_react42.useMemo)(
7496
+ const CustomHeaderActions = (0, import_react48.useMemo)(
7151
7497
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
7152
7498
  [loadedOverrides]
7153
7499
  );
7154
- const [mounted, setMounted] = (0, import_react42.useState)(false);
7155
- (0, import_react42.useEffect)(() => {
7500
+ const [mounted, setMounted] = (0, import_react48.useState)(false);
7501
+ (0, import_react48.useEffect)(() => {
7156
7502
  setMounted(true);
7157
7503
  }, []);
7158
7504
  const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
7159
7505
  const selectedComponentLabel = selectedItem ? (_b = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _b : selectedItem.type.toString() : "";
7160
- const [manager] = (0, import_react42.useState)(new import_dom2.DragDropManager({ plugins: [import_dom2.Feedback] }));
7161
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
7162
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7506
+ usePreviewModeHotkeys(dispatch, iframe.enabled);
7507
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
7508
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7163
7509
  AppProvider,
7164
7510
  {
7165
7511
  value: {
@@ -7181,7 +7527,7 @@ function Puck({
7181
7527
  getPermissions: () => ({}),
7182
7528
  refreshPermissions: () => null
7183
7529
  },
7184
- 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)(
7530
+ 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)(
7185
7531
  "div",
7186
7532
  {
7187
7533
  className: getLayoutClassName({
@@ -7190,60 +7536,60 @@ function Puck({
7190
7536
  mounted,
7191
7537
  rightSideBarVisible
7192
7538
  }),
7193
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("inner"), children: [
7194
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7539
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("inner"), children: [
7540
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7195
7541
  CustomHeader,
7196
7542
  {
7197
- 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)(
7543
+ 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)(
7198
7544
  Button,
7199
7545
  {
7200
7546
  onClick: () => {
7201
7547
  onPublish && onPublish(data);
7202
7548
  },
7203
- icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Globe, { size: "14px" }),
7549
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
7204
7550
  children: "Publish"
7205
7551
  }
7206
7552
  ) }) }),
7207
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
7208
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
7209
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7553
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
7554
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
7555
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7210
7556
  "div",
7211
7557
  {
7212
7558
  className: getLayoutClassName("leftSideBarToggle"),
7213
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7559
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7214
7560
  IconButton,
7215
7561
  {
7216
7562
  onClick: () => {
7217
7563
  toggleSidebars("left");
7218
7564
  },
7219
7565
  title: "Toggle left sidebar",
7220
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PanelLeft, { focusable: "false" })
7566
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelLeft, { focusable: "false" })
7221
7567
  }
7222
7568
  )
7223
7569
  }
7224
7570
  ),
7225
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7571
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7226
7572
  "div",
7227
7573
  {
7228
7574
  className: getLayoutClassName("rightSideBarToggle"),
7229
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7575
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7230
7576
  IconButton,
7231
7577
  {
7232
7578
  onClick: () => {
7233
7579
  toggleSidebars("right");
7234
7580
  },
7235
7581
  title: "Toggle right sidebar",
7236
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PanelRight, { focusable: "false" })
7582
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PanelRight, { focusable: "false" })
7237
7583
  }
7238
7584
  )
7239
7585
  }
7240
7586
  )
7241
7587
  ] }),
7242
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Heading, { rank: "2", size: "xs", children: [
7588
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Heading, { rank: "2", size: "xs", children: [
7243
7589
  headerTitle || rootProps.title || "Page",
7244
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
7590
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
7245
7591
  " ",
7246
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7592
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7247
7593
  "code",
7248
7594
  {
7249
7595
  className: getLayoutClassName("headerPath"),
@@ -7252,31 +7598,31 @@ function Puck({
7252
7598
  )
7253
7599
  ] })
7254
7600
  ] }) }),
7255
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
7256
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7601
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
7602
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7257
7603
  IconButton,
7258
7604
  {
7259
7605
  onClick: () => {
7260
7606
  return setMenuOpen(!menuOpen);
7261
7607
  },
7262
7608
  title: "Toggle menu bar",
7263
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronDown, { focusable: "false" })
7609
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronDown, { focusable: "false" })
7264
7610
  }
7265
7611
  ) }),
7266
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7612
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7267
7613
  MenuBar,
7268
7614
  {
7269
7615
  appState,
7270
7616
  dispatch,
7271
7617
  onPublish,
7272
7618
  menuOpen,
7273
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7619
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7274
7620
  Button,
7275
7621
  {
7276
7622
  onClick: () => {
7277
7623
  onPublish && onPublish(data);
7278
7624
  },
7279
- icon: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Globe, { size: "14px" }),
7625
+ icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Globe, { size: "14px" }),
7280
7626
  children: "Publish"
7281
7627
  }
7282
7628
  ) }),
@@ -7287,19 +7633,19 @@ function Puck({
7287
7633
  ] }) })
7288
7634
  }
7289
7635
  ),
7290
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
7291
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Components, {}) }),
7292
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Outline, {}) })
7636
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
7637
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Components, {}) }),
7638
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Outline, {}) })
7293
7639
  ] }),
7294
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Canvas, {}),
7295
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
7640
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Canvas, {}),
7641
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
7296
7642
  SidebarSection,
7297
7643
  {
7298
7644
  noPadding: true,
7299
7645
  noBorderTop: true,
7300
7646
  showBreadcrumbs: true,
7301
7647
  title: selectedItem ? selectedComponentLabel : "Page",
7302
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Fields, {})
7648
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Fields, {})
7303
7649
  }
7304
7650
  ) })
7305
7651
  ] })
@@ -7307,69 +7653,13 @@ function Puck({
7307
7653
  ) }) })
7308
7654
  }
7309
7655
  ),
7310
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
7656
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
7311
7657
  ] });
7312
7658
  }
7313
7659
  Puck.Components = Components;
7314
7660
  Puck.Fields = Fields;
7315
7661
  Puck.Outline = Outline;
7316
- Puck.Preview = Preview;
7317
-
7318
- // components/Render/index.tsx
7319
- init_react_import();
7320
- var import_jsx_runtime38 = require("react/jsx-runtime");
7321
- function Render({
7322
- config,
7323
- data
7324
- }) {
7325
- var _a;
7326
- const defaultedData = __spreadProps(__spreadValues({}, data), {
7327
- root: data.root || {},
7328
- content: data.content || []
7329
- });
7330
- const rootProps = defaultedData.root.props || defaultedData.root;
7331
- const title = (rootProps == null ? void 0 : rootProps.title) || "";
7332
- if ((_a = config.root) == null ? void 0 : _a.render) {
7333
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7334
- DropZoneProvider,
7335
- {
7336
- value: {
7337
- data: defaultedData,
7338
- config,
7339
- mode: "render",
7340
- depth: 0,
7341
- path: []
7342
- },
7343
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7344
- config.root.render,
7345
- __spreadProps(__spreadValues({}, rootProps), {
7346
- puck: {
7347
- renderDropZone: DropZone,
7348
- isEditing: false
7349
- },
7350
- title,
7351
- editMode: false,
7352
- id: "puck-root",
7353
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DropZone, { zone: rootDroppableId })
7354
- })
7355
- )
7356
- }
7357
- );
7358
- }
7359
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
7360
- DropZoneProvider,
7361
- {
7362
- value: {
7363
- data: defaultedData,
7364
- config,
7365
- mode: "render",
7366
- depth: 0,
7367
- path: []
7368
- },
7369
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DropZone, { zone: rootDroppableId })
7370
- }
7371
- );
7372
- }
7662
+ Puck.Preview = Preview2;
7373
7663
 
7374
7664
  // lib/migrate.ts
7375
7665
  init_react_import();