@measured/puck-plugin-heading-analyzer 0.14.2 → 0.14.3-canary.5c8c0e1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -45807,292 +45807,6 @@ var require_object_hash = __commonJS({
45807
45807
  }
45808
45808
  });
45809
45809
 
45810
- // ../../node_modules/@measured/auto-frame-component/dist/index.js
45811
- var require_dist = __commonJS({
45812
- "../../node_modules/@measured/auto-frame-component/dist/index.js"(exports, module2) {
45813
- "use strict";
45814
- init_react_import();
45815
- var __create2 = Object.create;
45816
- var __defProp2 = Object.defineProperty;
45817
- var __defProps2 = Object.defineProperties;
45818
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
45819
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
45820
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
45821
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
45822
- var __getProtoOf2 = Object.getPrototypeOf;
45823
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
45824
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
45825
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45826
- var __spreadValues2 = (a2, b) => {
45827
- for (var prop in b || (b = {}))
45828
- if (__hasOwnProp2.call(b, prop))
45829
- __defNormalProp2(a2, prop, b[prop]);
45830
- if (__getOwnPropSymbols2)
45831
- for (var prop of __getOwnPropSymbols2(b)) {
45832
- if (__propIsEnum2.call(b, prop))
45833
- __defNormalProp2(a2, prop, b[prop]);
45834
- }
45835
- return a2;
45836
- };
45837
- var __spreadProps2 = (a2, b) => __defProps2(a2, __getOwnPropDescs2(b));
45838
- var __objRest2 = (source, exclude) => {
45839
- var target = {};
45840
- for (var prop in source)
45841
- if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
45842
- target[prop] = source[prop];
45843
- if (source != null && __getOwnPropSymbols2)
45844
- for (var prop of __getOwnPropSymbols2(source)) {
45845
- if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
45846
- target[prop] = source[prop];
45847
- }
45848
- return target;
45849
- };
45850
- var __export2 = (target, all) => {
45851
- for (var name in all)
45852
- __defProp2(target, name, { get: all[name], enumerable: true });
45853
- };
45854
- var __copyProps2 = (to, from, except, desc) => {
45855
- if (from && typeof from === "object" || typeof from === "function") {
45856
- for (let key of __getOwnPropNames2(from))
45857
- if (!__hasOwnProp2.call(to, key) && key !== except)
45858
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
45859
- }
45860
- return to;
45861
- };
45862
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
45863
- // If the importer is in node compatibility mode or this is not an ESM
45864
- // file that has been converted to a CommonJS file using a Babel-
45865
- // compatible transform (i.e. "__esModule" has not been set), then set
45866
- // "default" to the CommonJS "module.exports" for node compatibility.
45867
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
45868
- mod
45869
- ));
45870
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
45871
- var __async2 = (__this, __arguments, generator) => {
45872
- return new Promise((resolve, reject) => {
45873
- var fulfilled = (value) => {
45874
- try {
45875
- step(generator.next(value));
45876
- } catch (e2) {
45877
- reject(e2);
45878
- }
45879
- };
45880
- var rejected = (value) => {
45881
- try {
45882
- step(generator.throw(value));
45883
- } catch (e2) {
45884
- reject(e2);
45885
- }
45886
- };
45887
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45888
- step((generator = generator.apply(__this, __arguments)).next());
45889
- });
45890
- };
45891
- var auto_frame_component_exports = {};
45892
- __export2(auto_frame_component_exports, {
45893
- default: () => AutoFrameComponent_default
45894
- });
45895
- module2.exports = __toCommonJS2(auto_frame_component_exports);
45896
- var import_react13 = __toESM2(require("react"));
45897
- var import_react22 = __toESM2(require("react"));
45898
- var import_react_frame_component = __toESM2(require_lib());
45899
- var import_object_hash = __toESM2(require_object_hash());
45900
- var import_jsx_runtime8 = require("react/jsx-runtime");
45901
- var styleSelector = 'style, link[as="style"], link[rel="stylesheet"]';
45902
- var collectStyles = (doc) => {
45903
- const collected = [];
45904
- doc.head.querySelectorAll(styleSelector).forEach((style2) => {
45905
- collected.push(style2);
45906
- });
45907
- return collected;
45908
- };
45909
- var getStyleSheet = (el) => {
45910
- return Array.from(document.styleSheets).find((ss) => {
45911
- const ownerNode = ss.ownerNode;
45912
- return ownerNode.href === el.href;
45913
- });
45914
- };
45915
- var getStyles2 = (styleSheet) => {
45916
- if (styleSheet) {
45917
- try {
45918
- return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
45919
- } catch (e2) {
45920
- console.warn(
45921
- "Access to stylesheet %s is denied. Ignoring\u2026",
45922
- styleSheet.href
45923
- );
45924
- }
45925
- }
45926
- return "";
45927
- };
45928
- var defer = (fn) => setTimeout(fn, 0);
45929
- var CopyHostStyles = ({
45930
- children,
45931
- debug = false,
45932
- onStylesLoaded = () => null
45933
- }) => {
45934
- const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
45935
- (0, import_react22.useEffect)(() => {
45936
- if (!win || !doc) {
45937
- return () => {
45938
- };
45939
- }
45940
- let elements = [];
45941
- const hashes = {};
45942
- const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
45943
- const mirrorEl = (el, onLoad = () => {
45944
- }) => __async2(void 0, null, function* () {
45945
- let mirror;
45946
- if (el.nodeName === "LINK") {
45947
- mirror = document.createElement("style");
45948
- mirror.type = "text/css";
45949
- let styleSheet = getStyleSheet(el);
45950
- if (!styleSheet) {
45951
- yield new Promise((resolve) => {
45952
- const fn = () => {
45953
- resolve();
45954
- el.removeEventListener("load", fn);
45955
- };
45956
- el.addEventListener("load", fn);
45957
- });
45958
- styleSheet = getStyleSheet(el);
45959
- }
45960
- const styles = getStyles2(styleSheet);
45961
- if (!styles) {
45962
- if (debug) {
45963
- console.warn(
45964
- `Tried to load styles for link element, but couldn't find them. Skipping...`
45965
- );
45966
- }
45967
- return;
45968
- }
45969
- mirror.innerHTML = styles;
45970
- mirror.setAttribute("data-href", el.getAttribute("href"));
45971
- } else {
45972
- mirror = el.cloneNode(true);
45973
- }
45974
- mirror.onload = onLoad;
45975
- return mirror;
45976
- });
45977
- const addEl = (el, onLoad = () => {
45978
- }) => __async2(void 0, null, function* () {
45979
- const index = lookupEl(el);
45980
- if (index > -1) {
45981
- if (debug)
45982
- console.log(
45983
- `Tried to add an element that was already mirrored. Updating instead...`
45984
- );
45985
- elements[index].mirror.innerText = el.innerText;
45986
- onLoad();
45987
- return;
45988
- }
45989
- const mirror = yield mirrorEl(el, onLoad);
45990
- if (!mirror) {
45991
- onLoad();
45992
- return;
45993
- }
45994
- const elHash = (0, import_object_hash.default)(mirror.outerHTML);
45995
- if (hashes[elHash]) {
45996
- if (debug)
45997
- console.log(
45998
- `iframe already contains element that is being mirrored. Skipping...`
45999
- );
46000
- onLoad();
46001
- return;
46002
- }
46003
- hashes[elHash] = true;
46004
- mirror.onload = onLoad;
46005
- doc.head.append(mirror);
46006
- elements.push({ original: el, mirror });
46007
- if (debug)
46008
- console.log(`Added style node ${el.outerHTML}`);
46009
- });
46010
- const removeEl = (el) => {
46011
- var _a3, _b;
46012
- const index = lookupEl(el);
46013
- if (index === -1) {
46014
- if (debug)
46015
- console.log(
46016
- `Tried to remove an element that did not exist. Skipping...`
46017
- );
46018
- return;
46019
- }
46020
- const elHash = (0, import_object_hash.default)(el.outerHTML);
46021
- (_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
46022
- delete hashes[elHash];
46023
- if (debug)
46024
- console.log(`Removed style node ${el.outerHTML}`);
46025
- };
46026
- const observer = new MutationObserver((mutations) => {
46027
- mutations.forEach((mutation) => {
46028
- if (mutation.type === "childList") {
46029
- mutation.addedNodes.forEach((node) => {
46030
- if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
46031
- const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
46032
- if (el && el.matches(styleSelector)) {
46033
- defer(() => addEl(el));
46034
- }
46035
- }
46036
- });
46037
- mutation.removedNodes.forEach((node) => {
46038
- if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
46039
- const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
46040
- if (el && el.matches(styleSelector)) {
46041
- defer(() => removeEl(el));
46042
- }
46043
- }
46044
- });
46045
- }
46046
- });
46047
- });
46048
- const parentDocument = win.parent.document;
46049
- const collectedStyles = collectStyles(parentDocument);
46050
- const hrefs = [];
46051
- Promise.all(
46052
- collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
46053
- if (styleNode.nodeName === "LINK") {
46054
- const linkHref = styleNode.href;
46055
- if (hrefs.indexOf(linkHref) > -1) {
46056
- return;
46057
- }
46058
- hrefs.push(linkHref);
46059
- }
46060
- const mirror = yield mirrorEl(styleNode);
46061
- if (!mirror)
46062
- return;
46063
- elements.push({ original: styleNode, mirror });
46064
- return mirror;
46065
- }))
46066
- ).then((mirrorStyles) => {
46067
- const filtered = mirrorStyles.filter(
46068
- (el) => typeof el !== "undefined"
46069
- );
46070
- doc.head.innerHTML = "";
46071
- doc.head.append(...filtered);
46072
- observer.observe(parentDocument.head, { childList: true, subtree: true });
46073
- filtered.forEach((el) => {
46074
- const elHash = (0, import_object_hash.default)(el.outerHTML);
46075
- hashes[elHash] = true;
46076
- });
46077
- onStylesLoaded();
46078
- });
46079
- return () => {
46080
- observer.disconnect();
46081
- };
46082
- }, []);
46083
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
46084
- };
46085
- var AutoFrameComponent = import_react22.default.forwardRef(
46086
- function(_a3, ref2) {
46087
- var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
46088
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_frame_component.default, __spreadProps2(__spreadValues2({}, props), { ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
46089
- }
46090
- );
46091
- AutoFrameComponent.displayName = "AutoFrameComponent";
46092
- var AutoFrameComponent_default = AutoFrameComponent;
46093
- }
46094
- });
46095
-
46096
45810
  // ../../node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js
