@measured/puck 0.14.0-canary.4932a6e → 0.14.0-canary.4c77ac5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -8264,8 +8264,8 @@ var require_react_dom_development = __commonJS({
8264
8264
  if (propertyInfo !== null) {
8265
8265
  return !propertyInfo.acceptsBooleans;
8266
8266
  } else {
8267
- var prefix2 = name.toLowerCase().slice(0, 5);
8268
- return prefix2 !== "data-" && prefix2 !== "aria-";
8267
+ var prefix3 = name.toLowerCase().slice(0, 5);
8268
+ return prefix3 !== "data-" && prefix3 !== "aria-";
8269
8269
  }
8270
8270
  }
8271
8271
  default:
@@ -8937,18 +8937,18 @@ var require_react_dom_development = __commonJS({
8937
8937
  }
8938
8938
  }
8939
8939
  var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
8940
- var prefix;
8940
+ var prefix2;
8941
8941
  function describeBuiltInComponentFrame(name, source, ownerFn) {
8942
8942
  {
8943
- if (prefix === void 0) {
8943
+ if (prefix2 === void 0) {
8944
8944
  try {
8945
8945
  throw Error();
8946
8946
  } catch (x) {
8947
8947
  var match = x.stack.trim().match(/\n( *(at )?)/);
8948
- prefix = match && match[1] || "";
8948
+ prefix2 = match && match[1] || "";
8949
8949
  }
8950
8950
  }
8951
- return "\n" + prefix + name;
8951
+ return "\n" + prefix2 + name;
8952
8952
  }
8953
8953
  }
8954
8954
  var reentry = false;
@@ -10033,13 +10033,13 @@ var require_react_dom_development = __commonJS({
10033
10033
  strokeOpacity: true,
10034
10034
  strokeWidth: true
10035
10035
  };
10036
- function prefixKey(prefix2, key) {
10037
- return prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
10036
+ function prefixKey(prefix3, key) {
10037
+ return prefix3 + key.charAt(0).toUpperCase() + key.substring(1);
10038
10038
  }
10039
10039
  var prefixes = ["Webkit", "ms", "Moz", "O"];
10040
10040
  Object.keys(isUnitlessNumber).forEach(function(prop) {
10041
- prefixes.forEach(function(prefix2) {
10042
- isUnitlessNumber[prefixKey(prefix2, prop)] = isUnitlessNumber[prop];
10041
+ prefixes.forEach(function(prefix3) {
10042
+ isUnitlessNumber[prefixKey(prefix3, prop)] = isUnitlessNumber[prop];
10043
10043
  });
10044
10044
  });
10045
10045
  function dangerousStyleValue(name, value, isCustomProperty) {
@@ -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_1brfa_1", "Button--medium": "_Button--medium_1brfa_22", "Button--large": "_Button--large_1brfa_29", "Button-icon": "_Button-icon_1brfa_36", "Button--primary": "_Button--primary_1brfa_44", "Button--secondary": "_Button--secondary_1brfa_53", "Button--flush": "_Button--flush_1brfa_64", "Button--disabled": "_Button--disabled_1brfa_68", "Button--fullWidth": "_Button--fullWidth_1brfa_78" };
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" };
29177
29177
 
29178
29178
  // lib/get-class-name-factory.ts
29179
29179
  init_react_import();
@@ -29227,7 +29227,7 @@ var Button = ({
29227
29227
  }) => {
29228
29228
  const [loading, setLoading] = (0, import_react2.useState)(loadingProp);
29229
29229
  (0, import_react2.useEffect)(() => setLoading(loadingProp), [loadingProp]);
29230
- const ElementType = href ? "a" : onClick ? "button" : "div";
29230
+ const ElementType = href ? "a" : type ? "button" : "span";
29231
29231
  const el = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
29232
29232
  ElementType,
29233
29233
  {
@@ -29255,10 +29255,7 @@ var Button = ({
29255
29255
  children: [
29256
29256
  icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("icon"), children: icon }),
29257
29257
  children,
29258
- loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
29259
- "\xA0\xA0",
29260
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" })
29261
- ] })
29258
+ loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" }) })
29262
29259
  ]
29263
29260
  }
29264
29261
  );
@@ -29267,15 +29264,15 @@ var Button = ({
29267
29264
 
29268
29265
  // components/Drawer/index.tsx
29269
29266
  init_react_import();
29270
- var import_dnd2 = require("@hello-pangea/dnd");
29267
+ var import_dnd2 = require("@measured/dnd");
29271
29268
 
29272
29269
  // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
29273
29270
  init_react_import();
29274
- var styles_module_default = { "DrawerItem": "_DrawerItem_1qydx_1", "DrawerItem-default": "_DrawerItem-default_1qydx_1", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_1qydx_1", "DrawerItem-draggable": "_DrawerItem-draggable_1qydx_1", "Drawer": "_Drawer_1qydx_1", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1qydx_21", "DrawerItem-name": "_DrawerItem-name_1qydx_26" };
29271
+ var styles_module_default = { "Drawer": "_Drawer_6zh0b_1", "DrawerItem-default": "_DrawerItem-default_6zh0b_5", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_6zh0b_5", "DrawerItem": "_DrawerItem_6zh0b_5", "DrawerItem-draggable": "_DrawerItem-draggable_6zh0b_5", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_6zh0b_31", "DrawerItem-name": "_DrawerItem-name_6zh0b_47" };
29275
29272
 
29276
29273
  // components/Draggable/index.tsx
29277
29274
  init_react_import();
29278
- var import_dnd = require("@hello-pangea/dnd");
29275
+ var import_dnd = require("@measured/dnd");
29279
29276
  var import_jsx_runtime2 = require("react/jsx-runtime");
29280
29277
  var Draggable = ({
29281
29278
  className,
@@ -29350,7 +29347,7 @@ var replace = (list, index, newItem) => {
29350
29347
 
29351
29348
  // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
29352
29349
  init_react_import();
29353
- var styles_module_default2 = { "DragIcon": "_DragIcon_o29on_1" };
29350
+ var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
29354
29351
 
29355
29352
  // components/DragIcon/index.tsx
29356
29353
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -29385,16 +29382,17 @@ var DrawerItem = ({
29385
29382
  name,
29386
29383
  children,
29387
29384
  id,
29385
+ label,
29388
29386
  index
29389
29387
  }) => {
29390
29388
  const ctx = (0, import_react3.useContext)(drawerContext);
29391
29389
  const resolvedId = `${ctx.droppableId}::${id || name}`;
29392
29390
  const CustomInner = (0, import_react3.useMemo)(
29393
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29391
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29394
29392
  [children]
29395
29393
  );
29396
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29397
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: name }),
29394
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29395
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
29398
29396
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DragIcon, {}) })
29399
29397
  ] }) }) }) });
29400
29398
  };
@@ -29425,12 +29423,12 @@ var import_react9 = require("react");
29425
29423
 
29426
29424
  // components/DraggableComponent/index.tsx
29427
29425
  init_react_import();
29428
- var import_react6 = require("react");
29429
- var import_dnd3 = require("@hello-pangea/dnd");
29426
+ var import_react7 = require("react");
29427
+ var import_dnd3 = require("@measured/dnd");
29430
29428
 
29431
29429
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
29432
29430
  init_react_import();
29433
- var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_foluk_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_foluk_6", "DraggableComponent-contents": "_DraggableComponent-contents_foluk_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_foluk_25", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_foluk_39", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_foluk_55", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_foluk_61", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_foluk_66", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_foluk_71", "DraggableComponent-actions": "_DraggableComponent-actions_foluk_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_foluk_120", "DraggableComponent-action": "_DraggableComponent-action_foluk_97" };
29431
+ var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_175tf_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_175tf_11", "DraggableComponent-contents": "_DraggableComponent-contents_175tf_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_175tf_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_175tf_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_175tf_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_175tf_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_175tf_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_175tf_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_175tf_97", "DraggableComponent-actions": "_DraggableComponent-actions_175tf_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_175tf_127", "DraggableComponent-action": "_DraggableComponent-action_175tf_97" };
29434
29432
 
29435
29433
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
29436
29434
  init_react_import();
@@ -29582,6 +29580,14 @@ var Lock = createLucideIcon("Lock", [
29582
29580
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
29583
29581
  ]);
29584
29582
 
29583
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
29584
+ init_react_import();
29585
+ var Monitor = createLucideIcon("Monitor", [
29586
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
29587
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
29588
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
29589
+ ]);
29590
+
29585
29591
  // ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
29586
29592
  init_react_import();
29587
29593
  var MoreVertical = createLucideIcon("MoreVertical", [
@@ -29618,6 +29624,34 @@ var Search = createLucideIcon("Search", [
29618
29624
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
29619
29625
  ]);
29620
29626
 
29627
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
29628
+ init_react_import();
29629
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29630
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
29631
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
29632
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
29633
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
29634
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
29635
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
29636
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
29637
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
29638
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29639
+ ]);
29640
+
29641
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
29642
+ init_react_import();
29643
+ var Smartphone = createLucideIcon("Smartphone", [
29644
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29645
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29646
+ ]);
29647
+
29648
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
29649
+ init_react_import();
29650
+ var Tablet = createLucideIcon("Tablet", [
29651
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29652
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
29653
+ ]);
29654
+
29621
29655
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29622
29656
  init_react_import();
29623
29657
  var Trash = createLucideIcon("Trash", [
@@ -29641,6 +29675,23 @@ var Unlock = createLucideIcon("Unlock", [
29641
29675
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
29642
29676
  ]);
29643
29677
 
29678
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
29679
+ init_react_import();
29680
+ var ZoomIn = createLucideIcon("ZoomIn", [
29681
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29682
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29683
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
29684
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29685
+ ]);
29686
+
29687
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
29688
+ init_react_import();
29689
+ var ZoomOut = createLucideIcon("ZoomOut", [
29690
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29691
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29692
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29693
+ ]);
29694
+
29644
29695
  // lib/use-modifier-held.ts
29645
29696
  init_react_import();
29646
29697
  var import_react5 = require("react");
@@ -29669,8 +29720,118 @@ var useModifierHeld = (modifier) => {
29669
29720
 
29670
29721
  // components/DraggableComponent/index.tsx
29671
29722
  var import_react_spinners2 = require("react-spinners");
29723
+
29724
+ // components/Puck/context.tsx
29725
+ init_react_import();
29726
+ var import_react6 = require("react");
29727
+
29728
+ // lib/get-item.ts
29729
+ init_react_import();
29730
+
29731
+ // lib/root-droppable-id.ts
29732
+ init_react_import();
29733
+ var rootDroppableId = "default-zone";
29734
+
29735
+ // lib/setup-zone.ts
29736
+ init_react_import();
29737
+ var setupZone = (data, zoneKey) => {
29738
+ if (zoneKey === rootDroppableId) {
29739
+ return data;
29740
+ }
29741
+ const newData = __spreadValues({}, data);
29742
+ newData.zones = data.zones || {};
29743
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29744
+ return newData;
29745
+ };
29746
+
29747
+ // lib/get-item.ts
29748
+ var getItem = (selector, data, dynamicProps = {}) => {
29749
+ if (!selector.zone || selector.zone === rootDroppableId) {
29750
+ const item2 = data.content[selector.index];
29751
+ return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29752
+ }
29753
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29754
+ return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29755
+ };
29756
+
29757
+ // components/ViewportControls/default-viewports.ts
29758
+ init_react_import();
29759
+ var defaultViewports = [
29760
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
29761
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
29762
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
29763
+ ];
29764
+
29765
+ // components/Puck/context.tsx
29672
29766
  var import_jsx_runtime5 = require("react/jsx-runtime");
29767
+ var defaultAppState = {
29768
+ data: { content: [], root: { props: { title: "" } } },
29769
+ ui: {
29770
+ leftSideBarVisible: true,
29771
+ rightSideBarVisible: true,
29772
+ arrayState: {},
29773
+ itemSelector: null,
29774
+ componentList: {},
29775
+ isDragging: false,
29776
+ viewports: {
29777
+ current: {
29778
+ width: defaultViewports[0].width,
29779
+ height: defaultViewports[0].height || "auto"
29780
+ },
29781
+ options: [],
29782
+ controlsVisible: true
29783
+ }
29784
+ }
29785
+ };
29786
+ var defaultContext = {
29787
+ state: defaultAppState,
29788
+ dispatch: () => null,
29789
+ config: { components: {} },
29790
+ componentState: {},
29791
+ resolveData: () => {
29792
+ },
29793
+ plugins: [],
29794
+ overrides: {},
29795
+ history: {},
29796
+ viewports: defaultViewports,
29797
+ zoomConfig: {
29798
+ autoZoom: 0,
29799
+ rootHeight: 0,
29800
+ zoom: 1
29801
+ },
29802
+ setZoomConfig: () => null
29803
+ };
29804
+ var appContext = (0, import_react6.createContext)(defaultContext);
29805
+ var AppProvider = ({
29806
+ children,
29807
+ value
29808
+ }) => {
29809
+ const [zoomConfig, setZoomConfig] = (0, import_react6.useState)(defaultContext.zoomConfig);
29810
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(appContext.Provider, { value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig }), children });
29811
+ };
29812
+ function useAppContext() {
29813
+ const mainContext = (0, import_react6.useContext)(appContext);
29814
+ const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29815
+ return __spreadProps(__spreadValues({}, mainContext), {
29816
+ // Helpers
29817
+ selectedItem,
29818
+ setUi: (ui, recordHistory) => {
29819
+ return mainContext.dispatch({
29820
+ type: "setUi",
29821
+ ui,
29822
+ recordHistory
29823
+ });
29824
+ }
29825
+ });
29826
+ }
29827
+
29828
+ // components/DraggableComponent/index.tsx
29829
+ var import_jsx_runtime6 = require("react/jsx-runtime");
29673
29830
  var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
29831
+ var space = 8;
29832
+ var actionsOverlayTop = space * 6.5;
29833
+ var actionsTop = -(actionsOverlayTop - 8);
29834
+ var actionsRight = space;
29674
29835
  var DraggableComponent = ({
29675
29836
  children,
29676
29837
  id,
@@ -29693,15 +29854,16 @@ var DraggableComponent = ({
29693
29854
  indicativeHover = false,
29694
29855
  style
29695
29856
  }) => {
29857
+ const { zoomConfig } = useAppContext();
29696
29858
  const isModifierHeld = useModifierHeld("Alt");
29697
- (0, import_react6.useEffect)(onMount, []);
29698
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
29859
+ (0, import_react7.useEffect)(onMount, []);
29860
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29699
29861
  import_dnd3.Draggable,
29700
29862
  {
29701
29863
  draggableId: id,
29702
29864
  index,
29703
29865
  isDragDisabled,
29704
- children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
29866
+ children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29705
29867
  "div",
29706
29868
  __spreadProps(__spreadValues(__spreadValues({
29707
29869
  ref: provided.innerRef
@@ -29724,13 +29886,34 @@ var DraggableComponent = ({
29724
29886
  onClick,
29725
29887
  children: [
29726
29888
  debug,
29727
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29728
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("overlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName4("actions"), children: [
29729
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29730
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Copy, { size: 16 }) }),
29731
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Trash, { size: 16 }) })
29732
- ] }) }),
29733
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName4("contents"), children })
29889
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29890
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29891
+ "div",
29892
+ {
29893
+ className: getClassName4("actionsOverlay"),
29894
+ style: {
29895
+ top: actionsOverlayTop / zoomConfig.zoom
29896
+ },
29897
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29898
+ "div",
29899
+ {
29900
+ className: getClassName4("actions"),
29901
+ style: {
29902
+ transform: `scale(${1 / zoomConfig.zoom}`,
29903
+ top: actionsTop / zoomConfig.zoom,
29904
+ right: actionsRight / zoomConfig.zoom
29905
+ },
29906
+ children: [
29907
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29908
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Copy, { size: 16 }) }),
29909
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Trash, { size: 16 }) })
29910
+ ]
29911
+ }
29912
+ )
29913
+ }
29914
+ ),
29915
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("overlay") }),
29916
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassName4("contents"), children })
29734
29917
  ]
