@measured/puck-plugin-heading-analyzer 0.21.0-canary.cf074bc6 → 0.21.0-canary.d5f934f0

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();
@@ -692,9 +691,28 @@ var stripSlots = (data, config) => {
692
691
 
693
692
  // ../core/lib/data/flatten-node.ts
694
693
  var { flatten: flatten2, unflatten } = import_flat.default;
694
+ function isEmptyArrayOrObject(val) {
695
+ if (Array.isArray(val)) {
696
+ return val.length === 0;
697
+ }
698
+ if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
699
+ return Object.keys(val).length === 0;
700
+ }
701
+ return false;
702
+ }
703
+ function stripEmptyObjects(props) {
704
+ const result = {};
705
+ for (const key in props) {
706
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
707
+ const val = props[key];
708
+ if (isEmptyArrayOrObject(val)) continue;
709
+ result[key] = val;
710
+ }
711
+ return result;
712
+ }
695
713
  var flattenNode = (node, config) => {
696
714
  return __spreadProps(__spreadValues({}, node), {
697
- props: flatten2(stripSlots(node, config).props)
715
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
698
716
  });
699
717
  };
700
718
 
@@ -854,10 +872,10 @@ var insert = (list, index, item) => {
854
872
  // ../core/lib/generate-id.ts
855
873
  init_react_import();
856
874
 
857
- // ../../node_modules/uuid/dist/esm-node/index.js
875
+ // ../core/node_modules/uuid/dist/esm-node/index.js
858
876
  init_react_import();
859
877
 
860
- // ../../node_modules/uuid/dist/esm-node/rng.js
878
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
861
879
  init_react_import();
862
880
  var import_crypto = __toESM(require("crypto"));
863
881
  var rnds8Pool = new Uint8Array(256);
@@ -870,7 +888,7 @@ function rng() {
870
888
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
871
889
  }
872
890
 
873
- // ../../node_modules/uuid/dist/esm-node/stringify.js
891
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
874
892
  init_react_import();
875
893
  var byteToHex = [];
876
894
  for (let i = 0; i < 256; ++i) {
@@ -880,17 +898,17 @@ function unsafeStringify(arr, offset = 0) {
880
898
  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
899
  }
882
900
 
883
- // ../../node_modules/uuid/dist/esm-node/v4.js
901
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
884
902
  init_react_import();
885
903
 
886
- // ../../node_modules/uuid/dist/esm-node/native.js
904
+ // ../core/node_modules/uuid/dist/esm-node/native.js
887
905
  init_react_import();
888
906
  var import_crypto2 = __toESM(require("crypto"));
889
907
  var native_default = {
890
908
  randomUUID: import_crypto2.default.randomUUID
891
909
  };
892
910
 
893
- // ../../node_modules/uuid/dist/esm-node/v4.js
911
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
894
912
  function v4(options, buf, offset) {
895
913
  if (native_default.randomUUID && !buf && !options) {
896
914
  return native_default.randomUUID();
@@ -1042,7 +1060,9 @@ var replaceAction = (state, action, appStore) => {
1042
1060
  });
1043
1061
  });
1044
1062
  });
1045
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1063
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1064
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1065
+ });
1046
1066
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1047
1067
  const id = zoneCompound.split(":")[0];
