@measured/puck-plugin-heading-analyzer 0.21.0-canary.a5160e5d → 0.21.0-canary.a7a65997

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,30 +268,30 @@ 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
279
279
  init_react_import();
280
- var import_react11 = require("react");
280
+ var import_react10 = require("react");
281
281
 
282
282
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
283
283
  init_react_import();
284
- var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
284
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
285
285
 
286
286
  // src/HeadingAnalyzer.tsx
287
287
  var import_puck = require("@measured/puck");
288
288
 
289
- // ../core/components/SidebarSection/index.tsx
289
+ // ../core/components/OutlineList/index.tsx
290
290
  init_react_import();
291
291
 
292
- // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
292
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
293
293
  init_react_import();
294
- var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
294
+ var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
295
295
 
296
296
  // ../core/lib/get-class-name-factory.ts
297
297
  init_react_import();
@@ -320,29 +320,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
320
320
  };
321
321
  var get_class_name_factory_default = getClassNameFactory;
322
322
 
323
- // ../core/components/Heading/index.tsx
324
- init_react_import();
325
-
326
- // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
327
- init_react_import();
328
- var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
329
-
330
- // ../core/components/Heading/index.tsx
323
+ // ../core/components/OutlineList/index.tsx
331
324
  var import_jsx_runtime = require("react/jsx-runtime");
332
- var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
333
- var Heading = ({ children, rank, size = "m" }) => {
334
- const Tag = rank ? `h${rank}` : "span";
325
+ var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
326
+ var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
327
+ var OutlineList = ({ children }) => {
328
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
329
+ };
330
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
331
+ OutlineList.Item = ({
332
+ children,
333
+ onClick
334
+ }) => {
335
335
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
336
- Tag,
336
+ "li",
337
337
  {
338
- className: getClassName({
339
- [size]: true
340
- }),
338
+ className: getClassNameItem({ clickable: !!onClick }),
339
+ onClick,
341
340
  children
342
341
  }
343
342
  );
344
343
  };
345
344
 
345
+ // ../core/lib/scroll-into-view.ts
346
+ init_react_import();
347
+ var scrollIntoView = (el) => {
348
+ const oldStyle = __spreadValues({}, el.style);
349
+ el.style.scrollMargin = "256px";
350
+ if (el) {
351
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
352
+ el.style.scrollMargin = oldStyle.scrollMargin || "";
353
+ }
354
+ };
355
+
356
+ // ../core/lib/get-frame.ts
357
+ init_react_import();
358
+ var getFrame = () => {
359
+ if (typeof window === "undefined") return;
360
+ let frameEl = document.querySelector("#preview-frame");
361
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
362
+ return frameEl.contentDocument || document;
363
+ }
364
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
365
+ };
366
+
346
367
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
347
368
  init_react_import();
348
369
 
@@ -430,15 +451,29 @@ var createLucideIcon = (iconName, iconNode) => {
430
451
  return Component;
431
452
  };
432
453
 
433
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
454
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
434
455
  init_react_import();