29735
29918
  })
29736
29919
  )
@@ -29740,44 +29923,15 @@ var DraggableComponent = ({
29740
29923
  };
29741
29924
 
29742
29925
  // components/DropZone/index.tsx
29743
- var import_dnd4 = require("@hello-pangea/dnd");
29744
-
29745
- // lib/get-item.ts
29746
- init_react_import();
29747
-
29748
- // lib/root-droppable-id.ts
29749
- init_react_import();
29750
- var rootDroppableId = "default-zone";
29751
-
29752
- // lib/setup-zone.ts
29753
- init_react_import();
29754
- var setupZone = (data, zoneKey) => {
29755
- if (zoneKey === rootDroppableId) {
29756
- return data;
29757
- }
29758
- const newData = __spreadValues({}, data);
29759
- newData.zones = data.zones || {};
29760
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29761
- return newData;
29762
- };
29763
-
29764
- // lib/get-item.ts
29765
- var getItem = (selector, data, dynamicProps = {}) => {
29766
- if (!selector.zone || selector.zone === rootDroppableId) {
29767
- const item2 = data.content[selector.index];
29768
- return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29769
- }
29770
- const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29771
- return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29772
- };
29926
+ var import_dnd4 = require("@measured/dnd");
29773
29927
 
29774
29928
  // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29775
29929
  init_react_import();
29776
- var styles_module_default4 = { "DropZone": "_DropZone_i675d_1", "DropZone--zoomEnabled": "_DropZone--zoomEnabled_i675d_10", "DropZone-renderWrapper": "_DropZone-renderWrapper_i675d_14", "DropZone-content": "_DropZone-content_i675d_18", "DropZone--userIsDragging": "_DropZone--userIsDragging_i675d_23", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_i675d_27", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_i675d_28", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_i675d_34", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_i675d_35", "DropZone--isDisabled": "_DropZone--isDisabled_i675d_36", "DropZone--isRootZone": "_DropZone--isRootZone_i675d_37", "DropZone--hasChildren": "_DropZone--hasChildren_i675d_43", "DropZone--isDestination": "_DropZone--isDestination_i675d_48", "DropZone-item": "_DropZone-item_i675d_56", "DropZone-hitbox": "_DropZone-hitbox_i675d_60" };
29930
+ 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" };
29777
29931
 
29778
29932
  // components/DropZone/context.tsx
29779
29933
  init_react_import();
29780
- var import_react7 = require("react");
29934
+ var import_react8 = require("react");
29781
29935
  var import_use_debounce = require("use-debounce");
29782
29936
 
29783
29937
  // lib/get-zone-id.ts
@@ -29793,30 +29947,30 @@ var getZoneId = (zoneCompound) => {
29793
29947
  };
29794
29948
 
29795
29949
  // components/DropZone/context.tsx
29796
- var import_jsx_runtime6 = require("react/jsx-runtime");
29797
- var dropZoneContext = (0, import_react7.createContext)(null);
29950
+ var import_jsx_runtime7 = require("react/jsx-runtime");
29951
+ var dropZoneContext = (0, import_react8.createContext)(null);
29798
29952
  var DropZoneProvider = ({
29799
29953
  children,
29800
29954
  value
29801
29955
  }) => {
29802
- const [hoveringArea, setHoveringArea] = (0, import_react7.useState)(null);
29803
- const [hoveringZone, setHoveringZone] = (0, import_react7.useState)(
29956
+ const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
29957
+ const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
29804
29958
  rootDroppableId
29805
29959
  );
29806
- const [hoveringComponent, setHoveringComponent] = (0, import_react7.useState)();
29960
+ const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
29807
29961
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
29808
- const [areasWithZones, setAreasWithZones] = (0, import_react7.useState)(
29962
+ const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
29809
29963
  {}
29810
29964
  );
29811
- const [activeZones, setActiveZones] = (0, import_react7.useState)({});
29965
+ const [activeZones, setActiveZones] = (0, import_react8.useState)({});
29812
29966
  const { dispatch = null } = value ? value : {};
29813
- const registerZoneArea = (0, import_react7.useCallback)(
29967
+ const registerZoneArea = (0, import_react8.useCallback)(
29814
29968
  (area) => {
29815
29969
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
29816
29970
  },
29817
29971
  [setAreasWithZones]
29818
29972
  );
29819
- const registerZone = (0, import_react7.useCallback)(
29973
+ const registerZone = (0, import_react8.useCallback)(
29820
29974
  (zoneCompound) => {
29821
29975
  if (!dispatch) {
29822
29976
  return;
@@ -29829,7 +29983,7 @@ var DropZoneProvider = ({
29829
29983
  },
29830
29984
  [setActiveZones, dispatch]
29831
29985
  );
29832
- const unregisterZone = (0, import_react7.useCallback)(
29986
+ const unregisterZone = (0, import_react8.useCallback)(
29833
29987
  (zoneCompound) => {
29834
29988
  if (!dispatch) {
29835
29989
  return;
@@ -29844,8 +29998,8 @@ var DropZoneProvider = ({
29844
29998
  },
29845
29999
  [setActiveZones, dispatch]
29846
30000
  );
29847
- const [pathData, setPathData] = (0, import_react7.useState)();
29848
- const registerPath = (0, import_react7.useCallback)(
30001
+ const [pathData, setPathData] = (0, import_react8.useState)();
30002
+ const registerPath = (0, import_react8.useCallback)(
29849
30003
  (selector) => {
29850
30004
  if (!(value == null ? void 0 : value.data)) {
29851
30005
  return;
@@ -29870,7 +30024,8 @@ var DropZoneProvider = ({
29870
30024
  },
29871
30025
  [value, setPathData]
29872
30026
  );
29873
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
30027
+ const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
30028
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29874
30029
  dropZoneContext.Provider,
29875
30030
  {
29876
30031
  value: __spreadValues({
@@ -29886,57 +30041,17 @@ var DropZoneProvider = ({
29886
30041
  unregisterZone,
29887
30042
  activeZones,
29888
30043
  registerPath,
29889
- pathData
30044
+ pathData,
30045
+ zoneWillDrag,
30046
+ setZoneWillDrag
29890
30047
  }, value),
29891
30048
  children
29892
30049
  }
29893
30050
  ) });
29894
30051
  };
29895
30052
 
29896
- // components/Puck/context.tsx
29897
- init_react_import();
29898
- var import_react8 = require("react");
29899
- var defaultAppState = {
29900
- data: { content: [], root: { props: { title: "" } } },
29901
- ui: {
29902
- leftSideBarVisible: true,
29903
- rightSideBarVisible: true,
29904
- arrayState: {},
29905
- itemSelector: null,
29906
- componentList: {},
29907
- isDragging: false
29908
- }
29909
- };
29910
- var appContext = (0, import_react8.createContext)({
29911
- state: defaultAppState,
29912
- dispatch: () => null,
29913
- config: { components: {} },
29914
- componentState: {},
29915
- resolveData: () => {
29916
- },
29917
- plugins: [],
29918
- overrides: {},
29919
- history: {}
29920
- });
29921
- var AppProvider = appContext.Provider;
29922
- function useAppContext() {
29923
- const mainContext = (0, import_react8.useContext)(appContext);
29924
- const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29925
- return __spreadProps(__spreadValues({}, mainContext), {
29926
- // Helpers
29927
- selectedItem,
29928
- setUi: (ui, recordHistory) => {
29929
- return mainContext.dispatch({
29930
- type: "setUi",
29931
- ui,
29932
- recordHistory
29933
- });
29934
- }
29935
- });
29936
- }
29937
-
29938
30053
  // components/DropZone/index.tsx
29939
- var import_jsx_runtime7 = require("react/jsx-runtime");
30054
+ var import_jsx_runtime8 = require("react/jsx-runtime");
29940
30055
  var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
29941
30056
  function DropZoneEdit({ zone, allow, disallow, style }) {
29942
30057
  var _a;
@@ -29955,7 +30070,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29955
30070
  registerZoneArea,
29956
30071
  areasWithZones,
29957
30072
  hoveringComponent,
29958
- disableZoom = false
30073
+ zoneWillDrag,
30074
+ setZoneWillDrag = () => null
29959
30075
  } = ctx || {};
29960
30076
  let content = data.content || [];
29961
30077
  let zoneCompound = rootDroppableId;
@@ -29985,12 +30101,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29985
30101
  const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
29986
30102
  const [zoneArea] = getZoneId(zoneCompound);
29987
30103
  const [draggedSourceArea] = getZoneId(draggedSourceId);
29988
- const [userWillDrag, setUserWillDrag] = (0, import_react9.useState)(false);
30104
+ const userWillDrag = zoneWillDrag === zone;
29989
30105
  const userIsDragging = !!draggedItem;
29990
30106
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
29991
30107
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
29992
30108
  if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
29993
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "DropZone requires context to work." });
30109
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "DropZone requires context to work." });
29994
30110
  }
29995
30111
  const {
29996
30112
  hoveringArea = "root",
@@ -30027,7 +30143,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30027
30143
  }
30028
30144
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
30029
30145
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
30030
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30146
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30031
30147
  "div",
30032
30148
  {
30033
30149
  className: getClassName5({
@@ -30039,17 +30155,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30039
30155
  isDestination: draggedDestinationId === zoneCompound,
30040
30156
  isDisabled: !isEnabled,
30041
30157
  isAreaSelected,
30042
- hasChildren: content.length > 0,
30043
- zoomEnabled: !disableZoom
30158
+ hasChildren: content.length > 0
30044
30159
  }),
30045
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30160
+ onMouseUp: () => {
30161
+ setZoneWillDrag("");
30162
+ },
30163
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30046
30164
  import_dnd4.Droppable,
30047
30165
  {
30048
30166
  droppableId: zoneCompound,
30049
30167
  direction: "vertical",
30050
30168
  isDropDisabled: !isEnabled,
30051
30169
  children: (provided, snapshot) => {
30052
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30170
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30053
30171
  "div",
30054
30172
  __spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
30055
30173
  className: getClassName5("content"),
@@ -30063,7 +30181,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30063
30181
  },
30064
30182
  children: [
30065
30183
  content.map((item, i) => {
30066
- var _a2, _b;
30184
+ var _a2, _b, _c;
30067
30185
  const componentId = item.props.id;
30068
30186
  const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
30069
30187
  puck: { renderDropZone: DropZone },
@@ -30074,33 +30192,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30074
30192
  "draggable-"
30075
30193
  )[1] === componentId;
30076
30194
  const containsZone = areasWithZones ? areasWithZones[componentId] : false;
30077
- const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30195
+ const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30078
30196
  "No configuration for ",
30079
30197
  item.type
30080
30198
  ] });
30081
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30199
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30082
30200
  "div",
30083
30201
  {
30084
30202
  className: getClassName5("item"),
30085
30203
  style: { zIndex: isDragging ? 1 : void 0 },
30086
30204
  children: [
30087
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30205
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30088
30206
  DropZoneProvider,
30089
30207
  {
30090
30208
  value: __spreadProps(__spreadValues({}, ctx), {
30091
30209
  areaId: componentId
30092
30210
  }),
30093
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30211
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30094
30212
  DraggableComponent,
30095
30213
  {
30096
- label: item.type.toString(),
30214
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
30097
30215
  id: `draggable-${componentId}`,
30098
30216
  index: i,
30099
30217
  isSelected,
30100
30218
  isLocked: userIsDragging,
30101
30219
  forceHover: hoveringComponent === componentId && !userIsDragging,
30102
30220
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
30103
- isLoading: (_b = appContext2.componentState[componentId]) == null ? void 0 : _b.loading,
30221
+ isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
30104
30222
  onMount: () => {
30105
30223
  ctx.registerPath({
30106
30224
  index: i,
@@ -30116,11 +30234,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30116
30234
  },
30117
30235
  onMouseDown: (e) => {
30118
30236
  e.stopPropagation();
30119
- setUserWillDrag(true);
30120
- },
30121
- onMouseUp: (e) => {
30122
- e.stopPropagation();
30123
- setUserWillDrag(false);
30237
+ setZoneWillDrag(zone);
30124
30238
  },
30125
30239
  onMouseOver: (e) => {
30126
30240
  e.stopPropagation();
@@ -30161,12 +30275,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30161
30275
  style: {
30162
30276
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
30163
30277
  },
30164
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30278
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30165
30279
  }
30166
30280
  )
30167
30281
  }
30168
30282
  ),
30169
- userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30283
+ userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30170
30284
  "div",
30171
30285
  {
30172
30286
  className: getClassName5("hitbox"),
@@ -30183,12 +30297,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30183
30297
  );
30184
30298
  }),
30185
30299
  provided == null ? void 0 : provided.placeholder,
30186
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30300
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30187
30301
  "div",
30188
30302
  {
30189
30303
  "data-puck-placeholder": true,
30190
30304
  style: __spreadProps(__spreadValues({}, placeholderStyle), {
30191
- background: "var(--puck-color-azure-5)",
30305
+ background: "var(--puck-color-azure-06)",
30192
30306
  opacity: 0.3,
30193
30307
  zIndex: 0
30194
30308
  })
@@ -30215,14 +30329,14 @@ function DropZoneRender({ zone }) {
30215
30329
  zoneCompound = `${areaId}:${zone}`;
30216
30330
  content = setupZone(data, zoneCompound).zones[zoneCompound];
30217
30331
  }
30218
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: content.map((item) => {
30332
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: content.map((item) => {
30219
30333
  const Component = config.components[item.type];
30220
30334
  if (Component) {
30221
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30335
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30222
30336
  DropZoneProvider,
30223
30337
  {
30224
30338
  value: { data, config, areaId: item.props.id },
30225
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30339
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
30226
30340
  Component.render,
30227
30341
  __spreadProps(__spreadValues({}, item.props), {
30228
30342
  puck: { renderDropZone: DropZone }
@@ -30238,9 +30352,9 @@ function DropZoneRender({ zone }) {
30238
30352
  function DropZone(props) {
30239
30353
  const ctx = (0, import_react9.useContext)(dropZoneContext);
30240
30354
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
30241
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneEdit, __spreadValues({}, props));
30355
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropZoneEdit, __spreadValues({}, props));
30242
30356
  }
30243
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneRender, __spreadValues({}, props));
30357
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropZoneRender, __spreadValues({}, props));
30244
30358
  }
30245
30359
 
30246
30360
  // components/IconButton/index.ts
@@ -30252,11 +30366,11 @@ var import_react10 = require("react");
30252
30366
 
30253
30367
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
30254
30368
  init_react_import();
30255
- var IconButton_module_default = { "IconButton": "_IconButton_38xdr_1", "IconButton-title": "_IconButton-title_38xdr_18" };
30369
+ var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
30256
30370
 
30257
30371
  // components/IconButton/IconButton.tsx
30258
30372
  var import_react_spinners3 = require("react-spinners");
30259
- var import_jsx_runtime8 = require("react/jsx-runtime");
30373
+ var import_jsx_runtime9 = require("react/jsx-runtime");
30260
30374
  var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
30261
30375
  var IconButton = ({
30262
30376
  children,
@@ -30272,7 +30386,7 @@ var IconButton = ({
30272
30386
  }) => {
30273
30387
  const [loading, setLoading] = (0, import_react10.useState)(false);
30274
30388
  const ElementType = href ? "a" : "button";
30275
- const el = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30389
+ const el = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30276
30390
  ElementType,
30277
30391
  {
30278
30392
  className: getClassName6({
@@ -30297,11 +30411,11 @@ var IconButton = ({
30297
30411
  href,
30298
30412
  title,
30299
30413
  children: [
30300
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName6("title"), children: title }),
30414
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: getClassName6("title"), children: title }),
30301
30415
  children,
30302
- loading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
30416
+ loading && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
30303
30417
  "\xA0\xA0",
30304
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30418
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30305
30419
  ] })
30306
30420
  ]
30307
30421
  }
@@ -30311,8 +30425,8 @@ var IconButton = ({
30311
30425
 
30312
30426
  // components/Puck/index.tsx
30313
30427
  init_react_import();
30314
- var import_react26 = require("react");
30315
- var import_dnd7 = require("@hello-pangea/dnd");
30428
+ var import_react28 = require("react");
30429
+ var import_dnd7 = require("@measured/dnd");
30316
30430
 
30317
30431
  // lib/use-placeholder-style.ts
30318
30432
  init_react_import();
@@ -30321,16 +30435,17 @@ var usePlaceholderStyle = () => {
30321
30435
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30322
30436
  const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
30323
30437
  const onDragStartOrUpdate = (draggedItem) => {
30324
- var _a;
30438
+ var _a, _b, _c;
30325
30439
  const draggableId = draggedItem.draggableId;
30326
30440
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30327
30441
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30328
30442
  const domQuery = `[${queryAttr}='${draggableId}']`;
30329
- const draggedDOM = document.querySelector(domQuery);
30443
+ const iframe = document.querySelector(`#preview-iframe`);
30444
+ const draggedDOM = document.querySelector(domQuery) || ((_a = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _a.document.querySelector(domQuery));
30330
30445
  if (!draggedDOM) {
30331
30446
  return;
30332
30447
  }
30333
- const targetListElement = document.querySelector(
30448
+ const targetListElement = (_b = iframe == null ? void 0 : iframe.contentWindow) == null ? void 0 : _b.document.querySelector(
30334
30449
  `[data-rfd-droppable-id='${droppableId}']`
30335
30450
  );
30336
30451
  const { clientHeight } = draggedDOM;
@@ -30338,7 +30453,7 @@ var usePlaceholderStyle = () => {
30338
30453
  return;
30339
30454
  }
30340
30455
  let clientY = 0;
30341
- const isSameDroppable = draggedItem.source.droppableId === ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
30456
+ const isSameDroppable = draggedItem.source.droppableId === ((_c = draggedItem.destination) == null ? void 0 : _c.droppableId);
30342
30457
  if (destinationIndex > 0) {
30343
30458
  const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
30344
30459
  const children = Array.from(targetListElement.children).filter(
@@ -30367,21 +30482,21 @@ init_react_import();
30367
30482
 
30368
30483
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
30369
30484
  init_react_import();
30370
- var styles_module_default5 = { "SidebarSection": "_SidebarSection_170gs_1", "SidebarSection-title": "_SidebarSection-title_170gs_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_170gs_20", "SidebarSection-content": "_SidebarSection-content_170gs_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_170gs_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_170gs_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_170gs_52", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_170gs_41", "SidebarSection-heading": "_SidebarSection-heading_170gs_64", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_170gs_68" };
30485
+ var styles_module_default5 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
30371
30486
 
30372
30487
  // components/Heading/index.tsx
30373
30488
  init_react_import();
30374
30489
 
30375
30490
  // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
30376
30491
  init_react_import();
30377
- var styles_module_default6 = { "Heading": "_Heading_1bvy5_1", "Heading--xxxxl": "_Heading--xxxxl_1bvy5_13", "Heading--xxxl": "_Heading--xxxl_1bvy5_19", "Heading--xxl": "_Heading--xxl_1bvy5_23", "Heading--xl": "_Heading--xl_1bvy5_27", "Heading--l": "_Heading--l_1bvy5_31", "Heading--m": "_Heading--m_1bvy5_35", "Heading--s": "_Heading--s_1bvy5_39", "Heading--xs": "_Heading--xs_1bvy5_43" };
30492
+ var styles_module_default6 = { "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" };
30378
30493
 
30379
30494
  // components/Heading/index.tsx
30380
- var import_jsx_runtime9 = require("react/jsx-runtime");
30495
+ var import_jsx_runtime10 = require("react/jsx-runtime");
30381
30496
  var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
30382
30497
  var Heading = ({ children, rank, size = "m" }) => {
30383
30498
  const Tag = rank ? `h${rank}` : "span";
30384
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30499
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
30385
30500
  Tag,
30386
30501
  {
30387
30502
  className: getClassName7({
@@ -30460,7 +30575,7 @@ var useBreadcrumbs = (renderCount) => {
30460
30575
 
30461
30576
  // components/SidebarSection/index.tsx
30462
30577
  var import_react_spinners4 = require("react-spinners");
30463
- var import_jsx_runtime10 = require("react/jsx-runtime");
30578
+ var import_jsx_runtime11 = require("react/jsx-runtime");
30464
30579
  var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
30465
30580
  var SidebarSection = ({
30466
30581
  children,
@@ -30473,28 +30588,28 @@ var SidebarSection = ({
30473
30588
  }) => {
30474
30589
  const { setUi } = useAppContext();
30475
30590
  const breadcrumbs = useBreadcrumbs(1);
30476
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30591
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
30477
30592
  "div",
30478
30593
  {
30479
30594
  className: getClassName8({ noBorderTop, noPadding }),
30480
30595
  style: { background },
30481
30596
  children: [
30482
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30483
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30484
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
30485
- "div",
30597
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30598
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30599
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
30600
+ "button",
30486
30601
  {
30487
30602
  className: getClassName8("breadcrumbLabel"),
30488
30603
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
30489
30604
  children: breadcrumb.label
30490
30605
  }
30491
30606
  ),
30492
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronRight, { size: 16 })
30607
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronRight, { size: 16 })
30493
30608
  ] }, i)) : null,
30494
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30609
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30495
30610
  ] }) }),
30496
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("content"), children }),
30497
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30611
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("content"), children }),
30612
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30498
30613
  ]
30499
30614
  }
30500
30615
  );
@@ -30527,8 +30642,8 @@ init_react_import();
30527
30642
 
30528
30643
  // lib/generate-id.ts
30529
30644
  init_react_import();
30530
- var import_crypto = require("crypto");
30531
- var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
30645
+ var import_uuid = require("uuid");
30646
+ var generateId = (type) => `${type}-${(0, import_uuid.v4)()}`;
30532
30647
 
30533
30648
  // lib/reduce-related-zones.ts
30534
30649
  var reduceRelatedZones = (item, data, fn) => {
@@ -31000,7 +31115,10 @@ var useResolvedData = (appState, config, dispatch) => {
31000
31115
  );
31001
31116
  const runResolvers = () => __async(void 0, null, function* () {
31002
31117
  const newData = newAppState.data;
31003
- const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => !!config.components[item.type].resolveData);
31118
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
31119
+ var _a;
31120
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
31121
+ });
31004
31122
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
31005
31123
  const processed = applyDynamicProps(
31006
31124
  appState.data,
@@ -31070,10 +31188,10 @@ init_react_import();
31070
31188
 
31071
31189
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
31072
31190
  init_react_import();
31073
- var styles_module_default7 = { "MenuBar": "_MenuBar_12sp7_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_12sp7_14", "MenuBar-inner": "_MenuBar-inner_12sp7_29", "MenuBar-history": "_MenuBar-history_12sp7_45" };
31191
+ var styles_module_default7 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
31074
31192
 
31075
31193
  // components/MenuBar/index.tsx
31076
- var import_jsx_runtime11 = require("react/jsx-runtime");
31194
+ var import_jsx_runtime12 = require("react/jsx-runtime");
31077
31195
  var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31078
31196
  var MenuBar = ({
31079
31197
  appState,
@@ -31088,7 +31206,7 @@ var MenuBar = ({
31088
31206
  history: { back, forward, historyStore }
31089
31207
  } = useAppContext();
31090
31208
  const { hasFuture = false, hasPast = false } = historyStore || {};
31091
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31209
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31092
31210
  "div",
31093
31211
  {
31094
31212
  className: getClassName9({ menuOpen }),
@@ -31102,34 +31220,34 @@ var MenuBar = ({
31102
31220
  setMenuOpen(false);
31103
31221
  }
31104
31222
  },
31105
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("inner"), children: [
31106
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("history"), children: [
31107
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31223
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName9("inner"), children: [
31224
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName9("history"), children: [
31225
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31108
31226
  ChevronLeft,
31109
31227
  {
31110
31228
  size: 21,
31111
- stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
31229
+ stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31112
31230
  }
31113
31231
  ) }),
31114
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31232
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31115
31233
  ChevronRight,
31116
31234
  {
31117
31235
  size: 21,
31118
- stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
31236
+ stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31119
31237
  }
31120
31238
  ) })
31121
31239
  ] }),
31122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: renderHeaderActions && renderHeaderActions({
31240
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: renderHeaderActions && renderHeaderActions({
31123
31241
  state: appState,
31124
31242
  dispatch
31125
31243
  }) }),
31126
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31244
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31127
31245
  Button,
31128
31246
  {
31129
31247
  onClick: () => {
31130
31248
  onPublish && onPublish(data);
31131
31249
  },
31132
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Globe, { size: "14px" }),
31250
+ icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Globe, { size: "14px" }),
31133
31251
  children: "Publish"
31134
31252
  }
31135
31253
  ) })
@@ -31140,7 +31258,7 @@ var MenuBar = ({
31140
31258
 
31141
31259
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31142
31260
  init_react_import();
31143
- var styles_module_default8 = { "Puck": "_Puck_17hk3_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_17hk3_35", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_17hk3_41", "Puck-header": "_Puck-header_17hk3_95", "Puck-headerInner": "_Puck-headerInner_17hk3_104", "Puck-headerToggle": "_Puck-headerToggle_17hk3_114", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_17hk3_121", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_17hk3_122", "Puck-headerTitle": "_Puck-headerTitle_17hk3_126", "Puck-headerPath": "_Puck-headerPath_17hk3_130", "Puck-headerTools": "_Puck-headerTools_17hk3_137", "Puck-menuButton": "_Puck-menuButton_17hk3_143", "Puck--menuOpen": "_Puck--menuOpen_17hk3_148", "Puck-leftSideBar": "_Puck-leftSideBar_17hk3_122", "Puck-frame": "_Puck-frame_17hk3_167", "Puck-root": "_Puck-root_17hk3_175", "Puck-rightSideBar": "_Puck-rightSideBar_17hk3_121" };
31261
+ var styles_module_default8 = { "Puck": "_Puck_3qn7l_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_3qn7l_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_3qn7l_42", "Puck-header": "_Puck-header_3qn7l_96", "Puck-headerInner": "_Puck-headerInner_3qn7l_105", "Puck-headerToggle": "_Puck-headerToggle_3qn7l_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_3qn7l_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_3qn7l_123", "Puck-headerTitle": "_Puck-headerTitle_3qn7l_127", "Puck-headerPath": "_Puck-headerPath_3qn7l_131", "Puck-headerTools": "_Puck-headerTools_3qn7l_138", "Puck-menuButton": "_Puck-menuButton_3qn7l_144", "Puck--menuOpen": "_Puck--menuOpen_3qn7l_149", "Puck-leftSideBar": "_Puck-leftSideBar_3qn7l_123", "Puck-frame": "_Puck-frame_3qn7l_168", "Puck-root": "_Puck-root_3qn7l_179", "Puck-rightSideBar": "_Puck-rightSideBar_3qn7l_122", "Puck-canvas": "_Puck-canvas_3qn7l_211", "Puck-canvasControls": "_Puck-canvasControls_3qn7l_226" };
31144
31262
 
31145
31263
  // components/Puck/components/Fields/index.tsx
31146
31264
  init_react_import();
@@ -31151,7 +31269,7 @@ init_react_import();
31151
31269
 
31152
31270
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
31153
31271
  init_react_import();
31154
- var styles_module_default9 = { "Input": "_Input_1v7zr_1", "Input-label": "_Input-label_1v7zr_27", "Input-labelIcon": "_Input-labelIcon_1v7zr_35", "Input-disabledIcon": "_Input-disabledIcon_1v7zr_41", "Input-input": "_Input-input_1v7zr_46", "Input--readOnly": "_Input--readOnly_1v7zr_69", "Input-radioGroupItems": "_Input-radioGroupItems_1v7zr_87", "Input-radio": "_Input-radio_1v7zr_87", "Input-radioInner": "_Input-radioInner_1v7zr_104", "Input-radioInput": "_Input-radioInput_1v7zr_126" };
31272
+ 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" };
31155
31273
 
31156
31274
  // components/InputOrGroup/index.tsx
31157
31275
  var import_react18 = require("react");
@@ -31164,13 +31282,13 @@ init_react_import();
31164
31282
 
31165
31283
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
31166
31284
  init_react_import();
31167
- var styles_module_default10 = { "ArrayField": "_ArrayField_1auyc_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1auyc_13", "ArrayField-addButton": "_ArrayField-addButton_1auyc_17", "ArrayField--hasItems": "_ArrayField--hasItems_1auyc_31", "ArrayFieldItem": "_ArrayFieldItem_1auyc_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1auyc_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1auyc_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1auyc_73", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1auyc_86", "ArrayFieldItem-body": "_ArrayFieldItem-body_1auyc_107", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1auyc_115", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1auyc_122", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1auyc_128", "ArrayFieldItem-action": "_ArrayFieldItem-action_1auyc_128" };
31285
+ 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" };
31168
31286
 
31169
31287
  // components/InputOrGroup/fields/ArrayField/index.tsx
31170
- var import_dnd5 = require("@hello-pangea/dnd");
31171
- var import_dnd6 = require("@hello-pangea/dnd");
31288
+ var import_dnd5 = require("@measured/dnd");
31289
+ var import_dnd6 = require("@measured/dnd");
31172
31290
  var import_react14 = require("react");
31173
- var import_jsx_runtime12 = require("react/jsx-runtime");
31291
+ var import_jsx_runtime13 = require("react/jsx-runtime");
31174
31292
  var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
31175
31293
  var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
31176
31294
  var ArrayField = ({
@@ -31240,14 +31358,14 @@ var ArrayField = ({
31240
31358
  if (field.type !== "array" || !field.arrayFields) {
31241
31359
  return null;
31242
31360
  }
31243
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31361
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31244
31362
  FieldLabelInternal,
31245
31363
  {
31246
31364
  label: label || name,
31247
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { size: 16 }),
31365
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(List, { size: 16 }),
31248
31366
  el: "div",
31249
31367
  readOnly,
31250
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31368
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31251
31369
  import_dnd6.DragDropContext,
31252
31370
  {
31253
31371
  onDragEnd: (event) => {
@@ -31274,8 +31392,8 @@ var ArrayField = ({
31274
31392
  });
31275
31393
  }
31276
31394
  },
31277
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dnd5.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31278
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31395
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_dnd5.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31396
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
31279
31397
  "div",
31280
31398
  __spreadProps(__spreadValues({}, provided.droppableProps), {
31281
31399
  ref: provided.innerRef,
@@ -31295,7 +31413,7 @@ var ArrayField = ({
31295
31413
  localState.arrayState.items.map((item, i) => {
31296
31414
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
31297
31415
  const data = Array.from(localState.value || [])[i] || {};
31298
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31416
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31299
31417
  Draggable,
31300
31418
  {
31301
31419
  id: _arrayId,
@@ -31306,8 +31424,8 @@ var ArrayField = ({
31306
31424
  readOnly
31307
31425
  }),
31308
31426
  isDragDisabled: readOnly || !hovering,
31309
- children: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
31310
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31427
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
31428
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
31311
31429
  "div",
31312
31430
  {
31313
31431
  onClick: () => {
@@ -31328,10 +31446,11 @@ var ArrayField = ({
31328
31446
  className: getClassNameItem2("summary"),
31329
31447
  children: [
31330
31448
  field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
31331
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31332
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31449
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31450
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31333
31451
  IconButton,
31334
31452
  {
31453
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31335
31454
  onClick: (e) => {
31336
31455
  e.stopPropagation();
31337
31456
  const existingValue = [
@@ -31350,20 +31469,20 @@ var ArrayField = ({
31350
31469
  );
31351
31470
  },
31352
31471
  title: "Delete",
31353
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash, { size: 16 })
31472
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Trash, { size: 16 })
31354
31473
  }
31355
31474
  ) }) }),
31356
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DragIcon, {}) })
31475
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DragIcon, {}) })
31357
31476
  ] })
31358
31477
  ]
31359
31478
  }
31360
31479
  ),
31361
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31480
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31362
31481
  (fieldName) => {
31363
31482
  const subField = field.arrayFields[fieldName];
31364
31483
  const subFieldName = `${name}[${i}].${fieldName}`;
31365
31484
  const wildcardFieldName = `${name}[*].${fieldName}`;
31366
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31485
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31367
31486
  InputOrGroup,
31368
31487
  {
31369
31488
  name: subFieldName,
@@ -31392,10 +31511,11 @@ var ArrayField = ({
31392
31511
  );
31393
31512
  }),
31394
31513
  provided.placeholder,
31395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31514
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31396
31515
  "button",
31397
31516
  {
31398
31517
  className: getClassName10("addButton"),
31518
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
31399
31519
  onClick: () => {
31400
31520
  const existingValue = value || [];
31401
31521
  const newValue = [
@@ -31405,7 +31525,7 @@ var ArrayField = ({
31405
31525
  const newArrayState = regenerateArrayState(newValue);
31406
31526
  onChange(newValue, mapArrayStateToUi(newArrayState));
31407
31527
  },
31408
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31528
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Plus, { size: 21 })
31409
31529
  }
31410
31530
  )
31411
31531
  ]
@@ -31420,7 +31540,7 @@ var ArrayField = ({
31420
31540
 
31421
31541
  // components/InputOrGroup/fields/DefaultField/index.tsx
31422
31542
  init_react_import();
31423
- var import_jsx_runtime13 = require("react/jsx-runtime");
31543
+ var import_jsx_runtime14 = require("react/jsx-runtime");
31424
31544
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
31425
31545
  var DefaultField = ({
31426
31546
  field,
@@ -31431,16 +31551,16 @@ var DefaultField = ({
31431
31551
  label,
31432
31552
  id
31433
31553
  }) => {
31434
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31554
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31435
31555
  FieldLabelInternal,
31436
31556
  {
31437
31557
  label: label || name,
31438
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
31439
- field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Type, { size: 16 }),
31440
- field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Hash, { size: 16 })
31558
+ icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
31559
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Type, { size: 16 }),
31560
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Hash, { size: 16 })
31441
31561
  ] }),
31442
31562
  readOnly,
31443
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31563
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31444
31564
  "input",
31445
31565
  {
31446
31566
  className: getClassName11("input"),
@@ -31456,6 +31576,7 @@ var DefaultField = ({
31456
31576
  }
31457
31577
  },
31458
31578
  readOnly,
31579
+ tabIndex: readOnly ? -1 : void 0,
31459
31580
  id,
31460
31581
  min: field.type === "number" ? field.min : void 0,
31461
31582
  max: field.type === "number" ? field.max : void 0
@@ -31475,7 +31596,7 @@ var import_react16 = require("react");
31475
31596
 
31476
31597
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31477
31598
  init_react_import();
31478
- var styles_module_default11 = { "ExternalInput": "_ExternalInput_s6fxy_1", "ExternalInput-actions": "_ExternalInput-actions_s6fxy_5", "ExternalInput-button": "_ExternalInput-button_s6fxy_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_s6fxy_28", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_s6fxy_35", "ExternalInputModal": "_ExternalInputModal_s6fxy_56", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_s6fxy_64", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_s6fxy_72", "ExternalInputModal-table": "_ExternalInputModal-table_s6fxy_72", "ExternalInputModal-thead": "_ExternalInputModal-thead_s6fxy_88", "ExternalInputModal-th": "_ExternalInputModal-th_s6fxy_88", "ExternalInputModal-td": "_ExternalInputModal-td_s6fxy_102", "ExternalInputModal-tr": "_ExternalInputModal-tr_s6fxy_107", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_s6fxy_119", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_s6fxy_138", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_s6fxy_142", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_s6fxy_155", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_s6fxy_159", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_s6fxy_166", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_s6fxy_171", "ExternalInputModal-search": "_ExternalInputModal-search_s6fxy_171", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_s6fxy_194", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_s6fxy_206", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_s6fxy_216" };
31599
+ var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_19obq_1", "ExternalInput-button": "_ExternalInput-button_19obq_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_19obq_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_19obq_32", "ExternalInputModal": "_ExternalInputModal_19obq_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_19obq_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_19obq_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_19obq_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_19obq_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_19obq_128", "ExternalInputModal-table": "_ExternalInputModal-table_19obq_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_19obq_144", "ExternalInputModal-th": "_ExternalInputModal-th_19obq_144", "ExternalInputModal-td": "_ExternalInputModal-td_19obq_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_19obq_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_19obq_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_19obq_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_19obq_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_19obq_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_19obq_222", "ExternalInputModal-search": "_ExternalInputModal-search_19obq_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_19obq_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_19obq_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_19obq_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_19obq_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_19obq_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_19obq_325" };
31479
31600
 
31480
31601
  // components/Modal/index.tsx
31481
31602
  init_react_import();
@@ -31483,11 +31604,11 @@ var import_react15 = require("react");
31483
31604
 
31484
31605
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31485
31606
  init_react_import();
31486
- var styles_module_default12 = { "Modal": "_Modal_hx2u6_1", "Modal--isOpen": "_Modal--isOpen_hx2u6_15", "Modal-inner": "_Modal-inner_hx2u6_19" };
31607
+ var styles_module_default12 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
31487
31608
 
31488
31609
  // components/Modal/index.tsx
31489
31610
  var import_react_dom = __toESM(require_react_dom());
31490
- var import_jsx_runtime14 = require("react/jsx-runtime");
31611
+ var import_jsx_runtime15 = require("react/jsx-runtime");
31491
31612
  var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
31492
31613
  var Modal = ({
31493
31614
  children,
@@ -31499,10 +31620,10 @@ var Modal = ({
31499
31620
  setRootEl(document.getElementById("puck-portal-root"));
31500
31621
  }, []);
31501
31622
  if (!rootEl) {
31502
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {});
31623
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", {});
31503
31624
  }
31504
31625
  return (0, import_react_dom.createPortal)(
31505
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31626
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31506
31627
  "div",
31507
31628
  {
31508
31629
  className: getClassName12("inner"),
@@ -31516,7 +31637,7 @@ var Modal = ({
31516
31637
 
31517
31638
  // components/ExternalInput/index.tsx
31518
31639
  var import_react_spinners5 = require("react-spinners");
31519
- var import_jsx_runtime15 = require("react/jsx-runtime");
31640
+ var import_jsx_runtime16 = require("react/jsx-runtime");
31520
31641
  var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
31521
31642
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
31522
31643
  var dataCache = {};
@@ -31527,13 +31648,23 @@ var ExternalInput = ({
31527
31648
  name,
31528
31649
  id
31529
31650
  }) => {
31530
- const { mapProp = (val) => val } = field || {};
31651
+ const {
31652
+ mapProp = (val) => val,
31653
+ mapRow = (val) => val,
31654
+ filterFields
31655
+ } = field || {};
31531
31656
  const [data, setData] = (0, import_react16.useState)([]);
31532
31657
  const [isOpen, setOpen] = (0, import_react16.useState)(false);
31533
31658
  const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31659
+ const hasFilterFields = !!filterFields;
31660
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
31661
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
31662
+ const mappedData = (0, import_react16.useMemo)(() => {
31663
+ return data.map(mapRow);
31664
+ }, [data]);
31534
31665
  const keys = (0, import_react16.useMemo)(() => {
31535
31666
  const validKeys = /* @__PURE__ */ new Set();
31536
- for (const item of data) {
31667
+ for (const item of mappedData) {
31537
31668
  for (const key of Object.keys(item)) {
31538
31669
  if (typeof item[key] === "string" || typeof item[key] === "number") {
31539
31670
  validKeys.add(key);
@@ -31541,13 +31672,13 @@ var ExternalInput = ({
31541
31672
  }
31542
31673
  }
31543
31674
  return Array.from(validKeys);
31544
- }, [data]);
31675
+ }, [mappedData]);
31545
31676
  const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31546
31677
  const search = (0, import_react16.useCallback)(
31547
- (query) => __async(void 0, null, function* () {
31678
+ (query, filters2) => __async(void 0, null, function* () {
31548
31679
  setIsLoading(true);
31549
- const cacheKey = `${id}-${name}-${query}`;
31550
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
31680
+ const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
31681
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
31551
31682
  if (listData) {
31552
31683
  setData(listData);
31553
31684
  setIsLoading(false);
@@ -31557,9 +31688,9 @@ var ExternalInput = ({
31557
31688
  [name, field]
31558
31689
  );
31559
31690
  (0, import_react16.useEffect)(() => {
31560
- search(searchQuery);
31691
+ search(searchQuery, filters);
31561
31692
  }, []);
31562
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31693
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
31563
31694
  "div",
31564
31695
  {
31565
31696
  className: getClassName13({
@@ -31568,102 +31699,133 @@ var ExternalInput = ({
31568
31699
  }),
31569
31700
  id,
31570
31701
  children: [
31571
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName13("actions"), children: [
31572
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31702
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassName13("actions"), children: [
31703
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31573
31704
  "button",
31574
31705
  {
31575
31706
  onClick: () => setOpen(true),
31576
31707
  className: getClassName13("button"),
31577
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31578
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: "16" }),
31579
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: field.placeholder })
31708
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
31709
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: "16" }),
31710
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: field.placeholder })
31580
31711
  ] })
31581
31712
  }
31582
31713
  ),
31583
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31714
+ value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31584
31715
  "button",
31585
31716
  {
31586
31717
  className: getClassName13("detachButton"),
31587
31718
  onClick: () => {
31588
31719
  onChange(null);
31589
31720
  },
31590
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Unlock, { size: 16 })
31721
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Unlock, { size: 16 })
31591
31722
  }
31592
31723
  )
31593
31724
  ] }),
31594
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31595
- "div",
31725
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
31726
+ "form",
31596
31727
  {
31597
31728
  className: getClassNameModal({
31598
31729
  isLoading,
31599
31730
  loaded: !isLoading,
31600
- hasData: data.length > 0
31731
+ hasData: mappedData.length > 0,
31732
+ filtersToggled
31601
31733
  }),
31734
+ onSubmit: (e) => {
31735
+ e.preventDefault();
31736
+ search(searchQuery, filters);
31737
+ },
31602
31738
  children: [
31603
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("masthead"), children: [
31604
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
31605
- field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31606
- "form",
31607
- {
31608
- className: getClassNameModal("searchForm"),
31609
- onSubmit: (e) => {
31610
- e.preventDefault();
31611
- search(searchQuery);
31612
- },
31613
- children: [
31614
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31615
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31616
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31617
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31618
- "input",
31619
- {
31620
- className: getClassNameModal("searchInput"),
31621
- name: "q",
31622
- type: "search",
31623
- placeholder: "Search",
31624
- onChange: (e) => {
31625
- setSearchQuery(e.currentTarget.value);
31626
- },
31627
- autoComplete: "off",
31628
- value: searchQuery
31629
- }
31630
- )
31631
- ] }),
31632
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
31633
- ]
31634
- }
31635
- )
31636
- ] }),
31637
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31638
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31639
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31640
- "th",
31739
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31740
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: getClassNameModal("search"), children: [
31741
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31742
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Search, { size: "18" }) }),
31743
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31744
+ "input",
31745
+ {
31746
+ className: getClassNameModal("searchInput"),
31747
+ name: "q",
31748
+ type: "search",
31749
+ placeholder: field.placeholder,
31750
+ onChange: (e) => {
31751
+ setSearchQuery(e.currentTarget.value);
31752
+ },
31753
+ autoComplete: "off",
31754
+ value: searchQuery
31755
+ }
31756
+ )
31757
+ ] }),
31758
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31759
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31760
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31761
+ IconButton,
31641
31762
  {
31642
- className: getClassNameModal("th"),
31643
- style: { textAlign: "left" },
31644
- children: key
31763
+ title: "Toggle filters",
31764
+ onClick: (e) => {
31765
+ e.preventDefault();
31766
+ e.stopPropagation();
31767
+ setFiltersToggled(!filtersToggled);
31768
+ },
31769
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SlidersHorizontal, { size: 20 })
31770
+ }
31771
+ ) })
31772
+ ] })
31773
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31774
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("grid"), children: [
31775
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31776
+ const filterField = filterFields[fieldName];
31777
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31778
+ InputOrGroup,
31779
+ {
31780
+ field: filterField,
31781
+ name: fieldName,
31782
+ id: `external_field_${fieldName}_filter`,
31783
+ label: filterField.label || fieldName,
31784
+ value: filters[fieldName],
31785
+ onChange: (value2) => {
31786
+ const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
31787
+ setFilters(newFilters);
31788
+ search(searchQuery, newFilters);
31789
+ }
31645
31790
  },
31646
- key
31647
- )) }) }),
31648
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
31649
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31650
- "tr",
31791
+ fieldName
31792
+ );
31793
+ }) }),
31794
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31795
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { className: getClassNameModal("table"), children: [
31796
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31797
+ "th",
31651
31798
  {
31652
- style: { whiteSpace: "nowrap" },
31653
- className: getClassNameModal("tr"),
31654
- onClick: (e) => {
31655
- onChange(mapProp(item));
31656
- setOpen(false);
31657
- },
31658
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31799
+ className: getClassNameModal("th"),
31800
+ style: { textAlign: "left" },
31801
+ children: key
31659
31802
  },
31660
- i
31661
- );
31662
- }) })
31663
- ] }),
31664
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31803
+ key
31804
+ )) }) }),
31805
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31806
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31807
+ "tr",
31808
+ {
31809
+ style: { whiteSpace: "nowrap" },
31810
+ className: getClassNameModal("tr"),
31811
+ onClick: () => {
31812
+ onChange(mapProp(data[i]));
31813
+ setOpen(false);
31814
+ },
31815
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31816
+ },
31817
+ i
31818
+ );
31819
+ }) })
31820
+ ] }),
31821
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31822
+ ] })
31665
31823
  ] }),
