@measured/puck-plugin-heading-analyzer 0.21.0-canary.6dae6cb7 → 0.21.0-canary.72e4fcca

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.mjs CHANGED
@@ -91,7 +91,7 @@ var require_classnames = __commonJS({
91
91
  init_react_import();
92
92
  (function() {
93
93
  "use strict";
94
- var hasOwn = {}.hasOwnProperty;
94
+ var hasOwn2 = {}.hasOwnProperty;
95
95
  function classNames() {
96
96
  var classes = "";
97
97
  for (var i = 0; i < arguments.length; i++) {
@@ -117,7 +117,7 @@ var require_classnames = __commonJS({
117
117
  }
118
118
  var classes = "";
119
119
  for (var key in arg) {
120
- if (hasOwn.call(arg, key) && arg[key]) {
120
+ if (hasOwn2.call(arg, key) && arg[key]) {
121
121
  classes = appendClass(classes, key);
122
122
  }
123
123
  }
@@ -206,11 +206,11 @@ var require_flat = __commonJS({
206
206
  }
207
207
  function isEmpty(val) {
208
208
  const type = Object.prototype.toString.call(val);
209
- const isArray = type === "[object Array]";
209
+ const isArray2 = type === "[object Array]";
210
210
  const isObject = type === "[object Object]";
211
211
  if (!val) {
212
212
  return true;
213
- } else if (isArray) {
213
+ } else if (isArray2) {
214
214
  return !val.length;
215
215
  } else if (isObject) {
216
216
  return !Object.keys(val).length;
@@ -260,42 +260,6 @@ var require_flat = __commonJS({
260
260
  }
261
261
  });
262
262
 
263
- // ../../node_modules/fast-deep-equal/index.js
264
- var require_fast_deep_equal = __commonJS({
265
- "../../node_modules/fast-deep-equal/index.js"(exports, module) {
266
- "use strict";
267
- init_react_import();
268
- module.exports = function equal(a, b) {
269
- if (a === b) return true;
270
- if (a && b && typeof a == "object" && typeof b == "object") {
271
- if (a.constructor !== b.constructor) return false;
272
- var length, i, keys;
273
- if (Array.isArray(a)) {
274
- length = a.length;
275
- if (length != b.length) return false;
276
- for (i = length; i-- !== 0; )
277
- if (!equal(a[i], b[i])) return false;
278
- return true;
279
- }
280
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
281
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
282
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
283
- keys = Object.keys(a);
284
- length = keys.length;
285
- if (length !== Object.keys(b).length) return false;
286
- for (i = length; i-- !== 0; )
287
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
288
- for (i = length; i-- !== 0; ) {
289
- var key = keys[i];
290
- if (!equal(a[key], b[key])) return false;
291
- }
292
- return true;
293
- }
294
- return a !== a && b !== b;
295
- };
296
- }
297
- });
298
-
299
263
  // index.ts
300
264
  init_react_import();
301
265
 
@@ -305,17 +269,17 @@ import { useEffect as useEffect5, useState } from "react";
305
269
 
306
270
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
307
271
  init_react_import();
308
- var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
272
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
309
273
 
310
274
  // src/HeadingAnalyzer.tsx
311
275
  import { createUsePuck } from "@measured/puck";
312
276
 
313
- // ../core/components/SidebarSection/index.tsx
277
+ // ../core/components/OutlineList/index.tsx
314
278
  init_react_import();
315
279
 
316
- // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
280
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
317
281
  init_react_import();
318
- var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
282
+ var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
319
283
 
320
284
  // ../core/lib/get-class-name-factory.ts
321
285
  init_react_import();
@@ -344,29 +308,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
344
308
  };
345
309
  var get_class_name_factory_default = getClassNameFactory;
346
310
 
347
- // ../core/components/Heading/index.tsx
348
- init_react_import();
349
-
350
- // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
351
- init_react_import();
352
- var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
353
-
354
- // ../core/components/Heading/index.tsx
311
+ // ../core/components/OutlineList/index.tsx
355
312
  import { jsx } from "react/jsx-runtime";
356
- var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
357
- var Heading = ({ children, rank, size = "m" }) => {
358
- const Tag = rank ? `h${rank}` : "span";
313
+ var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
314
+ var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
315
+ var OutlineList = ({ children }) => {
316
+ return /* @__PURE__ */ jsx("ul", { className: getClassName(), children });
317
+ };
318
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassNameItem({ clickable: true }), children });
319
+ OutlineList.Item = ({
320
+ children,
321
+ onClick
322
+ }) => {
359
323
  return /* @__PURE__ */ jsx(
360
- Tag,
324
+ "li",
361
325
  {
362
- className: getClassName({
363
- [size]: true
364
- }),
326
+ className: getClassNameItem({ clickable: !!onClick }),
327
+ onClick,
365
328
  children
366
329
  }
367
330
  );
368
331
  };
369
332
 
333
+ // ../core/lib/scroll-into-view.ts
334
+ init_react_import();
335
+ var scrollIntoView = (el) => {
336
+ const oldStyle = __spreadValues({}, el.style);
337
+ el.style.scrollMargin = "256px";
338
+ if (el) {
339
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
340
+ el.style.scrollMargin = oldStyle.scrollMargin || "";
341
+ }
342
+ };
343
+
344
+ // ../core/lib/get-frame.ts
345
+ init_react_import();
346
+ var getFrame = () => {
347
+ if (typeof window === "undefined") return;
348
+ let frameEl = document.querySelector("#preview-frame");
349
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
350
+ return frameEl.contentDocument || document;
351
+ }
352
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
353
+ };
354
+
370
355
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
371
356
  init_react_import();
372
357
 
@@ -454,15 +439,29 @@ var createLucideIcon = (iconName, iconNode) => {
454
439
  return Component;
455
440
  };
456
441
 
457
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
442
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
458
443
  init_react_import();
459
- var ChevronRight = createLucideIcon("ChevronRight", [
460
- ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
444
+ var Heading1 = createLucideIcon("Heading1", [
445
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
446
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
447
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
448
+ ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
461
449
  ]);
462
450
 
463
- // ../core/lib/use-breadcrumbs.ts
451
+ // ../core/lib/index.ts
452
+ init_react_import();
453
+
454
+ // ../core/lib/filter.ts
455
+ init_react_import();
456
+
457
+ // ../core/lib/data/reorder.ts
458
+ init_react_import();
459
+
460
+ // ../core/lib/data/replace.ts
461
+ init_react_import();
462
+
463
+ // ../core/lib/use-reset-auto-zoom.ts
464
464
  init_react_import();
465
- import { useMemo } from "react";
466
465
 
467
466
  // ../core/store/index.ts
468
467
  init_react_import();
@@ -842,10 +841,10 @@ var insert = (list, index, item) => {
842
841
  // ../core/lib/generate-id.ts
843
842
  init_react_import();
844
843
 
845
- // ../../node_modules/uuid/dist/esm-node/index.js
844
+ // ../core/node_modules/uuid/dist/esm-node/index.js
846
845
  init_react_import();
847
846
 
848
- // ../../node_modules/uuid/dist/esm-node/rng.js
847
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
849
848
  init_react_import();
850
849
  import crypto from "crypto";
851
850
  var rnds8Pool = new Uint8Array(256);
@@ -858,7 +857,7 @@ function rng() {
858
857
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
859
858
  }
860
859
 
861
- // ../../node_modules/uuid/dist/esm-node/stringify.js
860
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
862
861
  init_react_import();
863
862
  var byteToHex = [];
864
863
  for (let i = 0; i < 256; ++i) {
@@ -868,17 +867,17 @@ function unsafeStringify(arr, offset = 0) {
868
867
  return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
869
868
  }
870
869
 
871
- // ../../node_modules/uuid/dist/esm-node/v4.js
870
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
872
871
  init_react_import();
873
872
 
874
- // ../../node_modules/uuid/dist/esm-node/native.js
873
+ // ../core/node_modules/uuid/dist/esm-node/native.js
875
874
  init_react_import();
876
875
  import crypto2 from "crypto";
877
876
  var native_default = {
878
877
  randomUUID: crypto2.randomUUID
879
878
  };
880
879
 
881
- // ../../node_modules/uuid/dist/esm-node/v4.js
880
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
882
881
  function v4(options, buf, offset) {
883
882
  if (native_default.randomUUID && !buf && !options) {
884
883
  return native_default.randomUUID();
@@ -1030,7 +1029,9 @@ var replaceAction = (state, action, appStore) => {
1030
1029
  });
1031
1030
  });
1032
1031
  });
1033
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1032
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1033
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1034
+ });
1034
1035
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1035
1036
  const id = zoneCompound.split(":")[0];
1036
1037
  if (id === originalId) {
@@ -1432,7 +1433,8 @@ init_react_import();
1432
1433
  var defaultViewports = [
1433
1434
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1434
1435
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1435
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1436
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1437
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1436
1438
  ];
1437
1439
 
1438
1440
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1458,7 +1460,7 @@ var createStoreImpl = (createState) => {
1458
1460
  const initialState = state = createState(setState, getState, api);
1459
1461
  return api;
1460
1462
  };
1461
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1463
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1462
1464
 
1463
1465
  // ../../node_modules/zustand/esm/react.mjs
1464
1466
  init_react_import();
@@ -1467,8 +1469,8 @@ var identity = (arg) => arg;
1467
1469
  function useStore(api, selector = identity) {
1468
1470
  const slice = React2.useSyncExternalStore(
1469
1471
  api.subscribe,
1470
- () => selector(api.getState()),
1471
- () => selector(api.getInitialState())
1472
+ React2.useCallback(() => selector(api.getState()), [api, selector]),
1473
+ React2.useCallback(() => selector(api.getInitialState()), [api, selector])
1472
1474
  );
1473
1475
  React2.useDebugValue(slice);
1474
1476
  return slice;
@@ -1479,13 +1481,13 @@ var createImpl = (createState) => {
1479
1481
  Object.assign(useBoundStore, api);
1480
1482
  return useBoundStore;
1481
1483
  };
1482
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1484
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1483
1485
 
1484
1486
  // ../../node_modules/zustand/esm/middleware.mjs
1485
1487
  init_react_import();
1486
1488
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1487
1489
  const origSubscribe = api.subscribe;
1488
- api.subscribe = (selector, optListener, options) => {
1490
+ api.subscribe = ((selector, optListener, options) => {
1489
1491
  let listener = selector;
1490
1492
  if (optListener) {
1491
1493
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1502,7 +1504,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1502
1504
  }
1503
1505
  }
1504
1506
  return origSubscribe(listener);
1505
- };
1507
+ });
1506
1508
  const initialState = fn(set, get, api);
1507
1509
  return initialState;
1508
1510
  };
@@ -1542,9 +1544,9 @@ function debounce(func, timeout = 300) {
1542
1544
  var tidyState = (state) => {
1543
1545
  return __spreadProps(__spreadValues({}, state), {
1544
1546
  ui: __spreadProps(__spreadValues({}, state.ui), {
1545
- field: {
1547
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1546
1548
  focus: null
1547
- }
1549
+ })
1548
1550
  })
1549
1551
  });
1550
1552
  };
@@ -1678,7 +1680,7 @@ var flattenData = (state, config) => {
1678
1680
  (content) => content,
1679
1681
  (item) => {
1680
1682
  data.push(item);
1681
- return null;
1683
+ return item;
1682
1684
  }
1683
1685
  );
1684
1686
  return data;
@@ -1686,42 +1688,462 @@ var flattenData = (state, config) => {
1686
1688
 
1687
1689
  // ../core/lib/get-changed.ts
1688
1690
  init_react_import();
1689
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1691
+
1692
+ // ../../node_modules/fast-equals/dist/esm/index.mjs
1693
+ init_react_import();
1694
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
1695
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1696
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1697
+ function combineComparators(comparatorA, comparatorB) {
1698
+ return function isEqual(a, b, state) {
1699
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
1700
+ };
1701
+ }
1702
+ function createIsCircular(areItemsEqual) {
1703
+ return function isCircular(a, b, state) {
1704
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") {
1705
+ return areItemsEqual(a, b, state);
1706
+ }
1707
+ var cache2 = state.cache;
1708
+ var cachedA = cache2.get(a);
1709
+ var cachedB = cache2.get(b);
1710
+ if (cachedA && cachedB) {
1711
+ return cachedA === b && cachedB === a;
1712
+ }
1713
+ cache2.set(a, b);
1714
+ cache2.set(b, a);
1715
+ var result = areItemsEqual(a, b, state);
1716
+ cache2.delete(a);
1717
+ cache2.delete(b);
1718
+ return result;
1719
+ };
1720
+ }
1721
+ function getStrictProperties(object) {
1722
+ return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1723
+ }
1724
+ var hasOwn = Object.hasOwn || (function(object, property) {
1725
+ return hasOwnProperty.call(object, property);
1726
+ });
1727
+ function sameValueZeroEqual(a, b) {
1728
+ return a === b || !a && !b && a !== a && b !== b;
1729
+ }
1730
+ var PREACT_VNODE = "__v";
1731
+ var PREACT_OWNER = "__o";
1732
+ var REACT_OWNER = "_owner";
1733
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1734
+ var keys = Object.keys;
1735
+ function areArraysEqual(a, b, state) {
1736
+ var index = a.length;
1737
+ if (b.length !== index) {
1738
+ return false;
1739
+ }
1740
+ while (index-- > 0) {
1741
+ if (!state.equals(a[index], b[index], index, index, a, b, state)) {
1742
+ return false;
1743
+ }
1744
+ }
1745
+ return true;
1746
+ }
1747
+ function areDatesEqual(a, b) {
1748
+ return sameValueZeroEqual(a.getTime(), b.getTime());
1749
+ }
1750
+ function areErrorsEqual(a, b) {
1751
+ return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
1752
+ }
1753
+ function areFunctionsEqual(a, b) {
1754
+ return a === b;
1755
+ }
1756
+ function areMapsEqual(a, b, state) {
1757
+ var size = a.size;
1758
+ if (size !== b.size) {
1759
+ return false;
1760
+ }
1761
+ if (!size) {
1762
+ return true;
1763
+ }
1764
+ var matchedIndices = new Array(size);
1765
+ var aIterable = a.entries();
1766
+ var aResult;
1767
+ var bResult;
1768
+ var index = 0;
1769
+ while (aResult = aIterable.next()) {
1770
+ if (aResult.done) {
1771
+ break;
1772
+ }
1773
+ var bIterable = b.entries();
1774
+ var hasMatch = false;
1775
+ var matchIndex = 0;
1776
+ while (bResult = bIterable.next()) {
1777
+ if (bResult.done) {
1778
+ break;
1779
+ }
1780
+ if (matchedIndices[matchIndex]) {
1781
+ matchIndex++;
1782
+ continue;
1783
+ }
1784
+ var aEntry = aResult.value;
1785
+ var bEntry = bResult.value;
1786
+ if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
1787
+ hasMatch = matchedIndices[matchIndex] = true;
1788
+ break;
1789
+ }
1790
+ matchIndex++;
1791
+ }
1792
+ if (!hasMatch) {
1793
+ return false;
1794
+ }
1795
+ index++;
1796
+ }
1797
+ return true;
1798
+ }
1799
+ var areNumbersEqual = sameValueZeroEqual;
1800
+ function areObjectsEqual(a, b, state) {
1801
+ var properties = keys(a);
1802
+ var index = properties.length;
1803
+ if (keys(b).length !== index) {
1804
+ return false;
1805
+ }
1806
+ while (index-- > 0) {
1807
+ if (!isPropertyEqual(a, b, state, properties[index])) {
1808
+ return false;
1809
+ }
1810
+ }
1811
+ return true;
1812
+ }
1813
+ function areObjectsEqualStrict(a, b, state) {
1814
+ var properties = getStrictProperties(a);
1815
+ var index = properties.length;
1816
+ if (getStrictProperties(b).length !== index) {
1817
+ return false;
1818
+ }
1819
+ var property;
1820
+ var descriptorA;
1821
+ var descriptorB;
1822
+ while (index-- > 0) {
1823
+ property = properties[index];
1824
+ if (!isPropertyEqual(a, b, state, property)) {
1825
+ return false;
1826
+ }
1827
+ descriptorA = getOwnPropertyDescriptor(a, property);
1828
+ descriptorB = getOwnPropertyDescriptor(b, property);
1829
+ if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
1830
+ return false;
1831
+ }
1832
+ }
1833
+ return true;
1834
+ }
1835
+ function arePrimitiveWrappersEqual(a, b) {
1836
+ return sameValueZeroEqual(a.valueOf(), b.valueOf());
1837
+ }
1838
+ function areRegExpsEqual(a, b) {
1839
+ return a.source === b.source && a.flags === b.flags;
1840
+ }
1841
+ function areSetsEqual(a, b, state) {
1842
+ var size = a.size;
1843
+ if (size !== b.size) {
1844
+ return false;
1845
+ }
1846
+ if (!size) {
1847
+ return true;
1848
+ }
1849
+ var matchedIndices = new Array(size);
1850
+ var aIterable = a.values();
1851
+ var aResult;
1852
+ var bResult;
1853
+ while (aResult = aIterable.next()) {
1854
+ if (aResult.done) {
1855
+ break;
1856
+ }
1857
+ var bIterable = b.values();
1858
+ var hasMatch = false;
1859
+ var matchIndex = 0;
1860
+ while (bResult = bIterable.next()) {
1861
+ if (bResult.done) {
1862
+ break;
1863
+ }
1864
+ if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
1865
+ hasMatch = matchedIndices[matchIndex] = true;
1866
+ break;
1867
+ }
1868
+ matchIndex++;
1869
+ }
1870
+ if (!hasMatch) {
1871
+ return false;
1872
+ }
1873
+ }
1874
+ return true;
1875
+ }
1876
+ function areTypedArraysEqual(a, b) {
1877
+ var index = a.length;
1878
+ if (b.length !== index) {
1879
+ return false;
1880
+ }
1881
+ while (index-- > 0) {
1882
+ if (a[index] !== b[index]) {
1883
+ return false;
1884
+ }
1885
+ }
1886
+ return true;
1887
+ }
1888
+ function areUrlsEqual(a, b) {
1889
+ return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
1890
+ }
1891
+ function isPropertyEqual(a, b, state, property) {
1892
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
1893
+ return true;
1894
+ }
1895
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
1896
+ }
1897
+ var ARGUMENTS_TAG = "[object Arguments]";
1898
+ var BOOLEAN_TAG = "[object Boolean]";
1899
+ var DATE_TAG = "[object Date]";
1900
+ var ERROR_TAG = "[object Error]";
1901
+ var MAP_TAG = "[object Map]";
1902
+ var NUMBER_TAG = "[object Number]";
1903
+ var OBJECT_TAG = "[object Object]";
1904
+ var REG_EXP_TAG = "[object RegExp]";
1905
+ var SET_TAG = "[object Set]";
1906
+ var STRING_TAG = "[object String]";
1907
+ var URL_TAG = "[object URL]";
1908
+ var isArray = Array.isArray;
1909
+ var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
1910
+ var assign = Object.assign;
1911
+ var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
1912
+ function createEqualityComparator(_a) {
1913
+ var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areErrorsEqual2 = _a.areErrorsEqual, areFunctionsEqual2 = _a.areFunctionsEqual, areMapsEqual2 = _a.areMapsEqual, areNumbersEqual2 = _a.areNumbersEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual, areUrlsEqual2 = _a.areUrlsEqual;
1914
+ return function comparator(a, b, state) {
1915
+ if (a === b) {
1916
+ return true;
1917
+ }
1918
+ if (a == null || b == null) {
1919
+ return false;
1920
+ }
1921
+ var type = typeof a;
1922
+ if (type !== typeof b) {
1923
+ return false;
1924
+ }
1925
+ if (type !== "object") {
1926
+ if (type === "number") {
1927
+ return areNumbersEqual2(a, b, state);
1928
+ }
1929
+ if (type === "function") {
1930
+ return areFunctionsEqual2(a, b, state);
1931
+ }
1932
+ return false;
1933
+ }
1934
+ var constructor = a.constructor;
1935
+ if (constructor !== b.constructor) {
1936
+ return false;
1937
+ }
1938
+ if (constructor === Object) {
1939
+ return areObjectsEqual2(a, b, state);
1940
+ }
1941
+ if (isArray(a)) {
1942
+ return areArraysEqual2(a, b, state);
1943
+ }
1944
+ if (isTypedArray != null && isTypedArray(a)) {
1945
+ return areTypedArraysEqual2(a, b, state);
1946
+ }
1947
+ if (constructor === Date) {
1948
+ return areDatesEqual2(a, b, state);
1949
+ }
1950
+ if (constructor === RegExp) {
1951
+ return areRegExpsEqual2(a, b, state);
1952
+ }
1953
+ if (constructor === Map) {
1954
+ return areMapsEqual2(a, b, state);
1955
+ }
1956
+ if (constructor === Set) {
1957
+ return areSetsEqual2(a, b, state);
1958
+ }
1959
+ var tag = getTag(a);
1960
+ if (tag === DATE_TAG) {
1961
+ return areDatesEqual2(a, b, state);
1962
+ }
1963
+ if (tag === REG_EXP_TAG) {
1964
+ return areRegExpsEqual2(a, b, state);
1965
+ }
1966
+ if (tag === MAP_TAG) {
1967
+ return areMapsEqual2(a, b, state);
1968
+ }
1969
+ if (tag === SET_TAG) {
1970
+ return areSetsEqual2(a, b, state);
1971
+ }
1972
+ if (tag === OBJECT_TAG) {
1973
+ return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
1974
+ }
1975
+ if (tag === URL_TAG) {
1976
+ return areUrlsEqual2(a, b, state);
1977
+ }
1978
+ if (tag === ERROR_TAG) {
1979
+ return areErrorsEqual2(a, b, state);
1980
+ }
1981
+ if (tag === ARGUMENTS_TAG) {
1982
+ return areObjectsEqual2(a, b, state);
1983
+ }
1984
+ if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
1985
+ return arePrimitiveWrappersEqual2(a, b, state);
1986
+ }
1987
+ return false;
1988
+ };
1989
+ }
1990
+ function createEqualityComparatorConfig(_a) {
1991
+ var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
1992
+ var config = {
1993
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
1994
+ areDatesEqual,
1995
+ areErrorsEqual,
1996
+ areFunctionsEqual,
1997
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
1998
+ areNumbersEqual,
1999
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
2000
+ arePrimitiveWrappersEqual,
2001
+ areRegExpsEqual,
2002
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
2003
+ areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
2004
+ areUrlsEqual
2005
+ };
2006
+ if (createCustomConfig) {
2007
+ config = assign({}, config, createCustomConfig(config));
2008
+ }
2009
+ if (circular) {
2010
+ var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
2011
+ var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
2012
+ var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
2013
+ var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
2014
+ config = assign({}, config, {
2015
+ areArraysEqual: areArraysEqual$1,
2016
+ areMapsEqual: areMapsEqual$1,
2017
+ areObjectsEqual: areObjectsEqual$1,
2018
+ areSetsEqual: areSetsEqual$1
2019
+ });
2020
+ }
2021
+ return config;
2022
+ }
2023
+ function createInternalEqualityComparator(compare) {
2024
+ return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
2025
+ return compare(a, b, state);
2026
+ };
2027
+ }
2028
+ function createIsEqual(_a) {
2029
+ var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
2030
+ if (createState) {
2031
+ return function isEqual(a, b) {
2032
+ var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
2033
+ return comparator(a, b, {
2034
+ cache: cache2,
2035
+ equals,
2036
+ meta,
2037
+ strict
2038
+ });
2039
+ };
2040
+ }
2041
+ if (circular) {
2042
+ return function isEqual(a, b) {
2043
+ return comparator(a, b, {
2044
+ cache: /* @__PURE__ */ new WeakMap(),
2045
+ equals,
2046
+ meta: void 0,
2047
+ strict
2048
+ });
2049
+ };
2050
+ }
2051
+ var state = {
2052
+ cache: void 0,
2053
+ equals,
2054
+ meta: void 0,
2055
+ strict
2056
+ };
2057
+ return function isEqual(a, b) {
2058
+ return comparator(a, b, state);
2059
+ };
2060
+ }
2061
+ var deepEqual = createCustomEqual();
2062
+ var strictDeepEqual = createCustomEqual({ strict: true });
2063
+ var circularDeepEqual = createCustomEqual({ circular: true });
2064
+ var strictCircularDeepEqual = createCustomEqual({
2065
+ circular: true,
2066
+ strict: true
2067
+ });
2068
+ var shallowEqual = createCustomEqual({
2069
+ createInternalComparator: function() {
2070
+ return sameValueZeroEqual;
2071
+ }
2072
+ });
2073
+ var strictShallowEqual = createCustomEqual({
2074
+ strict: true,
2075
+ createInternalComparator: function() {
2076
+ return sameValueZeroEqual;
2077
+ }
2078
+ });
2079
+ var circularShallowEqual = createCustomEqual({
2080
+ circular: true,
2081
+ createInternalComparator: function() {
2082
+ return sameValueZeroEqual;
2083
+ }
2084
+ });
2085
+ var strictCircularShallowEqual = createCustomEqual({
2086
+ circular: true,
2087
+ createInternalComparator: function() {
2088
+ return sameValueZeroEqual;
2089
+ },
2090
+ strict: true
2091
+ });
2092
+ function createCustomEqual(options) {
2093
+ if (options === void 0) {
2094
+ options = {};
2095
+ }
2096
+ var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;
2097
+ var config = createEqualityComparatorConfig(options);
2098
+ var comparator = createEqualityComparator(config);
2099
+ var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
2100
+ return createIsEqual({ circular, comparator, createState, equals, strict });
2101
+ }
2102
+
2103
+ // ../core/lib/get-changed.ts
1690
2104
  var getChanged = (newItem, oldItem) => {
1691
2105
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1692
2106
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1693
2107
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1694
2108
  return __spreadProps(__spreadValues({}, acc), {
1695
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
2109
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
1696
2110
  });
1697
2111
  }, {}) : {};
