@measured/puck-plugin-heading-analyzer 0.14.3-canary.9df6633 → 0.15.0-canary.46aa8ff

Sign up to get free protection for your applications and to get access to all the features.
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();
@@ -77450,6 +77164,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77450
77164
  init_react_import2();
77451
77165
  var import_react132 = require("react");
77452
77166
  init_react_import2();
77167
+ init_react_import2();
77168
+ var getChanged = (newItem, oldItem) => {
77169
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
77170
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
77171
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
77172
+ return __spreadProps2(__spreadValues2({}, acc), {
77173
+ [item]: oldItemProps[item] !== newItemProps[item]
77174
+ });
77175
+ }, {}) : {};
77176
+ };
77453
77177
  var cache = { lastChange: {} };
77454
77178
  var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
77455
77179
  return yield Promise.all(
@@ -77466,25 +77190,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77466
77190
  var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
77467
77191
  const configForItem = config.components[item.type];
77468
77192
  if (configForItem.resolveData) {
77469
- let changed = Object.keys(item.props).reduce(
77470
- (acc, item2) => __spreadProps2(__spreadValues2({}, acc), { [item2]: true }),
77471
- {}
77472
- );
77473
- if (cache.lastChange[item.props.id]) {
77474
- const { item: oldItem, resolved } = cache.lastChange[item.props.id];
77475
- if (oldItem === item) {
77476
- return resolved;
77477
- }
77478
- Object.keys(item.props).forEach((propName) => {
77479
- if (oldItem.props[propName] === item.props[propName]) {
77480
- changed[propName] = false;
77481
- }
77482
- });
77193
+ const { item: oldItem = {}, resolved = {} } = cache.lastChange[item.props.id] || {};
77194
+ if (item && item === oldItem) {
77195
+ return resolved;
77483
77196
  }
77197
+ const changed = getChanged(item, oldItem);
77484
77198
  if (onResolveStart) {
77485
77199
  onResolveStart(item);
77486
77200
  }
77487
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed });
77201
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
77488
77202
  const { readOnly: existingReadOnly = {} } = item || {};
77489
77203
  const newReadOnly = __spreadValues2(__spreadValues2({}, existingReadOnly), readOnly);
77490
77204
  const resolvedItem = __spreadProps2(__spreadValues2({}, item), {
@@ -77523,26 +77237,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77523
77237
  init_react_import2();
77524
77238
  var cache2 = {};
77525
77239
  var resolveRootData = (data, config) => __async2(void 0, null, function* () {
77526
- var _a3, _b;
77240
+ var _a3, _b, _c, _d, _e;
77527
77241
  if (((_a3 = config.root) == null ? void 0 : _a3.resolveData) && data.root.props) {
77528
- let changed = Object.keys(data.root.props).reduce(
77529
- (acc, item) => __spreadProps2(__spreadValues2({}, acc), { [item]: true }),
77530
- {}
77531
- );
77532
- if (cache2.lastChange) {
77533
- const { original, resolved } = cache2.lastChange;
77534
- if (original === data.root) {
77535
- return resolved;
77536
- }
77537
- Object.keys(data.root.props).forEach((propName) => {
77538
- if (original.props[propName] === data.root.props[propName]) {
77539
- changed[propName] = false;
77540
- }
77541
- });
77242
+ if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
77243
+ return cache2.lastChange.resolved;
77542
77244
  }
77245
+ const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
77543
77246
  const rootWithProps = data.root;
77544
- const resolvedRoot = yield (_b = config.root) == null ? void 0 : _b.resolveData(rootWithProps, {
77545
- changed
77247
+ const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
77248
+ changed,
77249
+ lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {}
77546
77250
  });
77547
77251
  cache2.lastChange = {
77548
77252
  original: data.root,
@@ -77562,7 +77266,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77562
77266
  const [componentState, setComponentState] = (0, import_react132.useState)({});
77563
77267
  const deferredSetStates = {};
77564
77268
  const setComponentLoading = (0, import_react132.useCallback)(
77565
- (id, loading, defer = 0) => {
77269
+ (id, loading, defer2 = 0) => {
77566
77270
  if (deferredSetStates[id]) {
77567
77271
  clearTimeout(deferredSetStates[id]);
77568
77272
  delete deferredSetStates[id];
@@ -77572,7 +77276,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77572
77276
  [id]: __spreadProps2(__spreadValues2({}, prev[id]), { loading })
77573
77277
  }));
77574
77278
  delete deferredSetStates[id];
77575
- }, defer);
77279
+ }, defer2);
77576
77280
  },
77577
77281
  []
77578
77282
  );
@@ -77652,7 +77356,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77652
77356
  var getClassName9 = get_class_name_factory_default2("MenuBar", styles_module_default7);
77653
77357
  var MenuBar = ({
77654
77358
  appState,
77655
- data = { content: [], root: { props: { title: "" } } },
77359
+ data = { content: [], root: {} },
77656
77360
  dispatch,
77657
77361
  menuOpen = false,
77658
77362
  onPublish,
@@ -77697,17 +77401,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
77697
77401
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: renderHeaderActions && renderHeaderActions({
77698
77402
  state: appState,
77699
77403
  dispatch
77700
- }) }),
77701
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
77702
- Button,
77703
- {
77704
- onClick: () => {
77705
- onPublish && onPublish(data);
77706
- },
77707
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Globe, { size: "14px" }),
77708
- children: "Publish"
77709
- }
77710
- ) })
77404
+ }) })
77711
77405
  ] })
77712
77406
  }
77713
77407
  );
@@ -78616,7 +78310,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78616
78310
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Render2, __spreadProps2(__spreadValues2({}, mergedProps), { children }));
78617
78311
  };
78618
78312
  init_react_import2();
78619
- var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
78313
+ var styles_module_default14 = { "PuckFields": "_PuckFields_1o0if_1", "PuckFields--isLoading": "_PuckFields--isLoading_1o0if_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_1o0if_10" };
78620
78314
  var import_react19 = require("react");
78621
78315
  var import_jsx_runtime25 = require("react/jsx-runtime");
78622
78316
  var getClassName19 = get_class_name_factory_default2("PuckFields", styles_module_default14);
@@ -78627,13 +78321,73 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78627
78321
  children,
78628
78322
  isLoading
78629
78323
  }) => {
78630
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
78324
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19({ isLoading }), children: [
78631
78325
  children,
78632
78326
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
78633
78327
  ] });
78634
78328
  };