31666
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
31824
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: getClassNameModal("footer"), children: [
31825
+ mappedData.length,
31826
+ " result",
31827
+ mappedData.length === 1 ? "" : "s"
31828
+ ] })
31667
31829
  ]
31668
31830
  }
31669
31831
  ) })
@@ -31673,7 +31835,7 @@ var ExternalInput = ({
31673
31835
  };
31674
31836
 
31675
31837
  // components/InputOrGroup/fields/ExternalField/index.tsx
31676
- var import_jsx_runtime16 = require("react/jsx-runtime");
31838
+ var import_jsx_runtime17 = require("react/jsx-runtime");
31677
31839
  var ExternalField = ({
31678
31840
  field,
31679
31841
  onChange,
@@ -31695,13 +31857,13 @@ var ExternalField = ({
31695
31857
  if (field.type !== "external") {
31696
31858
  return null;
31697
31859
  }
31698
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31860
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31699
31861
  FieldLabelInternal,
31700
31862
  {
31701
31863
  label: label || name,
31702
- icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: 16 }),
31864
+ icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Link, { size: 16 }),
31703
31865
  el: "div",
31704
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31866
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31705
31867
  ExternalInput,
31706
31868
  {
31707
31869
  name,
@@ -31709,6 +31871,7 @@ var ExternalField = ({
31709
31871
  // DEPRECATED
31710
31872
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
31711
31873
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
31874
+ mapRow: validField.mapRow,
31712
31875
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
31713
31876
  return yield deprecatedField.adaptor.fetchList(
31714
31877
  deprecatedField.adaptorParams
@@ -31726,7 +31889,7 @@ var ExternalField = ({
31726
31889
 
31727
31890
  // components/InputOrGroup/fields/RadioField/index.tsx
31728
31891
  init_react_import();
31729
- var import_jsx_runtime17 = require("react/jsx-runtime");
31892
+ var import_jsx_runtime18 = require("react/jsx-runtime");
31730
31893
  var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
31731
31894
  var RadioField = ({
31732
31895
  field,
@@ -31740,19 +31903,19 @@ var RadioField = ({
31740
31903
  if (field.type !== "radio" || !field.options) {
31741
31904
  return null;
31742
31905
  }
31743
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31906
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31744
31907
  FieldLabelInternal,
31745
31908
  {
31746
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckCircle, { size: 16 }),
31909
+ icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CheckCircle, { size: 16 }),
31747
31910
  label: label || name,
31748
31911
  readOnly,
31749
31912
  el: "div",
31750
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
31913
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31751
31914
  "label",
31752
31915
  {
31753
31916
  className: getClassName14("radio"),
31754
31917
  children: [
31755
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31756
31919
  "input",
31757
31920
  {
31758
31921
  type: "radio",
@@ -31770,7 +31933,7 @@ var RadioField = ({
31770
31933
  defaultChecked: value === option.value
31771
31934
  }
31772
31935
  ),
31773
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31936
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31774
31937
  ]
31775
31938
  },
31776
31939
  option.label + option.value
@@ -31781,7 +31944,7 @@ var RadioField = ({
31781
31944
 
31782
31945
  // components/InputOrGroup/fields/SelectField/index.tsx
31783
31946
  init_react_import();
31784
- var import_jsx_runtime18 = require("react/jsx-runtime");
31947
+ var import_jsx_runtime19 = require("react/jsx-runtime");
31785
31948
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
31786
31949
  var SelectField = ({
31787
31950
  field,
@@ -31795,13 +31958,13 @@ var SelectField = ({
31795
31958
  if (field.type !== "select" || !field.options) {
31796
31959
  return null;
31797
31960
  }
31798
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31961
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31799
31962
  FieldLabelInternal,
31800
31963
  {
31801
31964
  label: label || name,
31802
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { size: 16 }),
31965
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDown, { size: 16 }),
31803
31966
  readOnly,
31804
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31967
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31805
31968
  "select",
31806
31969
  {
31807
31970
  id,
@@ -31815,7 +31978,7 @@ var SelectField = ({
31815
31978
  onChange(e.currentTarget.value);
31816
31979
  },
31817
31980
  value,
31818
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31981
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31819
31982
  "option",
31820
31983
  {
31821
31984
  label: option.label,
@@ -31831,7 +31994,7 @@ var SelectField = ({
31831
31994
 
31832
31995
  // components/InputOrGroup/fields/TextareaField/index.tsx
31833
31996
  init_react_import();
31834
- var import_jsx_runtime19 = require("react/jsx-runtime");
31997
+ var import_jsx_runtime20 = require("react/jsx-runtime");
31835
31998
  var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
31836
31999
  var TextareaField = ({
31837
32000
  onChange,
@@ -31841,13 +32004,13 @@ var TextareaField = ({
31841
32004
  label,
31842
32005
  id
31843
32006
  }) => {
31844
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32007
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31845
32008
  FieldLabelInternal,
31846
32009
  {
31847
32010
  label: label || name,
31848
- icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Type, { size: 16 }),
32011
+ icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Type, { size: 16 }),
31849
32012
  readOnly,
31850
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32013
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31851
32014
  "textarea",
31852
32015
  {
31853
32016
  id,
@@ -31857,6 +32020,7 @@ var TextareaField = ({
31857
32020
  value: typeof value === "undefined" ? "" : value,
31858
32021
  onChange: (e) => onChange(e.currentTarget.value),
31859
32022
  readOnly,
32023
+ tabIndex: readOnly ? -1 : void 0,
31860
32024
  rows: 5
31861
32025
  }
31862
32026
  )
@@ -31872,10 +32036,10 @@ init_react_import();
31872
32036
 
31873
32037
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
31874
32038
  init_react_import();
31875
- var styles_module_default13 = { "ObjectField": "_ObjectField_56z4t_5", "ObjectField-fieldset": "_ObjectField-fieldset_56z4t_13" };
32039
+ var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
31876
32040
 
31877
32041
  // components/InputOrGroup/fields/ObjectField/index.tsx
31878
- var import_jsx_runtime20 = require("react/jsx-runtime");
32042
+ var import_jsx_runtime21 = require("react/jsx-runtime");
31879
32043
  var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
31880
32044
  var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
31881
32045
  var ObjectField = ({
@@ -31892,18 +32056,18 @@ var ObjectField = ({
31892
32056
  return null;
31893
32057
  }
31894
32058
  const data = value || {};
31895
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32059
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31896
32060
  FieldLabelInternal,
31897
32061
  {
31898
32062
  label: label || name,
31899
- icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoreVertical, { size: 16 }),
32063
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MoreVertical, { size: 16 }),
31900
32064
  el: "div",
31901
32065
  readOnly,
31902
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
32066
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
31903
32067
  const subField = field.objectFields[fieldName];
31904
32068
  const subFieldName = `${name}.${fieldName}`;
31905
32069
  const wildcardFieldName = `${name}.${fieldName}`;
31906
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32070
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31907
32071
  InputOrGroup,
31908
32072
  {
31909
32073
  name: subFieldName,
@@ -31930,7 +32094,7 @@ var ObjectField = ({
31930
32094
  };
31931
32095
 
31932
32096
  // components/InputOrGroup/index.tsx
31933
- var import_jsx_runtime21 = require("react/jsx-runtime");
32097
+ var import_jsx_runtime22 = require("react/jsx-runtime");
31934
32098
  var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
31935
32099
  var FieldLabel = ({
31936
32100
  children,
@@ -31941,11 +32105,11 @@ var FieldLabel = ({
31941
32105
  className
31942
32106
  }) => {
31943
32107
  const El = el;
31944
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(El, { className, children: [
31945
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("label"), children: [
31946
- icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {}),
32108
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(El, { className, children: [
32109
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("label"), children: [
32110
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, {}),
31947
32111
  label,
31948
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Lock, { size: "12" }) })
32112
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Lock, { size: "12" }) })
31949
32113
  ] }),
31950
32114
  children
31951
32115
  ] });
@@ -31962,7 +32126,7 @@ var FieldLabelInternal = ({
31962
32126
  () => overrides.fieldLabel || FieldLabel,
31963
32127
  [overrides]
31964
32128
  );
31965
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
32129
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31966
32130
  Wrapper,
31967
32131
  {
31968
32132
  label,
@@ -32002,7 +32166,7 @@ var InputOrGroup = (_a) => {
32002
32166
  if (!field.render) {
32003
32167
  return null;
32004
32168
  }
32005
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32169
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32006
32170
  field,
32007
32171
  name,
32008
32172
  readOnly
@@ -32031,16 +32195,16 @@ var InputOrGroup = (_a) => {
32031
32195
  const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
32032
32196
  const children = defaultFields[field.type](mergedProps);
32033
32197
  const Render2 = render[field.type];
32034
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32198
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32035
32199
  };
32036
32200
 
32037
32201
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
32038
32202
  init_react_import();
32039
- var styles_module_default14 = { "PuckFields": "_PuckFields_1276r_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_1276r_5" };
32203
+ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
32040
32204
 
32041
32205
  // components/Puck/components/Fields/index.tsx
32042
32206
  var import_react19 = require("react");
32043
- var import_jsx_runtime22 = require("react/jsx-runtime");
32207
+ var import_jsx_runtime23 = require("react/jsx-runtime");
32044
32208
  var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32045
32209
  var defaultPageFields = {
32046
32210
  title: { type: "text" }
@@ -32049,9 +32213,9 @@ var DefaultFields = ({
32049
32213
  children,
32050
32214
  isLoading
32051
32215
  }) => {
32052
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName19(), children: [
32216
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName19(), children: [
32053
32217
  children,
32054
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32218
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32055
32219
  ] });
32056
32220
  };
32057
32221
  var Fields = () => {
@@ -32072,14 +32236,14 @@ var Fields = () => {
32072
32236
  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;
32073
32237
  const rootProps = data.root.props || data.root;
32074
32238
  const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32075
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32239
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32076
32240
  "form",
32077
32241
  {
32078
32242
  className: getClassName19(),
32079
32243
  onSubmit: (e) => {
32080
32244
  e.preventDefault();
32081
32245
  },
32082
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32246
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32083
32247
  const field = fields[fieldName];
32084
32248
  const onChange = (value, updatedUi) => {
32085
32249
  var _a2, _b2;
@@ -32145,7 +32309,7 @@ var Fields = () => {
32145
32309
  };
32146
32310
  if (selectedItem && itemSelector) {
32147
32311
  const { readOnly = {} } = selectedItem;
32148
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32312
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32149
32313
  InputOrGroup,
32150
32314
  {
32151
32315
  field,
@@ -32161,7 +32325,7 @@ var Fields = () => {
32161
32325
  );
32162
32326
  } else {
32163
32327
  const { readOnly = {} } = data.root;
32164
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32328
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32165
32329
  InputOrGroup,
32166
32330
  {
32167
32331
  field,
@@ -32193,17 +32357,18 @@ init_react_import();
32193
32357
 
32194
32358
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
32195
32359
  init_react_import();
32196
- var styles_module_default15 = { "ComponentList": "_ComponentList_1di93_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1di93_6", "ComponentList-content": "_ComponentList-content_1di93_10", "ComponentList-title": "_ComponentList-title_1di93_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_1di93_39" };
32360
+ var styles_module_default15 = { "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" };
32197
32361
 
32198
32362
  // components/ComponentList/index.tsx
32199
- var import_jsx_runtime23 = require("react/jsx-runtime");
32363
+ var import_jsx_runtime24 = require("react/jsx-runtime");
32200
32364
  var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
32201
32365
  var ComponentListItem = ({
32202
32366
  name,
32367
+ label,
32203
32368
  index
32204
32369
  }) => {
32205
32370
  const { overrides } = useAppContext();
32206
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
32371
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
32207
32372
  };
32208
32373
  var ComponentList = ({
32209
32374
  children,
@@ -32212,9 +32377,9 @@ var ComponentList = ({
32212
32377
  }) => {
32213
32378
  const { config, state, setUi } = useAppContext();
32214
32379
  const { expanded = true } = state.ui.componentList[id] || {};
32215
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32216
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
32217
- "div",
32380
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32381
+ title && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
32382
+ "button",
32218
32383
  {
32219
32384
  className: getClassName20("title"),
32220
32385
  onClick: () => setUi({
@@ -32226,15 +32391,17 @@ var ComponentList = ({
32226
32391
  }),
32227
32392
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
32228
32393
  children: [
32229
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: title }),
32230
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronDown, { size: 12 }) })
32394
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: title }),
32395
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChevronDown, { size: 12 }) })
32231
32396
  ]
32232
32397
  }
32233
32398
  ),
32234
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32235
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32399
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32400
+ var _a;
32401
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32236
32402
  ComponentListItem,
32237
32403
  {
32404
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
32238
32405
  name: componentKey,
32239
32406
  index: i
32240
32407
  },
@@ -32246,7 +32413,7 @@ var ComponentList = ({
32246
32413
  ComponentList.Item = ComponentListItem;
32247
32414
 
32248
32415
  // lib/use-component-list.tsx
32249
- var import_jsx_runtime24 = require("react/jsx-runtime");
32416
+ var import_jsx_runtime25 = require("react/jsx-runtime");
32250
32417
  var useComponentList = (config, ui) => {
32251
32418
  const [componentList, setComponentList] = (0, import_react20.useState)();
32252
32419
  (0, import_react20.useEffect)(() => {
@@ -32259,16 +32426,18 @@ var useComponentList = (config, ui) => {
32259
32426
  if (category.visible === false || !category.components) {
32260
32427
  return null;
32261
32428
  }
32262
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32429
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32263
32430
  ComponentList,
32264
32431
  {
32265
32432
  id: categoryKey,
32266
32433
  title: category.title || categoryKey,
32267
32434
  children: category.components.map((componentName, i) => {
32435
+ var _a2;
32268
32436
  matchedComponents.push(componentName);
32269
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32437
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32270
32438
  ComponentList.Item,
32271
32439
  {
32440
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32272
32441
  name: componentName,
32273
32442
  index: i
32274
32443
  },
@@ -32285,16 +32454,18 @@ var useComponentList = (config, ui) => {
32285
32454
  );
32286
32455
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
32287
32456
  _componentList.push(
32288
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32457
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32289
32458
  ComponentList,
32290
32459
  {
32291
32460
  id: "other",
32292
32461
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
32293
32462
  children: remainingComponents.map((componentName, i) => {
32294
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32463
+ var _a2;
32464
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32295
32465
  ComponentList.Item,
32296
32466
  {
32297
32467
  name: componentName,
32468
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32298
32469
  index: i
32299
32470
  },
32300
32471
  componentName
@@ -32307,24 +32478,32 @@ var useComponentList = (config, ui) => {
32307
32478
  }
32308
32479
  setComponentList(_componentList);
32309
32480
  }
32310
- }, [config.categories, ui.componentList]);
32481
+ }, [config.categories, config.components, ui.componentList]);
32311
32482
  return componentList;
32312
32483
  };
32313
32484
 
32314
32485
  // components/Puck/components/Components/index.tsx
32315
32486
  var import_react21 = require("react");
32316
- var import_jsx_runtime25 = require("react/jsx-runtime");
32487
+ var import_jsx_runtime26 = require("react/jsx-runtime");
32317
32488
  var Components = () => {
32318
32489
  const { config, state, overrides } = useAppContext();
32319
32490
  const componentList = useComponentList(config, state.ui);
32320
32491
  const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32321
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentList, { id: "all" }) });
32492
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComponentList, { id: "all" }) });
32322
32493
  };
32323
32494
 
32324
32495
  // components/Puck/components/Preview/index.tsx
32325
32496
  init_react_import();
32326
32497
  var import_react22 = require("react");
32327
- var import_jsx_runtime26 = require("react/jsx-runtime");
32498
+ var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32499
+
32500
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
32501
+ init_react_import();
32502
+ var styles_module_default16 = { "PuckPreview": "_PuckPreview_29rm6_1", "PuckPreview-iframe": "_PuckPreview-iframe_29rm6_5" };
32503
+
32504
+ // components/Puck/components/Preview/index.tsx
32505
+ var import_jsx_runtime27 = require("react/jsx-runtime");
32506
+ var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
32328
32507
  var Preview = ({ id = "puck-preview" }) => {
32329
32508
  const { config, dispatch, state } = useAppContext();
32330
32509
  const Page = (0, import_react22.useCallback)(
@@ -32335,16 +32514,25 @@ var Preview = ({ id = "puck-preview" }) => {
32335
32514
  [config.root]
32336
32515
  );
32337
32516
  const rootProps = state.data.root.props || state.data.root;
32338
- const { disableZoom = false } = (0, import_react22.useContext)(dropZoneContext) || {};
32339
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32517
+ const ref = (0, import_react22.useRef)(null);
32518
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32340
32519
  "div",
32341
32520
  {
32521
+ className: getClassName21(),
32342
32522
  id,
32343
32523
  onClick: () => {
32344
32524
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32345
32525
  },
32346
- style: { zoom: disableZoom ? 1 : 0.75 },
32347
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZone, { zone: rootDroppableId }) }))
32526
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32527
+ import_auto_frame_component.default,
32528
+ {
32529
+ id: "preview-iframe",
32530
+ className: getClassName21("iframe"),
32531
+ "data-rfd-iframe": true,
32532
+ ref,
32533
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropZone, { zone: rootDroppableId }) }))
32534
+ }
32535
+ )
32348
32536
  }
32349
32537
  );
32350
32538
  };
@@ -32378,7 +32566,7 @@ init_react_import();
32378
32566
 
32379
32567
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
32380
32568
  init_react_import();
32381
- var styles_module_default16 = { "LayerTree": "_LayerTree_o89yt_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_o89yt_11", "LayerTree-helper": "_LayerTree-helper_o89yt_17", "Layer": "_Layer_o89yt_1", "Layer-inner": "_Layer-inner_o89yt_29", "Layer--containsZone": "_Layer--containsZone_o89yt_35", "Layer-clickable": "_Layer-clickable_o89yt_39", "Layer--isSelected": "_Layer--isSelected_o89yt_48", "Layer--isHovering": "_Layer--isHovering_o89yt_49", "Layer-chevron": "_Layer-chevron_o89yt_65", "Layer--childIsSelected": "_Layer--childIsSelected_o89yt_66", "Layer-zones": "_Layer-zones_o89yt_70", "Layer-title": "_Layer-title_o89yt_84", "Layer-name": "_Layer-name_o89yt_93", "Layer-icon": "_Layer-icon_o89yt_99", "Layer-zoneIcon": "_Layer-zoneIcon_o89yt_104" };
32569
+ var styles_module_default17 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
32382
32570
 
32383
32571
  // lib/scroll-into-view.ts
32384
32572
  init_react_import();
@@ -32406,11 +32594,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32406
32594
  };
32407
32595
 
32408
32596
  // components/LayerTree/index.tsx
32409
- var import_jsx_runtime27 = require("react/jsx-runtime");
32410
- var getClassName21 = get_class_name_factory_default("LayerTree", styles_module_default16);
32411
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
32597
+ var import_jsx_runtime28 = require("react/jsx-runtime");
32598
+ var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
32599
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
32412
32600
  var LayerTree = ({
32413
32601
  data,
32602
+ config,
32414
32603
  zoneContent,
32415
32604
  itemSelector,
32416
32605
  setItemSelector,
@@ -32419,15 +32608,16 @@ var LayerTree = ({
32419
32608
  }) => {
32420
32609
  const zones = data.zones || {};
32421
32610
  const ctx = (0, import_react23.useContext)(dropZoneContext);
32422
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
32423
- label && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName21("zoneTitle"), children: [
32424
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Layers, { size: "16" }) }),
32611
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
32612
+ label && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32613
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Layers, { size: "16" }) }),
32425
32614
  " ",
32426
32615
  label
32427
32616
  ] }),
32428
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
32429
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
32617
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("ul", { className: getClassName22(), children: [
32618
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32430
32619
  zoneContent.map((item, i) => {
32620
+ var _a;
32431
32621
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
32432
32622
  const zonesForItem = findZonesForArea(data, item.props.id);
32433
32623
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -32441,7 +32631,7 @@ var LayerTree = ({
32441
32631
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32442
32632
  const isHovering = hoveringComponent === item.props.id;
32443
32633
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32444
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32634
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
32445
32635
  "li",
32446
32636
  {
32447
32637
  className: getClassNameLayer({
@@ -32451,8 +32641,8 @@ var LayerTree = ({
32451
32641
  childIsSelected
32452
32642
  }),
32453
32643
  children: [
32454
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32455
- "div",
32644
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
32645
+ "button",
32456
32646
  {
32457
32647
  className: getClassNameLayer("clickable"),
32458
32648
  onClick: () => {
@@ -32465,8 +32655,14 @@ var LayerTree = ({
32465
32655
  zone
32466
32656
  });
32467
32657
  const id = zoneContent[i].props.id;
32658
+ const iframe = document.querySelector("#preview-iframe");
32659
+ if (!(iframe == null ? void 0 : iframe.contentDocument)) {
32660
+ throw new Error(
32661
+ `Preview iframe could not be found when trying to scroll to item ${id}`
32662
+ );
32663
+ }
32468
32664
  scrollIntoView(
32469
- document.querySelector(
32665
+ iframe.contentDocument.querySelector(
32470
32666
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
32471
32667
  )
32472
32668
  );
@@ -32482,24 +32678,25 @@ var LayerTree = ({
32482
32678
  setHoveringComponent(null);
32483
32679
  },
32484
32680
  children: [
32485
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32681
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32486
32682
  "div",
32487
32683
  {
32488
32684
  className: getClassNameLayer("chevron"),
32489
32685
  title: isSelected ? "Collapse" : "Expand",
32490
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: "12" })
32686
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronDown, { size: "12" })
32491
32687
  }
32492
32688
  ),
32493
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
32494
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LayoutGrid, { size: "16" }) }),
32495
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
32689
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getClassNameLayer("title"), children: [
32690
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LayoutGrid, { size: "16" }) }),
32691
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32496
32692
  ] })
32497
32693
  ]
32498
32694
  }
32499
32695
  ) }),
32500
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32696
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32501
32697
  LayerTree,
32502
32698
  {
32699
+ config,
32503
32700
  data,
32504
32701
  zoneContent: zones[zoneKey],
32505
32702
  setItemSelector,
@@ -32519,9 +32716,9 @@ var LayerTree = ({
32519
32716
 
32520
32717
  // components/Puck/components/Outline/index.tsx
32521
32718
  var import_react24 = require("react");
32522
- var import_jsx_runtime28 = require("react/jsx-runtime");
32719
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32523
32720
  var Outline = () => {
32524
- const { dispatch, state, overrides } = useAppContext();
32721
+ const { dispatch, state, overrides, config } = useAppContext();
32525
32722
  const { data, ui } = state;
32526
32723
  const { itemSelector } = ui;
32527
32724
  const setItemSelector = (0, import_react24.useCallback)(
@@ -32534,10 +32731,11 @@ var Outline = () => {
32534
32731
  []
32535
32732
  );
32536
32733
  const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32537
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
32538
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32734
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32735
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32539
32736
  LayerTree,
32540
32737
  {
32738
+ config,
32541
32739
  data,
32542
32740
  label: areaContainsZones(data, "root") ? rootDroppableId : "",
32543
32741
  zoneContent: data.content,
@@ -32547,9 +32745,10 @@ var Outline = () => {
32547
32745
  ),
32548
32746
  Object.entries(findZonesForArea(data, "root")).map(
32549
32747
  ([zoneKey, zone]) => {
32550
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32748
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32551
32749
  LayerTree,
32552
32750
  {
32751
+ config,
32553
32752
  data,
32554
32753
  label: zoneKey,
32555
32754
  zone: zoneKey,
@@ -32570,7 +32769,7 @@ var loadOverrides = ({
32570
32769
  overrides,
32571
32770
  plugins
32572
32771
  }) => {
32573
- const collected = overrides;
32772
+ const collected = __spreadValues({}, overrides);
32574
32773
  plugins.forEach((plugin) => {
32575
32774
  Object.keys(plugin.overrides).forEach((overridesType) => {
32576
32775
  if (overridesType === "fieldTypes") {
@@ -32673,14 +32872,421 @@ function useHistoryStore() {
32673
32872
  };
32674
32873
  }
32675
32874
 
32875
+ // components/Puck/components/Canvas/index.tsx
32876
+ init_react_import();
32877
+
32878
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32879
+ init_react_import();
32880
+
32881
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
32882
+ init_react_import();
32883
+ var isProduction = process.env.NODE_ENV === "production";
32884
+ var prefix = "Invariant failed";
32885
+ function invariant(condition, message) {
32886
+ if (condition) {
32887
+ return;
32888
+ }
32889
+ if (isProduction) {
32890
+ throw new Error(prefix);
32891
+ }
32892
+ var provided = typeof message === "function" ? message() : message;
32893
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
32894
+ throw new Error(value);
32895
+ }
32896
+
32897
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32898
+ var getRect = function getRect2(_ref) {
32899
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
32900
+ var width = right - left;
32901
+ var height = bottom - top;
32902
+ var rect = {
32903
+ top,
32904
+ right,
32905
+ bottom,
32906
+ left,
32907
+ width,
32908
+ height,
32909
+ x: left,
32910
+ y: top,
32911
+ center: {
32912
+ x: (right + left) / 2,
32913
+ y: (bottom + top) / 2
32914
+ }
32915
+ };
32916
+ return rect;
32917
+ };
32918
+ var expand = function expand2(target, expandBy) {
32919
+ return {
32920
+ top: target.top - expandBy.top,
32921
+ left: target.left - expandBy.left,
32922
+ bottom: target.bottom + expandBy.bottom,
32923
+ right: target.right + expandBy.right
32924
+ };
32925
+ };
32926
+ var shrink = function shrink2(target, shrinkBy) {
32927
+ return {
32928
+ top: target.top + shrinkBy.top,
32929
+ left: target.left + shrinkBy.left,
32930
+ bottom: target.bottom - shrinkBy.bottom,
32931
+ right: target.right - shrinkBy.right
32932
+ };
32933
+ };
32934
+ var noSpacing = {
32935
+ top: 0,
32936
+ right: 0,
32937
+ bottom: 0,
32938
+ left: 0
32939
+ };
32940
+ var createBox = function createBox2(_ref2) {
32941
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
32942
+ var marginBox = getRect(expand(borderBox, margin));
32943
+ var paddingBox = getRect(shrink(borderBox, border));
32944
+ var contentBox = getRect(shrink(paddingBox, padding));
32945
+ return {
32946
+ marginBox,
32947
+ borderBox: getRect(borderBox),
32948
+ paddingBox,
32949
+ contentBox,
32950
+ margin,
32951
+ border,
32952
+ padding
32953
+ };
32954
+ };
32955
+ var parse = function parse2(raw) {
32956
+ var value = raw.slice(0, -2);
32957
+ var suffix = raw.slice(-2);
32958
+ if (suffix !== "px") {
32959
+ return 0;
32960
+ }
32961
+ var result = Number(value);
32962
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
32963
+ return result;
32964
+ };
32965
+ var calculateBox = function calculateBox2(borderBox, styles) {
32966
+ var margin = {
32967
+ top: parse(styles.marginTop),
32968
+ right: parse(styles.marginRight),
32969
+ bottom: parse(styles.marginBottom),
32970
+ left: parse(styles.marginLeft)
32971
+ };
32972
+ var padding = {
32973
+ top: parse(styles.paddingTop),
32974
+ right: parse(styles.paddingRight),
32975
+ bottom: parse(styles.paddingBottom),
32976
+ left: parse(styles.paddingLeft)
32977
+ };
32978
+ var border = {
32979
+ top: parse(styles.borderTopWidth),
32980
+ right: parse(styles.borderRightWidth),
32981
+ bottom: parse(styles.borderBottomWidth),
32982
+ left: parse(styles.borderLeftWidth)
32983
+ };
32984
+ return createBox({
32985
+ borderBox,
32986
+ margin,
32987
+ padding,
32988
+ border
32989
+ });
32990
+ };
32991
+ var getBox = function getBox2(el) {
32992
+ var borderBox = el.getBoundingClientRect();
32993
+ var styles = window.getComputedStyle(el);
32994
+ return calculateBox(borderBox, styles);
32995
+ };
32996
+
32997
+ // components/Puck/components/Canvas/index.tsx
32998
+ var import_react27 = require("react");
32999
+
33000
+ // components/ViewportControls/index.tsx
33001
+ init_react_import();
33002
+ var import_react26 = require("react");
33003
+
33004
+ // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
33005
+ init_react_import();
33006
+ 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" };
33007
+
33008
+ // components/ViewportControls/index.tsx
33009
+ var import_jsx_runtime30 = require("react/jsx-runtime");
33010
+ var icons = {
33011
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Smartphone, { size: 16 }),
33012
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Tablet, { size: 16 }),
33013
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Monitor, { size: 16 })
33014
+ };
33015
+ var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
33016
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
33017
+ var ViewportButton = ({
33018
+ children,
33019
+ height = "auto",
33020
+ title,
33021
+ width,
33022
+ onClick
33023
+ }) => {
33024
+ const { state } = useAppContext();
33025
+ const isActive = width === state.ui.viewports.current.width;
33026
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33027
+ IconButton,
33028
+ {
33029
+ title,
33030
+ disabled: isActive,
33031
+ onClick: (e) => {
33032
+ e.stopPropagation();
33033
+ onClick({ width, height });
33034
+ },
33035
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: getClassNameButton("inner"), children })
33036
+ }
33037
+ ) });
33038
+ };
33039
+ var defaultZoomOptions = [
33040
+ { label: "25%", value: 0.25 },
33041
+ { label: "50%", value: 0.5 },
33042
+ { label: "75%", value: 0.75 },
33043
+ { label: "100%", value: 1 },
33044
+ { label: "125%", value: 1.25 },
33045
+ { label: "150%", value: 1.5 },
33046
+ { label: "200%", value: 2 }
33047
+ ];
33048
+ var ViewportControls = ({
33049
+ autoZoom,
33050
+ zoom,
33051
+ onViewportChange,
33052
+ onZoom
33053
+ }) => {
33054
+ const { state, viewports } = useAppContext();
33055
+ const viewport = state.ui.viewports.current;
33056
+ const defaultsContainAutoZoom = defaultZoomOptions.find(
33057
+ (option) => option.value === autoZoom
33058
+ );
33059
+ const zoomOptions = (0, import_react26.useMemo)(
33060
+ () => [
33061
+ ...defaultZoomOptions,
33062
+ ...defaultsContainAutoZoom ? [] : [
33063
+ {
33064
+ value: autoZoom,
33065
+ label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
33066
+ }
33067
+ ]
33068
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33069
+ [autoZoom]
33070
+ );
33071
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName23(), children: [
33072
+ viewports.map((viewport2, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33073
+ ViewportButton,
33074
+ {
33075
+ height: viewport2.height,
33076
+ width: viewport2.width,
33077
+ title: viewport2.label ? `Switch to ${viewport2.label} viewport` : "Switch viewport",
33078
+ onClick: onViewportChange,
33079
+ children: typeof viewport2.icon === "string" ? icons[viewport2.icon] || viewport2.icon : viewport2.icon || icons.Smartphone
33080
+ },
33081
+ i
33082
+ )),
33083
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName23("divider") }),
33084
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33085
+ IconButton,
33086
+ {
33087
+ title: "Zoom viewport out",
33088
+ disabled: zoom <= zoomOptions[0].value,
33089
+ onClick: (e) => {
33090
+ e.stopPropagation();
33091
+ onZoom(
33092
+ zoomOptions[Math.max(
33093
+ zoomOptions.findIndex((option) => option.value === zoom) - 1,
33094
+ 0
33095
+ )].value
33096
+ );
33097
+ },
33098
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ZoomOut, { size: 16 })
33099
+ }
33100
+ ),
33101
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33102
+ IconButton,
33103
+ {
33104
+ title: "Zoom viewport in",
33105
+ disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
33106
+ onClick: (e) => {
33107
+ e.stopPropagation();
33108
+ onZoom(
33109
+ zoomOptions[Math.min(
33110
+ zoomOptions.findIndex((option) => option.value === zoom) + 1,
33111
+ zoomOptions.length - 1
33112
+ )].value
33113
+ );
33114
+ },
33115
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ZoomIn, { size: 16 })
33116
+ }
33117
+ ),
33118
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName23("divider") }),
33119
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33120
+ "select",
33121
+ {
33122
+ className: getClassName23("zoomSelect"),
33123
+ value: zoom.toString(),
33124
+ onChange: (e) => {
33125
+ onZoom(parseFloat(e.currentTarget.value));
33126
+ },
33127
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33128
+ "option",
33129
+ {
33130
+ value: option.value,
33131
+ label: option.label
33132
+ },
33133
+ option.label
33134
+ ))
33135
+ }
33136
+ )
33137
+ ] });
33138
+ };
33139
+
33140
+ // lib/get-zoom-config.ts
33141
+ init_react_import();
33142
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
33143
+ var getZoomConfig = (uiViewport, frame, zoom) => {
33144
+ const box = getBox(frame);
33145
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
33146
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
33147
+ let rootHeight = 0;
33148
+ let autoZoom = 1;
33149
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
33150
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
33151
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
33152
+ zoom = widthZoom;
33153
+ if (widthZoom < heightZoom) {
33154
+ rootHeight = viewportHeight / zoom;
33155
+ } else {
33156
+ rootHeight = viewportHeight;
33157
+ zoom = heightZoom;
33158
+ }
33159
+ autoZoom = zoom;
33160
+ } else {
33161
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
33162
+ autoZoom = 1;
33163
+ zoom = 1;
33164
+ rootHeight = viewportHeight;
33165
+ }
33166
+ }
33167
+ return { autoZoom, rootHeight, zoom };
33168
+ };
33169
+
33170
+ // components/Puck/components/Canvas/index.tsx
33171
+ var import_jsx_runtime31 = require("react/jsx-runtime");
33172
+ var getClassName24 = get_class_name_factory_default("Puck", styles_module_default8);
33173
+ var ZOOM_ON_CHANGE = true;
33174
+ var Canvas = () => {
33175
+ const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33176
+ const { ui } = state;
33177
+ const frameRef = (0, import_react27.useRef)(null);
33178
+ const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
33179
+ const defaultRender = (0, import_react27.useMemo)(() => {
33180
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
33181
+ return PuckDefault;
33182
+ }, []);
33183
+ const CustomPreview = (0, import_react27.useMemo)(
33184
+ () => overrides.preview || defaultRender,
33185
+ [overrides]
33186
+ );
33187
+ const getFrameDimensions = (0, import_react27.useCallback)(() => {
33188
+ if (frameRef.current) {
33189
+ const frame = frameRef.current;
33190
+ const box = getBox(frame);
33191
+ return { width: box.contentBox.width, height: box.contentBox.height };
33192
+ }
33193
+ return { width: 0, height: 0 };
33194
+ }, [frameRef]);
33195
+ const resetAutoZoom = (0, import_react27.useCallback)(
33196
+ (ui2 = state.ui) => {
33197
+ if (frameRef.current) {
33198
+ setZoomConfig(
33199
+ getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
33200
+ );
33201
+ }
33202
+ },
33203
+ [frameRef, zoomConfig, state.ui]
33204
+ );
33205
+ (0, import_react27.useEffect)(() => {
33206
+ setShowTransition(false);
33207
+ resetAutoZoom();
33208
+ }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33209
+ (0, import_react27.useEffect)(() => {
33210
+ const { height: frameHeight } = getFrameDimensions();
33211
+ if (ui.viewports.current.height === "auto") {
33212
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
33213
+ rootHeight: frameHeight / zoomConfig.zoom
33214
+ }));
33215
+ }
33216
+ }, [zoomConfig.zoom]);
33217
+ (0, import_react27.useEffect)(() => {
33218
+ const observer = new ResizeObserver(() => {
33219
+ setShowTransition(false);
33220
+ resetAutoZoom();
33221
+ });
33222
+ if (document.body) {
33223
+ observer.observe(document.body);
33224
+ }
33225
+ return () => {
33226
+ observer.disconnect();
33227
+ };
33228
+ }, []);
33229
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
33230
+ "div",
33231
+ {
33232
+ className: getClassName24("canvas"),
33233
+ onClick: () => dispatch({
33234
+ type: "setUi",
33235
+ ui: { itemSelector: null },
33236
+ recordHistory: true
33237
+ }),
33238
+ children: [
33239
+ ui.viewports.controlsVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName24("canvasControls"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
33240
+ ViewportControls,
33241
+ {
33242
+ autoZoom: zoomConfig.autoZoom,
33243
+ zoom: zoomConfig.zoom,
33244
+ onViewportChange: (viewport) => {
33245
+ setShowTransition(true);
33246
+ const uiViewport = __spreadProps(__spreadValues({}, viewport), {
33247
+ height: viewport.height || "auto",
33248
+ zoom: zoomConfig.zoom
33249
+ });
33250
+ const newUi = __spreadProps(__spreadValues({}, ui), {
33251
+ viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
33252
+ });
33253
+ setUi(newUi);
33254
+ if (ZOOM_ON_CHANGE) {
33255
+ resetAutoZoom(newUi);
33256
+ }
33257
+ },
33258
+ onZoom: (zoom) => {
33259
+ setShowTransition(true);
33260
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
33261
+ }
33262
+ }
33263
+ ) }),
33264
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName24("frame"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
33265
+ "div",
33266
+ {
33267
+ className: getClassName24("root"),
33268
+ style: {
33269
+ width: ui.viewports.current.width,
33270
+ height: zoomConfig.rootHeight,
33271
+ transform: `scale(${zoomConfig.zoom})`,
33272
+ transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : ""
33273
+ },
33274
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Preview, {}) })
33275
+ }
33276
+ ) })
33277
+ ]
33278
+ }
33279
+ );
33280
+ };
33281
+
32676
33282
  // components/Puck/index.tsx