435
- var ChevronRight = createLucideIcon("ChevronRight", [
436
- ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
456
+ var Heading1 = createLucideIcon("Heading1", [
457
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
458
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
459
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
460
+ ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
437
461
  ]);
438
462
 
439
- // ../core/lib/use-breadcrumbs.ts
463
+ // ../core/lib/index.ts
464
+ init_react_import();
465
+
466
+ // ../core/lib/filter.ts
467
+ init_react_import();
468
+
469
+ // ../core/lib/data/reorder.ts
470
+ init_react_import();
471
+
472
+ // ../core/lib/data/replace.ts
473
+ init_react_import();
474
+
475
+ // ../core/lib/use-reset-auto-zoom.ts
440
476
  init_react_import();
441
- var import_react10 = require("react");
442
477
 
443
478
  // ../core/store/index.ts
444
479
  init_react_import();
@@ -621,12 +656,12 @@ var walkObject = ({
621
656
  }
622
657
  return flatten(newProps);
623
658
  };
624
- function mapFields(item, mappers, config, recurseSlots = false) {
659
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
625
660
  var _a, _b, _c, _d, _e;
626
661
  const itemType = "type" in item ? item.type : "root";
627
662
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
628
663
  const newProps = walkObject({
629
- value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
664
+ value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
630
665
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
631
666
  mappers,
632
667
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
@@ -656,9 +691,28 @@ var stripSlots = (data, config) => {
656
691
 
657
692
  // ../core/lib/data/flatten-node.ts
658
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
+ }
659
713
  var flattenNode = (node, config) => {
660
714
  return __spreadProps(__spreadValues({}, node), {
661
- props: flatten2(stripSlots(node, config).props)
715
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
662
716
  });
663
717
  };
664
718
 
@@ -818,10 +872,10 @@ var insert = (list, index, item) => {
818
872
  // ../core/lib/generate-id.ts
819
873
  init_react_import();
820
874
 
821
- // ../../node_modules/uuid/dist/esm-node/index.js
875
+ // ../core/node_modules/uuid/dist/esm-node/index.js
822
876
  init_react_import();
823
877
 
824
- // ../../node_modules/uuid/dist/esm-node/rng.js
878
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
825
879
  init_react_import();
826
880
  var import_crypto = __toESM(require("crypto"));
827
881
  var rnds8Pool = new Uint8Array(256);
@@ -834,7 +888,7 @@ function rng() {
834
888
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
835
889
  }
836
890
 
837
- // ../../node_modules/uuid/dist/esm-node/stringify.js
891
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
838
892
  init_react_import();
839
893
  var byteToHex = [];
840
894
  for (let i = 0; i < 256; ++i) {
@@ -844,17 +898,17 @@ function unsafeStringify(arr, offset = 0) {
844
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]];
845
899
  }
846
900
 
847
- // ../../node_modules/uuid/dist/esm-node/v4.js
901
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
848
902
  init_react_import();
849
903
 
850
- // ../../node_modules/uuid/dist/esm-node/native.js
904
+ // ../core/node_modules/uuid/dist/esm-node/native.js
851
905
  init_react_import();
852
906
  var import_crypto2 = __toESM(require("crypto"));
853
907
  var native_default = {
854
908
  randomUUID: import_crypto2.default.randomUUID
855
909
  };
856
910
 
857
- // ../../node_modules/uuid/dist/esm-node/v4.js
911
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
858
912
  function v4(options, buf, offset) {
859
913
  if (native_default.randomUUID && !buf && !options) {
860
914
  return native_default.randomUUID();
@@ -1006,7 +1060,9 @@ var replaceAction = (state, action, appStore) => {
1006
1060
  });
1007
1061
  });
1008
1062
  });
1009
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
1063
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
1064
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1065
+ });
1010
1066
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1011
1067
  const id = zoneCompound.split(":")[0];
1012
1068
  if (id === originalId) {
@@ -1408,7 +1464,8 @@ init_react_import();
1408
1464
  var defaultViewports = [
1409
1465
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1410
1466
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1411
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1467
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1468
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1412
1469
  ];
1413
1470
 
1414
1471
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1434,7 +1491,7 @@ var createStoreImpl = (createState) => {
1434
1491
  const initialState = state = createState(setState, getState, api);
1435
1492
  return api;
1436
1493
  };
1437
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1494
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1438
1495
 
1439
1496
  // ../../node_modules/zustand/esm/react.mjs
1440
1497
  init_react_import();
@@ -1443,8 +1500,8 @@ var identity = (arg) => arg;
1443
1500
  function useStore(api, selector = identity) {
1444
1501
  const slice = import_react4.default.useSyncExternalStore(
1445
1502
  api.subscribe,
1446
- () => selector(api.getState()),
1447
- () => selector(api.getInitialState())
1503
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1504
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1448
1505
  );
1449
1506
  import_react4.default.useDebugValue(slice);
1450
1507
  return slice;
@@ -1455,13 +1512,13 @@ var createImpl = (createState) => {
1455
1512
  Object.assign(useBoundStore, api);
1456
1513
  return useBoundStore;
1457
1514
  };
1458
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1515
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1459
1516
 
1460
1517
  // ../../node_modules/zustand/esm/middleware.mjs
1461
1518
  init_react_import();
1462
1519
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1463
1520
  const origSubscribe = api.subscribe;
1464
- api.subscribe = (selector, optListener, options) => {
1521
+ api.subscribe = ((selector, optListener, options) => {
1465
1522
  let listener = selector;
1466
1523
  if (optListener) {
1467
1524
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1478,7 +1535,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1478
1535
  }
1479
1536
  }
1480
1537
  return origSubscribe(listener);
1481
- };
1538
+ });
1482
1539
  const initialState = fn(set, get, api);
1483
1540
  return initialState;
1484
1541
  };