1048
1068
  if (id === originalId) {
@@ -1444,7 +1464,8 @@ init_react_import();
1444
1464
  var defaultViewports = [
1445
1465
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1446
1466
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1447
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1467
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1468
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1448
1469
  ];
1449
1470
 
1450
1471
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1470,7 +1491,7 @@ var createStoreImpl = (createState) => {
1470
1491
  const initialState = state = createState(setState, getState, api);
1471
1492
  return api;
1472
1493
  };
1473
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1494
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1474
1495
 
1475
1496
  // ../../node_modules/zustand/esm/react.mjs
1476
1497
  init_react_import();
@@ -1479,8 +1500,8 @@ var identity = (arg) => arg;
1479
1500
  function useStore(api, selector = identity) {
1480
1501
  const slice = import_react4.default.useSyncExternalStore(
1481
1502
  api.subscribe,
1482
- () => selector(api.getState()),
1483
- () => selector(api.getInitialState())
1503
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1504
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1484
1505
  );
1485
1506
  import_react4.default.useDebugValue(slice);
1486
1507
  return slice;
@@ -1491,13 +1512,13 @@ var createImpl = (createState) => {
1491
1512
  Object.assign(useBoundStore, api);
1492
1513
  return useBoundStore;
1493
1514
  };
1494
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1515
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1495
1516
 
1496
1517
  // ../../node_modules/zustand/esm/middleware.mjs
1497
1518
  init_react_import();
1498
1519
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1499
1520
  const origSubscribe = api.subscribe;
1500
- api.subscribe = (selector, optListener, options) => {
1521
+ api.subscribe = ((selector, optListener, options) => {
1501
1522
  let listener = selector;
1502
1523
  if (optListener) {
1503
1524
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1514,7 +1535,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1514
1535
  }
1515
1536
  }
1516
1537
  return origSubscribe(listener);
1517
- };
1538
+ });
1518
1539
  const initialState = fn(set, get, api);
1519
1540
  return initialState;
1520
1541
  };
@@ -1554,9 +1575,9 @@ function debounce(func, timeout = 300) {
1554
1575
  var tidyState = (state) => {
1555
1576
  return __spreadProps(__spreadValues({}, state), {
1556
1577
  ui: __spreadProps(__spreadValues({}, state.ui), {
1557
- field: {
1578
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1558
1579
  focus: null
1559
- }
1580
+ })
1560
1581
  })
1561
1582
  });
1562
1583
  };