32677
- var import_jsx_runtime29 = require("react/jsx-runtime");
32678
- var getClassName22 = get_class_name_factory_default("Puck", styles_module_default8);
33283
+ var import_jsx_runtime32 = require("react/jsx-runtime");
33284
+ var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
32679
33285
  function Puck({
32680
33286
  children,
32681
33287
  config,
32682
33288
  data: initialData = { content: [], root: { props: { title: "" } } },
32683
- ui: initialUi = defaultAppState.ui,
33289
+ ui: initialUi,
32684
33290
  onChange,
32685
33291
  onPublish,
32686
33292
  plugins = [],
@@ -32688,32 +33294,58 @@ function Puck({
32688
33294
  renderHeader,
32689
33295
  renderHeaderActions,
32690
33296
  headerTitle,
32691
- headerPath
33297
+ headerPath,
33298
+ viewports = defaultViewports
32692
33299
  }) {
33300
+ var _a;
32693
33301
  const historyStore = useHistoryStore();
32694
- const [reducer] = (0, import_react26.useState)(
33302
+ const [reducer] = (0, import_react28.useState)(
32695
33303
  () => createReducer({ config, record: historyStore.record })
32696
33304
  );
32697
- const [initialAppState] = (0, import_react26.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
32698
- data: initialData,
32699
- ui: __spreadProps(__spreadValues(__spreadValues({}, defaultAppState.ui), initialUi), {
32700
- // Store categories under componentList on state to allow render functions and plugins to modify
32701
- componentList: config.categories ? Object.entries(config.categories).reduce(
32702
- (acc, [categoryName, category]) => {
32703
- return __spreadProps(__spreadValues({}, acc), {
32704
- [categoryName]: {
32705
- title: category.title,
32706
- components: category.components,
32707
- expanded: category.defaultExpanded,
32708
- visible: category.visible
32709
- }
32710
- });
32711
- },
32712
- {}
32713
- ) : {}
32714
- })
32715
- }));
32716
- const [appState, dispatch] = (0, import_react26.useReducer)(
33305
+ const [initialAppState] = (0, import_react28.useState)(() => {
33306
+ var _a2, _b, _c, _d;
33307
+ const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33308
+ let clientUiState = {};
33309
+ if (typeof window !== "undefined") {
33310
+ const viewportWidth = window.innerWidth;
33311
+ const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33312
+ key,
33313
+ diff: Math.abs(viewportWidth - value.width)
33314
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33315
+ const closestViewport = viewportDifferences[0].key;
33316
+ clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
33317
+ leftSideBarVisible: false,
33318
+ rightSideBarVisible: false
33319
+ }), {
33320
+ viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33321
+ current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33322
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33323
+ width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33324
+ })
33325
+ })
33326
+ });
33327
+ }
33328
+ return __spreadProps(__spreadValues({}, defaultAppState), {
33329
+ data: initialData,
33330
+ ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33331
+ // Store categories under componentList on state to allow render functions and plugins to modify
33332
+ componentList: config.categories ? Object.entries(config.categories).reduce(
33333
+ (acc, [categoryName, category]) => {
33334
+ return __spreadProps(__spreadValues({}, acc), {
33335
+ [categoryName]: {
33336
+ title: category.title,
33337
+ components: category.components,
33338
+ expanded: category.defaultExpanded,
33339
+ visible: category.visible
33340
+ }
33341
+ });
33342
+ },
33343
+ {}
33344
+ ) : {}
33345
+ })
33346
+ });
33347
+ });
33348
+ const [appState, dispatch] = (0, import_react28.useReducer)(
32717
33349
  reducer,
32718
33350
  flushZones(initialAppState)
32719
33351
  );