78329
+ var useResolvedFields = () => {
78330
+ var _a3;
78331
+ const { selectedItem, state, config } = useAppContext2();
78332
+ const { data } = state;
78333
+ const rootFields = ((_a3 = config.root) == null ? void 0 : _a3.fields) || defaultPageFields;
78334
+ const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
78335
+ const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
78336
+ const rootProps = data.root.props || data.root;
78337
+ const [lastSelectedData, setLastSelectedData] = (0, import_react19.useState)(
78338
+ {}
78339
+ );
78340
+ const [resolvedFields, setResolvedFields] = (0, import_react19.useState)(defaultFields || {});
78341
+ const [fieldsLoading, setFieldsLoading] = (0, import_react19.useState)(false);
78342
+ const defaultResolveFields = (_componentData, _params) => defaultFields;
78343
+ const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
78344
+ const resolveFields = (0, import_react19.useCallback)(
78345
+ (..._0) => __async2(void 0, [..._0], function* (fields = {}) {
78346
+ var _a22, _b, _c;
78347
+ const lastData = ((_a22 = lastSelectedData.props) == null ? void 0 : _a22.id) === componentData.props.id ? lastSelectedData : {};
78348
+ const changed = getChanged(componentData, lastData);
78349
+ setLastSelectedData(componentData);
78350
+ if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields)) {
78351
+ return yield componentConfig == null ? void 0 : componentConfig.resolveFields(
78352
+ componentData,
78353
+ {
78354
+ changed,
78355
+ fields,
78356
+ lastFields: resolvedFields,
78357
+ lastData,
78358
+ appState: state
78359
+ }
78360
+ );
78361
+ }
78362
+ if (!selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields)) {
78363
+ return yield (_c = config.root) == null ? void 0 : _c.resolveFields(componentData, {
78364
+ changed,
78365
+ fields,
78366
+ lastFields: resolvedFields,
78367
+ lastData,
78368
+ appState: state
78369
+ });
78370
+ }
78371
+ return defaultResolveFields(componentData, {
78372
+ changed,
78373
+ fields,
78374
+ lastFields: resolvedFields,
78375
+ lastData
78376
+ });
78377
+ }),
78378
+ [data, config, componentData, selectedItem, resolvedFields, state]
78379
+ );
78380
+ (0, import_react19.useEffect)(() => {
78381
+ setFieldsLoading(true);
78382
+ resolveFields(defaultFields).then((fields) => {
78383
+ setResolvedFields(fields || {});
78384
+ setFieldsLoading(false);
78385
+ });
78386
+ }, [data, defaultFields]);
78387
+ return [resolvedFields, fieldsLoading];
78388
+ };
78635
78389
  var Fields = () => {
78636
- var _a3, _b, _c, _d;
78390
+ var _a3, _b;
78637
78391
  const {
78638
78392
  selectedItem,
78639
78393
  state,
@@ -78645,9 +78399,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78645
78399
  } = useAppContext2();
78646
78400
  const { data, ui } = state;
78647
78401
  const { itemSelector } = ui;
78648
- const rootFields = ((_a3 = config.root) == null ? void 0 : _a3.fields) || defaultPageFields;
78649
- const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
78650
- const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
78402
+ const [fields, fieldsResolving] = useResolvedFields();
78403
+ const componentResolving = selectedItem ? (_a3 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a3.loading : (_b = componentState["puck-root"]) == null ? void 0 : _b.loading;
78404
+ const isLoading = fieldsResolving || componentResolving;
78651
78405
  const rootProps = data.root.props || data.root;
78652
78406
  const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
78653
78407
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -78659,6 +78413,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78659
78413
  },
78660
78414
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
78661
78415
  const field = fields[fieldName];
78416
+ if (!(field == null ? void 0 : field.type))
78417
+ return null;
78662
78418
  const onChange = (value, updatedUi) => {
78663
78419
  var _a22, _b2;
78664
78420
  let currentProps;
@@ -78894,15 +78650,212 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78894
78650
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComponentList, { id: "all" }) });
78895
78651
  };
78896
78652
  init_react_import2();
78897
- var import_react222 = require("react");
78898
- var import_auto_frame_component = __toESM2(require_dist());
78653
+ var import_react23 = require("react");
78899
78654
  init_react_import2();
78900
- var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
78655
+ var import_react222 = __toESM2(require("react"));
78656
+ var import_react_frame_component = __toESM2(require_lib());
78657
+ var import_object_hash = __toESM2(require_object_hash());
78901
78658
  var import_jsx_runtime29 = require("react/jsx-runtime");