@@ -1698,42 +1719,462 @@ var flattenData = (state, config) => {
1698
1719
 
1699
1720
  // ../core/lib/get-changed.ts
1700
1721
  init_react_import();
1701
- var import_fast_deep_equal = __toESM(require_fast_deep_equal());
1722
+
1723
+ // ../../node_modules/fast-equals/dist/esm/index.mjs
1724
+ init_react_import();
1725
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
1726
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1727
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1728
+ function combineComparators(comparatorA, comparatorB) {
1729
+ return function isEqual(a, b, state) {
1730
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
1731
+ };
1732
+ }
1733
+ function createIsCircular(areItemsEqual) {
1734
+ return function isCircular(a, b, state) {
1735
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") {
1736
+ return areItemsEqual(a, b, state);
1737
+ }
1738
+ var cache2 = state.cache;
1739
+ var cachedA = cache2.get(a);
1740
+ var cachedB = cache2.get(b);
1741
+ if (cachedA && cachedB) {
1742
+ return cachedA === b && cachedB === a;
1743
+ }
1744
+ cache2.set(a, b);
1745
+ cache2.set(b, a);
1746
+ var result = areItemsEqual(a, b, state);
1747
+ cache2.delete(a);
1748
+ cache2.delete(b);
1749
+ return result;
1750
+ };
1751
+ }
1752
+ function getStrictProperties(object) {
1753
+ return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1754
+ }
1755
+ var hasOwn = Object.hasOwn || (function(object, property) {
1756
+ return hasOwnProperty.call(object, property);
1757
+ });
1758
+ function sameValueZeroEqual(a, b) {
1759
+ return a === b || !a && !b && a !== a && b !== b;
1760
+ }
1761
+ var PREACT_VNODE = "__v";
1762
+ var PREACT_OWNER = "__o";
1763
+ var REACT_OWNER = "_owner";
1764
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1765
+ var keys = Object.keys;
1766
+ function areArraysEqual(a, b, state) {
1767
+ var index = a.length;
1768
+ if (b.length !== index) {
1769
+ return false;
1770
+ }
1771
+ while (index-- > 0) {
1772
+ if (!state.equals(a[index], b[index], index, index, a, b, state)) {
1773
+ return false;
1774
+ }
1775
+ }
1776
+ return true;
1777
+ }
1778
+ function areDatesEqual(a, b) {
1779
+ return sameValueZeroEqual(a.getTime(), b.getTime());
1780
+ }
1781
+ function areErrorsEqual(a, b) {
1782
+ return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
1783
+ }
1784
+ function areFunctionsEqual(a, b) {
1785
+ return a === b;
1786
+ }
1787
+ function areMapsEqual(a, b, state) {
1788
+ var size = a.size;
1789
+ if (size !== b.size) {
1790
+ return false;
1791
+ }
1792
+ if (!size) {
1793
+ return true;
1794
+ }
1795
+ var matchedIndices = new Array(size);
1796
+ var aIterable = a.entries();
1797
+ var aResult;
1798
+ var bResult;
1799
+ var index = 0;
1800
+ while (aResult = aIterable.next()) {
1801
+ if (aResult.done) {
1802
+ break;
1803
+ }
1804
+ var bIterable = b.entries();
1805
+ var hasMatch = false;
1806
+ var matchIndex = 0;
1807
+ while (bResult = bIterable.next()) {
1808
+ if (bResult.done) {
1809
+ break;
1810
+ }
1811
+ if (matchedIndices[matchIndex]) {
1812
+ matchIndex++;
1813
+ continue;
1814
+ }
1815
+ var aEntry = aResult.value;
1816
+ var bEntry = bResult.value;
1817
+ 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)) {
1818
+ hasMatch = matchedIndices[matchIndex] = true;
1819
+ break;
1820
+ }
1821
+ matchIndex++;
1822
+ }
1823
+ if (!hasMatch) {
1824
+ return false;
1825
+ }
1826
+ index++;
1827
+ }
1828
+ return true;
1829
+ }
1830
+ var areNumbersEqual = sameValueZeroEqual;
1831
+ function areObjectsEqual(a, b, state) {
1832
+ var properties = keys(a);
1833
+ var index = properties.length;
1834
+ if (keys(b).length !== index) {
1835
+ return false;
1836
+ }
1837
+ while (index-- > 0) {
1838
+ if (!isPropertyEqual(a, b, state, properties[index])) {
1839
+ return false;
1840
+ }
1841
+ }
1842
+ return true;
1843
+ }
1844
+ function areObjectsEqualStrict(a, b, state) {
1845
+ var properties = getStrictProperties(a);
1846
+ var index = properties.length;
1847
+ if (getStrictProperties(b).length !== index) {
1848
+ return false;
1849
+ }
1850
+ var property;
1851
+ var descriptorA;
1852
+ var descriptorB;
1853
+ while (index-- > 0) {
1854
+ property = properties[index];
1855
+ if (!isPropertyEqual(a, b, state, property)) {
1856
+ return false;
1857
+ }
1858
+ descriptorA = getOwnPropertyDescriptor(a, property);
1859
+ descriptorB = getOwnPropertyDescriptor(b, property);
1860
+ if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) {
1861
+ return false;
1862
+ }
1863
+ }
1864
+ return true;
1865
+ }
1866
+ function arePrimitiveWrappersEqual(a, b) {
1867
+ return sameValueZeroEqual(a.valueOf(), b.valueOf());
1868
+ }
1869
+ function areRegExpsEqual(a, b) {
1870
+ return a.source === b.source && a.flags === b.flags;
1871
+ }
1872
+ function areSetsEqual(a, b, state) {
1873
+ var size = a.size;
1874
+ if (size !== b.size) {
1875
+ return false;
1876
+ }
1877
+ if (!size) {
1878
+ return true;
1879
+ }
1880
+ var matchedIndices = new Array(size);
1881
+ var aIterable = a.values();
1882
+ var aResult;
1883
+ var bResult;
1884
+ while (aResult = aIterable.next()) {
1885
+ if (aResult.done) {
1886
+ break;
1887
+ }
1888
+ var bIterable = b.values();
1889
+ var hasMatch = false;
1890
+ var matchIndex = 0;
1891
+ while (bResult = bIterable.next()) {
1892
+ if (bResult.done) {
1893
+ break;
1894
+ }
1895
+ if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
1896
+ hasMatch = matchedIndices[matchIndex] = true;
1897
+ break;
1898
+ }
1899
+ matchIndex++;
1900
+ }
1901
+ if (!hasMatch) {
1902
+ return false;
1903
+ }
1904
+ }
1905
+ return true;
1906
+ }
1907
+ function areTypedArraysEqual(a, b) {
1908
+ var index = a.length;
1909
+ if (b.length !== index) {
1910
+ return false;
1911
+ }
1912
+ while (index-- > 0) {
1913
+ if (a[index] !== b[index]) {
1914
+ return false;
1915
+ }
1916
+ }
1917
+ return true;
1918
+ }
1919
+ function areUrlsEqual(a, b) {
1920
+ 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;
1921
+ }
1922
+ function isPropertyEqual(a, b, state, property) {
1923
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) {
1924
+ return true;
1925
+ }
1926
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
1927
+ }
1928
+ var ARGUMENTS_TAG = "[object Arguments]";
1929
+ var BOOLEAN_TAG = "[object Boolean]";
1930
+ var DATE_TAG = "[object Date]";
1931
+ var ERROR_TAG = "[object Error]";
1932
+ var MAP_TAG = "[object Map]";
1933
+ var NUMBER_TAG = "[object Number]";
1934
+ var OBJECT_TAG = "[object Object]";
1935
+ var REG_EXP_TAG = "[object RegExp]";
1936
+ var SET_TAG = "[object Set]";
1937
+ var STRING_TAG = "[object String]";
1938
+ var URL_TAG = "[object URL]";
1939
+ var isArray = Array.isArray;
1940
+ var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null;
1941
+ var assign = Object.assign;
1942
+ var getTag = Object.prototype.toString.call.bind(Object.prototype.toString);
1943
+ function createEqualityComparator(_a) {
1944
+ 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;
1945
+ return function comparator(a, b, state) {
1946
+ if (a === b) {
1947
+ return true;
1948
+ }
1949
+ if (a == null || b == null) {
1950
+ return false;
1951
+ }
1952
+ var type = typeof a;
1953
+ if (type !== typeof b) {
1954
+ return false;
1955
+ }
1956
+ if (type !== "object") {
1957
+ if (type === "number") {
1958
+ return areNumbersEqual2(a, b, state);
1959
+ }
1960
+ if (type === "function") {
1961
+ return areFunctionsEqual2(a, b, state);
1962
+ }
1963
+ return false;
1964
+ }
1965
+ var constructor = a.constructor;
1966
+ if (constructor !== b.constructor) {
1967
+ return false;
1968
+ }
1969
+ if (constructor === Object) {
1970
+ return areObjectsEqual2(a, b, state);
1971
+ }
1972
+ if (isArray(a)) {
1973
+ return areArraysEqual2(a, b, state);
1974
+ }
1975
+ if (isTypedArray != null && isTypedArray(a)) {
1976
+ return areTypedArraysEqual2(a, b, state);
1977
+ }
1978
+ if (constructor === Date) {
1979
+ return areDatesEqual2(a, b, state);
1980
+ }
1981
+ if (constructor === RegExp) {
1982
+ return areRegExpsEqual2(a, b, state);
1983
+ }
1984
+ if (constructor === Map) {
1985
+ return areMapsEqual2(a, b, state);
1986
+ }
1987
+ if (constructor === Set) {
1988
+ return areSetsEqual2(a, b, state);
1989
+ }
1990
+ var tag = getTag(a);
1991
+ if (tag === DATE_TAG) {
1992
+ return areDatesEqual2(a, b, state);
1993
+ }
1994
+ if (tag === REG_EXP_TAG) {
1995
+ return areRegExpsEqual2(a, b, state);
1996
+ }
1997
+ if (tag === MAP_TAG) {
1998
+ return areMapsEqual2(a, b, state);
1999
+ }
2000
+ if (tag === SET_TAG) {
2001
+ return areSetsEqual2(a, b, state);
2002
+ }
2003
+ if (tag === OBJECT_TAG) {
2004
+ return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state);
2005
+ }
2006
+ if (tag === URL_TAG) {
2007
+ return areUrlsEqual2(a, b, state);
2008
+ }
2009
+ if (tag === ERROR_TAG) {
2010
+ return areErrorsEqual2(a, b, state);
2011
+ }
2012
+ if (tag === ARGUMENTS_TAG) {
2013
+ return areObjectsEqual2(a, b, state);
2014
+ }
2015
+ if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {
2016
+ return arePrimitiveWrappersEqual2(a, b, state);
2017
+ }
2018
+ return false;
2019
+ };
2020
+ }
2021
+ function createEqualityComparatorConfig(_a) {
2022
+ var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;
2023
+ var config = {
2024
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
2025
+ areDatesEqual,
2026
+ areErrorsEqual,
2027
+ areFunctionsEqual,
2028
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
2029
+ areNumbersEqual,
2030
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
2031
+ arePrimitiveWrappersEqual,
2032
+ areRegExpsEqual,
2033
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
2034
+ areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual,
2035
+ areUrlsEqual
2036
+ };
2037
+ if (createCustomConfig) {
2038
+ config = assign({}, config, createCustomConfig(config));
2039
+ }
2040
+ if (circular) {
2041
+ var areArraysEqual$1 = createIsCircular(config.areArraysEqual);
2042
+ var areMapsEqual$1 = createIsCircular(config.areMapsEqual);
2043
+ var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);
2044
+ var areSetsEqual$1 = createIsCircular(config.areSetsEqual);
2045
+ config = assign({}, config, {
2046
+ areArraysEqual: areArraysEqual$1,
2047
+ areMapsEqual: areMapsEqual$1,
2048
+ areObjectsEqual: areObjectsEqual$1,
2049
+ areSetsEqual: areSetsEqual$1
2050
+ });
2051
+ }
2052
+ return config;
2053
+ }
2054
+ function createInternalEqualityComparator(compare) {
2055
+ return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
2056
+ return compare(a, b, state);
2057
+ };
2058
+ }
2059
+ function createIsEqual(_a) {
2060
+ var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;
2061
+ if (createState) {
2062
+ return function isEqual(a, b) {
2063
+ var _a2 = createState(), _b = _a2.cache, cache2 = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta;
2064
+ return comparator(a, b, {
2065
+ cache: cache2,
2066
+ equals,
2067
+ meta,
2068
+ strict
2069
+ });
2070
+ };
2071
+ }
2072
+ if (circular) {
2073
+ return function isEqual(a, b) {
2074
+ return comparator(a, b, {
2075
+ cache: /* @__PURE__ */ new WeakMap(),
2076
+ equals,
2077
+ meta: void 0,
2078
+ strict
2079
+ });
2080
+ };
2081
+ }
2082
+ var state = {
2083
+ cache: void 0,
2084
+ equals,
2085
+ meta: void 0,
2086
+ strict
2087
+ };
2088
+ return function isEqual(a, b) {
2089
+ return comparator(a, b, state);
2090
+ };
2091
+ }
2092
+ var deepEqual = createCustomEqual();
2093
+ var strictDeepEqual = createCustomEqual({ strict: true });
2094
+ var circularDeepEqual = createCustomEqual({ circular: true });
2095
+ var strictCircularDeepEqual = createCustomEqual({
2096
+ circular: true,
2097
+ strict: true
2098
+ });
2099
+ var shallowEqual = createCustomEqual({
2100
+ createInternalComparator: function() {
2101
+ return sameValueZeroEqual;
2102
+ }
2103
+ });
2104
+ var strictShallowEqual = createCustomEqual({
2105
+ strict: true,
2106
+ createInternalComparator: function() {
2107
+ return sameValueZeroEqual;
2108
+ }
2109
+ });
2110
+ var circularShallowEqual = createCustomEqual({
2111
+ circular: true,
2112
+ createInternalComparator: function() {
2113
+ return sameValueZeroEqual;
2114
+ }
2115
+ });
2116
+ var strictCircularShallowEqual = createCustomEqual({
2117
+ circular: true,
2118
+ createInternalComparator: function() {
2119
+ return sameValueZeroEqual;
2120
+ },
2121
+ strict: true
2122
+ });
2123
+ function createCustomEqual(options) {
2124
+ if (options === void 0) {
2125
+ options = {};
2126
+ }
2127
+ 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;
2128
+ var config = createEqualityComparatorConfig(options);
2129
+ var comparator = createEqualityComparator(config);
2130
+ var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
2131
+ return createIsEqual({ circular, comparator, createState, equals, strict });
2132
+ }
2133
+
2134
+ // ../core/lib/get-changed.ts
1702
2135
  var getChanged = (newItem, oldItem) => {
1703
2136
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1704
2137
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1705
2138
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1706
2139
  return __spreadProps(__spreadValues({}, acc), {
1707
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
2140
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
1708
2141
  });
1709
2142
  }, {}) : {};