@@ -32724,9 +33356,9 @@ function Puck({
32724
33356
  config,
32725
33357
  dispatch
32726
33358
  );
32727
- const [menuOpen, setMenuOpen] = (0, import_react26.useState)(false);
33359
+ const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
32728
33360
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
32729
- const setItemSelector = (0, import_react26.useCallback)(
33361
+ const setItemSelector = (0, import_react28.useCallback)(
32730
33362
  (newItemSelector) => {
32731
33363
  if (newItemSelector === itemSelector)
32732
33364
  return;
@@ -32739,21 +33371,21 @@ function Puck({
32739
33371
  [itemSelector]
32740
33372
  );
32741
33373
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
32742
- (0, import_react26.useEffect)(() => {
33374
+ (0, import_react28.useEffect)(() => {
32743
33375
  if (onChange)
32744
33376
  onChange(data);
32745
33377
  }, [data]);
32746
33378
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
32747
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
33379
+ const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
32748
33380
  const rootProps = data.root.props || data.root;
32749
- (0, import_react26.useEffect)(() => {
33381
+ (0, import_react28.useEffect)(() => {
32750
33382
  if (Object.keys(data.root).length > 0 && !data.root.props) {
32751
33383
  console.error(
32752
33384
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
32753
33385
  );
32754
33386
  }
32755
33387
  }, []);
32756
- const toggleSidebars = (0, import_react26.useCallback)(
33388
+ const toggleSidebars = (0, import_react28.useCallback)(
32757
33389
  (sidebar) => {
32758
33390
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
32759
33391
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -32767,7 +33399,7 @@ function Puck({
32767
33399
  },
32768
33400
  [dispatch, leftSideBarVisible, rightSideBarVisible]
32769
33401
  );
32770
- (0, import_react26.useEffect)(() => {
33402
+ (0, import_react28.useEffect)(() => {
32771
33403
  if (!window.matchMedia("(min-width: 638px)").matches) {
32772
33404
  dispatch({
32773
33405
  type: "setUi",
@@ -32790,59 +33422,54 @@ function Puck({
32790
33422
  window.removeEventListener("resize", handleResize);
32791
33423
  };
32792
33424
  }, []);
32793
- const defaultRender = (0, import_react26.useMemo)(() => {
32794
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: children2 });
33425
+ const defaultRender = (0, import_react28.useMemo)(() => {
33426
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: children2 });
32795
33427
  return PuckDefault;
32796
33428
  }, []);
32797
- const defaultHeaderRender = (0, import_react26.useMemo)(() => {
33429
+ const defaultHeaderRender = (0, import_react28.useMemo)(() => {
32798
33430
  if (renderHeader) {
32799
33431
  console.warn(
32800
33432
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
32801
33433
  );
32802
- const RenderHeader = (_a) => {
32803
- var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
33434
+ const RenderHeader = (_a2) => {
33435
+ var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
32804
33436
  const Comp = renderHeader;
32805
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33437
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
32806
33438
  };
32807
33439
  return RenderHeader;
32808
33440
  }
32809
33441
  return defaultRender;
32810
33442
  }, [renderHeader]);
32811
- const defaultHeaderActionsRender = (0, import_react26.useMemo)(() => {
33443
+ const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
32812
33444
  if (renderHeaderActions) {
32813
33445
  console.warn(
32814
33446
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
32815
33447
  );
32816
33448
  const RenderHeader = (props) => {
32817
33449
  const Comp = renderHeaderActions;
32818
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33450
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
32819
33451
  };
32820
33452
  return RenderHeader;
32821
33453
  }
32822
33454
  return defaultRender;
32823
33455
  }, [renderHeader]);
32824
- const loadedOverrides = (0, import_react26.useMemo)(() => {
33456
+ const loadedOverrides = (0, import_react28.useMemo)(() => {
32825
33457
  return loadOverrides({ overrides, plugins });
32826
33458
  }, [plugins]);
32827
- const CustomPuck = (0, import_react26.useMemo)(
33459
+ const CustomPuck = (0, import_react28.useMemo)(
32828
33460
  () => loadedOverrides.puck || defaultRender,
32829
33461
  [loadedOverrides]
32830
33462
  );
32831
- const CustomPreview = (0, import_react26.useMemo)(
32832
- () => loadedOverrides.preview || defaultRender,
32833
- [loadedOverrides]
32834
- );
32835
- const CustomHeader = (0, import_react26.useMemo)(
33463
+ const CustomHeader = (0, import_react28.useMemo)(
32836
33464
  () => loadedOverrides.header || defaultHeaderRender,
32837
33465
  [loadedOverrides]
32838
33466
  );
32839
- const CustomHeaderActions = (0, import_react26.useMemo)(
33467
+ const CustomHeaderActions = (0, import_react28.useMemo)(
32840
33468
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
32841
33469
  [loadedOverrides]
32842
33470
  );
32843
- const disableZoom = children || loadedOverrides.puck ? true : false;
32844
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "Puck", children: [
32845
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33471
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "Puck", children: [
33472
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32846
33473
  AppProvider,
32847
33474
  {
32848
33475
  value: {
@@ -32853,9 +33480,10 @@ function Puck({
32853
33480
  resolveData,
32854
33481
  plugins,
32855
33482
  overrides: loadedOverrides,
32856
- history
33483
+ history,
33484
+ viewports
32857
33485
  },
32858
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33486
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32859
33487
  import_dnd7.DragDropContext,
32860
33488
  {
32861
33489
  onDragUpdate: (update) => {
@@ -32910,7 +33538,7 @@ function Puck({
32910
33538
  });
32911
33539
  }
32912
33540
  },
32913
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33541
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32914
33542
  DropZoneProvider,
32915
33543
  {
32916
33544
  value: {
@@ -32922,77 +33550,75 @@ function Puck({
32922
33550
  draggedItem,
32923
33551
  placeholderStyle,
32924
33552
  mode: "edit",
32925
- areaId: "root",
32926
- disableZoom
33553
+ areaId: "root"
32927
33554
  },
32928
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33555
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
32929
33556
  "div",
32930
33557
  {
32931
- className: getClassName22({
33558
+ className: getClassName25({
32932
33559
  leftSideBarVisible,
32933
33560
  menuOpen,
32934
- rightSideBarVisible,
32935
- disableZoom
33561
+ rightSideBarVisible
32936
33562
  }),
32937
33563
  children: [
32938
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33564
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32939
33565
  CustomHeader,
32940
33566
  {
32941
- actions: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32942
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
32943
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33567
+ actions: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
33568
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomHeaderActions, {}),
33569
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32944
33570
  Button,
32945
33571
  {
32946
33572
  onClick: () => {
32947
33573
  onPublish && onPublish(data);
32948
33574
  },
32949
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Globe, { size: "14px" }),
33575
+ icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Globe, { size: "14px" }),
32950
33576
  children: "Publish"
32951
33577
  }
32952
33578
  )
32953
33579
  ] }),
32954
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: getClassName22("header"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerInner"), children: [
32955
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerToggle"), children: [
32956
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33580
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("headerInner"), children: [
33581
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33582
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32957
33583
  IconButton,
32958
33584
  {
32959
33585
  onClick: () => {
32960
33586
  toggleSidebars("left");
32961
33587
  },
32962
33588
  title: "Toggle left sidebar",
32963
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
33589
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelLeft, { focusable: "false" })
32964
33590
  }
32965
33591
  ) }),
32966
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33592
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32967
33593
  IconButton,
32968
33594
  {
32969
33595
  onClick: () => {
32970
33596
  toggleSidebars("right");
32971
33597
  },
32972
33598
  title: "Toggle right sidebar",
32973
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
33599
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelRight, { focusable: "false" })
32974
33600
  }
32975
33601
  ) })
32976
33602
  ] }),
32977
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
33603
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Heading, { rank: 2, size: "xs", children: [
32978
33604
  headerTitle || rootProps.title || "Page",
32979
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
33605
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
32980
33606
  " ",
32981
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
33607
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
32982
33608
  ] })
32983
33609
  ] }) }),
32984
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
32985
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33610
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("headerTools"), children: [
33611
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32986
33612
  IconButton,
32987
33613
  {
32988
33614
  onClick: () => {
32989
33615
  return setMenuOpen(!menuOpen);
32990
33616
  },
32991
33617
  title: "Toggle menu bar",
32992
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
33618
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDown, { focusable: "false" })
32993
33619
  }
32994
33620
  ) }),
32995
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33621
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32996
33622
  MenuBar,
32997
33623
  {
32998
33624
  appState,
@@ -33000,7 +33626,7 @@ function Puck({
33000
33626
  dispatch,
33001
33627
  onPublish,
33002
33628
  menuOpen,
33003
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33629
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CustomHeaderActions, {}),
33004
33630
  setMenuOpen
33005
33631
  }
33006
33632
  )
@@ -33008,38 +33634,19 @@ function Puck({
33008
33634
  ] }) })
33009
33635
  }
33010
33636
  ),
33011
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("leftSideBar"), children: [
33012
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
33013
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
33637
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33638
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Components, {}) }),
33639
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Outline, {}) })
33014
33640
  ] }),
