@measured/puck-plugin-heading-analyzer 0.21.0-canary.d32e582b → 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,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
  });
@@ -727,9 +691,28 @@ var stripSlots = (data, config) => {
727
691
 
728
692
  // ../core/lib/data/flatten-node.ts
729
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
+ }
730
713
  var flattenNode = (node, config) => {
731
714
  return __spreadProps(__spreadValues({}, node), {
732
- props: flatten2(stripSlots(node, config).props)
715
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
733
716
  });
734
717
  };
735
718
 
@@ -889,10 +872,10 @@ var insert = (list, index, item) => {
889
872
  // ../core/lib/generate-id.ts
890
873
  init_react_import();
891
874
 
892
- // ../../node_modules/uuid/dist/esm-node/index.js
875
+ // ../core/node_modules/uuid/dist/esm-node/index.js
893
876
  init_react_import();
894
877
 
895
- // ../../node_modules/uuid/dist/esm-node/rng.js
878
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
896
879
  init_react_import();
897
880
  var import_crypto = __toESM(require("crypto"));
898
881
  var rnds8Pool = new Uint8Array(256);
@@ -905,7 +888,7 @@ function rng() {
905
888
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
906
889
  }
907
890
 
908
- // ../../node_modules/uuid/dist/esm-node/stringify.js
891
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
909
892
  init_react_import();
910
893
  var byteToHex = [];
911
894
  for (let i = 0; i < 256; ++i) {
@@ -915,17 +898,17 @@ function unsafeStringify(arr, offset = 0) {
915
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]];
916
899
  }
917
900
 
918
- // ../../node_modules/uuid/dist/esm-node/v4.js
901
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
919
902
  init_react_import();
920
903
 
921
- // ../../node_modules/uuid/dist/esm-node/native.js
904
+ // ../core/node_modules/uuid/dist/esm-node/native.js
922
905
  init_react_import();
923
906
  var import_crypto2 = __toESM(require("crypto"));
924
907
  var native_default = {
925
908
  randomUUID: import_crypto2.default.randomUUID
926
909
  };
927
910
 
928
- // ../../node_modules/uuid/dist/esm-node/v4.js
911
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
929
912
  function v4(options, buf, offset) {
930
913
  if (native_default.randomUUID && !buf && !options) {
931
914
  return native_default.randomUUID();
@@ -1077,7 +1060,9 @@ var replaceAction = (state, action, appStore) => {
1077
1060
  });
1078
1061
  });
1079
1062
  });
1080
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1063
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1064
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1065
+ });
1081
1066
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1082
1067
  const id = zoneCompound.split(":")[0];
1083
1068
  if (id === originalId) {
@@ -1506,7 +1491,7 @@ var createStoreImpl = (createState) => {
1506
1491
  const initialState = state = createState(setState, getState, api);
1507
1492
  return api;
1508
1493
  };
1509
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1494
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1510
1495
 
1511
1496
  // ../../node_modules/zustand/esm/react.mjs
1512
1497
  init_react_import();
@@ -1515,8 +1500,8 @@ var identity = (arg) => arg;
1515
1500
  function useStore(api, selector = identity) {
1516
1501
  const slice = import_react4.default.useSyncExternalStore(
1517
1502
  api.subscribe,
1518
- () => selector(api.getState()),
1519
- () => selector(api.getInitialState())
1503
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1504
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1520
1505
  );
1521
1506
  import_react4.default.useDebugValue(slice);
1522
1507
  return slice;
@@ -1527,13 +1512,13 @@ var createImpl = (createState) => {
1527
1512
  Object.assign(useBoundStore, api);
1528
1513
  return useBoundStore;
1529
1514
  };
1530
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1515
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1531
1516
 
1532
1517
  // ../../node_modules/zustand/esm/middleware.mjs
1533
1518
  init_react_import();
1534
1519
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1535
1520
  const origSubscribe = api.subscribe;
1536
- api.subscribe = (selector, optListener, options) => {
1521
+ api.subscribe = ((selector, optListener, options) => {
1537
1522
  let listener = selector;
1538
1523
  if (optListener) {
1539
1524
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1550,7 +1535,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1550
1535
  }
1551
1536
  }
1552
1537
  return origSubscribe(listener);
1553
- };
1538
+ });
1554
1539
  const initialState = fn(set, get, api);
1555
1540
  return initialState;
1556
1541
  };