@@ -1518,9 +1575,9 @@ function debounce(func, timeout = 300) {
1518
1575
  var tidyState = (state) => {
1519
1576
  return __spreadProps(__spreadValues({}, state), {
1520
1577
  ui: __spreadProps(__spreadValues({}, state.ui), {
1521
- field: {
1578
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1522
1579
  focus: null
1523
- }
1580
+ })
1524
1581
  })
1525
1582
  });
1526
1583
  };
@@ -1695,9 +1752,9 @@ function createIsCircular(areItemsEqual) {
1695
1752
  function getStrictProperties(object) {
1696
1753
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1697
1754
  }
1698
- var hasOwn = Object.hasOwn || function(object, property) {
1755
+ var hasOwn = Object.hasOwn || (function(object, property) {
1699
1756
  return hasOwnProperty.call(object, property);
1700
- };
1757
+ });
1701
1758
  function sameValueZeroEqual(a, b) {
1702
1759
  return a === b || !a && !b && a !== a && b !== b;
1703
1760
  }
@@ -2087,29 +2144,37 @@ var getChanged = (newItem, oldItem) => {
2087
2144
 
2088
2145
  // ../core/store/slices/permissions.ts
2089
2146
  var createPermissionsSlice = (set, get) => {
2090
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2147
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2091
2148
  const { state, permissions, config } = get();
2092
2149
  const { cache: cache2, globalPermissions } = permissions;
2093
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2094
- var _a, _b, _c;
2150
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2151
+ var _a, _b;
2095
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;
2096
2158
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2097
2159
  if (!componentConfig) {
2098
2160
  return;
2099
2161
  }
2100
2162
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2101
2163
  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) {
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) {
2104
2168
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2105
2169
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2106
2170
  item2,
2107
2171
  {
2108
2172
  changed,
2109
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2173
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2110
2174
  permissions: initialPermissions,
2111
2175
  appState: makeStatePublic(appState),
2112
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2176
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2177
+ parent: parentData
2113
2178
  }
2114
2179
  );
2115
2180
  const latest = get().permissions;
@@ -2117,6 +2182,7 @@ var createPermissionsSlice = (set, get) => {
2117
2182
  permissions: __spreadProps(__spreadValues({}, latest), {
2118
2183
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2119
2184
  [item2.props.id]: {
2185
+ lastParentId: parentId,
2120
2186
  lastData: item2,
2121
2187
  lastPermissions: resolvedPermissions
2122
2188
  }
@@ -2130,9 +2196,9 @@ var createPermissionsSlice = (set, get) => {
2130
2196
  }
2131
2197
  }
2132
2198
  });
2133
- const resolveDataForRoot = (force2 = false) => {
2199
+ const resolvePermissionsForRoot = (force2 = false) => {
2134
2200
  const { state: appState } = get();
2135
- resolveDataForItem(
2201
+ resolvePermissionsForItem(
2136
2202
  // Shim the root data in by conforming to component data shape
2137
2203
  {
2138
2204
  type: "root",
@@ -2143,16 +2209,16 @@ var createPermissionsSlice = (set, get) => {
2143
2209
  };
2144
2210
  const { item, type, root } = params;
2145
2211
  if (item) {
2146
- yield resolveDataForItem(item, force);
2212
+ yield resolvePermissionsForItem(item, force);
2147
2213
  } else if (type) {
2148
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2149
- yield resolveDataForItem(item2, force);
2214
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2215
+ yield resolvePermissionsForItem(item2, force);
2150
2216
  }));
2151
2217
  } else if (root) {
2152
- resolveDataForRoot(force);
2218
+ resolvePermissionsForRoot(force);
2153
2219
  } else {
2154
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2155
- yield resolveDataForItem(item2, force);
2220
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2221
+ yield resolvePermissionsForItem(item2, force);
2156
2222
  }));
2157
2223
  }
2158
2224
  });