33015
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33016
- "div",
33017
- {
33018
- className: getClassName22("frame"),
33019
- onClick: () => setItemSelector(null),
33020
- children: [
33021
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("root"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Preview, {}) }) }),
33022
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33023
- "div",
33024
- {
33025
- style: {
33026
- background: "var(--puck-color-grey-10)",
33027
- height: "100%",
33028
- flexGrow: 1
33029
- }
33030
- }
33031
- )
33032
- ]
33033
- }
33034
- ),
33035
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33641
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Canvas, {}),
33642
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33036
33643
  SidebarSection,
33037
33644
  {
33038
33645
  noPadding: true,
33039
33646
  noBorderTop: true,
33040
33647
  showBreadcrumbs: true,
33041
- title: selectedItem ? selectedItem.type : "Page",
33042
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
33648
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33649
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Fields, {})
33043
33650
  }
33044
33651
  ) })
33045
33652
  ]
@@ -33051,7 +33658,7 @@ function Puck({
33051
33658
  )
33052
33659
  }
33053
33660
  ),
33054
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "puck-portal-root" })
33661
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: "puck-portal-root" })
33055
33662
  ] });
33056
33663
  }
33057
33664
  Puck.Components = Components;
@@ -33061,13 +33668,13 @@ Puck.Preview = Preview;
33061
33668
 
