@measured/puck 0.14.0-canary.03dd90b → 0.14.0-canary.053d4c6

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -8084,7 +8084,7 @@ var require_react_dom_development = __commonJS({
8084
8084
  var HostPortal = 4;
8085
8085
  var HostComponent = 5;
8086
8086
  var HostText = 6;
8087
- var Fragment16 = 7;
8087
+ var Fragment17 = 7;
8088
8088
  var Mode = 8;
8089
8089
  var ContextConsumer = 9;
8090
8090
  var ContextProvider = 10;
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
9240
9240
  return "DehydratedFragment";
9241
9241
  case ForwardRef:
9242
9242
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment16:
9243
+ case Fragment17:
9244
9244
  return "Fragment";
9245
9245
  case HostComponent:
9246
9246
  return type;
@@ -18911,7 +18911,7 @@ var require_react_dom_development = __commonJS({
18911
18911
  }
18912
18912
  }
18913
18913
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
18914
- if (current2 === null || current2.tag !== Fragment16) {
18914
+ if (current2 === null || current2.tag !== Fragment17) {
18915
18915
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
18916
18916
  created.return = returnFiber;
18917
18917
  return created;
@@ -19314,7 +19314,7 @@ var require_react_dom_development = __commonJS({
19314
19314
  if (child.key === key) {
19315
19315
  var elementType = element.type;
19316
19316
  if (elementType === REACT_FRAGMENT_TYPE) {
19317
- if (child.tag === Fragment16) {
19317
+ if (child.tag === Fragment17) {
19318
19318
  deleteRemainingChildren(returnFiber, child.sibling);
19319
19319
  var existing = useFiber(child, element.props.children);
19320
19320
  existing.return = returnFiber;
@@ -23489,7 +23489,7 @@ var require_react_dom_development = __commonJS({
23489
23489
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
23490
23490
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
23491
23491
  }
23492
- case Fragment16:
23492
+ case Fragment17:
23493
23493
  return updateFragment(current2, workInProgress2, renderLanes2);
23494
23494
  case Mode:
23495
23495
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23762,7 +23762,7 @@ var require_react_dom_development = __commonJS({
23762
23762
  case SimpleMemoComponent:
23763
23763
  case FunctionComponent:
23764
23764
  case ForwardRef:
23765
- case Fragment16:
23765
+ case Fragment17:
23766
23766
  case Mode:
23767
23767
  case Profiler:
23768
23768
  case ContextConsumer:
@@ -28021,7 +28021,7 @@ var require_react_dom_development = __commonJS({
28021
28021
  return fiber;
28022
28022
  }
28023
28023
  function createFiberFromFragment(elements, mode, lanes, key) {
28024
- var fiber = createFiber(Fragment16, elements, key, mode);
28024
+ var fiber = createFiber(Fragment17, elements, key, mode);
28025
28025
  fiber.lanes = lanes;
28026
28026
  return fiber;
28027
28027
  }
@@ -29173,7 +29173,7 @@ var import_react2 = require("react");
29173
29173
 
29174
29174
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
29175
29175
  init_react_import();
29176
- var Button_module_default = { "Button": "_Button_8fn3a_1", "Button--medium": "_Button--medium_8fn3a_29", "Button--large": "_Button--large_8fn3a_37", "Button-icon": "_Button-icon_8fn3a_44", "Button--primary": "_Button--primary_8fn3a_48", "Button--secondary": "_Button--secondary_8fn3a_67", "Button--flush": "_Button--flush_8fn3a_82", "Button--disabled": "_Button--disabled_8fn3a_86", "Button--fullWidth": "_Button--fullWidth_8fn3a_93", "Button-spinner": "_Button-spinner_8fn3a_98" };
29176
+ var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
29177
29177
 
29178
29178
  // lib/get-class-name-factory.ts
29179
29179
  init_react_import();
@@ -29879,6 +29879,18 @@ var useModifierHeld = (modifier) => {
29879
29879
  return modifierHeld;
29880
29880
  };
29881
29881
 
29882
+ // lib/is-ios.ts
29883
+ init_react_import();
29884
+ var isIos = () => [
29885
+ "iPad Simulator",
29886
+ "iPhone Simulator",
29887
+ "iPod Simulator",
29888
+ "iPad",
29889
+ "iPhone",
29890
+ "iPod"
29891
+ ].includes(navigator.platform) || // iPad on iOS 13 detection
29892
+ navigator.userAgent.includes("Mac") && "ontouchend" in document;
29893
+
29882
29894
  // components/DraggableComponent/index.tsx
29883
29895
  var import_react_spinners2 = require("react-spinners");
29884
29896
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -29914,65 +29926,81 @@ var DraggableComponent = ({
29914
29926
  const { status } = useAppContext();
29915
29927
  const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
29916
29928
  (0, import_react7.useEffect)(onMount, []);
29917
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29918
- "div",
29919
- __spreadProps(__spreadValues(__spreadValues({
29920
- ref: provided.innerRef
29921
- }, provided.draggableProps), provided.dragHandleProps), {
29922
- className: getClassName4({
29923
- isSelected,
29924
- isModifierHeld,
29925
- isDragging: snapshot.isDragging,
29926
- isLocked,
29927
- forceHover,
29928
- indicativeHover
29929
- }),
29930
- style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29931
- cursor: isModifierHeld ? "initial" : "grab"
29932
- }),
29933
- onMouseOver,
29934
- onMouseOut,
29935
- onMouseDown,
29936
- onMouseUp,
29937
- onClick,
29938
- children: [
29939
- debug,
29940
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29941
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29942
- "div",
29943
- {
29944
- className: getClassName4("actionsOverlay"),
29945
- style: {
29946
- top: actionsOverlayTop / zoomConfig.zoom
29947
- },
29948
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29929
+ const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react7.useState)(false);
29930
+ (0, import_react7.useEffect)(() => {
29931
+ if (isIos()) {
29932
+ setDisableSecondaryAnimation(true);
29933
+ }
29934
+ }, []);
29935
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29936
+ El,
29937
+ {
29938
+ draggableId: id,
29939
+ index,
29940
+ isDragDisabled,
29941
+ disableSecondaryAnimation,
29942
+ children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29943
+ "div",
29944
+ __spreadProps(__spreadValues(__spreadValues({
29945
+ ref: provided.innerRef
29946
+ }, provided.draggableProps), provided.dragHandleProps), {
29947
+ className: getClassName4({
29948
+ isSelected,
29949
+ isModifierHeld,
29950
+ isDragging: snapshot.isDragging,
29951
+ isLocked,
29952
+ forceHover,
29953
+ indicativeHover
29954
+ }),
29955
+ style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29956
+ cursor: isModifierHeld ? "initial" : "grab"
29957
+ }),
29958
+ onMouseOver,
29959
+ onMouseOut,
29960
+ onMouseDown,
29961
+ onMouseUp,
29962
+ onClick,
29963
+ children: [
29964
+ debug,
29965
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29966
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29949
29967
  "div",
29950
29968
  {
29951
- className: getClassName4("actions"),
29969
+ className: getClassName4("actionsOverlay"),
29952
29970
  style: {
29953
- transform: `scale(${1 / zoomConfig.zoom}`,
29954
- top: actionsTop / zoomConfig.zoom,
29955
- right: actionsRight / zoomConfig.zoom
29971
+ top: actionsOverlayTop / zoomConfig.zoom
29956
29972
  },
29957
- children: [
29958
- label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29959
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
29960
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
29961
- ]
29973
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29974
+ "div",
29975
+ {
29976
+ className: getClassName4("actions"),
29977
+ style: {
29978
+ transform: `scale(${1 / zoomConfig.zoom}`,
29979
+ top: actionsTop / zoomConfig.zoom,
29980
+ right: actionsRight / zoomConfig.zoom
29981
+ },
29982
+ children: [
29983
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29984
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
29985
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
29986
+ ]
29987
+ }
29988
+ )
29962
29989
  }
29963
- )
29964
- }
29965
- ),
29966
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
29967
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
29968
- ]
29969
- })
29970
- ) }, id);
29990
+ ),
29991
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
29992
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
29993
+ ]
29994
+ })
29995
+ )
29996
+ },
29997
+ id
29998
+ );
29971
29999
  };
29972
30000
 
29973
30001
  // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29974
30002
  init_react_import();
29975
- var styles_module_default4 = { "DropZone": "_DropZone_jtf9d_1", "DropZone-content": "_DropZone-content_jtf9d_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_jtf9d_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_jtf9d_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_jtf9d_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_jtf9d_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_jtf9d_27", "DropZone--isDisabled": "_DropZone--isDisabled_jtf9d_28", "DropZone--isRootZone": "_DropZone--isRootZone_jtf9d_29", "DropZone--hasChildren": "_DropZone--hasChildren_jtf9d_30", "DropZone--isDestination": "_DropZone--isDestination_jtf9d_40", "DropZone-item": "_DropZone-item_jtf9d_48", "DropZone-hitbox": "_DropZone-hitbox_jtf9d_52" };
30003
+ var styles_module_default4 = { "DropZone": "_DropZone_w4btq_1", "DropZone-content": "_DropZone-content_w4btq_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_w4btq_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_w4btq_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_w4btq_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_w4btq_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_w4btq_27", "DropZone--isDisabled": "_DropZone--isDisabled_w4btq_28", "DropZone--isRootZone": "_DropZone--isRootZone_w4btq_29", "DropZone--hasChildren": "_DropZone--hasChildren_w4btq_30", "DropZone--isDestination": "_DropZone--isDestination_w4btq_40", "DropZone-item": "_DropZone-item_w4btq_52", "DropZone-hitbox": "_DropZone-hitbox_w4btq_56" };
29976
30004
 
29977
30005
  // components/DropZone/context.tsx
29978
30006
  init_react_import();
@@ -30470,14 +30498,10 @@ var IconButton = ({
30470
30498
 
30471
30499
  // components/Puck/index.tsx
30472
30500
  init_react_import();
30473
- var import_react29 = require("react");
30501
+ var import_react28 = require("react");
30474
30502
 
30475
30503
  // lib/use-placeholder-style.ts
30476
30504
  init_react_import();
30477
- var import_react12 = require("react");
30478
-
30479
- // lib/use-frame.ts
30480
- init_react_import();
30481
30505
  var import_react11 = require("react");
30482
30506
 
30483
30507
  // lib/get-frame.ts
@@ -30485,36 +30509,27 @@ init_react_import();
30485
30509
  var getFrame = () => {
30486
30510
  let frame = document.querySelector("#preview-frame");
30487
30511
  if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
30488
- frame = frame.contentDocument.body;
30512
+ frame = frame.contentDocument;
30489
30513
  }
30490
30514
  return frame;
30491
30515
  };
30492
30516
 
30493
- // lib/use-frame.ts
30494
- var useFrame = () => {
30495
- const [el, setEl] = (0, import_react11.useState)();
30496
- (0, import_react11.useEffect)(() => {
30497
- setEl(getFrame());
30498
- }, []);
30499
- return el;
30500
- };
30501
-
30502
30517
  // lib/use-placeholder-style.ts
30503
30518
  var usePlaceholderStyle = () => {
30504
30519
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30505
- const [placeholderStyle, setPlaceholderStyle] = (0, import_react12.useState)();
30506
- const frame = useFrame();
30520
+ const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
30507
30521
  const onDragStartOrUpdate = (draggedItem) => {
30508
30522
  var _a;
30509
30523
  const draggableId = draggedItem.draggableId;
30510
30524
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30511
30525
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30512
30526
  const domQuery = `[${queryAttr}='${draggableId}']`;
30513
- const draggedDOM = frame == null ? void 0 : frame.ownerDocument.querySelector(domQuery);
30527
+ const frame = getFrame();
30528
+ const draggedDOM = document.querySelector(domQuery) || (frame == null ? void 0 : frame.querySelector(domQuery));
30514
30529
  if (!draggedDOM) {
30515
30530
  return;
30516
30531
  }
30517
- const targetListElement = frame == null ? void 0 : frame.ownerDocument.querySelector(
30532
+ const targetListElement = frame == null ? void 0 : frame.querySelector(
30518
30533
  `[data-rfd-droppable-id='${droppableId}']`
30519
30534
  );
30520
30535
  const { clientHeight } = draggedDOM;
@@ -30578,7 +30593,7 @@ var Heading = ({ children, rank, size = "m" }) => {
30578
30593
 
30579
30594
  // lib/use-breadcrumbs.ts
30580
30595
  init_react_import();
30581
- var import_react13 = require("react");
30596
+ var import_react12 = require("react");
30582
30597
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
30583
30598
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
30584
30599
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -30628,8 +30643,8 @@ var useBreadcrumbs = (renderCount) => {
30628
30643
  state: { data },
30629
30644
  selectedItem
30630
30645
  } = useAppContext();
30631
- const dzContext = (0, import_react13.useContext)(dropZoneContext);
30632
- return (0, import_react13.useMemo)(() => {
30646
+ const dzContext = (0, import_react12.useContext)(dropZoneContext);
30647
+ return (0, import_react12.useMemo)(() => {
30633
30648
  const breadcrumbs = convertPathDataToBreadcrumbs(
30634
30649
  selectedItem,
30635
30650
  dzContext == null ? void 0 : dzContext.pathData,
@@ -31046,7 +31061,7 @@ var flushZones = (appState) => {
31046
31061
 
31047
31062
  // lib/use-resolved-data.ts
31048
31063
  init_react_import();
31049
- var import_react14 = require("react");
31064
+ var import_react13 = require("react");
31050
31065
 
31051
31066
  // lib/resolve-component-data.ts
31052
31067
  init_react_import();
@@ -31161,13 +31176,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
31161
31176
 
31162
31177
  // lib/use-resolved-data.ts
31163
31178
  var useResolvedData = (appState, config, dispatch) => {
31164
- const [{ resolverKey, newAppState }, setResolverState] = (0, import_react14.useState)({
31179
+ const [{ resolverKey, newAppState }, setResolverState] = (0, import_react13.useState)({
31165
31180
  resolverKey: 0,
31166
31181
  newAppState: appState
31167
31182
  });
31168
- const [componentState, setComponentState] = (0, import_react14.useState)({});
31183
+ const [componentState, setComponentState] = (0, import_react13.useState)({});
31169
31184
  const deferredSetStates = {};
31170
- const setComponentLoading = (0, import_react14.useCallback)(
31185
+ const setComponentLoading = (0, import_react13.useCallback)(
31171
31186
  (id, loading, defer = 0) => {
31172
31187
  if (deferredSetStates[id]) {
31173
31188
  clearTimeout(deferredSetStates[id]);
@@ -31237,10 +31252,10 @@ var useResolvedData = (appState, config, dispatch) => {
31237
31252
  });
31238
31253
  yield Promise.all(promises);
31239
31254
  });
31240
- (0, import_react14.useEffect)(() => {
31255
+ (0, import_react13.useEffect)(() => {
31241
31256
  runResolvers();
31242
31257
  }, [resolverKey]);
31243
- const resolveData = (0, import_react14.useCallback)((newAppState2 = appState) => {
31258
+ const resolveData = (0, import_react13.useCallback)((newAppState2 = appState) => {
31244
31259
  setResolverState((curr) => ({
31245
31260
  resolverKey: curr.resolverKey + 1,
31246
31261
  newAppState: newAppState2
@@ -31327,7 +31342,7 @@ var MenuBar = ({
31327
31342
 
31328
31343
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31329
31344
  init_react_import();
31330
- var styles_module_default8 = { "Puck": "_Puck_1lfcm_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_1lfcm_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_1lfcm_42", "Puck-header": "_Puck-header_1lfcm_96", "Puck-headerInner": "_Puck-headerInner_1lfcm_105", "Puck-headerToggle": "_Puck-headerToggle_1lfcm_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_1lfcm_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_1lfcm_123", "Puck-headerTitle": "_Puck-headerTitle_1lfcm_127", "Puck-headerPath": "_Puck-headerPath_1lfcm_131", "Puck-headerTools": "_Puck-headerTools_1lfcm_138", "Puck-menuButton": "_Puck-menuButton_1lfcm_144", "Puck--menuOpen": "_Puck--menuOpen_1lfcm_149", "Puck-leftSideBar": "_Puck-leftSideBar_1lfcm_123", "Puck-rightSideBar": "_Puck-rightSideBar_1lfcm_122" };
31345
+ var styles_module_default8 = { "Puck": "_Puck_u70b9_19", "Puck--mounted": "_Puck--mounted_u70b9_36", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_u70b9_40", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_u70b9_46", "Puck-mounted": "_Puck-mounted_u70b9_59", "Puck-header": "_Puck-header_u70b9_100", "Puck-headerInner": "_Puck-headerInner_u70b9_109", "Puck-headerToggle": "_Puck-headerToggle_u70b9_119", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_u70b9_126", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_u70b9_127", "Puck-headerTitle": "_Puck-headerTitle_u70b9_131", "Puck-headerPath": "_Puck-headerPath_u70b9_135", "Puck-headerTools": "_Puck-headerTools_u70b9_142", "Puck-menuButton": "_Puck-menuButton_u70b9_148", "Puck--menuOpen": "_Puck--menuOpen_u70b9_153", "Puck-leftSideBar": "_Puck-leftSideBar_u70b9_127", "Puck-rightSideBar": "_Puck-rightSideBar_u70b9_126", "Puck-portal": "_Puck-portal_u70b9_181" };
31331
31346
 
31332
31347
  // components/Puck/components/Fields/index.tsx
31333
31348
  init_react_import();
@@ -31341,7 +31356,7 @@ init_react_import();
31341
31356
  var styles_module_default9 = { "Input": "_Input_1qi5b_1", "Input-label": "_Input-label_1qi5b_26", "Input-labelIcon": "_Input-labelIcon_1qi5b_34", "Input-disabledIcon": "_Input-disabledIcon_1qi5b_41", "Input-input": "_Input-input_1qi5b_46", "Input--readOnly": "_Input--readOnly_1qi5b_90", "Input-radioGroupItems": "_Input-radioGroupItems_1qi5b_101", "Input-radio": "_Input-radio_1qi5b_101", "Input-radioInner": "_Input-radioInner_1qi5b_118", "Input-radioInput": "_Input-radioInput_1qi5b_163" };
31342
31357
 
31343
31358
  // components/InputOrGroup/index.tsx
31344
- var import_react19 = require("react");
31359
+ var import_react18 = require("react");
31345
31360
 
31346
31361
  // components/InputOrGroup/fields/index.tsx
31347
31362
  init_react_import();
@@ -31351,10 +31366,10 @@ init_react_import();
31351
31366
 
31352
31367
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
31353
31368
  init_react_import();
31354
- var styles_module_default10 = { "ArrayField": "_ArrayField_1txra_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1txra_13", "ArrayField-addButton": "_ArrayField-addButton_1txra_17", "ArrayField--hasItems": "_ArrayField--hasItems_1txra_32", "ArrayFieldItem": "_ArrayFieldItem_1txra_61", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1txra_69", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1txra_74", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1txra_84", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1txra_108", "ArrayFieldItem-body": "_ArrayFieldItem-body_1txra_142", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1txra_150", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1txra_157", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1txra_163" };
31369
+ var styles_module_default10 = { "ArrayField": "_ArrayField_1lr58_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1lr58_13", "ArrayField-addButton": "_ArrayField-addButton_1lr58_18", "ArrayField--hasItems": "_ArrayField--hasItems_1lr58_33", "ArrayFieldItem": "_ArrayFieldItem_1lr58_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1lr58_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1lr58_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1lr58_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1lr58_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1lr58_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1lr58_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1lr58_180", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1lr58_186" };
31355
31370
 
31356
31371
  // components/InputOrGroup/fields/ArrayField/index.tsx
31357
- var import_react15 = require("react");
31372
+ var import_react14 = require("react");
31358
31373
 
31359
31374
  // components/DragDropContext/index.tsx
31360
31375
  init_react_import();
@@ -31392,11 +31407,11 @@ var ArrayField = ({
31392
31407
  }),
31393
31408
  openId: ""
31394
31409
  };
31395
- const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
31396
- (0, import_react15.useEffect)(() => {
31410
+ const [localState, setLocalState] = (0, import_react14.useState)({ arrayState, value });
31411
+ (0, import_react14.useEffect)(() => {
31397
31412
  setLocalState({ arrayState, value });
31398
31413
  }, [value, state.ui.arrayState[id]]);
31399
- const mapArrayStateToUi = (0, import_react15.useCallback)(
31414
+ const mapArrayStateToUi = (0, import_react14.useCallback)(
31400
31415
  (partialArrayState) => {
31401
31416
  return {
31402
31417
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
@@ -31406,13 +31421,13 @@ var ArrayField = ({
31406
31421
  },
31407
31422
  [arrayState]
31408
31423
  );
31409
- const getHighestIndex = (0, import_react15.useCallback)(() => {
31424
+ const getHighestIndex = (0, import_react14.useCallback)(() => {
31410
31425
  return arrayState.items.reduce(
31411
31426
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
31412
31427
  -1
31413
31428
  );
31414
31429
  }, [arrayState]);
31415
- const regenerateArrayState = (0, import_react15.useCallback)(
31430
+ const regenerateArrayState = (0, import_react14.useCallback)(
31416
31431
  (value2) => {
31417
31432
  let highestIndex = getHighestIndex();
31418
31433
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -31431,13 +31446,16 @@ var ArrayField = ({
31431
31446
  },
31432
31447
  [arrayState]
31433
31448
  );
31434
- (0, import_react15.useEffect)(() => {
31435
- setUi(mapArrayStateToUi(arrayState));
31449
+ (0, import_react14.useEffect)(() => {
31450
+ if (arrayState.items.length > 0) {
31451
+ setUi(mapArrayStateToUi(arrayState));
31452
+ }
31436
31453
  }, []);
31437
- const [hovering, setHovering] = (0, import_react15.useState)(false);
31454
+ const [hovering, setHovering] = (0, import_react14.useState)(false);
31438
31455
  if (field.type !== "array" || !field.arrayFields) {
31439
31456
  return null;
31440
31457
  }
31458
+ const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
31441
31459
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31442
31460
  FieldLabelInternal,
31443
31461
  {
@@ -31479,7 +31497,8 @@ var ArrayField = ({
31479
31497
  ref: provided.innerRef,
31480
31498
  className: getClassName10({
31481
31499
  isDraggingFrom: !!snapshot.draggingFromThisWith,
31482
- hasItems: Array.isArray(value) && value.length > 0
31500
+ hasItems: Array.isArray(value) && value.length > 0,
31501
+ addDisabled
31483
31502
  }),
31484
31503
  onMouseOver: (e) => {
31485
31504
  e.stopPropagation();
@@ -31530,6 +31549,7 @@ var ArrayField = ({
31530
31549
  !readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31531
31550
  IconButton,
31532
31551
  {
31552
+ type: "button",
31533
31553
  disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31534
31554
  onClick: (e) => {
31535
31555
  e.stopPropagation();
@@ -31591,11 +31611,11 @@ var ArrayField = ({
31591
31611
  );
31592
31612
  }),
31593
31613
  provided.placeholder,
31594
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31614
+ !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31595
31615
  "button",
31596
31616
  {
31617
+ type: "button",
31597
31618
  className: getClassName10("addButton"),
31598
- disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
31599
31619
  onClick: () => {
31600
31620
  const existingValue = value || [];
31601
31621
  const newValue = [
@@ -31668,11 +31688,11 @@ var DefaultField = ({
31668
31688
 
31669
31689
  // components/InputOrGroup/fields/ExternalField/index.tsx
31670
31690
  init_react_import();
31671
- var import_react18 = require("react");
31691
+ var import_react17 = require("react");
31672
31692
 
31673
31693
  // components/ExternalInput/index.tsx
31674
31694
  init_react_import();
31675
- var import_react17 = require("react");
31695
+ var import_react16 = require("react");
31676
31696
 
31677
31697
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31678
31698
  init_react_import();
@@ -31680,7 +31700,7 @@ var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions
31680
31700
 
31681
31701
  // components/Modal/index.tsx
31682
31702
  init_react_import();
31683
- var import_react16 = require("react");
31703
+ var import_react15 = require("react");
31684
31704
 
31685
31705
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31686
31706
  init_react_import();
@@ -31695,8 +31715,8 @@ var Modal = ({
31695
31715
  onClose,
31696
31716
  isOpen
31697
31717
  }) => {
31698
- const [rootEl, setRootEl] = (0, import_react16.useState)(null);
31699
- (0, import_react16.useEffect)(() => {
31718
+ const [rootEl, setRootEl] = (0, import_react15.useState)(null);
31719
+ (0, import_react15.useEffect)(() => {
31700
31720
  setRootEl(document.getElementById("puck-portal-root"));
31701
31721
  }, []);
31702
31722
  if (!rootEl) {
@@ -31733,16 +31753,16 @@ var ExternalInput = ({
31733
31753
  mapRow = (val) => val,
31734
31754
  filterFields
31735
31755
  } = field || {};
31736
- const [data, setData] = (0, import_react17.useState)([]);
31737
- const [isOpen, setOpen] = (0, import_react17.useState)(false);
31738
- const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
31756
+ const [data, setData] = (0, import_react16.useState)([]);
31757
+ const [isOpen, setOpen] = (0, import_react16.useState)(false);
31758
+ const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31739
31759
  const hasFilterFields = !!filterFields;
31740
- const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
31741
- const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
31742
- const mappedData = (0, import_react17.useMemo)(() => {
31760
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
31761
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
31762
+ const mappedData = (0, import_react16.useMemo)(() => {
31743
31763
  return data.map(mapRow);
31744
31764
  }, [data]);
31745
- const keys = (0, import_react17.useMemo)(() => {
31765
+ const keys = (0, import_react16.useMemo)(() => {
31746
31766
  const validKeys = /* @__PURE__ */ new Set();
31747
31767
  for (const item of mappedData) {
31748
31768
  for (const key of Object.keys(item)) {
@@ -31753,11 +31773,11 @@ var ExternalInput = ({
31753
31773
  }
31754
31774
  return Array.from(validKeys);
31755
31775
  }, [mappedData]);
31756
- const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
31757
- const search = (0, import_react17.useCallback)(
31776
+ const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31777
+ const search = (0, import_react16.useCallback)(
31758
31778
  (query, filters2) => __async(void 0, null, function* () {
31759
31779
  setIsLoading(true);
31760
- const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
31780
+ const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
31761
31781
  const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
31762
31782
  if (listData) {
31763
31783
  setData(listData);
@@ -31767,7 +31787,7 @@ var ExternalInput = ({
31767
31787
  }),
31768
31788
  [name, field]
31769
31789
  );
31770
- (0, import_react17.useEffect)(() => {
31790
+ (0, import_react16.useEffect)(() => {
31771
31791
  search(searchQuery, filters);
31772
31792
  }, []);
31773
31793
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -31783,6 +31803,7 @@ var ExternalInput = ({
31783
31803
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31784
31804
  "button",
31785
31805
  {
31806
+ type: "button",
31786
31807
  onClick: () => setOpen(true),
31787
31808
  className: getClassName13("button"),
31788
31809
  children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
@@ -31927,7 +31948,7 @@ var ExternalField = ({
31927
31948
  var _a, _b, _c;
31928
31949
  const validField = field;
31929
31950
  const deprecatedField = field;
31930
- (0, import_react18.useEffect)(() => {
31951
+ (0, import_react17.useEffect)(() => {
31931
31952
  if (deprecatedField.adaptor) {
31932
31953
  console.error(
31933
31954
  "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."
@@ -32202,7 +32223,7 @@ var FieldLabelInternal = ({
32202
32223
  readOnly
32203
32224
  }) => {
32204
32225
  const { overrides } = useAppContext();
32205
- const Wrapper = (0, import_react19.useMemo)(
32226
+ const Wrapper = (0, import_react18.useMemo)(
32206
32227
  () => overrides.fieldLabel || FieldLabel,
32207
32228
  [overrides]
32208
32229
  );
@@ -32223,7 +32244,7 @@ var InputOrGroup = (_a) => {
32223
32244
  var _a2, _b2, _c, _d, _e, _f, _g, _h;
32224
32245
  const { overrides } = useAppContext();
32225
32246
  const { name, field, value, readOnly } = props;
32226
- const [localValue, setLocalValue] = (0, import_react19.useState)(value);
32247
+ const [localValue, setLocalValue] = (0, import_react18.useState)(value);
32227
32248
  const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
32228
32249
  (val, ui) => {
32229
32250
  onChange(val, ui);
@@ -32231,11 +32252,11 @@ var InputOrGroup = (_a) => {
32231
32252
  50,
32232
32253
  { leading: true }
32233
32254
  );
32234
- const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
32255
+ const onChangeLocal = (0, import_react18.useCallback)((val, ui) => {
32235
32256
  setLocalValue(val);
32236
32257
  onChangeDb(val, ui);
32237
32258
  }, []);
32238
- (0, import_react19.useEffect)(() => {
32259
+ (0, import_react18.useEffect)(() => {
32239
32260
  setLocalValue(value);
32240
32261
  }, [value]);
32241
32262
  const localProps = {
@@ -32283,7 +32304,7 @@ init_react_import();
32283
32304
  var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
32284
32305
 
32285
32306
  // components/Puck/components/Fields/index.tsx
32286
- var import_react20 = require("react");
32307
+ var import_react19 = require("react");
32287
32308
  var import_jsx_runtime25 = require("react/jsx-runtime");
32288
32309
  var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32289
32310
  var defaultPageFields = {
@@ -32315,7 +32336,7 @@ var Fields = () => {
32315
32336
  const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
32316
32337
  const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
32317
32338
  const rootProps = data.root.props || data.root;
32318
- const Wrapper = (0, import_react20.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32339
+ const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32319
32340
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32320
32341
  "form",
32321
32342
  {
@@ -32430,7 +32451,7 @@ init_react_import();
32430
32451
 
32431
32452
  // lib/use-component-list.tsx
32432
32453
  init_react_import();
32433
- var import_react21 = require("react");
32454
+ var import_react20 = require("react");
32434
32455
 
32435
32456
  // components/ComponentList/index.tsx
32436
32457
  init_react_import();
@@ -32495,8 +32516,8 @@ ComponentList.Item = ComponentListItem;
32495
32516
  // lib/use-component-list.tsx
32496
32517
  var import_jsx_runtime27 = require("react/jsx-runtime");
32497
32518
  var useComponentList = (config, ui) => {
32498
- const [componentList, setComponentList] = (0, import_react21.useState)();
32499
- (0, import_react21.useEffect)(() => {
32519
+ const [componentList, setComponentList] = (0, import_react20.useState)();
32520
+ (0, import_react20.useEffect)(() => {
32500
32521
  var _a, _b, _c;
32501
32522
  if (Object.keys(ui.componentList).length > 0) {
32502
32523
  const matchedComponents = [];
@@ -32563,18 +32584,18 @@ var useComponentList = (config, ui) => {
32563
32584
  };
32564
32585
 
32565
32586
  // components/Puck/components/Components/index.tsx
32566
- var import_react22 = require("react");
32587
+ var import_react21 = require("react");
32567
32588
  var import_jsx_runtime28 = require("react/jsx-runtime");
32568
32589
  var Components = () => {
32569
32590
  const { config, state, overrides } = useAppContext();
32570
32591
  const componentList = useComponentList(config, state.ui);
32571
- const Wrapper = (0, import_react22.useMemo)(() => overrides.components || "div", [overrides]);
32592
+ const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32572
32593
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
32573
32594
  };
32574
32595
 
32575
32596
  // components/Puck/components/Preview/index.tsx
32576
32597
  init_react_import();
32577
- var import_react23 = require("react");
32598
+ var import_react22 = require("react");
32578
32599
  var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32579
32600
 
32580
32601
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
@@ -32586,15 +32607,20 @@ var import_jsx_runtime29 = require("react/jsx-runtime");
32586
32607
  var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
32587
32608
  var Preview = ({ id = "puck-preview" }) => {
32588
32609
  const { config, dispatch, state, setStatus, iframe } = useAppContext();
32589
- const Page = (0, import_react23.useCallback)(
32610
+ const Page = (0, import_react22.useCallback)(
32590
32611
  (pageProps) => {
32591
32612
  var _a, _b;
32592
- return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, pageProps), { editMode: true })) : pageProps.children;
32613
+ return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
32614
+ id: "puck-root"
32615
+ }, pageProps), {
32616
+ editMode: true,
32617
+ puck: { renderDropZone: DropZone }
32618
+ })) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
32593
32619
  },
32594
32620
  [config.root]
32595
32621
  );
32596
32622
  const rootProps = state.data.root.props || state.data.root;
32597
- const ref = (0, import_react23.useRef)(null);
32623
+ const ref = (0, import_react22.useRef)(null);
32598
32624
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32599
32625
  "div",
32600
32626
  {
@@ -32663,7 +32689,7 @@ var scrollIntoView = (el) => {
32663
32689
  };
32664
32690
 
32665
32691
  // components/LayerTree/index.tsx
32666
- var import_react24 = require("react");
32692
+ var import_react23 = require("react");
32667
32693
 
32668
32694
  // lib/is-child-of-zone.ts
32669
32695
  init_react_import();
@@ -32690,8 +32716,7 @@ var LayerTree = ({
32690
32716
  label
32691
32717
  }) => {
32692
32718
  const zones = data.zones || {};
32693
- const ctx = (0, import_react24.useContext)(dropZoneContext);
32694
- const frame = useFrame();
32719
+ const ctx = (0, import_react23.useContext)(dropZoneContext);
32695
32720
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
32696
32721
  label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32697
32722
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
@@ -32739,6 +32764,7 @@ var LayerTree = ({
32739
32764
  zone
32740
32765
  });
32741
32766
  const id = zoneContent[i].props.id;
32767
+ const frame = getFrame();
32742
32768
  scrollIntoView(
32743
32769
  frame == null ? void 0 : frame.querySelector(
32744
32770
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
@@ -32793,13 +32819,13 @@ var LayerTree = ({
32793
32819
  };
32794
32820
 
32795
32821
  // components/Puck/components/Outline/index.tsx
32796
- var import_react25 = require("react");
32822
+ var import_react24 = require("react");
32797
32823
  var import_jsx_runtime31 = require("react/jsx-runtime");
32798
32824
  var Outline = () => {
32799
32825
  const { dispatch, state, overrides, config } = useAppContext();
32800
32826
  const { data, ui } = state;
32801
32827
  const { itemSelector } = ui;
32802
- const setItemSelector = (0, import_react25.useCallback)(
32828
+ const setItemSelector = (0, import_react24.useCallback)(
32803
32829
  (newItemSelector) => {
32804
32830
  dispatch({
32805
32831
  type: "setUi",
@@ -32808,7 +32834,7 @@ var Outline = () => {
32808
32834
  },
32809
32835
  []
32810
32836
  );
32811
- const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
32837
+ const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32812
32838
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
32813
32839
  (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32814
32840
  LayerTree,
@@ -32908,12 +32934,12 @@ function usePuckHistory({
32908
32934
 
32909
32935
  // lib/use-history-store.ts
32910
32936
  init_react_import();
32911
- var import_react26 = require("react");
32937
+ var import_react25 = require("react");
32912
32938
  var import_use_debounce3 = require("use-debounce");
32913
32939
  var EMPTY_HISTORY_INDEX = -1;
32914
32940
  function useHistoryStore() {
32915
- const [histories, setHistories] = (0, import_react26.useState)([]);
32916
- const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
32941
+ const [histories, setHistories] = (0, import_react25.useState)([]);
32942
+ const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
32917
32943
  const hasPast = index > EMPTY_HISTORY_INDEX;
32918
32944
  const hasFuture = index < histories.length - 1;
32919
32945
  const currentHistory = histories[index];
@@ -33073,15 +33099,15 @@ var getBox = function getBox2(el) {
33073
33099
  };
33074
33100
 
33075
33101
  // components/Puck/components/Canvas/index.tsx
33076
- var import_react28 = require("react");
33102
+ var import_react27 = require("react");
33077
33103
 
33078
33104
  // components/ViewportControls/index.tsx
33079
33105
  init_react_import();
33080
- var import_react27 = require("react");
33106
+ var import_react26 = require("react");
33081
33107
 
33082
33108
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
33083
33109
  init_react_import();
33084
- var styles_module_default18 = { "ViewportControls": "_ViewportControls_14bhf_1", "ViewportControls-divider": "_ViewportControls-divider_14bhf_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_14bhf_21", "ViewportButton--isActive": "_ViewportButton--isActive_14bhf_33", "ViewportButton-inner": "_ViewportButton-inner_14bhf_33" };
33110
+ var styles_module_default18 = { "ViewportControls": "_ViewportControls_3zdvn_1", "ViewportControls-divider": "_ViewportControls-divider_3zdvn_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_3zdvn_21", "ViewportButton--isActive": "_ViewportButton--isActive_3zdvn_33", "ViewportButton-inner": "_ViewportButton-inner_3zdvn_33" };
33085
33111
 
33086
33112
  // components/ViewportControls/index.tsx
33087
33113
  var import_jsx_runtime32 = require("react/jsx-runtime");
@@ -33100,8 +33126,8 @@ var ViewportButton = ({
33100
33126
  onClick
33101
33127
  }) => {
33102
33128
  const { state } = useAppContext();
33103
- const [isActive, setIsActive] = (0, import_react27.useState)(false);
33104
- (0, import_react27.useEffect)(() => {
33129
+ const [isActive, setIsActive] = (0, import_react26.useState)(false);
33130
+ (0, import_react26.useEffect)(() => {
33105
33131
  setIsActive(width === state.ui.viewports.current.width);
33106
33132
  }, [width, state.ui.viewports.current.width]);
33107
33133
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -33136,7 +33162,7 @@ var ViewportControls = ({
33136
33162
  const defaultsContainAutoZoom = defaultZoomOptions.find(
33137
33163
  (option) => option.value === autoZoom
33138
33164
  );
33139
- const zoomOptions = (0, import_react27.useMemo)(
33165
+ const zoomOptions = (0, import_react26.useMemo)(
33140
33166
  () => [
33141
33167
  ...defaultZoomOptions,
33142
33168
  ...defaultsContainAutoZoom ? [] : [
@@ -33219,7 +33245,7 @@ var ViewportControls = ({
33219
33245
 
33220
33246
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
33221
33247
  init_react_import();
33222
- var styles_module_default19 = { "PuckCanvas": "_PuckCanvas_1i5ph_1", "PuckCanvas-controls": "_PuckCanvas-controls_1i5ph_16", "PuckCanvas-inner": "_PuckCanvas-inner_1i5ph_21", "PuckCanvas-root": "_PuckCanvas-root_1i5ph_32", "PuckCanvas--ready": "_PuckCanvas--ready_1i5ph_56" };
33248
+ var styles_module_default19 = { "PuckCanvas": "_PuckCanvas_6zd4y_1", "PuckCanvas-controls": "_PuckCanvas-controls_6zd4y_16", "PuckCanvas-inner": "_PuckCanvas-inner_6zd4y_21", "PuckCanvas-root": "_PuckCanvas-root_6zd4y_32", "PuckCanvas--ready": "_PuckCanvas--ready_6zd4y_56" };
33223
33249
 
33224
33250
  // lib/get-zoom-config.ts
33225
33251
  init_react_import();
@@ -33259,17 +33285,17 @@ var Canvas = () => {
33259
33285
  const { status, iframe } = useAppContext();
33260
33286
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33261
33287
  const { ui } = state;
33262
- const frameRef = (0, import_react28.useRef)(null);
33263
- const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
33264
- const defaultRender = (0, import_react28.useMemo)(() => {
33288
+ const frameRef = (0, import_react27.useRef)(null);
33289
+ const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
33290
+ const defaultRender = (0, import_react27.useMemo)(() => {
33265
33291
  const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
33266
33292
  return PuckDefault;
33267
33293
  }, []);
33268
- const CustomPreview = (0, import_react28.useMemo)(
33294
+ const CustomPreview = (0, import_react27.useMemo)(
33269
33295
  () => overrides.preview || defaultRender,
33270
33296
  [overrides]
33271
33297
  );
33272
- const getFrameDimensions = (0, import_react28.useCallback)(() => {
33298
+ const getFrameDimensions = (0, import_react27.useCallback)(() => {
33273
33299
  if (frameRef.current) {
33274
33300
  const frame = frameRef.current;
33275
33301
  const box = getBox(frame);
@@ -33277,7 +33303,7 @@ var Canvas = () => {
33277
33303
  }
33278
33304
  return { width: 0, height: 0 };
33279
33305
  }, [frameRef]);
33280
- const resetAutoZoom = (0, import_react28.useCallback)(
33306
+ const resetAutoZoom = (0, import_react27.useCallback)(
33281
33307
  (ui2 = state.ui) => {
33282
33308
  if (frameRef.current) {
33283
33309
  setZoomConfig(
@@ -33287,11 +33313,11 @@ var Canvas = () => {
33287
33313
  },
33288
33314
  [frameRef, zoomConfig, state.ui]
33289
33315
  );
33290
- (0, import_react28.useEffect)(() => {
33316
+ (0, import_react27.useEffect)(() => {
33291
33317
  setShowTransition(false);
33292
33318
  resetAutoZoom();
33293
33319
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33294
- (0, import_react28.useEffect)(() => {
33320
+ (0, import_react27.useEffect)(() => {
33295
33321
  const { height: frameHeight } = getFrameDimensions();
33296
33322
  if (ui.viewports.current.height === "auto") {
33297
33323
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -33299,7 +33325,7 @@ var Canvas = () => {
33299
33325
  }));
33300
33326
  }
33301
33327
  }, [zoomConfig.zoom]);
33302
- (0, import_react28.useEffect)(() => {
33328
+ (0, import_react27.useEffect)(() => {
33303
33329
  const observer = new ResizeObserver(() => {
33304
33330
  setShowTransition(false);
33305
33331
  resetAutoZoom();
@@ -33359,6 +33385,7 @@ var Canvas = () => {
33359
33385
  transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
33360
33386
  overflow: iframe.enabled ? void 0 : "auto"
33361
33387
  },
33388
+ suppressHydrationWarning: true,
33362
33389
  children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
33363
33390
  }
33364
33391
  ) })
@@ -33390,14 +33417,20 @@ function Puck({
33390
33417
  }) {
33391
33418
  var _a;
33392
33419
  const historyStore = useHistoryStore();
33393
- const [reducer] = (0, import_react29.useState)(
33420
+ const [reducer] = (0, import_react28.useState)(
33394
33421
  () => createReducer({ config, record: historyStore.record })
33395
33422
  );
33396
- const [initialAppState] = (0, import_react29.useState)(() => {
33423
+ const [initialAppState] = (0, import_react28.useState)(() => {
33397
33424
  var _a2, _b, _c, _d;
33398
33425
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33399
33426
  let clientUiState = {};
33400
33427
  if (typeof window !== "undefined") {
33428
+ if (window.matchMedia("(max-width: 638px)").matches) {
33429
+ clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
33430
+ leftSideBarVisible: false,
33431
+ rightSideBarVisible: false
33432
+ });
33433
+ }
33401
33434
  const viewportWidth = window.innerWidth;
33402
33435
  const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33403
33436
  key,
@@ -33405,17 +33438,14 @@ function Puck({
33405
33438
  })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33406
33439
  const closestViewport = viewportDifferences[0].key;
33407
33440
  if (iframe.enabled) {
33408
- clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
33409
- leftSideBarVisible: false,
33410
- rightSideBarVisible: false
33411
- }), {
33441
+ clientUiState = {
33412
33442
  viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33413
33443
  current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33414
33444
  height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33415
33445
  width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33416
33446
  })
33417
33447
  })
33418
- });
33448
+ };
33419
33449
  }
33420
33450
  }
33421
33451
  return __spreadProps(__spreadValues({}, defaultAppState), {
@@ -33438,7 +33468,7 @@ function Puck({
33438
33468
  })
33439
33469
  });
33440
33470
  });
33441
- const [appState, dispatch] = (0, import_react29.useReducer)(
33471
+ const [appState, dispatch] = (0, import_react28.useReducer)(
33442
33472
  reducer,
33443
33473
  flushZones(initialAppState)
33444
33474
  );
@@ -33449,9 +33479,9 @@ function Puck({
33449
33479
  config,
33450
33480
  dispatch
33451
33481
  );
33452
- const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
33482
+ const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
33453
33483
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
33454
- const setItemSelector = (0, import_react29.useCallback)(
33484
+ const setItemSelector = (0, import_react28.useCallback)(
33455
33485
  (newItemSelector) => {
33456
33486
  if (newItemSelector === itemSelector)
33457
33487
  return;
@@ -33464,21 +33494,21 @@ function Puck({
33464
33494
  [itemSelector]
33465
33495
  );
33466
33496
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
33467
- (0, import_react29.useEffect)(() => {
33497
+ (0, import_react28.useEffect)(() => {
33468
33498
  if (onChange)
33469
33499
  onChange(data);
33470
33500
  }, [data]);
33471
33501
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
33472
- const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
33502
+ const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
33473
33503
  const rootProps = data.root.props || data.root;
33474
- (0, import_react29.useEffect)(() => {
33504
+ (0, import_react28.useEffect)(() => {
33475
33505
  if (Object.keys(data.root).length > 0 && !data.root.props) {
33476
33506
  console.error(
33477
33507
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
33478
33508
  );
33479
33509
  }
33480
33510
  }, []);
33481
- const toggleSidebars = (0, import_react29.useCallback)(
33511
+ const toggleSidebars = (0, import_react28.useCallback)(
33482
33512
  (sidebar) => {
33483
33513
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
33484
33514
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -33492,7 +33522,7 @@ function Puck({
33492
33522
  },
33493
33523
  [dispatch, leftSideBarVisible, rightSideBarVisible]
33494
33524
  );
33495
- (0, import_react29.useEffect)(() => {
33525
+ (0, import_react28.useEffect)(() => {
33496
33526
  if (!window.matchMedia("(min-width: 638px)").matches) {
33497
33527
  dispatch({
33498
33528
  type: "setUi",
@@ -33515,11 +33545,11 @@ function Puck({
33515
33545
  window.removeEventListener("resize", handleResize);
33516
33546
  };
33517
33547
  }, []);
33518
- const defaultRender = (0, import_react29.useMemo)(() => {
33548
+ const defaultRender = (0, import_react28.useMemo)(() => {
33519
33549
  const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
33520
33550
  return PuckDefault;
33521
33551
  }, []);
33522
- const defaultHeaderRender = (0, import_react29.useMemo)(() => {
33552
+ const defaultHeaderRender = (0, import_react28.useMemo)(() => {
33523
33553
  if (renderHeader) {
33524
33554
  console.warn(
33525
33555
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -33533,7 +33563,7 @@ function Puck({
33533
33563
  }
33534
33564
  return defaultRender;
33535
33565
  }, [renderHeader]);
33536
- const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
33566
+ const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
33537
33567
  if (renderHeaderActions) {
33538
33568
  console.warn(
33539
33569
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
@@ -33546,214 +33576,223 @@ function Puck({
33546
33576
  }
33547
33577
  return defaultRender;
33548
33578
  }, [renderHeader]);
33549
- const loadedOverrides = (0, import_react29.useMemo)(() => {
33579
+ const loadedOverrides = (0, import_react28.useMemo)(() => {
33550
33580
  return loadOverrides({ overrides, plugins });
33551
33581
  }, [plugins]);
33552
- const CustomPuck = (0, import_react29.useMemo)(
33582
+ const CustomPuck = (0, import_react28.useMemo)(
33553
33583
  () => loadedOverrides.puck || defaultRender,
33554
33584
  [loadedOverrides]
33555
33585
  );
33556
- const CustomHeader = (0, import_react29.useMemo)(
33586
+ const CustomHeader = (0, import_react28.useMemo)(
33557
33587
  () => loadedOverrides.header || defaultHeaderRender,
33558
33588
  [loadedOverrides]
33559
33589
  );
33560
- const CustomHeaderActions = (0, import_react29.useMemo)(
33590
+ const CustomHeaderActions = (0, import_react28.useMemo)(
33561
33591
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
33562
33592
  [loadedOverrides]
33563
33593
  );
33564
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
33565
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33566
- AppProvider,
33567
- {
33568
- value: {
33569
- state: appState,
33570
- dispatch,
33571
- config,
33572
- componentState,
33573
- resolveData,
33574
- plugins,
33575
- overrides: loadedOverrides,
33576
- history,
33577
- viewports,
33578
- iframe
33579
- },
33580
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33581
- DragDropContext,
33582
- {
33583
- onDragUpdate: (update) => {
33584
- setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
33585
- onDragStartOrUpdate(update);
33586
- },
33587
- onBeforeDragStart: (start) => {
33588
- onDragStartOrUpdate(start);
33589
- setItemSelector(null);
33590
- dispatch({ type: "setUi", ui: { isDragging: true } });
33591
- },
33592
- onDragEnd: (droppedItem) => {
33593
- setDraggedItem(void 0);
33594
- dispatch({ type: "setUi", ui: { isDragging: false } });
33595
- if (!droppedItem.destination) {
33596
- return;
33597
- }
33598
- if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
33599
- const [_, componentType] = droppedItem.draggableId.split("::");
33594
+ const [mounted, setMounted] = (0, import_react28.useState)(false);
33595
+ (0, import_react28.useEffect)(() => {
33596
+ setMounted(true);
33597
+ }, []);
33598
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33599
+ AppProvider,
33600
+ {
33601
+ value: {
33602
+ state: appState,
33603
+ dispatch,
33604
+ config,
33605
+ componentState,
33606
+ resolveData,
33607
+ plugins,
33608
+ overrides: loadedOverrides,
33609
+ history,
33610
+ viewports,
33611
+ iframe
33612
+ },
33613
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33614
+ DragDropContext,
33615
+ {
33616
+ onDragUpdate: (update) => {
33617
+ setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
33618
+ onDragStartOrUpdate(update);
33619
+ },
33620
+ onBeforeDragStart: (start) => {
33621
+ onDragStartOrUpdate(start);
33622
+ setItemSelector(null);
33623
+ dispatch({ type: "setUi", ui: { isDragging: true } });
33624
+ },
33625
+ onDragEnd: (droppedItem) => {
33626
+ setDraggedItem(void 0);
33627
+ dispatch({ type: "setUi", ui: { isDragging: false } });
33628
+ if (!droppedItem.destination) {
33629
+ return;
33630
+ }
33631
+ if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
33632
+ const [_, componentType] = droppedItem.draggableId.split("::");
33633
+ dispatch({
33634
+ type: "insert",
33635
+ componentType: componentType || droppedItem.draggableId,
33636
+ destinationIndex: droppedItem.destination.index,
33637
+ destinationZone: droppedItem.destination.droppableId
33638
+ });
33639
+ setItemSelector({
33640
+ index: droppedItem.destination.index,
33641
+ zone: droppedItem.destination.droppableId
33642
+ });
33643
+ return;
33644
+ } else {
33645
+ const { source, destination } = droppedItem;
33646
+ if (source.droppableId === destination.droppableId) {
33600
33647
  dispatch({
33601
- type: "insert",
33602
- componentType: componentType || droppedItem.draggableId,
33603
- destinationIndex: droppedItem.destination.index,
33604
- destinationZone: droppedItem.destination.droppableId
33648
+ type: "reorder",
33649
+ sourceIndex: source.index,
33650
+ destinationIndex: destination.index,
33651
+ destinationZone: destination.droppableId
33605
33652
  });
33606
- setItemSelector({
33607
- index: droppedItem.destination.index,
33608
- zone: droppedItem.destination.droppableId
33609
- });
33610
- return;
33611
33653
  } else {
33612
- const { source, destination } = droppedItem;
33613
- if (source.droppableId === destination.droppableId) {
33614
- dispatch({
33615
- type: "reorder",
33616
- sourceIndex: source.index,
33617
- destinationIndex: destination.index,
33618
- destinationZone: destination.droppableId
33619
- });
33620
- } else {
33621
- dispatch({
33622
- type: "move",
33623
- sourceZone: source.droppableId,
33624
- sourceIndex: source.index,
33625
- destinationIndex: destination.index,
33626
- destinationZone: destination.droppableId
33627
- });
33628
- }
33629
- setItemSelector({
33630
- index: destination.index,
33631
- zone: destination.droppableId
33654
+ dispatch({
33655
+ type: "move",
33656
+ sourceZone: source.droppableId,
33657
+ sourceIndex: source.index,
33658
+ destinationIndex: destination.index,
33659
+ destinationZone: destination.droppableId
33632
33660
  });
33633
33661
  }
33634
- },
33635
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33636
- DropZoneProvider,
33637
- {
33638
- value: {
33639
- data,
33640
- itemSelector,
33641
- setItemSelector,
33642
- config,
33643
- dispatch,
33644
- draggedItem,
33645
- placeholderStyle,
33646
- mode: "edit",
33647
- areaId: "root"
33648
- },
33649
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
33650
- "div",
33651
- {
33652
- className: getClassName25({
33653
- leftSideBarVisible,
33654
- menuOpen,
33655
- rightSideBarVisible
33656
- }),
33657
- children: [
33658
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33659
- CustomHeader,
33660
- {
33661
- actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33662
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33663
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33664
- Button,
33662
+ setItemSelector({
33663
+ index: destination.index,
33664
+ zone: destination.droppableId
33665
+ });
33666
+ }
33667
+ },
33668
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33669
+ DropZoneProvider,
33670
+ {
33671
+ value: {
33672
+ data,
33673
+ itemSelector,
33674
+ setItemSelector,
33675
+ config,
33676
+ dispatch,
33677
+ draggedItem,
33678
+ placeholderStyle,
33679
+ mode: "edit",
33680
+ areaId: "root"
33681
+ },
33682
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
33683
+ "div",
33684
+ {
33685
+ className: getClassName25({
33686
+ leftSideBarVisible,
33687
+ menuOpen,
33688
+ mounted,
33689
+ rightSideBarVisible
33690
+ }),
33691
+ children: [
33692
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33693
+ CustomHeader,
33694
+ {
33695
+ actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33696
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33697
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33698
+ Button,
33699
+ {
33700
+ onClick: () => {
33701
+ onPublish && onPublish(data);
33702
+ },
33703
+ icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
33704
+ children: "Publish"
33705
+ }
33706
+ )
33707
+ ] }),
33708
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33709
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33710
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33711
+ IconButton,
33665
33712
  {
33666
33713
  onClick: () => {
33667
- onPublish && onPublish(data);
33714
+ toggleSidebars("left");
33668
33715
  },
33669
- icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
33670
- children: "Publish"
33716
+ title: "Toggle left sidebar",
33717
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
33671
33718
  }
33672
- )
33719
+ ) }),
33720
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33721
+ IconButton,
33722
+ {
33723
+ onClick: () => {
33724
+ toggleSidebars("right");
33725
+ },
33726
+ title: "Toggle right sidebar",
33727
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
33728
+ }
33729
+ ) })
33673
33730
  ] }),
33674
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33675
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33676
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33677
- IconButton,
33678
- {
33679
- onClick: () => {
33680
- toggleSidebars("left");
33681
- },
33682
- title: "Toggle left sidebar",
33683
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
33684
- }
33685
- ) }),
33686
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33687
- IconButton,
33688
- {
33689
- onClick: () => {
33690
- toggleSidebars("right");
33691
- },
33692
- title: "Toggle right sidebar",
33693
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
33694
- }
33695
- ) })
33696
- ] }),
33697
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
33698
- headerTitle || rootProps.title || "Page",
33699
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33700
- " ",
33701
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33702
- ] })
33703
- ] }) }),
33704
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33705
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33706
- IconButton,
33707
- {
33708
- onClick: () => {
33709
- return setMenuOpen(!menuOpen);
33710
- },
33711
- title: "Toggle menu bar",
33712
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
33713
- }
33714
- ) }),
33715
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33716
- MenuBar,
33717
- {
33718
- appState,
33719
- data,
33720
- dispatch,
33721
- onPublish,
33722
- menuOpen,
33723
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33724
- setMenuOpen
33725
- }
33726
- )
33731
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
33732
+ headerTitle || rootProps.title || "Page",
33733
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33734
+ " ",
33735
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33727
33736
  ] })
33728
- ] }) })
33729
- }
33730
- ),
33731
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33732
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33733
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
33734
- ] }),
33735
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33736
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33737
- SidebarSection,
33738
- {
33739
- noPadding: true,
33740
- noBorderTop: true,
33741
- showBreadcrumbs: true,
33742
- title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33743
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
33744
- }
33745
- ) })
33746
- ]
33747
- }
33748
- ) })
33749
- }
33750
- )
33751
- }
33752
- )
33753
- }
33754
- ),
33755
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
33756
- ] });
33737
+ ] }) }),
33738
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33739
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33740
+ IconButton,
33741
+ {
33742
+ onClick: () => {
33743
+ return setMenuOpen(!menuOpen);
33744
+ },
33745
+ title: "Toggle menu bar",
33746
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
33747
+ }
33748
+ ) }),
33749
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33750
+ MenuBar,
33751
+ {
33752
+ appState,
33753
+ data,
33754
+ dispatch,
33755
+ onPublish,
33756
+ menuOpen,
33757
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33758
+ setMenuOpen
33759
+ }
33760
+ )
33761
+ ] })
33762
+ ] }) })
33763
+ }
33764
+ ),
33765
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33766
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33767
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
33768
+ ] }),
33769
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33770
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33771
+ SidebarSection,
33772
+ {
33773
+ noPadding: true,
33774
+ noBorderTop: true,
33775
+ showBreadcrumbs: true,
33776
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33777
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
33778
+ }
33779
+ ) }),
33780
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33781
+ "div",
33782
+ {
33783
+ id: "puck-portal-root",
33784
+ className: getClassName25("portal")
33785
+ }
33786
+ )
33787
+ ]
33788
+ }
33789
+ ) })
33790
+ }
33791
+ )
33792
+ }
33793
+ )
33794
+ }
33795
+ ) });
33757
33796
  }
33758
33797
  Puck.Components = Components;
33759
33798
  Puck.Fields = Fields;
@@ -33763,7 +33802,10 @@ Puck.Preview = Preview;
33763
33802
  // components/Render/index.tsx
33764
33803
  init_react_import();
33765
33804
  var import_jsx_runtime35 = require("react/jsx-runtime");
33766
- function Render({ config, data }) {
33805
+ function Render({
33806
+ config,
33807
+ data
33808
+ }) {
33767
33809
  var _a;
33768
33810
  const rootProps = data.root.props || data.root;
33769
33811
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
@@ -33842,37 +33884,51 @@ function transformProps(data, propTransforms) {
33842
33884
 
33843
33885
  // lib/resolve-all-data.ts
33844
33886
  init_react_import();
33845
- var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
33846
- const dynamicRoot = yield resolveRootData(data, config);
33847
- const { zones = {} } = data;
33848
- const zoneKeys = Object.keys(zones);
33849
- const resolvedZones = {};
33850
- for (let i = 0; i < zoneKeys.length; i++) {
33851
- const zoneKey = zoneKeys[i];
33852
- resolvedZones[zoneKey] = yield resolveAllComponentData(
33853
- zones[zoneKey],
33854
- config,
33855
- onResolveStart,
33856
- onResolveEnd
33857
- );
33858
- }
33859
- return __spreadProps(__spreadValues({}, data), {
33860
- root: dynamicRoot,
33861
- content: yield resolveAllComponentData(
33862
- data.content,
33863
- config,
33864
- onResolveStart,
33865
- onResolveEnd
33866
- ),
33867
- zones: resolvedZones
33887
+ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
33888
+ return __async(this, null, function* () {
33889
+ const dynamicRoot = yield resolveRootData(data, config);
33890
+ const { zones = {} } = data;
33891
+ const zoneKeys = Object.keys(zones);
33892
+ const resolvedZones = {};
33893
+ for (let i = 0; i < zoneKeys.length; i++) {
33894
+ const zoneKey = zoneKeys[i];
33895
+ resolvedZones[zoneKey] = yield resolveAllComponentData(
33896
+ zones[zoneKey],
33897
+ config,
33898
+ onResolveStart,
33899
+ onResolveEnd
33900
+ );
33901
+ }
33902
+ return __spreadProps(__spreadValues({}, data), {
33903
+ root: dynamicRoot,
33904
+ content: yield resolveAllComponentData(
33905
+ data.content,
33906
+ config,
33907
+ onResolveStart,
33908
+ onResolveEnd
33909
+ ),
33910
+ zones: resolvedZones
33911
+ });
33868
33912
  });
33869
- });
33913
+ }
33870
33914
 
33871
33915
  // lib/use-puck.ts
33872
33916
  init_react_import();
33873
33917
  var usePuck = () => {
33874
- const { state: appState, config, history, dispatch } = useAppContext();
33875
- return { appState, config, dispatch, history };
33918
+ const {
33919
+ state: appState,
33920
+ config,
33921
+ history,
33922
+ dispatch,
33923
+ selectedItem
33924
+ } = useAppContext();
33925
+ return {
33926
+ appState,
33927
+ config,
33928
+ dispatch,
33929
+ history,
33930
+ selectedItem: selectedItem || null
33931
+ };
33876
33932
  };
33877
33933
  // Annotate the CommonJS export names for ESM import in node:
33878
33934
  0 && (module.exports = {