@measured/puck 0.13.2-canary.7d861f5 → 0.14.0-canary.03dd90b

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -8084,7 +8084,7 @@ var require_react_dom_development = __commonJS({
8084
8084
  var HostPortal = 4;
8085
8085
  var HostComponent = 5;
8086
8086
  var HostText = 6;
8087
- var Fragment14 = 7;
8087
+ var Fragment16 = 7;
8088
8088
  var Mode = 8;
8089
8089
  var ContextConsumer = 9;
8090
8090
  var ContextProvider = 10;
@@ -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;
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
9240
9240
  return "DehydratedFragment";
9241
9241
  case ForwardRef:
9242
9242
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment14:
9243
+ case Fragment16:
9244
9244
  return "Fragment";
9245
9245
  case HostComponent:
9246
9246
  return type;
@@ -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) {
@@ -18911,7 +18911,7 @@ var require_react_dom_development = __commonJS({
18911
18911
  }
18912
18912
  }
18913
18913
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
18914
- if (current2 === null || current2.tag !== Fragment14) {
18914
+ if (current2 === null || current2.tag !== Fragment16) {
18915
18915
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
18916
18916
  created.return = returnFiber;
18917
18917
  return created;
@@ -19314,7 +19314,7 @@ var require_react_dom_development = __commonJS({
19314
19314
  if (child.key === key) {
19315
19315
  var elementType = element.type;
19316
19316
  if (elementType === REACT_FRAGMENT_TYPE) {
19317
- if (child.tag === Fragment14) {
19317
+ if (child.tag === Fragment16) {
19318
19318
  deleteRemainingChildren(returnFiber, child.sibling);
19319
19319
  var existing = useFiber(child, element.props.children);
19320
19320
  existing.return = returnFiber;
@@ -23489,7 +23489,7 @@ var require_react_dom_development = __commonJS({
23489
23489
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
23490
23490
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
23491
23491
  }
23492
- case Fragment14:
23492
+ case Fragment16:
23493
23493
  return updateFragment(current2, workInProgress2, renderLanes2);
23494
23494
  case Mode:
23495
23495
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23762,7 +23762,7 @@ var require_react_dom_development = __commonJS({
23762
23762
  case SimpleMemoComponent:
23763
23763
  case FunctionComponent:
23764
23764
  case ForwardRef:
23765
- case Fragment14:
23765
+ case Fragment16:
23766
23766
  case Mode:
23767
23767
  case Profiler:
23768
23768
  case ContextConsumer:
@@ -28021,7 +28021,7 @@ var require_react_dom_development = __commonJS({
28021
28021
  return fiber;
28022
28022
  }
28023
28023
  function createFiberFromFragment(elements, mode, lanes, key) {
28024
- var fiber = createFiber(Fragment14, elements, key, mode);
28024
+ var fiber = createFiber(Fragment16, elements, key, mode);
28025
28025
  fiber.lanes = lanes;
28026
28026
  return fiber;
28027
28027
  }
@@ -29173,7 +29173,7 @@ var import_react2 = require("react");
29173
29173
 
29174
29174
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
29175
29175
  init_react_import();
29176
- var Button_module_default = { "Button": "_Button_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,16 +29264,183 @@ var Button = ({
29267
29264
 
29268
29265
  // components/Drawer/index.tsx
29269
29266
  init_react_import();
29270
- var import_dnd2 = require("@hello-pangea/dnd");
29267
+
29268
+ // components/Droppable/index.tsx
29269
+ init_react_import();
29270
+ var import_dnd = require("@measured/dnd");
29271
+
29272
+ // components/Puck/context.tsx
29273
+ init_react_import();
29274
+ var import_react3 = require("react");
29275
+
29276
+ // lib/get-item.ts
29277
+ init_react_import();
29278
+
29279
+ // lib/root-droppable-id.ts
29280
+ init_react_import();
29281
+ var rootDroppableId = "default-zone";
29282
+
29283
+ // lib/setup-zone.ts
29284
+ init_react_import();
29285
+ var setupZone = (data, zoneKey) => {
29286
+ if (zoneKey === rootDroppableId) {
29287
+ return data;
29288
+ }
29289
+ const newData = __spreadValues({}, data);
29290
+ newData.zones = data.zones || {};
29291
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
29292
+ return newData;
29293
+ };
29294
+
29295
+ // lib/get-item.ts
29296
+ var getItem = (selector, data, dynamicProps = {}) => {
29297
+ if (!selector.zone || selector.zone === rootDroppableId) {
29298
+ const item2 = data.content[selector.index];
29299
+ return __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props });
29300
+ }
29301
+ const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
29302
+ return __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props });
29303
+ };
29304
+
29305
+ // components/ViewportControls/default-viewports.ts
29306
+ init_react_import();
29307
+ var defaultViewports = [
29308
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
29309
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
29310
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
29311
+ ];
29312
+
29313
+ // components/Puck/context.tsx
29314
+ var import_jsx_runtime2 = require("react/jsx-runtime");
29315
+ var defaultAppState = {
29316
+ data: { content: [], root: { props: { title: "" } } },
29317
+ ui: {
29318
+ leftSideBarVisible: true,
29319
+ rightSideBarVisible: true,
29320
+ arrayState: {},
29321
+ itemSelector: null,
29322
+ componentList: {},
29323
+ isDragging: false,
29324
+ viewports: {
29325
+ current: {
29326
+ width: defaultViewports[0].width,
29327
+ height: defaultViewports[0].height || "auto"
29328
+ },
29329
+ options: [],
29330
+ controlsVisible: true
29331
+ }
29332
+ }
29333
+ };
29334
+ var defaultContext = {
29335
+ state: defaultAppState,
29336
+ dispatch: () => null,
29337
+ config: { components: {} },
29338
+ componentState: {},
29339
+ resolveData: () => {
29340
+ },
29341
+ plugins: [],
29342
+ overrides: {},
29343
+ history: {},
29344
+ viewports: defaultViewports,
29345
+ zoomConfig: {
29346
+ autoZoom: 1,
29347
+ rootHeight: 0,
29348
+ zoom: 1
29349
+ },
29350
+ setZoomConfig: () => null,
29351
+ status: "LOADING",
29352
+ setStatus: () => null,
29353
+ iframe: {}
29354
+ };
29355
+ var appContext = (0, import_react3.createContext)(defaultContext);
29356
+ var AppProvider = ({
29357
+ children,
29358
+ value
29359
+ }) => {
29360
+ const [zoomConfig, setZoomConfig] = (0, import_react3.useState)(defaultContext.zoomConfig);
29361
+ const [status, setStatus] = (0, import_react3.useState)("LOADING");
29362
+ (0, import_react3.useEffect)(() => {
29363
+ setStatus("MOUNTED");
29364
+ }, []);
29365
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29366
+ appContext.Provider,
29367
+ {
29368
+ value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
29369
+ children
29370
+ }
29371
+ );
29372
+ };
29373
+ function useAppContext() {
29374
+ const mainContext = (0, import_react3.useContext)(appContext);
29375
+ const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
29376
+ return __spreadProps(__spreadValues({}, mainContext), {
29377
+ // Helpers
29378
+ selectedItem,
29379
+ setUi: (ui, recordHistory) => {
29380
+ return mainContext.dispatch({
29381
+ type: "setUi",
29382
+ ui,
29383
+ recordHistory
29384
+ });
29385
+ }
29386
+ });
29387
+ }
29388
+
29389
+ // components/Droppable/index.tsx
29390
+ var import_jsx_runtime3 = require("react/jsx-runtime");
29391
+ var defaultProvided = {
29392
+ droppableProps: {
29393
+ "data-rfd-droppable-context-id": "",
29394
+ "data-rfd-droppable-id": ""
29395
+ },
29396
+ placeholder: null,
29397
+ innerRef: () => null
29398
+ };
29399
+ var defaultSnapshot = {
29400
+ isDraggingOver: false,
29401
+ draggingOverWith: null,
29402
+ draggingFromThisWith: null,
29403
+ isUsingPlaceholder: false
29404
+ };
29405
+ var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: children(defaultProvided, defaultSnapshot) });
29406
+ var Droppable = (props) => {
29407
+ const { status } = useAppContext();
29408
+ const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
29409
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(El, __spreadValues({}, props));
29410
+ };
29271
29411
 
29272
29412
  // css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
29273
29413
  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" };
29414
+ 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
29415
 
29276
29416
  // components/Draggable/index.tsx
29277
29417
  init_react_import();
29278
- var import_dnd = require("@hello-pangea/dnd");
29279
- var import_jsx_runtime2 = require("react/jsx-runtime");
29418
+ var import_dnd2 = require("@measured/dnd");
29419
+ var import_jsx_runtime4 = require("react/jsx-runtime");
29420
+ var defaultProvided2 = {
29421
+ draggableProps: {
29422
+ "data-rfd-draggable-context-id": "",
29423
+ "data-rfd-draggable-id": ""
29424
+ },
29425
+ dragHandleProps: null,
29426
+ innerRef: () => null
29427
+ };
29428
+ var defaultSnapshot2 = {
29429
+ isDragging: false,
29430
+ isDropAnimating: false,
29431
+ isClone: false,
29432
+ dropAnimation: null,
29433
+ draggingOver: null,
29434
+ combineWith: null,
29435
+ combineTargetFor: null,
29436
+ mode: null
29437
+ };
29438
+ var defaultRubric = {
29439
+ draggableId: "",
29440
+ type: "",
29441
+ source: { droppableId: "", index: 0 }
29442
+ };
29443
+ var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
29280
29444
  var Draggable = ({
29281
29445
  className,
29282
29446
  children,
@@ -29286,39 +29450,33 @@ var Draggable = ({
29286
29450
  disableAnimations = false,
29287
29451
  isDragDisabled = false
29288
29452
  }) => {
29289
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29290
- import_dnd.Draggable,
29291
- {
29292
- draggableId: id,
29293
- index,
29294
- isDragDisabled,
29295
- children: (provided, snapshot) => {
29296
- var _a;
29297
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
29298
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29299
- "div",
29300
- __spreadProps(__spreadValues(__spreadValues({
29301
- className: className && className(provided, snapshot),
29302
- ref: provided.innerRef
29303
- }, provided.draggableProps), provided.dragHandleProps), {
29304
- style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29305
- transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29306
- }),
29307
- children: children(provided, snapshot)
29308
- })
29309
- ),
29310
- showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29311
- "div",
29312
- {
29313
- className: className && className(provided, snapshot),
29314
- style: { transform: "none !important" },
29315
- children: children(provided, snapshot)
29316
- }
29317
- )
29318
- ] });
29319
- }
29320
- }
29321
- );
29453
+ const { status } = useAppContext();
29454
+ const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
29455
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
29456
+ var _a;
29457
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
29458
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29459
+ "div",
29460
+ __spreadProps(__spreadValues(__spreadValues({
29461
+ className: className && className(provided, snapshot),
29462
+ ref: provided.innerRef
29463
+ }, provided.draggableProps), provided.dragHandleProps), {
29464
+ style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
29465
+ transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
29466
+ }),
29467
+ children: children(provided, snapshot)
29468
+ })
29469
+ ),
29470
+ showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29471
+ "div",
29472
+ {
29473
+ className: className && className(provided, snapshot),
29474
+ style: { transform: "none !important" },
29475
+ children: children(provided, snapshot)
29476
+ }
29477
+ )
29478
+ ] });
29479
+ } });
29322
29480
  };
29323
29481
 
29324
29482
  // components/DragIcon/index.tsx
@@ -29350,26 +29508,26 @@ var replace = (list, index, newItem) => {
29350
29508
 
29351
29509
  // css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
29352
29510
  init_react_import();
29353
- var styles_module_default2 = { "DragIcon": "_DragIcon_o29on_1" };
29511
+ var styles_module_default2 = { "DragIcon": "_DragIcon_1p5wn_1" };
29354
29512
 
29355
29513
  // components/DragIcon/index.tsx
29356
- var import_jsx_runtime3 = require("react/jsx-runtime");
29514
+ var import_jsx_runtime5 = require("react/jsx-runtime");
29357
29515
  var getClassName2 = get_class_name_factory_default("DragIcon", styles_module_default2);
29358
- var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
29516
+ var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName2(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
29359
29517
 
29360
29518
  // components/Drawer/index.tsx
29361
- var import_react3 = require("react");
29362
- var import_jsx_runtime4 = require("react/jsx-runtime");
29519
+ var import_react4 = require("react");
29520
+ var import_jsx_runtime6 = require("react/jsx-runtime");
29363
29521
  var getClassName3 = get_class_name_factory_default("Drawer", styles_module_default);
29364
29522
  var getClassNameItem = get_class_name_factory_default("DrawerItem", styles_module_default);
29365
- var drawerContext = (0, import_react3.createContext)({
29523
+ var drawerContext = (0, import_react4.createContext)({
29366
29524
  droppableId: ""
29367
29525
  });
29368
29526
  var DrawerDraggable = ({
29369
29527
  children,
29370
29528
  id,
29371
29529
  index
29372
- }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
29530
+ }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
29373
29531
  Draggable,
29374
29532
  {
29375
29533
  id,
@@ -29385,17 +29543,18 @@ var DrawerItem = ({
29385
29543
  name,
29386
29544
  children,
29387
29545
  id,
29546
+ label,
29388
29547
  index
29389
29548
  }) => {
29390
- const ctx = (0, import_react3.useContext)(drawerContext);
29549
+ const ctx = (0, import_react4.useContext)(drawerContext);
29391
29550
  const resolvedId = `${ctx.droppableId}::${id || name}`;
29392
- const CustomInner = (0, import_react3.useMemo)(
29393
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29551
+ const CustomInner = (0, import_react4.useMemo)(
29552
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29394
29553
  [children]
29395
29554
  );
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 }),
29398
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DragIcon, {}) })
29555
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29556
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("name"), children: label != null ? label : name }),
29557
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DragIcon, {}) })
29399
29558
  ] }) }) }) });
29400
29559
  };
29401
29560
  var Drawer = ({
@@ -29403,7 +29562,7 @@ var Drawer = ({
29403
29562
  droppableId = "component-list",
29404
29563
  direction = "vertical"
29405
29564
  }) => {
29406
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_dnd2.Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
29565
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
29407
29566
  "div",
29408
29567
  __spreadProps(__spreadValues({}, provided.droppableProps), {
29409
29568
  ref: provided.innerRef,
@@ -29412,7 +29571,7 @@ var Drawer = ({
29412
29571
  }),
29413
29572
  children: [
29414
29573
  children,
29415
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29574
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
29416
29575
  ]
29417
29576
  })
29418
29577
  ) }) });
@@ -29425,19 +29584,19 @@ var import_react9 = require("react");
29425
29584
 
29426
29585
  // components/DraggableComponent/index.tsx
29427
29586
  init_react_import();
29428
- var import_react6 = require("react");
29429
- var import_dnd3 = require("@hello-pangea/dnd");
29587
+ var import_react7 = require("react");
29588
+ var import_dnd3 = require("@measured/dnd");
29430
29589
 
29431
29590
  // css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
29432
29591
  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" };
29592
+ var styles_module_default3 = { "DraggableComponent": "_DraggableComponent_1542z_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1542z_11", "DraggableComponent-contents": "_DraggableComponent-contents_1542z_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1542z_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1542z_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1542z_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1542z_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1542z_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1542z_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1542z_97", "DraggableComponent-actions": "_DraggableComponent-actions_1542z_97", "DraggableComponent-actionsLabel": "_DraggableComponent-actionsLabel_1542z_127", "DraggableComponent-action": "_DraggableComponent-action_1542z_97" };
29434
29593
 
29435
29594
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
29436
29595
  init_react_import();
29437
29596
 
29438
29597
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29439
29598
  init_react_import();
29440
- var import_react4 = require("react");
29599
+ var import_react5 = require("react");
29441
29600
 
29442
29601
  // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
29443
29602
  init_react_import();
