@measured/puck-plugin-heading-analyzer 0.21.0-canary.f5820ce9 → 0.21.0-canary.fee2ba98

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
@@ -268,11 +268,11 @@ var require_flat = __commonJS({
268
268
  });
269
269
 
270
270
  // index.ts
271
- var plugin_heading_analyzer_exports = {};
272
- __export(plugin_heading_analyzer_exports, {
271
+ var index_exports = {};
272
+ __export(index_exports, {
273
273
  default: () => HeadingAnalyzer_default
274
274
  });
275
- module.exports = __toCommonJS(plugin_heading_analyzer_exports);
275
+ module.exports = __toCommonJS(index_exports);
276
276
  init_react_import();
277
277
 
278
278
  // src/HeadingAnalyzer.tsx
@@ -818,10 +818,10 @@ var insert = (list, index, item) => {
818
818
  // ../core/lib/generate-id.ts
819
819
  init_react_import();
820
820
 
821
- // ../../node_modules/uuid/dist/esm-node/index.js
821
+ // ../core/node_modules/uuid/dist/esm-node/index.js
822
822
  init_react_import();
823
823
 
824
- // ../../node_modules/uuid/dist/esm-node/rng.js
824
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
825
825
  init_react_import();
826
826
  var import_crypto = __toESM(require("crypto"));
827
827
  var rnds8Pool = new Uint8Array(256);
@@ -834,7 +834,7 @@ function rng() {
834
834
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
835
835
  }
836
836
 
837
- // ../../node_modules/uuid/dist/esm-node/stringify.js
837
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
838
838
  init_react_import();
839
839
  var byteToHex = [];
840
840
  for (let i = 0; i < 256; ++i) {
@@ -844,17 +844,17 @@ function unsafeStringify(arr, offset = 0) {
844
844
  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]];
845
845
  }
846
846
 
847
- // ../../node_modules/uuid/dist/esm-node/v4.js
847
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
848
848
  init_react_import();
849
849
 
850
- // ../../node_modules/uuid/dist/esm-node/native.js
850
+ // ../core/node_modules/uuid/dist/esm-node/native.js
851
851
  init_react_import();
852
852
  var import_crypto2 = __toESM(require("crypto"));
853
853
  var native_default = {
854
854
  randomUUID: import_crypto2.default.randomUUID
855
855
  };
856
856
 
857
- // ../../node_modules/uuid/dist/esm-node/v4.js
857
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
858
858
  function v4(options, buf, offset) {
859
859
  if (native_default.randomUUID && !buf && !options) {
860
860
  return native_default.randomUUID();
@@ -1006,7 +1006,9 @@ var replaceAction = (state, action, appStore) => {
1006
1006
  });
1007
1007
  });
1008
1008
  });
1009
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1009
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1010
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1011
+ });
1010
1012
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1011
1013
  const id = zoneCompound.split(":")[0];
1012
1014
  if (id === originalId) {
@@ -1434,7 +1436,7 @@ var createStoreImpl = (createState) => {
1434
1436
  const initialState = state = createState(setState, getState, api);
1435
1437
  return api;
1436
1438
  };
1437
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1439
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1438
1440
 
1439
1441
  // ../../node_modules/zustand/esm/react.mjs
1440
1442
  init_react_import();
@@ -1443,8 +1445,8 @@ var identity = (arg) => arg;
1443
1445
  function useStore(api, selector = identity) {
1444
1446
  const slice = import_react4.default.useSyncExternalStore(
1445
1447
  api.subscribe,
1446
- () => selector(api.getState()),
1447
- () => selector(api.getInitialState())
1448
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1449
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1448
1450
  );
1449
1451
  import_react4.default.useDebugValue(slice);
1450
1452
  return slice;
@@ -1455,13 +1457,13 @@ var createImpl = (createState) => {
1455
1457
  Object.assign(useBoundStore, api);
1456
1458
  return useBoundStore;
1457
1459
  };
1458
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1460
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1459
1461
 
1460
1462
  // ../../node_modules/zustand/esm/middleware.mjs
1461
1463
  init_react_import();
1462
1464
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1463
1465
  const origSubscribe = api.subscribe;
1464
- api.subscribe = (selector, optListener, options) => {
1466
+ api.subscribe = ((selector, optListener, options) => {
1465
1467
  let listener = selector;
1466
1468
  if (optListener) {
1467
1469
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1478,7 +1480,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1478
1480
  }
1479
1481
  }
1480
1482
  return origSubscribe(listener);
1481
- };
1483
+ });
1482
1484
  const initialState = fn(set, get, api);
1483
1485
  return initialState;
1484
1486
  };