@@ -1590,9 +1575,9 @@ function debounce(func, timeout = 300) {
1590
1575
  var tidyState = (state) => {
1591
1576
  return __spreadProps(__spreadValues({}, state), {
1592
1577
  ui: __spreadProps(__spreadValues({}, state.ui), {
1593
- field: {
1578
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1594
1579
  focus: null
1595
- }
1580
+ })
1596
1581
  })
1597
1582
  });
1598
1583
  };
@@ -1726,7 +1711,7 @@ var flattenData = (state, config) => {
1726
1711
  (content) => content,
1727
1712
  (item) => {
1728
1713
  data.push(item);
1729
- return null;
1714
+ return item;
1730
1715
  }
1731
1716
  );
1732
1717
  return data;
@@ -1734,42 +1719,462 @@ var flattenData = (state, config) => {
1734
1719
 
1735
1720
  // ../core/lib/get-changed.ts
1736
1721
  init_react_import();
1737
- 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
1738
2135
  var getChanged = (newItem, oldItem) => {
1739
2136
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
1740
2137
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
1741
2138
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
1742
2139
  return __spreadProps(__spreadValues({}, acc), {
1743
- [item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
2140
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
1744
2141
  });
1745
2142
  }, {}) : {};
1746
2143
  };
1747
2144
 
1748
2145
  // ../core/store/slices/permissions.ts
1749
2146
  var createPermissionsSlice = (set, get) => {
1750
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2147
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
1751
2148
  const { state, permissions, config } = get();
1752
2149
  const { cache: cache2, globalPermissions } = permissions;
1753
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1754
- var _a, _b, _c;
2150
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2151
+ var _a, _b;
1755
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;
1756
2158
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1757
2159
  if (!componentConfig) {
1758
2160
  return;
1759
2161
  }
1760
2162
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1761
2163
  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) {
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) {
1764
2168
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1765
2169
  const resolvedPermissions = yield componentConfig.resolvePermissions(
1766
2170
  item2,
1767
2171
  {
1768
2172
  changed,
1769
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2173
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
1770
2174
  permissions: initialPermissions,
1771
2175
  appState: makeStatePublic(appState),
1772
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2176
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2177
+ parent: parentData
1773
2178
  }
1774
2179
  );
1775
2180
  const latest = get().permissions;
@@ -1777,6 +2182,7 @@ var createPermissionsSlice = (set, get) => {
1777
2182
  permissions: __spreadProps(__spreadValues({}, latest), {
1778
2183
  cache: __spreadProps(__spreadValues({}, latest.cache), {
1779
2184
  [item2.props.id]: {
2185
+ lastParentId: parentId,
1780
2186
  lastData: item2,
1781
2187
  lastPermissions: resolvedPermissions
1782
2188
  }
@@ -1790,9 +2196,9 @@ var createPermissionsSlice = (set, get) => {
1790
2196
  }
1791
2197
  }
1792
2198
  });
1793
- const resolveDataForRoot = (force2 = false) => {
2199
+ const resolvePermissionsForRoot = (force2 = false) => {
1794
2200
  const { state: appState } = get();
1795
- resolveDataForItem(
2201
+ resolvePermissionsForItem(
1796
2202
  // Shim the root data in by conforming to component data shape
1797
2203
  {
1798
2204
  type: "root",
@@ -1803,16 +2209,16 @@ var createPermissionsSlice = (set, get) => {
1803
2209
  };
1804
2210
  const { item, type, root } = params;
1805
2211
  if (item) {
1806
- yield resolveDataForItem(item, force);
2212
+ yield resolvePermissionsForItem(item, force);
1807
2213
  } else if (type) {
1808
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1809
- yield resolveDataForItem(item2, force);
2214
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2215
+ yield resolvePermissionsForItem(item2, force);
1810
2216
  }));
1811
2217
  } else if (root) {
1812
- resolveDataForRoot(force);
2218
+ resolvePermissionsForRoot(force);
1813
2219
  } else {
1814
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1815
- yield resolveDataForItem(item2, force);
2220
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2221
+ yield resolvePermissionsForItem(item2, force);
1816
2222
  }));
1817
2223
  }
1818
2224
  });