@@ -29456,10 +29615,10 @@ var defaultAttributes = {
29456
29615
  // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
29457
29616
  var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim();
29458
29617
  var createLucideIcon = (iconName, iconNode) => {
29459
- const Component = (0, import_react4.forwardRef)(
29618
+ const Component = (0, import_react5.forwardRef)(
29460
29619
  (_a, ref) => {
29461
29620
  var _b = _a, { color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children } = _b, rest = __objRest(_b, ["color", "size", "strokeWidth", "absoluteStrokeWidth", "className", "children"]);
29462
- return (0, import_react4.createElement)(
29621
+ return (0, import_react5.createElement)(
29463
29622
  "svg",
29464
29623
  __spreadValues(__spreadProps(__spreadValues({
29465
29624
  ref
@@ -29471,7 +29630,7 @@ var createLucideIcon = (iconName, iconNode) => {
29471
29630
  className: ["lucide", `lucide-${toKebabCase(iconName)}`, className].join(" ")
29472
29631
  }), rest),
29473
29632
  [
29474
- ...iconNode.map(([tag, attrs]) => (0, import_react4.createElement)(tag, attrs)),
29633
+ ...iconNode.map(([tag, attrs]) => (0, import_react5.createElement)(tag, attrs)),
29475
29634
  ...Array.isArray(children) ? children : [children]
29476
29635
  ]
29477
29636
  );
@@ -29582,6 +29741,14 @@ var Lock = createLucideIcon("Lock", [
29582
29741
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
29583
29742
  ]);
29584
29743
 
29744
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
29745
+ init_react_import();
29746
+ var Monitor = createLucideIcon("Monitor", [
29747
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
29748
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
29749
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
29750
+ ]);
29751
+
29585
29752
  // ../../node_modules/lucide-react/dist/esm/icons/more-vertical.js
29586
29753
  init_react_import();
29587
29754
  var MoreVertical = createLucideIcon("MoreVertical", [
@@ -29618,6 +29785,34 @@ var Search = createLucideIcon("Search", [
29618
29785
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
29619
29786
  ]);
29620
29787
 
29788
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
29789
+ init_react_import();
29790
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29791
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
29792
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
29793
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
29794
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
29795
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
29796
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
29797
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
29798
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
29799
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29800
+ ]);
29801
+
29802
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
29803
+ init_react_import();
29804
+ var Smartphone = createLucideIcon("Smartphone", [
29805
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
29806
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
29807
+ ]);
29808
+
29809
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
29810
+ init_react_import();
29811
+ var Tablet = createLucideIcon("Tablet", [
29812
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
29813
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
29814
+ ]);
29815
+
29621
29816
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29622
29817
  init_react_import();
29623
29818
  var Trash = createLucideIcon("Trash", [
@@ -29641,12 +29836,29 @@ var Unlock = createLucideIcon("Unlock", [
29641
29836
  ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
29642
29837
  ]);
29643
29838
 
29839
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
29840
+ init_react_import();
29841
+ var ZoomIn = createLucideIcon("ZoomIn", [
29842
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29843
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29844
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
29845
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29846
+ ]);
29847
+
29848
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
29849
+ init_react_import();
29850
+ var ZoomOut = createLucideIcon("ZoomOut", [
29851
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
29852
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
29853
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
29854
+ ]);
29855
+
29644
29856
  // lib/use-modifier-held.ts
29645
29857
  init_react_import();
29646
- var import_react5 = require("react");
29858
+ var import_react6 = require("react");
29647
29859
  var useModifierHeld = (modifier) => {
29648
- const [modifierHeld, setModifierHeld] = (0, import_react5.useState)(false);
29649
- (0, import_react5.useEffect)(() => {
29860
+ const [modifierHeld, setModifierHeld] = (0, import_react6.useState)(false);
29861
+ (0, import_react6.useEffect)(() => {
29650
29862
  function downHandler({ key }) {
29651
29863
  if (key === modifier) {
29652
29864
  setModifierHeld(true);
@@ -29669,8 +29881,12 @@ var useModifierHeld = (modifier) => {
29669
29881
 
29670
29882
  // components/DraggableComponent/index.tsx
29671
29883
  var import_react_spinners2 = require("react-spinners");
29672
- var import_jsx_runtime5 = require("react/jsx-runtime");
29884
+ var import_jsx_runtime7 = require("react/jsx-runtime");
29673
29885
  var getClassName4 = get_class_name_factory_default("DraggableComponent", styles_module_default3);
29886
+ var space = 8;
29887
+ var actionsOverlayTop = space * 6.5;
29888
+ var actionsTop = -(actionsOverlayTop - 8);
29889
+ var actionsRight = space;
29674
29890
  var DraggableComponent = ({
29675
29891
  children,
29676
29892
  id,
@@ -29693,91 +29909,74 @@ var DraggableComponent = ({
29693
29909
  indicativeHover = false,
29694
29910
  style
29695
29911
  }) => {
29912
+ const { zoomConfig } = useAppContext();
29696
29913
  const isModifierHeld = useModifierHeld("Alt");
29697
- (0, import_react6.useEffect)(onMount, []);
29698
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
29699
- import_dnd3.Draggable,
29700
- {
29701
- draggableId: id,
29702
- index,
29703
- isDragDisabled,
29704
- children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
29705
- "div",
29706
- __spreadProps(__spreadValues(__spreadValues({
29707
- ref: provided.innerRef
29708
- }, provided.draggableProps), provided.dragHandleProps), {
29709
- className: getClassName4({
29710
- isSelected,
29711
- isModifierHeld,
29712
- isDragging: snapshot.isDragging,
29713
- isLocked,
29714
- forceHover,
29715
- indicativeHover
29716
- }),
29717
- style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29718
- cursor: isModifierHeld ? "initial" : "grab"
29719
- }),
29720
- onMouseOver,
29721
- onMouseOut,
29722
- onMouseDown,
29723
- onMouseUp,
29724
- onClick,
29725
- children: [
29726
- 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 })
29734
- ]
29735
- })
29736
- )
29737
- },
29738
- id
29739
- );
29740
- };
29741
-
29742
- // 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 });
29914
+ const { status } = useAppContext();
29915
+ const El = status !== "LOADING" ? import_dnd3.Draggable : DefaultDraggable;
29916
+ (0, import_react7.useEffect)(onMount, []);
29917
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29918
+ "div",
29919
+ __spreadProps(__spreadValues(__spreadValues({
29920
+ ref: provided.innerRef
29921
+ }, provided.draggableProps), provided.dragHandleProps), {
29922
+ className: getClassName4({
29923
+ isSelected,
29924
+ isModifierHeld,
29925
+ isDragging: snapshot.isDragging,
29926
+ isLocked,
29927
+ forceHover,
29928
+ indicativeHover
29929
+ }),
29930
+ style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
29931
+ cursor: isModifierHeld ? "initial" : "grab"
29932
+ }),
29933
+ onMouseOver,
29934
+ onMouseOut,
29935
+ onMouseDown,
29936
+ onMouseUp,
29937
+ onClick,
29938
+ children: [
29939
+ debug,
29940
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_spinners2.ClipLoader, { "aria-label": "loading", size: 16, color: "inherit" }) }),
29941
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
29942
+ "div",
29943
+ {
29944
+ className: getClassName4("actionsOverlay"),
29945
+ style: {
29946
+ top: actionsOverlayTop / zoomConfig.zoom
29947
+ },
29948
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
29949
+ "div",
29950
+ {
29951
+ className: getClassName4("actions"),
29952
+ style: {
29953
+ transform: `scale(${1 / zoomConfig.zoom}`,
29954
+ top: actionsTop / zoomConfig.zoom,
29955
+ right: actionsRight / zoomConfig.zoom
29956
+ },
29957
+ children: [
29958
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("actionsLabel"), children: label }),
29959
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDuplicate, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 }) }),
29960
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: getClassName4("action"), onClick: onDelete, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 }) })
29961
+ ]
29962
+ }
29963
+ )
29964
+ }
29965
+ ),
29966
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("overlay") }),
29967
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4("contents"), children })
29968
+ ]
29969
+ })
29970
+ ) }, id);
29772
29971
  };
29773
29972
 
29774
29973
  // css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
29775
29974
  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" };
29975
+ var styles_module_default4 = { "DropZone": "_DropZone_jtf9d_1", "DropZone-content": "_DropZone-content_jtf9d_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_jtf9d_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_jtf9d_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_jtf9d_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_jtf9d_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_jtf9d_27", "DropZone--isDisabled": "_DropZone--isDisabled_jtf9d_28", "DropZone--isRootZone": "_DropZone--isRootZone_jtf9d_29", "DropZone--hasChildren": "_DropZone--hasChildren_jtf9d_30", "DropZone--isDestination": "_DropZone--isDestination_jtf9d_40", "DropZone-item": "_DropZone-item_jtf9d_48", "DropZone-hitbox": "_DropZone-hitbox_jtf9d_52" };
29777
29976
 
29778
29977
  // components/DropZone/context.tsx
29779
29978
  init_react_import();
29780
- var import_react7 = require("react");
29979
+ var import_react8 = require("react");
29781
29980
  var import_use_debounce = require("use-debounce");
29782
29981
 
29783
29982
  // lib/get-zone-id.ts
@@ -29793,30 +29992,30 @@ var getZoneId = (zoneCompound) => {
29793
29992
  };
29794
29993
 
29795
29994
  // components/DropZone/context.tsx