33062
33669
  // components/Render/index.tsx
33063
33670
  init_react_import();
33064
- var import_jsx_runtime30 = require("react/jsx-runtime");
33671
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33065
33672
  function Render({ config, data }) {
33066
33673
  var _a;
33067
33674
  const rootProps = data.root.props || data.root;
33068
33675
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33069
33676
  if ((_a = config.root) == null ? void 0 : _a.render) {
33070
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33677
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33071
33678
  config.root.render,
33072
33679
  __spreadProps(__spreadValues({}, rootProps), {
33073
33680
  puck: {
@@ -33076,11 +33683,11 @@ function Render({ config, data }) {
33076
33683
  title,
33077
33684
  editMode: false,
33078
33685
  id: "puck-root",
33079
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId })
33686
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
33080
33687
  })
33081
33688
  ) });
33082
33689
  }
33083
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) });
33690
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) });
33084
33691
  }
33085
33692
 
33086
33693
  // lib/migrate.ts
@@ -33170,8 +33777,8 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
33170
33777
  // lib/use-puck.ts
33171
33778
  init_react_import();
33172
33779
  var usePuck = () => {
33173
- const { state: appState, config, dispatch } = useAppContext();
33174
- return { appState, config, dispatch };
33780
+ const { state: appState, config, history, dispatch } = useAppContext();
33781
+ return { appState, config, dispatch, history };
33175
33782
  };