78659
+ var styleSelector = 'style, link[rel="stylesheet"]';
78660
+ var collectStyles = (doc) => {
78661
+ const collected = [];
78662
+ doc.head.querySelectorAll(styleSelector).forEach((style2) => {
78663
+ collected.push(style2);
78664
+ });
78665
+ return collected;
78666
+ };
78667
+ var getStyleSheet = (el) => {
78668
+ return Array.from(document.styleSheets).find((ss) => {
78669
+ const ownerNode = ss.ownerNode;
78670
+ return ownerNode.href === el.href;
78671
+ });
78672
+ };
78673
+ var getStyles2 = (styleSheet) => {
78674
+ if (styleSheet) {
78675
+ try {
78676
+ return [...styleSheet.cssRules].map((rule) => rule.cssText).join("");
78677
+ } catch (e2) {
78678
+ console.warn(
78679
+ "Access to stylesheet %s is denied. Ignoring\u2026",
78680
+ styleSheet.href
78681
+ );
78682
+ }
78683
+ }
78684
+ return "";
78685
+ };
78686
+ var defer = (fn) => setTimeout(fn, 0);
78687
+ var CopyHostStyles = ({
78688
+ children,
78689
+ debug = false,
78690
+ onStylesLoaded = () => null
78691
+ }) => {
78692
+ const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
78693
+ (0, import_react222.useEffect)(() => {
78694
+ if (!win || !doc) {
78695
+ return () => {
78696
+ };
78697
+ }
78698
+ let elements = [];
78699
+ const hashes = {};
78700
+ const lookupEl = (el) => elements.findIndex((elementMap) => elementMap.original === el);
78701
+ const mirrorEl = (el, inlineStyles = false) => __async2(void 0, null, function* () {
78702
+ let mirror;
78703
+ if (el.nodeName === "LINK" && inlineStyles) {
78704
+ mirror = document.createElement("style");
78705
+ mirror.type = "text/css";
78706
+ let styleSheet = getStyleSheet(el);
78707
+ if (!styleSheet) {
78708
+ yield new Promise((resolve) => {
78709
+ const fn = () => {
78710
+ resolve();
78711
+ el.removeEventListener("load", fn);
78712
+ };
78713
+ el.addEventListener("load", fn);
78714
+ });
78715
+ styleSheet = getStyleSheet(el);
78716
+ }
78717
+ const styles = getStyles2(styleSheet);
78718
+ if (!styles) {
78719
+ if (debug) {
78720
+ console.warn(
78721
+ `Tried to load styles for link element, but couldn't find them. Skipping...`
78722
+ );
78723
+ }
78724
+ return;
78725
+ }
78726
+ mirror.innerHTML = styles;
78727
+ mirror.setAttribute("data-href", el.getAttribute("href"));
78728
+ } else {
78729
+ mirror = el.cloneNode(true);
78730
+ }
78731
+ return mirror;
78732
+ });
78733
+ const addEl = (el) => __async2(void 0, null, function* () {
78734
+ const index = lookupEl(el);
78735
+ if (index > -1) {
78736
+ if (debug)
78737
+ console.log(
78738
+ `Tried to add an element that was already mirrored. Updating instead...`
78739
+ );
78740
+ elements[index].mirror.innerText = el.innerText;
78741
+ return;
78742
+ }
78743
+ const mirror = yield mirrorEl(el);
78744
+ if (!mirror) {
78745
+ return;
78746
+ }
78747
+ const elHash = (0, import_object_hash.default)(mirror.outerHTML);
78748
+ if (hashes[elHash]) {
78749
+ if (debug)
78750
+ console.log(
78751
+ `iframe already contains element that is being mirrored. Skipping...`
78752
+ );
78753
+ return;
78754
+ }
78755
+ hashes[elHash] = true;
78756
+ doc.head.append(mirror);
78757
+ elements.push({ original: el, mirror });
78758
+ if (debug)
78759
+ console.log(`Added style node ${el.outerHTML}`);
78760
+ });
78761
+ const removeEl = (el) => {
78762
+ var _a3, _b;
78763
+ const index = lookupEl(el);
78764
+ if (index === -1) {
78765
+ if (debug)
78766
+ console.log(
78767
+ `Tried to remove an element that did not exist. Skipping...`
78768
+ );
78769
+ return;
78770
+ }
78771
+ const elHash = (0, import_object_hash.default)(el.outerHTML);
78772
+ (_b = (_a3 = elements[index]) == null ? void 0 : _a3.mirror) == null ? void 0 : _b.remove();
78773
+ delete hashes[elHash];
78774
+ if (debug)
78775
+ console.log(`Removed style node ${el.outerHTML}`);
78776
+ };
78777
+ const observer = new MutationObserver((mutations) => {
78778
+ mutations.forEach((mutation) => {
78779
+ if (mutation.type === "childList") {
78780
+ mutation.addedNodes.forEach((node) => {
78781
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
78782
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
78783
+ if (el && el.matches(styleSelector)) {
78784
+ defer(() => addEl(el));
78785
+ }
78786
+ }
78787
+ });
78788
+ mutation.removedNodes.forEach((node) => {
78789
+ if (node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE) {
78790
+ const el = node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
78791
+ if (el && el.matches(styleSelector)) {
78792
+ defer(() => removeEl(el));
78793
+ }
78794
+ }
78795
+ });
78796
+ }
78797
+ });
78798
+ });
78799
+ const parentDocument = win.parent.document;
78800
+ const collectedStyles = collectStyles(parentDocument);
78801
+ const hrefs = [];
78802
+ let stylesLoaded = 0;
78803
+ Promise.all(
78804
+ collectedStyles.map((styleNode, i2) => __async2(void 0, null, function* () {
78805
+ if (styleNode.nodeName === "LINK") {
78806
+ const linkHref = styleNode.href;
78807
+ if (hrefs.indexOf(linkHref) > -1) {
78808
+ return;
78809
+ }
78810
+ hrefs.push(linkHref);
78811
+ }
78812
+ const mirror = yield mirrorEl(styleNode);
78813
+ if (!mirror)
78814
+ return;
78815
+ elements.push({ original: styleNode, mirror });
78816
+ return mirror;
78817
+ }))
78818
+ ).then((mirrorStyles) => {
78819
+ const filtered = mirrorStyles.filter(
78820
+ (el) => typeof el !== "undefined"
78821
+ );
78822
+ filtered.forEach((mirror) => {
78823
+ mirror.onload = () => {
78824
+ stylesLoaded = stylesLoaded + 1;
78825
+ if (stylesLoaded >= elements.length) {
78826
+ onStylesLoaded();
78827
+ }
78828
+ };
78829
+ });
78830
+ doc.head.innerHTML = "";
78831
+ doc.head.append(...filtered);
78832
+ observer.observe(parentDocument.head, { childList: true, subtree: true });
78833
+ filtered.forEach((el) => {
78834
+ const elHash = (0, import_object_hash.default)(el.outerHTML);
78835
+ hashes[elHash] = true;
78836
+ });
78837
+ });
78838
+ return () => {
78839
+ observer.disconnect();
78840
+ };
78841
+ }, []);
78842
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children });
78843
+ };
78844
+ var AutoFrameComponent = import_react222.default.forwardRef(
78845
+ function(_a3, ref2) {
78846
+ var _b = _a3, { children, debug, onStylesLoaded } = _b, props = __objRest2(_b, ["children", "debug", "onStylesLoaded"]);
78847
+ 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 }) }));
78848
+ }
78849
+ );
78850
+ AutoFrameComponent.displayName = "AutoFrameComponent";
78851
+ var AutoFrame_default = AutoFrameComponent;
78852
+ init_react_import2();
78853
+ var styles_module_default16 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
78854
+ var import_jsx_runtime30 = require("react/jsx-runtime");
78902
78855
  var getClassName21 = get_class_name_factory_default2("PuckPreview", styles_module_default16);
78903
78856
  var Preview = ({ id = "puck-preview" }) => {
78904
78857
  const { config, dispatch, state, setStatus, iframe } = useAppContext2();
78905
- const Page = (0, import_react222.useCallback)(
78858
+ const Page = (0, import_react23.useCallback)(
78906
78859
  (pageProps) => {
78907
78860
  var _a3, _b;
78908
78861
  return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps2(__spreadValues2({
@@ -78910,13 +78863,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78910
78863
  }, pageProps), {
78911
78864
  editMode: true,
78912
78865
  puck: { renderDropZone: DropZone }
78913
- })) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: pageProps.children });
78866
+ })) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: pageProps.children });
78914
78867
  },
78915
78868
  [config.root]
78916
78869
  );