1710
2143
  };
1711
2144
 
1712
2145
  // ../core/store/slices/permissions.ts
1713
2146
  var createPermissionsSlice = (set, get) => {
1714
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2147
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1715
2148
  const { state, permissions, config } = get();
1716
2149
  const { cache: cache2, globalPermissions } = permissions;
1717
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1718
- var _a, _b, _c;
2150
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2151
+ var _a, _b;
1719
2152
  const { config: config2, state: appState, setComponentLoading } = get();
2153
+ const itemCache = cache2[item2.props.id];
2154
+ const nodes = appState.indexes.nodes;
2155
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2156
+ const parentNode = parentId ? nodes[parentId] : null;
2157
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
1720
2158
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1721
2159
  if (!componentConfig) {
1722
2160
  return;
1723
2161
  }
1724
2162
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1725
2163
  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) {
2164
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2165
+ const propsChanged = Object.values(changed).some((el) => el === true);
2166
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2167
+ if (propsChanged || parentChanged || force2) {
1728
2168
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1729
2169
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1730
2170
  item2,
1731
2171
  {
1732
2172
  changed,
1733
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2173
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1734
2174
  permissions: initialPermissions,
1735
2175
  appState: makeStatePublic(appState),
1736
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2176
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2177
+ parent: parentData
1737
2178
  }
1738
2179
  );
1739
2180
  const latest = get().permissions;
@@ -1741,6 +2182,7 @@ var createPermissionsSlice = (set, get) => {
1741
2182
  permissions: __spreadProps(__spreadValues({}, latest), {
1742
2183
  cache: __spreadProps(__spreadValues({}, latest.cache), {
1743
2184
  [item2.props.id]: {
2185
+ lastParentId: parentId,
1744
2186
  lastData: item2,
1745
2187
  lastPermissions: resolvedPermissions
1746
2188
  }
@@ -1754,9 +2196,9 @@ var createPermissionsSlice = (set, get) => {
1754
2196
  }
1755
2197
  }
1756
2198
  });
1757
- const resolveDataForRoot = (force2 = false) => {
2199
+ const resolvePermissionsForRoot = (force2 = false) => {
1758
2200
  const { state: appState } = get();
1759
- resolveDataForItem(
2201
+ resolvePermissionsForItem(
1760
2202
  // Shim the root data in by conforming to component data shape
1761
2203
  {
1762
2204
  type: "root",
@@ -1767,16 +2209,16 @@ var createPermissionsSlice = (set, get) => {
1767
2209
  };
1768
2210
  const { item, type, root } = params;
1769
2211
  if (item) {
1770
- yield resolveDataForItem(item, force);
2212
+ yield resolvePermissionsForItem(item, force);
1771
2213
  } else if (type) {
1772
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1773
- yield resolveDataForItem(item2, force);
2214
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2215
+ yield resolvePermissionsForItem(item2, force);
1774
2216
  }));
1775
2217
  } else if (root) {
1776
- resolveDataForRoot(force);
2218
+ resolvePermissionsForRoot(force);
1777
2219
  } else {
1778
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1779
- yield resolveDataForItem(item2, force);
2220
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2221
+ yield resolvePermissionsForItem(item2, force);
1780
2222
  }));
1781
2223
  }
1782
2224
  });