@@ -2206,7 +2272,7 @@ var createFieldsSlice = (_set, _get) => {
2206
2272
  // ../core/lib/resolve-component-data.ts
2207
2273
  init_react_import();
2208
2274
  var cache = { lastChange: {} };
2209
- 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") {
2210
2276
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2211
2277
  const resolvedItem = __spreadValues({}, item);
2212
2278
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2234,11 +2300,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2234
2300
  let itemWithResolvedChildren = yield mapFields(
2235
2301
  resolvedItem,
2236
2302
  {
2237
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2303
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2238
2304
  const content = value;
2239
2305
  return yield Promise.all(
2240
2306
  content.map(
2241
- (childItem) => __async(void 0, null, function* () {
2307
+ (childItem) => __async(null, null, function* () {
2242
2308
  return (yield resolveComponentData(
2243
2309
  childItem,
2244
2310
  config,
@@ -2304,7 +2370,8 @@ var defaultAppState = {
2304
2370
  options: [],
2305
2371
  controlsVisible: true
2306
2372
  },
2307
- field: { focus: null }
2373
+ field: { focus: null },
2374
+ plugin: { current: null }
2308
2375
  },
2309
2376
  indexes: {
2310
2377
  nodes: {},
@@ -2320,6 +2387,7 @@ var createAppStore = (initialAppStore) => create()(
2320
2387
  subscribeWithSelector((set, get) => {
2321
2388
  var _a, _b;
2322
2389
  return __spreadProps(__spreadValues({
2390
+ instanceId: generateId(),
2323
2391
  state: defaultAppState,
2324
2392
  config: { components: {} },
2325
2393
  componentState: {},
@@ -2340,6 +2408,11 @@ var createAppStore = (initialAppStore) => create()(
2340
2408
  history: createHistorySlice(set, get),
2341
2409
  nodes: createNodesSlice(set, get),
2342
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
+ },
2343
2416
  getComponentConfig: (type) => {
2344
2417
  var _a2;
2345
2418
  const { config, selectedItem } = get();
@@ -2428,7 +2501,7 @@ var createAppStore = (initialAppStore) => create()(
2428
2501
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2429
2502
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2430
2503
  }),
2431
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2504
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2432
2505
  const { config, metadata, setComponentLoading, permissions } = get();
2433
2506
  const timeouts = {};
2434
2507
  return yield resolveComponentData(
@@ -2439,7 +2512,7 @@ var createAppStore = (initialAppStore) => create()(
2439
2512
  const id = "id" in item.props ? item.props.id : "root";
2440
2513
  timeouts[id] = setComponentLoading(id, true, 50);
2441
2514
  },
2442
- (item) => __async(void 0, null, function* () {
2515
+ (item) => __async(null, null, function* () {
2443
2516
  const id = "id" in item.props ? item.props.id : "root";
2444
2517
  if ("type" in item) {
2445
2518
  yield permissions.refreshPermissions({ item });
@@ -2451,7 +2524,7 @@ var createAppStore = (initialAppStore) => create()(
2451
2524
  trigger
2452
2525
  );
2453
2526
  }),
2454
- resolveAndCommitData: () => __async(void 0, null, function* () {
2527
+ resolveAndCommitData: () => __async(null, null, function* () {
2455
2528
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2456
2529
  walkAppState(
2457
2530
  state,
@@ -2490,203 +2563,14 @@ var createAppStore = (initialAppStore) => create()(
2490
2563
  })
2491
2564
  );
2492
2565
  var appStoreContext = (0, import_react9.createContext)(createAppStore());
2493
- function useAppStore(selector) {
2494
- const context = (0, import_react9.useContext)(appStoreContext);
2495
- return useStore(context, selector);
2496
- }
2497
- function useAppStoreApi() {
2498
- return (0, import_react9.useContext)(appStoreContext);
2499
- }
2500
-
2501
- // ../core/lib/use-breadcrumbs.ts
2502
- var useBreadcrumbs = (renderCount) => {
2503
- const selectedId = useAppStore((s) => {
2504
- var _a;
2505
- return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2506
- });
2507
- const config = useAppStore((s) => s.config);
2508
- const path = useAppStore((s) => {
2509
- var _a;
2510
- return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2511
- });
2512
- const appStore = useAppStoreApi();
2513
- return (0, import_react10.useMemo)(() => {
2514
- const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2515
- var _a, _b, _c;
2516
- const [componentId] = zoneCompound.split(":");
2517
- if (componentId === "root") {
2518
- return {
2519
- label: "Page",
2520
- selector: null
2521
- };
2522
- }
2523
- const node = appStore.getState().state.indexes.nodes[componentId];
2524
- const parentId = node.path[node.path.length - 1];
2525
- const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2526
- const index = contentIds.indexOf(componentId);
2527
- const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2528
- return {
2529
- label,
2530
- selector: node ? {
2531
- index,
2532
- zone: node.path[node.path.length - 1]
2533
- } : null
2534
- };
2535
- })) || [];
2536
- if (renderCount) {
2537
- return breadcrumbs.slice(breadcrumbs.length - renderCount);
2538
- }
2539
- return breadcrumbs;
2540
- }, [path, renderCount]);
2541
- };
2542
-
2543
- // ../core/components/Loader/index.tsx
2544
- init_react_import();
2545
-
2546
- // ../core/lib/index.ts
2547
- init_react_import();
2548
-
2549
- // ../core/lib/filter.ts
2550
- init_react_import();
2551
-
2552
- // ../core/lib/data/reorder.ts
2553
- init_react_import();
2554
-
2555
- // ../core/lib/data/replace.ts
2556
- init_react_import();
2557
-
2558
- // ../core/lib/use-reset-auto-zoom.ts
2559
- init_react_import();
2560
2566
 
2561
2567
  // ../core/lib/get-zoom-config.ts
2562
2568
  init_react_import();
2563
2569
 
2564
- // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2565
- init_react_import();
2566
- var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2567
-
2568
- // ../core/components/Loader/index.tsx
2569
- var import_jsx_runtime2 = require("react/jsx-runtime");
2570
- var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2571
- var Loader = (_a) => {
2572
- var _b = _a, {
2573
- color,
2574
- size = 16
2575
- } = _b, props = __objRest(_b, [
2576
- "color",
2577
- "size"
2578
- ]);
2579
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2580
- "span",
2581
- __spreadValues({
2582
- className: getClassName2(),
2583
- style: {
2584
- width: size,
2585
- height: size,
2586
- color
2587
- },
2588
- "aria-label": "loading"
2589
- }, props)
2590
- );
2591
- };
2592
-
2593
- // ../core/components/SidebarSection/index.tsx
2594
- var import_jsx_runtime3 = require("react/jsx-runtime");
2595
- var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2596
- var SidebarSection = ({
2597
- children,
2598
- title,
2599
- background,
2600
- showBreadcrumbs,
2601
- noBorderTop,
2602
- noPadding,
2603
- isLoading
2604
- }) => {
2605
- const setUi = useAppStore((s) => s.setUi);
2606
- const breadcrumbs = useBreadcrumbs(1);
2607
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2608
- "div",
2609
- {
2610
- className: getClassName3({ noBorderTop, noPadding }),
2611
- style: { background },
2612
- children: [
2613
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
2614
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
2615
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2616
- "button",
2617
- {
2618
- type: "button",
2619
- className: getClassName3("breadcrumbLabel"),
2620
- onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2621
- children: breadcrumb.label
2622
- }
2623
- ),
2624
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
2625
- ] }, i)) : null,
2626
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
2627
- ] }) }),
2628
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
2629
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
2630
- ]
2631
- }
2632
- );
2633
- };
2634
-
2635
- // ../core/components/OutlineList/index.tsx
2636
- init_react_import();
2637
-
2638
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2639
- init_react_import();
2640
- var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2641
-
2642
- // ../core/components/OutlineList/index.tsx
2643
- var import_jsx_runtime4 = require("react/jsx-runtime");
2644
- var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2645
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2646
- var OutlineList = ({ children }) => {
2647
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
2648
- };
2649
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
2650
- OutlineList.Item = ({
2651
- children,
2652
- onClick
2653
- }) => {
2654
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2655
- "li",
2656
- {
2657
- className: getClassNameItem({ clickable: !!onClick }),
2658
- onClick,
2659
- children
2660
- }
2661
- );
2662
- };
2663
-
2664
- // ../core/lib/scroll-into-view.ts
2665
- init_react_import();
2666
- var scrollIntoView = (el) => {
2667
- const oldStyle = __spreadValues({}, el.style);
2668
- el.style.scrollMargin = "256px";
2669
- if (el) {
2670
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2671
- el.style.scrollMargin = oldStyle.scrollMargin || "";
2672
- }
2673
- };
2674
-
2675
- // ../core/lib/get-frame.ts
2676
- init_react_import();
2677
- var getFrame = () => {
2678
- if (typeof window === "undefined") return;
2679
- let frameEl = document.querySelector("#preview-frame");
2680
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2681
- return frameEl.contentDocument || document;
2682
- }
2683
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2684
- };
2685
-
2686
2570
  // src/HeadingAnalyzer.tsx
2687
2571
  var import_react_from_json = __toESM(require("react-from-json"));
2688
- var import_jsx_runtime5 = require("react/jsx-runtime");
2689
- var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2572
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2573
+ var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2690
2574
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2691
2575
  var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
2692
2576
  var getOutline = ({ frame } = {}) => {
@@ -2741,8 +2625,8 @@ function buildHierarchy(frame) {
2741
2625
  var usePuck = (0, import_puck.createUsePuck)();
2742
2626
  var HeadingAnalyzer = () => {
2743
2627
  const data = usePuck((s) => s.appState.data);
2744
- const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
2745
- (0, import_react11.useEffect)(() => {
2628
+ const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
2629
+ (0, import_react10.useEffect)(() => {
2746
2630
  const frame = getFrame();
2747
2631
  let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
2748
2632
  const createHierarchy = () => {
@@ -2777,11 +2661,11 @@ var HeadingAnalyzer = () => {
2777
2661
  frameObserver.disconnect();
2778
2662
  };
2779
2663
  }, [data]);
2780
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
2781
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2664
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
2665
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2782
2666
  "small",
2783
2667
  {
2784
- className: getClassName5("cssWarning"),
2668
+ className: getClassName2("cssWarning"),
2785
2669
  style: {
2786
2670
  color: "var(--puck-color-red-04)",
2787
2671
  display: "block",
@@ -2790,19 +2674,19 @@ var HeadingAnalyzer = () => {
2790
2674
  children: [
2791
2675
  "Heading analyzer styles not loaded. Please review the",
2792
2676
  " ",
2793
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2677
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2794
2678
  "."
2795
2679
  ]
2796
2680
  }
2797
2681
  ),
2798
- hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
2799
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2682
+ hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
2683
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2800
2684
  ReactFromJSON,
2801
2685
  {
2802
2686
  mapping: {
2803
- Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
2804
- OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
2805
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2687
+ Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
2688
+ OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
2689
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2806
2690
  "small",
2807
2691
  {
2808
2692
  className: getClassNameItem2({ missing: props.missing }),
@@ -2820,14 +2704,14 @@ var HeadingAnalyzer = () => {
2820
2704
  }, 2e3);
2821
2705
  }
2822
2706
  },
2823
- children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2824
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2707
+ children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2708
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2825
2709
  "H",
2826
2710
  props.rank
2827
2711
  ] }),
2828
2712
  ": Missing"
2829
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2830
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
2713
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2714
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
2831
2715
  "H",
2832
2716
  props.rank
2833
2717
  ] }),
@@ -2836,7 +2720,7 @@ var HeadingAnalyzer = () => {
2836
2720
  ] })
2837
2721
  }
2838
2722
  ) }),
2839
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
2723
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
2840
2724
  ] })
2841
2725
  },
2842
2726
  entry: {
@@ -2857,12 +2741,10 @@ var HeadingAnalyzer = () => {
2857
2741
  ] });
2858
2742
  };
2859
2743
  var headingAnalyzer = {
2860
- overrides: {
2861
- fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
2862
- children,
2863
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
2864
- ] })
2865
- }
2744
+ name: "heading-analyzer",
2745
+ label: "Audit",
2746
+ render: HeadingAnalyzer,
2747
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
2866
2748
  };
2867
2749
  var HeadingAnalyzer_default = headingAnalyzer;
2868
2750
  /*! Bundled license information:
@@ -2875,45 +2757,10 @@ classnames/index.js:
2875
2757
  *)
2876
2758
 
2877
2759
  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
2760
  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
2761
  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
2762
  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
- 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
-
2763
+ lucide-react/dist/esm/icons/heading-1.js:
2917
2764
  lucide-react/dist/esm/lucide-react.js:
2918
2765
  (**
2919
2766
  * @license lucide-react v0.468.0 - ISC