@measured/puck 0.14.2-canary.e6e01c6 → 0.14.3-canary.061cc2a

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -108,7 +108,7 @@ Available recipes include:
108
108
 
109
109
  Puck is developed and maintained by **Measured**, a small group of industry veterans with decades of experience helping companies solve hard UI problems. We offer consultancy and development services for scale-ups, SMEs and enterprises.
110
110
 
111
- If you need support integrating Puck or creating a beautiful component library, please reach out via [our website](https://measured.co).
111
+ If you need support integrating Puck or creating a beautiful component library, please reach out via the [Measured](https://measured.co) website.
112
112
 
113
113
  ## License
114
114
 
package/dist/index.css CHANGED
@@ -135,9 +135,6 @@
135
135
  }
136
136
 
137
137
  /* styles.css */
138
- .Puck {
139
- min-height: 100%;
140
- }
141
138
 
142
139
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css/#css-module-data */
143
140
  ._Button_1t64k_1 {
package/dist/index.d.ts CHANGED
@@ -229,7 +229,7 @@ type IframeConfig = {
229
229
  enabled?: boolean;
230
230
  };
231
231
 
232
- declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, }: {
232
+ declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, }: {
233
233
  children?: ReactNode;
234
234
  config: UserConfig;
235
235
  data: Data;
@@ -251,6 +251,9 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
251
251
  headerPath?: string;
252
252
  viewports?: Viewports;
253
253
  iframe?: IframeConfig;
254
+ dnd?: {
255
+ disableAutoScroll?: boolean;
256
+ };
254
257
  }): react_jsx_runtime.JSX.Element;
