@measured/puck-plugin-heading-analyzer 0.21.0-canary.d32e582b → 0.21.0-canary.e1cbf777

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,48 +267,12 @@ 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
@@ -607,7 +571,7 @@ var walkField = ({
607
571
  return map({
608
572
  value: mappedContent,
609
573
  parentId: id,
610
- propName: propKey,
574
+ propName: propPath,
611
575
  field: fields[propKey],
612
576
  propPath
613
577
  });
@@ -889,10 +853,10 @@ var insert = (list, index, item) => {
889
853
  // ../core/lib/generate-id.ts
890
854
  init_react_import();
891
855
 
892
- // ../../node_modules/uuid/dist/esm-node/index.js
856
+ // ../core/node_modules/uuid/dist/esm-node/index.js
893
857
  init_react_import();
894
858
 
895
- // ../../node_modules/uuid/dist/esm-node/rng.js
859
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
896
860
  init_react_import();
897
861
  var import_crypto = __toESM(require("crypto"));
898
862
  var rnds8Pool = new Uint8Array(256);
@@ -905,7 +869,7 @@ function rng() {
905
869
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
906
870
  }
907
871
 
908
- // ../../node_modules/uuid/dist/esm-node/stringify.js
872
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
909
873
  init_react_import();
910
874
  var byteToHex = [];
911
875
  for (let i = 0; i < 256; ++i) {
@@ -915,17 +879,17 @@ function unsafeStringify(arr, offset = 0) {
915
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]];
916
880
  }
917
881
 
918
- // ../../node_modules/uuid/dist/esm-node/v4.js
882
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
919
883
  init_react_import();
920
884
 
921
- // ../../node_modules/uuid/dist/esm-node/native.js
885
+ // ../core/node_modules/uuid/dist/esm-node/native.js
922
886
  init_react_import();
923
887
  var import_crypto2 = __toESM(require("crypto"));
924
888
  var native_default = {
925
889
  randomUUID: import_crypto2.default.randomUUID
926
890
  };
927
891
 
928
- // ../../node_modules/uuid/dist/esm-node/v4.js
892
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
929
893
  function v4(options, buf, offset) {
930
894
  if (native_default.randomUUID && !buf && !options) {
931
895
  return native_default.randomUUID();
@@ -1077,7 +1041,9 @@ var replaceAction = (state, action, appStore) => {
1077
1041
  });
1078
1042
  });
1079
1043
  });
1080
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1044
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1045
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1046
+ });
1081
1047
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1082
1048
  const id = zoneCompound.split(":")[0];
1083
1049
  if (id === originalId) {
@@ -1506,7 +1472,7 @@ var createStoreImpl = (createState) => {
1506
1472
  const initialState = state = createState(setState, getState, api);
1507
1473
  return api;
1508
1474
  };
1509
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1475
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1510
1476
 
1511
1477
  // ../../node_modules/zustand/esm/react.mjs
1512
1478
  init_react_import();
@@ -1515,8 +1481,8 @@ var identity = (arg) => arg;
1515
1481
  function useStore(api, selector = identity) {
1516
1482
  const slice = import_react4.default.useSyncExternalStore(
1517
1483
  api.subscribe,
1518
- () => selector(api.getState()),
1519
- () => selector(api.getInitialState())
1484
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1485
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1520
1486
  );
1521
1487
  import_react4.default.useDebugValue(slice);
1522
1488
  return slice;
@@ -1527,13 +1493,13 @@ var createImpl = (createState) => {
1527
1493
  Object.assign(useBoundStore, api);
1528
1494
  return useBoundStore;
1529
1495
  };
1530
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1496
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1531
1497
 
1532
1498
  // ../../node_modules/zustand/esm/middleware.mjs
1533
1499
  init_react_import();
1534
1500
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1535
1501
  const origSubscribe = api.subscribe;
1536
- api.subscribe = (selector, optListener, options) => {
1502
+ api.subscribe = ((selector, optListener, options) => {
1537
1503
  let listener = selector;
1538
1504
  if (optListener) {
1539
1505
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1550,7 +1516,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1550
1516
  }
1551
1517
  }
1552
1518
  return origSubscribe(listener);
1553
- };
1519
+ });
1554
1520
  const initialState = fn(set, get, api);
1555
1521
  return initialState;
1556
1522
  };
