@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.js CHANGED
@@ -98,7 +98,7 @@ var require_classnames = __commonJS({
98
98
  init_react_import();
99
99
  (function() {
100
100
  "use strict";
101
- var hasOwn = {}.hasOwnProperty;
101
+ var hasOwn2 = {}.hasOwnProperty;
102
102
  function classNames() {
103
103
  var classes = "";
104
104
  for (var i = 0; i < arguments.length; i++) {
@@ -124,7 +124,7 @@ var require_classnames = __commonJS({
124
124
  }
125
125
  var classes = "";
126
126
  for (var key in arg) {
127
- if (hasOwn.call(arg, key) && arg[key]) {
127
+ if (hasOwn2.call(arg, key) && arg[key]) {
128
128
  classes = appendClass(classes, key);
129
129
  }
130
130
  }
@@ -213,11 +213,11 @@ var require_flat = __commonJS({
213
213
  }
214
214
  function isEmpty(val) {
215
215
  const type = Object.prototype.toString.call(val);
216
- const isArray = type === "[object Array]";
216
+ const isArray2 = type === "[object Array]";
217
217
  const isObject = type === "[object Object]";
218
218
  if (!val) {
219
219
  return true;
220
- } else if (isArray) {
220
+ } else if (isArray2) {
221
221
  return !val.length;
222
222
  } else if (isObject) {
223
223
  return !Object.keys(val).length;
@@ -267,67 +267,31 @@ var require_flat = __commonJS({
267
267
  }
268
268
  });
269
269
 
270
- // ../../node_modules/fast-deep-equal/index.js
271
- var require_fast_deep_equal = __commonJS({
272
- "../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
273
- "use strict";
274
- init_react_import();
275
- module2.exports = function equal(a, b) {
276
- if (a === b) return true;
277
- if (a && b && typeof a == "object" && typeof b == "object") {
278
- if (a.constructor !== b.constructor) return false;
279
- var length, i, keys;
280
- if (Array.isArray(a)) {
281
- length = a.length;
282
- if (length != b.length) return false;
283
- for (i = length; i-- !== 0; )
284
- if (!equal(a[i], b[i])) return false;
285
- return true;
286
- }
287
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
288
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
289
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
290
- keys = Object.keys(a);
291
- length = keys.length;
292
- if (length !== Object.keys(b).length) return false;
293
- for (i = length; i-- !== 0; )
294
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
295
- for (i = length; i-- !== 0; ) {
296
- var key = keys[i];
297
- if (!equal(a[key], b[key])) return false;
298
- }
299
- return true;
300
- }
301
- return a !== a && b !== b;
302
- };
303
- }
304
- });
305
-
306
270
  // index.ts
307
- var plugin_heading_analyzer_exports = {};
308
- __export(plugin_heading_analyzer_exports, {
271
+ var index_exports = {};
272
+ __export(index_exports, {
309
273
  default: () => HeadingAnalyzer_default
310
274
  });
311
- module.exports = __toCommonJS(plugin_heading_analyzer_exports);
275
+ module.exports = __toCommonJS(index_exports);
312
276
  init_react_import();
313
277
 
314
278
  // src/HeadingAnalyzer.tsx
315
279
  init_react_import();
316
- var import_react11 = require("react");
280
+ var import_react10 = require("react");
317
281
 
318
282
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
319
283
  init_react_import();
320
- var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
284
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
321
285
 
322
286
  // src/HeadingAnalyzer.tsx
323
287
  var import_puck = require("@measured/puck");
324
288
 
325
- // ../core/components/SidebarSection/index.tsx
289
+ // ../core/components/OutlineList/index.tsx
326
290
  init_react_import();
327
291
 
328
- // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
292
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
329
293
  init_react_import();
330
- 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" };
294
+ var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
331
295
 
332
296
  // ../core/lib/get-class-name-factory.ts
333
297
  init_react_import();
@@ -356,29 +320,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
356
320
  };
357
321
  var get_class_name_factory_default = getClassNameFactory;
358
322
 
359
- // ../core/components/Heading/index.tsx
360
- init_react_import();
361
-
362
- // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
363
- init_react_import();
364
- 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" };
365
-
366
- // ../core/components/Heading/index.tsx
323
+ // ../core/components/OutlineList/index.tsx
367
324
  var import_jsx_runtime = require("react/jsx-runtime");
368
- var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
369
- var Heading = ({ children, rank, size = "m" }) => {
370
- const Tag = rank ? `h${rank}` : "span";
325
+ var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
326
+ var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
327
+ var OutlineList = ({ children }) => {
328
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
329
+ };
330
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
331
+ OutlineList.Item = ({
332
+ children,
333
+ onClick
334
+ }) => {
371
335
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
372
- Tag,
336
+ "li",
373
337
  {
374
- className: getClassName({
375
- [size]: true
376
- }),
338
+ className: getClassNameItem({ clickable: !!onClick }),
339
+ onClick,
377
340
  children
378
341
  }
379
342
  );
380
343
  };
381
344
 
345
+ // ../core/lib/scroll-into-view.ts
346
+ init_react_import();
347
+ var scrollIntoView = (el) => {
348
+ const oldStyle = __spreadValues({}, el.style);
349
+ el.style.scrollMargin = "256px";
350
+ if (el) {
351
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
352
+ el.style.scrollMargin = oldStyle.scrollMargin || "";
353
+ }
354
+ };
355
+
356
+ // ../core/lib/get-frame.ts
357
+ init_react_import();
358
+ var getFrame = () => {
359
+ if (typeof window === "undefined") return;
360
+ let frameEl = document.querySelector("#preview-frame");
361
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
362
+ return frameEl.contentDocument || document;
363
+ }
364
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
365
+ };
366
+
382
367
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
383
368
  init_react_import();
384
369
 
@@ -466,15 +451,29 @@ var createLucideIcon = (iconName, iconNode) => {
466
451
  return Component;
467
452
  };
468
453
 
469
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
454
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
470
455
  init_react_import();
471
- var ChevronRight = createLucideIcon("ChevronRight", [
472
- ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
456
+ var Heading1 = createLucideIcon("Heading1", [
457
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
458
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
459
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
460
+ ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
473
461
  ]);
474
462
 
475
- // ../core/lib/use-breadcrumbs.ts
463
+ // ../core/lib/index.ts
464
+ init_react_import();
465
+
466
+ // ../core/lib/filter.ts
467
+ init_react_import();
468
+
469
+ // ../core/lib/data/reorder.ts
470
+ init_react_import();
471
+
472
+ // ../core/lib/data/replace.ts
473
+ init_react_import();
474
+
475
+ // ../core/lib/use-reset-auto-zoom.ts
476
476
  init_react_import();
477
- var import_react10 = require("react");
478
477
 
479
478
  // ../core/store/index.ts
480
479
  init_react_import();
@@ -854,10 +853,10 @@ var insert = (list, index, item) => {
854
853
  // ../core/lib/generate-id.ts
855
854
  init_react_import();
856
855
 
857
- // ../../node_modules/uuid/dist/esm-node/index.js
856
+ // ../core/node_modules/uuid/dist/esm-node/index.js
858
857
  init_react_import();
859
858
 
860
- // ../../node_modules/uuid/dist/esm-node/rng.js
859
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
861
860
  init_react_import();
862
861
  var import_crypto = __toESM(require("crypto"));
863
862
  var rnds8Pool = new Uint8Array(256);
@@ -870,7 +869,7 @@ function rng() {
870
869
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
871
870
  }
872
871
 
873
- // ../../node_modules/uuid/dist/esm-node/stringify.js
872
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
874
873
  init_react_import();
875
874
  var byteToHex = [];
876
875
  for (let i = 0; i < 256; ++i) {
@@ -880,17 +879,17 @@ function unsafeStringify(arr, offset = 0) {
880
879
  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]];
881
880
  }
882
881
 
883
- // ../../node_modules/uuid/dist/esm-node/v4.js
882
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
884
883
  init_react_import();
885
884
 
886
- // ../../node_modules/uuid/dist/esm-node/native.js
885
+ // ../core/node_modules/uuid/dist/esm-node/native.js
887
886
  init_react_import();
888
887
  var import_crypto2 = __toESM(require("crypto"));
889
888
  var native_default = {
890
889
  randomUUID: import_crypto2.default.randomUUID
891
890
  };
892
891
 
893
- // ../../node_modules/uuid/dist/esm-node/v4.js
892
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
894
893
  function v4(options, buf, offset) {
895
894
  if (native_default.randomUUID && !buf && !options) {
896
895
  return native_default.randomUUID();
@@ -1042,7 +1041,9 @@ var replaceAction = (state, action, appStore) => {
1042
1041
  });
1043
1042
  });
1044
1043
  });
1045
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1044
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1045
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1046
+ });
1046
1047
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1047
1048
  const id = zoneCompound.split(":")[0];
1048
1049
  if (id === originalId) {
@@ -1444,7 +1445,8 @@ init_react_import();
1444
1445
  var defaultViewports = [
1445
1446
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1446
1447
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1447
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1448
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1449
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1448
1450
  ];
1449
1451
 
1450
1452
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1470,7 +1472,7 @@ var createStoreImpl = (createState) => {
1470
1472
  const initialState = state = createState(setState, getState, api);
1471
1473
  return api;
1472
1474
  };
1473
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1475
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1474
1476
 
1475
1477
  // ../../node_modules/zustand/esm/react.mjs
1476
1478
  init_react_import();
@@ -1479,8 +1481,8 @@ var identity = (arg) => arg;
1479
1481
  function useStore(api, selector = identity) {
1480
1482
  const slice = import_react4.default.useSyncExternalStore(
1481
1483
  api.subscribe,
1482
- () => selector(api.getState()),
1483
- () => selector(api.getInitialState())
1484
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1485
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1484
1486
  );
1485
1487
  import_react4.default.useDebugValue(slice);
1486
1488
  return slice;
@@ -1491,13 +1493,13 @@ var createImpl = (createState) => {
1491
1493
  Object.assign(useBoundStore, api);
1492
1494
  return useBoundStore;
1493
1495
  };
1494
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1496
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1495
1497
 
1496
1498
  // ../../node_modules/zustand/esm/middleware.mjs
1497
1499
  init_react_import();
1498
1500
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1499
1501
  const origSubscribe = api.subscribe;
1500
- api.subscribe = (selector, optListener, options) => {
1502
+ api.subscribe = ((selector, optListener, options) => {
1501
1503
  let listener = selector;
1502
1504
  if (optListener) {
1503
1505
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1514,7 +1516,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1514
1516
  }
1515
1517
  }
1516
1518
  return origSubscribe(listener);
1517
- };
1519
+ });
1518
1520
  const initialState = fn(set, get, api);
1519
1521
  return initialState;
1520
1522
  };
@@ -1554,9 +1556,9 @@ function debounce(func, timeout = 300) {
1554
1556
  var tidyState = (state) => {
1555
1557
  return __spreadProps(__spreadValues({}, state), {
1556
1558
  ui: __spreadProps(__spreadValues({}, state.ui), {
1557
- field: {
1559
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1558
1560
  focus: null
1559
- }
1561
+ })
1560
1562
  })
1561
1563
  });
1562
1564
  };
@@ -1690,7 +1692,7 @@ var flattenData = (state, config) => {
1690
1692
  (content) => content,
1691
1693
  (item) => {
1692
1694
  data.push(item);
1693
- return null;
1695
+ return item;
1694
1696
  }
1695
1697
  );
1696
1698
  return data;
@@ -1698,42 +1700,462 @@ var flattenData = (state, config) => {
1698
1700
 
1699
1701
  // ../core/lib/get-changed.ts
1700
1702
  init_react_import();
1701
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1703
+
1704
+ // ../../node_modules/fast-equals/dist/esm/index.mjs
1705
+ init_react_import();
1706
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
1707
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1708
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1709
+ function combineComparators(comparatorA, comparatorB) {
1710
+ return function isEqual(a, b, state) {
1711
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
1712
+ };
1713
+ }
1714
+ function createIsCircular(areItemsEqual) {
1715
+ return function isCircular(a, b, state) {
1716
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") {
1717
+ return areItemsEqual(a, b, state);
1718
+ }
1719
+ var cache2 = state.cache;
1720
+ var cachedA = cache2.get(a);
1721
+ var cachedB = cache2.get(b);
1722
+ if (cachedA && cachedB) {
1723
+ return cachedA === b && cachedB === a;
1724
+ }
1725
+ cache2.set(a, b);
1726
+ cache2.set(b, a);
1727
+ var result = areItemsEqual(a, b, state);
1728
+ cache2.delete(a);
1729
+ cache2.delete(b);
1730
+ return result;
1731
+ };
1732
+ }
1733
+ function getStrictProperties(object) {
1734
+ return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1735
+ }
1736
+ var hasOwn = Object.hasOwn || (function(object, property) {
1737
+ return hasOwnProperty.call(object, property);
1738
+ });
1739
+ function sameValueZeroEqual(a, b) {
1740
+ return a === b || !a && !b && a !== a && b !== b;
1741
+ }
1742
+ var PREACT_VNODE = "__v";
1743
+ var PREACT_OWNER = "__o";
1744
+ var REACT_OWNER = "_owner";
1745
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1746
+ var keys = Object.keys;
1747
+ function areArraysEqual(a, b, state) {
1748
+ var index = a.length;
1749
+ if (b.length !== index) {
1750
+ return false;
1751
+ }
1752
+ while (index-- > 0) {
1753
+ if (!state.equals(a[index], b[index], index, index, a, b, state)) {
1754
+ return false;
1755
+ }
1756
+ }
1757
+ return true;
1758
+ }
1759
+ function areDatesEqual(a, b) {
1760
+ return sameValueZeroEqual(a.getTime(), b.getTime());
1761
+ }
1762
+ function areErrorsEqual(a, b) {
1763
+ return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
1764
+ }
1765
+ function areFunctionsEqual(a, b) {
1766
+ return a === b;
1767
+ }
1768
+ function areMapsEqual(a, b, state) {
1769
+ var size = a.size;
1770
+ if (size !== b.size) {
1771
+ return false;
1772
+ }
1773
+ if (!size) {
1774
+ return true;
1775
+ }
1776
+ var matchedIndices = new Array(size);
1777
+ var aIterable = a.entries();
1778
+ var aResult;
1779
+ var bResult;
1780
+ var index = 0;
1781
+ while (aResult = aIterable.next()) {
1782
+ if (aResult.done) {
1783
+ break;
1784
+ }
1785
+ var bIterable = b.entries();
1786
+ var hasMatch = false;
1787
+ var matchIndex = 0;
1788
+ while (bResult = bIterable.next()) {
1789
+ if (bResult.done) {
1790
+ break;
1791
+ }
1792
+ if (matchedIndices[matchIndex]) {
1793
+ matchIndex++;
1794
+ continue;
1795
+ }
1796
+ var aEntry = aResult.value;
1797
+ var bEntry = bResult.value;
1798
+ 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)) {
1799
+ hasMatch = matchedIndices[matchIndex] = true;
1800
+ break;
1801
+ }
1802
+ matchIndex++;
1803
+ }
1804
+ if (!hasMatch) {
1805
+ return false;
1806
+ }
1807
+ index++;
1808
+ }
1809
+ return true;
1810
+ }
1811
+ var areNumbersEqual = sameValueZeroEqual;
1812
+ function areObjectsEqual(a, b, state) {
1813
+ var properties = keys(a);
1814
+ var index = properties.length;
1815
+ if (keys(b).length !== index) {
1816
+ return false;
1817
+ }
1818
+ while (index-- > 0) {
1819
+ if (!isPropertyEqual(a, b, state, properties[index])) {
1820
+ return false;
1821
+ }
1822
+ }
1823
+ return true;
1824
+ }
1825
+ function areObjectsEqualStrict(a, b, state) {
1826
+ var properties = getStrictProperties(a);
1827
+ var index = properties.length;
1828
+ if (getStrictProperties(b).length !== index) {
1829
+ return false;
1830
+ }
1831
+ var property;
1832
+ var descriptorA;
1833
+ var descriptorB;
1834
+ while (index-- > 0) {
1835
+ property = properties[index];
1836
+ if (!isPropertyEqual(a, b, state, property)) {
1837
+ return false;
1838
+ }
1839
+ descriptorA = getOwnPropertyDescriptor(a, property);
1840
+ descriptorB = getOwnPropertyDescriptor(b, property);
1841
+ if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
1842
+ return false;
1843
+ }
1844
+ }
1845
+ return true;
1846
+ }
1847
+ function arePrimitiveWrappersEqual(a, b) {
1848
+ return sameValueZeroEqual(a.valueOf(), b.valueOf());
1849
+ }
1850
+ function areRegExpsEqual(a, b) {
1851
+ return a.source === b.source && a.flags === b.flags;
1852
+ }
1853
+ function areSetsEqual(a, b, state) {
1854
+ var size = a.size;
1855
+ if (size !== b.size) {
1856
+ return false;
1857
+ }
1858
+ if (!size) {
1859
+ return true;
1860
+ }
1861
+ var matchedIndices = new Array(size);
1862
+ var aIterable = a.values();
1863
+ var aResult;
1864
+ var bResult;
1865
+ while (aResult = aIterable.next()) {
1866
+ if (aResult.done) {
1867
+ break;
1868
+ }
1869
+ var bIterable = b.values();
1870
+ var hasMatch = false;
1871
+ var matchIndex = 0;
1872
+ while (bResult = bIterable.next()) {
1873
+ if (bResult.done) {
1874
+ break;
1875
+ }
1876
+ if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
1877
+ hasMatch = matchedIndices[matchIndex] = true;
1878
+ break;
1879
+ }
1880
+ matchIndex++;
1881
+ }
1882
+ if (!hasMatch) {
1883
+ return false;
1884
+ }
1885
+ }
1886
+ return true;
1887
+ }
1888
+ function areTypedArraysEqual(a, b) {
1889
+ var index = a.length;
1890
+ if (b.length !== index) {
1891
+ return false;
1892
+ }
1893
+ while (index-- > 0) {
1894
+ if (a[index] !== b[index]) {
1895
+ return false;
1896
+ }
1897
+ }
1898
+ return true;
1899
+ }
1900
+ function areUrlsEqual(a, b) {
1901
+ 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;
1902
+ }
1903
+ function isPropertyEqual(a, b, state, property) {
1904
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
1905
+ return true;
1906
+ }
1907
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
1908
+ }
1909
+ var ARGUMENTS_TAG = "[object Arguments]";
1910
+ var BOOLEAN_TAG = "[object Boolean]";
1911
+ var DATE_TAG = "[object Date]";
1912
+ var ERROR_TAG = "[object Error]";
1913
+ var MAP_TAG = "[object Map]";
1914
+ var NUMBER_TAG = "[object Number]";
1915
+ var OBJECT_TAG = "[object Object]";
1916
+ var REG_EXP_TAG = "[object RegExp]";
1917
+ var SET_TAG = "[object Set]";
1918
+ var STRING_TAG = "[object String]";
1919
+ var URL_TAG = "[object URL]";
1920
+ var isArray = Array.isArray;
1921
+ var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
1922
+ var assign = Object.assign;
1923
+ var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
1924
+ function createEqualityComparator(_a) {
1925
+ 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;
1926
+ return function comparator(a, b, state) {
1927
+ if (a === b) {
1928
+ return true;
1929
+ }
1930
+ if (a == null || b == null) {
1931
+ return false;
1932
+ }
1933
+ var type = typeof a;
1934
+ if (type !== typeof b) {
1935
+ return false;
1936
+ }
1937
+ if (type !== "object") {
1938
+ if (type === "number") {
1939
+ return areNumbersEqual2(a, b, state);
1940
+ }
1941
+ if (type === "function") {
1942
+ return areFunctionsEqual2(a, b, state);
1943
+ }
1944
+ return false;
1945
+ }
1946
+ var constructor = a.constructor;
1947
+ if (constructor !== b.constructor) {
1948
+ return false;
1949
+ }
1950
+ if (constructor === Object) {
1951
+ return areObjectsEqual2(a, b, state);
1952
+ }
1953
+ if (isArray(a)) {
1954
+ return areArraysEqual2(a, b, state);
1955
+ }
1956
+ if (isTypedArray != null && isTypedArray(a)) {
1957
+ return areTypedArraysEqual2(a, b, state);
1958
+ }
1959
+ if (constructor === Date) {
1960
+ return areDatesEqual2(a, b, state);
1961
+ }
1962
+ if (constructor === RegExp) {
1963
+ return areRegExpsEqual2(a, b, state);
1964
+ }
1965
+ if (constructor === Map) {
1966
+ return areMapsEqual2(a, b, state);
1967
+ }
1968
+ if (constructor === Set) {
1969
+ return areSetsEqual2(a, b, state);
1970
+ }
1971
+ var tag = getTag(a);
1972
+ if (tag === DATE_TAG) {
1973
+ return areDatesEqual2(a, b, state);
1974
+ }
1975
+ if (tag === REG_EXP_TAG) {
1976
+ return areRegExpsEqual2(a, b, state);
1977
+ }
1978
+ if (tag === MAP_TAG) {
1979
+ return areMapsEqual2(a, b, state);
1980
+ }
1981
+ if (tag === SET_TAG) {
1982
+ return areSetsEqual2(a, b, state);
1983
+ }
1984
+ if (tag === OBJECT_TAG) {
1985
+ return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
1986
+ }
1987
+ if (tag === URL_TAG) {
1988
+ return areUrlsEqual2(a, b, state);
1989
+ }
1990
+ if (tag === ERROR_TAG) {
1991
+ return areErrorsEqual2(a, b, state);
1992
+ }
1993
+ if (tag === ARGUMENTS_TAG) {
1994
+ return areObjectsEqual2(a, b, state);
1995
+ }
1996
+ if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
1997
+ return arePrimitiveWrappersEqual2(a, b, state);
1998
+ }
1999
+ return false;
2000
+ };
2001
+ }
2002
+ function createEqualityComparatorConfig(_a) {
2003
+ var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
2004
+ var config = {
2005
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
2006
+ areDatesEqual,
2007
+ areErrorsEqual,
2008
+ areFunctionsEqual,
2009
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
2010
+ areNumbersEqual,
2011
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
2012
+ arePrimitiveWrappersEqual,
2013
+ areRegExpsEqual,
2014
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
2015
+ areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
2016
+ areUrlsEqual
2017
+ };
2018
+ if (createCustomConfig) {
2019
+ config = assign({}, config, createCustomConfig(config));
2020
+ }
2021
+ if (circular) {
2022
+ var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
2023
+ var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
2024
+ var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
2025
+ var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
2026
+ config = assign({}, config, {
2027
+ areArraysEqual: areArraysEqual$1,
2028
+ areMapsEqual: areMapsEqual$1,
2029
+ areObjectsEqual: areObjectsEqual$1,
2030
+ areSetsEqual: areSetsEqual$1
2031
+ });
2032
+ }
2033
+ return config;
2034
+ }
2035
+ function createInternalEqualityComparator(compare) {
2036
+ return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
2037
+ return compare(a, b, state);
2038
+ };
2039
+ }
2040
+ function createIsEqual(_a) {
2041
+ var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
2042
+ if (createState) {
2043
+ return function isEqual(a, b) {
2044
+ var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
2045
+ return comparator(a, b, {
2046
+ cache: cache2,
2047
+ equals,
2048
+ meta,
2049
+ strict
2050
+ });
2051
+ };
2052
+ }
2053
+ if (circular) {
2054
+ return function isEqual(a, b) {
2055
+ return comparator(a, b, {
2056
+ cache: /* @__PURE__ */ new WeakMap(),
2057
+ equals,
2058
+ meta: void 0,
2059
+ strict
2060
+ });
2061
+ };
2062
+ }
2063
+ var state = {
2064
+ cache: void 0,
2065
+ equals,
2066
+ meta: void 0,
2067
+ strict
2068
+ };
2069
+ return function isEqual(a, b) {
2070
+ return comparator(a, b, state);
2071
+ };
2072
+ }
2073
+ var deepEqual = createCustomEqual();
2074
+ var strictDeepEqual = createCustomEqual({ strict: true });
2075
+ var circularDeepEqual = createCustomEqual({ circular: true });
2076
+ var strictCircularDeepEqual = createCustomEqual({
2077
+ circular: true,
2078
+ strict: true
2079
+ });
2080
+ var shallowEqual = createCustomEqual({
2081
+ createInternalComparator: function() {
2082
+ return sameValueZeroEqual;
2083
+ }
2084
+ });
2085
+ var strictShallowEqual = createCustomEqual({
2086
+ strict: true,
2087
+ createInternalComparator: function() {
2088
+ return sameValueZeroEqual;
2089
+ }
2090
+ });
2091
+ var circularShallowEqual = createCustomEqual({
2092
+ circular: true,
2093
+ createInternalComparator: function() {
2094
+ return sameValueZeroEqual;
2095
+ }
2096
+ });
2097
+ var strictCircularShallowEqual = createCustomEqual({
2098
+ circular: true,
2099
+ createInternalComparator: function() {
2100
+ return sameValueZeroEqual;
2101
+ },
2102
+ strict: true
2103
+ });
2104
+ function createCustomEqual(options) {
2105
+ if (options === void 0) {
2106
+ options = {};
2107
+ }
2108
+ 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;
2109
+ var config = createEqualityComparatorConfig(options);
2110
+ var comparator = createEqualityComparator(config);
2111
+ var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
2112
+ return createIsEqual({ circular, comparator, createState, equals, strict });
2113
+ }
2114
+
2115
+ // ../core/lib/get-changed.ts
1702
2116
  var getChanged = (newItem, oldItem) => {
1703
2117
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1704
2118
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1705
2119
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1706
2120
  return __spreadProps(__spreadValues({}, acc), {
1707
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
2121
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
1708
2122
  });
1709
2123
  }, {}) : {};