78917
78870
  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)(
78871
+ const ref2 = (0, import_react23.useRef)(null);
78872
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
78920
78873
  "div",
78921
78874
  {
78922
78875
  className: getClassName21(),
@@ -78924,8 +78877,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78924
78877
  onClick: () => {
78925
78878
  dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
78926
78879
  },
78927
- children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
78928
- import_auto_frame_component.default,
78880
+ children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
78881
+ AutoFrame_default,
78929
78882
  {
78930
78883
  id: "preview-frame",
78931
78884
  className: getClassName21("frame"),
@@ -78934,9 +78887,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78934
78887
  onStylesLoaded: () => {
78935
78888
  setStatus("READY");
78936
78889
  },
78937
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropZone, { zone: rootDroppableId2 }) }))
78890
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropZone, { zone: rootDroppableId2 }) }))
78938
78891
  }
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 }) })) })
78892
+ ) : /* @__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
78893
  }
78941
78894
  );
78942
78895
  };
@@ -78968,7 +78921,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78968
78921
  el.style.scrollMargin = oldStyle.scrollMargin || "";
78969
78922
  }
78970
78923
  };
78971
- var import_react23 = require("react");
78924
+ var import_react24 = require("react");
78972
78925
  init_react_import2();
78973
78926
  var isChildOfZone = (item, maybeChild, ctx) => {
78974
78927
  var _a3;
@@ -78978,7 +78931,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78978
78931
  return area === item.props.id;
78979
78932
  })) : false;
78980
78933
  };
78981
- var import_jsx_runtime30 = require("react/jsx-runtime");
78934
+ var import_jsx_runtime31 = require("react/jsx-runtime");
78982
78935
  var getClassName222 = get_class_name_factory_default2("LayerTree", styles_module_default17);
78983
78936
  var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default17);
78984
78937
  var LayerTree = ({
@@ -78991,15 +78944,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
78991
78944
  label
78992
78945
  }) => {
78993
78946
  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" }) }),
78947
+ const ctx = (0, import_react24.useContext)(dropZoneContext2);
78948
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
78949
+ label && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassName222("zoneTitle"), children: [
78950
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Layers, { size: "16" }) }),
78998
78951
  " ",
78999
78952
  label
79000
78953
  ] }),
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" }),
78954
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("ul", { className: getClassName222(), children: [
78955
+ zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassName222("helper"), children: "No items" }),
79003
78956
  zoneContent.map((item, i2) => {
79004
78957
  var _a3;
79005
78958
  const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
@@ -79015,7 +78968,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79015
78968
  const selectedItem = itemSelector && data ? getItem2(itemSelector, data) : null;
79016
78969
  const isHovering = hoveringComponent === item.props.id;
79017
78970
  const childIsSelected = isChildOfZone(item, selectedItem, ctx);
79018
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
78971
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
79019
78972
  "li",
79020
78973
  {
79021
78974
  className: getClassNameLayer({
@@ -79025,7 +78978,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79025
78978
  childIsSelected
79026
78979
  }),
79027
78980
  children: [
79028
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
78981
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
79029
78982
  "button",
79030
78983
  {
79031
78984
  className: getClassNameLayer("clickable"),
@@ -79057,22 +79010,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79057
79010
  setHoveringComponent(null);
79058
79011
  },
79059
79012
  children: [
79060
- containsZone && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
79013
+ containsZone && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
79061
79014
  "div",
79062
79015
  {
79063
79016
  className: getClassNameLayer("chevron"),
79064
79017
  title: isSelected ? "Collapse" : "Expand",
79065
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ChevronDown, { size: "12" })
79018
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDown, { size: "12" })
79066
79019
  }
79067
79020
  ),
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 })
79021
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getClassNameLayer("title"), children: [
79022
+ /* @__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" }) }),
79023
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: getClassNameLayer("name"), children: (_a3 = config.components[item.type]["label"]) != null ? _a3 : item.type })
79071
79024
  ] })
79072
79025
  ]
79073
79026
  }
79074
79027
  ) }),
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)(
79028
+ 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
79029
  LayerTree,
79077
79030
  {
79078
79031
  config,
@@ -79092,13 +79045,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79092
79045
  ] })
79093
79046
  ] });
79094
79047
  };
79095
- var import_react24 = require("react");
79096
- var import_jsx_runtime31 = require("react/jsx-runtime");
79048
+ var import_react25 = require("react");
79049
+ var import_jsx_runtime322 = require("react/jsx-runtime");
79097
79050
  var Outline = () => {
79098
79051
  const { dispatch, state, overrides, config } = useAppContext2();
79099
79052
  const { data, ui } = state;
79100
79053
  const { itemSelector } = ui;
79101
- const setItemSelector = (0, import_react24.useCallback)(
79054
+ const setItemSelector = (0, import_react25.useCallback)(
79102
79055
  (newItemSelector) => {
79103
79056
  dispatch({
79104
79057
  type: "setUi",
@@ -79107,9 +79060,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79107
79060
  },
79108
79061
  []
79109
79062
  );
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)(
79063
+ const Wrapper = (0, import_react25.useMemo)(() => overrides.outline || "div", [overrides]);
79064
+ 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: [
79065
+ (ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79113
79066
  LayerTree,
79114
79067
  {
79115
79068
  config,
@@ -79122,7 +79075,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79122
79075
  ),
79123
79076
  Object.entries(findZonesForArea(data, "root")).map(
79124
79077
  ([zoneKey, zone]) => {
79125
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
79078
+ return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79126
79079
  LayerTree,
79127
79080
  {
79128
79081
  config,
@@ -79201,12 +79154,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79201
79154
  };
79202
79155
  }
79203
79156
  init_react_import2();
79204
- var import_react25 = require("react");
79157
+ var import_react26 = require("react");
79205
79158
  var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
79206
79159
  var EMPTY_HISTORY_INDEX = -1;
79207
79160
  function useHistoryStore() {
79208
- const [histories, setHistories] = (0, import_react25.useState)([]);
79209
- const [index, setIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
79161
+ const [histories, setHistories] = (0, import_react26.useState)([]);
79162
+ const [index, setIndex] = (0, import_react26.useState)(EMPTY_HISTORY_INDEX);
79210
79163
  const hasPast = index > EMPTY_HISTORY_INDEX;
79211
79164
  const hasFuture = index < histories.length - 1;
79212
79165
  const currentHistory = histories[index];
@@ -79356,16 +79309,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79356
79309
  var styles = window.getComputedStyle(el);
79357
79310
  return calculateBox3(borderBox, styles);
79358
79311
  };
79359
- var import_react27 = require("react");
79312
+ var import_react28 = require("react");
79360
79313
  init_react_import2();
79361
- var import_react26 = require("react");
79314
+ var import_react27 = require("react");
79362
79315
  init_react_import2();
79363
79316
  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");
79317
+ var import_jsx_runtime33 = require("react/jsx-runtime");
79365
79318
  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 })
79319
+ Smartphone: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Smartphone, { size: 16 }),
79320
+ Tablet: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tablet, { size: 16 }),
79321
+ Monitor: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Monitor, { size: 16 })
79369
79322
  };
79370
79323
  var getClassName23 = get_class_name_factory_default2("ViewportControls", styles_module_default18);
79371
79324
  var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default18);
@@ -79377,11 +79330,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79377
79330
  onClick
79378
79331
  }) => {
79379
79332
  const { state } = useAppContext2();
79380
- const [isActive2, setIsActive] = (0, import_react26.useState)(false);
79381
- (0, import_react26.useEffect)(() => {
79333
+ const [isActive2, setIsActive] = (0, import_react27.useState)(false);
79334
+ (0, import_react27.useEffect)(() => {
79382
79335
  setIsActive(width === state.ui.viewports.current.width);
79383
79336
  }, [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)(
79337
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79385
79338
  IconButton,
79386
79339
  {
79387
79340
  title,
@@ -79390,7 +79343,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79390
79343
  e2.stopPropagation();
79391
79344
  onClick({ width, height });
79392
79345
  },
79393
- children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("span", { className: getClassNameButton("inner"), children })
79346
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: getClassNameButton("inner"), children })
79394
79347
  }
79395
79348
  ) });
79396
79349
  };
@@ -79414,7 +79367,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79414
79367
  const defaultsContainAutoZoom = defaultZoomOptions.find(
79415
79368
  (option) => option.value === autoZoom
79416
79369
  );
79417
- const zoomOptions = (0, import_react26.useMemo)(
79370
+ const zoomOptions = (0, import_react27.useMemo)(
79418
79371
  () => [
79419
79372
  ...defaultZoomOptions,
79420
79373
  ...defaultsContainAutoZoom ? [] : [
@@ -79426,8 +79379,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79426
79379
  ].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
79427
79380
  [autoZoom]
79428
79381
  );
79429
- return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)("div", { className: getClassName23(), children: [
79430
- viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79382
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: getClassName23(), children: [
79383
+ viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79431
79384
  ViewportButton,
79432
79385
  {
79433
79386
  height: viewport.height,
@@ -79438,8 +79391,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79438
79391
  },
79439
79392
  i2
79440
79393
  )),
79441
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassName23("divider") }),
79442
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79394
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
79395
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79443
79396
  IconButton,
79444
79397
  {
79445
79398
  title: "Zoom viewport out",
@@ -79453,10 +79406,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79453
79406
  )].value
79454
79407
  );
79455
79408
  },
79456
- children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(ZoomOut, { size: 16 })
79409
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomOut, { size: 16 })
79457
79410
  }
79458
79411
  ),
79459
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79412
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79460
79413
  IconButton,
79461
79414
  {
79462
79415
  title: "Zoom viewport in",
@@ -79470,11 +79423,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79470
79423
  )].value
79471
79424
  );
79472
79425
  },
79473
- children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(ZoomIn, { size: 16 })
79426
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ZoomIn, { size: 16 })
79474
79427
  }
79475
79428
  ),
79476
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: getClassName23("divider") }),
79477
- /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79429
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName23("divider") }),
79430
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79478
79431
  "select",
79479
79432
  {
79480
79433
  className: getClassName23("zoomSelect"),
@@ -79482,7 +79435,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79482
79435
  onChange: (e2) => {
79483
79436
  onZoom(parseFloat(e2.currentTarget.value));
79484
79437
  },
79485
- children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
79438
+ children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79486
79439
  "option",
79487
79440
  {
79488
79441
  value: option.value,
@@ -79524,24 +79477,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79524
79477
  }
79525
79478
  return { autoZoom, rootHeight, zoom };
79526
79479
  };
79527
- var import_jsx_runtime33 = require("react/jsx-runtime");
79480
+ var import_jsx_runtime34 = require("react/jsx-runtime");
79528
79481
  var getClassName24 = get_class_name_factory_default2("PuckCanvas", styles_module_default19);
79529
79482
  var ZOOM_ON_CHANGE = true;
79530
79483
  var Canvas = () => {
79531
79484
  const { status, iframe } = useAppContext2();
79532
79485
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
79533
79486
  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 });
79487
+ const frameRef = (0, import_react28.useRef)(null);
79488
+ const [showTransition, setShowTransition] = (0, import_react28.useState)(false);
79489
+ const defaultRender = (0, import_react28.useMemo)(() => {
79490
+ const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children });
79538
79491
  return PuckDefault;
79539
79492
  }, []);
79540
- const CustomPreview = (0, import_react27.useMemo)(
79493
+ const CustomPreview = (0, import_react28.useMemo)(
79541
79494
  () => overrides.preview || defaultRender,
79542
79495
  [overrides]
79543
79496
  );
79544
- const getFrameDimensions = (0, import_react27.useCallback)(() => {
79497
+ const getFrameDimensions = (0, import_react28.useCallback)(() => {
79545
79498
  if (frameRef.current) {
79546
79499
  const frame = frameRef.current;
79547
79500
  const box = getBox3(frame);
@@ -79549,7 +79502,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79549
79502
  }
79550
79503
  return { width: 0, height: 0 };
79551
79504
  }, [frameRef]);
79552
- const resetAutoZoom = (0, import_react27.useCallback)(
79505
+ const resetAutoZoom = (0, import_react28.useCallback)(
79553
79506
  (ui2 = state.ui) => {
79554
79507
  if (frameRef.current) {
79555
79508
  setZoomConfig(
@@ -79559,11 +79512,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79559
79512
  },
79560
79513
  [frameRef, zoomConfig, state.ui]
79561
79514
  );
79562
- (0, import_react27.useEffect)(() => {
79515
+ (0, import_react28.useEffect)(() => {
79563
79516
  setShowTransition(false);
79564
79517
  resetAutoZoom();
79565
79518
  }, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
79566
- (0, import_react27.useEffect)(() => {
79519
+ (0, import_react28.useEffect)(() => {
79567
79520
  const { height: frameHeight } = getFrameDimensions();
79568
79521
  if (ui.viewports.current.height === "auto") {
79569
79522
  setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
@@ -79571,7 +79524,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79571
79524
  }));
79572
79525
  }
79573
79526
  }, [zoomConfig.zoom]);
79574
- (0, import_react27.useEffect)(() => {
79527
+ (0, import_react28.useEffect)(() => {
79575
79528
  const observer = new ResizeObserver(() => {
79576
79529
  setShowTransition(false);
79577
79530
  resetAutoZoom();
@@ -79583,7 +79536,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79583
79536
  observer.disconnect();
79584
79537
  };
79585
79538
  }, []);
79586
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
79539
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
79587
79540
  "div",
79588
79541
  {
79589
79542
  className: getClassName24({
@@ -79595,7 +79548,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79595
79548
  recordHistory: true
79596
79549
  }),
79597
79550
  children: [
79598
- ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79551
+ ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79599
79552
  ViewportControls,
79600
79553
  {
79601
79554
  autoZoom: zoomConfig.autoZoom,
@@ -79620,7 +79573,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79620
79573
  }
79621
79574
  }
79622
79575
  ) }),
79623
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
79576
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79624
79577
  "div",
79625
79578
  {
79626
79579
  className: getClassName24("root"),
@@ -79632,19 +79585,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79632
79585
  overflow: iframe.enabled ? void 0 : "auto"
79633
79586
  },
79634
79587
  suppressHydrationWarning: true,
79635
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Preview, {}) })
79588
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Preview, {}) })
79636
79589
  }
79637
79590
  ) })
79638
79591
  ]
79639
79592
  }
79640
79593
  );
79641
79594
  };
79642
- var import_jsx_runtime34 = require("react/jsx-runtime");
79595
+ var import_jsx_runtime35 = require("react/jsx-runtime");
79643
79596
  var getClassName25 = get_class_name_factory_default2("Puck", styles_module_default8);
79644
79597
  function Puck({
79645
79598
  children,
79646
79599
  config,
79647
- data: initialData = { content: [], root: { props: { title: "" } } },
79600
+ data: initialData = { content: [], root: {} },
79648
79601
  ui: initialUi,
79649
79602
  onChange,
79650
79603
  onPublish,
@@ -79662,11 +79615,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79662
79615
  }) {
79663
79616
  var _a3;
79664
79617
  const historyStore = useHistoryStore();
79665
- const [reducer2] = (0, import_react28.useState)(
79618
+ const [reducer2] = (0, import_react29.useState)(
79666
79619
  () => createReducer({ config, record: historyStore.record })
79667
79620
  );
79668
- const [initialAppState] = (0, import_react28.useState)(() => {
79669
- var _a22, _b, _c, _d;
79621
+ const [initialAppState] = (0, import_react29.useState)(() => {
79622
+ var _a22, _b, _c, _d, _e, _f, _g;
79670
79623
  const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
79671
79624
  let clientUiState = {};
79672
79625
  if (typeof window !== "undefined") {
@@ -79693,8 +79646,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79693
79646
  };
79694
79647
  }
79695
79648
  }
79649
+ if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_e = initialData == null ? void 0 : initialData.root) == null ? void 0 : _e.props)) {
79650
+ console.error(
79651
+ "Warning: Defining props on `root` is deprecated. Please use `root.props`, or republish this page to migrate automatically."
79652
+ );
79653
+ }
79654
+ const rootProps2 = ((_f = initialData == null ? void 0 : initialData.root) == null ? void 0 : _f.props) || (initialData == null ? void 0 : initialData.root) || {};
79655
+ const defaultedRootProps = __spreadValues2(__spreadValues2({}, (_g = config.root) == null ? void 0 : _g.defaultProps), rootProps2);
79696
79656
  return __spreadProps2(__spreadValues2({}, defaultAppState2), {
79697
- data: initialData,
79657
+ data: __spreadProps2(__spreadValues2({}, initialData), {
79658
+ root: __spreadProps2(__spreadValues2({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps }),
79659
+ content: initialData.content || []
79660
+ }),
79698
79661
  ui: __spreadProps2(__spreadValues2(__spreadValues2({}, initial), clientUiState), {
79699
79662
  // Store categories under componentList on state to allow render functions and plugins to modify
79700
79663
  componentList: config.categories ? Object.entries(config.categories).reduce(
@@ -79713,7 +79676,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79713
79676
  })
79714
79677
  });
79715
79678
  });
79716
- const [appState, dispatch] = (0, import_react28.useReducer)(
79679
+ const [appState, dispatch] = (0, import_react29.useReducer)(
79717
79680
  reducer2,
79718
79681
  flushZones(initialAppState)
79719
79682
  );
@@ -79724,9 +79687,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79724
79687
  config,
79725
79688
  dispatch
79726
79689
  );
79727
- const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
79690
+ const [menuOpen, setMenuOpen] = (0, import_react29.useState)(false);
79728
79691
  const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
79729
- const setItemSelector = (0, import_react28.useCallback)(
79692
+ const setItemSelector = (0, import_react29.useCallback)(
79730
79693
  (newItemSelector) => {
79731
79694
  if (newItemSelector === itemSelector)
79732
79695
  return;
@@ -79739,21 +79702,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79739
79702
  [itemSelector]
79740
79703
  );
79741
79704
  const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
79742
- (0, import_react28.useEffect)(() => {
79705
+ (0, import_react29.useEffect)(() => {
79743
79706
  if (onChange)
79744
79707
  onChange(data);
79745
79708
  }, [data]);
79746
79709
  const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
79747
- const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
79710
+ const [draggedItem, setDraggedItem] = (0, import_react29.useState)();
79748
79711
  const rootProps = data.root.props || data.root;
79749
- (0, import_react28.useEffect)(() => {
79750
- if (Object.keys(data.root).length > 0 && !data.root.props) {
79751
- console.error(
79752
- "Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
79753
- );
79754
- }
79755
- }, []);
79756
- const toggleSidebars = (0, import_react28.useCallback)(
79712
+ const toggleSidebars = (0, import_react29.useCallback)(
79757
79713
  (sidebar) => {
79758
79714
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
79759
79715
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -79767,7 +79723,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79767
79723
  },
79768
79724
  [dispatch, leftSideBarVisible, rightSideBarVisible]
79769
79725
  );
79770
- (0, import_react28.useEffect)(() => {
79726
+ (0, import_react29.useEffect)(() => {
79771
79727
  if (!window.matchMedia("(min-width: 638px)").matches) {
79772
79728
  dispatch({
79773
79729
  type: "setUi",
@@ -79790,11 +79746,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79790
79746
  window.removeEventListener("resize", handleResize);
79791
79747
  };
79792
79748
  }, []);
79793
- const defaultRender = (0, import_react28.useMemo)(() => {
79794
- const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: children2 });
79749
+ const defaultRender = (0, import_react29.useMemo)(() => {
79750
+ const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: children2 });
79795
79751
  return PuckDefault;
79796
79752
  }, []);
79797
- const defaultHeaderRender = (0, import_react28.useMemo)(() => {
79753
+ const defaultHeaderRender = (0, import_react29.useMemo)(() => {
79798
79754
  if (renderHeader) {
79799
79755
  console.warn(
79800
79756
  "`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
@@ -79802,45 +79758,45 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79802
79758
  const RenderHeader = (_a22) => {
79803
79759
  var _b = _a22, { actions } = _b, props = __objRest2(_b, ["actions"]);
79804
79760
  const Comp = renderHeader;
79805
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
79761
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
79806
79762
  };
79807
79763
  return RenderHeader;
79808
79764
  }
79809
79765
  return defaultRender;
79810
79766
  }, [renderHeader]);
79811
- const defaultHeaderActionsRender = (0, import_react28.useMemo)(() => {
79767
+ const defaultHeaderActionsRender = (0, import_react29.useMemo)(() => {
79812
79768
  if (renderHeaderActions) {
79813
79769
  console.warn(
79814
79770
  "`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
79815
79771
  );
79816
79772
  const RenderHeader = (props) => {
79817
79773
  const Comp = renderHeaderActions;
79818
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
79774
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
79819
79775
  };
79820
79776
  return RenderHeader;
79821
79777
  }
79822
79778
  return defaultRender;
79823
79779
  }, [renderHeader]);
79824
- const loadedOverrides = (0, import_react28.useMemo)(() => {
79780
+ const loadedOverrides = (0, import_react29.useMemo)(() => {
79825
79781
  return loadOverrides({ overrides, plugins });
79826
79782
  }, [plugins]);
79827
- const CustomPuck = (0, import_react28.useMemo)(
79783
+ const CustomPuck = (0, import_react29.useMemo)(
79828
79784
  () => loadedOverrides.puck || defaultRender,
79829
79785
  [loadedOverrides]
79830
79786
  );
79831
- const CustomHeader = (0, import_react28.useMemo)(
79787
+ const CustomHeader = (0, import_react29.useMemo)(
79832
79788
  () => loadedOverrides.header || defaultHeaderRender,
79833
79789
  [loadedOverrides]
79834
79790
  );
79835
- const CustomHeaderActions = (0, import_react28.useMemo)(
79791
+ const CustomHeaderActions = (0, import_react29.useMemo)(
79836
79792
  () => loadedOverrides.headerActions || defaultHeaderActionsRender,
79837
79793
  [loadedOverrides]
79838
79794
  );
79839
- const [mounted, setMounted] = (0, import_react28.useState)(false);
79840
- (0, import_react28.useEffect)(() => {
79795
+ const [mounted, setMounted] = (0, import_react29.useState)(false);
79796
+ (0, import_react29.useEffect)(() => {
79841
79797
  setMounted(true);
79842
79798
  }, []);
79843
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79799
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "Puck", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79844
79800
  AppProvider,
79845
79801
  {
79846
79802
  value: {
@@ -79855,7 +79811,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79855
79811
  viewports,
79856
79812
  iframe
79857
79813
  },
79858
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79814
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79859
79815
  DragDropContext2,
79860
79816
  {
79861
79817
  autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
@@ -79911,7 +79867,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79911
79867
  });
79912
79868
  }
79913
79869
  },
79914
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79870
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79915
79871
  DropZoneProvider,
79916
79872
  {
79917
79873
  value: {
@@ -79925,7 +79881,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79925
79881
  mode: "edit",
79926
79882
  areaId: "root"
79927
79883
  },
79928
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
79884
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
79929
79885
  "div",
79930
79886
  {
79931
79887
  className: getClassName25({
@@ -79935,65 +79891,62 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79935
79891
  rightSideBarVisible
79936
79892
  }),
79937
79893
  children: [
79938
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName25("layout"), children: [
79939
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79894
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("layout"), children: [
79895
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79940
79896
  CustomHeader,
79941
79897
  {
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)(
79945
- Button,
79946
- {
79947
- onClick: () => {
79948
- onPublish && onPublish(data);
79949
- },
79950
- icon: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Globe, { size: "14px" }),
79951
- children: "Publish"
79952
- }
79953
- )
79954
- ] }),
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)(
79898
+ actions: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79899
+ Button,
79900
+ {
79901
+ onClick: () => {
79902
+ onPublish && onPublish(data);
79903
+ },
79904
+ icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
79905
+ children: "Publish"
79906
+ }
79907
+ ) }) }),
79908
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("header", { className: getClassName25("header"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerInner"), children: [
79909
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerToggle"), children: [
79910
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("leftSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79958
79911
  IconButton,
79959
79912
  {
79960
79913
  onClick: () => {
79961
79914
  toggleSidebars("left");
79962
79915
  },
79963
79916
  title: "Toggle left sidebar",
79964
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelLeft, { focusable: "false" })
79917
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelLeft, { focusable: "false" })
79965
79918
  }
79966
79919
  ) }),
79967
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79920
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBarToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79968
79921
  IconButton,
79969
79922
  {
79970
79923
  onClick: () => {
79971
79924
  toggleSidebars("right");
79972
79925
  },
79973
79926
  title: "Toggle right sidebar",
79974
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelRight, { focusable: "false" })
79927
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelRight, { focusable: "false" })
79975
79928
  }
79976
79929
  ) })
79977
79930
  ] }),
79978
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Heading2, { rank: 2, size: "xs", children: [
79931
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Heading2, { rank: 2, size: "xs", children: [
79979
79932
  headerTitle || rootProps.title || "Page",
79980
- headerPath && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
79933
+ headerPath && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
79981
79934
  " ",
79982
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
79935
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { className: getClassName25("headerPath"), children: headerPath })
79983
79936
  ] })
79984
79937
  ] }) }),
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)(
79938
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("headerTools"), children: [
79939
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79987
79940
  IconButton,
79988
79941
  {
79989
79942
  onClick: () => {
79990
79943
  return setMenuOpen(!menuOpen);
79991
79944
  },
79992
79945
  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" })
79946
+ children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChevronDown, { focusable: "false" })
79994
79947
  }
79995
79948
  ) }),
79996
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79949
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79997
79950
  MenuBar,
79998
79951
  {
79999
79952
  appState,
@@ -80001,7 +79954,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80001
79954
  dispatch,
80002
79955
  onPublish,
80003
79956
  menuOpen,
80004
- renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomHeaderActions, {}),
79957
+ renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
79958
+ Button,
79959
+ {
79960
+ onClick: () => {
79961
+ onPublish && onPublish(data);
79962
+ },
79963
+ icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Globe, { size: "14px" }),
79964
+ children: "Publish"
79965
+ }
79966
+ ) }),
80005
79967
  setMenuOpen
80006
79968
  }
80007
79969
  )
@@ -80009,23 +79971,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80009
79971
  ] }) })
80010
79972
  }
80011
79973
  ),
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, {}) })
79974
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getClassName25("leftSideBar"), children: [
79975
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Components, {}) }),
79976
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Outline, {}) })
80015
79977
  ] }),
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)(
79978
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, {}),
79979
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getClassName25("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
80018
79980
  SidebarSection2,
80019
79981
  {
80020
79982
  noPadding: true,
80021
79983
  noBorderTop: true,
80022
79984
  showBreadcrumbs: true,
80023
79985
  title: selectedItem ? (_a3 = config.components[selectedItem.type]["label"]) != null ? _a3 : selectedItem.type : "Page",
80024
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Fields, {})
79986
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Fields, {})
80025
79987
  }
80026
79988
  ) })
80027
79989
  ] }),
80028
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
79990
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
80029
79991
  "div",
80030
79992
  {
80031
79993
  id: "puck-portal-root",
@@ -80047,16 +80009,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80047
80009
  Puck.Outline = Outline;
80048
80010
  Puck.Preview = Preview;
80049
80011
  init_react_import2();
80050
- var import_jsx_runtime35 = require("react/jsx-runtime");
80012
+ var import_jsx_runtime36 = require("react/jsx-runtime");
80051
80013
  function Render({
80052
80014
  config,
80053
80015
  data
80054
80016
  }) {
80055
80017
  var _a3;
80056
- const rootProps = data.root.props || data.root;
80018
+ const defaultedData = __spreadProps2(__spreadValues2({}, data), {
80019
+ root: data.root || {},
80020
+ content: data.content || []
80021
+ });
80022
+ const rootProps = defaultedData.root.props || defaultedData.root;
80057
80023
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
80058
80024
  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)(
80025
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
80060
80026
  config.root.render,
80061
80027
  __spreadProps2(__spreadValues2({}, rootProps), {
80062
80028
  puck: {
@@ -80065,11 +80031,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80065
80031
  title,
80066
80032
  editMode: false,
80067
80033
  id: "puck-root",
80068
- children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId2 })
80034
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 })
80069
80035
  })
80070
80036
  ) });
80071
80037
  }
80072
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DropZone, { zone: rootDroppableId2 }) });
80038
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 }) });
80073
80039
  }
80074
80040
  init_react_import2();
80075
80041
  var migrations = [
@@ -80093,6 +80059,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80093
80059
  return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
80094
80060
  }
80095
80061
  init_react_import2();
80062
+ init_react_import2();
80063
+ var defaultData = (data) => __spreadProps2(__spreadValues2({}, data), {
80064
+ root: data.root || {},
80065
+ content: data.content || []
80066
+ });
80096
80067
  function transformProps(data, propTransforms) {
80097
80068
  const mapItem = (item) => {
80098
80069
  if (propTransforms[item.type]) {
@@ -80102,18 +80073,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80102
80073
  }
80103
80074
  return item;
80104
80075
  };
80105
- const rootProps = data.root.props || data.root;
80106
- let newRoot = __spreadValues2({}, data.root);
80076
+ const defaultedData = defaultData(data);
80077
+ const rootProps = defaultedData.root.props || defaultedData.root;
80078
+ let newRoot = __spreadValues2({}, defaultedData.root);
80107
80079
  if (propTransforms["root"]) {
80108
- if (data.root.props) {
80080
+ if (defaultedData.root.props) {
80109
80081
  newRoot.props = propTransforms["root"](rootProps);
80110
80082
  } else {
80111
80083
  newRoot = propTransforms["root"](rootProps);
80112
80084
  }
80113
80085
  }
80114
- const afterPropTransforms = __spreadProps2(__spreadValues2({}, data), {
80086
+ const afterPropTransforms = __spreadProps2(__spreadValues2({}, defaultedData), {
80115
80087
  root: newRoot,
80116
- content: data.content.map(mapItem),
80088
+ content: defaultedData.content.map(mapItem),
80117
80089
  zones: Object.keys(data.zones || {}).reduce(
80118
80090
  (acc, zoneKey) => __spreadProps2(__spreadValues2({}, acc), {
80119
80091
  [zoneKey]: data.zones[zoneKey].map(mapItem)
@@ -80126,7 +80098,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80126
80098
  init_react_import2();
80127
80099
  function resolveAllData(data, config, onResolveStart, onResolveEnd) {
80128
80100
  return __async2(this, null, function* () {
80129
- const dynamicRoot = yield resolveRootData(data, config);
80101
+ const defaultedData = defaultData(data);
80102
+ const dynamicRoot = yield resolveRootData(defaultedData, config);
80130
80103
  const { zones = {} } = data;
80131
80104
  const zoneKeys = Object.keys(zones);
80132
80105
  const resolvedZones = {};
@@ -80139,10 +80112,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80139
80112
  onResolveEnd
80140
80113
  );
80141
80114
  }
80142
- return __spreadProps2(__spreadValues2({}, data), {
80115
+ return __spreadProps2(__spreadValues2({}, defaultedData), {
80143
80116
  root: dynamicRoot,
80144
80117
  content: yield resolveAllComponentData(
80145
- data.content,
80118
+ defaultedData.content,
80146
80119
  config,
80147
80120
  onResolveStart,
80148
80121
  onResolveEnd
@@ -80234,7 +80207,7 @@ init_react_import();
80234
80207
  // src/HeadingAnalyzer.tsx
80235
80208
  init_react_import();
80236
80209
  var import_react12 = require("react");
80237
- var import_puck = __toESM(require_dist2());
80210
+ var import_puck = __toESM(require_dist());
80238
80211
 
80239
80212
  // ../core/components/SidebarSection/index.tsx
80240
80213
  init_react_import();
@@ -80422,7 +80395,7 @@ var defaultViewports = [
80422
80395
  var import_ua_parser_js = __toESM(require_ua_parser());
80423
80396
  var import_jsx_runtime4 = require("react/jsx-runtime");
80424
80397
  var defaultAppState = {
80425
- data: { content: [], root: { props: { title: "" } } },
80398
+ data: { content: [], root: { props: {} } },
80426
80399
  ui: {
80427
80400
  leftSideBarVisible: true,
80428
80401
  rightSideBarVisible: true,