29796
- var import_jsx_runtime6 = require("react/jsx-runtime");
29797
- var dropZoneContext = (0, import_react7.createContext)(null);
29995
+ var import_jsx_runtime8 = require("react/jsx-runtime");
29996
+ var dropZoneContext = (0, import_react8.createContext)(null);
29798
29997
  var DropZoneProvider = ({
29799
29998
  children,
29800
29999
  value
29801
30000
  }) => {
29802
- const [hoveringArea, setHoveringArea] = (0, import_react7.useState)(null);
29803
- const [hoveringZone, setHoveringZone] = (0, import_react7.useState)(
30001
+ const [hoveringArea, setHoveringArea] = (0, import_react8.useState)(null);
30002
+ const [hoveringZone, setHoveringZone] = (0, import_react8.useState)(
29804
30003
  rootDroppableId
29805
30004
  );
29806
- const [hoveringComponent, setHoveringComponent] = (0, import_react7.useState)();
30005
+ const [hoveringComponent, setHoveringComponent] = (0, import_react8.useState)();
29807
30006
  const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
29808
- const [areasWithZones, setAreasWithZones] = (0, import_react7.useState)(
30007
+ const [areasWithZones, setAreasWithZones] = (0, import_react8.useState)(
29809
30008
  {}
29810
30009
  );
29811
- const [activeZones, setActiveZones] = (0, import_react7.useState)({});
30010
+ const [activeZones, setActiveZones] = (0, import_react8.useState)({});
29812
30011
  const { dispatch = null } = value ? value : {};
29813
- const registerZoneArea = (0, import_react7.useCallback)(
30012
+ const registerZoneArea = (0, import_react8.useCallback)(
29814
30013
  (area) => {
29815
30014
  setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
29816
30015
  },
29817
30016
  [setAreasWithZones]
29818
30017
  );
29819
- const registerZone = (0, import_react7.useCallback)(
30018
+ const registerZone = (0, import_react8.useCallback)(
29820
30019
  (zoneCompound) => {
29821
30020
  if (!dispatch) {
29822
30021
  return;
@@ -29829,7 +30028,7 @@ var DropZoneProvider = ({
29829
30028
  },
29830
30029
  [setActiveZones, dispatch]
29831
30030
  );
29832
- const unregisterZone = (0, import_react7.useCallback)(
30031
+ const unregisterZone = (0, import_react8.useCallback)(
29833
30032
  (zoneCompound) => {
29834
30033
  if (!dispatch) {
29835
30034
  return;
@@ -29844,8 +30043,8 @@ var DropZoneProvider = ({
29844
30043
  },
29845
30044
  [setActiveZones, dispatch]
29846
30045
  );
29847
- const [pathData, setPathData] = (0, import_react7.useState)();
29848
- const registerPath = (0, import_react7.useCallback)(
30046
+ const [pathData, setPathData] = (0, import_react8.useState)();
30047
+ const registerPath = (0, import_react8.useCallback)(
29849
30048
  (selector) => {
29850
30049
  if (!(value == null ? void 0 : value.data)) {
29851
30050
  return;
@@ -29870,7 +30069,8 @@ var DropZoneProvider = ({
29870
30069
  },
29871
30070
  [value, setPathData]
29872
30071
  );
29873
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
30072
+ const [zoneWillDrag, setZoneWillDrag] = (0, import_react8.useState)("");
30073
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
29874
30074
  dropZoneContext.Provider,
29875
30075
  {
29876
30076
  value: __spreadValues({
@@ -29886,57 +30086,17 @@ var DropZoneProvider = ({
29886
30086
  unregisterZone,
29887
30087
  activeZones,
29888
30088
  registerPath,
29889
- pathData
30089
+ pathData,
30090
+ zoneWillDrag,
30091
+ setZoneWillDrag
29890
30092
  }, value),
29891
30093
  children
29892
30094
  }
29893
30095
  ) });
29894
30096
  };
29895
30097
 
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
30098
  // components/DropZone/index.tsx
29939
- var import_jsx_runtime7 = require("react/jsx-runtime");
30099
+ var import_jsx_runtime9 = require("react/jsx-runtime");
29940
30100
  var getClassName5 = get_class_name_factory_default("DropZone", styles_module_default4);
29941
30101
  function DropZoneEdit({ zone, allow, disallow, style }) {
29942
30102
  var _a;
@@ -29955,7 +30115,8 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29955
30115
  registerZoneArea,
29956
30116
  areasWithZones,
29957
30117
  hoveringComponent,
29958
- disableZoom = false
30118
+ zoneWillDrag,
30119
+ setZoneWillDrag = () => null
29959
30120
  } = ctx || {};
29960
30121
  let content = data.content || [];
29961
30122
  let zoneCompound = rootDroppableId;
@@ -29985,12 +30146,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
29985
30146
  const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
29986
30147
  const [zoneArea] = getZoneId(zoneCompound);
29987
30148
  const [draggedSourceArea] = getZoneId(draggedSourceId);
29988
- const [userWillDrag, setUserWillDrag] = (0, import_react9.useState)(false);
30149
+ const userWillDrag = zoneWillDrag === zone;
29989
30150
  const userIsDragging = !!draggedItem;
29990
30151
  const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
29991
30152
  const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
29992
30153
  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." });
30154
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "DropZone requires context to work." });
29994
30155
  }
29995
30156
  const {
29996
30157
  hoveringArea = "root",
@@ -30027,7 +30188,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30027
30188
  }
30028
30189
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
30029
30190
  const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
30030
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30191
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30031
30192
  "div",
30032
30193
  {
30033
30194
  className: getClassName5({
@@ -30039,17 +30200,19 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30039
30200
  isDestination: draggedDestinationId === zoneCompound,
30040
30201
  isDisabled: !isEnabled,
30041
30202
  isAreaSelected,
30042
- hasChildren: content.length > 0,
30043
- zoomEnabled: !disableZoom
30203
+ hasChildren: content.length > 0
30044
30204
  }),
30045
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30046
- import_dnd4.Droppable,
30205
+ onMouseUp: () => {
30206
+ setZoneWillDrag("");
30207
+ },
30208
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30209
+ Droppable,
30047
30210
  {
30048
30211
  droppableId: zoneCompound,
30049
30212
  direction: "vertical",
30050
30213
  isDropDisabled: !isEnabled,
30051
30214
  children: (provided, snapshot) => {
30052
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30215
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30053
30216
  "div",
30054
30217
  __spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
30055
30218
  className: getClassName5("content"),
@@ -30063,7 +30226,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30063
30226
  },
30064
30227
  children: [
30065
30228
  content.map((item, i) => {
30066
- var _a2, _b;
30229
+ var _a2, _b, _c;
30067
30230
  const componentId = item.props.id;
30068
30231
  const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
30069
30232
  puck: { renderDropZone: DropZone },
@@ -30074,33 +30237,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30074
30237
  "draggable-"
30075
30238
  )[1] === componentId;
30076
30239
  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: [
30240
+ const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
30078
30241
  "No configuration for ",
30079
30242
  item.type
30080
30243
  ] });
30081
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
30244
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
30082
30245
  "div",
30083
30246
  {
30084
30247
  className: getClassName5("item"),
30085
30248
  style: { zIndex: isDragging ? 1 : void 0 },
30086
30249
  children: [
30087
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30250
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30088
30251
  DropZoneProvider,
30089
30252
  {
30090
30253
  value: __spreadProps(__spreadValues({}, ctx), {
30091
30254
  areaId: componentId
30092
30255
  }),
30093
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30256
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30094
30257
  DraggableComponent,
30095
30258
  {
30096
- label: item.type.toString(),
30259
+ label: (_b = config.components[item.type]["label"]) != null ? _b : item.type.toString(),
30097
30260
  id: `draggable-${componentId}`,
30098
30261
  index: i,
30099
30262
  isSelected,
30100
30263
  isLocked: userIsDragging,
30101
30264
  forceHover: hoveringComponent === componentId && !userIsDragging,
30102
30265
  indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
30103
- isLoading: (_b = appContext2.componentState[componentId]) == null ? void 0 : _b.loading,
30266
+ isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
30104
30267
  onMount: () => {
30105
30268
  ctx.registerPath({
30106
30269
  index: i,
@@ -30116,11 +30279,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30116
30279
  },
30117
30280
  onMouseDown: (e) => {
30118
30281
  e.stopPropagation();
30119
- setUserWillDrag(true);
30120
- },
30121
- onMouseUp: (e) => {
30122
- e.stopPropagation();
30123
- setUserWillDrag(false);
30282
+ setZoneWillDrag(zone);
30124
30283
  },
30125
30284
  onMouseOver: (e) => {
30126
30285
  e.stopPropagation();
@@ -30161,12 +30320,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30161
30320
  style: {
30162
30321
  pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
30163
30322
  },
30164
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30323
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName5("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Render2, __spreadValues({}, defaultedProps)) })
30165
30324
  }
30166
30325
  )
30167
30326
  }
30168
30327
  ),
30169
- userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30328
+ userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30170
30329
  "div",
30171
30330
  {
30172
30331
  className: getClassName5("hitbox"),
@@ -30183,12 +30342,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30183
30342
  );
30184
30343
  }),
30185
30344
  provided == null ? void 0 : provided.placeholder,
30186
- (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30345
+ (snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30187
30346
  "div",
30188
30347
  {
30189
30348
  "data-puck-placeholder": true,
30190
30349
  style: __spreadProps(__spreadValues({}, placeholderStyle), {
30191
- background: "var(--puck-color-azure-5)",
30350
+ background: "var(--puck-color-azure-06)",
30192
30351
  opacity: 0.3,
30193
30352
  zIndex: 0
30194
30353
  })
@@ -30215,14 +30374,14 @@ function DropZoneRender({ zone }) {
30215
30374
  zoneCompound = `${areaId}:${zone}`;
30216
30375
  content = setupZone(data, zoneCompound).zones[zoneCompound];
30217
30376
  }
30218
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: content.map((item) => {
30377
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content.map((item) => {
30219
30378
  const Component = config.components[item.type];
30220
30379
  if (Component) {
30221
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30380
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30222
30381
  DropZoneProvider,
30223
30382
  {
30224
30383
  value: { data, config, areaId: item.props.id },
30225
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
30384
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30226
30385
  Component.render,
30227
30386
  __spreadProps(__spreadValues({}, item.props), {
30228
30387
  puck: { renderDropZone: DropZone }
@@ -30238,9 +30397,9 @@ function DropZoneRender({ zone }) {
30238
30397
  function DropZone(props) {
30239
30398
  const ctx = (0, import_react9.useContext)(dropZoneContext);
30240
30399
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
30241
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneEdit, __spreadValues({}, props));
30400
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneEdit, __spreadValues({}, props));
30242
30401
  }
30243
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropZoneRender, __spreadValues({}, props));
30402
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropZoneRender, __spreadValues({}, props));
30244
30403
  }
30245
30404
 
30246
30405
  // components/IconButton/index.ts
@@ -30252,11 +30411,11 @@ var import_react10 = require("react");
30252
30411
 
30253
30412
  // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
30254
30413
  init_react_import();
30255
- var IconButton_module_default = { "IconButton": "_IconButton_38xdr_1", "IconButton-title": "_IconButton-title_38xdr_18" };
30414
+ var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
30256
30415
 
30257
30416
  // components/IconButton/IconButton.tsx
30258
30417
  var import_react_spinners3 = require("react-spinners");
30259
- var import_jsx_runtime8 = require("react/jsx-runtime");
30418
+ var import_jsx_runtime10 = require("react/jsx-runtime");
30260
30419
  var getClassName6 = get_class_name_factory_default("IconButton", IconButton_module_default);
30261
30420
  var IconButton = ({
30262
30421
  children,
@@ -30272,7 +30431,7 @@ var IconButton = ({
30272
30431
  }) => {
30273
30432
  const [loading, setLoading] = (0, import_react10.useState)(false);
30274
30433
  const ElementType = href ? "a" : "button";
30275
- const el = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
30434
+ const el = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30276
30435
  ElementType,
30277
30436
  {
30278
30437
  className: getClassName6({
@@ -30297,11 +30456,11 @@ var IconButton = ({
30297
30456
  href,
30298
30457
  title,
30299
30458
  children: [
30300
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: getClassName6("title"), children: title }),
30459
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName6("title"), children: title }),
30301
30460
  children,
30302
- loading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
30461
+ loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
30303
30462
  "\xA0\xA0",
30304
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30463
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_spinners3.ClipLoader, { "aria-label": "Loading", color: "inherit", size: "14px" })
30305
30464
  ] })
30306
30465
  ]
30307
30466
  }
@@ -30311,26 +30470,51 @@ var IconButton = ({
30311
30470
 
30312
30471
  // components/Puck/index.tsx
30313
30472
  init_react_import();
30314
- var import_react26 = require("react");
30315
- var import_dnd7 = require("@hello-pangea/dnd");
30473
+ var import_react29 = require("react");
30316
30474
 
30317
30475
  // lib/use-placeholder-style.ts
30318
30476
  init_react_import();
30477
+ var import_react12 = require("react");
30478
+
30479
+ // lib/use-frame.ts
30480
+ init_react_import();
30319
30481
  var import_react11 = require("react");
30482
+
30483
+ // lib/get-frame.ts
30484
+ init_react_import();
30485
+ var getFrame = () => {
30486
+ let frame = document.querySelector("#preview-frame");
30487
+ if ((frame == null ? void 0 : frame.tagName) === "IFRAME") {
30488
+ frame = frame.contentDocument.body;
30489
+ }
30490
+ return frame;
30491
+ };
30492
+
30493
+ // lib/use-frame.ts
30494
+ var useFrame = () => {
30495
+ const [el, setEl] = (0, import_react11.useState)();
30496
+ (0, import_react11.useEffect)(() => {
30497
+ setEl(getFrame());
30498
+ }, []);
30499
+ return el;
30500
+ };
30501
+
30502
+ // lib/use-placeholder-style.ts
30320
30503
  var usePlaceholderStyle = () => {
30321
30504
  const queryAttr = "data-rfd-drag-handle-draggable-id";
30322
- const [placeholderStyle, setPlaceholderStyle] = (0, import_react11.useState)();
30505
+ const [placeholderStyle, setPlaceholderStyle] = (0, import_react12.useState)();
30506
+ const frame = useFrame();
30323
30507
  const onDragStartOrUpdate = (draggedItem) => {
30324
30508
  var _a;
30325
30509
  const draggableId = draggedItem.draggableId;
30326
30510
  const destinationIndex = (draggedItem.destination || draggedItem.source).index;
30327
30511
  const droppableId = (draggedItem.destination || draggedItem.source).droppableId;
30328
30512
  const domQuery = `[${queryAttr}='${draggableId}']`;
30329
- const draggedDOM = document.querySelector(domQuery);
30513
+ const draggedDOM = frame == null ? void 0 : frame.ownerDocument.querySelector(domQuery);
30330
30514
  if (!draggedDOM) {
30331
30515
  return;
30332
30516
  }
30333
- const targetListElement = document.querySelector(
30517
+ const targetListElement = frame == null ? void 0 : frame.ownerDocument.querySelector(
30334
30518
  `[data-rfd-droppable-id='${droppableId}']`
30335
30519
  );
30336
30520
  const { clientHeight } = draggedDOM;
@@ -30367,21 +30551,21 @@ init_react_import();
30367
30551
 
30368
30552
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
30369
30553
  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" };
30554
+ 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
30555
 
30372
30556
  // components/Heading/index.tsx
30373
30557
  init_react_import();
30374
30558
 
30375
30559
  // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
30376
30560
  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" };
30561
+ 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
30562
 
30379
30563
  // components/Heading/index.tsx
30380
- var import_jsx_runtime9 = require("react/jsx-runtime");
30564
+ var import_jsx_runtime11 = require("react/jsx-runtime");
30381
30565
  var getClassName7 = get_class_name_factory_default("Heading", styles_module_default6);
30382
30566
  var Heading = ({ children, rank, size = "m" }) => {
30383
30567
  const Tag = rank ? `h${rank}` : "span";
30384
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
30568
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
30385
30569
  Tag,
30386
30570
  {
30387
30571
  className: getClassName7({
@@ -30394,7 +30578,7 @@ var Heading = ({ children, rank, size = "m" }) => {
30394
30578
 
30395
30579
  // lib/use-breadcrumbs.ts
30396
30580
  init_react_import();
30397
- var import_react12 = require("react");
30581
+ var import_react13 = require("react");
30398
30582
  var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
30399
30583
  const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
30400
30584
  const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
@@ -30444,8 +30628,8 @@ var useBreadcrumbs = (renderCount) => {
30444
30628
  state: { data },
30445
30629
  selectedItem
30446
30630
  } = useAppContext();
30447
- const dzContext = (0, import_react12.useContext)(dropZoneContext);
30448
- return (0, import_react12.useMemo)(() => {
30631
+ const dzContext = (0, import_react13.useContext)(dropZoneContext);
30632
+ return (0, import_react13.useMemo)(() => {
30449
30633
  const breadcrumbs = convertPathDataToBreadcrumbs(
30450
30634
  selectedItem,
30451
30635
  dzContext == null ? void 0 : dzContext.pathData,
@@ -30460,7 +30644,7 @@ var useBreadcrumbs = (renderCount) => {
30460
30644
 
30461
30645
  // components/SidebarSection/index.tsx
30462
30646
  var import_react_spinners4 = require("react-spinners");
30463
- var import_jsx_runtime10 = require("react/jsx-runtime");
30647
+ var import_jsx_runtime12 = require("react/jsx-runtime");
30464
30648
  var getClassName8 = get_class_name_factory_default("SidebarSection", styles_module_default5);
30465
30649
  var SidebarSection = ({
30466
30650
  children,
@@ -30473,28 +30657,28 @@ var SidebarSection = ({
30473
30657
  }) => {
30474
30658
  const { setUi } = useAppContext();
30475
30659
  const breadcrumbs = useBreadcrumbs(1);
30476
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
30660
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
30477
30661
  "div",
30478
30662
  {
30479
30663
  className: getClassName8({ noBorderTop, noPadding }),
30480
30664
  style: { background },
30481
30665
  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",
30666
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("title"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumbs"), children: [
30667
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName8("breadcrumb"), children: [
30668
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
30669
+ "button",
30486
30670
  {
30487
30671
  className: getClassName8("breadcrumbLabel"),
30488
30672
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
30489
30673
  children: breadcrumb.label
30490
30674
  }
30491
30675
  ),
30492
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronRight, { size: 16 })
30676
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRight, { size: 16 })
30493
30677
  ] }, 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 }) })
30678
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
30495
30679
  ] }) }),
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" }) })
30680
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("content"), children }),
30681
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName8("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { "aria-label": "loading" }) })
30498
30682
  ]
30499
30683
  }
30500
30684
  );
@@ -30862,7 +31046,7 @@ var flushZones = (appState) => {
30862
31046
 
30863
31047
  // lib/use-resolved-data.ts
30864
31048
  init_react_import();
30865
- var import_react13 = require("react");
31049
+ var import_react14 = require("react");
30866
31050
 
30867
31051
  // lib/resolve-component-data.ts
30868
31052
  init_react_import();
@@ -30977,13 +31161,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
30977
31161
 
30978
31162
  // lib/use-resolved-data.ts
30979
31163
  var useResolvedData = (appState, config, dispatch) => {
30980
- const [{ resolverKey, newAppState }, setResolverState] = (0, import_react13.useState)({
31164
+ const [{ resolverKey, newAppState }, setResolverState] = (0, import_react14.useState)({
30981
31165
  resolverKey: 0,
30982
31166
  newAppState: appState
30983
31167
  });
30984
- const [componentState, setComponentState] = (0, import_react13.useState)({});
31168
+ const [componentState, setComponentState] = (0, import_react14.useState)({});
30985
31169
  const deferredSetStates = {};
30986
- const setComponentLoading = (0, import_react13.useCallback)(
31170
+ const setComponentLoading = (0, import_react14.useCallback)(
30987
31171
  (id, loading, defer = 0) => {
30988
31172
  if (deferredSetStates[id]) {
30989
31173
  clearTimeout(deferredSetStates[id]);
@@ -31000,7 +31184,10 @@ var useResolvedData = (appState, config, dispatch) => {
31000
31184
  );
31001
31185
  const runResolvers = () => __async(void 0, null, function* () {
31002
31186
  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);
31187
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
31188
+ var _a;
31189
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
31190
+ });
31004
31191
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
31005
31192
  const processed = applyDynamicProps(
31006
31193
  appState.data,
@@ -31050,10 +31237,10 @@ var useResolvedData = (appState, config, dispatch) => {
31050
31237
  });
31051
31238
  yield Promise.all(promises);
31052
31239
  });
31053
- (0, import_react13.useEffect)(() => {
31240
+ (0, import_react14.useEffect)(() => {
31054
31241
  runResolvers();
31055
31242
  }, [resolverKey]);
31056
- const resolveData = (0, import_react13.useCallback)((newAppState2 = appState) => {
31243
+ const resolveData = (0, import_react14.useCallback)((newAppState2 = appState) => {
31057
31244
  setResolverState((curr) => ({
31058
31245
  resolverKey: curr.resolverKey + 1,
31059
31246
  newAppState: newAppState2
@@ -31070,10 +31257,10 @@ init_react_import();
31070
31257
 
31071
31258
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
31072
31259
  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" };
31260
+ 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
31261
 
31075
31262
  // components/MenuBar/index.tsx
31076
- var import_jsx_runtime11 = require("react/jsx-runtime");
31263
+ var import_jsx_runtime13 = require("react/jsx-runtime");
31077
31264
  var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31078
31265
  var MenuBar = ({
31079
31266
  appState,
@@ -31088,7 +31275,7 @@ var MenuBar = ({
31088
31275
  history: { back, forward, historyStore }
31089
31276
  } = useAppContext();
31090
31277
  const { hasFuture = false, hasPast = false } = historyStore || {};
31091
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31278
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31092
31279
  "div",
31093
31280
  {
31094
31281
  className: getClassName9({ menuOpen }),
@@ -31102,34 +31289,34 @@ var MenuBar = ({
31102
31289
  setMenuOpen(false);
31103
31290
  }
31104
31291
  },
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)(
31292
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("inner"), children: [
31293
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName9("history"), children: [
31294
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31108
31295
  ChevronLeft,
31109
31296
  {
31110
31297
  size: 21,
31111
- stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
31298
+ stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31112
31299
  }
31113
31300
  ) }),
31114
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31301
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31115
31302
  ChevronRight,
31116
31303
  {
31117
31304
  size: 21,
31118
- stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
31305
+ stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
31119
31306
  }
31120
31307
  ) })
31121
31308
  ] }),
31122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: renderHeaderActions && renderHeaderActions({
31309
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
31123
31310
  state: appState,
31124
31311
  dispatch
31125
31312
  }) }),
31126
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
31313
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31127
31314
  Button,
31128
31315
  {
31129
31316
  onClick: () => {
31130
31317
  onPublish && onPublish(data);
31131
31318
  },
31132
- icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Globe, { size: "14px" }),
31319
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
31133
31320
  children: "Publish"
31134
31321
  }
31135
31322
  ) })
@@ -31140,7 +31327,7 @@ var MenuBar = ({
31140
31327
 
31141
31328
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
31142
31329
  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" };
31330
+ var styles_module_default8 = { "Puck": "_Puck_1lfcm_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_1lfcm_36", "Puck--rightSideBarVisible": "_Puck--rightSideBarVisible_1lfcm_42", "Puck-header": "_Puck-header_1lfcm_96", "Puck-headerInner": "_Puck-headerInner_1lfcm_105", "Puck-headerToggle": "_Puck-headerToggle_1lfcm_115", "Puck-rightSideBarToggle": "_Puck-rightSideBarToggle_1lfcm_122", "Puck-leftSideBarToggle": "_Puck-leftSideBarToggle_1lfcm_123", "Puck-headerTitle": "_Puck-headerTitle_1lfcm_127", "Puck-headerPath": "_Puck-headerPath_1lfcm_131", "Puck-headerTools": "_Puck-headerTools_1lfcm_138", "Puck-menuButton": "_Puck-menuButton_1lfcm_144", "Puck--menuOpen": "_Puck--menuOpen_1lfcm_149", "Puck-leftSideBar": "_Puck-leftSideBar_1lfcm_123", "Puck-rightSideBar": "_Puck-rightSideBar_1lfcm_122" };
31144
31331
 
31145
31332
  // components/Puck/components/Fields/index.tsx
31146
31333
  init_react_import();
@@ -31151,10 +31338,10 @@ init_react_import();
31151
31338
 
31152
31339
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
31153
31340
  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" };
31341
+ 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
31342
 
31156
31343
  // components/InputOrGroup/index.tsx
31157
- var import_react18 = require("react");
31344
+ var import_react19 = require("react");
31158
31345
 
31159
31346
  // components/InputOrGroup/fields/index.tsx
31160
31347
  init_react_import();
@@ -31164,13 +31351,24 @@ init_react_import();
31164
31351
 
31165
31352
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
31166
31353
  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" };
31354
+ var styles_module_default10 = { "ArrayField": "_ArrayField_1txra_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1txra_13", "ArrayField-addButton": "_ArrayField-addButton_1txra_17", "ArrayField--hasItems": "_ArrayField--hasItems_1txra_32", "ArrayFieldItem": "_ArrayFieldItem_1txra_61", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1txra_69", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1txra_74", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1txra_84", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_1txra_108", "ArrayFieldItem-body": "_ArrayFieldItem-body_1txra_142", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1txra_150", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1txra_157", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1txra_163" };
31168
31355
 
31169
31356
  // components/InputOrGroup/fields/ArrayField/index.tsx
31170
- var import_dnd5 = require("@hello-pangea/dnd");
31171
- var import_dnd6 = require("@hello-pangea/dnd");
31172
- var import_react14 = require("react");
31173
- var import_jsx_runtime12 = require("react/jsx-runtime");
31357
+ var import_react15 = require("react");
31358
+
31359
+ // components/DragDropContext/index.tsx
31360
+ init_react_import();
31361
+ var import_dnd4 = require("@measured/dnd");
31362
+ var import_jsx_runtime14 = require("react/jsx-runtime");
31363
+ var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
31364
+ var DragDropContext = (props) => {
31365
+ const { status } = useAppContext();
31366
+ const El = status !== "LOADING" ? import_dnd4.DragDropContext : DefaultDragDropContext;
31367
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(El, __spreadValues({}, props));
31368
+ };
31369
+
31370
+ // components/InputOrGroup/fields/ArrayField/index.tsx
31371
+ var import_jsx_runtime15 = require("react/jsx-runtime");
31174
31372
  var getClassName10 = get_class_name_factory_default("ArrayField", styles_module_default10);
31175
31373
  var getClassNameItem2 = get_class_name_factory_default("ArrayFieldItem", styles_module_default10);
31176
31374
  var ArrayField = ({
@@ -31194,11 +31392,11 @@ var ArrayField = ({
31194
31392
  }),
31195
31393
  openId: ""
31196
31394
  };
31197
- const [localState, setLocalState] = (0, import_react14.useState)({ arrayState, value });
31198
- (0, import_react14.useEffect)(() => {
31395
+ const [localState, setLocalState] = (0, import_react15.useState)({ arrayState, value });
31396
+ (0, import_react15.useEffect)(() => {
31199
31397
  setLocalState({ arrayState, value });
31200
31398
  }, [value, state.ui.arrayState[id]]);
31201
- const mapArrayStateToUi = (0, import_react14.useCallback)(
31399
+ const mapArrayStateToUi = (0, import_react15.useCallback)(
31202
31400
  (partialArrayState) => {
31203
31401
  return {
31204
31402
  arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
@@ -31208,13 +31406,13 @@ var ArrayField = ({
31208
31406
  },
31209
31407
  [arrayState]
31210
31408
  );
31211
- const getHighestIndex = (0, import_react14.useCallback)(() => {
31409
+ const getHighestIndex = (0, import_react15.useCallback)(() => {
31212
31410
  return arrayState.items.reduce(
31213
31411
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
31214
31412
  -1
31215
31413
  );
31216
31414
  }, [arrayState]);
31217
- const regenerateArrayState = (0, import_react14.useCallback)(
31415
+ const regenerateArrayState = (0, import_react15.useCallback)(
31218
31416
  (value2) => {
31219
31417
  let highestIndex = getHighestIndex();
31220
31418
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -31233,22 +31431,22 @@ var ArrayField = ({
31233
31431
  },
31234
31432
  [arrayState]
31235
31433
  );
31236
- (0, import_react14.useEffect)(() => {
31434
+ (0, import_react15.useEffect)(() => {
31237
31435
  setUi(mapArrayStateToUi(arrayState));
31238
31436
  }, []);
31239
- const [hovering, setHovering] = (0, import_react14.useState)(false);
31437
+ const [hovering, setHovering] = (0, import_react15.useState)(false);
31240
31438
  if (field.type !== "array" || !field.arrayFields) {
31241
31439
  return null;
31242
31440
  }
31243
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31441
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31244
31442
  FieldLabelInternal,
31245
31443
  {
31246
31444
  label: label || name,
31247
- icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(List, { size: 16 }),
31445
+ icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(List, { size: 16 }),
31248
31446
  el: "div",
31249
31447
  readOnly,
31250
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31251
- import_dnd6.DragDropContext,
31448
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31449
+ DragDropContext,
31252
31450
  {
31253
31451
  onDragEnd: (event) => {
31254
31452
  var _a, _b;
@@ -31274,8 +31472,8 @@ var ArrayField = ({
31274
31472
  });
31275
31473
  }
31276
31474
  },
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)(
31475
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
31476
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31279
31477
  "div",
31280
31478
  __spreadProps(__spreadValues({}, provided.droppableProps), {
31281
31479
  ref: provided.innerRef,
@@ -31295,7 +31493,7 @@ var ArrayField = ({
31295
31493
  localState.arrayState.items.map((item, i) => {
31296
31494
  const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
31297
31495
  const data = Array.from(localState.value || [])[i] || {};
31298
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31496
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31299
31497
  Draggable,
31300
31498
  {
31301
31499
  id: _arrayId,
@@ -31306,8 +31504,8 @@ var ArrayField = ({
31306
31504
  readOnly
31307
31505
  }),
31308
31506
  isDragDisabled: readOnly || !hovering,
31309
- children: () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
31310
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
31507
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31508
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31311
31509
  "div",
31312
31510
  {
31313
31511
  onClick: () => {
@@ -31328,10 +31526,11 @@ var ArrayField = ({
31328
31526
  className: getClassNameItem2("summary"),
31329
31527
  children: [
31330
31528
  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)(
31529
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameItem2("rhs"), children: [
31530
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31333
31531
  IconButton,
31334
31532
  {
31533
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31335
31534
  onClick: (e) => {
31336
31535
  e.stopPropagation();
31337
31536
  const existingValue = [
@@ -31350,20 +31549,20 @@ var ArrayField = ({
31350
31549
  );
31351
31550
  },
31352
31551
  title: "Delete",
31353
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash, { size: 16 })
31552
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trash, { size: 16 })
31354
31553
  }
31355
31554
  ) }) }),
31356
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DragIcon, {}) })
31555
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragIcon, {}) })
31357
31556
  ] })
31358
31557
  ]
31359
31558
  }
31360
31559
  ),
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(
31560
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameItem2("body"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("fieldset", { className: getClassNameItem2("fieldset"), children: Object.keys(field.arrayFields).map(
31362
31561
  (fieldName) => {
31363
31562
  const subField = field.arrayFields[fieldName];
31364
31563
  const subFieldName = `${name}[${i}].${fieldName}`;
31365
31564
  const wildcardFieldName = `${name}[*].${fieldName}`;
31366
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31565
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31367
31566
  InputOrGroup,
31368
31567
  {
31369
31568
  name: subFieldName,
@@ -31392,10 +31591,11 @@ var ArrayField = ({
31392
31591
  );
31393
31592
  }),
31394
31593
  provided.placeholder,
31395
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31594
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31396
31595
  "button",
31397
31596
  {
31398
31597
  className: getClassName10("addButton"),
31598
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
31399
31599
  onClick: () => {
31400
31600
  const existingValue = value || [];
31401
31601
  const newValue = [
@@ -31405,7 +31605,7 @@ var ArrayField = ({
31405
31605
  const newArrayState = regenerateArrayState(newValue);
31406
31606
  onChange(newValue, mapArrayStateToUi(newArrayState));
31407
31607
  },
31408
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31608
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Plus, { size: 21 })
31409
31609
  }
31410
31610
  )
31411
31611
  ]
@@ -31420,7 +31620,7 @@ var ArrayField = ({
31420
31620
 
31421
31621
  // components/InputOrGroup/fields/DefaultField/index.tsx
31422
31622
  init_react_import();
31423
- var import_jsx_runtime13 = require("react/jsx-runtime");
31623
+ var import_jsx_runtime16 = require("react/jsx-runtime");
31424
31624
  var getClassName11 = get_class_name_factory_default("Input", styles_module_default9);
31425
31625
  var DefaultField = ({
31426
31626
  field,
@@ -31431,16 +31631,16 @@ var DefaultField = ({
31431
31631
  label,
31432
31632
  id
31433
31633
  }) => {
31434
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31634
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31435
31635
  FieldLabelInternal,
31436
31636
  {
31437
31637
  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 })
31638
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
31639
+ field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
31640
+ field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Hash, { size: 16 })
31441
31641
  ] }),
31442
31642
  readOnly,
31443
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
31643
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31444
31644
  "input",
31445
31645
  {
31446
31646
  className: getClassName11("input"),
@@ -31456,7 +31656,10 @@ var DefaultField = ({
31456
31656
  }
31457
31657
  },
31458
31658
  readOnly,
31459
- id
31659
+ tabIndex: readOnly ? -1 : void 0,
31660
+ id,
31661
+ min: field.type === "number" ? field.min : void 0,
31662
+ max: field.type === "number" ? field.max : void 0
31460
31663
  }
31461
31664
  )
31462
31665
  }
@@ -31465,42 +31668,42 @@ var DefaultField = ({
31465
31668
 
31466
31669
  // components/InputOrGroup/fields/ExternalField/index.tsx
31467
31670
  init_react_import();
31468
- var import_react17 = require("react");
31671
+ var import_react18 = require("react");
31469
31672
 
31470
31673
  // components/ExternalInput/index.tsx
31471
31674
  init_react_import();
31472
- var import_react16 = require("react");
31675
+ var import_react17 = require("react");
31473
31676
 
31474
31677
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31475
31678
  init_react_import();
31476
- 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" };
31679
+ 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" };
31477
31680
 
31478
31681
  // components/Modal/index.tsx
31479
31682
  init_react_import();
31480
- var import_react15 = require("react");
31683
+ var import_react16 = require("react");
31481
31684
 
31482
31685
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31483
31686
  init_react_import();
31484
- var styles_module_default12 = { "Modal": "_Modal_hx2u6_1", "Modal--isOpen": "_Modal--isOpen_hx2u6_15", "Modal-inner": "_Modal-inner_hx2u6_19" };
31687
+ var styles_module_default12 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
31485
31688
 
31486
31689
  // components/Modal/index.tsx
31487
31690
  var import_react_dom = __toESM(require_react_dom());
31488
- var import_jsx_runtime14 = require("react/jsx-runtime");
31691
+ var import_jsx_runtime17 = require("react/jsx-runtime");
31489
31692
  var getClassName12 = get_class_name_factory_default("Modal", styles_module_default12);
31490
31693
  var Modal = ({
31491
31694
  children,
31492
31695
  onClose,
31493
31696
  isOpen
31494
31697
  }) => {
31495
- const [rootEl, setRootEl] = (0, import_react15.useState)(null);
31496
- (0, import_react15.useEffect)(() => {
31698
+ const [rootEl, setRootEl] = (0, import_react16.useState)(null);
31699
+ (0, import_react16.useEffect)(() => {
31497
31700
  setRootEl(document.getElementById("puck-portal-root"));
31498
31701
  }, []);
31499
31702
  if (!rootEl) {
31500
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {});
31703
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {});
31501
31704
  }
31502
31705
  return (0, import_react_dom.createPortal)(
31503
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
31706
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName12({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31504
31707
  "div",
31505
31708
  {
31506
31709
  className: getClassName12("inner"),
@@ -31514,7 +31717,7 @@ var Modal = ({
31514
31717
 
31515
31718
  // components/ExternalInput/index.tsx
31516
31719
  var import_react_spinners5 = require("react-spinners");
31517
- var import_jsx_runtime15 = require("react/jsx-runtime");
31720
+ var import_jsx_runtime18 = require("react/jsx-runtime");
31518
31721
  var getClassName13 = get_class_name_factory_default("ExternalInput", styles_module_default11);
31519
31722
  var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default11);
31520
31723
  var dataCache = {};
@@ -31525,13 +31728,23 @@ var ExternalInput = ({
31525
31728
  name,
31526
31729
  id
31527
31730
  }) => {
31528
- const { mapProp = (val) => val } = field || {};
31529
- const [data, setData] = (0, import_react16.useState)([]);
31530
- const [isOpen, setOpen] = (0, import_react16.useState)(false);
31531
- const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31532
- const keys = (0, import_react16.useMemo)(() => {
31731
+ const {
31732
+ mapProp = (val) => val,
31733
+ mapRow = (val) => val,
31734
+ filterFields
31735
+ } = field || {};
31736
+ const [data, setData] = (0, import_react17.useState)([]);
31737
+ const [isOpen, setOpen] = (0, import_react17.useState)(false);
31738
+ const [isLoading, setIsLoading] = (0, import_react17.useState)(true);
31739
+ const hasFilterFields = !!filterFields;
31740
+ const [filters, setFilters] = (0, import_react17.useState)(field.initialFilters || {});
31741
+ const [filtersToggled, setFiltersToggled] = (0, import_react17.useState)(hasFilterFields);
31742
+ const mappedData = (0, import_react17.useMemo)(() => {
31743
+ return data.map(mapRow);
31744
+ }, [data]);
31745
+ const keys = (0, import_react17.useMemo)(() => {
31533
31746
  const validKeys = /* @__PURE__ */ new Set();
31534
- for (const item of data) {
31747
+ for (const item of mappedData) {
31535
31748
  for (const key of Object.keys(item)) {
31536
31749
  if (typeof item[key] === "string" || typeof item[key] === "number") {
31537
31750
  validKeys.add(key);
@@ -31539,13 +31752,13 @@ var ExternalInput = ({
31539
31752
  }
31540
31753
  }
31541
31754
  return Array.from(validKeys);
31542
- }, [data]);
31543
- const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31544
- const search = (0, import_react16.useCallback)(
31545
- (query) => __async(void 0, null, function* () {
31755
+ }, [mappedData]);
31756
+ const [searchQuery, setSearchQuery] = (0, import_react17.useState)(field.initialQuery || "");
31757
+ const search = (0, import_react17.useCallback)(
31758
+ (query, filters2) => __async(void 0, null, function* () {
31546
31759
  setIsLoading(true);
31547
- const cacheKey = `${id}-${name}-${query}`;
31548
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
31760
+ const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
31761
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
31549
31762
  if (listData) {
31550
31763
  setData(listData);
31551
31764
  setIsLoading(false);
@@ -31554,10 +31767,10 @@ var ExternalInput = ({
31554
31767
  }),
31555
31768
  [name, field]
31556
31769
  );
31557
- (0, import_react16.useEffect)(() => {
31558
- search(searchQuery);
31770
+ (0, import_react17.useEffect)(() => {
31771
+ search(searchQuery, filters);
31559
31772
  }, []);
31560
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31773
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31561
31774
  "div",
31562
31775
  {
31563
31776
  className: getClassName13({
@@ -31566,102 +31779,133 @@ var ExternalInput = ({
31566
31779
  }),
31567
31780
  id,
31568
31781
  children: [
31569
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName13("actions"), children: [
31570
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31782
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName13("actions"), children: [
31783
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31571
31784
  "button",
31572
31785
  {
31573
31786
  onClick: () => setOpen(true),
31574
31787
  className: getClassName13("button"),
31575
- children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
31576
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: "16" }),
31577
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: field.placeholder })
31788
+ children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
31789
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Link, { size: "16" }),
31790
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: field.placeholder })
31578
31791
  ] })
31579
31792
  }
31580
31793
  ),
31581
- value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31794
+ value && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31582
31795
  "button",
31583
31796
  {
31584
31797
  className: getClassName13("detachButton"),
31585
31798
  onClick: () => {
31586
31799
  onChange(null);
31587
31800
  },
31588
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Unlock, { size: 16 })
31801
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Unlock, { size: 16 })
31589
31802
  }
31590
31803
  )
31591
31804
  ] }),
31592
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31593
- "div",
31805
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
31806
+ "form",
31594
31807
  {
31595
31808
  className: getClassNameModal({
31596
31809
  isLoading,
31597
31810
  loaded: !isLoading,
31598
- hasData: data.length > 0
31811
+ hasData: mappedData.length > 0,
31812
+ filtersToggled
31599
31813
  }),
31814
+ onSubmit: (e) => {
31815
+ e.preventDefault();
31816
+ search(searchQuery, filters);
31817
+ },
31600
31818
  children: [
31601
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("masthead"), children: [
31602
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
31603
- field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31604
- "form",
31605
- {
31606
- className: getClassNameModal("searchForm"),
31607
- onSubmit: (e) => {
31608
- e.preventDefault();
31609
- search(searchQuery);
31610
- },
31611
- children: [
31612
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31613
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31614
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31615
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31616
- "input",
31617
- {
31618
- className: getClassNameModal("searchInput"),
31619
- name: "q",
31620
- type: "search",
31621
- placeholder: "Search",
31622
- onChange: (e) => {
31623
- setSearchQuery(e.currentTarget.value);
31624
- },
31625
- autoComplete: "off",
31626
- value: searchQuery
31627
- }
31628
- )
31629
- ] }),
31630
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
31631
- ]
31632
- }
31633
- )
31634
- ] }),
31635
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31636
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31637
- /* @__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)(
31638
- "th",
31819
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31820
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: getClassNameModal("search"), children: [
31821
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31822
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Search, { size: "18" }) }),
31823
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31824
+ "input",
31639
31825
  {
31640
- className: getClassNameModal("th"),
31641
- style: { textAlign: "left" },
31642
- children: key
31826
+ className: getClassNameModal("searchInput"),
31827
+ name: "q",
31828
+ type: "search",
31829
+ placeholder: field.placeholder,
31830
+ onChange: (e) => {
31831
+ setSearchQuery(e.currentTarget.value);
31832
+ },
31833
+ autoComplete: "off",
31834
+ value: searchQuery
31835
+ }
31836
+ )
31837
+ ] }),
31838
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31839
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31840
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31841
+ IconButton,
31842
+ {
31843
+ title: "Toggle filters",
31844
+ onClick: (e) => {
31845
+ e.preventDefault();
31846
+ e.stopPropagation();
31847
+ setFiltersToggled(!filtersToggled);
31848
+ },
31849
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlidersHorizontal, { size: 20 })
31850
+ }
31851
+ ) })
31852
+ ] })
31853
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31854
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("grid"), children: [
31855
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31856
+ const filterField = filterFields[fieldName];
31857
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31858
+ InputOrGroup,
31859
+ {
31860
+ field: filterField,
31861
+ name: fieldName,
31862
+ id: `external_field_${fieldName}_filter`,
31863
+ label: filterField.label || fieldName,
31864
+ value: filters[fieldName],
31865
+ onChange: (value2) => {
31866
+ const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
31867
+ setFilters(newFilters);
31868
+ search(searchQuery, newFilters);
31869
+ }
31643
31870
  },
31644
- key
31645
- )) }) }),
31646
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
31647
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31648
- "tr",
31871
+ fieldName
31872
+ );
31873
+ }) }),
31874
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31875
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: getClassNameModal("table"), children: [
31876
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31877
+ "th",
31649
31878
  {
31650
- style: { whiteSpace: "nowrap" },
31651
- className: getClassNameModal("tr"),
31652
- onClick: (e) => {
31653
- onChange(mapProp(item));
31654
- setOpen(false);
31655
- },
31656
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31879
+ className: getClassNameModal("th"),
31880
+ style: { textAlign: "left" },
31881
+ children: key
31657
31882
  },
31658
- i
31659
- );
31660
- }) })
31661
- ] }),
31662
- /* @__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" }) })
31883
+ key
31884
+ )) }) }),
31885
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31886
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31887
+ "tr",
31888
+ {
31889
+ style: { whiteSpace: "nowrap" },
31890
+ className: getClassNameModal("tr"),
31891
+ onClick: () => {
31892
+ onChange(mapProp(data[i]));
31893
+ setOpen(false);
31894
+ },
31895
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31896
+ },
31897
+ i
31898
+ );
31899
+ }) })
31900
+ ] }),
31901
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31902
+ ] })
31663
31903
  ] }),
31664
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
31904
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassNameModal("footer"), children: [
31905
+ mappedData.length,
31906
+ " result",
31907
+ mappedData.length === 1 ? "" : "s"
31908
+ ] })
31665
31909
  ]
31666
31910
  }
31667
31911
  ) })
@@ -31671,7 +31915,7 @@ var ExternalInput = ({
31671
31915
  };
31672
31916
 
31673
31917
  // components/InputOrGroup/fields/ExternalField/index.tsx
31674
- var import_jsx_runtime16 = require("react/jsx-runtime");
31918
+ var import_jsx_runtime19 = require("react/jsx-runtime");
31675
31919
  var ExternalField = ({
31676
31920
  field,
31677
31921
  onChange,
@@ -31683,7 +31927,7 @@ var ExternalField = ({
31683
31927
  var _a, _b, _c;
31684
31928
  const validField = field;
31685
31929
  const deprecatedField = field;
31686
- (0, import_react17.useEffect)(() => {
31930
+ (0, import_react18.useEffect)(() => {
31687
31931
  if (deprecatedField.adaptor) {
31688
31932
  console.error(
31689
31933
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -31693,13 +31937,13 @@ var ExternalField = ({
31693
31937
  if (field.type !== "external") {
31694
31938
  return null;
31695
31939
  }
31696
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31940
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31697
31941
  FieldLabelInternal,
31698
31942
  {
31699
31943
  label: label || name,
31700
- icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Link, { size: 16 }),
31944
+ icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Link, { size: 16 }),
31701
31945
  el: "div",
31702
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
31946
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
31703
31947
  ExternalInput,
31704
31948
  {
31705
31949
  name,
@@ -31707,6 +31951,7 @@ var ExternalField = ({
31707
31951
  // DEPRECATED
31708
31952
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
31709
31953
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
31954
+ mapRow: validField.mapRow,
31710
31955
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
31711
31956
  return yield deprecatedField.adaptor.fetchList(
31712
31957
  deprecatedField.adaptorParams
@@ -31724,7 +31969,7 @@ var ExternalField = ({
31724
31969
 
31725
31970
  // components/InputOrGroup/fields/RadioField/index.tsx
31726
31971
  init_react_import();
31727
- var import_jsx_runtime17 = require("react/jsx-runtime");
31972
+ var import_jsx_runtime20 = require("react/jsx-runtime");
31728
31973
  var getClassName14 = get_class_name_factory_default("Input", styles_module_default9);
31729
31974
  var RadioField = ({
31730
31975
  field,
@@ -31738,19 +31983,19 @@ var RadioField = ({
31738
31983
  if (field.type !== "radio" || !field.options) {
31739
31984
  return null;
31740
31985
  }
31741
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31986
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31742
31987
  FieldLabelInternal,
31743
31988
  {
31744
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CheckCircle, { size: 16 }),
31989
+ icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CheckCircle, { size: 16 }),
31745
31990
  label: label || name,
31746
31991
  readOnly,
31747
31992
  el: "div",
31748
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
31993
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
31749
31994
  "label",
31750
31995
  {
31751
31996
  className: getClassName14("radio"),
31752
31997
  children: [
31753
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
31998
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
31754
31999
  "input",
31755
32000
  {
31756
32001
  type: "radio",
@@ -31768,7 +32013,7 @@ var RadioField = ({
31768
32013
  defaultChecked: value === option.value
31769
32014
  }
31770
32015
  ),
31771
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
32016
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
31772
32017
  ]
31773
32018
  },
31774
32019
  option.label + option.value
@@ -31779,7 +32024,7 @@ var RadioField = ({
31779
32024
 
31780
32025
  // components/InputOrGroup/fields/SelectField/index.tsx
31781
32026
  init_react_import();
31782
- var import_jsx_runtime18 = require("react/jsx-runtime");
32027
+ var import_jsx_runtime21 = require("react/jsx-runtime");
31783
32028
  var getClassName15 = get_class_name_factory_default("Input", styles_module_default9);
31784
32029
  var SelectField = ({
31785
32030
  field,
@@ -31793,13 +32038,13 @@ var SelectField = ({
31793
32038
  if (field.type !== "select" || !field.options) {
31794
32039
  return null;
31795
32040
  }
31796
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32041
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31797
32042
  FieldLabelInternal,
31798
32043
  {
31799
32044
  label: label || name,
31800
- icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDown, { size: 16 }),
32045
+ icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronDown, { size: 16 }),
31801
32046
  readOnly,
31802
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32047
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31803
32048
  "select",
31804
32049
  {
31805
32050
  id,
@@ -31813,7 +32058,7 @@ var SelectField = ({
31813
32058
  onChange(e.currentTarget.value);
31814
32059
  },
31815
32060
  value,
31816
- children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
32061
+ children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
31817
32062
  "option",
31818
32063
  {
31819
32064
  label: option.label,
@@ -31829,7 +32074,7 @@ var SelectField = ({
31829
32074
 
31830
32075
  // components/InputOrGroup/fields/TextareaField/index.tsx
31831
32076
  init_react_import();
31832
- var import_jsx_runtime19 = require("react/jsx-runtime");
32077
+ var import_jsx_runtime22 = require("react/jsx-runtime");
31833
32078
  var getClassName16 = get_class_name_factory_default("Input", styles_module_default9);
31834
32079
  var TextareaField = ({
31835
32080
  onChange,
@@ -31839,13 +32084,13 @@ var TextareaField = ({
31839
32084
  label,
31840
32085
  id
31841
32086
  }) => {
31842
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32087
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31843
32088
  FieldLabelInternal,
31844
32089
  {
31845
32090
  label: label || name,
31846
- icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Type, { size: 16 }),
32091
+ icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Type, { size: 16 }),
31847
32092
  readOnly,
31848
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32093
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
31849
32094
  "textarea",
31850
32095
  {
31851
32096
  id,
@@ -31855,6 +32100,7 @@ var TextareaField = ({
31855
32100
  value: typeof value === "undefined" ? "" : value,
31856
32101
  onChange: (e) => onChange(e.currentTarget.value),
31857
32102
  readOnly,
32103
+ tabIndex: readOnly ? -1 : void 0,
31858
32104
  rows: 5
31859
32105
  }
31860
32106
  )
@@ -31870,10 +32116,10 @@ init_react_import();
31870
32116
 
31871
32117
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css#css-module
31872
32118
  init_react_import();
31873
- var styles_module_default13 = { "ObjectField": "_ObjectField_56z4t_5", "ObjectField-fieldset": "_ObjectField-fieldset_56z4t_13" };
32119
+ var styles_module_default13 = { "ObjectField": "_ObjectField_15j63_5", "ObjectField-fieldset": "_ObjectField-fieldset_15j63_13" };
31874
32120
 
31875
32121
  // components/InputOrGroup/fields/ObjectField/index.tsx
31876
- var import_jsx_runtime20 = require("react/jsx-runtime");
32122
+ var import_jsx_runtime23 = require("react/jsx-runtime");
31877
32123
  var getClassName17 = get_class_name_factory_default("ObjectField", styles_module_default13);
31878
32124
  var getClassNameItem3 = get_class_name_factory_default("ObjectFieldItem", styles_module_default13);
31879
32125
  var ObjectField = ({
@@ -31890,18 +32136,18 @@ var ObjectField = ({
31890
32136
  return null;
31891
32137
  }
31892
32138
  const data = value || {};
31893
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32139
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31894
32140
  FieldLabelInternal,
31895
32141
  {
31896
32142
  label: label || name,
31897
- icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MoreVertical, { size: 16 }),
32143
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MoreVertical, { size: 16 }),
31898
32144
  el: "div",
31899
32145
  readOnly,
31900
- 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) => {
32146
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17(), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("fieldset", { className: getClassName17("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
31901
32147
  const subField = field.objectFields[fieldName];
31902
32148
  const subFieldName = `${name}.${fieldName}`;
31903
32149
  const wildcardFieldName = `${name}.${fieldName}`;
31904
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
32150
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
31905
32151
  InputOrGroup,
31906
32152
  {
31907
32153
  name: subFieldName,
@@ -31928,7 +32174,7 @@ var ObjectField = ({
31928
32174
  };
31929
32175
 
31930
32176
  // components/InputOrGroup/index.tsx
31931
- var import_jsx_runtime21 = require("react/jsx-runtime");
32177
+ var import_jsx_runtime24 = require("react/jsx-runtime");
31932
32178
  var getClassName18 = get_class_name_factory_default("Input", styles_module_default9);
31933
32179
  var FieldLabel = ({
31934
32180
  children,
@@ -31939,11 +32185,11 @@ var FieldLabel = ({
31939
32185
  className
31940
32186
  }) => {
31941
32187
  const El = el;
31942
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(El, { className, children: [
31943
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassName18("label"), children: [
31944
- icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {}),
32188
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(El, { className, children: [
32189
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getClassName18("label"), children: [
32190
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
31945
32191
  label,
31946
- readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Lock, { size: "12" }) })
32192
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Lock, { size: "12" }) })
31947
32193
  ] }),
31948
32194
  children
31949
32195
  ] });
@@ -31956,11 +32202,11 @@ var FieldLabelInternal = ({
31956
32202
  readOnly
31957
32203
  }) => {
31958
32204
  const { overrides } = useAppContext();
31959
- const Wrapper = (0, import_react18.useMemo)(
32205
+ const Wrapper = (0, import_react19.useMemo)(
31960
32206
  () => overrides.fieldLabel || FieldLabel,
31961
32207
  [overrides]
31962
32208
  );
31963
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
32209
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
31964
32210
  Wrapper,
31965
32211
  {
31966
32212
  label,
@@ -31977,7 +32223,7 @@ var InputOrGroup = (_a) => {
31977
32223
  var _a2, _b2, _c, _d, _e, _f, _g, _h;
31978
32224
  const { overrides } = useAppContext();
31979
32225
  const { name, field, value, readOnly } = props;
31980
- const [localValue, setLocalValue] = (0, import_react18.useState)(value);
32226
+ const [localValue, setLocalValue] = (0, import_react19.useState)(value);
31981
32227
  const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
31982
32228
  (val, ui) => {
31983
32229
  onChange(val, ui);
@@ -31985,11 +32231,11 @@ var InputOrGroup = (_a) => {
31985
32231
  50,
31986
32232
  { leading: true }
31987
32233
  );
31988
- const onChangeLocal = (0, import_react18.useCallback)((val, ui) => {
32234
+ const onChangeLocal = (0, import_react19.useCallback)((val, ui) => {
31989
32235
  setLocalValue(val);
31990
32236
  onChangeDb(val, ui);
31991
32237
  }, []);
31992
- (0, import_react18.useEffect)(() => {
32238
+ (0, import_react19.useEffect)(() => {
31993
32239
  setLocalValue(value);
31994
32240
  }, [value]);
31995
32241
  const localProps = {
@@ -32000,7 +32246,7 @@ var InputOrGroup = (_a) => {
32000
32246
  if (!field.render) {
32001
32247
  return null;
32002
32248
  }
32003
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32249
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: getClassName18(), children: field.render(__spreadValues({
32004
32250
  field,
32005
32251
  name,
32006
32252
  readOnly
@@ -32029,16 +32275,16 @@ var InputOrGroup = (_a) => {
32029
32275
  const mergedProps = __spreadProps(__spreadValues(__spreadValues({}, props), localProps), { field });
32030
32276
  const children = defaultFields[field.type](mergedProps);
32031
32277
  const Render2 = render[field.type];
32032
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32278
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
32033
32279
  };
32034
32280
 
32035
32281
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
32036
32282
  init_react_import();
32037
- var styles_module_default14 = { "PuckFields": "_PuckFields_1276r_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_1276r_5" };
32283
+ var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
32038
32284
 
32039
32285
  // components/Puck/components/Fields/index.tsx
32040
- var import_react19 = require("react");
32041
- var import_jsx_runtime22 = require("react/jsx-runtime");
32286
+ var import_react20 = require("react");
32287
+ var import_jsx_runtime25 = require("react/jsx-runtime");
32042
32288
  var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default14);
32043
32289
  var defaultPageFields = {
32044
32290
  title: { type: "text" }
@@ -32047,9 +32293,9 @@ var DefaultFields = ({
32047
32293
  children,
32048
32294
  isLoading
32049
32295
  }) => {
32050
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName19(), children: [
32296
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
32051
32297
  children,
32052
- 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" }) })
32298
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32053
32299
  ] });
32054
32300
  };
32055
32301
  var Fields = () => {
@@ -32069,15 +32315,15 @@ var Fields = () => {
32069
32315
  const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
32070
32316
  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;
32071
32317
  const rootProps = data.root.props || data.root;
32072
- const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32073
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32318
+ const Wrapper = (0, import_react20.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32319
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32074
32320
  "form",
32075
32321
  {
32076
32322
  className: getClassName19(),
32077
32323
  onSubmit: (e) => {
32078
32324
  e.preventDefault();
32079
32325
  },
32080
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32326
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32081
32327
  const field = fields[fieldName];
32082
32328
  const onChange = (value, updatedUi) => {
32083
32329
  var _a2, _b2;
@@ -32143,7 +32389,7 @@ var Fields = () => {
32143
32389
  };
32144
32390
  if (selectedItem && itemSelector) {
32145
32391
  const { readOnly = {} } = selectedItem;
32146
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32392
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32147
32393
  InputOrGroup,
32148
32394
  {
32149
32395
  field,
@@ -32159,7 +32405,7 @@ var Fields = () => {
32159
32405
  );
32160
32406
  } else {
32161
32407
  const { readOnly = {} } = data.root;
32162
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
32408
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
32163
32409
  InputOrGroup,
32164
32410
  {
32165
32411
  field,
@@ -32184,24 +32430,25 @@ init_react_import();
32184
32430
 
32185
32431
  // lib/use-component-list.tsx
32186
32432
  init_react_import();
32187
- var import_react20 = require("react");
32433
+ var import_react21 = require("react");
32188
32434
 
32189
32435
  // components/ComponentList/index.tsx
32190
32436
  init_react_import();
32191
32437
 
32192
32438
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
32193
32439
  init_react_import();
32194
- 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" };
32440
+ 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" };
32195
32441
 
32196
32442
  // components/ComponentList/index.tsx
32197
- var import_jsx_runtime23 = require("react/jsx-runtime");
32443
+ var import_jsx_runtime26 = require("react/jsx-runtime");
32198
32444
  var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default15);
32199
32445
  var ComponentListItem = ({
32200
32446
  name,
32447
+ label,
32201
32448
  index
32202
32449
  }) => {
32203
32450
  const { overrides } = useAppContext();
32204
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Drawer.Item, { name, index, children: overrides.componentItem });
32451
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer.Item, { label, name, index, children: overrides.componentItem });
32205
32452
  };
32206
32453
  var ComponentList = ({
32207
32454
  children,
@@ -32210,9 +32457,9 @@ var ComponentList = ({
32210
32457
  }) => {
32211
32458
  const { config, state, setUi } = useAppContext();
32212
32459
  const { expanded = true } = state.ui.componentList[id] || {};
32213
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32214
- title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
32215
- "div",
32460
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName20({ isExpanded: expanded }), children: [
32461
+ title && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
32462
+ "button",
32216
32463
  {
32217
32464
  className: getClassName20("title"),
32218
32465
  onClick: () => setUi({
@@ -32224,15 +32471,17 @@ var ComponentList = ({
32224
32471
  }),
32225
32472
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
32226
32473
  children: [
32227
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: title }),
32228
- /* @__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 }) })
32474
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: title }),
32475
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronDown, { size: 12 }) })
32229
32476
  ]
32230
32477
  }
32231
32478
  ),
32232
- /* @__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) => {
32233
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
32479
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName20("content"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Drawer, { droppableId: `component-list${title ? `:${title}` : ""}`, children: children || Object.keys(config.components).map((componentKey, i) => {
32480
+ var _a;
32481
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32234
32482
  ComponentListItem,
32235
32483
  {
32484
+ label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
32236
32485
  name: componentKey,
32237
32486
  index: i
32238
32487
  },
@@ -32244,10 +32493,10 @@ var ComponentList = ({
32244
32493
  ComponentList.Item = ComponentListItem;
32245
32494
 
32246
32495
  // lib/use-component-list.tsx
32247
- var import_jsx_runtime24 = require("react/jsx-runtime");
32496
+ var import_jsx_runtime27 = require("react/jsx-runtime");
32248
32497
  var useComponentList = (config, ui) => {
32249
- const [componentList, setComponentList] = (0, import_react20.useState)();
32250
- (0, import_react20.useEffect)(() => {
32498
+ const [componentList, setComponentList] = (0, import_react21.useState)();
32499
+ (0, import_react21.useEffect)(() => {
32251
32500
  var _a, _b, _c;
32252
32501
  if (Object.keys(ui.componentList).length > 0) {
32253
32502
  const matchedComponents = [];
@@ -32257,16 +32506,18 @@ var useComponentList = (config, ui) => {
32257
32506
  if (category.visible === false || !category.components) {
32258
32507
  return null;
32259
32508
  }
32260
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32509
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32261
32510
  ComponentList,
32262
32511
  {
32263
32512
  id: categoryKey,
32264
32513
  title: category.title || categoryKey,
32265
32514
  children: category.components.map((componentName, i) => {
32515
+ var _a2;
32266
32516
  matchedComponents.push(componentName);
32267
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32517
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32268
32518
  ComponentList.Item,
32269
32519
  {
32520
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32270
32521
  name: componentName,
32271
32522
  index: i
32272
32523
  },
@@ -32283,16 +32534,18 @@ var useComponentList = (config, ui) => {
32283
32534
  );
32284
32535
  if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
32285
32536
  _componentList.push(
32286
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32537
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32287
32538
  ComponentList,
32288
32539
  {
32289
32540
  id: "other",
32290
32541
  title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
32291
32542
  children: remainingComponents.map((componentName, i) => {
32292
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
32543
+ var _a2;
32544
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32293
32545
  ComponentList.Item,
32294
32546
  {
32295
32547
  name: componentName,
32548
+ label: (_a2 = config.components[componentName]["label"]) != null ? _a2 : componentName,
32296
32549
  index: i
32297
32550
  },
32298
32551
  componentName
@@ -32305,27 +32558,35 @@ var useComponentList = (config, ui) => {
32305
32558
  }
32306
32559
  setComponentList(_componentList);
32307
32560
  }
32308
- }, [config.categories, ui.componentList]);
32561
+ }, [config.categories, config.components, ui.componentList]);
32309
32562
  return componentList;
32310
32563
  };
32311
32564
 
32312
32565
  // components/Puck/components/Components/index.tsx
32313
- var import_react21 = require("react");
32314
- var import_jsx_runtime25 = require("react/jsx-runtime");
32566
+ var import_react22 = require("react");
32567
+ var import_jsx_runtime28 = require("react/jsx-runtime");
32315
32568
  var Components = () => {
32316
32569
  const { config, state, overrides } = useAppContext();
32317
32570
  const componentList = useComponentList(config, state.ui);
32318
- const Wrapper = (0, import_react21.useMemo)(() => overrides.components || "div", [overrides]);
32319
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComponentList, { id: "all" }) });
32571
+ const Wrapper = (0, import_react22.useMemo)(() => overrides.components || "div", [overrides]);
32572
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
32320
32573
  };
32321
32574
 
32322
32575
  // components/Puck/components/Preview/index.tsx
32323
32576
  init_react_import();
32324
- var import_react22 = require("react");
32325
- var import_jsx_runtime26 = require("react/jsx-runtime");
32577
+ var import_react23 = require("react");
32578
+ var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32579
+
32580
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
32581
+ init_react_import();
32582
+ var styles_module_default16 = { "PuckPreview": "_PuckPreview_1mia0_1", "PuckPreview-frame": "_PuckPreview-frame_1mia0_5" };
32583
+
32584
+ // components/Puck/components/Preview/index.tsx
32585
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32586
+ var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
32326
32587
  var Preview = ({ id = "puck-preview" }) => {
32327
- const { config, dispatch, state } = useAppContext();
32328
- const Page = (0, import_react22.useCallback)(
32588
+ const { config, dispatch, state, setStatus, iframe } = useAppContext();
32589
+ const Page = (0, import_react23.useCallback)(
32329
32590
  (pageProps) => {
32330
32591
  var _a, _b;
32331
32592
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({}, pageProps), { editMode: true })) : pageProps.children;
@@ -32333,16 +32594,28 @@ var Preview = ({ id = "puck-preview" }) => {
32333
32594
  [config.root]
32334
32595
  );
32335
32596
  const rootProps = state.data.root.props || state.data.root;
32336
- const { disableZoom = false } = (0, import_react22.useContext)(dropZoneContext) || {};
32337
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
32597
+ const ref = (0, import_react23.useRef)(null);
32598
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32338
32599
  "div",
32339
32600
  {
32601
+ className: getClassName21(),
32340
32602
  id,
32341
32603
  onClick: () => {
32342
32604
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32343
32605
  },
32344
- style: { zoom: disableZoom ? 1 : 0.75 },
32345
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropZone, { zone: rootDroppableId }) }))
32606
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32607
+ import_auto_frame_component.default,
32608
+ {
32609
+ id: "preview-frame",
32610
+ className: getClassName21("frame"),
32611
+ "data-rfd-iframe": true,
32612
+ ref,
32613
+ onStylesLoaded: () => {
32614
+ setStatus("READY");
32615
+ },
32616
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
32617
+ }
32618
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) })) })
32346
32619
  }
32347
32620
  );
32348
32621
  };
@@ -32376,7 +32649,7 @@ init_react_import();
32376
32649
 
32377
32650
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
32378
32651
  init_react_import();
32379
- 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" };
32652
+ 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" };
32380
32653
 
32381
32654
  // lib/scroll-into-view.ts
32382
32655
  init_react_import();
@@ -32390,7 +32663,7 @@ var scrollIntoView = (el) => {
32390
32663
  };
32391
32664
 
32392
32665
  // components/LayerTree/index.tsx
32393
- var import_react23 = require("react");
32666
+ var import_react24 = require("react");
32394
32667
 
32395
32668
  // lib/is-child-of-zone.ts
32396
32669
  init_react_import();
@@ -32404,11 +32677,12 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32404
32677
  };
32405
32678
 
32406
32679
  // components/LayerTree/index.tsx
32407
- var import_jsx_runtime27 = require("react/jsx-runtime");
32408
- var getClassName21 = get_class_name_factory_default("LayerTree", styles_module_default16);
32409
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
32680
+ var import_jsx_runtime30 = require("react/jsx-runtime");
32681
+ var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
32682
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
32410
32683
  var LayerTree = ({
32411
32684
  data,
32685
+ config,
32412
32686
  zoneContent,
32413
32687
  itemSelector,
32414
32688
  setItemSelector,
@@ -32416,16 +32690,18 @@ var LayerTree = ({
32416
32690
  label
32417
32691
  }) => {
32418
32692
  const zones = data.zones || {};
32419
- const ctx = (0, import_react23.useContext)(dropZoneContext);
32420
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
32421
- label && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName21("zoneTitle"), children: [
32422
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Layers, { size: "16" }) }),
32693
+ const ctx = (0, import_react24.useContext)(dropZoneContext);
32694
+ const frame = useFrame();
32695
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
32696
+ label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32697
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
32423
32698
  " ",
32424
32699
  label
32425
32700
  ] }),
32426
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("ul", { className: getClassName21(), children: [
32427
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassName21("helper"), children: "No items" }),
32701
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
32702
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32428
32703
  zoneContent.map((item, i) => {
32704
+ var _a;
32429
32705
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
32430
32706
  const zonesForItem = findZonesForArea(data, item.props.id);
32431
32707
  const containsZone = Object.keys(zonesForItem).length > 0;
@@ -32439,7 +32715,7 @@ var LayerTree = ({
32439
32715
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32440
32716
  const isHovering = hoveringComponent === item.props.id;
32441
32717
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32442
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32718
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32443
32719
  "li",
32444
32720
  {
32445
32721
  className: getClassNameLayer({
@@ -32449,8 +32725,8 @@ var LayerTree = ({
32449
32725
  childIsSelected
32450
32726
  }),
32451
32727
  children: [
32452
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
32453
- "div",
32728
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32729
+ "button",
32454
32730
  {
32455
32731
  className: getClassNameLayer("clickable"),
32456
32732
  onClick: () => {
@@ -32464,7 +32740,7 @@ var LayerTree = ({
32464
32740
  });
32465
32741
  const id = zoneContent[i].props.id;
32466
32742
  scrollIntoView(
32467
- document.querySelector(
32743
+ frame == null ? void 0 : frame.querySelector(
32468
32744
  `[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
32469
32745
  )
32470
32746
  );
@@ -32480,24 +32756,25 @@ var LayerTree = ({
32480
32756
  setHoveringComponent(null);
32481
32757
  },
32482
32758
  children: [
32483
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32759
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32484
32760
  "div",
32485
32761
  {
32486
32762
  className: getClassNameLayer("chevron"),
32487
32763
  title: isSelected ? "Collapse" : "Expand",
32488
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ChevronDown, { size: "12" })
32764
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
32489
32765
  }
32490
32766
  ),
32491
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassNameLayer("title"), children: [
32492
- /* @__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" }) }),
32493
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
32767
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
32768
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayoutGrid, { size: "16" }) }),
32769
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32494
32770
  ] })
32495
32771
  ]
32496
32772
  }
32497
32773
  ) }),
32498
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
32774
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32499
32775
  LayerTree,
32500
32776
  {
32777
+ config,
32501
32778
  data,
32502
32779
  zoneContent: zones[zoneKey],
32503
32780
  setItemSelector,
@@ -32516,13 +32793,13 @@ var LayerTree = ({
32516
32793
  };
32517
32794
 
32518
32795
  // components/Puck/components/Outline/index.tsx
32519
- var import_react24 = require("react");
32520
- var import_jsx_runtime28 = require("react/jsx-runtime");
32796
+ var import_react25 = require("react");
32797
+ var import_jsx_runtime31 = require("react/jsx-runtime");
32521
32798
  var Outline = () => {
32522
- const { dispatch, state, overrides } = useAppContext();
32799
+ const { dispatch, state, overrides, config } = useAppContext();
32523
32800
  const { data, ui } = state;
32524
32801
  const { itemSelector } = ui;
32525
- const setItemSelector = (0, import_react24.useCallback)(
32802
+ const setItemSelector = (0, import_react25.useCallback)(
32526
32803
  (newItemSelector) => {
32527
32804
  dispatch({
32528
32805
  type: "setUi",
@@ -32531,11 +32808,12 @@ var Outline = () => {
32531
32808
  },
32532
32809
  []
32533
32810
  );
32534
- const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32535
- 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: [
32536
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32811
+ const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
32812
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
32813
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32537
32814
  LayerTree,
32538
32815
  {
32816
+ config,
32539
32817
  data,
32540
32818
  label: areaContainsZones(data, "root") ? rootDroppableId : "",
32541
32819
  zoneContent: data.content,
@@ -32545,9 +32823,10 @@ var Outline = () => {
32545
32823
  ),
32546
32824
  Object.entries(findZonesForArea(data, "root")).map(
32547
32825
  ([zoneKey, zone]) => {
32548
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
32826
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32549
32827
  LayerTree,
32550
32828
  {
32829
+ config,
32551
32830
  data,
32552
32831
  label: zoneKey,
32553
32832
  zone: zoneKey,
@@ -32629,12 +32908,12 @@ function usePuckHistory({
32629
32908
 
32630
32909
  // lib/use-history-store.ts
32631
32910
  init_react_import();
32632
- var import_react25 = require("react");
32911
+ var import_react26 = require("react");
32633
32912
  var import_use_debounce3 = require("use-debounce");
32634
32913
  var EMPTY_HISTORY_INDEX = -1;
32635
32914
  function useHistoryStore() {
32636
- const [histories, setHistories] = (0, import_react25.useState)([]);
32637
- const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
32915
+ const [histories, setHistories] = (0, import_react26.useState)([]);
32916
+ const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
32638
32917
  const hasPast = index > EMPTY_HISTORY_INDEX;
32639
32918
  const hasFuture = index < histories.length - 1;
32640
32919
  const currentHistory = histories[index];
@@ -32671,14 +32950,431 @@ function useHistoryStore() {
32671
32950
  };
32672
32951
  }
32673
32952
 
32953
+ // components/Puck/components/Canvas/index.tsx
32954
+ init_react_import();
32955
+
32956
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32957
+ init_react_import();
32958
+
32959
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
32960
+ init_react_import();
32961
+ var isProduction = process.env.NODE_ENV === "production";
32962
+ var prefix = "Invariant failed";
32963
+ function invariant(condition, message) {
32964
+ if (condition) {
32965
+ return;
32966
+ }
32967
+ if (isProduction) {
32968
+ throw new Error(prefix);
32969
+ }
32970
+ var provided = typeof message === "function" ? message() : message;
32971
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
32972
+ throw new Error(value);
32973
+ }
32974
+
32975
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
32976
+ var getRect = function getRect2(_ref) {
32977
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
32978
+ var width = right - left;
32979
+ var height = bottom - top;
32980
+ var rect = {
32981
+ top,
32982
+ right,
32983
+ bottom,
32984
+ left,
32985
+ width,
32986
+ height,
32987
+ x: left,
32988
+ y: top,
32989
+ center: {
32990
+ x: (right + left) / 2,
32991
+ y: (bottom + top) / 2
32992
+ }
32993
+ };
32994
+ return rect;
32995
+ };
32996
+ var expand = function expand2(target, expandBy) {
32997
+ return {
32998
+ top: target.top - expandBy.top,
32999
+ left: target.left - expandBy.left,
33000
+ bottom: target.bottom + expandBy.bottom,
33001
+ right: target.right + expandBy.right
33002
+ };
33003
+ };
33004
+ var shrink = function shrink2(target, shrinkBy) {
33005
+ return {
33006
+ top: target.top + shrinkBy.top,
33007
+ left: target.left + shrinkBy.left,
33008
+ bottom: target.bottom - shrinkBy.bottom,
33009
+ right: target.right - shrinkBy.right
33010
+ };
33011
+ };
33012
+ var noSpacing = {
33013
+ top: 0,
33014
+ right: 0,
33015
+ bottom: 0,
33016
+ left: 0
33017
+ };
33018
+ var createBox = function createBox2(_ref2) {
33019
+ 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;
33020
+ var marginBox = getRect(expand(borderBox, margin));
33021
+ var paddingBox = getRect(shrink(borderBox, border));
33022
+ var contentBox = getRect(shrink(paddingBox, padding));
33023
+ return {
33024
+ marginBox,
33025
+ borderBox: getRect(borderBox),
33026
+ paddingBox,
33027
+ contentBox,
33028
+ margin,
33029
+ border,
33030
+ padding
33031
+ };
33032
+ };
33033
+ var parse = function parse2(raw) {
33034
+ var value = raw.slice(0, -2);
33035
+ var suffix = raw.slice(-2);
33036
+ if (suffix !== "px") {
33037
+ return 0;
33038
+ }
33039
+ var result = Number(value);
33040
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
33041
+ return result;
33042
+ };
33043
+ var calculateBox = function calculateBox2(borderBox, styles) {
33044
+ var margin = {
33045
+ top: parse(styles.marginTop),
33046
+ right: parse(styles.marginRight),
33047
+ bottom: parse(styles.marginBottom),
33048
+ left: parse(styles.marginLeft)
33049
+ };
33050
+ var padding = {
33051
+ top: parse(styles.paddingTop),
33052
+ right: parse(styles.paddingRight),
33053
+ bottom: parse(styles.paddingBottom),
33054
+ left: parse(styles.paddingLeft)
33055
+ };
33056
+ var border = {
33057
+ top: parse(styles.borderTopWidth),
33058
+ right: parse(styles.borderRightWidth),
33059
+ bottom: parse(styles.borderBottomWidth),
33060
+ left: parse(styles.borderLeftWidth)
33061
+ };
33062
+ return createBox({
33063
+ borderBox,
33064
+ margin,
33065
+ padding,
33066
+ border
33067
+ });
33068
+ };
33069
+ var getBox = function getBox2(el) {
33070
+ var borderBox = el.getBoundingClientRect();
33071
+ var styles = window.getComputedStyle(el);
33072
+ return calculateBox(borderBox, styles);
33073
+ };
33074
+
33075
+ // components/Puck/components/Canvas/index.tsx
33076
+ var import_react28 = require("react");
33077
+
33078
+ // components/ViewportControls/index.tsx
33079
+ init_react_import();
33080
+ var import_react27 = require("react");
33081
+
33082
+ // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
33083
+ init_react_import();
33084
+ var styles_module_default18 = { "ViewportControls": "_ViewportControls_14bhf_1", "ViewportControls-divider": "_ViewportControls-divider_14bhf_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_14bhf_21", "ViewportButton--isActive": "_ViewportButton--isActive_14bhf_33", "ViewportButton-inner": "_ViewportButton-inner_14bhf_33" };
33085
+
33086
+ // components/ViewportControls/index.tsx
33087
+ var import_jsx_runtime32 = require("react/jsx-runtime");
33088
+ var icons = {
33089
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
33090
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
33091
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
33092
+ };
33093
+ var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
33094
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
33095
+ var ViewportButton = ({
33096
+ children,
33097
+ height = "auto",
33098
+ title,
33099
+ width,
33100
+ onClick
33101
+ }) => {
33102
+ const { state } = useAppContext();
33103
+ const [isActive, setIsActive] = (0, import_react27.useState)(false);
33104
+ (0, import_react27.useEffect)(() => {
33105
+ setIsActive(width === state.ui.viewports.current.width);
33106
+ }, [width, state.ui.viewports.current.width]);
33107
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33108
+ IconButton,
33109
+ {
33110
+ title,
33111
+ disabled: isActive,
33112
+ onClick: (e) => {
33113
+ e.stopPropagation();
33114
+ onClick({ width, height });
33115
+ },
33116
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
33117
+ }
33118
+ ) });
33119
+ };
33120
+ var defaultZoomOptions = [
33121
+ { label: "25%", value: 0.25 },
33122
+ { label: "50%", value: 0.5 },
33123
+ { label: "75%", value: 0.75 },
33124
+ { label: "100%", value: 1 },
33125
+ { label: "125%", value: 1.25 },
33126
+ { label: "150%", value: 1.5 },
33127
+ { label: "200%", value: 2 }
33128
+ ];
33129
+ var ViewportControls = ({
33130
+ autoZoom,
33131
+ zoom,
33132
+ onViewportChange,
33133
+ onZoom
33134
+ }) => {
33135
+ const { viewports } = useAppContext();
33136
+ const defaultsContainAutoZoom = defaultZoomOptions.find(
33137
+ (option) => option.value === autoZoom
33138
+ );
33139
+ const zoomOptions = (0, import_react27.useMemo)(
33140
+ () => [
33141
+ ...defaultZoomOptions,
33142
+ ...defaultsContainAutoZoom ? [] : [
33143
+ {
33144
+ value: autoZoom,
33145
+ label: `${(autoZoom * 100).toFixed(0)}% (Auto)`
33146
+ }
33147
+ ]
33148
+ ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33149
+ [autoZoom]
33150
+ );
33151
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
33152
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33153
+ ViewportButton,
33154
+ {
33155
+ height: viewport.height,
33156
+ width: viewport.width,
33157
+ title: viewport.label ? `Switch to ${viewport.label} viewport` : "Switch viewport",
33158
+ onClick: onViewportChange,
33159
+ children: typeof viewport.icon === "string" ? icons[viewport.icon] || viewport.icon : viewport.icon || icons.Smartphone
33160
+ },
33161
+ i
33162
+ )),
33163
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33164
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33165
+ IconButton,
33166
+ {
33167
+ title: "Zoom viewport out",
33168
+ disabled: zoom <= zoomOptions[0].value,
33169
+ onClick: (e) => {
33170
+ e.stopPropagation();
33171
+ onZoom(
33172
+ zoomOptions[Math.max(
33173
+ zoomOptions.findIndex((option) => option.value === zoom) - 1,
33174
+ 0
33175
+ )].value
33176
+ );
33177
+ },
33178
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
33179
+ }
33180
+ ),
33181
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33182
+ IconButton,
33183
+ {
33184
+ title: "Zoom viewport in",
33185
+ disabled: zoom >= zoomOptions[zoomOptions.length - 1].value,
33186
+ onClick: (e) => {
33187
+ e.stopPropagation();
33188
+ onZoom(
33189
+ zoomOptions[Math.min(
33190
+ zoomOptions.findIndex((option) => option.value === zoom) + 1,
33191
+ zoomOptions.length - 1
33192
+ )].value
33193
+ );
33194
+ },
33195
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
33196
+ }
33197
+ ),
33198
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33199
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33200
+ "select",
33201
+ {
33202
+ className: getClassName23("zoomSelect"),
33203
+ value: zoom.toString(),
33204
+ onChange: (e) => {
33205
+ onZoom(parseFloat(e.currentTarget.value));
33206
+ },
33207
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33208
+ "option",
33209
+ {
33210
+ value: option.value,
33211
+ label: option.label
33212
+ },
33213
+ option.label
33214
+ ))
33215
+ }
33216
+ )
33217
+ ] });
33218
+ };
33219
+
33220
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
33221
+ init_react_import();
33222
+ var styles_module_default19 = { "PuckCanvas": "_PuckCanvas_1i5ph_1", "PuckCanvas-controls": "_PuckCanvas-controls_1i5ph_16", "PuckCanvas-inner": "_PuckCanvas-inner_1i5ph_21", "PuckCanvas-root": "_PuckCanvas-root_1i5ph_32", "PuckCanvas--ready": "_PuckCanvas--ready_1i5ph_56" };
33223
+
33224
+ // lib/get-zoom-config.ts
33225
+ init_react_import();
33226
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
33227
+ var getZoomConfig = (uiViewport, frame, zoom) => {
33228
+ const box = getBox(frame);
33229
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
33230
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
33231
+ let rootHeight = 0;
33232
+ let autoZoom = 1;
33233
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
33234
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
33235
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
33236
+ zoom = widthZoom;
33237
+ if (widthZoom < heightZoom) {
33238
+ rootHeight = viewportHeight / zoom;
33239
+ } else {
33240
+ rootHeight = viewportHeight;
33241
+ zoom = heightZoom;
33242
+ }
33243
+ autoZoom = zoom;
33244
+ } else {
33245
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
33246
+ autoZoom = 1;
33247
+ zoom = 1;
33248
+ rootHeight = viewportHeight;
33249
+ }
33250
+ }
33251
+ return { autoZoom, rootHeight, zoom };
33252
+ };
33253
+
33254
+ // components/Puck/components/Canvas/index.tsx
33255
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33256
+ var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_module_default19);
33257
+ var ZOOM_ON_CHANGE = true;
33258
+ var Canvas = () => {
33259
+ const { status, iframe } = useAppContext();
33260
+ const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33261
+ const { ui } = state;
33262
+ const frameRef = (0, import_react28.useRef)(null);
33263
+ const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
33264
+ const defaultRender = (0, import_react28.useMemo)(() => {
33265
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
33266
+ return PuckDefault;
33267
+ }, []);
33268
+ const CustomPreview = (0, import_react28.useMemo)(
33269
+ () => overrides.preview || defaultRender,
33270
+ [overrides]
33271
+ );
33272
+ const getFrameDimensions = (0, import_react28.useCallback)(() => {
33273
+ if (frameRef.current) {
33274
+ const frame = frameRef.current;
33275
+ const box = getBox(frame);
33276
+ return { width: box.contentBox.width, height: box.contentBox.height };
33277
+ }
33278
+ return { width: 0, height: 0 };
33279
+ }, [frameRef]);
33280
+ const resetAutoZoom = (0, import_react28.useCallback)(
33281
+ (ui2 = state.ui) => {
33282
+ if (frameRef.current) {
33283
+ setZoomConfig(
33284
+ getZoomConfig(ui2.viewports.current, frameRef.current, zoomConfig.zoom)
33285
+ );
33286
+ }
33287
+ },
33288
+ [frameRef, zoomConfig, state.ui]
33289
+ );
33290
+ (0, import_react28.useEffect)(() => {
33291
+ setShowTransition(false);
33292
+ resetAutoZoom();
33293
+ }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33294
+ (0, import_react28.useEffect)(() => {
33295
+ const { height: frameHeight } = getFrameDimensions();
33296
+ if (ui.viewports.current.height === "auto") {
33297
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
33298
+ rootHeight: frameHeight / zoomConfig.zoom
33299
+ }));
33300
+ }
33301
+ }, [zoomConfig.zoom]);
33302
+ (0, import_react28.useEffect)(() => {
33303
+ const observer = new ResizeObserver(() => {
33304
+ setShowTransition(false);
33305
+ resetAutoZoom();
33306
+ });
33307
+ if (document.body) {
33308
+ observer.observe(document.body);
33309
+ }
33310
+ return () => {
33311
+ observer.disconnect();
33312
+ };
33313
+ }, []);
33314
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
33315
+ "div",
33316
+ {
33317
+ className: getClassName24({
33318
+ ready: status === "READY" || !iframe.enabled
33319
+ }),
33320
+ onClick: () => dispatch({
33321
+ type: "setUi",
33322
+ ui: { itemSelector: null },
33323
+ recordHistory: true
33324
+ }),
33325
+ children: [
33326
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33327
+ ViewportControls,
33328
+ {
33329
+ autoZoom: zoomConfig.autoZoom,
33330
+ zoom: zoomConfig.zoom,
33331
+ onViewportChange: (viewport) => {
33332
+ setShowTransition(true);
33333
+ const uiViewport = __spreadProps(__spreadValues({}, viewport), {
33334
+ height: viewport.height || "auto",
33335
+ zoom: zoomConfig.zoom
33336
+ });
33337
+ const newUi = __spreadProps(__spreadValues({}, ui), {
33338
+ viewports: __spreadProps(__spreadValues({}, ui.viewports), { current: uiViewport })
33339
+ });
33340
+ setUi(newUi);
33341
+ if (ZOOM_ON_CHANGE) {
33342
+ resetAutoZoom(newUi);
33343
+ }
33344
+ },
33345
+ onZoom: (zoom) => {
33346
+ setShowTransition(true);
33347
+ setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom }));
33348
+ }
33349
+ }
33350
+ ) }),
33351
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33352
+ "div",
33353
+ {
33354
+ className: getClassName24("root"),
33355
+ style: {
33356
+ width: iframe.enabled ? ui.viewports.current.width : void 0,
33357
+ height: zoomConfig.rootHeight,
33358
+ transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
33359
+ transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
33360
+ overflow: iframe.enabled ? void 0 : "auto"
33361
+ },
33362
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
33363
+ }
33364
+ ) })
33365
+ ]
33366
+ }
33367
+ );
33368
+ };
33369
+
32674
33370
  // components/Puck/index.tsx
32675
- var import_jsx_runtime29 = require("react/jsx-runtime");
32676
- var getClassName22 = get_class_name_factory_default("Puck", styles_module_default8);
33371
+ var import_jsx_runtime34 = require("react/jsx-runtime");
33372
+ var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
32677
33373
  function Puck({
32678
33374
  children,
32679
33375
  config,
32680
33376
  data: initialData = { content: [], root: { props: { title: "" } } },
32681
- ui: initialUi = defaultAppState.ui,
33377
+ ui: initialUi,
32682
33378
  onChange,
32683
33379
  onPublish,
32684
33380
  plugins = [],
@@ -32686,32 +33382,63 @@ function Puck({
32686
33382
  renderHeader,
32687
33383
  renderHeaderActions,
32688
33384
  headerTitle,
32689
- headerPath
33385
+ headerPath,
33386
+ viewports = defaultViewports,
33387
+ iframe = {
33388
+ enabled: true
33389
+ }
32690
33390
  }) {
33391
+ var _a;
32691
33392
  const historyStore = useHistoryStore();
32692
- const [reducer] = (0, import_react26.useState)(
33393
+ const [reducer] = (0, import_react29.useState)(
32693
33394
  () => createReducer({ config, record: historyStore.record })
32694
33395
  );
32695
- const [initialAppState] = (0, import_react26.useState)(() => __spreadProps(__spreadValues({}, defaultAppState), {
32696
- data: initialData,
32697
- ui: __spreadProps(__spreadValues(__spreadValues({}, defaultAppState.ui), initialUi), {
32698
- // Store categories under componentList on state to allow render functions and plugins to modify
32699
- componentList: config.categories ? Object.entries(config.categories).reduce(
32700
- (acc, [categoryName, category]) => {
32701
- return __spreadProps(__spreadValues({}, acc), {
32702
- [categoryName]: {
32703
- title: category.title,
32704
- components: category.components,
32705
- expanded: category.defaultExpanded,
32706
- visible: category.visible
32707
- }
32708
- });
32709
- },
32710
- {}
32711
- ) : {}
32712
- })
32713
- }));
32714
- const [appState, dispatch] = (0, import_react26.useReducer)(
33396
+ const [initialAppState] = (0, import_react29.useState)(() => {
33397
+ var _a2, _b, _c, _d;
33398
+ const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33399
+ let clientUiState = {};
33400
+ if (typeof window !== "undefined") {
33401
+ const viewportWidth = window.innerWidth;
33402
+ const viewportDifferences = Object.entries(viewports).map(([key, value]) => ({
33403
+ key,
33404
+ diff: Math.abs(viewportWidth - value.width)
33405
+ })).sort((a, b) => a.diff > b.diff ? 1 : -1);
33406
+ const closestViewport = viewportDifferences[0].key;
33407
+ if (iframe.enabled) {
33408
+ clientUiState = __spreadProps(__spreadValues({}, window.matchMedia("(min-width: 638px)").matches ? {} : {
33409
+ leftSideBarVisible: false,
33410
+ rightSideBarVisible: false
33411
+ }), {
33412
+ viewports: __spreadProps(__spreadValues({}, initial.viewports), {
33413
+ current: __spreadProps(__spreadValues({}, initial.viewports.current), {
33414
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
33415
+ width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
33416
+ })
33417
+ })
33418
+ });
33419
+ }
33420
+ }
33421
+ return __spreadProps(__spreadValues({}, defaultAppState), {
33422
+ data: initialData,
33423
+ ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33424
+ // Store categories under componentList on state to allow render functions and plugins to modify
33425
+ componentList: config.categories ? Object.entries(config.categories).reduce(
33426
+ (acc, [categoryName, category]) => {
33427
+ return __spreadProps(__spreadValues({}, acc), {
33428
+ [categoryName]: {
33429
+ title: category.title,
33430
+ components: category.components,
33431
+ expanded: category.defaultExpanded,
33432
+ visible: category.visible
33433
+ }
33434
+ });
33435
+ },
33436
+ {}
33437
+ ) : {}
33438
+ })
33439
+ });
33440
+ });
33441
+ const [appState, dispatch] = (0, import_react29.useReducer)(
32715
33442
  reducer,
32716
33443
  flushZones(initialAppState)
32717
33444
  );
@@ -32722,9 +33449,9 @@ function Puck({
32722
33449
  config,
32723
33450
  dispatch
32724
33451
  );
32725
- const [menuOpen, setMenuOpen] = (0, import_react26.useState)(false);
33452
+ const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
32726
33453
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
32727
- const setItemSelector = (0, import_react26.useCallback)(
33454
+ const setItemSelector = (0, import_react29.useCallback)(
32728
33455
  (newItemSelector) => {
32729
33456
  if (newItemSelector === itemSelector)
32730
33457
  return;
@@ -32737,21 +33464,21 @@ function Puck({
32737
33464
  [itemSelector]
32738
33465
  );
32739
33466
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
32740
- (0, import_react26.useEffect)(() => {
33467
+ (0, import_react29.useEffect)(() => {
32741
33468
  if (onChange)
32742
33469
  onChange(data);
32743
33470
  }, [data]);
32744
33471
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
32745
- const [draggedItem, setDraggedItem] = (0, import_react26.useState)();
33472
+ const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
32746
33473
  const rootProps = data.root.props || data.root;
32747
- (0, import_react26.useEffect)(() => {
33474
+ (0, import_react29.useEffect)(() => {
32748
33475
  if (Object.keys(data.root).length > 0 && !data.root.props) {
32749
33476
  console.error(
32750
33477
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
32751
33478
  );
32752
33479
  }
32753
33480
  }, []);
32754
- const toggleSidebars = (0, import_react26.useCallback)(
33481
+ const toggleSidebars = (0, import_react29.useCallback)(
32755
33482
  (sidebar) => {
32756
33483
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
32757
33484
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -32765,7 +33492,7 @@ function Puck({
32765
33492
  },
32766
33493
  [dispatch, leftSideBarVisible, rightSideBarVisible]
32767
33494
  );
32768
- (0, import_react26.useEffect)(() => {
33495
+ (0, import_react29.useEffect)(() => {
32769
33496
  if (!window.matchMedia("(min-width: 638px)").matches) {
32770
33497
  dispatch({
32771
33498
  type: "setUi",
@@ -32788,59 +33515,54 @@ function Puck({
32788
33515
  window.removeEventListener("resize", handleResize);
32789
33516
  };
32790
33517
  }, []);
32791
- const defaultRender = (0, import_react26.useMemo)(() => {
32792
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: children2 });
33518
+ const defaultRender = (0, import_react29.useMemo)(() => {
33519
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
32793
33520
  return PuckDefault;
32794
33521
  }, []);
32795
- const defaultHeaderRender = (0, import_react26.useMemo)(() => {
33522
+ const defaultHeaderRender = (0, import_react29.useMemo)(() => {
32796
33523
  if (renderHeader) {
32797
33524
  console.warn(
32798
33525
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
32799
33526
  );
32800
- const RenderHeader = (_a) => {
32801
- var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
33527
+ const RenderHeader = (_a2) => {
33528
+ var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
32802
33529
  const Comp = renderHeader;
32803
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33530
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
32804
33531
  };
32805
33532
  return RenderHeader;
32806
33533
  }
32807
33534
  return defaultRender;
32808
33535
  }, [renderHeader]);
32809
- const defaultHeaderActionsRender = (0, import_react26.useMemo)(() => {
33536
+ const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
32810
33537
  if (renderHeaderActions) {
32811
33538
  console.warn(
32812
33539
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
32813
33540
  );
32814
33541
  const RenderHeader = (props) => {
32815
33542
  const Comp = renderHeaderActions;
32816
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33543
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
32817
33544
  };
32818
33545
  return RenderHeader;
32819
33546
  }
32820
33547
  return defaultRender;
32821
33548
  }, [renderHeader]);
32822
- const loadedOverrides = (0, import_react26.useMemo)(() => {
33549
+ const loadedOverrides = (0, import_react29.useMemo)(() => {
32823
33550
  return loadOverrides({ overrides, plugins });
32824
33551
  }, [plugins]);
32825
- const CustomPuck = (0, import_react26.useMemo)(
33552
+ const CustomPuck = (0, import_react29.useMemo)(
32826
33553
  () => loadedOverrides.puck || defaultRender,
32827
33554
  [loadedOverrides]
32828
33555
  );
32829
- const CustomPreview = (0, import_react26.useMemo)(
32830
- () => loadedOverrides.preview || defaultRender,
32831
- [loadedOverrides]
32832
- );
32833
- const CustomHeader = (0, import_react26.useMemo)(
33556
+ const CustomHeader = (0, import_react29.useMemo)(
32834
33557
  () => loadedOverrides.header || defaultHeaderRender,
32835
33558
  [loadedOverrides]
32836
33559
  );
32837
- const CustomHeaderActions = (0, import_react26.useMemo)(
33560
+ const CustomHeaderActions = (0, import_react29.useMemo)(
32838
33561
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
32839
33562
  [loadedOverrides]
32840
33563
  );
32841
- const disableZoom = children || loadedOverrides.puck ? true : false;
32842
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "Puck", children: [
32843
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33564
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "Puck", children: [
33565
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32844
33566
  AppProvider,
32845
33567
  {
32846
33568
  value: {
@@ -32851,10 +33573,12 @@ function Puck({
32851
33573
  resolveData,
32852
33574
  plugins,
32853
33575
  overrides: loadedOverrides,
32854
- history
33576
+ history,
33577
+ viewports,
33578
+ iframe
32855
33579
  },
32856
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32857
- import_dnd7.DragDropContext,
33580
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33581
+ DragDropContext,
32858
33582
  {
32859
33583
  onDragUpdate: (update) => {
32860
33584
  setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
@@ -32908,7 +33632,7 @@ function Puck({
32908
33632
  });
32909
33633
  }
32910
33634
  },
32911
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33635
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32912
33636
  DropZoneProvider,
32913
33637
  {
32914
33638
  value: {
@@ -32920,77 +33644,75 @@ function Puck({
32920
33644
  draggedItem,
32921
33645
  placeholderStyle,
32922
33646
  mode: "edit",
32923
- areaId: "root",
32924
- disableZoom
33647
+ areaId: "root"
32925
33648
  },
32926
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33649
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
32927
33650
  "div",
32928
33651
  {
32929
- className: getClassName22({
33652
+ className: getClassName25({
32930
33653
  leftSideBarVisible,
32931
33654
  menuOpen,
32932
- rightSideBarVisible,
32933
- disableZoom
33655
+ rightSideBarVisible
32934
33656
  }),
32935
33657
  children: [
32936
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33658
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32937
33659
  CustomHeader,
32938
33660
  {
32939
- actions: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
32940
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
32941
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33661
+ actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33662
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33663
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32942
33664
  Button,
32943
33665
  {
32944
33666
  onClick: () => {
32945
33667
  onPublish && onPublish(data);
32946
33668
  },
32947
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Globe, { size: "14px" }),
33669
+ icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
32948
33670
  children: "Publish"
32949
33671
  }
32950
33672
  )
32951
33673
  ] }),
32952
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("header", { className: getClassName22("header"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerInner"), children: [
32953
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerToggle"), children: [
32954
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33674
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33675
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33676
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32955
33677
  IconButton,
32956
33678
  {
32957
33679
  onClick: () => {
32958
33680
  toggleSidebars("left");
32959
33681
  },
32960
33682
  title: "Toggle left sidebar",
32961
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelLeft, { focusable: "false" })
33683
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
32962
33684
  }
32963
33685
  ) }),
32964
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33686
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32965
33687
  IconButton,
32966
33688
  {
32967
33689
  onClick: () => {
32968
33690
  toggleSidebars("right");
32969
33691
  },
32970
33692
  title: "Toggle right sidebar",
32971
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PanelRight, { focusable: "false" })
33693
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
32972
33694
  }
32973
33695
  ) })
32974
33696
  ] }),
32975
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Heading, { rank: 2, size: "xs", children: [
33697
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
32976
33698
  headerTitle || rootProps.title || "Page",
32977
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
33699
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
32978
33700
  " ",
32979
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("code", { className: getClassName22("headerPath"), children: headerPath })
33701
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
32980
33702
  ] })
32981
33703
  ] }) }),
32982
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("headerTools"), children: [
32983
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33704
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33705
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32984
33706
  IconButton,
32985
33707
  {
32986
33708
  onClick: () => {
32987
33709
  return setMenuOpen(!menuOpen);
32988
33710
  },
32989
33711
  title: "Toggle menu bar",
32990
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { focusable: "false" })
33712
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
32991
33713
  }
32992
33714
  ) }),
32993
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33715
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
32994
33716
  MenuBar,
32995
33717
  {
32996
33718
  appState,
@@ -32998,7 +33720,7 @@ function Puck({
32998
33720
  dispatch,
32999
33721
  onPublish,
33000
33722
  menuOpen,
33001
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomHeaderActions, {}),
33723
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33002
33724
  setMenuOpen
33003
33725
  }
33004
33726
  )
@@ -33006,38 +33728,19 @@ function Puck({
33006
33728
  ] }) })
33007
33729
  }
33008
33730
  ),
33009
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22("leftSideBar"), children: [
33010
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Components, {}) }),
33011
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Outline, {}) })
33731
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33732
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33733
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
33012
33734
  ] }),
33013
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
33014
- "div",
33015
- {
33016
- className: getClassName22("frame"),
33017
- onClick: () => setItemSelector(null),
33018
- children: [
33019
- /* @__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, {}) }) }),
33020
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33021
- "div",
33022
- {
33023
- style: {
33024
- background: "var(--puck-color-grey-10)",
33025
- height: "100%",
33026
- flexGrow: 1
33027
- }
33028
- }
33029
- )
33030
- ]
33031
- }
33032
- ),
33033
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
33735
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33736
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33034
33737
  SidebarSection,
33035
33738
  {
33036
33739
  noPadding: true,
33037
33740
  noBorderTop: true,
33038
33741
  showBreadcrumbs: true,
33039
- title: selectedItem ? selectedItem.type : "Page",
33040
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Fields, {})
33742
+ title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33743
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
33041
33744
  }
33042
33745
  ) })
33043
33746
  ]
@@ -33049,7 +33752,7 @@ function Puck({
33049
33752
  )
33050
33753
  }
33051
33754
  ),
33052
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "puck-portal-root" })
33755
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "puck-portal-root" })
33053
33756
  ] });
33054
33757
  }
33055
33758
  Puck.Components = Components;
@@ -33059,13 +33762,13 @@ Puck.Preview = Preview;
33059
33762
 
33060
33763
  // components/Render/index.tsx
33061
33764
  init_react_import();
33062
- var import_jsx_runtime30 = require("react/jsx-runtime");
33765
+ var import_jsx_runtime35 = require("react/jsx-runtime");
33063
33766
  function Render({ config, data }) {
33064
33767
  var _a;
33065
33768
  const rootProps = data.root.props || data.root;
33066
33769
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33067
33770
  if ((_a = config.root) == null ? void 0 : _a.render) {
33068
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33771
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33069
33772
  config.root.render,
33070
33773
  __spreadProps(__spreadValues({}, rootProps), {
33071
33774
  puck: {
@@ -33074,11 +33777,11 @@ function Render({ config, data }) {
33074
33777
  title,
33075
33778
  editMode: false,
33076
33779
  id: "puck-root",
33077
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId })
33780
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
33078
33781
  })
33079
33782
  ) });
33080
33783
  }
33081
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) });
33784
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
33082
33785
  }
33083
33786
 
33084
33787
  // lib/migrate.ts
@@ -33168,8 +33871,8 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
33168
33871
  // lib/use-puck.ts
33169
33872
  init_react_import();
33170
33873
  var usePuck = () => {
33171
- const { state: appState, config, dispatch } = useAppContext();
33172
- return { appState, config, dispatch };
33874
+ const { state: appState, config, history, dispatch } = useAppContext();
33875
+ return { appState, config, dispatch, history };
33173
33876
  };
33174
33877
  // Annotate the CommonJS export names for ESM import in node:
33175
33878
  0 && (module.exports = {
@@ -33373,6 +34076,14 @@ lucide-react/dist/esm/icons/lock.js:
33373
34076
  * See the LICENSE file in the root directory of this source tree.
33374
34077
  *)
33375
34078
 
34079
+ lucide-react/dist/esm/icons/monitor.js:
34080
+ (**
34081
+ * @license lucide-react v0.298.0 - ISC
34082
+ *
34083
+ * This source code is licensed under the ISC license.
34084
+ * See the LICENSE file in the root directory of this source tree.
34085
+ *)
34086
+
33376
34087
  lucide-react/dist/esm/icons/more-vertical.js:
33377
34088
  (**
33378
34089
  * @license lucide-react v0.298.0 - ISC
@@ -33413,6 +34124,30 @@ lucide-react/dist/esm/icons/search.js:
33413
34124
  * See the LICENSE file in the root directory of this source tree.
33414
34125
  *)
33415
34126
 
34127
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
34128
+ (**
34129
+ * @license lucide-react v0.298.0 - ISC
34130
+ *
34131
+ * This source code is licensed under the ISC license.
34132
+ * See the LICENSE file in the root directory of this source tree.
34133
+ *)
34134
+
34135
+ lucide-react/dist/esm/icons/smartphone.js:
34136
+ (**
34137
+ * @license lucide-react v0.298.0 - ISC
34138
+ *
34139
+ * This source code is licensed under the ISC license.
34140
+ * See the LICENSE file in the root directory of this source tree.
34141
+ *)
34142
+
34143
+ lucide-react/dist/esm/icons/tablet.js:
34144
+ (**
34145
+ * @license lucide-react v0.298.0 - ISC
34146
+ *
34147
+ * This source code is licensed under the ISC license.
34148
+ * See the LICENSE file in the root directory of this source tree.
34149
+ *)
34150
+
33416
34151
  lucide-react/dist/esm/icons/trash.js:
33417
34152
  (**
33418
34153
  * @license lucide-react v0.298.0 - ISC
@@ -33437,6 +34172,22 @@ lucide-react/dist/esm/icons/unlock.js:
33437
34172
  * See the LICENSE file in the root directory of this source tree.
33438
34173
  *)
33439
34174
 
34175
+ lucide-react/dist/esm/icons/zoom-in.js:
34176
+ (**
34177
+ * @license lucide-react v0.298.0 - ISC
34178
+ *
34179
+ * This source code is licensed under the ISC license.
34180
+ * See the LICENSE file in the root directory of this source tree.
34181
+ *)
34182
+
34183
+ lucide-react/dist/esm/icons/zoom-out.js:
34184
+ (**
34185
+ * @license lucide-react v0.298.0 - ISC
34186
+ *
34187
+ * This source code is licensed under the ISC license.
34188
+ * See the LICENSE file in the root directory of this source tree.
34189
+ *)
34190
+
33440
34191
  lucide-react/dist/esm/lucide-react.js:
33441
34192
  (**
33442
34193
  * @license lucide-react v0.298.0 - ISC