46097
45811
  var react_hotkeys_hook_esm_exports = {};
46098
45812
  __export(react_hotkeys_hook_esm_exports, {
@@ -46562,7 +46276,7 @@ var init_react_hotkeys_hook_esm = __esm({
46562
46276
  });
46563
46277
 
46564
46278
  // ../core/dist/index.js
46565
- var require_dist2 = __commonJS({
46279
+ var require_dist = __commonJS({
46566
46280
  "../core/dist/index.js"(exports, module2) {
46567
46281
  "use strict";
46568
46282
  init_react_import();
@@ -54586,9 +54300,9 @@ var require_dist2 = __commonJS({
54586
54300
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
54587
54301
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
54588
54302
  }
54589
- var React210 = require("react");
54303
+ var React32 = require("react");
54590
54304
  var Scheduler = require_scheduler2();
54591
- var ReactSharedInternals = React210.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
54305
+ var ReactSharedInternals = React32.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
54592
54306
  var suppressWarning = false;
54593
54307
  function setSuppressWarning(newSuppressWarning) {
54594
54308
  {
@@ -54637,7 +54351,7 @@ var require_dist2 = __commonJS({
54637
54351
  var HostPortal = 4;
54638
54352
  var HostComponent = 5;
54639
54353
  var HostText = 6;
54640
- var Fragment17 = 7;
54354
+ var Fragment18 = 7;
54641
54355
  var Mode = 8;
54642
54356
  var ContextConsumer = 9;
54643
54357
  var ContextProvider = 10;
@@ -55793,7 +55507,7 @@ var require_dist2 = __commonJS({
55793
55507
  return "DehydratedFragment";
55794
55508
  case ForwardRef:
55795
55509
  return getWrappedName$1(type, type.render, "ForwardRef");
55796
- case Fragment17:
55510
+ case Fragment18:
55797
55511
  return "Fragment";
55798
55512
  case HostComponent:
55799
55513
  return type;
@@ -56193,7 +55907,7 @@ var require_dist2 = __commonJS({
56193
55907
  {
56194
55908
  if (props.value == null) {
56195
55909
  if (typeof props.children === "object" && props.children !== null) {
56196
- React210.Children.forEach(props.children, function(child) {
55910
+ React32.Children.forEach(props.children, function(child) {
56197
55911
  if (child == null) {
56198
55912
  return;
56199
55913
  }
@@ -64640,7 +64354,7 @@ var require_dist2 = __commonJS({
64640
64354
  }
64641
64355
  }
64642
64356
  var fakeInternalInstance = {};
64643
- var emptyRefsObject = new React210.Component().refs;
64357
+ var emptyRefsObject = new React32.Component().refs;
64644
64358
  var didWarnAboutStateAssignmentForComponent;
64645
64359
  var didWarnAboutUninitializedState;
64646
64360
  var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
@@ -65464,7 +65178,7 @@ var require_dist2 = __commonJS({
65464
65178
  }
65465
65179
  }
65466
65180
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
65467
- if (current2 === null || current2.tag !== Fragment17) {
65181
+ if (current2 === null || current2.tag !== Fragment18) {
65468
65182
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
65469
65183
  created.return = returnFiber;
65470
65184
  return created;
@@ -65867,7 +65581,7 @@ var require_dist2 = __commonJS({
65867
65581
  if (child.key === key) {
65868
65582
  var elementType = element.type;
65869
65583
  if (elementType === REACT_FRAGMENT_TYPE) {
65870
- if (child.tag === Fragment17) {
65584
+ if (child.tag === Fragment18) {
65871
65585
  deleteRemainingChildren(returnFiber, child.sibling);
65872
65586
  var existing = useFiber(child, element.props.children);
65873
65587
  existing.return = returnFiber;
@@ -70042,7 +69756,7 @@ var require_dist2 = __commonJS({
70042
69756
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
70043
69757
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
70044
69758
  }
70045
- case Fragment17:
69759
+ case Fragment18:
70046
69760
  return updateFragment(current2, workInProgress2, renderLanes2);
70047
69761
  case Mode:
70048
69762
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -70315,7 +70029,7 @@ var require_dist2 = __commonJS({
70315
70029
  case SimpleMemoComponent:
70316
70030
  case FunctionComponent:
70317
70031
  case ForwardRef:
70318
- case Fragment17:
70032
+ case Fragment18:
70319
70033
  case Mode:
70320
70034
  case Profiler:
70321
70035
  case ContextConsumer:
@@ -74574,7 +74288,7 @@ var require_dist2 = __commonJS({
74574
74288
  return fiber;
74575
74289
  }
74576
74290
  function createFiberFromFragment(elements, mode, lanes, key) {
74577
- var fiber = createFiber(Fragment17, elements, key, mode);
74291
+ var fiber = createFiber(Fragment18, elements, key, mode);
74578
74292
  fiber.lanes = lanes;
74579
74293
  return fiber;
74580
74294
  }
@@ -75833,7 +75547,7 @@ var require_dist2 = __commonJS({
75833
75547
  var import_ua_parser_js2 = require_ua_parser();
75834
75548
  var import_jsx_runtime22 = require("react/jsx-runtime");
75835
75549
  var defaultAppState2 = {
75836
- data: { content: [], root: { props: { title: "" } } },
75550
+ data: { content: [], root: { props: {} } },
75837
75551
  ui: {
75838
75552
  leftSideBarVisible: true,
75839
75553
  rightSideBarVisible: true,
@@ -76931,7 +76645,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
76931
76645
  return el;
76932
76646
  };
76933
76647
  init_react_import2();
76934
- var import_react28 = require("react");
76648
+ var import_react29 = require("react");
76935
76649
  init_react_import2();
76936
76650
  var import_react112 = require("react");
76937
76651
  init_react_import2();
@@ -77562,7 +77276,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77562
77276
  const [componentState, setComponentState] = (0, import_react132.useState)({});
77563
77277
  const deferredSetStates = {};
77564
77278
  const setComponentLoading = (0, import_react132.useCallback)(
77565
- (id, loading, defer = 0) => {
77279
+ (id, loading, defer2 = 0) => {
77566
77280
  if (deferredSetStates[id]) {
77567
77281
  clearTimeout(deferredSetStates[id]);
77568
77282
  delete deferredSetStates[id];
@@ -77572,7 +77286,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77572
77286
  [id]: __spreadProps2(__spreadValues2({}, prev[id]), { loading })
77573
77287
  }));
77574
77288
  delete deferredSetStates[id];
77575
- }, defer);
77289
+ }, defer2);
77576
77290
  },
77577
77291
  []
77578
77292
  );
@@ -77652,7 +77366,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77652
77366
  var getClassName9 = get_class_name_factory_default2("MenuBar", styles_module_default7);
77653
77367
  var MenuBar = ({
77654
77368
  appState,
77655
- data = { content: [], root: { props: { title: "" } } },
77369
+ data = { content: [], root: {} },
77656
77370
  dispatch,
77657
77371
  menuOpen = false,
77658
77372
  onPublish,
@@ -78894,15 +78608,212 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78894
78608
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
78895
78609
  };
78896
78610
  init_react_import2();
78897
- var import_react222 = require("react");
78898
- var import_auto_frame_component = __toESM2(require_dist());
78611
+ var import_react23 = require("react");
78899
78612
  init_react_import2();
78900
- var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
78613
+ var import_react222 = __toESM2(require("react"));
78614
+ var import_react_frame_component = __toESM2(require_lib());
78615
+ var import_object_hash = __toESM2(require_object_hash());
78901
78616
  var import_jsx_runtime29 = require("react/jsx-runtime");
78617
+ var styleSelector = 'style, link[rel="stylesheet"]';
78618
+ var collectStyles = (doc) => {
78619
+ const collected = [];
78620
+ doc.head.querySelectorAll(styleSelector).forEach((style2) => {
78621
+ collected.push(style2);
78622
+ });
78623
+ return collected;
78624
+ };
78625
+ var getStyleSheet = (el) => {
78626
+ return Array.from(document.styleSheets).find((ss) => {
78627
+ const ownerNode = ss.ownerNode;
78628
+ return ownerNode.href === el.href;
78629
+ });
78630
+ };
78631
+ var getStyles2 = (styleSheet) => {
78632
+ if (styleSheet) {
78633
+ try {
78634
+ return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
78635
+ } catch (e2) {
78636
+ console.warn(
78637
+ "Access to stylesheet %s is denied. Ignoring\u2026",
78638
+ styleSheet.href
78639
+ );
78640
+ }
78641
+ }
78642
+ return "";
78643
+ };
78644
+ var defer = (fn) => setTimeout(fn, 0);
78645
+ var CopyHostStyles = ({
78646
+ children,
78647
+ debug = false,
78648
+ onStylesLoaded = () => null
78649
+ }) => {
78650
+ const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
78651
+ (0, import_react222.useEffect)(() => {
78652
+ if (!win || !doc) {
78653
+ return () => {
78654
+ };
78655
+ }
78656
+ let elements = [];
78657
+ const hashes = {};
78658
+ const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
78659
+ const mirrorEl = (el, inlineStyles = false) => __async2(void 0, null, function* () {
78660
+ let mirror;
78661
+ if (el.nodeName === "LINK" && inlineStyles) {
78662
+ mirror = document.createElement("style");
78663
+ mirror.type = "text/css";
78664
+ let styleSheet = getStyleSheet(el);
78665
+ if (!styleSheet) {
78666
+ yield new Promise((resolve) => {
78667
+ const fn = () => {
78668
+ resolve();
78669
+ el.removeEventListener("load", fn);
78670
+ };
78671
+ el.addEventListener("load", fn);
78672
+ });
78673
+ styleSheet = getStyleSheet(el);
78674
+ }
78675
+ const styles = getStyles2(styleSheet);
78676
+ if (!styles) {
78677
+ if (debug) {
78678
+ console.warn(
78679
+ `Tried to load styles for link element, but couldn't find them. Skipping...`
78680
+ );
78681
+ }
78682
+ return;
78683
+ }
78684
+ mirror.innerHTML = styles;
78685
+ mirror.setAttribute("data-href", el.getAttribute("href"));
78686
+ } else {
78687
+ mirror = el.cloneNode(true);
78688
+ }
78689
+ return mirror;
78690
+ });
78691
+ const addEl = (el) => __async2(void 0, null, function* () {
78692
+ const index = lookupEl(el);
78693
+ if (index > -1) {
78694
+ if (debug)
78695
+ console.log(
78696
+ `Tried to add an element that was already mirrored. Updating instead...`
78697
+ );
78698
+ elements[index].mirror.innerText = el.innerText;
78699
+ return;
78700
+ }
78701
+ const mirror = yield mirrorEl(el);
78702
+ if (!mirror) {
78703
+ return;
78704
+ }
78705
+ const elHash = (0, import_object_hash.default)(mirror.outerHTML);
78706
+ if (hashes[elHash]) {
78707
+ if (debug)
78708
+ console.log(
78709
+ `iframe already contains element that is being mirrored. Skipping...`
78710
+ );
78711
+ return;
78712
+ }
78713
+ hashes[elHash] = true;
78714
+ doc.head.append(mirror);
78715
+ elements.push({ original: el, mirror });
78716
+ if (debug)
78717
+ console.log(`Added style node ${el.outerHTML}`);
78718
+ });
78719
+ const removeEl = (el) => {
78720
+ var _a3, _b;
78721
+ const index = lookupEl(el);
78722
+ if (index === -1) {
78723
+ if (debug)
78724
+ console.log(
78725
+ `Tried to remove an element that did not exist. Skipping...`
78726
+ );
78727
+ return;
78728
+ }
78729
+ const elHash = (0, import_object_hash.default)(el.outerHTML);
78730
+ (_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
78731
+ delete hashes[elHash];
78732
+ if (debug)
78733
+ console.log(`Removed style node ${el.outerHTML}`);
78734
+ };
78735
+ const observer = new MutationObserver((mutations) => {
78736
+ mutations.forEach((mutation) => {
78737
+ if (mutation.type === "childList") {
78738
+ mutation.addedNodes.forEach((node) => {
78739
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
78740
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
78741
+ if (el && el.matches(styleSelector)) {
78742
+ defer(() => addEl(el));
78743
+ }
78744
+ }
78745
+ });
78746
+ mutation.removedNodes.forEach((node) => {
78747
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
78748
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
78749
+ if (el && el.matches(styleSelector)) {
78750
+ defer(() => removeEl(el));
78751
+ }
78752
+ }
78753
+ });
78754
+ }
78755
+ });
78756
+ });
78757
+ const parentDocument = win.parent.document;
78758
+ const collectedStyles = collectStyles(parentDocument);
78759
+ const hrefs = [];
78760
+ let stylesLoaded = 0;
78761
+ Promise.all(
78762
+ collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
78763
+ if (styleNode.nodeName === "LINK") {
78764
+ const linkHref = styleNode.href;
78765
+ if (hrefs.indexOf(linkHref) > -1) {
78766
+ return;
78767
+ }
78768
+ hrefs.push(linkHref);
78769
+ }
78770
+ const mirror = yield mirrorEl(styleNode);
78771
+ if (!mirror)
78772
+ return;
78773
+ elements.push({ original: styleNode, mirror });
78774
+ return mirror;
78775
+ }))
78776
+ ).then((mirrorStyles) => {
78777
+ const filtered = mirrorStyles.filter(
78778
+ (el) => typeof el !== "undefined"
78779
+ );
78780
+ filtered.forEach((mirror) => {
78781
+ mirror.onload = () => {
78782
+ stylesLoaded = stylesLoaded + 1;
78783
+ if (stylesLoaded >= elements.length) {
78784
+ onStylesLoaded();
78785
+ }
78786
+ };
78787
+ });
78788
+ doc.head.innerHTML = "";
78789
+ doc.head.append(...filtered);
78790
+ observer.observe(parentDocument.head, { childList: true, subtree: true });
78791
+ filtered.forEach((el) => {
78792
+ const elHash = (0, import_object_hash.default)(el.outerHTML);
78793
+ hashes[elHash] = true;
78794
+ });
78795
+ });
78796
+ return () => {
78797
+ observer.disconnect();
78798
+ };
78799
+ }, []);
78800
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
78801
+ };
78802
+ var AutoFrameComponent = import_react222.default.forwardRef(
78803
+ function(_a3, ref2) {
78804
+ var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
78805
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_frame_component.default, __spreadProps2(__spreadValues2({}, props), { ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
78806
+ }
78807
+ );
78808
+ AutoFrameComponent.displayName = "AutoFrameComponent";
78809
+ var AutoFrame_default = AutoFrameComponent;
78810
+ init_react_import2();
78811
+ var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
78812
+ var import_jsx_runtime30 = require("react/jsx-runtime");
78902
78813
  var getClassName21 = get_class_name_factory_default2("PuckPreview", styles_module_default16);
78903
78814
  var Preview = ({ id = "puck-preview" }) => {
78904
78815
  const { config, dispatch, state, setStatus, iframe } = useAppContext2();
78905
- const Page = (0, import_react222.useCallback)(
78816
+ const Page = (0, import_react23.useCallback)(
78906
78817
  (pageProps) => {
78907
78818
  var _a3, _b;
78908
78819
  return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps2(__spreadValues2({
@@ -78910,13 +78821,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78910
78821
  }, pageProps), {
78911
78822
  editMode: true,
78912
78823
  puck: { renderDropZone: DropZone }
78913
- })) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
78824
+ })) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
78914
78825
  },
78915
78826
  [config.root]
78916
78827
  );
78917
78828
  const rootProps = state.data.root.props || state.data.root;
78918
- const ref2 = (0, import_react222.useRef)(null);
78919
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
78829
+ const ref2 = (0, import_react23.useRef)(null);
78830
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
78920
78831
  "div",
78921
78832
  {
78922
78833
  className: getClassName21(),
@@ -78924,8 +78835,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78924
78835
  onClick: () => {
78925
78836
  dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
78926
78837
  },
78927
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
78928
- import_auto_frame_component.default,
78838
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
78839
+ AutoFrame_default,
78929
78840
  {
78930
78841
  id: "preview-frame",
78931
78842
  className: getClassName21("frame"),
@@ -78934,9 +78845,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78934
78845
  onStylesLoaded: () => {
78935
78846
  setStatus("READY");
78936
78847
  },
78937
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId2 }) }))
78848
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId2 }) }))
78938
78849
  }
78939
- ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId2 }) })) })
78850
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { id: "preview-frame", className: getClassName21("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId2 }) })) })
78940
78851
  }
78941
78852
  );
78942
78853
  };
@@ -78968,7 +78879,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78968
78879
  el.style.scrollMargin = oldStyle.scrollMargin || "";
78969
78880
  }
78970
78881
  };
78971
- var import_react23 = require("react");
78882
+ var import_react24 = require("react");
78972
78883
  init_react_import2();
78973
78884
  var isChildOfZone = (item, maybeChild, ctx) => {
78974
78885
  var _a3;
@@ -78978,7 +78889,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78978
78889
  return area === item.props.id;
78979
78890
  })) : false;
78980
78891
  };
78981
- var import_jsx_runtime30 = require("react/jsx-runtime");
78892
+ var import_jsx_runtime31 = require("react/jsx-runtime");
78982
78893
  var getClassName222 = get_class_name_factory_default2("LayerTree", styles_module_default17);
78983
78894
  var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default17);
78984
78895
  var LayerTree = ({
@@ -78991,15 +78902,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78991
78902
  label
78992
78903
  }) => {
78993
78904
  const zones = data.zones || {};
78994
- const ctx = (0, import_react23.useContext)(dropZoneContext2);
78995
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
78996
- label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassName222("zoneTitle"), children: [
78997
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName222("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Layers, { size: "16" }) }),
78905
+ const ctx = (0, import_react24.useContext)(dropZoneContext2);
78906
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
78907
+ label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName222("zoneTitle"), children: [
78908
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
78998
78909
  " ",
78999
78910
  label
79000
78911
  ] }),
79001
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("ul", { className: getClassName222(), children: [
79002
- zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassName222("helper"), children: "No items" }),
78912
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName222(), children: [
78913
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("helper"), children: "No items" }),
79003
78914
  zoneContent.map((item, i2) => {
79004
78915
  var _a3;
79005
78916
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
@@ -79015,7 +78926,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79015
78926
  const selectedItem = itemSelector && data ? getItem2(itemSelector, data) : null;
79016
78927
  const isHovering = hoveringComponent === item.props.id;
79017
78928
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
79018
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
78929
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
79019
78930
  "li",
79020
78931
  {
79021
78932
  className: getClassNameLayer({
@@ -79025,7 +78936,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79025
78936
  childIsSelected
79026
78937
  }),
79027
78938
  children: [
79028
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
78939
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
79029
78940
  "button",
79030
78941
  {
79031
78942
  className: getClassNameLayer("clickable"),
@@ -79057,22 +78968,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79057
78968
  setHoveringComponent(null);
79058
78969
  },
79059
78970
  children: [
79060
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
78971
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
79061
78972
  "div",
79062
78973
  {
79063
78974
  className: getClassNameLayer("chevron"),
79064
78975
  title: isSelected ? "Collapse" : "Expand",
79065
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
78976
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
79066
78977
  }
79067
78978
  ),
79068
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: getClassNameLayer("title"), children: [
79069
- /* @__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" }) }),
79070
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("name"), children: (_a3 = config.components[item.type]["label"]) != null ? _a3 : item.type })
78979
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
78980
+ /* @__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" }) }),
78981
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a3 = config.components[item.type]["label"]) != null ? _a3 : item.type })
79071
78982
  ] })
79072
78983
  ]
79073
78984
  }
79074
78985
  ) }),
79075
- containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
78986
+ containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
79076
78987
  LayerTree,
79077
78988
  {
79078
78989
  config,
@@ -79092,13 +79003,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79092
79003
  ] })
79093
79004
  ] });
79094
79005
  };
79095
- var import_react24 = require("react");
79096
- var import_jsx_runtime31 = require("react/jsx-runtime");
79006
+ var import_react25 = require("react");
79007
+ var import_jsx_runtime322 = require("react/jsx-runtime");
79097
79008
  var Outline = () => {
79098
79009
  const { dispatch, state, overrides, config } = useAppContext2();
79099
79010
  const { data, ui } = state;
79100
79011
  const { itemSelector } = ui;
79101
- const setItemSelector = (0, import_react24.useCallback)(
79012
+ const setItemSelector = (0, import_react25.useCallback)(
79102
79013
  (newItemSelector) => {
79103
79014
  dispatch({
79104
79015
  type: "setUi",
@@ -79107,9 +79018,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79107
79018
  },
79108
79019
  []
79109
79020
  );
79110
- const Wrapper = (0, import_react24.useMemo)(() => overrides.outline || "div", [overrides]);
79111
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(dropZoneContext2.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
79112
- (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
79021
+ const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
79022
+ return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(dropZoneContext2.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(import_jsx_runtime322.Fragment, { children: [
79023
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79113
79024
  LayerTree,
79114
79025
  {
79115
79026
  config,
@@ -79122,7 +79033,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79122
79033
  ),
79123
79034
  Object.entries(findZonesForArea(data, "root")).map(
79124
79035
  ([zoneKey, zone]) => {
79125
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
79036
+ return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79126
79037
  LayerTree,
79127
79038
  {
79128
79039
  config,
@@ -79201,12 +79112,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79201
79112
  };
79202
79113
  }
79203
79114
  init_react_import2();
79204
- var import_react25 = require("react");
79115
+ var import_react26 = require("react");
79205
79116
  var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
79206
79117
  var EMPTY_HISTORY_INDEX = -1;
79207
79118
  function useHistoryStore() {
79208
- const [histories, setHistories] = (0, import_react25.useState)([]);
79209
- const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
79119
+ const [histories, setHistories] = (0, import_react26.useState)([]);
79120
+ const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
79210
79121
  const hasPast = index > EMPTY_HISTORY_INDEX;
79211
79122
  const hasFuture = index < histories.length - 1;
79212
79123
  const currentHistory = histories[index];
@@ -79356,16 +79267,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79356
79267
  var styles = window.getComputedStyle(el);
79357
79268
  return calculateBox3(borderBox, styles);
79358
79269
  };
79359
- var import_react27 = require("react");
79270
+ var import_react28 = require("react");
79360
79271
  init_react_import2();
79361
- var import_react26 = require("react");
79272
+ var import_react27 = require("react");
79362
79273
  init_react_import2();
79363
79274
  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" };
79364
- var import_jsx_runtime322 = require("react/jsx-runtime");
79275
+ var import_jsx_runtime33 = require("react/jsx-runtime");
79365
79276
  var icons = {
79366
- Smartphone: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Smartphone, { size: 16 }),
79367
- Tablet: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Tablet, { size: 16 }),
79368
- Monitor: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(Monitor, { size: 16 })
79277
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
79278
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
79279
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
79369
79280
  };
79370
79281
  var getClassName23 = get_class_name_factory_default2("ViewportControls", styles_module_default18);
79371
79282
  var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default18);
@@ -79377,11 +79288,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79377
79288
  onClick
79378
79289
  }) => {
79379
79290
  const { state } = useAppContext2();
79380
- const [isActive2, setIsActive] = (0, import_react26.useState)(false);
79381
- (0, import_react26.useEffect)(() => {
79291
+ const [isActive2, setIsActive] = (0, import_react27.useState)(false);
79292
+ (0, import_react27.useEffect)(() => {
79382
79293
  setIsActive(width === state.ui.viewports.current.width);
79383
79294
  }, [width, state.ui.viewports.current.width]);
79384
- return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79295
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79385
79296
  IconButton,
79386
79297
  {
79387
79298
  title,
@@ -79390,7 +79301,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79390
79301
  e2.stopPropagation();
79391
79302
  onClick({ width, height });
79392
79303
  },
79393
- children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("span", { className: getClassNameButton("inner"), children })
79304
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
79394
79305
  }
79395
79306
  ) });
79396
79307
  };
@@ -79414,7 +79325,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79414
79325
  const defaultsContainAutoZoom = defaultZoomOptions.find(
79415
79326
  (option) => option.value === autoZoom
79416
79327
  );
79417
- const zoomOptions = (0, import_react26.useMemo)(
79328
+ const zoomOptions = (0, import_react27.useMemo)(
79418
79329
  () => [
79419
79330
  ...defaultZoomOptions,
79420
79331
  ...defaultsContainAutoZoom ? [] : [
@@ -79426,8 +79337,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79426
79337
  ].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
79427
79338
  [autoZoom]
79428
79339
  );
79429
- return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)("div", { className: getClassName23(), children: [
79430
- viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79340
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
79341
+ viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79431
79342
  ViewportButton,
79432
79343
  {
79433
79344
  height: viewport.height,
@@ -79438,8 +79349,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79438
79349
  },
79439
79350
  i2
79440
79351
  )),
79441
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassName23("divider") }),
79442
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79352
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
79353
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79443
79354
  IconButton,
79444
79355
  {
79445
79356
  title: "Zoom viewport out",
@@ -79453,10 +79364,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79453
79364
  )].value
79454
79365
  );
79455
79366
  },
79456
- children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(ZoomOut, { size: 16 })
79367
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
79457
79368
  }
79458
79369
  ),
79459
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79370
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79460
79371
  IconButton,
79461
79372
  {
79462
79373
  title: "Zoom viewport in",
@@ -79470,11 +79381,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79470
79381
  )].value
79471
79382
  );
79472
79383
  },
79473
- children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(ZoomIn, { size: 16 })
79384
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
79474
79385
  }
79475
79386
  ),
79476
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassName23("divider") }),
79477
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79387
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
79388
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79478
79389
  "select",
79479
79390
  {
79480
79391
  className: getClassName23("zoomSelect"),
@@ -79482,7 +79393,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79482
79393
  onChange: (e2) => {
79483
79394
  onZoom(parseFloat(e2.currentTarget.value));
79484
79395
  },
79485
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79396
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79486
79397
  "option",
79487
79398
  {
79488
79399
  value: option.value,
@@ -79524,24 +79435,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79524
79435
  }
79525
79436
  return { autoZoom, rootHeight, zoom };
79526
79437
  };
79527
- var import_jsx_runtime33 = require("react/jsx-runtime");
79438
+ var import_jsx_runtime34 = require("react/jsx-runtime");
79528
79439
  var getClassName24 = get_class_name_factory_default2("PuckCanvas", styles_module_default19);
79529
79440
  var ZOOM_ON_CHANGE = true;
79530
79441
  var Canvas = () => {
79531
79442
  const { status, iframe } = useAppContext2();
79532
79443
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
79533
79444
  const { ui } = state;
79534
- const frameRef = (0, import_react27.useRef)(null);
79535
- const [showTransition, setShowTransition] = (0, import_react27.useState)(false);
79536
- const defaultRender = (0, import_react27.useMemo)(() => {
79537
- const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children });
79445
+ const frameRef = (0, import_react28.useRef)(null);
79446
+ const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
79447
+ const defaultRender = (0, import_react28.useMemo)(() => {
79448
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
79538
79449
  return PuckDefault;
79539
79450
  }, []);
79540
- const CustomPreview = (0, import_react27.useMemo)(
79451
+ const CustomPreview = (0, import_react28.useMemo)(
79541
79452
  () => overrides.preview || defaultRender,
79542
79453
  [overrides]
79543
79454
  );
79544
- const getFrameDimensions = (0, import_react27.useCallback)(() => {
79455
+ const getFrameDimensions = (0, import_react28.useCallback)(() => {
79545
79456
  if (frameRef.current) {
79546
79457
  const frame = frameRef.current;
79547
79458
  const box = getBox3(frame);
@@ -79549,7 +79460,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79549
79460
  }
79550
79461
  return { width: 0, height: 0 };
79551
79462
  }, [frameRef]);
79552
- const resetAutoZoom = (0, import_react27.useCallback)(
79463
+ const resetAutoZoom = (0, import_react28.useCallback)(
79553
79464
  (ui2 = state.ui) => {
79554
79465
  if (frameRef.current) {
79555
79466
  setZoomConfig(
@@ -79559,11 +79470,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79559
79470
  },
79560
79471
  [frameRef, zoomConfig, state.ui]
79561
79472
  );
79562
- (0, import_react27.useEffect)(() => {
79473
+ (0, import_react28.useEffect)(() => {
79563
79474
  setShowTransition(false);
79564
79475
  resetAutoZoom();
79565
79476
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
79566
- (0, import_react27.useEffect)(() => {
79477
+ (0, import_react28.useEffect)(() => {
79567
79478
  const { height: frameHeight } = getFrameDimensions();
79568
79479
  if (ui.viewports.current.height === "auto") {
79569
79480
  setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
@@ -79571,7 +79482,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79571
79482
  }));
79572
79483
  }
79573
79484
  }, [zoomConfig.zoom]);
79574
- (0, import_react27.useEffect)(() => {
79485
+ (0, import_react28.useEffect)(() => {
79575
79486
  const observer = new ResizeObserver(() => {
79576
79487
  setShowTransition(false);
79577
79488
  resetAutoZoom();
@@ -79583,7 +79494,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79583
79494
  observer.disconnect();
79584
79495
  };
79585
79496
  }, []);
79586
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
79497
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
79587
79498
  "div",
79588
79499
  {
79589
79500
  className: getClassName24({
@@ -79595,7 +79506,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79595
79506
  recordHistory: true
79596
79507
  }),
79597
79508
  children: [
79598
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79509
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79599
79510
  ViewportControls,
79600
79511
  {
79601
79512
  autoZoom: zoomConfig.autoZoom,
@@ -79620,7 +79531,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79620
79531
  }
79621
79532
  }
79622
79533
  ) }),
79623
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79534
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79624
79535
  "div",
79625
79536
  {
79626
79537
  className: getClassName24("root"),
@@ -79632,19 +79543,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79632
79543
  overflow: iframe.enabled ? void 0 : "auto"
79633
79544
  },
79634
79545
  suppressHydrationWarning: true,
79635
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
79546
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
79636
79547
  }
79637
79548
  ) })
79638
79549
  ]
79639
79550
  }
79640
79551
  );
79641
79552
  };
79642
- var import_jsx_runtime34 = require("react/jsx-runtime");
79553
+ var import_jsx_runtime35 = require("react/jsx-runtime");
79643
79554
  var getClassName25 = get_class_name_factory_default2("Puck", styles_module_default8);
79644
79555
  function Puck({
79645
79556
  children,
79646
79557
  config,
79647
- data: initialData = { content: [], root: { props: { title: "" } } },
79558
+ data: initialData = { content: [], root: {} },
79648
79559
  ui: initialUi,
79649
79560
  onChange,
79650
79561
  onPublish,
@@ -79662,11 +79573,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79662
79573
  }) {
79663
79574
  var _a3;
79664
79575
  const historyStore = useHistoryStore();
79665
- const [reducer2] = (0, import_react28.useState)(
79576
+ const [reducer2] = (0, import_react29.useState)(
79666
79577
  () => createReducer({ config, record: historyStore.record })
79667
79578
  );
79668
- const [initialAppState] = (0, import_react28.useState)(() => {
79669
- var _a22, _b, _c, _d;
79579
+ const [initialAppState] = (0, import_react29.useState)(() => {
79580
+ var _a22, _b, _c, _d, _e;
79670
79581
  const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
79671
79582
  let clientUiState = {};
79672
79583
  if (typeof window !== "undefined") {
@@ -79693,8 +79604,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79693
79604
  };
79694
79605
  }
79695
79606
  }
79607
+ const rootProps2 = initialData.root.props || initialData.root;
79608
+ const defaultedRootProps = __spreadValues2(__spreadValues2({}, (_e = config.root) == null ? void 0 : _e.defaultProps), rootProps2);
79696
79609
  return __spreadProps2(__spreadValues2({}, defaultAppState2), {
79697
- data: initialData,
79610
+ data: __spreadProps2(__spreadValues2({}, initialData), {
79611
+ root: defaultedRootProps
79612
+ }),
79698
79613
  ui: __spreadProps2(__spreadValues2(__spreadValues2({}, initial), clientUiState), {
79699
79614
  // Store categories under componentList on state to allow render functions and plugins to modify
79700
79615
  componentList: config.categories ? Object.entries(config.categories).reduce(
@@ -79713,7 +79628,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79713
79628
  })
79714
79629
  });
79715
79630
  });
79716
- const [appState, dispatch] = (0, import_react28.useReducer)(
79631
+ const [appState, dispatch] = (0, import_react29.useReducer)(
79717
79632
  reducer2,
79718
79633
  flushZones(initialAppState)
79719
79634
  );
@@ -79724,9 +79639,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79724
79639
  config,
79725
79640
  dispatch
79726
79641
  );
79727
- const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
79642
+ const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
79728
79643
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
79729
- const setItemSelector = (0, import_react28.useCallback)(
79644
+ const setItemSelector = (0, import_react29.useCallback)(
79730
79645
  (newItemSelector) => {
79731
79646
  if (newItemSelector === itemSelector)
79732
79647
  return;
@@ -79739,21 +79654,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79739
79654
  [itemSelector]
79740
79655
  );
79741
79656
  const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
79742
- (0, import_react28.useEffect)(() => {
79657
+ (0, import_react29.useEffect)(() => {
79743
79658
  if (onChange)
79744
79659
  onChange(data);
79745
79660
  }, [data]);
79746
79661
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
79747
- const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
79662
+ const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
79748
79663
  const rootProps = data.root.props || data.root;
79749
- (0, import_react28.useEffect)(() => {
79664
+ (0, import_react29.useEffect)(() => {
79750
79665
  if (Object.keys(data.root).length > 0 && !data.root.props) {
79751
79666
  console.error(
79752
79667
  "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
79753
79668
  );
79754
79669
  }
79755
79670
  }, []);
79756
- const toggleSidebars = (0, import_react28.useCallback)(
79671
+ const toggleSidebars = (0, import_react29.useCallback)(
79757
79672
  (sidebar) => {
79758
79673
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
79759
79674
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -79767,7 +79682,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79767
79682
  },
79768
79683
  [dispatch, leftSideBarVisible, rightSideBarVisible]
79769
79684
  );
79770
- (0, import_react28.useEffect)(() => {
79685
+ (0, import_react29.useEffect)(() => {
79771
79686
  if (!window.matchMedia("(min-width: 638px)").matches) {
79772
79687
  dispatch({
79773
79688
  type: "setUi",
@@ -79790,11 +79705,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79790
79705
  window.removeEventListener("resize", handleResize);
79791
79706
  };
79792
79707
  }, []);
79793
- const defaultRender = (0, import_react28.useMemo)(() => {
79794
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
79708
+ const defaultRender = (0, import_react29.useMemo)(() => {
79709
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
79795
79710
  return PuckDefault;
79796
79711
  }, []);
79797
- const defaultHeaderRender = (0, import_react28.useMemo)(() => {
79712
+ const defaultHeaderRender = (0, import_react29.useMemo)(() => {
79798
79713
  if (renderHeader) {
79799
79714
  console.warn(
79800
79715
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -79802,45 +79717,45 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79802
79717
  const RenderHeader = (_a22) => {
79803
79718
  var _b = _a22, { actions } = _b, props = __objRest2(_b, ["actions"]);
79804
79719
  const Comp = renderHeader;
79805
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
79720
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
79806
79721
  };
79807
79722
  return RenderHeader;
79808
79723
  }
79809
79724
  return defaultRender;
79810
79725
  }, [renderHeader]);
79811
- const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
79726
+ const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
79812
79727
  if (renderHeaderActions) {
79813
79728
  console.warn(
79814
79729
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
79815
79730
  );
79816
79731
  const RenderHeader = (props) => {
79817
79732
  const Comp = renderHeaderActions;
79818
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
79733
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
79819
79734
  };
79820
79735
  return RenderHeader;
79821
79736
  }
79822
79737
  return defaultRender;
79823
79738
  }, [renderHeader]);
79824
- const loadedOverrides = (0, import_react28.useMemo)(() => {
79739
+ const loadedOverrides = (0, import_react29.useMemo)(() => {
79825
79740
  return loadOverrides({ overrides, plugins });
79826
79741
  }, [plugins]);
79827
- const CustomPuck = (0, import_react28.useMemo)(
79742
+ const CustomPuck = (0, import_react29.useMemo)(
79828
79743
  () => loadedOverrides.puck || defaultRender,
79829
79744
  [loadedOverrides]
79830
79745
  );
79831
- const CustomHeader = (0, import_react28.useMemo)(
79746
+ const CustomHeader = (0, import_react29.useMemo)(
79832
79747
  () => loadedOverrides.header || defaultHeaderRender,
79833
79748
  [loadedOverrides]
79834
79749
  );
79835
- const CustomHeaderActions = (0, import_react28.useMemo)(
79750
+ const CustomHeaderActions = (0, import_react29.useMemo)(
79836
79751
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
79837
79752
  [loadedOverrides]
79838
79753
  );
79839
- const [mounted, setMounted] = (0, import_react28.useState)(false);
79840
- (0, import_react28.useEffect)(() => {
79754
+ const [mounted, setMounted] = (0, import_react29.useState)(false);
79755
+ (0, import_react29.useEffect)(() => {
79841
79756
  setMounted(true);
79842
79757
  }, []);
79843
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79758
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79844
79759
  AppProvider,
79845
79760
  {
79846
79761
  value: {
@@ -79855,7 +79770,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79855
79770
  viewports,
79856
79771
  iframe
79857
79772
  },
79858
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79773
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79859
79774
  DragDropContext2,
79860
79775
  {
79861
79776
  autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
@@ -79911,7 +79826,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79911
79826
  });
79912
79827
  }
79913
79828
  },
79914
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79829
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79915
79830
  DropZoneProvider,
79916
79831
  {
79917
79832
  value: {
@@ -79925,7 +79840,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79925
79840
  mode: "edit",
79926
79841
  areaId: "root"
79927
79842
  },
79928
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
79843
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
79929
79844
  "div",
79930
79845
  {
79931
79846
  className: getClassName25({
@@ -79935,65 +79850,65 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79935
79850
  rightSideBarVisible
79936
79851
  }),
79937
79852
  children: [
79938
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("layout"), children: [
79939
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79853
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
79854
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79940
79855
  CustomHeader,
79941
79856
  {
79942
- actions: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
79943
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
79944
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79857
+ actions: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
79858
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
79859
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79945
79860
  Button,
79946
79861
  {
79947
79862
  onClick: () => {
79948
79863
  onPublish && onPublish(data);
79949
79864
  },
79950
- icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
79865
+ icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
79951
79866
  children: "Publish"
79952
79867
  }
79953
79868
  )
79954
79869
  ] }),
79955
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerInner"), children: [
79956
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerToggle"), children: [
79957
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79870
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
79871
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
79872
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79958
79873
  IconButton,
79959
79874
  {
79960
79875
  onClick: () => {
79961
79876
  toggleSidebars("left");
79962
79877
  },
79963
79878
  title: "Toggle left sidebar",
79964
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
79879
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
79965
79880
  }
79966
79881
  ) }),
79967
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79882
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79968
79883
  IconButton,
79969
79884
  {
79970
79885
  onClick: () => {
79971
79886
  toggleSidebars("right");
79972
79887
  },
79973
79888
  title: "Toggle right sidebar",
79974
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
79889
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
79975
79890
  }
79976
79891
  ) })
79977
79892
  ] }),
79978
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading2, { rank: 2, size: "xs", children: [
79893
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading2, { rank: 2, size: "xs", children: [
79979
79894
  headerTitle || rootProps.title || "Page",
79980
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
79895
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
79981
79896
  " ",
79982
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
79897
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
79983
79898
  ] })
79984
79899
  ] }) }),
79985
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("headerTools"), children: [
79986
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79900
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
79901
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79987
79902
  IconButton,
79988
79903
  {
79989
79904
  onClick: () => {
79990
79905
  return setMenuOpen(!menuOpen);
79991
79906
  },
79992
79907
  title: "Toggle menu bar",
79993
- children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { focusable: "false" })
79908
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
79994
79909
  }
79995
79910
  ) }),
79996
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79911
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79997
79912
  MenuBar,
79998
79913
  {
79999
79914
  appState,
@@ -80001,7 +79916,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80001
79916
  dispatch,
80002
79917
  onPublish,
80003
79918
  menuOpen,
80004
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
79919
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, {}),
80005
79920
  setMenuOpen
80006
79921
  }
80007
79922
  )
@@ -80009,23 +79924,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80009
79924
  ] }) })
80010
79925
  }
80011
79926
  ),
80012
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
80013
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Components, {}) }),
80014
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Outline, {}) })
79927
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
79928
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Components, {}) }),
79929
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Outline, {}) })
80015
79930
  ] }),
80016
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, {}),
80017
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79931
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, {}),
79932
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
80018
79933
  SidebarSection2,
80019
79934
  {
80020
79935
  noPadding: true,
80021
79936
  noBorderTop: true,
80022
79937
  showBreadcrumbs: true,
80023
79938
  title: selectedItem ? (_a3 = config.components[selectedItem.type]["label"]) != null ? _a3 : selectedItem.type : "Page",
80024
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
79939
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
80025
79940
  }
80026
79941
  ) })
80027
79942
  ] }),
80028
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79943
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
80029
79944
  "div",
80030
79945
  {
80031
79946
  id: "puck-portal-root",
@@ -80047,7 +79962,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80047
79962
  Puck.Outline = Outline;
80048
79963
  Puck.Preview = Preview;
80049
79964
  init_react_import2();
80050
- var import_jsx_runtime35 = require("react/jsx-runtime");
79965
+ var import_jsx_runtime36 = require("react/jsx-runtime");
80051
79966
  function Render({
80052
79967
  config,
80053
79968
  data
@@ -80056,7 +79971,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80056
79971
  const rootProps = data.root.props || data.root;
80057
79972
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
80058
79973
  if ((_a3 = config.root) == null ? void 0 : _a3.render) {
80059
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79974
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
80060
79975
  config.root.render,
80061
79976
  __spreadProps2(__spreadValues2({}, rootProps), {
80062
79977
  puck: {
@@ -80065,11 +79980,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80065
79980
  title,
80066
79981
  editMode: false,
80067
79982
  id: "puck-root",
80068
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId2 })
79983
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 })
80069
79984
  })
80070
79985
  ) });
80071
79986
  }
80072
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId2 }) });
79987
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 }) });
80073
79988
  }
80074
79989
  init_react_import2();
80075
79990
  var migrations = [
@@ -80234,7 +80149,7 @@ init_react_import();
80234
80149
  // src/HeadingAnalyzer.tsx
80235
80150
  init_react_import();
80236
80151
  var import_react12 = require("react");
80237
- var import_puck = __toESM(require_dist2());
80152
+ var import_puck = __toESM(require_dist());
80238
80153
 
80239
80154
  // ../core/components/SidebarSection/index.tsx
80240
80155
  init_react_import();
@@ -80422,7 +80337,7 @@ var defaultViewports = [
80422
80337
  var import_ua_parser_js = __toESM(require_ua_parser());
80423
80338
  var import_jsx_runtime4 = require("react/jsx-runtime");
80424
80339
  var defaultAppState = {
80425
- data: { content: [], root: { props: { title: "" } } },
80340
+ data: { content: [], root: { props: {} } },
80426
80341
  ui: {
80427
80342
  leftSideBarVisible: true,
80428
80343
  rightSideBarVisible: true,