1698
2112
  };
1699
2113
 
1700
2114
  // ../core/store/slices/permissions.ts
1701
2115
  var createPermissionsSlice = (set, get) => {
1702
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2116
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1703
2117
  const { state, permissions, config } = get();
1704
2118
  const { cache: cache2, globalPermissions } = permissions;
1705
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1706
- var _a, _b, _c;
2119
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2120
+ var _a, _b;
1707
2121
  const { config: config2, state: appState, setComponentLoading } = get();
2122
+ const itemCache = cache2[item2.props.id];
2123
+ const nodes = appState.indexes.nodes;
2124
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2125
+ const parentNode = parentId ? nodes[parentId] : null;
2126
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
1708
2127
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1709
2128
  if (!componentConfig) {
1710
2129
  return;
1711
2130
  }
1712
2131
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1713
2132
  if (componentConfig.resolvePermissions) {
1714
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
1715
- if (Object.values(changed).some((el) => el === true) || force2) {
2133
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2134
+ const propsChanged = Object.values(changed).some((el) => el === true);
2135
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2136
+ if (propsChanged || parentChanged || force2) {
1716
2137
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1717
2138
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1718
2139
  item2,
1719
2140
  {
1720
2141
  changed,
1721
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2142
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1722
2143
  permissions: initialPermissions,
1723
2144
  appState: makeStatePublic(appState),
1724
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2145
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2146
+ parent: parentData
1725
2147
  }
1726
2148
  );
1727
2149
  const latest = get().permissions;
@@ -1729,6 +2151,7 @@ var createPermissionsSlice = (set, get) => {
1729
2151
  permissions: __spreadProps(__spreadValues({}, latest), {
1730
2152
  cache: __spreadProps(__spreadValues({}, latest.cache), {
1731
2153
  [item2.props.id]: {
2154
+ lastParentId: parentId,
1732
2155
  lastData: item2,
1733
2156
  lastPermissions: resolvedPermissions
1734
2157
  }
@@ -1742,9 +2165,9 @@ var createPermissionsSlice = (set, get) => {
1742
2165
  }
1743
2166
  }
1744
2167
  });
1745
- const resolveDataForRoot = (force2 = false) => {
2168
+ const resolvePermissionsForRoot = (force2 = false) => {
1746
2169
  const { state: appState } = get();
1747
- resolveDataForItem(
2170
+ resolvePermissionsForItem(
1748
2171
  // Shim the root data in by conforming to component data shape
1749
2172
  {
1750
2173
  type: "root",
@@ -1755,16 +2178,16 @@ var createPermissionsSlice = (set, get) => {
1755
2178
  };
1756
2179
  const { item, type, root } = params;
1757
2180
  if (item) {
1758
- yield resolveDataForItem(item, force);
2181
+ yield resolvePermissionsForItem(item, force);
1759
2182
  } else if (type) {
1760
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1761
- yield resolveDataForItem(item2, force);
2183
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2184
+ yield resolvePermissionsForItem(item2, force);
1762
2185
  }));
1763
2186
  } else if (root) {
1764
- resolveDataForRoot(force);
2187
+ resolvePermissionsForRoot(force);
1765
2188
  } else {
1766
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1767
- yield resolveDataForItem(item2, force);
2189
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2190
+ yield resolvePermissionsForItem(item2, force);
1768
2191
  }));
1769
2192
  }
1770
2193
  });
@@ -1817,16 +2240,15 @@ var createFieldsSlice = (_set, _get) => {
1817
2240
 
1818
2241
  // ../core/lib/resolve-component-data.ts
1819
2242
  init_react_import();
1820
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1821
2243
  var cache = { lastChange: {} };
1822
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2244
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1823
2245
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1824
2246
  const resolvedItem = __spreadValues({}, item);
1825
2247
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1826
2248
  const id = "id" in item.props ? item.props.id : "root";
1827
2249
  if (shouldRunResolver) {
1828
2250
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1829
- if (trigger !== "force" && item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
2251
+ if (trigger !== "force" && item && deepEqual(item, oldItem)) {
1830
2252
  return { node: resolved, didChange: false };
1831
2253
  }
1832
2254
  const changed = getChanged(item, oldItem);
@@ -1847,11 +2269,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1847
2269
  let itemWithResolvedChildren = yield mapFields(
1848
2270
  resolvedItem,
1849
2271
  {
1850
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2272
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
1851
2273
  const content = value;
1852
2274
  return yield Promise.all(
1853
2275
  content.map(
1854
- (childItem) => __async(void 0, null, function* () {
2276
+ (childItem) => __async(null, null, function* () {
1855
2277
  return (yield resolveComponentData(
1856
2278
  childItem,
1857
2279
  config,
@@ -1876,7 +2298,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1876
2298
  };
1877
2299
  return {
1878
2300
  node: itemWithResolvedChildren,
1879
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
2301
+ didChange: !deepEqual(item, itemWithResolvedChildren)
1880
2302
  };
1881
2303
  });
1882
2304
 
@@ -1917,7 +2339,8 @@ var defaultAppState = {
1917
2339
  options: [],
1918
2340
  controlsVisible: true
1919
2341
  },
1920
- field: { focus: null }
2342
+ field: { focus: null },
2343
+ plugin: { current: null }
1921
2344
  },
1922
2345
  indexes: {
1923
2346
  nodes: {},
@@ -1933,6 +2356,7 @@ var createAppStore = (initialAppStore) => create()(
1933
2356
  subscribeWithSelector((set, get) => {
1934
2357
  var _a, _b;
1935
2358
  return __spreadProps(__spreadValues({
2359
+ instanceId: generateId(),
1936
2360
  state: defaultAppState,
1937
2361
  config: { components: {} },
1938
2362
  componentState: {},
@@ -1953,6 +2377,11 @@ var createAppStore = (initialAppStore) => create()(
1953
2377
  history: createHistorySlice(set, get),
1954
2378
  nodes: createNodesSlice(set, get),
1955
2379
  permissions: createPermissionsSlice(set, get),
2380
+ getCurrentData: () => {
2381
+ var _a2;
2382
+ const s = get();
2383
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
2384
+ },
1956
2385
  getComponentConfig: (type) => {
1957
2386
  var _a2;
1958
2387
  const { config, selectedItem } = get();
@@ -2041,7 +2470,7 @@ var createAppStore = (initialAppStore) => create()(
2041
2470
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2042
2471
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2043
2472
  }),
2044
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2473
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2045
2474
  const { config, metadata, setComponentLoading, permissions } = get();
2046
2475
  const timeouts = {};
2047
2476
  return yield resolveComponentData(
@@ -2052,7 +2481,7 @@ var createAppStore = (initialAppStore) => create()(
2052
2481
  const id = "id" in item.props ? item.props.id : "root";
2053
2482
  timeouts[id] = setComponentLoading(id, true, 50);
2054
2483
  },
2055
- (item) => __async(void 0, null, function* () {
2484
+ (item) => __async(null, null, function* () {
2056
2485
  const id = "id" in item.props ? item.props.id : "root";
2057
2486
  if ("type" in item) {
2058
2487
  yield permissions.refreshPermissions({ item });
@@ -2064,7 +2493,7 @@ var createAppStore = (initialAppStore) => create()(
2064
2493
  trigger
2065
2494
  );
2066
2495
  }),
2067
- resolveAndCommitData: () => __async(void 0, null, function* () {
2496
+ resolveAndCommitData: () => __async(null, null, function* () {
2068
2497
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2069
2498
  walkAppState(
2070
2499
  state,
@@ -2103,203 +2532,14 @@ var createAppStore = (initialAppStore) => create()(
2103
2532
  })
2104
2533
  );
2105
2534
  var appStoreContext = createContext(createAppStore());
2106
- function useAppStore(selector) {
2107
- const context = useContext(appStoreContext);
2108
- return useStore(context, selector);
2109
- }
2110
- function useAppStoreApi() {
2111
- return useContext(appStoreContext);
2112
- }
2113
-
2114
- // ../core/lib/use-breadcrumbs.ts
2115
- var useBreadcrumbs = (renderCount) => {
2116
- const selectedId = useAppStore((s) => {
2117
- var _a;
2118
- return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2119
- });
2120
- const config = useAppStore((s) => s.config);
2121
- const path = useAppStore((s) => {
2122
- var _a;
2123
- return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2124
- });
2125
- const appStore = useAppStoreApi();
2126
- return useMemo(() => {
2127
- const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2128
- var _a, _b, _c;
2129
- const [componentId] = zoneCompound.split(":");
2130
- if (componentId === "root") {
2131
- return {
2132
- label: "Page",
2133
- selector: null
2134
- };
2135
- }
2136
- const node = appStore.getState().state.indexes.nodes[componentId];
2137
- const parentId = node.path[node.path.length - 1];
2138
- const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2139
- const index = contentIds.indexOf(componentId);
2140
- const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2141
- return {
2142
- label,
2143
- selector: node ? {
2144
- index,
2145
- zone: node.path[node.path.length - 1]
2146
- } : null
2147
- };
2148
- })) || [];
2149
- if (renderCount) {
2150
- return breadcrumbs.slice(breadcrumbs.length - renderCount);
2151
- }
2152
- return breadcrumbs;
2153
- }, [path, renderCount]);
2154
- };
2155
-
2156
- // ../core/components/Loader/index.tsx
2157
- init_react_import();
2158
-
2159
- // ../core/lib/index.ts
2160
- init_react_import();
2161
-
2162
- // ../core/lib/filter.ts
2163
- init_react_import();
2164
-
2165
- // ../core/lib/data/reorder.ts
2166
- init_react_import();
2167
-
2168
- // ../core/lib/data/replace.ts
2169
- init_react_import();
2170
-
2171
- // ../core/lib/use-reset-auto-zoom.ts
2172
- init_react_import();
2173
2535
 
2174
2536
  // ../core/lib/get-zoom-config.ts
2175
2537
  init_react_import();
2176
2538
 
2177
- // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2178
- init_react_import();
2179
- var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2180
-
2181
- // ../core/components/Loader/index.tsx
2182
- import { jsx as jsx2 } from "react/jsx-runtime";
2183
- var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2184
- var Loader = (_a) => {
2185
- var _b = _a, {
2186
- color,
2187
- size = 16
2188
- } = _b, props = __objRest(_b, [
2189
- "color",
2190
- "size"
2191
- ]);
2192
- return /* @__PURE__ */ jsx2(
2193
- "span",
2194
- __spreadValues({
2195
- className: getClassName2(),
2196
- style: {
2197
- width: size,
2198
- height: size,
2199
- color
2200
- },
2201
- "aria-label": "loading"
2202
- }, props)
2203
- );
2204
- };
2205
-
2206
- // ../core/components/SidebarSection/index.tsx
2207
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
2208
- var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2209
- var SidebarSection = ({
2210
- children,
2211
- title,
2212
- background,
2213
- showBreadcrumbs,
2214
- noBorderTop,
2215
- noPadding,
2216
- isLoading
2217
- }) => {
2218
- const setUi = useAppStore((s) => s.setUi);
2219
- const breadcrumbs = useBreadcrumbs(1);
2220
- return /* @__PURE__ */ jsxs(
2221
- "div",
2222
- {
2223
- className: getClassName3({ noBorderTop, noPadding }),
2224
- style: { background },
2225
- children: [
2226
- /* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2227
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
2228
- /* @__PURE__ */ jsx3(
2229
- "button",
2230
- {
2231
- type: "button",
2232
- className: getClassName3("breadcrumbLabel"),
2233
- onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2234
- children: breadcrumb.label
2235
- }
2236
- ),
2237
- /* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
2238
- ] }, i)) : null,
2239
- /* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
2240
- ] }) }),
2241
- /* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
2242
- isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
2243
- ]
2244
- }
2245
- );
2246
- };
2247
-
2248
- // ../core/components/OutlineList/index.tsx
2249
- init_react_import();
2250
-
2251
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2252
- init_react_import();
2253
- var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2254
-
2255
- // ../core/components/OutlineList/index.tsx
2256
- import { jsx as jsx4 } from "react/jsx-runtime";
2257
- var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2258
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2259
- var OutlineList = ({ children }) => {
2260
- return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
2261
- };
2262
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
2263
- OutlineList.Item = ({
2264
- children,
2265
- onClick
2266
- }) => {
2267
- return /* @__PURE__ */ jsx4(
2268
- "li",
2269
- {
2270
- className: getClassNameItem({ clickable: !!onClick }),
2271
- onClick,
2272
- children
2273
- }
2274
- );
2275
- };
2276
-
2277
- // ../core/lib/scroll-into-view.ts
2278
- init_react_import();
2279
- var scrollIntoView = (el) => {
2280
- const oldStyle = __spreadValues({}, el.style);
2281
- el.style.scrollMargin = "256px";
2282
- if (el) {
2283
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2284
- el.style.scrollMargin = oldStyle.scrollMargin || "";
2285
- }
2286
- };
2287
-
2288
- // ../core/lib/get-frame.ts
2289
- init_react_import();
2290
- var getFrame = () => {
2291
- if (typeof window === "undefined") return;
2292
- let frameEl = document.querySelector("#preview-frame");
2293
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2294
- return frameEl.contentDocument || document;
2295
- }
2296
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2297
- };
2298
-
2299
2539
  // src/HeadingAnalyzer.tsx
2300
2540
  import ReactFromJSONModule from "react-from-json";
2301
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
2302
- var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2541
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
2542
+ var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2303
2543
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2304
2544
  var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
2305
2545
  var getOutline = ({ frame } = {}) => {
@@ -2390,11 +2630,11 @@ var HeadingAnalyzer = () => {
2390
2630
  frameObserver.disconnect();
2391
2631
  };
2392
2632
  }, [data]);
2393
- return /* @__PURE__ */ jsxs2("div", { className: getClassName5(), children: [
2394
- /* @__PURE__ */ jsxs2(
2633
+ return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
2634
+ /* @__PURE__ */ jsxs(
2395
2635
  "small",
2396
2636
  {
2397
- className: getClassName5("cssWarning"),
2637
+ className: getClassName2("cssWarning"),
2398
2638
  style: {
2399
2639
  color: "var(--puck-color-red-04)",
2400
2640
  display: "block",
@@ -2403,19 +2643,19 @@ var HeadingAnalyzer = () => {
2403
2643
  children: [
2404
2644
  "Heading analyzer styles not loaded. Please review the",
2405
2645
  " ",
2406
- /* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2646
+ /* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2407
2647
  "."
2408
2648
  ]
2409
2649
  }
2410
2650
  ),
2411
- hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
2412
- /* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
2651
+ hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
2652
+ /* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
2413
2653
  ReactFromJSON,
2414
2654
  {
2415
2655
  mapping: {
2416
- Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
2417
- OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
2418
- /* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
2656
+ Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
2657
+ OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
2658
+ /* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
2419
2659
  "small",
2420
2660
  {
2421
2661
  className: getClassNameItem2({ missing: props.missing }),
@@ -2433,14 +2673,14 @@ var HeadingAnalyzer = () => {
2433
2673
  }, 2e3);
2434
2674
  }
2435
2675
  },
2436
- children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2437
- /* @__PURE__ */ jsxs2("b", { children: [
2676
+ children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
2677
+ /* @__PURE__ */ jsxs("b", { children: [
2438
2678
  "H",
2439
2679
  props.rank
2440
2680
  ] }),
2441
2681
  ": Missing"
2442
- ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
2443
- /* @__PURE__ */ jsxs2("b", { children: [
2682
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2683
+ /* @__PURE__ */ jsxs("b", { children: [
2444
2684
  "H",
2445
2685
  props.rank
2446
2686
  ] }),
@@ -2449,7 +2689,7 @@ var HeadingAnalyzer = () => {
2449
2689
  ] })
2450
2690
  }
2451
2691
  ) }),
2452
- /* @__PURE__ */ jsx5(OutlineList, { children: props.children })
2692
+ /* @__PURE__ */ jsx2(OutlineList, { children: props.children })
2453
2693
  ] })
2454
2694
  },
2455
2695
  entry: {
@@ -2470,12 +2710,10 @@ var HeadingAnalyzer = () => {
2470
2710
  ] });
2471
2711
  };
2472
2712
  var headingAnalyzer = {
2473
- overrides: {
2474
- fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2475
- children,
2476
- /* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
2477
- ] })
2478
- }
2713
+ name: "heading-analyzer",
2714
+ label: "Audit",
2715
+ render: HeadingAnalyzer,
2716
+ icon: /* @__PURE__ */ jsx2(Heading1, {})
2479
2717
  };
2480
2718
  var HeadingAnalyzer_default = headingAnalyzer;
2481
2719
  export {
@@ -2491,45 +2729,10 @@ classnames/index.js:
2491
2729
  *)
2492
2730
 
2493
2731
  lucide-react/dist/esm/shared/src/utils.js:
2494
- (**
2495
- * @license lucide-react v0.468.0 - ISC
2496
- *
2497
- * This source code is licensed under the ISC license.
2498
- * See the LICENSE file in the root directory of this source tree.
2499
- *)
2500
-
2501
2732
  lucide-react/dist/esm/defaultAttributes.js:
2502
- (**
2503
- * @license lucide-react v0.468.0 - ISC
2504
- *
2505
- * This source code is licensed under the ISC license.
2506
- * See the LICENSE file in the root directory of this source tree.
2507
- *)
2508
-
2509
2733
  lucide-react/dist/esm/Icon.js:
2510
- (**
2511
- * @license lucide-react v0.468.0 - ISC
2512
- *
2513
- * This source code is licensed under the ISC license.
2514
- * See the LICENSE file in the root directory of this source tree.
2515
- *)
2516
-
2517
2734
  lucide-react/dist/esm/createLucideIcon.js:
2518
- (**
2519
- * @license lucide-react v0.468.0 - ISC
2520
- *
2521
- * This source code is licensed under the ISC license.
2522
- * See the LICENSE file in the root directory of this source tree.
2523
- *)
2524
-
2525
- lucide-react/dist/esm/icons/chevron-right.js:
2526
- (**
2527
- * @license lucide-react v0.468.0 - ISC
2528
- *
2529
- * This source code is licensed under the ISC license.
2530
- * See the LICENSE file in the root directory of this source tree.
2531
- *)
2532
-
2735
+ lucide-react/dist/esm/icons/heading-1.js:
2533
2736
  lucide-react/dist/esm/lucide-react.js:
2534
2737
  (**
2535
2738
  * @license lucide-react v0.468.0 - ISC