@@ -1865,16 +2271,15 @@ var createFieldsSlice = (_set, _get) => {
1865
2271
 
1866
2272
  // ../core/lib/resolve-component-data.ts
1867
2273
  init_react_import();
1868
- var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
1869
2274
  var cache = { lastChange: {} };
1870
- 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") {
1871
2276
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
1872
2277
  const resolvedItem = __spreadValues({}, item);
1873
2278
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
1874
2279
  const id = "id" in item.props ? item.props.id : "root";
1875
2280
  if (shouldRunResolver) {
1876
2281
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
1877
- if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
2282
+ if (trigger !== "force" && item && deepEqual(item, oldItem)) {
1878
2283
  return { node: resolved, didChange: false };
1879
2284
  }
1880
2285
  const changed = getChanged(item, oldItem);
@@ -1895,11 +2300,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1895
2300
  let itemWithResolvedChildren = yield mapFields(
1896
2301
  resolvedItem,
1897
2302
  {
1898
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2303
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
1899
2304
  const content = value;
1900
2305
  return yield Promise.all(
1901
2306
  content.map(
1902
- (childItem) => __async(void 0, null, function* () {
2307
+ (childItem) => __async(null, null, function* () {
1903
2308
  return (yield resolveComponentData(
1904
2309
  childItem,
1905
2310
  config,
@@ -1924,7 +2329,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
1924
2329
  };
1925
2330
  return {
1926
2331
  node: itemWithResolvedChildren,
1927
- didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
2332
+ didChange: !deepEqual(item, itemWithResolvedChildren)
1928
2333
  };
1929
2334
  });
1930
2335
 
@@ -2003,6 +2408,11 @@ var createAppStore = (initialAppStore) => create()(
2003
2408
  history: createHistorySlice(set, get),
2004
2409
  nodes: createNodesSlice(set, get),
2005
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
+ },
2006
2416
  getComponentConfig: (type) => {
2007
2417
  var _a2;
2008
2418
  const { config, selectedItem } = get();
@@ -2091,7 +2501,7 @@ var createAppStore = (initialAppStore) => create()(
2091
2501
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2092
2502
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2093
2503
  }),
2094
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2504
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2095
2505
  const { config, metadata, setComponentLoading, permissions } = get();
2096
2506
  const timeouts = {};
2097
2507
  return yield resolveComponentData(
@@ -2102,7 +2512,7 @@ var createAppStore = (initialAppStore) => create()(
2102
2512
  const id = "id" in item.props ? item.props.id : "root";
2103
2513
  timeouts[id] = setComponentLoading(id, true, 50);
2104
2514
  },
2105
- (item) => __async(void 0, null, function* () {
2515
+ (item) => __async(null, null, function* () {
2106
2516
  const id = "id" in item.props ? item.props.id : "root";
2107
2517
  if ("type" in item) {
2108
2518
  yield permissions.refreshPermissions({ item });
@@ -2114,7 +2524,7 @@ var createAppStore = (initialAppStore) => create()(
2114
2524
  trigger
2115
2525
  );
2116
2526
  }),
2117
- resolveAndCommitData: () => __async(void 0, null, function* () {
2527
+ resolveAndCommitData: () => __async(null, null, function* () {
2118
2528
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2119
2529
  walkAppState(
2120
2530
  state,
@@ -2347,45 +2757,10 @@ classnames/index.js:
2347
2757
  *)
2348
2758
 
2349
2759
  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
2760
  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
2761
  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
2762
  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
2763
  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
2764
  lucide-react/dist/esm/lucide-react.js:
2390
2765
  (**
2391
2766
  * @license lucide-react v0.468.0 - ISC