@@ -1518,9 +1520,9 @@ function debounce(func, timeout = 300) {
1518
1520
  var tidyState = (state) => {
1519
1521
  return __spreadProps(__spreadValues({}, state), {
1520
1522
  ui: __spreadProps(__spreadValues({}, state.ui), {
1521
- field: {
1523
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1522
1524
  focus: null
1523
- }
1525
+ })
1524
1526
  })
1525
1527
  });
1526
1528
  };
@@ -1695,9 +1697,9 @@ function createIsCircular(areItemsEqual) {
1695
1697
  function getStrictProperties(object) {
1696
1698
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1697
1699
  }
1698
- var hasOwn = Object.hasOwn || function(object, property) {
1700
+ var hasOwn = Object.hasOwn || (function(object, property) {
1699
1701
  return hasOwnProperty.call(object, property);
1700
- };
1702
+ });
1701
1703
  function sameValueZeroEqual(a, b) {
1702
1704
  return a === b || !a && !b && a !== a && b !== b;
1703
1705
  }
@@ -2087,29 +2089,37 @@ var getChanged = (newItem, oldItem) => {
2087
2089
 
2088
2090
  // ../core/store/slices/permissions.ts
2089
2091
  var createPermissionsSlice = (set, get) => {
2090
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2092
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2091
2093
  const { state, permissions, config } = get();
2092
2094
  const { cache: cache2, globalPermissions } = permissions;
2093
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2094
- var _a, _b, _c;
2095
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2096
+ var _a, _b;
2095
2097
  const { config: config2, state: appState, setComponentLoading } = get();
2098
+ const itemCache = cache2[item2.props.id];
2099
+ const nodes = appState.indexes.nodes;
2100
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2101
+ const parentNode = parentId ? nodes[parentId] : null;
2102
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
2096
2103
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2097
2104
  if (!componentConfig) {
2098
2105
  return;
2099
2106
  }
2100
2107
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2101
2108
  if (componentConfig.resolvePermissions) {
2102
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2103
- if (Object.values(changed).some((el) => el === true) || force2) {
2109
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2110
+ const propsChanged = Object.values(changed).some((el) => el === true);
2111
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2112
+ if (propsChanged || parentChanged || force2) {
2104
2113
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2105
2114
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2106
2115
  item2,
2107
2116
  {
2108
2117
  changed,
2109
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2118
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2110
2119
  permissions: initialPermissions,
2111
2120
  appState: makeStatePublic(appState),
2112
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2121
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2122
+ parent: parentData
2113
2123
  }
2114
2124
  );
2115
2125
  const latest = get().permissions;
@@ -2117,6 +2127,7 @@ var createPermissionsSlice = (set, get) => {
2117
2127
  permissions: __spreadProps(__spreadValues({}, latest), {
2118
2128
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2119
2129
  [item2.props.id]: {
2130
+ lastParentId: parentId,
2120
2131
  lastData: item2,
2121
2132
  lastPermissions: resolvedPermissions
2122
2133
  }
@@ -2130,9 +2141,9 @@ var createPermissionsSlice = (set, get) => {
2130
2141
  }
2131
2142
  }
2132
2143
  });
2133
- const resolveDataForRoot = (force2 = false) => {
2144
+ const resolvePermissionsForRoot = (force2 = false) => {
2134
2145
  const { state: appState } = get();
2135
- resolveDataForItem(
2146
+ resolvePermissionsForItem(
2136
2147
  // Shim the root data in by conforming to component data shape
2137
2148
  {
2138
2149
  type: "root",
@@ -2143,16 +2154,16 @@ var createPermissionsSlice = (set, get) => {
2143
2154
  };
2144
2155
  const { item, type, root } = params;
2145
2156
  if (item) {
2146
- yield resolveDataForItem(item, force);
2157
+ yield resolvePermissionsForItem(item, force);
2147
2158
  } else if (type) {
2148
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2149
- yield resolveDataForItem(item2, force);
2159
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2160
+ yield resolvePermissionsForItem(item2, force);
2150
2161
  }));
2151
2162
  } else if (root) {
2152
- resolveDataForRoot(force);
2163
+ resolvePermissionsForRoot(force);
2153
2164
  } else {
2154
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2155
- yield resolveDataForItem(item2, force);
2165
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2166
+ yield resolvePermissionsForItem(item2, force);
2156
2167
  }));
2157
2168
  }
2158
2169
  });
@@ -2206,7 +2217,7 @@ var createFieldsSlice = (_set, _get) => {
2206
2217
  // ../core/lib/resolve-component-data.ts
2207
2218
  init_react_import();
2208
2219
  var cache = { lastChange: {} };
2209
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2220
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2210
2221
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2211
2222
  const resolvedItem = __spreadValues({}, item);
2212
2223
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2234,11 +2245,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2234
2245
  let itemWithResolvedChildren = yield mapFields(
2235
2246
  resolvedItem,
2236
2247
  {
2237
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2248
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2238
2249
  const content = value;
2239
2250
  return yield Promise.all(
2240
2251
  content.map(
2241
- (childItem) => __async(void 0, null, function* () {
2252
+ (childItem) => __async(null, null, function* () {
2242
2253
  return (yield resolveComponentData(
2243
2254
  childItem,
2244
2255
  config,
@@ -2340,6 +2351,11 @@ var createAppStore = (initialAppStore) => create()(
2340
2351
  history: createHistorySlice(set, get),
2341
2352
  nodes: createNodesSlice(set, get),
2342
2353
  permissions: createPermissionsSlice(set, get),
2354
+ getCurrentData: () => {
2355
+ var _a2;
2356
+ const s = get();
2357
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
2358
+ },
2343
2359
  getComponentConfig: (type) => {
2344
2360
  var _a2;
2345
2361
  const { config, selectedItem } = get();
@@ -2428,7 +2444,7 @@ var createAppStore = (initialAppStore) => create()(
2428
2444
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2429
2445
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2430
2446
  }),
2431
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2447
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2432
2448
  const { config, metadata, setComponentLoading, permissions } = get();
2433
2449
  const timeouts = {};
2434
2450
  return yield resolveComponentData(
@@ -2439,7 +2455,7 @@ var createAppStore = (initialAppStore) => create()(
2439
2455
  const id = "id" in item.props ? item.props.id : "root";
2440
2456
  timeouts[id] = setComponentLoading(id, true, 50);
2441
2457
  },
2442
- (item) => __async(void 0, null, function* () {
2458
+ (item) => __async(null, null, function* () {
2443
2459
  const id = "id" in item.props ? item.props.id : "root";
2444
2460
  if ("type" in item) {
2445
2461
  yield permissions.refreshPermissions({ item });
@@ -2451,7 +2467,7 @@ var createAppStore = (initialAppStore) => create()(
2451
2467
  trigger
2452
2468
  );
2453
2469
  }),
2454
- resolveAndCommitData: () => __async(void 0, null, function* () {
2470
+ resolveAndCommitData: () => __async(null, null, function* () {
2455
2471
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2456
2472
  walkAppState(
2457
2473
  state,
@@ -2875,45 +2891,10 @@ classnames/index.js:
2875
2891
  *)
2876
2892
 
2877
2893
  lucide-react/dist/esm/shared/src/utils.js:
2878
- (**
2879
- * @license lucide-react v0.468.0 - ISC
2880
- *
2881
- * This source code is licensed under the ISC license.
2882
- * See the LICENSE file in the root directory of this source tree.
2883
- *)
2884
-
2885
2894
  lucide-react/dist/esm/defaultAttributes.js:
2886
- (**
2887
- * @license lucide-react v0.468.0 - ISC
2888
- *
2889
- * This source code is licensed under the ISC license.
2890
- * See the LICENSE file in the root directory of this source tree.
2891
- *)
2892
-
2893
2895
  lucide-react/dist/esm/Icon.js:
2894
- (**
2895
- * @license lucide-react v0.468.0 - ISC
2896
- *
2897
- * This source code is licensed under the ISC license.
2898
- * See the LICENSE file in the root directory of this source tree.
2899
- *)
2900
-
2901
2896
  lucide-react/dist/esm/createLucideIcon.js:
2902
- (**
2903
- * @license lucide-react v0.468.0 - ISC
2904
- *
2905
- * This source code is licensed under the ISC license.
2906
- * See the LICENSE file in the root directory of this source tree.
2907
- *)
2908
-
2909
2897
  lucide-react/dist/esm/icons/chevron-right.js:
2910
- (**
2911
- * @license lucide-react v0.468.0 - ISC
2912
- *
2913
- * This source code is licensed under the ISC license.
2914
- * See the LICENSE file in the root directory of this source tree.
2915
- *)
2916
-
2917
2898
  lucide-react/dist/esm/lucide-react.js:
2918
2899
  (**
2919
2900
  * @license lucide-react v0.468.0 - ISC
package/dist/index.mjs CHANGED
@@ -806,10 +806,10 @@ var insert = (list, index, item) => {
806
806
  // ../core/lib/generate-id.ts
807
807
  init_react_import();
808
808
 
809
- // ../../node_modules/uuid/dist/esm-node/index.js
809
+ // ../core/node_modules/uuid/dist/esm-node/index.js
810
810
  init_react_import();
811
811
 
812
- // ../../node_modules/uuid/dist/esm-node/rng.js
812
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
813
813
  init_react_import();
814
814
  import crypto from "crypto";
815
815
  var rnds8Pool = new Uint8Array(256);
@@ -822,7 +822,7 @@ function rng() {
822
822
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
823
823
  }
824
824
 
825
- // ../../node_modules/uuid/dist/esm-node/stringify.js
825
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
826
826
  init_react_import();
827
827
  var byteToHex = [];
828
828
  for (let i = 0; i < 256; ++i) {
@@ -832,17 +832,17 @@ function unsafeStringify(arr, offset = 0) {
832
832
  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]];
833
833
  }
834
834
 
835
- // ../../node_modules/uuid/dist/esm-node/v4.js
835
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
836
836
  init_react_import();
837
837
 
838
- // ../../node_modules/uuid/dist/esm-node/native.js
838
+ // ../core/node_modules/uuid/dist/esm-node/native.js
839
839
  init_react_import();
840
840
  import crypto2 from "crypto";
841
841
  var native_default = {
842
842
  randomUUID: crypto2.randomUUID
843
843
  };
844
844
 
845
- // ../../node_modules/uuid/dist/esm-node/v4.js
845
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
846
846
  function v4(options, buf, offset) {
847
847
  if (native_default.randomUUID && !buf && !options) {
848
848
  return native_default.randomUUID();
@@ -994,7 +994,9 @@ var replaceAction = (state, action, appStore) => {
994
994
  });
995
995
  });
996
996
  });
997
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
997
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
998
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
999
+ });
998
1000
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
999
1001
  const id = zoneCompound.split(":")[0];
1000
1002
  if (id === originalId) {
@@ -1422,7 +1424,7 @@ var createStoreImpl = (createState) => {
1422
1424
  const initialState = state = createState(setState, getState, api);
1423
1425
  return api;
1424
1426
  };
1425
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1427
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1426
1428
 
1427
1429
  // ../../node_modules/zustand/esm/react.mjs
1428
1430
  init_react_import();
@@ -1431,8 +1433,8 @@ var identity = (arg) => arg;
1431
1433
  function useStore(api, selector = identity) {
1432
1434
  const slice = React2.useSyncExternalStore(
1433
1435
  api.subscribe,
1434
- () => selector(api.getState()),
1435
- () => selector(api.getInitialState())
1436
+ React2.useCallback(() => selector(api.getState()), [api, selector]),
1437
+ React2.useCallback(() => selector(api.getInitialState()), [api, selector])
1436
1438
  );
1437
1439
  React2.useDebugValue(slice);
1438
1440
  return slice;
@@ -1443,13 +1445,13 @@ var createImpl = (createState) => {
1443
1445
  Object.assign(useBoundStore, api);
1444
1446
  return useBoundStore;
1445
1447
  };
1446
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1448
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1447
1449
 
1448
1450
  // ../../node_modules/zustand/esm/middleware.mjs
1449
1451
  init_react_import();
1450
1452
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1451
1453
  const origSubscribe = api.subscribe;
1452
- api.subscribe = (selector, optListener, options) => {
1454
+ api.subscribe = ((selector, optListener, options) => {
1453
1455
  let listener = selector;
1454
1456
  if (optListener) {
1455
1457
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1466,7 +1468,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1466
1468
  }
1467
1469
  }
1468
1470
  return origSubscribe(listener);
1469
- };
1471
+ });
1470
1472
  const initialState = fn(set, get, api);
1471
1473
  return initialState;
1472
1474
  };
@@ -1506,9 +1508,9 @@ function debounce(func, timeout = 300) {
1506
1508
  var tidyState = (state) => {
1507
1509
  return __spreadProps(__spreadValues({}, state), {
1508
1510
  ui: __spreadProps(__spreadValues({}, state.ui), {
1509
- field: {
1511
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1510
1512
  focus: null
1511
- }
1513
+ })
1512
1514
  })
1513
1515
  });
1514
1516
  };
@@ -1683,9 +1685,9 @@ function createIsCircular(areItemsEqual) {
1683
1685
  function getStrictProperties(object) {
1684
1686
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1685
1687
  }
1686
- var hasOwn = Object.hasOwn || function(object, property) {
1688
+ var hasOwn = Object.hasOwn || (function(object, property) {
1687
1689
  return hasOwnProperty.call(object, property);
1688
- };
1690
+ });
1689
1691
  function sameValueZeroEqual(a, b) {
1690
1692
  return a === b || !a && !b && a !== a && b !== b;
1691
1693
  }
@@ -2075,29 +2077,37 @@ var getChanged = (newItem, oldItem) => {
2075
2077
 
2076
2078
  // ../core/store/slices/permissions.ts
2077
2079
  var createPermissionsSlice = (set, get) => {
2078
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2080
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2079
2081
  const { state, permissions, config } = get();
2080
2082
  const { cache: cache2, globalPermissions } = permissions;
2081
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2082
- var _a, _b, _c;
2083
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2084
+ var _a, _b;
2083
2085
  const { config: config2, state: appState, setComponentLoading } = get();
2086
+ const itemCache = cache2[item2.props.id];
2087
+ const nodes = appState.indexes.nodes;
2088
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2089
+ const parentNode = parentId ? nodes[parentId] : null;
2090
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
2084
2091
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2085
2092
  if (!componentConfig) {
2086
2093
  return;
2087
2094
  }
2088
2095
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2089
2096
  if (componentConfig.resolvePermissions) {
2090
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2091
- if (Object.values(changed).some((el) => el === true) || force2) {
2097
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2098
+ const propsChanged = Object.values(changed).some((el) => el === true);
2099
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2100
+ if (propsChanged || parentChanged || force2) {
2092
2101
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2093
2102
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2094
2103
  item2,
2095
2104
  {
2096
2105
  changed,
2097
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2106
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2098
2107
  permissions: initialPermissions,
2099
2108
  appState: makeStatePublic(appState),
2100
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2109
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2110
+ parent: parentData
2101
2111
  }
2102
2112
  );
2103
2113
  const latest = get().permissions;
@@ -2105,6 +2115,7 @@ var createPermissionsSlice = (set, get) => {
2105
2115
  permissions: __spreadProps(__spreadValues({}, latest), {
2106
2116
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2107
2117
  [item2.props.id]: {
2118
+ lastParentId: parentId,
2108
2119
  lastData: item2,
2109
2120
  lastPermissions: resolvedPermissions
2110
2121
  }
@@ -2118,9 +2129,9 @@ var createPermissionsSlice = (set, get) => {
2118
2129
  }
2119
2130
  }
2120
2131
  });
2121
- const resolveDataForRoot = (force2 = false) => {
2132
+ const resolvePermissionsForRoot = (force2 = false) => {
2122
2133
  const { state: appState } = get();
2123
- resolveDataForItem(
2134
+ resolvePermissionsForItem(
2124
2135
  // Shim the root data in by conforming to component data shape
2125
2136
  {
2126
2137
  type: "root",
@@ -2131,16 +2142,16 @@ var createPermissionsSlice = (set, get) => {
2131
2142
  };
2132
2143
  const { item, type, root } = params;
2133
2144
  if (item) {
2134
- yield resolveDataForItem(item, force);
2145
+ yield resolvePermissionsForItem(item, force);
2135
2146
  } else if (type) {
2136
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2137
- yield resolveDataForItem(item2, force);
2147
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2148
+ yield resolvePermissionsForItem(item2, force);
2138
2149
  }));
2139
2150
  } else if (root) {
2140
- resolveDataForRoot(force);
2151
+ resolvePermissionsForRoot(force);
2141
2152
  } else {
2142
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2143
- yield resolveDataForItem(item2, force);
2153
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2154
+ yield resolvePermissionsForItem(item2, force);
2144
2155
  }));
2145
2156
  }
2146
2157
  });
@@ -2194,7 +2205,7 @@ var createFieldsSlice = (_set, _get) => {
2194
2205
  // ../core/lib/resolve-component-data.ts
2195
2206
  init_react_import();
2196
2207
  var cache = { lastChange: {} };
2197
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2208
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2198
2209
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2199
2210
  const resolvedItem = __spreadValues({}, item);
2200
2211
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2222,11 +2233,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2222
2233
  let itemWithResolvedChildren = yield mapFields(
2223
2234
  resolvedItem,
2224
2235
  {
2225
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2236
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2226
2237
  const content = value;
2227
2238
  return yield Promise.all(
2228
2239
  content.map(
2229
- (childItem) => __async(void 0, null, function* () {
2240
+ (childItem) => __async(null, null, function* () {
2230
2241
  return (yield resolveComponentData(
2231
2242
  childItem,
2232
2243
  config,
@@ -2328,6 +2339,11 @@ var createAppStore = (initialAppStore) => create()(
2328
2339
  history: createHistorySlice(set, get),
2329
2340
  nodes: createNodesSlice(set, get),
2330
2341
  permissions: createPermissionsSlice(set, get),
2342
+ getCurrentData: () => {
2343
+ var _a2;
2344
+ const s = get();
2345
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
2346
+ },
2331
2347
  getComponentConfig: (type) => {
2332
2348
  var _a2;
2333
2349
  const { config, selectedItem } = get();
@@ -2416,7 +2432,7 @@ var createAppStore = (initialAppStore) => create()(
2416
2432
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2417
2433
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2418
2434
  }),
2419
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2435
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2420
2436
  const { config, metadata, setComponentLoading, permissions } = get();
2421
2437
  const timeouts = {};
2422
2438
  return yield resolveComponentData(
@@ -2427,7 +2443,7 @@ var createAppStore = (initialAppStore) => create()(
2427
2443
  const id = "id" in item.props ? item.props.id : "root";
2428
2444
  timeouts[id] = setComponentLoading(id, true, 50);
2429
2445
  },
2430
- (item) => __async(void 0, null, function* () {
2446
+ (item) => __async(null, null, function* () {
2431
2447
  const id = "id" in item.props ? item.props.id : "root";
2432
2448
  if ("type" in item) {
2433
2449
  yield permissions.refreshPermissions({ item });
@@ -2439,7 +2455,7 @@ var createAppStore = (initialAppStore) => create()(
2439
2455
  trigger
2440
2456
  );
2441
2457
  }),
2442
- resolveAndCommitData: () => __async(void 0, null, function* () {
2458
+ resolveAndCommitData: () => __async(null, null, function* () {
2443
2459
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2444
2460
  walkAppState(
2445
2461
  state,
@@ -2866,45 +2882,10 @@ classnames/index.js:
2866
2882
  *)
2867
2883
 
2868
2884
  lucide-react/dist/esm/shared/src/utils.js:
2869
- (**
2870
- * @license lucide-react v0.468.0 - ISC
2871
- *
2872
- * This source code is licensed under the ISC license.
2873
- * See the LICENSE file in the root directory of this source tree.
2874
- *)
2875
-
2876
2885
  lucide-react/dist/esm/defaultAttributes.js:
2877
- (**
2878
- * @license lucide-react v0.468.0 - ISC
2879
- *
2880
- * This source code is licensed under the ISC license.
2881
- * See the LICENSE file in the root directory of this source tree.
2882
- *)
2883
-
2884
2886
  lucide-react/dist/esm/Icon.js:
2885
- (**
2886
- * @license lucide-react v0.468.0 - ISC
2887
- *
2888
- * This source code is licensed under the ISC license.
2889
- * See the LICENSE file in the root directory of this source tree.
2890
- *)
2891
-
2892
2887
  lucide-react/dist/esm/createLucideIcon.js:
2893
- (**
2894
- * @license lucide-react v0.468.0 - ISC
2895
- *
2896
- * This source code is licensed under the ISC license.
2897
- * See the LICENSE file in the root directory of this source tree.
2898
- *)
2899
-
2900
2888
  lucide-react/dist/esm/icons/chevron-right.js:
2901
- (**
2902
- * @license lucide-react v0.468.0 - ISC
2903
- *
2904
- * This source code is licensed under the ISC license.
2905
- * See the LICENSE file in the root directory of this source tree.
2906
- *)
2907
-
2908
2889
  lucide-react/dist/esm/lucide-react.js:
2909
2890
  (**
2910
2891
  * @license lucide-react v0.468.0 - ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.21.0-canary.f5820ce9",
3
+ "version": "0.21.0-canary.fee2ba98",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -25,7 +25,8 @@
25
25
  "dist"
26
26
  ],
27
27
  "devDependencies": {
28
- "@measured/puck": "^0.21.0-canary.f5820ce9",
28
+ "@measured/puck": "^0.21.0-canary.fee2ba98",
29
+ "@types/minimatch": "3.0.5",
29
30
  "@types/react": "^19.0.1",
30
31
  "@types/react-dom": "^19.0.2",
31
32
  "eslint": "^7.32.0",