@@ -1829,16 +2271,15 @@ var createFieldsSlice = (_set, _get) => {
1829
2271
 
1830
2272
  // ../core/lib/resolve-component-data.ts
1831
2273
  init_react_import();
1832
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1833
2274
  var cache = { lastChange: {} };
1834
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2275
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
1835
2276
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1836
2277
  const resolvedItem = __spreadValues({}, item);
1837
2278
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1838
2279
  const id = "id" in item.props ? item.props.id : "root";
1839
2280
  if (shouldRunResolver) {
1840
2281
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1841
- if (trigger !== "force" && item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
2282
+ if (trigger !== "force" && item && deepEqual(item, oldItem)) {
1842
2283
  return { node: resolved, didChange: false };
1843
2284
  }
1844
2285
  const changed = getChanged(item, oldItem);
@@ -1859,11 +2300,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1859
2300
  let itemWithResolvedChildren = yield mapFields(
1860
2301
  resolvedItem,
1861
2302
  {
1862
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2303
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
1863
2304
  const content = value;
1864
2305
  return yield Promise.all(
1865
2306
  content.map(
1866
- (childItem) => __async(void 0, null, function* () {
2307
+ (childItem) => __async(null, null, function* () {
1867
2308
  return (yield resolveComponentData(
1868
2309
  childItem,
1869
2310
  config,
@@ -1888,7 +2329,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1888
2329
  };
1889
2330
  return {
1890
2331
  node: itemWithResolvedChildren,
1891
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
2332
+ didChange: !deepEqual(item, itemWithResolvedChildren)
1892
2333
  };
1893
2334
  });
1894
2335
 
@@ -1929,7 +2370,8 @@ var defaultAppState = {
1929
2370
  options: [],
1930
2371
  controlsVisible: true
1931
2372
  },
1932
- field: { focus: null }
2373
+ field: { focus: null },
2374
+ plugin: { current: null }
1933
2375
  },
1934
2376
  indexes: {
1935
2377
  nodes: {},
@@ -1945,6 +2387,7 @@ var createAppStore = (initialAppStore) => create()(
1945
2387
  subscribeWithSelector((set, get) => {
1946
2388
  var _a, _b;
1947
2389
  return __spreadProps(__spreadValues({
2390
+ instanceId: generateId(),
1948
2391
  state: defaultAppState,
1949
2392
  config: { components: {} },
1950
2393
  componentState: {},
@@ -1965,6 +2408,11 @@ var createAppStore = (initialAppStore) => create()(
1965
2408
  history: createHistorySlice(set, get),
1966
2409
  nodes: createNodesSlice(set, get),
1967
2410
  permissions: createPermissionsSlice(set, get),
2411
+ getCurrentData: () => {
2412
+ var _a2;
2413
+ const s = get();
2414
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
2415
+ },
1968
2416
  getComponentConfig: (type) => {
1969
2417
  var _a2;
1970
2418
  const { config, selectedItem } = get();
@@ -2053,7 +2501,7 @@ var createAppStore = (initialAppStore) => create()(
2053
2501
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2054
2502
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2055
2503
  }),
2056
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2504
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2057
2505
  const { config, metadata, setComponentLoading, permissions } = get();
2058
2506
  const timeouts = {};
2059
2507
  return yield resolveComponentData(
@@ -2064,7 +2512,7 @@ var createAppStore = (initialAppStore) => create()(
2064
2512
  const id = "id" in item.props ? item.props.id : "root";
2065
2513
  timeouts[id] = setComponentLoading(id, true, 50);
2066
2514
  },
2067
- (item) => __async(void 0, null, function* () {
2515
+ (item) => __async(null, null, function* () {
2068
2516
  const id = "id" in item.props ? item.props.id : "root";
2069
2517
  if ("type" in item) {
2070
2518
  yield permissions.refreshPermissions({ item });
@@ -2076,7 +2524,7 @@ var createAppStore = (initialAppStore) => create()(
2076
2524
  trigger
2077
2525
  );
2078
2526
  }),
2079
- resolveAndCommitData: () => __async(void 0, null, function* () {
2527
+ resolveAndCommitData: () => __async(null, null, function* () {
2080
2528
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2081
2529
  walkAppState(
2082
2530
  state,
@@ -2115,203 +2563,14 @@ var createAppStore = (initialAppStore) => create()(
2115
2563
  })
2116
2564
  );
2117
2565
  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
2566
 
2186
2567
  // ../core/lib/get-zoom-config.ts
2187
2568
  init_react_import();
2188
2569
 
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
2570
  // src/HeadingAnalyzer.tsx
2312
2571
  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);
2572
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2573
+ var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2315
2574
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2316
2575
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
2317
2576
  var getOutline = ({ frame } = {}) => {
@@ -2366,8 +2625,8 @@ function buildHierarchy(frame) {
2366
2625
  var usePuck = (0, import_puck.createUsePuck)();
2367
2626
  var HeadingAnalyzer = () => {
2368
2627
  const data = usePuck((s) => s.appState.data);
2369
- const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
2370
- (0, import_react11.useEffect)(() => {
2628
+ const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
2629
+ (0, import_react10.useEffect)(() => {
2371
2630
  const frame = getFrame();
2372
2631
  let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
2373
2632
  const createHierarchy = () => {
@@ -2402,11 +2661,11 @@ var HeadingAnalyzer = () => {
2402
2661
  frameObserver.disconnect();
2403
2662
  };
2404
2663
  }, [data]);
2405
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
2406
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2664
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
2665
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2407
2666
  "small",
2408
2667
  {
2409
- className: getClassName5("cssWarning"),
2668
+ className: getClassName2("cssWarning"),
2410
2669
  style: {
2411
2670
  color: "var(--puck-color-red-04)",
2412
2671
  display: "block",
@@ -2415,19 +2674,19 @@ var HeadingAnalyzer = () => {
2415
2674
  children: [
2416
2675
  "Heading analyzer styles not loaded. Please review the",
2417
2676
  " ",
2418
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2677
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2419
2678
  "."
2420
2679
  ]
2421
2680
  }
2422
2681
  ),
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)(
2682
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
2683
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2425
2684
  ReactFromJSON,
2426
2685
  {
2427
2686
  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)(
2687
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
2688
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
2689
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2431
2690
  "small",
2432
2691
  {
2433
2692
  className: getClassNameItem2({ missing: props.missing }),
@@ -2445,14 +2704,14 @@ var HeadingAnalyzer = () => {
2445
2704
  }, 2e3);
2446
2705
  }
2447
2706
  },
2448
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2449
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2707
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2708
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2450
2709
  "H",
2451
2710
  props.rank
2452
2711
  ] }),
2453
2712
  ": Missing"
2454
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2455
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2713
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2714
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2456
2715
  "H",
2457
2716
  props.rank
2458
2717
  ] }),
@@ -2461,7 +2720,7 @@ var HeadingAnalyzer = () => {
2461
2720
  ] })
2462
2721
  }
2463
2722
  ) }),
2464
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
2723
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
2465
2724
  ] })
2466
2725
  },
2467
2726
  entry: {
@@ -2482,12 +2741,10 @@ var HeadingAnalyzer = () => {
2482
2741
  ] });
2483
2742
  };
2484
2743
  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
- }
2744
+ name: "heading-analyzer",
2745
+ label: "Audit",
2746
+ render: HeadingAnalyzer,
2747
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
2491
2748
  };
2492
2749
  var HeadingAnalyzer_default = headingAnalyzer;
2493
2750
  /*! Bundled license information:
@@ -2500,45 +2757,10 @@ classnames/index.js:
2500
2757
  *)
2501
2758
 
2502
2759
  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
2760
  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
2761
  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
2762
  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
-
2763
+ lucide-react/dist/esm/icons/heading-1.js:
2542
2764
  lucide-react/dist/esm/lucide-react.js:
2543
2765
  (**
2544
2766
  * @license lucide-react v0.468.0 - ISC