1710
2124
  };
1711
2125
 
1712
2126
  // ../core/store/slices/permissions.ts
1713
2127
  var createPermissionsSlice = (set, get) => {
1714
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2128
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1715
2129
  const { state, permissions, config } = get();
1716
2130
  const { cache: cache2, globalPermissions } = permissions;
1717
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1718
- var _a, _b, _c;
2131
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2132
+ var _a, _b;
1719
2133
  const { config: config2, state: appState, setComponentLoading } = get();
2134
+ const itemCache = cache2[item2.props.id];
2135
+ const nodes = appState.indexes.nodes;
2136
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2137
+ const parentNode = parentId ? nodes[parentId] : null;
2138
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
1720
2139
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1721
2140
  if (!componentConfig) {
1722
2141
  return;
1723
2142
  }
1724
2143
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1725
2144
  if (componentConfig.resolvePermissions) {
1726
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
1727
- if (Object.values(changed).some((el) => el === true) || force2) {
2145
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2146
+ const propsChanged = Object.values(changed).some((el) => el === true);
2147
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2148
+ if (propsChanged || parentChanged || force2) {
1728
2149
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1729
2150
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1730
2151
  item2,
1731
2152
  {
1732
2153
  changed,
1733
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2154
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1734
2155
  permissions: initialPermissions,
1735
2156
  appState: makeStatePublic(appState),
1736
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2157
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2158
+ parent: parentData
1737
2159
  }
1738
2160
  );
1739
2161
  const latest = get().permissions;
@@ -1741,6 +2163,7 @@ var createPermissionsSlice = (set, get) => {
1741
2163
  permissions: __spreadProps(__spreadValues({}, latest), {
1742
2164
  cache: __spreadProps(__spreadValues({}, latest.cache), {
1743
2165
  [item2.props.id]: {
2166
+ lastParentId: parentId,
1744
2167
  lastData: item2,
1745
2168
  lastPermissions: resolvedPermissions
1746
2169
  }
@@ -1754,9 +2177,9 @@ var createPermissionsSlice = (set, get) => {
1754
2177
  }
1755
2178
  }
1756
2179
  });
1757
- const resolveDataForRoot = (force2 = false) => {
2180
+ const resolvePermissionsForRoot = (force2 = false) => {
1758
2181
  const { state: appState } = get();
1759
- resolveDataForItem(
2182
+ resolvePermissionsForItem(
1760
2183
  // Shim the root data in by conforming to component data shape
1761
2184
  {
1762
2185
  type: "root",
@@ -1767,16 +2190,16 @@ var createPermissionsSlice = (set, get) => {
1767
2190
  };
1768
2191
  const { item, type, root } = params;
1769
2192
  if (item) {
1770
- yield resolveDataForItem(item, force);
2193
+ yield resolvePermissionsForItem(item, force);
1771
2194
  } else if (type) {
1772
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1773
- yield resolveDataForItem(item2, force);
2195
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2196
+ yield resolvePermissionsForItem(item2, force);
1774
2197
  }));
1775
2198
  } else if (root) {
1776
- resolveDataForRoot(force);
2199
+ resolvePermissionsForRoot(force);
1777
2200
  } else {
1778
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1779
- yield resolveDataForItem(item2, force);
2201
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2202
+ yield resolvePermissionsForItem(item2, force);
1780
2203
  }));
1781
2204
  }
1782
2205
  });
@@ -1829,16 +2252,15 @@ var createFieldsSlice = (_set, _get) => {
1829
2252
 
1830
2253
  // ../core/lib/resolve-component-data.ts
1831
2254
  init_react_import();
1832
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1833
2255
  var cache = { lastChange: {} };
1834
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2256
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1835
2257
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1836
2258
  const resolvedItem = __spreadValues({}, item);
1837
2259
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1838
2260
  const id = "id" in item.props ? item.props.id : "root";
1839
2261
  if (shouldRunResolver) {
1840
2262
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1841
- if (trigger !== "force" && item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
2263
+ if (trigger !== "force" && item && deepEqual(item, oldItem)) {
1842
2264
  return { node: resolved, didChange: false };
1843
2265
  }
1844
2266
  const changed = getChanged(item, oldItem);
@@ -1859,11 +2281,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1859
2281
  let itemWithResolvedChildren = yield mapFields(
1860
2282
  resolvedItem,
1861
2283
  {
1862
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2284
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
1863
2285
  const content = value;
1864
2286
  return yield Promise.all(
1865
2287
  content.map(
1866
- (childItem) => __async(void 0, null, function* () {
2288
+ (childItem) => __async(null, null, function* () {
1867
2289
  return (yield resolveComponentData(
1868
2290
  childItem,
1869
2291
  config,
@@ -1888,7 +2310,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1888
2310
  };
1889
2311
  return {
1890
2312
  node: itemWithResolvedChildren,
1891
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
2313
+ didChange: !deepEqual(item, itemWithResolvedChildren)
1892
2314
  };
1893
2315
  });
1894
2316
 
@@ -1929,7 +2351,8 @@ var defaultAppState = {
1929
2351
  options: [],
1930
2352
  controlsVisible: true
1931
2353
  },
1932
- field: { focus: null }
2354
+ field: { focus: null },
2355
+ plugin: { current: null }
1933
2356
  },
1934
2357
  indexes: {
1935
2358
  nodes: {},
@@ -1945,6 +2368,7 @@ var createAppStore = (initialAppStore) => create()(
1945
2368
  subscribeWithSelector((set, get) => {
1946
2369
  var _a, _b;
1947
2370
  return __spreadProps(__spreadValues({
2371
+ instanceId: generateId(),
1948
2372
  state: defaultAppState,
1949
2373
  config: { components: {} },
1950
2374
  componentState: {},
@@ -1965,6 +2389,11 @@ var createAppStore = (initialAppStore) => create()(
1965
2389
  history: createHistorySlice(set, get),
1966
2390
  nodes: createNodesSlice(set, get),
1967
2391
  permissions: createPermissionsSlice(set, get),
2392
+ getCurrentData: () => {
2393
+ var _a2;
2394
+ const s = get();
2395
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
2396
+ },
1968
2397
  getComponentConfig: (type) => {
1969
2398
  var _a2;
1970
2399
  const { config, selectedItem } = get();
@@ -2053,7 +2482,7 @@ var createAppStore = (initialAppStore) => create()(
2053
2482
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2054
2483
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2055
2484
  }),
2056
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2485
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2057
2486
  const { config, metadata, setComponentLoading, permissions } = get();
2058
2487
  const timeouts = {};
2059
2488
  return yield resolveComponentData(
@@ -2064,7 +2493,7 @@ var createAppStore = (initialAppStore) => create()(
2064
2493
  const id = "id" in item.props ? item.props.id : "root";
2065
2494
  timeouts[id] = setComponentLoading(id, true, 50);
2066
2495
  },
2067
- (item) => __async(void 0, null, function* () {
2496
+ (item) => __async(null, null, function* () {
2068
2497
  const id = "id" in item.props ? item.props.id : "root";
2069
2498
  if ("type" in item) {
2070
2499
  yield permissions.refreshPermissions({ item });
@@ -2076,7 +2505,7 @@ var createAppStore = (initialAppStore) => create()(
2076
2505
  trigger
2077
2506
  );
2078
2507
  }),
2079
- resolveAndCommitData: () => __async(void 0, null, function* () {
2508
+ resolveAndCommitData: () => __async(null, null, function* () {
2080
2509
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2081
2510
  walkAppState(
2082
2511
  state,
@@ -2115,203 +2544,14 @@ var createAppStore = (initialAppStore) => create()(
2115
2544
  })
2116
2545
  );
2117
2546
  var appStoreContext = (0, import_react9.createContext)(createAppStore());
2118
- function useAppStore(selector) {
2119
- const context = (0, import_react9.useContext)(appStoreContext);
2120
- return useStore(context, selector);
2121
- }
2122
- function useAppStoreApi() {
2123
- return (0, import_react9.useContext)(appStoreContext);
2124
- }
2125
-
2126
- // ../core/lib/use-breadcrumbs.ts
2127
- var useBreadcrumbs = (renderCount) => {
2128
- const selectedId = useAppStore((s) => {
2129
- var _a;
2130
- return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2131
- });
2132
- const config = useAppStore((s) => s.config);
2133
- const path = useAppStore((s) => {
2134
- var _a;
2135
- return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2136
- });
2137
- const appStore = useAppStoreApi();
2138
- return (0, import_react10.useMemo)(() => {
2139
- const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2140
- var _a, _b, _c;
2141
- const [componentId] = zoneCompound.split(":");
2142
- if (componentId === "root") {
2143
- return {
2144
- label: "Page",
2145
- selector: null
2146
- };
2147
- }
2148
- const node = appStore.getState().state.indexes.nodes[componentId];
2149
- const parentId = node.path[node.path.length - 1];
2150
- const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2151
- const index = contentIds.indexOf(componentId);
2152
- const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2153
- return {
2154
- label,
2155
- selector: node ? {
2156
- index,
2157
- zone: node.path[node.path.length - 1]
2158
- } : null
2159
- };
2160
- })) || [];
2161
- if (renderCount) {
2162
- return breadcrumbs.slice(breadcrumbs.length - renderCount);
2163
- }
2164
- return breadcrumbs;
2165
- }, [path, renderCount]);
2166
- };
2167
-
2168
- // ../core/components/Loader/index.tsx
2169
- init_react_import();
2170
-
2171
- // ../core/lib/index.ts
2172
- init_react_import();
2173
-
2174
- // ../core/lib/filter.ts
2175
- init_react_import();
2176
-
2177
- // ../core/lib/data/reorder.ts
2178
- init_react_import();
2179
-
2180
- // ../core/lib/data/replace.ts
2181
- init_react_import();
2182
-
2183
- // ../core/lib/use-reset-auto-zoom.ts
2184
- init_react_import();
2185
2547
 
2186
2548
  // ../core/lib/get-zoom-config.ts
2187
2549
  init_react_import();
2188
2550
 
2189
- // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2190
- init_react_import();
2191
- var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2192
-
2193
- // ../core/components/Loader/index.tsx
2194
- var import_jsx_runtime2 = require("react/jsx-runtime");
2195
- var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2196
- var Loader = (_a) => {
2197
- var _b = _a, {
2198
- color,
2199
- size = 16
2200
- } = _b, props = __objRest(_b, [
2201
- "color",
2202
- "size"
2203
- ]);
2204
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2205
- "span",
2206
- __spreadValues({
2207
- className: getClassName2(),
2208
- style: {
2209
- width: size,
2210
- height: size,
2211
- color
2212
- },
2213
- "aria-label": "loading"
2214
- }, props)
2215
- );
2216
- };
2217
-
2218
- // ../core/components/SidebarSection/index.tsx
2219
- var import_jsx_runtime3 = require("react/jsx-runtime");
2220
- var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2221
- var SidebarSection = ({
2222
- children,
2223
- title,
2224
- background,
2225
- showBreadcrumbs,
2226
- noBorderTop,
2227
- noPadding,
2228
- isLoading
2229
- }) => {
2230
- const setUi = useAppStore((s) => s.setUi);
2231
- const breadcrumbs = useBreadcrumbs(1);
2232
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2233
- "div",
2234
- {
2235
- className: getClassName3({ noBorderTop, noPadding }),
2236
- style: { background },
2237
- children: [
2238
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
2239
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
2240
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2241
- "button",
2242
- {
2243
- type: "button",
2244
- className: getClassName3("breadcrumbLabel"),
2245
- onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2246
- children: breadcrumb.label
2247
- }
2248
- ),
2249
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
2250
- ] }, i)) : null,
2251
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
2252
- ] }) }),
2253
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
2254
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
2255
- ]
2256
- }
2257
- );
2258
- };
2259
-
2260
- // ../core/components/OutlineList/index.tsx
2261
- init_react_import();
2262
-
2263
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2264
- init_react_import();
2265
- var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2266
-
2267
- // ../core/components/OutlineList/index.tsx
2268
- var import_jsx_runtime4 = require("react/jsx-runtime");
2269
- var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2270
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2271
- var OutlineList = ({ children }) => {
2272
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
2273
- };
2274
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2275
- OutlineList.Item = ({
2276
- children,
2277
- onClick
2278
- }) => {
2279
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2280
- "li",
2281
- {
2282
- className: getClassNameItem({ clickable: !!onClick }),
2283
- onClick,
2284
- children
2285
- }
2286
- );
2287
- };
2288
-
2289
- // ../core/lib/scroll-into-view.ts
2290
- init_react_import();
2291
- var scrollIntoView = (el) => {
2292
- const oldStyle = __spreadValues({}, el.style);
2293
- el.style.scrollMargin = "256px";
2294
- if (el) {
2295
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2296
- el.style.scrollMargin = oldStyle.scrollMargin || "";
2297
- }
2298
- };
2299
-
2300
- // ../core/lib/get-frame.ts
2301
- init_react_import();
2302
- var getFrame = () => {
2303
- if (typeof window === "undefined") return;
2304
- let frameEl = document.querySelector("#preview-frame");
2305
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2306
- return frameEl.contentDocument || document;
2307
- }
2308
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2309
- };
2310
-
2311
2551
  // src/HeadingAnalyzer.tsx
2312
2552
  var import_react_from_json = __toESM(require("react-from-json"));
2313
- var import_jsx_runtime5 = require("react/jsx-runtime");
2314
- var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2553
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2554
+ var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2315
2555
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2316
2556
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
2317
2557
  var getOutline = ({ frame } = {}) => {
@@ -2366,8 +2606,8 @@ function buildHierarchy(frame) {
2366
2606
  var usePuck = (0, import_puck.createUsePuck)();
2367
2607
  var HeadingAnalyzer = () => {
2368
2608
  const data = usePuck((s) => s.appState.data);
2369
- const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
2370
- (0, import_react11.useEffect)(() => {
2609
+ const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
2610
+ (0, import_react10.useEffect)(() => {
2371
2611
  const frame = getFrame();
2372
2612
  let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
2373
2613
  const createHierarchy = () => {
@@ -2402,11 +2642,11 @@ var HeadingAnalyzer = () => {
2402
2642
  frameObserver.disconnect();
2403
2643
  };
2404
2644
  }, [data]);
2405
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
2406
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2645
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
2646
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2407
2647
  "small",
2408
2648
  {
2409
- className: getClassName5("cssWarning"),
2649
+ className: getClassName2("cssWarning"),
2410
2650
  style: {
2411
2651
  color: "var(--puck-color-red-04)",
2412
2652
  display: "block",
@@ -2415,19 +2655,19 @@ var HeadingAnalyzer = () => {
2415
2655
  children: [
2416
2656
  "Heading analyzer styles not loaded. Please review the",
2417
2657
  " ",
2418
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2658
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2419
2659
  "."
2420
2660
  ]
2421
2661
  }
2422
2662
  ),
2423
- hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
2424
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2663
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
2664
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2425
2665
  ReactFromJSON,
2426
2666
  {
2427
2667
  mapping: {
2428
- Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
2429
- OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
2430
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2668
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
2669
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
2670
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2431
2671
  "small",
2432
2672
  {
2433
2673
  className: getClassNameItem2({ missing: props.missing }),
@@ -2445,14 +2685,14 @@ var HeadingAnalyzer = () => {
2445
2685
  }, 2e3);
2446
2686
  }
2447
2687
  },
2448
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2449
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2688
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2689
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2450
2690
  "H",
2451
2691
  props.rank
2452
2692
  ] }),
2453
2693
  ": Missing"
2454
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2455
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2694
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2695
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2456
2696
  "H",
2457
2697
  props.rank
2458
2698
  ] }),
@@ -2461,7 +2701,7 @@ var HeadingAnalyzer = () => {
2461
2701
  ] })
2462
2702
  }
2463
2703
  ) }),
2464
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
2704
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
2465
2705
  ] })
2466
2706
  },