@@ -1590,9 +1556,9 @@ function debounce(func, timeout = 300) {
1590
1556
  var tidyState = (state) => {
1591
1557
  return __spreadProps(__spreadValues({}, state), {
1592
1558
  ui: __spreadProps(__spreadValues({}, state.ui), {
1593
- field: {
1559
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1594
1560
  focus: null
1595
- }
1561
+ })
1596
1562
  })
1597
1563
  });
1598
1564
  };
@@ -1726,7 +1692,7 @@ var flattenData = (state, config) => {
1726
1692
  (content) => content,
1727
1693
  (item) => {
1728
1694
  data.push(item);
1729
- return null;
1695
+ return item;
1730
1696
  }
1731
1697
  );
1732
1698
  return data;
@@ -1734,42 +1700,462 @@ var flattenData = (state, config) => {
1734
1700
 
1735
1701
  // ../core/lib/get-changed.ts
1736
1702
  init_react_import();
1737
- 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
1738
2116
  var getChanged = (newItem, oldItem) => {
1739
2117
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1740
2118
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1741
2119
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1742
2120
  return __spreadProps(__spreadValues({}, acc), {
1743
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
2121
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
1744
2122
  });
1745
2123
  }, {}) : {};
1746
2124
  };
1747
2125
 
1748
2126
  // ../core/store/slices/permissions.ts
1749
2127
  var createPermissionsSlice = (set, get) => {
1750
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2128
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1751
2129
  const { state, permissions, config } = get();
1752
2130
  const { cache: cache2, globalPermissions } = permissions;
1753
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1754
- var _a, _b, _c;
2131
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2132
+ var _a, _b;
1755
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;
1756
2139
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1757
2140
  if (!componentConfig) {
1758
2141
  return;
1759
2142
  }
1760
2143
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1761
2144
  if (componentConfig.resolvePermissions) {
1762
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
1763
- 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) {
1764
2149
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1765
2150
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1766
2151
  item2,
1767
2152
  {
1768
2153
  changed,
1769
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2154
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1770
2155
  permissions: initialPermissions,
1771
2156
  appState: makeStatePublic(appState),
1772
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2157
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2158
+ parent: parentData
1773
2159
  }
1774
2160
  );
1775
2161
  const latest = get().permissions;
@@ -1777,6 +2163,7 @@ var createPermissionsSlice = (set, get) => {
1777
2163
  permissions: __spreadProps(__spreadValues({}, latest), {
1778
2164
  cache: __spreadProps(__spreadValues({}, latest.cache), {
1779
2165
  [item2.props.id]: {
2166
+ lastParentId: parentId,
1780
2167
  lastData: item2,
1781
2168
  lastPermissions: resolvedPermissions
1782
2169
  }
@@ -1790,9 +2177,9 @@ var createPermissionsSlice = (set, get) => {
1790
2177
  }
1791
2178
  }
1792
2179
  });
1793
- const resolveDataForRoot = (force2 = false) => {
2180
+ const resolvePermissionsForRoot = (force2 = false) => {
1794
2181
  const { state: appState } = get();
1795
- resolveDataForItem(
2182
+ resolvePermissionsForItem(
1796
2183
  // Shim the root data in by conforming to component data shape
1797
2184
  {
1798
2185
  type: "root",
@@ -1803,16 +2190,16 @@ var createPermissionsSlice = (set, get) => {
1803
2190
  };
1804
2191
  const { item, type, root } = params;
1805
2192
  if (item) {
1806
- yield resolveDataForItem(item, force);
2193
+ yield resolvePermissionsForItem(item, force);
1807
2194
  } else if (type) {
1808
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1809
- yield resolveDataForItem(item2, force);
2195
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2196
+ yield resolvePermissionsForItem(item2, force);
1810
2197
  }));
1811
2198
  } else if (root) {
1812
- resolveDataForRoot(force);
2199
+ resolvePermissionsForRoot(force);
1813
2200
  } else {
1814
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1815
- yield resolveDataForItem(item2, force);
2201
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2202
+ yield resolvePermissionsForItem(item2, force);
1816
2203
  }));
1817
2204
  }
1818
2205
  });