255
258
  declare namespace Puck {
256
259
  var Components: () => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -8033,9 +8033,9 @@ var require_react_dom_development = __commonJS({
8033
8033
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
8034
8034
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
8035
8035
  }
8036
- var React2 = require("react");
8036
+ var React3 = require("react");
8037
8037
  var Scheduler = require_scheduler();
8038
- var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
8038
+ var ReactSharedInternals = React3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
8039
8039
  var suppressWarning = false;
8040
8040
  function setSuppressWarning(newSuppressWarning) {
8041
8041
  {
@@ -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 Fragment17 = 7;
8087
+ var Fragment18 = 7;
8088
8088
  var Mode = 8;
8089
8089
  var ContextConsumer = 9;
8090
8090
  var ContextProvider = 10;
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
9240
9240
  return "DehydratedFragment";
9241
9241
  case ForwardRef:
9242
9242
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment17:
9243
+ case Fragment18:
9244
9244
  return "Fragment";
9245
9245
  case HostComponent:
9246
9246
  return type;
@@ -9640,7 +9640,7 @@ var require_react_dom_development = __commonJS({
9640
9640
  {
9641
9641
  if (props.value == null) {
9642
9642
  if (typeof props.children === "object" && props.children !== null) {
9643
- React2.Children.forEach(props.children, function(child) {
9643
+ React3.Children.forEach(props.children, function(child) {
9644
9644
  if (child == null) {
9645
9645
  return;
9646
9646
  }
@@ -18087,7 +18087,7 @@ var require_react_dom_development = __commonJS({
18087
18087
  }
18088
18088
  }
18089
18089
  var fakeInternalInstance = {};
18090
- var emptyRefsObject = new React2.Component().refs;
18090
+ var emptyRefsObject = new React3.Component().refs;
18091
18091
  var didWarnAboutStateAssignmentForComponent;
18092
18092
  var didWarnAboutUninitializedState;
18093
18093
  var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
@@ -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 !== Fragment17) {
18914
+ if (current2 === null || current2.tag !== Fragment18) {
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 === Fragment17) {
19317
+ if (child.tag === Fragment18) {
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 Fragment17:
23492
+ case Fragment18:
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 Fragment17:
23765
+ case Fragment18:
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(Fragment17, elements, key, mode);
28024
+ var fiber = createFiber(Fragment18, elements, key, mode);
28025
28025
  fiber.lanes = lanes;
28026
28026
  return fiber;
28027
28027
  }
@@ -29311,9 +29311,10 @@ var defaultViewports = [
29311
29311
  ];
29312
29312
 
29313
29313
  // components/Puck/context.tsx
29314
+ var import_ua_parser_js = require("ua-parser-js");
29314
29315
  var import_jsx_runtime2 = require("react/jsx-runtime");
29315
29316
  var defaultAppState = {
29316
- data: { content: [], root: { props: { title: "" } } },
29317
+ data: { content: [], root: { props: {} } },
29317
29318
  ui: {
29318
29319
  leftSideBarVisible: true,
29319
29320
  rightSideBarVisible: true,
@@ -29350,7 +29351,8 @@ var defaultContext = {
29350
29351
  setZoomConfig: () => null,
29351
29352
  status: "LOADING",
29352
29353
  setStatus: () => null,
29353
- iframe: {}
29354
+ iframe: {},
29355
+ safariFallbackMode: false
29354
29356
  };
29355
29357
  var appContext = (0, import_react3.createContext)(defaultContext);
29356
29358
  var AppProvider = ({
@@ -29362,10 +29364,34 @@ var AppProvider = ({
29362
29364
  (0, import_react3.useEffect)(() => {
29363
29365
  setStatus("MOUNTED");
29364
29366
  }, []);
29367
+ const [safariFallbackMode, setSafariFallbackMode] = (0, import_react3.useState)(false);
29368
+ (0, import_react3.useEffect)(() => {
29369
+ var _a, _b, _c;
29370
+ const ua = new import_ua_parser_js.UAParser(navigator.userAgent);
29371
+ const { browser } = ua.getResult();
29372
+ if (browser.name === "Safari" && (((_a = browser.version) == null ? void 0 : _a.indexOf("17.2.")) || ((_b = browser.version) == null ? void 0 : _b.indexOf("17.3.")) || ((_c = browser.version) == null ? void 0 : _c.indexOf("17.4.")))) {
29373
+ if (process.env.NODE_ENV !== "production" && value.iframe.enabled) {
29374
+ console.warn(
29375
+ `Detected Safari ${browser.version}, which contains a bug that prevents Puck DropZones from detecting a mouseover event within an iframe. This affects Safari versions 17.2, 17.3 and 17.4.
29376
+
29377
+ Running in compatibility mode, which may have some DropZone side-effects. Alternatively, consider disabling iframes: https://puckeditor.com/docs/integrating-puck/viewports#opting-out-of-iframes.
29378
+
29379
+ See https://github.com/measuredco/puck/issues/411 for more information. This message will not show in production.`
29380
+ );
29381
+ }
29382
+ setSafariFallbackMode(true);
29383
+ }
29384
+ }, []);
29365
29385
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
29366
29386
  appContext.Provider,
29367
29387
  {
29368
- value: __spreadProps(__spreadValues({}, value), { zoomConfig, setZoomConfig, status, setStatus }),
29388
+ value: __spreadProps(__spreadValues({}, value), {
29389
+ zoomConfig,
29390
+ setZoomConfig,
29391
+ status,
29392
+ setStatus,
29393
+ safariFallbackMode
29394
+ }),
29369
29395
  children
29370
29396
  }
29371
29397
  );
@@ -30193,7 +30219,11 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
30193
30219
  let isEnabled = userWillDrag;
30194
30220
  if (userIsDragging) {
30195
30221
  if (draggingNewComponent) {
30196
- isEnabled = hoveringOverArea;
30222
+ if (appContext2.safariFallbackMode) {
30223
+ isEnabled = true;
30224
+ } else {
30225
+ isEnabled = hoveringOverArea;
30226
+ }
30197
30227
  } else {
30198
30228
  isEnabled = draggingOverArea && hoveringOverZone;
30199
30229
  }
@@ -30498,7 +30528,7 @@ var IconButton = ({
30498
30528
 
30499
30529
  // components/Puck/index.tsx
30500
30530
  init_react_import();
30501
- var import_react28 = require("react");
30531
+ var import_react29 = require("react");
30502
30532
 
30503
30533
  // lib/use-placeholder-style.ts
30504
30534
  init_react_import();
@@ -31183,7 +31213,7 @@ var useResolvedData = (appState, config, dispatch) => {
31183
31213
  const [componentState, setComponentState] = (0, import_react13.useState)({});
31184
31214
  const deferredSetStates = {};
31185
31215
  const setComponentLoading = (0, import_react13.useCallback)(
31186
- (id, loading, defer = 0) => {
31216
+ (id, loading, defer2 = 0) => {
31187
31217
  if (deferredSetStates[id]) {
31188
31218
  clearTimeout(deferredSetStates[id]);
31189
31219
  delete deferredSetStates[id];
@@ -31193,7 +31223,7 @@ var useResolvedData = (appState, config, dispatch) => {
31193
31223
  [id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
31194
31224
  }));
31195
31225
  delete deferredSetStates[id];
31196
- }, defer);
31226
+ }, defer2);
31197
31227
  },
31198
31228
  []
31199
31229
  );
@@ -31279,7 +31309,7 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
31279
31309
  var getClassName9 = get_class_name_factory_default("MenuBar", styles_module_default7);
31280
31310
  var MenuBar = ({
31281
31311
  appState,
31282
- data = { content: [], root: { props: { title: "" } } },
31312
+ data = { content: [], root: {} },
31283
31313
  dispatch,
31284
31314
  menuOpen = false,
31285
31315
  onPublish,
@@ -32031,7 +32061,7 @@ var RadioField = ({
32031
32061
  onChange(e.currentTarget.value);
32032
32062
  },
32033
32063
  disabled: readOnly,
32034
- defaultChecked: value === option.value
32064
+ checked: value === option.value
32035
32065
  }
32036
32066
  ),
32037
32067
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName14("radioInner"), children: option.label || option.value })
@@ -32073,7 +32103,7 @@ var SelectField = ({
32073
32103
  disabled: readOnly,
32074
32104
  onChange: (e) => {
32075
32105
  if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
32076
- onChange(Boolean(e.currentTarget.value));
32106
+ onChange(JSON.parse(e.currentTarget.value));
32077
32107
  return;
32078
32108
  }
32079
32109
  onChange(e.currentTarget.value);
@@ -32597,19 +32627,218 @@ var Components = () => {
32597
32627
 
32598
32628
  // components/Puck/components/Preview/index.tsx
32599
32629
  init_react_import();
32600
- var import_react22 = require("react");
32601
- var import_auto_frame_component = __toESM(require("@measured/auto-frame-component"));
32630
+ var import_react23 = require("react");
32631
+
32632
+ // components/AutoFrame/index.tsx
32633
+ init_react_import();
32634
+ var import_react22 = __toESM(require("react"));
32635
+ var import_react_frame_component = __toESM(require("react-frame-component"));
32636
+ var import_object_hash = __toESM(require("object-hash"));
32637
+ var import_jsx_runtime29 = require("react/jsx-runtime");
32638
+ var styleSelector = 'style, link[rel="stylesheet"]';
32639
+ var collectStyles = (doc) => {
32640
+ const collected = [];
32641
+ doc.head.querySelectorAll(styleSelector).forEach((style) => {
32642
+ collected.push(style);
32643
+ });
32644
+ return collected;
32645
+ };
32646
+ var getStyleSheet = (el) => {
32647
+ return Array.from(document.styleSheets).find((ss) => {
32648
+ const ownerNode = ss.ownerNode;
32649
+ return ownerNode.href === el.href;
32650
+ });
32651
+ };
32652
+ var getStyles = (styleSheet) => {
32653
+ if (styleSheet) {
32654
+ try {
32655
+ return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
32656
+ } catch (e) {
32657
+ console.warn(
32658
+ "Access to stylesheet %s is denied. Ignoring\u2026",
32659
+ styleSheet.href
32660
+ );
32661
+ }
32662
+ }
32663
+ return "";
32664
+ };
32665
+ var defer = (fn) => setTimeout(fn, 0);
32666
+ var CopyHostStyles = ({
32667
+ children,
32668
+ debug = false,
32669
+ onStylesLoaded = () => null
32670
+ }) => {
32671
+ const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
32672
+ (0, import_react22.useEffect)(() => {
32673
+ if (!win || !doc) {
32674
+ return () => {
32675
+ };
32676
+ }
32677
+ let elements = [];
32678
+ const hashes = {};
32679
+ const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
32680
+ const mirrorEl = (el, inlineStyles = false) => __async(void 0, null, function* () {
32681
+ let mirror;
32682
+ if (el.nodeName === "LINK" && inlineStyles) {
32683
+ mirror = document.createElement("style");
32684
+ mirror.type = "text/css";
32685
+ let styleSheet = getStyleSheet(el);
32686
+ if (!styleSheet) {
32687
+ yield new Promise((resolve) => {
32688
+ const fn = () => {
32689
+ resolve();
32690
+ el.removeEventListener("load", fn);
32691
+ };
32692
+ el.addEventListener("load", fn);
32693
+ });
32694
+ styleSheet = getStyleSheet(el);
32695
+ }
32696
+ const styles = getStyles(styleSheet);
32697
+ if (!styles) {
32698
+ if (debug) {
32699
+ console.warn(
32700
+ `Tried to load styles for link element, but couldn't find them. Skipping...`
32701
+ );
32702
+ }
32703
+ return;
32704
+ }
32705
+ mirror.innerHTML = styles;
32706
+ mirror.setAttribute("data-href", el.getAttribute("href"));
32707
+ } else {
32708
+ mirror = el.cloneNode(true);
32709
+ }
32710
+ return mirror;
32711
+ });
32712
+ const addEl = (el) => __async(void 0, null, function* () {
32713
+ const index = lookupEl(el);
32714
+ if (index > -1) {
32715
+ if (debug)
32716
+ console.log(
32717
+ `Tried to add an element that was already mirrored. Updating instead...`
32718
+ );
32719
+ elements[index].mirror.innerText = el.innerText;
32720
+ return;
32721
+ }
32722
+ const mirror = yield mirrorEl(el);
32723
+ if (!mirror) {
32724
+ return;
32725
+ }
32726
+ const elHash = (0, import_object_hash.default)(mirror.outerHTML);
32727
+ if (hashes[elHash]) {
32728
+ if (debug)
32729
+ console.log(
32730
+ `iframe already contains element that is being mirrored. Skipping...`
32731
+ );
32732
+ return;
32733
+ }
32734
+ hashes[elHash] = true;
32735
+ doc.head.append(mirror);
32736
+ elements.push({ original: el, mirror });
32737
+ if (debug)
32738
+ console.log(`Added style node ${el.outerHTML}`);
32739
+ });
32740
+ const removeEl = (el) => {
32741
+ var _a, _b;
32742
+ const index = lookupEl(el);
32743
+ if (index === -1) {
32744
+ if (debug)
32745
+ console.log(
32746
+ `Tried to remove an element that did not exist. Skipping...`
32747
+ );
32748
+ return;
32749
+ }
32750
+ const elHash = (0, import_object_hash.default)(el.outerHTML);
32751
+ (_b = (_a = elements[index]) == null ? void 0 : _a.mirror) == null ? void 0 : _b.remove();
32752
+ delete hashes[elHash];
32753
+ if (debug)
32754
+ console.log(`Removed style node ${el.outerHTML}`);
32755
+ };
32756
+ const observer = new MutationObserver((mutations) => {
32757
+ mutations.forEach((mutation) => {
32758
+ if (mutation.type === "childList") {
32759
+ mutation.addedNodes.forEach((node) => {
32760
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
32761
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
32762
+ if (el && el.matches(styleSelector)) {
32763
+ defer(() => addEl(el));
32764
+ }
32765
+ }
32766
+ });
32767
+ mutation.removedNodes.forEach((node) => {
32768
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
32769
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
32770
+ if (el && el.matches(styleSelector)) {
32771
+ defer(() => removeEl(el));
32772
+ }
32773
+ }
32774
+ });
32775
+ }
32776
+ });
32777
+ });
32778
+ const parentDocument = win.parent.document;
32779
+ const collectedStyles = collectStyles(parentDocument);
32780
+ const hrefs = [];
32781
+ let stylesLoaded = 0;
32782
+ Promise.all(
32783
+ collectedStyles.map((styleNode, i) => __async(void 0, null, function* () {
32784
+ if (styleNode.nodeName === "LINK") {
32785
+ const linkHref = styleNode.href;
32786
+ if (hrefs.indexOf(linkHref) > -1) {
32787
+ return;
32788
+ }
32789
+ hrefs.push(linkHref);
32790
+ }
32791
+ const mirror = yield mirrorEl(styleNode);
32792
+ if (!mirror)
32793
+ return;
32794
+ elements.push({ original: styleNode, mirror });
32795
+ return mirror;
32796
+ }))
32797
+ ).then((mirrorStyles) => {
32798
+ const filtered = mirrorStyles.filter(
32799
+ (el) => typeof el !== "undefined"
32800
+ );
32801
+ filtered.forEach((mirror) => {
32802
+ mirror.onload = () => {
32803
+ stylesLoaded = stylesLoaded + 1;
32804
+ if (stylesLoaded >= elements.length) {
32805
+ onStylesLoaded();
32806
+ }
32807
+ };
32808
+ });
32809
+ doc.head.innerHTML = "";
32810
+ doc.head.append(...filtered);
32811
+ observer.observe(parentDocument.head, { childList: true, subtree: true });
32812
+ filtered.forEach((el) => {
32813
+ const elHash = (0, import_object_hash.default)(el.outerHTML);
32814
+ hashes[elHash] = true;
32815
+ });
32816
+ });
32817
+ return () => {
32818
+ observer.disconnect();
32819
+ };
32820
+ }, []);
32821
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
32822
+ };
32823
+ var AutoFrameComponent = import_react22.default.forwardRef(
32824
+ function(_a, ref) {
32825
+ var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest(_b, ["children", "debug", "onStylesLoaded"]);
32826
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_frame_component.default, __spreadProps(__spreadValues({}, props), { ref, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
32827
+ }
32828
+ );
32829
+ AutoFrameComponent.displayName = "AutoFrameComponent";
32830
+ var AutoFrame_default = AutoFrameComponent;
32602
32831
 
32603
32832
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
32604
32833
  init_react_import();
32605
32834
  var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
32606
32835
 
32607
32836
  // components/Puck/components/Preview/index.tsx
32608
- var import_jsx_runtime29 = require("react/jsx-runtime");
32837
+ var import_jsx_runtime30 = require("react/jsx-runtime");
32609
32838
  var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default16);
32610
32839
  var Preview = ({ id = "puck-preview" }) => {
32611
32840
  const { config, dispatch, state, setStatus, iframe } = useAppContext();
32612
- const Page = (0, import_react22.useCallback)(
32841
+ const Page = (0, import_react23.useCallback)(
32613
32842
  (pageProps) => {
32614
32843
  var _a, _b;
32615
32844
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
@@ -32617,13 +32846,13 @@ var Preview = ({ id = "puck-preview" }) => {
32617
32846
  }, pageProps), {
32618
32847
  editMode: true,
32619
32848
  puck: { renderDropZone: DropZone }
32620
- })) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
32849
+ })) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
32621
32850
  },
32622
32851
  [config.root]
32623
32852
  );
32624
32853
  const rootProps = state.data.root.props || state.data.root;
32625
- const ref = (0, import_react22.useRef)(null);
32626
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32854
+ const ref = (0, import_react23.useRef)(null);
32855
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32627
32856
  "div",
32628
32857
  {
32629
32858
  className: getClassName21(),
@@ -32631,8 +32860,8 @@ var Preview = ({ id = "puck-preview" }) => {
32631
32860
  onClick: () => {
32632
32861
  dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
32633
32862
  },
32634
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
32635
- import_auto_frame_component.default,
32863
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
32864
+ AutoFrame_default,
32636
32865
  {
32637
32866
  id: "preview-frame",
32638
32867
  className: getClassName21("frame"),
@@ -32641,9 +32870,9 @@ var Preview = ({ id = "puck-preview" }) => {
32641
32870
  onStylesLoaded: () => {
32642
32871
  setStatus("READY");
32643
32872
  },
32644
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId }) }))
32873
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) }))
32645
32874
  }
32646
- ) : /* @__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 }) })) })
32875
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId }) })) })
32647
32876
  }
32648
32877
  );
32649
32878
  };
@@ -32691,7 +32920,7 @@ var scrollIntoView = (el) => {
32691
32920
  };
32692
32921
 
32693
32922
  // components/LayerTree/index.tsx
32694
- var import_react23 = require("react");
32923
+ var import_react24 = require("react");
32695
32924
 
32696
32925
  // lib/is-child-of-zone.ts
32697
32926
  init_react_import();
@@ -32705,7 +32934,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
32705
32934
  };
32706
32935
 
32707
32936
  // components/LayerTree/index.tsx
32708
- var import_jsx_runtime30 = require("react/jsx-runtime");
32937
+ var import_jsx_runtime31 = require("react/jsx-runtime");
32709
32938
  var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
32710
32939
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
32711
32940
  var LayerTree = ({
@@ -32718,15 +32947,15 @@ var LayerTree = ({
32718
32947
  label
32719
32948
  }) => {
32720
32949
  const zones = data.zones || {};
32721
- const ctx = (0, import_react23.useContext)(dropZoneContext);
32722
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
32723
- label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32724
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
32950
+ const ctx = (0, import_react24.useContext)(dropZoneContext);
32951
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
32952
+ label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName22("zoneTitle"), children: [
32953
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
32725
32954
  " ",
32726
32955
  label
32727
32956
  ] }),
32728
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName22(), children: [
32729
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32957
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName22(), children: [
32958
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName22("helper"), children: "No items" }),
32730
32959
  zoneContent.map((item, i) => {
32731
32960
  var _a;
32732
32961
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
@@ -32742,7 +32971,7 @@ var LayerTree = ({
32742
32971
  const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
32743
32972
  const isHovering = hoveringComponent === item.props.id;
32744
32973
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
32745
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32974
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
32746
32975
  "li",
32747
32976
  {
32748
32977
  className: getClassNameLayer({
@@ -32752,7 +32981,7 @@ var LayerTree = ({
32752
32981
  childIsSelected
32753
32982
  }),
32754
32983
  children: [
32755
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
32984
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
32756
32985
  "button",
32757
32986
  {
32758
32987
  className: getClassNameLayer("clickable"),
@@ -32784,22 +33013,22 @@ var LayerTree = ({
32784
33013
  setHoveringComponent(null);
32785
33014
  },
32786
33015
  children: [
32787
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33016
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32788
33017
  "div",
32789
33018
  {
32790
33019
  className: getClassNameLayer("chevron"),
32791
33020
  title: isSelected ? "Collapse" : "Expand",
32792
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
33021
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
32793
33022
  }
32794
33023
  ),
32795
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
32796
- /* @__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" }) }),
32797
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
33024
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
33025
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LayoutGrid, { size: "16" }) }),
33026
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a = config.components[item.type]["label"]) != null ? _a : item.type })
32798
33027
  ] })
32799
33028
  ]
32800
33029
  }
32801
33030
  ) }),
32802
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
33031
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
32803
33032
  LayerTree,
32804
33033
  {
32805
33034
  config,
@@ -32821,13 +33050,13 @@ var LayerTree = ({
32821
33050
  };
32822
33051
 
32823
33052
  // components/Puck/components/Outline/index.tsx
32824
- var import_react24 = require("react");
32825
- var import_jsx_runtime31 = require("react/jsx-runtime");
33053
+ var import_react25 = require("react");
33054
+ var import_jsx_runtime32 = require("react/jsx-runtime");
32826
33055
  var Outline = () => {
32827
33056
  const { dispatch, state, overrides, config } = useAppContext();
32828
33057
  const { data, ui } = state;
32829
33058
  const { itemSelector } = ui;
32830
- const setItemSelector = (0, import_react24.useCallback)(
33059
+ const setItemSelector = (0, import_react25.useCallback)(
32831
33060
  (newItemSelector) => {
32832
33061
  dispatch({
32833
33062
  type: "setUi",
@@ -32836,9 +33065,9 @@ var Outline = () => {
32836
33065
  },
32837
33066
  []
32838
33067
  );
32839
- const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
32840
- 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: [
32841
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
33068
+ const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
33069
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
33070
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32842
33071
  LayerTree,
32843
33072
  {
32844
33073
  config,
@@ -32851,7 +33080,7 @@ var Outline = () => {
32851
33080
  ),
32852
33081
  Object.entries(findZonesForArea(data, "root")).map(
32853
33082
  ([zoneKey, zone]) => {
32854
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
33083
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
32855
33084
  LayerTree,
32856
33085
  {
32857
33086
  config,
@@ -32936,12 +33165,12 @@ function usePuckHistory({
32936
33165
 
32937
33166
  // lib/use-history-store.ts
32938
33167
  init_react_import();
32939
- var import_react25 = require("react");
33168
+ var import_react26 = require("react");
32940
33169
  var import_use_debounce3 = require("use-debounce");
32941
33170
  var EMPTY_HISTORY_INDEX = -1;
32942
33171
  function useHistoryStore() {
32943
- const [histories, setHistories] = (0, import_react25.useState)([]);
32944
- const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
33172
+ const [histories, setHistories] = (0, import_react26.useState)([]);
33173
+ const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
32945
33174
  const hasPast = index > EMPTY_HISTORY_INDEX;
32946
33175
  const hasFuture = index < histories.length - 1;
32947
33176
  const currentHistory = histories[index];
@@ -33101,22 +33330,22 @@ var getBox = function getBox2(el) {
33101
33330
  };
33102
33331
 
33103
33332
  // components/Puck/components/Canvas/index.tsx
33104
- var import_react27 = require("react");
33333
+ var import_react28 = require("react");
33105
33334
 
33106
33335
  // components/ViewportControls/index.tsx
33107
33336
  init_react_import();
33108
- var import_react26 = require("react");
33337
+ var import_react27 = require("react");
33109
33338
 
33110
33339
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
33111
33340
  init_react_import();
33112
33341
  var styles_module_default18 = { "ViewportControls": "_ViewportControls_3zdvn_1", "ViewportControls-divider": "_ViewportControls-divider_3zdvn_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_3zdvn_21", "ViewportButton--isActive": "_ViewportButton--isActive_3zdvn_33", "ViewportButton-inner": "_ViewportButton-inner_3zdvn_33" };
33113
33342
 
33114
33343
  // components/ViewportControls/index.tsx
33115
- var import_jsx_runtime32 = require("react/jsx-runtime");
33344
+ var import_jsx_runtime33 = require("react/jsx-runtime");
33116
33345
  var icons = {
33117
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Smartphone, { size: 16 }),
33118
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tablet, { size: 16 }),
33119
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Monitor, { size: 16 })
33346
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
33347
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
33348
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
33120
33349
  };
33121
33350
  var getClassName23 = get_class_name_factory_default("ViewportControls", styles_module_default18);
33122
33351
  var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default18);
@@ -33128,11 +33357,11 @@ var ViewportButton = ({
33128
33357
  onClick
33129
33358
  }) => {
33130
33359
  const { state } = useAppContext();
33131
- const [isActive, setIsActive] = (0, import_react26.useState)(false);
33132
- (0, import_react26.useEffect)(() => {
33360
+ const [isActive, setIsActive] = (0, import_react27.useState)(false);
33361
+ (0, import_react27.useEffect)(() => {
33133
33362
  setIsActive(width === state.ui.viewports.current.width);
33134
33363
  }, [width, state.ui.viewports.current.width]);
33135
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33364
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33136
33365
  IconButton,
33137
33366
  {
33138
33367
  title,
@@ -33141,7 +33370,7 @@ var ViewportButton = ({
33141
33370
  e.stopPropagation();
33142
33371
  onClick({ width, height });
33143
33372
  },
33144
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassNameButton("inner"), children })
33373
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
33145
33374
  }
33146
33375
  ) });
33147
33376
  };
@@ -33165,7 +33394,7 @@ var ViewportControls = ({
33165
33394
  const defaultsContainAutoZoom = defaultZoomOptions.find(
33166
33395
  (option) => option.value === autoZoom
33167
33396
  );
33168
- const zoomOptions = (0, import_react26.useMemo)(
33397
+ const zoomOptions = (0, import_react27.useMemo)(
33169
33398
  () => [
33170
33399
  ...defaultZoomOptions,
33171
33400
  ...defaultsContainAutoZoom ? [] : [
@@ -33177,8 +33406,8 @@ var ViewportControls = ({
33177
33406
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
33178
33407
  [autoZoom]
33179
33408
  );
33180
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: getClassName23(), children: [
33181
- viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33409
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
33410
+ viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33182
33411
  ViewportButton,
33183
33412
  {
33184
33413
  height: viewport.height,
@@ -33189,8 +33418,8 @@ var ViewportControls = ({
33189
33418
  },
33190
33419
  i
33191
33420
  )),
33192
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33193
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33421
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
33422
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33194
33423
  IconButton,
33195
33424
  {
33196
33425
  title: "Zoom viewport out",
@@ -33204,10 +33433,10 @@ var ViewportControls = ({
33204
33433
  )].value
33205
33434
  );
33206
33435
  },
33207
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomOut, { size: 16 })
33436
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
33208
33437
  }
33209
33438
  ),
33210
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33439
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33211
33440
  IconButton,
33212
33441
  {
33213
33442
  title: "Zoom viewport in",
@@ -33221,11 +33450,11 @@ var ViewportControls = ({
33221
33450
  )].value
33222
33451
  );
33223
33452
  },
33224
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ZoomIn, { size: 16 })
33453
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
33225
33454
  }
33226
33455
  ),
33227
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: getClassName23("divider") }),
33228
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33456
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
33457
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33229
33458
  "select",
33230
33459
  {
33231
33460
  className: getClassName23("zoomSelect"),
@@ -33233,7 +33462,7 @@ var ViewportControls = ({
33233
33462
  onChange: (e) => {
33234
33463
  onZoom(parseFloat(e.currentTarget.value));
33235
33464
  },
33236
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
33465
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33237
33466
  "option",
33238
33467
  {
33239
33468
  value: option.value,
@@ -33281,24 +33510,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
33281
33510
  };
33282
33511
 
33283
33512
  // components/Puck/components/Canvas/index.tsx
33284
- var import_jsx_runtime33 = require("react/jsx-runtime");
33513
+ var import_jsx_runtime34 = require("react/jsx-runtime");
33285
33514
  var getClassName24 = get_class_name_factory_default("PuckCanvas", styles_module_default19);
33286
33515
  var ZOOM_ON_CHANGE = true;
33287
33516
  var Canvas = () => {
33288
33517
  const { status, iframe } = useAppContext();
33289
33518
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
33290
33519
  const { ui } = state;
33291
- const frameRef = (0, import_react27.useRef)(null);
33292
- const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
33293
- const defaultRender = (0, import_react27.useMemo)(() => {
33294
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
33520
+ const frameRef = (0, import_react28.useRef)(null);
33521
+ const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
33522
+ const defaultRender = (0, import_react28.useMemo)(() => {
33523
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
33295
33524
  return PuckDefault;
33296
33525
  }, []);
33297
- const CustomPreview = (0, import_react27.useMemo)(
33526
+ const CustomPreview = (0, import_react28.useMemo)(
33298
33527
  () => overrides.preview || defaultRender,
33299
33528
  [overrides]
33300
33529
  );
33301
- const getFrameDimensions = (0, import_react27.useCallback)(() => {
33530
+ const getFrameDimensions = (0, import_react28.useCallback)(() => {
33302
33531
  if (frameRef.current) {
33303
33532
  const frame = frameRef.current;
33304
33533
  const box = getBox(frame);
@@ -33306,7 +33535,7 @@ var Canvas = () => {
33306
33535
  }
33307
33536
  return { width: 0, height: 0 };
33308
33537
  }, [frameRef]);
33309
- const resetAutoZoom = (0, import_react27.useCallback)(
33538
+ const resetAutoZoom = (0, import_react28.useCallback)(
33310
33539
  (ui2 = state.ui) => {
33311
33540
  if (frameRef.current) {
33312
33541
  setZoomConfig(
@@ -33316,11 +33545,11 @@ var Canvas = () => {
33316
33545
  },
33317
33546
  [frameRef, zoomConfig, state.ui]
33318
33547
  );
33319
- (0, import_react27.useEffect)(() => {
33548
+ (0, import_react28.useEffect)(() => {
33320
33549
  setShowTransition(false);
33321
33550
  resetAutoZoom();
33322
33551
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
33323
- (0, import_react27.useEffect)(() => {
33552
+ (0, import_react28.useEffect)(() => {
33324
33553
  const { height: frameHeight } = getFrameDimensions();
33325
33554
  if (ui.viewports.current.height === "auto") {
33326
33555
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -33328,7 +33557,7 @@ var Canvas = () => {
33328
33557
  }));
33329
33558
  }
33330
33559
  }, [zoomConfig.zoom]);
33331
- (0, import_react27.useEffect)(() => {
33560
+ (0, import_react28.useEffect)(() => {
33332
33561
  const observer = new ResizeObserver(() => {
33333
33562
  setShowTransition(false);
33334
33563
  resetAutoZoom();
@@ -33340,7 +33569,7 @@ var Canvas = () => {
33340
33569
  observer.disconnect();
33341
33570
  };
33342
33571
  }, []);
33343
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
33572
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
33344
33573
  "div",
33345
33574
  {
33346
33575
  className: getClassName24({
@@ -33352,7 +33581,7 @@ var Canvas = () => {
33352
33581
  recordHistory: true
33353
33582
  }),
33354
33583
  children: [
33355
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33584
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33356
33585
  ViewportControls,
33357
33586
  {
33358
33587
  autoZoom: zoomConfig.autoZoom,
@@ -33377,7 +33606,7 @@ var Canvas = () => {
33377
33606
  }
33378
33607
  }
33379
33608
  ) }),
33380
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
33609
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33381
33610
  "div",
33382
33611
  {
33383
33612
  className: getClassName24("root"),
@@ -33389,7 +33618,7 @@ var Canvas = () => {
33389
33618
  overflow: iframe.enabled ? void 0 : "auto"
33390
33619
  },
33391
33620
  suppressHydrationWarning: true,
33392
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
33621
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
33393
33622
  }
33394
33623
  ) })
33395
33624
  ]
@@ -33398,12 +33627,12 @@ var Canvas = () => {
33398
33627
  };
33399
33628
 
33400
33629
  // components/Puck/index.tsx
33401
- var import_jsx_runtime34 = require("react/jsx-runtime");
33630
+ var import_jsx_runtime35 = require("react/jsx-runtime");
33402
33631
  var getClassName25 = get_class_name_factory_default("Puck", styles_module_default8);
33403
33632
  function Puck({
33404
33633
  children,
33405
33634
  config,
33406
- data: initialData = { content: [], root: { props: { title: "" } } },
33635
+ data: initialData = { content: [], root: {} },
33407
33636
  ui: initialUi,
33408
33637
  onChange,
33409
33638
  onPublish,
@@ -33416,15 +33645,16 @@ function Puck({
33416
33645
  viewports = defaultViewports,
33417
33646
  iframe = {
33418
33647
  enabled: true
33419
- }
33648
+ },
33649
+ dnd
33420
33650
  }) {
33421
33651
  var _a;
33422
33652
  const historyStore = useHistoryStore();
33423
- const [reducer] = (0, import_react28.useState)(
33653
+ const [reducer] = (0, import_react29.useState)(
33424
33654
  () => createReducer({ config, record: historyStore.record })
33425
33655
  );
33426
- const [initialAppState] = (0, import_react28.useState)(() => {
33427
- var _a2, _b, _c, _d;
33656
+ const [initialAppState] = (0, import_react29.useState)(() => {
33657
+ var _a2, _b, _c, _d, _e;
33428
33658
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33429
33659
  let clientUiState = {};
33430
33660
  if (typeof window !== "undefined") {
@@ -33451,8 +33681,12 @@ function Puck({
33451
33681
  };
33452
33682
  }
33453
33683
  }
33684
+ const rootProps2 = initialData.root.props || initialData.root;
33685
+ const defaultedRootProps = __spreadValues(__spreadValues({}, (_e = config.root) == null ? void 0 : _e.defaultProps), rootProps2);
33454
33686
  return __spreadProps(__spreadValues({}, defaultAppState), {
33455
- data: initialData,
33687
+ data: __spreadProps(__spreadValues({}, initialData), {
33688
+ root: defaultedRootProps
33689
+ }),
33456
33690
  ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33457
33691
  // Store categories under componentList on state to allow render functions and plugins to modify
33458
33692
  componentList: config.categories ? Object.entries(config.categories).reduce(
@@ -33471,7 +33705,7 @@ function Puck({
33471
33705
  })
33472
33706
  });
33473
33707
  });
33474
- const [appState, dispatch] = (0, import_react28.useReducer)(
33708
+ const [appState, dispatch] = (0, import_react29.useReducer)(
33475
33709
  reducer,
33476
33710
  flushZones(initialAppState)
33477
33711
  );
@@ -33482,9 +33716,9 @@ function Puck({
33482
33716
  config,
33483
33717
  dispatch
33484
33718
  );
33485
- const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
33719
+ const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
33486
33720
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
33487
- const setItemSelector = (0, import_react28.useCallback)(
33721
+ const setItemSelector = (0, import_react29.useCallback)(
33488
33722
  (newItemSelector) => {
33489
33723
  if (newItemSelector === itemSelector)
33490
33724
  return;
@@ -33497,21 +33731,21 @@ function Puck({
33497
33731
  [itemSelector]
33498
33732
  );
33499
33733
  const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
33500
- (0, import_react28.useEffect)(() => {
33734
+ (0, import_react29.useEffect)(() => {
33501
33735
  if (onChange)
33502
33736
  onChange(data);
33503
33737
  }, [data]);
33504
33738
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
33505
- const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
33739
+ const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
33506
33740
  const rootProps = data.root.props || data.root;
33507
- (0, import_react28.useEffect)(() => {
33741
+ (0, import_react29.useEffect)(() => {
33508
33742
  if (Object.keys(data.root).length > 0 && !data.root.props) {
33509
33743
  console.error(
33510
33744
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
33511
33745
  );
33512
33746
  }
33513
33747
  }, []);
33514
- const toggleSidebars = (0, import_react28.useCallback)(
33748
+ const toggleSidebars = (0, import_react29.useCallback)(
33515
33749
  (sidebar) => {
33516
33750
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
33517
33751
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -33525,7 +33759,7 @@ function Puck({
33525
33759
  },
33526
33760
  [dispatch, leftSideBarVisible, rightSideBarVisible]
33527
33761
  );
33528
- (0, import_react28.useEffect)(() => {
33762
+ (0, import_react29.useEffect)(() => {
33529
33763
  if (!window.matchMedia("(min-width: 638px)").matches) {
33530
33764
  dispatch({
33531
33765
  type: "setUi",
@@ -33548,11 +33782,11 @@ function Puck({
33548
33782
  window.removeEventListener("resize", handleResize);
33549
33783
  };
33550
33784
  }, []);
33551
- const defaultRender = (0, import_react28.useMemo)(() => {
33552
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
33785
+ const defaultRender = (0, import_react29.useMemo)(() => {
33786
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
33553
33787
  return PuckDefault;
33554
33788
  }, []);
33555
- const defaultHeaderRender = (0, import_react28.useMemo)(() => {
33789
+ const defaultHeaderRender = (0, import_react29.useMemo)(() => {
33556
33790
  if (renderHeader) {
33557
33791
  console.warn(
33558
33792
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -33560,45 +33794,45 @@ function Puck({
33560
33794
  const RenderHeader = (_a2) => {
33561
33795
  var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
33562
33796
  const Comp = renderHeader;
33563
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33797
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
33564
33798
  };
33565
33799
  return RenderHeader;
33566
33800
  }
33567
33801
  return defaultRender;
33568
33802
  }, [renderHeader]);
33569
- const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
33803
+ const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
33570
33804
  if (renderHeaderActions) {
33571
33805
  console.warn(
33572
33806
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
33573
33807
  );
33574
33808
  const RenderHeader = (props) => {
33575
33809
  const Comp = renderHeaderActions;
33576
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33810
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
33577
33811
  };
33578
33812
  return RenderHeader;
33579
33813
  }
33580
33814
  return defaultRender;
33581
33815
  }, [renderHeader]);
33582
- const loadedOverrides = (0, import_react28.useMemo)(() => {
33816
+ const loadedOverrides = (0, import_react29.useMemo)(() => {
33583
33817
  return loadOverrides({ overrides, plugins });
33584
33818
  }, [plugins]);
33585
- const CustomPuck = (0, import_react28.useMemo)(
33819
+ const CustomPuck = (0, import_react29.useMemo)(
33586
33820
  () => loadedOverrides.puck || defaultRender,
33587
33821
  [loadedOverrides]
33588
33822
  );
33589
- const CustomHeader = (0, import_react28.useMemo)(
33823
+ const CustomHeader = (0, import_react29.useMemo)(
33590
33824
  () => loadedOverrides.header || defaultHeaderRender,
33591
33825
  [loadedOverrides]
33592
33826
  );
33593
- const CustomHeaderActions = (0, import_react28.useMemo)(
33827
+ const CustomHeaderActions = (0, import_react29.useMemo)(
33594
33828
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
33595
33829
  [loadedOverrides]
33596
33830
  );
33597
- const [mounted, setMounted] = (0, import_react28.useState)(false);
33598
- (0, import_react28.useEffect)(() => {
33831
+ const [mounted, setMounted] = (0, import_react29.useState)(false);
33832
+ (0, import_react29.useEffect)(() => {
33599
33833
  setMounted(true);
33600
33834
  }, []);
33601
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33835
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33602
33836
  AppProvider,
33603
33837
  {
33604
33838
  value: {
@@ -33613,9 +33847,10 @@ function Puck({
33613
33847
  viewports,
33614
33848
  iframe
33615
33849
  },
33616
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33850
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33617
33851
  DragDropContext,
33618
33852
  {
33853
+ autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
33619
33854
  onDragUpdate: (update) => {
33620
33855
  setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
33621
33856
  onDragStartOrUpdate(update);
@@ -33668,7 +33903,7 @@ function Puck({
33668
33903
  });
33669
33904
  }
33670
33905
  },
33671
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33906
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33672
33907
  DropZoneProvider,
33673
33908
  {
33674
33909
  value: {
@@ -33682,7 +33917,7 @@ function Puck({
33682
33917
  mode: "edit",
33683
33918
  areaId: "root"
33684
33919
  },
33685
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
33920
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
33686
33921
  "div",
33687
33922
  {
33688
33923
  className: getClassName25({
@@ -33692,65 +33927,65 @@ function Puck({
33692
33927
  rightSideBarVisible
33693
33928
  }),
33694
33929
  children: [
33695
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("layout"), children: [
33696
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33930
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
33931
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33697
33932
  CustomHeader,
33698
33933
  {
33699
- actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33700
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33701
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33934
+ actions: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
33935
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
33936
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33702
33937
  Button,
33703
33938
  {
33704
33939
  onClick: () => {
33705
33940
  onPublish && onPublish(data);
33706
33941
  },
33707
- icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
33942
+ icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
33708
33943
  children: "Publish"
33709
33944
  }
33710
33945
  )
33711
33946
  ] }),
33712
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
33713
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33714
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33947
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
33948
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
33949
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33715
33950
  IconButton,
33716
33951
  {
33717
33952
  onClick: () => {
33718
33953
  toggleSidebars("left");
33719
33954
  },
33720
33955
  title: "Toggle left sidebar",
33721
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
33956
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
33722
33957
  }
33723
33958
  ) }),
33724
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33959
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33725
33960
  IconButton,
33726
33961
  {
33727
33962
  onClick: () => {
33728
33963
  toggleSidebars("right");
33729
33964
  },
33730
33965
  title: "Toggle right sidebar",
33731
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
33966
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
33732
33967
  }
33733
33968
  ) })
33734
33969
  ] }),
33735
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading, { rank: 2, size: "xs", children: [
33970
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading, { rank: 2, size: "xs", children: [
33736
33971
  headerTitle || rootProps.title || "Page",
33737
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
33972
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
33738
33973
  " ",
33739
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33974
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
33740
33975
  ] })
33741
33976
  ] }) }),
33742
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
33743
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33977
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
33978
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33744
33979
  IconButton,
33745
33980
  {
33746
33981
  onClick: () => {
33747
33982
  return setMenuOpen(!menuOpen);
33748
33983
  },
33749
33984
  title: "Toggle menu bar",
33750
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
33985
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
33751
33986
  }
33752
33987
  ) }),
33753
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
33988
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33754
33989
  MenuBar,
33755
33990
  {
33756
33991
  appState,
@@ -33758,7 +33993,7 @@ function Puck({
33758
33993
  dispatch,
33759
33994
  onPublish,
33760
33995
  menuOpen,
33761
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
33996
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
33762
33997
  setMenuOpen
33763
33998
  }
33764
33999
  )
@@ -33766,23 +34001,23 @@ function Puck({
33766
34001
  ] }) })
33767
34002
  }
33768
34003
  ),
33769
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
33770
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
33771
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
34004
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
34005
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Components, {}) }),
34006
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Outline, {}) })
33772
34007
  ] }),
33773
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
33774
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
34008
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, {}),
34009
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33775
34010
  SidebarSection,
33776
34011
  {
33777
34012
  noPadding: true,
33778
34013
  noBorderTop: true,
33779
34014
  showBreadcrumbs: true,
33780
34015
  title: selectedItem ? (_a = config.components[selectedItem.type]["label"]) != null ? _a : selectedItem.type : "Page",
33781
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
34016
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
33782
34017
  }
33783
34018
  ) })
33784
34019
  ] }),
33785
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
34020
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
33786
34021
  "div",
33787
34022
  {
33788
34023
  id: "puck-portal-root",
@@ -33806,7 +34041,7 @@ Puck.Preview = Preview;
33806
34041
 
33807
34042
  // components/Render/index.tsx
33808
34043
  init_react_import();
33809
- var import_jsx_runtime35 = require("react/jsx-runtime");
34044
+ var import_jsx_runtime36 = require("react/jsx-runtime");
33810
34045
  function Render({
33811
34046
  config,
33812
34047
  data
@@ -33815,7 +34050,7 @@ function Render({
33815
34050
  const rootProps = data.root.props || data.root;
33816
34051
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
33817
34052
  if ((_a = config.root) == null ? void 0 : _a.render) {
33818
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
34053
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
33819
34054
  config.root.render,
33820
34055
  __spreadProps(__spreadValues({}, rootProps), {
33821
34056
  puck: {
@@ -33824,11 +34059,11 @@ function Render({
33824
34059
  title,
33825
34060
  editMode: false,
33826
34061
  id: "puck-root",
33827
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId })
34062
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId })
33828
34063
  })
33829
34064
  ) });
33830
34065
  }
33831
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId }) });
34066
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId }) });
33832
34067
  }
33833
34068
 
33834
34069
  // lib/migrate.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.14.2-canary.e6e01c6",
3
+ "version": "0.14.3-canary.061cc2a",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -46,6 +46,7 @@
46
46
  "@types/jest": "^29.5.4",
47
47
  "@types/react": "^18.2.0",
48
48
  "@types/react-dom": "^18.2.0",
49
+ "@types/ua-parser-js": "^0.7.39",
49
50
  "css-box-model": "^1.2.1",
50
51
  "eslint": "^7.32.0",
51
52
  "eslint-config-custom": "*",
@@ -59,11 +60,13 @@
59
60
  "typescript": "^4.5.2"
60
61
  },
61
62
  "dependencies": {
62
- "@measured/auto-frame-component": "0.1.1",
63
- "@measured/dnd": "16.6.0-canary.f472135",
63
+ "@measured/dnd": "16.6.0-canary.4cba1d1",
64
64
  "deep-diff": "^1.0.2",
65
+ "object-hash": "^3.0.0",
66
+ "react-frame-component": "^5.2.6",
65
67
  "react-hotkeys-hook": "^4.4.1",
66
68
  "react-spinners": "^0.13.8",
69
+ "ua-parser-js": "^1.0.37",
67
70
  "use-debounce": "^9.0.4",
68
71
  "uuid": "^9.0.1"
69
72
  },