33176
33783
  // Annotate the CommonJS export names for ESM import in node:
33177
33784
  0 && (module.exports = {
@@ -33375,6 +33982,14 @@ lucide-react/dist/esm/icons/lock.js:
33375
33982
  * See the LICENSE file in the root directory of this source tree.
33376
33983
  *)
33377
33984
 
33985
+ lucide-react/dist/esm/icons/monitor.js:
33986
+ (**
33987
+ * @license lucide-react v0.298.0 - ISC
33988
+ *
33989
+ * This source code is licensed under the ISC license.
33990
+ * See the LICENSE file in the root directory of this source tree.
33991
+ *)
33992
+
33378
33993
  lucide-react/dist/esm/icons/more-vertical.js:
33379
33994
  (**
33380
33995
  * @license lucide-react v0.298.0 - ISC
@@ -33415,6 +34030,30 @@ lucide-react/dist/esm/icons/search.js:
33415
34030
  * See the LICENSE file in the root directory of this source tree.
33416
34031
  *)
33417
34032
 
34033
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
34034
+ (**
34035
+ * @license lucide-react v0.298.0 - ISC
34036
+ *
34037
+ * This source code is licensed under the ISC license.
34038
+ * See the LICENSE file in the root directory of this source tree.
34039
+ *)
34040
+
34041
+ lucide-react/dist/esm/icons/smartphone.js:
34042
+ (**
34043
+ * @license lucide-react v0.298.0 - ISC
34044
+ *
34045
+ * This source code is licensed under the ISC license.
34046
+ * See the LICENSE file in the root directory of this source tree.
34047
+ *)
34048
+
34049
+ lucide-react/dist/esm/icons/tablet.js:
34050
+ (**
34051
+ * @license lucide-react v0.298.0 - ISC
34052
+ *
34053
+ * This source code is licensed under the ISC license.
34054
+ * See the LICENSE file in the root directory of this source tree.
34055
+ *)
34056
+
33418
34057
  lucide-react/dist/esm/icons/trash.js:
33419
34058
  (**
33420
34059
  * @license lucide-react v0.298.0 - ISC
@@ -33439,6 +34078,22 @@ lucide-react/dist/esm/icons/unlock.js:
33439
34078
  * See the LICENSE file in the root directory of this source tree.
33440
34079
  *)
33441
34080
 
34081
+ lucide-react/dist/esm/icons/zoom-in.js:
34082
+ (**
34083
+ * @license lucide-react v0.298.0 - ISC
34084
+ *
34085
+ * This source code is licensed under the ISC license.
34086
+ * See the LICENSE file in the root directory of this source tree.
34087
+ *)
34088
+
34089
+ lucide-react/dist/esm/icons/zoom-out.js:
34090
+ (**
34091
+ * @license lucide-react v0.298.0 - ISC
34092
+ *
34093
+ * This source code is licensed under the ISC license.
34094
+ * See the LICENSE file in the root directory of this source tree.
34095
+ *)
34096
+
33442
34097
  lucide-react/dist/esm/lucide-react.js:
33443
34098
  (**
33444
34099
  * @license lucide-react v0.298.0 - ISC