@@ -1865,16 +2252,15 @@ var createFieldsSlice = (_set, _get) => {
1865
2252
 
1866
2253
  // ../core/lib/resolve-component-data.ts
1867
2254
  init_react_import();
1868
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1869
2255
  var cache = { lastChange: {} };
1870
- 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") {
1871
2257
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1872
2258
  const resolvedItem = __spreadValues({}, item);
1873
2259
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1874
2260
  const id = "id" in item.props ? item.props.id : "root";
1875
2261
  if (shouldRunResolver) {
1876
2262
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1877
- if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
2263
+ if (trigger !== "force" && item && deepEqual(item, oldItem)) {
1878
2264
  return { node: resolved, didChange: false };
1879
2265
  }
1880
2266
  const changed = getChanged(item, oldItem);
@@ -1895,11 +2281,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1895
2281
  let itemWithResolvedChildren = yield mapFields(
1896
2282
  resolvedItem,
1897
2283
  {
1898
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2284
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
1899
2285
  const content = value;
1900
2286
  return yield Promise.all(
1901
2287
  content.map(
1902
- (childItem) => __async(void 0, null, function* () {
2288
+ (childItem) => __async(null, null, function* () {
1903
2289
  return (yield resolveComponentData(
1904
2290
  childItem,
1905
2291
  config,
@@ -1924,7 +2310,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1924
2310
  };
1925
2311
  return {
1926
2312
  node: itemWithResolvedChildren,
1927
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
2313
+ didChange: !deepEqual(item, itemWithResolvedChildren)
1928
2314
  };
1929
2315
  });
1930
2316
 
@@ -2003,6 +2389,11 @@ var createAppStore = (initialAppStore) => create()(
2003
2389
  history: createHistorySlice(set, get),
2004
2390
  nodes: createNodesSlice(set, get),
2005
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
+ },
2006
2397
  getComponentConfig: (type) => {
2007
2398
  var _a2;
2008
2399
  const { config, selectedItem } = get();
@@ -2091,7 +2482,7 @@ var createAppStore = (initialAppStore) => create()(
2091
2482
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2092
2483
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2093
2484
  }),
2094
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2485
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2095
2486
  const { config, metadata, setComponentLoading, permissions } = get();
2096
2487
  const timeouts = {};
2097
2488
  return yield resolveComponentData(
@@ -2102,7 +2493,7 @@ var createAppStore = (initialAppStore) => create()(
2102
2493
  const id = "id" in item.props ? item.props.id : "root";
2103
2494
  timeouts[id] = setComponentLoading(id, true, 50);
2104
2495
  },
2105
- (item) => __async(void 0, null, function* () {
2496
+ (item) => __async(null, null, function* () {
2106
2497
  const id = "id" in item.props ? item.props.id : "root";
2107
2498
  if ("type" in item) {
2108
2499
  yield permissions.refreshPermissions({ item });
@@ -2114,7 +2505,7 @@ var createAppStore = (initialAppStore) => create()(
2114
2505
  trigger
2115
2506
  );
2116
2507
  }),
2117
- resolveAndCommitData: () => __async(void 0, null, function* () {
2508
+ resolveAndCommitData: () => __async(null, null, function* () {
2118
2509
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2119
2510
  walkAppState(
2120
2511
  state,
@@ -2347,45 +2738,10 @@ classnames/index.js:
2347
2738
  *)
2348
2739
 
2349
2740
  lucide-react/dist/esm/shared/src/utils.js:
2350
- (**
2351
- * @license lucide-react v0.468.0 - ISC
2352
- *
2353
- * This source code is licensed under the ISC license.
2354
- * See the LICENSE file in the root directory of this source tree.
2355
- *)
2356
-
2357
2741
  lucide-react/dist/esm/defaultAttributes.js:
2358
- (**
2359
- * @license lucide-react v0.468.0 - ISC
2360
- *
2361
- * This source code is licensed under the ISC license.
2362
- * See the LICENSE file in the root directory of this source tree.
2363
- *)
2364
-
2365
2742
  lucide-react/dist/esm/Icon.js:
2366
- (**
2367
- * @license lucide-react v0.468.0 - ISC
2368
- *
2369
- * This source code is licensed under the ISC license.
2370
- * See the LICENSE file in the root directory of this source tree.
2371
- *)
2372
-
2373
2743
  lucide-react/dist/esm/createLucideIcon.js:
2374
- (**
2375
- * @license lucide-react v0.468.0 - ISC
2376
- *
2377
- * This source code is licensed under the ISC license.
2378
- * See the LICENSE file in the root directory of this source tree.
2379
- *)
2380
-
2381
2744
  lucide-react/dist/esm/icons/heading-1.js:
2382
- (**
2383
- * @license lucide-react v0.468.0 - ISC
2384
- *
2385
- * This source code is licensed under the ISC license.
2386
- * See the LICENSE file in the root directory of this source tree.
2387
- *)
2388
-
2389
2745
  lucide-react/dist/esm/lucide-react.js:
2390
2746
  (**
2391
2747
  * @license lucide-react v0.468.0 - ISC