@measured/puck-plugin-heading-analyzer 0.21.0-canary.f3ce0d72 → 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.mjs CHANGED
@@ -269,17 +269,17 @@ import { useEffect as useEffect5, useState } from "react";
269
269
 
270
270
  // css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
271
271
  init_react_import();
272
- var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_yg0s7_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_yg0s7_6", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_yg0s7_10", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_yg0s7_14" };
272
+ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
273
273
 
274
274
  // src/HeadingAnalyzer.tsx
275
275
  import { createUsePuck } from "@measured/puck";
276
276
 
277
- // ../core/components/OutlineList/index.tsx
277
+ // ../core/components/SidebarSection/index.tsx
278
278
  init_react_import();
279
279
 
280
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
280
+ // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
281
281
  init_react_import();
282
- var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
282
+ 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" };
283
283
 
284
284
  // ../core/lib/get-class-name-factory.ts
285
285
  init_react_import();
@@ -308,50 +308,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
308
308
  };
309
309
  var get_class_name_factory_default = getClassNameFactory;
310
310
 
311
- // ../core/components/OutlineList/index.tsx
311
+ // ../core/components/Heading/index.tsx
312
+ init_react_import();
313
+
314
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
315
+ init_react_import();
316
+ 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" };
317
+
318
+ // ../core/components/Heading/index.tsx
312
319
  import { jsx } from "react/jsx-runtime";
313
- var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
314
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
315
- var OutlineList = ({ children }) => {
316
- return /* @__PURE__ */ jsx("ul", { className: getClassName(), children });
317
- };
318
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassNameItem({ clickable: true }), children });
319
- OutlineList.Item = ({
320
- children,
321
- onClick
322
- }) => {
320
+ var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
321
+ var Heading = ({ children, rank, size = "m" }) => {
322
+ const Tag = rank ? `h${rank}` : "span";
323
323
  return /* @__PURE__ */ jsx(
324
- "li",
324
+ Tag,
325
325
  {
326
- className: getClassNameItem({ clickable: !!onClick }),
327
- onClick,
326
+ className: getClassName({
327
+ [size]: true
328
+ }),
328
329
  children
329
330
  }
330
331
  );
331
332
  };
332
333
 
333
- // ../core/lib/scroll-into-view.ts
334
- init_react_import();
335
- var scrollIntoView = (el) => {
336
- const oldStyle = __spreadValues({}, el.style);
337
- el.style.scrollMargin = "256px";
338
- if (el) {
339
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
340
- el.style.scrollMargin = oldStyle.scrollMargin || "";
341
- }
342
- };
343
-
344
- // ../core/lib/get-frame.ts
345
- init_react_import();
346
- var getFrame = () => {
347
- if (typeof window === "undefined") return;
348
- let frameEl = document.querySelector("#preview-frame");
349
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
350
- return frameEl.contentDocument || document;
351
- }
352
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
353
- };
354
-
355
334
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
356
335
  init_react_import();
357
336
 
@@ -439,29 +418,15 @@ var createLucideIcon = (iconName, iconNode) => {
439
418
  return Component;
440
419
  };
441
420
 
442
- // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
421
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
443
422
  init_react_import();
444
- var Heading1 = createLucideIcon("Heading1", [
445
- ["path", { d: "M4 12h8", key: "17cfdx" }],
446
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
447
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
448
- ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
423
+ var ChevronRight = createLucideIcon("ChevronRight", [
424
+ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
449
425
  ]);
450
426
 
451
- // ../core/lib/index.ts
452
- init_react_import();
453
-
454
- // ../core/lib/filter.ts
455
- init_react_import();
456
-
457
- // ../core/lib/data/reorder.ts
458
- init_react_import();
459
-
460
- // ../core/lib/data/replace.ts
461
- init_react_import();
462
-
463
- // ../core/lib/use-reset-auto-zoom.ts
427
+ // ../core/lib/use-breadcrumbs.ts
464
428
  init_react_import();
429
+ import { useMemo } from "react";
465
430
 
466
431
  // ../core/store/index.ts
467
432
  init_react_import();
@@ -1029,7 +994,9 @@ var replaceAction = (state, action, appStore) => {
1029
994
  });
1030
995
  });