2467
2707
  entry: {
@@ -2482,12 +2722,10 @@ var HeadingAnalyzer = () => {
2482
2722
  ] });
2483
2723
  };
2484
2724
  var headingAnalyzer = {
2485
- overrides: {
2486
- fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2487
- children,
2488
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
2489
- ] })
2490
- }
2725
+ name: "heading-analyzer",
2726
+ label: "Audit",
2727
+ render: HeadingAnalyzer,
2728
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
2491
2729
  };
2492
2730
  var HeadingAnalyzer_default = headingAnalyzer;
2493
2731
  /*! Bundled license information:
@@ -2500,45 +2738,10 @@ classnames/index.js:
2500
2738
  *)
2501
2739
 
2502
2740
  lucide-react/dist/esm/shared/src/utils.js:
2503
- (**
2504
- * @license lucide-react v0.468.0 - ISC
2505
- *
2506
- * This source code is licensed under the ISC license.
2507
- * See the LICENSE file in the root directory of this source tree.
2508
- *)
2509
-
2510
2741
  lucide-react/dist/esm/defaultAttributes.js:
2511
- (**
2512
- * @license lucide-react v0.468.0 - ISC
2513
- *
2514
- * This source code is licensed under the ISC license.
2515
- * See the LICENSE file in the root directory of this source tree.
2516
- *)
2517
-
2518
2742
  lucide-react/dist/esm/Icon.js:
2519
- (**
2520
- * @license lucide-react v0.468.0 - ISC
2521
- *
2522
- * This source code is licensed under the ISC license.
2523
- * See the LICENSE file in the root directory of this source tree.
2524
- *)
2525
-
2526
2743
  lucide-react/dist/esm/createLucideIcon.js:
2527
- (**
2528
- * @license lucide-react v0.468.0 - ISC
2529
- *
2530
- * This source code is licensed under the ISC license.
2531
- * See the LICENSE file in the root directory of this source tree.
2532
- *)
2533
-
2534
- lucide-react/dist/esm/icons/chevron-right.js:
2535
- (**
2536
- * @license lucide-react v0.468.0 - ISC
2537
- *
2538
- * This source code is licensed under the ISC license.
2539
- * See the LICENSE file in the root directory of this source tree.
2540
- *)
2541
-
2744
+ lucide-react/dist/esm/icons/heading-1.js:
2542
2745
  lucide-react/dist/esm/lucide-react.js:
2543
2746
  (**
2544
2747
  * @license lucide-react v0.468.0 - ISC