1031
996
  });
1032
- const stateWithDeepSlotsRemoved = __spreadValues({}, state);
997
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
998
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
999
+ });
1033
1000
  Object.keys(state.indexes.zones).forEach((zoneCompound) => {
1034
1001
  const id = zoneCompound.split(":")[0];
1035
1002
  if (id === originalId) {
@@ -1431,8 +1398,7 @@ init_react_import();
1431
1398
  var defaultViewports = [
1432
1399
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1433
1400
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1434
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1435
- { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1401
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1436
1402
  ];
1437
1403
 
1438
1404
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -1542,9 +1508,9 @@ function debounce(func, timeout = 300) {
1542
1508
  var tidyState = (state) => {
1543
1509
  return __spreadProps(__spreadValues({}, state), {
1544
1510
  ui: __spreadProps(__spreadValues({}, state.ui), {
1545
- field: {
1511
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
1546
1512
  focus: null
1547
- }
1513
+ })
1548
1514
  })
1549
1515
  });
1550
1516
  };
@@ -2114,26 +2080,34 @@ var createPermissionsSlice = (set, get) => {
2114
2080
  const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2115
2081
  const { state, permissions, config } = get();
2116
2082
  const { cache: cache2, globalPermissions } = permissions;
2117
- const resolveDataForItem = (item2, force2 = false) => __async(null, null, function* () {
2118
- var _a, _b, _c;
2083
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2084
+ var _a, _b;
2119
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;
2120
2091
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2121
2092
  if (!componentConfig) {
2122
2093
  return;
2123
2094
  }
2124
2095
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2125
2096
  if (componentConfig.resolvePermissions) {
2126
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2127
- 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) {
2128
2101
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2129
2102
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2130
2103
  item2,
2131
2104
  {
2132
2105
  changed,
2133
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2106
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2134
2107
  permissions: initialPermissions,
2135
2108
  appState: makeStatePublic(appState),
2136
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2109
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2110
+ parent: parentData
2137
2111
  }
2138
2112
  );
2139
2113
  const latest = get().permissions;
@@ -2141,6 +2115,7 @@ var createPermissionsSlice = (set, get) => {
2141
2115
  permissions: __spreadProps(__spreadValues({}, latest), {
2142
2116
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2143
2117
  [item2.props.id]: {
2118
+ lastParentId: parentId,
2144
2119
  lastData: item2,
2145
2120
  lastPermissions: resolvedPermissions
2146
2121
  }
@@ -2154,9 +2129,9 @@ var createPermissionsSlice = (set, get) => {
2154
2129
  }
2155
2130
  }
2156
2131
  });
2157
- const resolveDataForRoot = (force2 = false) => {
2132
+ const resolvePermissionsForRoot = (force2 = false) => {
2158
2133
  const { state: appState } = get();
2159
- resolveDataForItem(
2134
+ resolvePermissionsForItem(
2160
2135
  // Shim the root data in by conforming to component data shape
2161
2136
  {
2162
2137
  type: "root",
@@ -2167,16 +2142,16 @@ var createPermissionsSlice = (set, get) => {
2167
2142
  };
2168
2143
  const { item, type, root } = params;
2169
2144
  if (item) {
2170
- yield resolveDataForItem(item, force);
2145
+ yield resolvePermissionsForItem(item, force);
2171
2146
  } else if (type) {
2172
2147
  flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2173
- yield resolveDataForItem(item2, force);
2148
+ yield resolvePermissionsForItem(item2, force);
2174
2149
  }));
2175
2150
  } else if (root) {
2176
- resolveDataForRoot(force);
2151
+ resolvePermissionsForRoot(force);
2177
2152
  } else {
2178
2153
  flattenData(state, config).map((item2) => __async(null, null, function* () {
2179
- yield resolveDataForItem(item2, force);
2154
+ yield resolvePermissionsForItem(item2, force);
2180
2155
  }));
2181
2156
  }
2182
2157
  });
@@ -2328,8 +2303,7 @@ var defaultAppState = {
2328
2303
  options: [],
2329
2304
  controlsVisible: true
2330
2305
  },
2331
- field: { focus: null },
2332
- plugin: { current: null }
2306
+ field: { focus: null }
2333
2307
  },
2334
2308
  indexes: {
2335
2309
  nodes: {},
@@ -2345,7 +2319,6 @@ var createAppStore = (initialAppStore) => create()(
2345
2319
  subscribeWithSelector((set, get) => {
2346
2320
  var _a, _b;
2347
2321
  return __spreadProps(__spreadValues({
2348
- instanceId: generateId(),
2349
2322
  state: defaultAppState,
2350
2323
  config: { components: {} },
2351
2324
  componentState: {},
@@ -2366,6 +2339,11 @@ var createAppStore = (initialAppStore) => create()(
2366
2339
  history: createHistorySlice(set, get),
2367
2340
  nodes: createNodesSlice(set, get),
2368
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
+ },
2369
2347
  getComponentConfig: (type) => {
2370
2348
  var _a2;
2371
2349
  const { config, selectedItem } = get();
@@ -2516,14 +2494,203 @@ var createAppStore = (initialAppStore) => create()(
2516
2494
  })
2517
2495
  );
2518
2496
  var appStoreContext = createContext(createAppStore());
2497
+ function useAppStore(selector) {
2498
+ const context = useContext(appStoreContext);
2499
+ return useStore(context, selector);
2500
+ }
2501
+ function useAppStoreApi() {
2502
+ return useContext(appStoreContext);
2503
+ }
2504
+
2505
+ // ../core/lib/use-breadcrumbs.ts
2506
+ var useBreadcrumbs = (renderCount) => {
2507
+ const selectedId = useAppStore((s) => {
2508
+ var _a;
2509
+ return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2510
+ });
2511
+ const config = useAppStore((s) => s.config);
2512
+ const path = useAppStore((s) => {
2513
+ var _a;
2514
+ return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2515
+ });
2516
+ const appStore = useAppStoreApi();
2517
+ return useMemo(() => {
2518
+ const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2519
+ var _a, _b, _c;
2520
+ const [componentId] = zoneCompound.split(":");
2521
+ if (componentId === "root") {
2522
+ return {
2523
+ label: "Page",
2524
+ selector: null
2525
+ };
2526
+ }
2527
+ const node = appStore.getState().state.indexes.nodes[componentId];
2528
+ const parentId = node.path[node.path.length - 1];
2529
+ const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2530
+ const index = contentIds.indexOf(componentId);
2531
+ const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2532
+ return {
2533
+ label,
2534
+ selector: node ? {
2535
+ index,
2536
+ zone: node.path[node.path.length - 1]
2537
+ } : null
2538
+ };
2539
+ })) || [];
2540
+ if (renderCount) {
2541
+ return breadcrumbs.slice(breadcrumbs.length - renderCount);
2542
+ }
2543
+ return breadcrumbs;
2544
+ }, [path, renderCount]);
2545
+ };
2546
+
2547
+ // ../core/components/Loader/index.tsx
2548
+ init_react_import();
2549
+
2550
+ // ../core/lib/index.ts
2551
+ init_react_import();
2552
+
2553
+ // ../core/lib/filter.ts
2554
+ init_react_import();
2555
+
2556
+ // ../core/lib/data/reorder.ts
2557
+ init_react_import();
2558
+
2559
+ // ../core/lib/data/replace.ts
2560
+ init_react_import();
2561
+
2562
+ // ../core/lib/use-reset-auto-zoom.ts
2563
+ init_react_import();
2519
2564
 
2520
2565
  // ../core/lib/get-zoom-config.ts
2521
2566
  init_react_import();
2522
2567
 
2568
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2569
+ init_react_import();
2570
+ var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2571
+
2572
+ // ../core/components/Loader/index.tsx
2573
+ import { jsx as jsx2 } from "react/jsx-runtime";
2574
+ var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2575
+ var Loader = (_a) => {
2576
+ var _b = _a, {
2577
+ color,
2578
+ size = 16
2579
+ } = _b, props = __objRest(_b, [
2580
+ "color",
2581
+ "size"
2582
+ ]);
2583
+ return /* @__PURE__ */ jsx2(
2584
+ "span",
2585
+ __spreadValues({
2586
+ className: getClassName2(),
2587
+ style: {
2588
+ width: size,
2589
+ height: size,
2590
+ color
2591
+ },
2592
+ "aria-label": "loading"
2593
+ }, props)
2594
+ );
2595
+ };
2596
+
2597
+ // ../core/components/SidebarSection/index.tsx
2598
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
2599
+ var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2600
+ var SidebarSection = ({
2601
+ children,
2602
+ title,
2603
+ background,
2604
+ showBreadcrumbs,
2605
+ noBorderTop,
2606
+ noPadding,
2607
+ isLoading
2608
+ }) => {
2609
+ const setUi = useAppStore((s) => s.setUi);
2610
+ const breadcrumbs = useBreadcrumbs(1);
2611
+ return /* @__PURE__ */ jsxs(
2612
+ "div",
2613
+ {
2614
+ className: getClassName3({ noBorderTop, noPadding }),
2615
+ style: { background },
2616
+ children: [
2617
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2618
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
2619
+ /* @__PURE__ */ jsx3(
2620
+ "button",
2621
+ {
2622
+ type: "button",
2623
+ className: getClassName3("breadcrumbLabel"),
2624
+ onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2625
+ children: breadcrumb.label
2626
+ }
2627
+ ),
2628
+ /* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
2629
+ ] }, i)) : null,
2630
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
2631
+ ] }) }),
2632
+ /* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
2633
+ isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
2634
+ ]
2635
+ }
2636
+ );
2637
+ };
2638
+
2639
+ // ../core/components/OutlineList/index.tsx
2640
+ init_react_import();
2641
+
2642
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2643
+ init_react_import();
2644
+ var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2645
+
2646
+ // ../core/components/OutlineList/index.tsx
2647
+ import { jsx as jsx4 } from "react/jsx-runtime";
2648
+ var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2649
+ var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2650
+ var OutlineList = ({ children }) => {
2651
+ return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
2652
+ };
2653
+ OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
2654
+ OutlineList.Item = ({
2655
+ children,
2656
+ onClick
2657
+ }) => {
2658
+ return /* @__PURE__ */ jsx4(
2659
+ "li",
2660
+ {
2661
+ className: getClassNameItem({ clickable: !!onClick }),
2662
+ onClick,
2663
+ children
2664
+ }
2665
+ );
2666
+ };
2667
+
2668
+ // ../core/lib/scroll-into-view.ts
2669
+ init_react_import();
2670
+ var scrollIntoView = (el) => {
2671
+ const oldStyle = __spreadValues({}, el.style);
2672
+ el.style.scrollMargin = "256px";
2673
+ if (el) {
2674
+ el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2675
+ el.style.scrollMargin = oldStyle.scrollMargin || "";
2676
+ }
2677
+ };
2678
+
2679
+ // ../core/lib/get-frame.ts
2680
+ init_react_import();
2681
+ var getFrame = () => {
2682
+ if (typeof window === "undefined") return;
2683
+ let frameEl = document.querySelector("#preview-frame");
2684
+ if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2685
+ return frameEl.contentDocument || document;
2686
+ }
2687
+ return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2688
+ };
2689
+
2523
2690
  // src/HeadingAnalyzer.tsx
2524
2691
  import ReactFromJSONModule from "react-from-json";
2525
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
2526
- var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2692
+ import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
2693
+ var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2527
2694
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2528
2695
  var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
2529
2696
  var getOutline = ({ frame } = {}) => {
@@ -2614,11 +2781,11 @@ var HeadingAnalyzer = () => {
2614
2781
  frameObserver.disconnect();
2615
2782
  };
2616
2783
  }, [data]);
2617
- return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
2618
- /* @__PURE__ */ jsxs(
2784
+ return /* @__PURE__ */ jsxs2("div", { className: getClassName5(), children: [
2785
+ /* @__PURE__ */ jsxs2(
2619
2786
  "small",
2620
2787
  {
2621
- className: getClassName2("cssWarning"),
2788
+ className: getClassName5("cssWarning"),
2622
2789
  style: {
2623
2790
  color: "var(--puck-color-red-04)",
2624
2791
  display: "block",
@@ -2627,19 +2794,19 @@ var HeadingAnalyzer = () => {
2627
2794
  children: [
2628
2795
  "Heading analyzer styles not loaded. Please review the",
2629
2796
  " ",
2630
- /* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2797
+ /* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2631
2798
  "."
2632
2799
  ]
2633
2800
  }
2634
2801
  ),
2635
- hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
2636
- /* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
2802
+ hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
2803
+ /* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
2637
2804
  ReactFromJSON,
2638
2805
  {
2639
2806
  mapping: {
2640
- Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
2641
- OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
2642
- /* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
2807
+ Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
2808
+ OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
2809
+ /* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
2643
2810
  "small",
2644
2811
  {
2645
2812
  className: getClassNameItem2({ missing: props.missing }),
@@ -2657,14 +2824,14 @@ var HeadingAnalyzer = () => {
2657
2824
  }, 2e3);
2658
2825
  }
2659
2826
  },
2660
- children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
2661
- /* @__PURE__ */ jsxs("b", { children: [
2827
+ children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2828
+ /* @__PURE__ */ jsxs2("b", { children: [
2662
2829
  "H",
2663
2830
  props.rank
2664
2831
  ] }),
2665
2832
  ": Missing"
2666
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2667
- /* @__PURE__ */ jsxs("b", { children: [
2833
+ ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
2834
+ /* @__PURE__ */ jsxs2("b", { children: [
2668
2835
  "H",
2669
2836
  props.rank
2670
2837
  ] }),
@@ -2673,7 +2840,7 @@ var HeadingAnalyzer = () => {
2673
2840
  ] })
2674
2841
  }
2675
2842
  ) }),
2676
- /* @__PURE__ */ jsx2(OutlineList, { children: props.children })
2843
+ /* @__PURE__ */ jsx5(OutlineList, { children: props.children })
2677
2844
  ] })
2678
2845
  },
2679
2846
  entry: {
@@ -2694,10 +2861,12 @@ var HeadingAnalyzer = () => {
2694
2861
  ] });
2695
2862
  };
2696
2863
  var headingAnalyzer = {
2697
- name: "heading-analyzer",
2698
- label: "Audit",
2699
- render: HeadingAnalyzer,
2700
- icon: /* @__PURE__ */ jsx2(Heading1, {})
2864
+ overrides: {
2865
+ fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2866
+ children,
2867
+ /* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
2868
+ ] })
2869
+ }
2701
2870
  };
2702
2871
  var HeadingAnalyzer_default = headingAnalyzer;
2703
2872
  export {
@@ -2716,7 +2885,7 @@ lucide-react/dist/esm/shared/src/utils.js:
2716
2885
  lucide-react/dist/esm/defaultAttributes.js:
2717
2886
  lucide-react/dist/esm/Icon.js:
2718
2887
  lucide-react/dist/esm/createLucideIcon.js:
2719
- lucide-react/dist/esm/icons/heading-1.js:
2888
+ lucide-react/dist/esm/icons/chevron-right.js:
2720
2889
  lucide-react/dist/esm/lucide-react.js:
2721
2890
  (**
2722
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.f3ce0d72",
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,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "devDependencies": {
28
- "@measured/puck": "^0.21.0-canary.f3ce0d72",
28
+ "@measured/puck": "^0.21.0-canary.fee2ba98",
29
29
  "@types/minimatch": "3.0.5",
30
30
  "@types/react": "^19.0.1",
31
31
  "@types/react-dom": "^19.0.2",