@measured/puck-plugin-heading-analyzer 0.21.0-canary.77444503 → 0.21.0-canary.7c2f9283

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_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
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" };
273
273
 
274
274
  // src/HeadingAnalyzer.tsx
275
275
  import { createUsePuck } from "@measured/puck";
276
276
 
277
- // ../core/components/SidebarSection/index.tsx
277
+ // ../core/components/OutlineList/index.tsx
278
278
  init_react_import();
279
279
 
280
- // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
280
+ // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
281
281
  init_react_import();
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" };
282
+ var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
283
283
 
284
284
  // ../core/lib/get-class-name-factory.ts
285
285
  init_react_import();
@@ -308,29 +308,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
308
308
  };
309
309
  var get_class_name_factory_default = getClassNameFactory;
310
310
 
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
311
+ // ../core/components/OutlineList/index.tsx
319
312
  import { jsx } from "react/jsx-runtime";
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";
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
+ }) => {
323
323
  return /* @__PURE__ */ jsx(
324
- Tag,
324
+ "li",
325
325
  {
326
- className: getClassName({
327
- [size]: true
328
- }),
326
+ className: getClassNameItem({ clickable: !!onClick }),
327
+ onClick,
329
328
  children
330
329
  }
331
330
  );
332
331
  };
333
332
 
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
+
334
355
  // ../../node_modules/lucide-react/dist/esm/lucide-react.js
335
356
  init_react_import();
336
357
 
@@ -418,15 +439,29 @@ var createLucideIcon = (iconName, iconNode) => {
418
439
  return Component;
419
440
  };
420
441
 
421
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
442
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
422
443
  init_react_import();
423
- var ChevronRight = createLucideIcon("ChevronRight", [
424
- ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
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" }]
425
449
  ]);
426
450
 
427
- // ../core/lib/use-breadcrumbs.ts
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
428
464
  init_react_import();
429
- import { useMemo } from "react";
430
465
 
431
466
  // ../core/store/index.ts
432
467
  init_react_import();
@@ -609,12 +644,12 @@ var walkObject = ({
609
644
  }
610
645
  return flatten(newProps);
611
646
  };
612
- function mapFields(item, mappers, config, recurseSlots = false) {
647
+ function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
613
648
  var _a, _b, _c, _d, _e;
614
649
  const itemType = "type" in item ? item.type : "root";
615
650
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
616
651
  const newProps = walkObject({
617
- value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
652
+ value: shouldDefaultSlots ? defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}) : item.props,
618
653
  fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
619
654
  mappers,
620
655
  id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
@@ -644,9 +679,28 @@ var stripSlots = (data, config) => {
644
679
 
645
680
  // ../core/lib/data/flatten-node.ts
646
681
  var { flatten: flatten2, unflatten } = import_flat.default;
682
+ function isEmptyArrayOrObject(val) {
683
+ if (Array.isArray(val)) {
684
+ return val.length === 0;
685
+ }
686
+ if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
687
+ return Object.keys(val).length === 0;
688
+ }
689
+ return false;
690
+ }
691
+ function stripEmptyObjects(props) {
692
+ const result = {};
693
+ for (const key in props) {
694
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
695
+ const val = props[key];
696
+ if (isEmptyArrayOrObject(val)) continue;
697
+ result[key] = val;
698
+ }
699
+ return result;
700
+ }
647
701
  var flattenNode = (node, config) => {
648
702
  return __spreadProps(__spreadValues({}, node), {
649
- props: flatten2(stripSlots(node, config).props)
703
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
650
704
  });
651
705
  };
652
706
 
@@ -1398,7 +1452,8 @@ init_react_import();
1398
1452
  var defaultViewports = [
1399
1453
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
1400
1454
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
1401
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
1455
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
1456
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
1402
1457
  ];
1403
1458
 
1404
1459
  // ../../node_modules/zustand/esm/vanilla.mjs
@@ -2204,15 +2259,34 @@ var createFieldsSlice = (_set, _get) => {
2204
2259
 
2205
2260
  // ../core/lib/resolve-component-data.ts
2206
2261
  init_react_import();
2262
+
2263
+ // ../core/lib/data/to-component.ts
2264
+ init_react_import();
2265
+ var toComponent = (item) => {
2266
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
2267
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
2268
+ type: "root"
2269
+ });
2270
+ };
2271
+
2272
+ // ../core/lib/resolve-component-data.ts
2207
2273
  var cache = { lastChange: {} };
2208
- var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2274
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null) {
2209
2275
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2210
2276
  const resolvedItem = __spreadValues({}, item);
2211
2277
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
2212
2278
  const id = "id" in item.props ? item.props.id : "root";
2213
2279
  if (shouldRunResolver) {
2214
- const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
2215
- if (trigger !== "force" && item && deepEqual(item, oldItem)) {
2280
+ const {
2281
+ item: oldItem = null,
2282
+ resolved = {},
2283
+ parentId: oldParentId = null
2284
+ } = cache.lastChange[id] || {};
2285
+ const isRootOrInserted = oldParentId === null;
2286
+ const parentChanged = !isRootOrInserted && (parent == null ? void 0 : parent.props.id) !== oldParentId;
2287
+ const dataChanged = item && !deepEqual(item, oldItem);
2288
+ const shouldSkip = trigger === "move" && !parentChanged || trigger !== "move" && trigger !== "force" && !dataChanged;
2289
+ if (shouldSkip) {
2216
2290
  return { node: resolved, didChange: false };
2217
2291
  }
2218
2292
  const changed = getChanged(item, oldItem);
@@ -2223,13 +2297,15 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
2223
2297
  changed,
2224
2298
  lastData: oldItem,
2225
2299
  metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
2226
- trigger
2300
+ trigger,
2301
+ parent
2227
2302
  });
2228
2303
  resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
2229
2304
  if (Object.keys(readOnly).length) {
2230
2305
  resolvedItem.readOnly = readOnly;
2231
2306
  }
2232
2307
  }
2308
+ const itemAsComponentData = toComponent(resolvedItem);
2233
2309
  let itemWithResolvedChildren = yield mapFields(
2234
2310
  resolvedItem,
2235
2311
  {
@@ -2244,7 +2320,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
2244
2320
  metadata,
2245
2321
  onResolveStart,
2246
2322
  onResolveEnd,
2247
- trigger
2323
+ trigger,
2324
+ itemAsComponentData
2248
2325
  )).node;
2249
2326
  })
2250
2327
  )
@@ -2258,7 +2335,8 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
2258
2335
  }
2259
2336
  cache.lastChange[id] = {
2260
2337
  item,
2261
- resolved: itemWithResolvedChildren
2338
+ resolved: itemWithResolvedChildren,
2339
+ parentId: parent == null ? void 0 : parent.props.id
2262
2340
  };
2263
2341
  return {
2264
2342
  node: itemWithResolvedChildren,
@@ -2303,7 +2381,8 @@ var defaultAppState = {
2303
2381
  options: [],
2304
2382
  controlsVisible: true
2305
2383
  },
2306
- field: { focus: null }
2384
+ field: { focus: null },
2385
+ plugin: { current: null }
2307
2386
  },
2308
2387
  indexes: {
2309
2388
  nodes: {},
@@ -2319,6 +2398,7 @@ var createAppStore = (initialAppStore) => create()(
2319
2398
  subscribeWithSelector((set, get) => {
2320
2399
  var _a, _b;
2321
2400
  return __spreadProps(__spreadValues({
2401
+ instanceId: generateId(),
2322
2402
  state: defaultAppState,
2323
2403
  config: { components: {} },
2324
2404
  componentState: {},
@@ -2339,6 +2419,11 @@ var createAppStore = (initialAppStore) => create()(
2339
2419
  history: createHistorySlice(set, get),
2340
2420
  nodes: createNodesSlice(set, get),
2341
2421
  permissions: createPermissionsSlice(set, get),
2422
+ getCurrentData: () => {
2423
+ var _a2;
2424
+ const s = get();
2425
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
2426
+ },
2342
2427
  getComponentConfig: (type) => {
2343
2428
  var _a2;
2344
2429
  const { config, selectedItem } = get();
@@ -2428,7 +2513,12 @@ var createAppStore = (initialAppStore) => create()(
2428
2513
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2429
2514
  }),
2430
2515
  resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2431
- const { config, metadata, setComponentLoading, permissions } = get();
2516
+ var _a2, _b2;
2517
+ const { config, metadata, setComponentLoading, permissions, state } = get();
2518
+ const componentId = "id" in componentData.props ? componentData.props.id : "root";
2519
+ const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
2520
+ const parentNode = parentId ? state.indexes.nodes[parentId] : null;
2521
+ const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
2432
2522
  const timeouts = {};
2433
2523
  return yield resolveComponentData(
2434
2524
  componentData,
@@ -2447,7 +2537,8 @@ var createAppStore = (initialAppStore) => create()(
2447
2537
  }
2448
2538
  timeouts[id]();
2449
2539
  }),
2450
- trigger
2540
+ trigger,
2541
+ parentData
2451
2542
  );
2452
2543
  }),
2453
2544
  resolveAndCommitData: () => __async(null, null, function* () {
@@ -2489,203 +2580,14 @@ var createAppStore = (initialAppStore) => create()(
2489
2580
  })
2490
2581
  );
2491
2582
  var appStoreContext = createContext(createAppStore());
2492
- function useAppStore(selector) {
2493
- const context = useContext(appStoreContext);
2494
- return useStore(context, selector);
2495
- }
2496
- function useAppStoreApi() {
2497
- return useContext(appStoreContext);
2498
- }
2499
-
2500
- // ../core/lib/use-breadcrumbs.ts
2501
- var useBreadcrumbs = (renderCount) => {
2502
- const selectedId = useAppStore((s) => {
2503
- var _a;
2504
- return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
2505
- });
2506
- const config = useAppStore((s) => s.config);
2507
- const path = useAppStore((s) => {
2508
- var _a;
2509
- return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
2510
- });
2511
- const appStore = useAppStoreApi();
2512
- return useMemo(() => {
2513
- const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
2514
- var _a, _b, _c;
2515
- const [componentId] = zoneCompound.split(":");
2516
- if (componentId === "root") {
2517
- return {
2518
- label: "Page",
2519
- selector: null
2520
- };
2521
- }
2522
- const node = appStore.getState().state.indexes.nodes[componentId];
2523
- const parentId = node.path[node.path.length - 1];
2524
- const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
2525
- const index = contentIds.indexOf(componentId);
2526
- const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
2527
- return {
2528
- label,
2529
- selector: node ? {
2530
- index,
2531
- zone: node.path[node.path.length - 1]
2532
- } : null
2533
- };
2534
- })) || [];
2535
- if (renderCount) {
2536
- return breadcrumbs.slice(breadcrumbs.length - renderCount);
2537
- }
2538
- return breadcrumbs;
2539
- }, [path, renderCount]);
2540
- };
2541
-
2542
- // ../core/components/Loader/index.tsx
2543
- init_react_import();
2544
-
2545
- // ../core/lib/index.ts
2546
- init_react_import();
2547
-
2548
- // ../core/lib/filter.ts
2549
- init_react_import();
2550
-
2551
- // ../core/lib/data/reorder.ts
2552
- init_react_import();
2553
-
2554
- // ../core/lib/data/replace.ts
2555
- init_react_import();
2556
-
2557
- // ../core/lib/use-reset-auto-zoom.ts
2558
- init_react_import();
2559
2583
 
2560
2584
  // ../core/lib/get-zoom-config.ts
2561
2585
  init_react_import();
2562
2586
 
2563
- // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
2564
- init_react_import();
2565
- var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
2566
-
2567
- // ../core/components/Loader/index.tsx
2568
- import { jsx as jsx2 } from "react/jsx-runtime";
2569
- var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
2570
- var Loader = (_a) => {
2571
- var _b = _a, {
2572
- color,
2573
- size = 16
2574
- } = _b, props = __objRest(_b, [
2575
- "color",
2576
- "size"
2577
- ]);
2578
- return /* @__PURE__ */ jsx2(
2579
- "span",
2580
- __spreadValues({
2581
- className: getClassName2(),
2582
- style: {
2583
- width: size,
2584
- height: size,
2585
- color
2586
- },
2587
- "aria-label": "loading"
2588
- }, props)
2589
- );
2590
- };
2591
-
2592
- // ../core/components/SidebarSection/index.tsx
2593
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
2594
- var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
2595
- var SidebarSection = ({
2596
- children,
2597
- title,
2598
- background,
2599
- showBreadcrumbs,
2600
- noBorderTop,
2601
- noPadding,
2602
- isLoading
2603
- }) => {
2604
- const setUi = useAppStore((s) => s.setUi);
2605
- const breadcrumbs = useBreadcrumbs(1);
2606
- return /* @__PURE__ */ jsxs(
2607
- "div",
2608
- {
2609
- className: getClassName3({ noBorderTop, noPadding }),
2610
- style: { background },
2611
- children: [
2612
- /* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
2613
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
2614
- /* @__PURE__ */ jsx3(
2615
- "button",
2616
- {
2617
- type: "button",
2618
- className: getClassName3("breadcrumbLabel"),
2619
- onClick: () => setUi({ itemSelector: breadcrumb.selector }),
2620
- children: breadcrumb.label
2621
- }
2622
- ),
2623
- /* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
2624
- ] }, i)) : null,
2625
- /* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
2626
- ] }) }),
2627
- /* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
2628
- isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
2629
- ]
2630
- }
2631
- );
2632
- };
2633
-
2634
- // ../core/components/OutlineList/index.tsx
2635
- init_react_import();
2636
-
2637
- // css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
2638
- init_react_import();
2639
- var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
2640
-
2641
- // ../core/components/OutlineList/index.tsx
2642
- import { jsx as jsx4 } from "react/jsx-runtime";
2643
- var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
2644
- var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
2645
- var OutlineList = ({ children }) => {
2646
- return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
2647
- };
2648
- OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
2649
- OutlineList.Item = ({
2650
- children,
2651
- onClick
2652
- }) => {
2653
- return /* @__PURE__ */ jsx4(
2654
- "li",
2655
- {
2656
- className: getClassNameItem({ clickable: !!onClick }),
2657
- onClick,
2658
- children
2659
- }
2660
- );
2661
- };
2662
-
2663
- // ../core/lib/scroll-into-view.ts
2664
- init_react_import();
2665
- var scrollIntoView = (el) => {
2666
- const oldStyle = __spreadValues({}, el.style);
2667
- el.style.scrollMargin = "256px";
2668
- if (el) {
2669
- el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
2670
- el.style.scrollMargin = oldStyle.scrollMargin || "";
2671
- }
2672
- };
2673
-
2674
- // ../core/lib/get-frame.ts
2675
- init_react_import();
2676
- var getFrame = () => {
2677
- if (typeof window === "undefined") return;
2678
- let frameEl = document.querySelector("#preview-frame");
2679
- if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
2680
- return frameEl.contentDocument || document;
2681
- }
2682
- return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
2683
- };
2684
-
2685
2587
  // src/HeadingAnalyzer.tsx
2686
2588
  import ReactFromJSONModule from "react-from-json";
2687
- import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
2688
- var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2589
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
2590
+ var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
2689
2591
  var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
2690
2592
  var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
2691
2593
  var getOutline = ({ frame } = {}) => {
@@ -2776,11 +2678,11 @@ var HeadingAnalyzer = () => {
2776
2678
  frameObserver.disconnect();
2777
2679
  };
2778
2680
  }, [data]);
2779
- return /* @__PURE__ */ jsxs2("div", { className: getClassName5(), children: [
2780
- /* @__PURE__ */ jsxs2(
2681
+ return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
2682
+ /* @__PURE__ */ jsxs(
2781
2683
  "small",
2782
2684
  {
2783
- className: getClassName5("cssWarning"),
2685
+ className: getClassName2("cssWarning"),
2784
2686
  style: {
2785
2687
  color: "var(--puck-color-red-04)",
2786
2688
  display: "block",
@@ -2789,19 +2691,19 @@ var HeadingAnalyzer = () => {
2789
2691
  children: [
2790
2692
  "Heading analyzer styles not loaded. Please review the",
2791
2693
  " ",
2792
- /* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2694
+ /* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
2793
2695
  "."
2794
2696
  ]
2795
2697
  }
2796
2698
  ),
2797
- hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
2798
- /* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
2699
+ hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
2700
+ /* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
2799
2701
  ReactFromJSON,
2800
2702
  {
2801
2703
  mapping: {
2802
- Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
2803
- OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
2804
- /* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
2704
+ Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
2705
+ OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
2706
+ /* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
2805
2707
  "small",
2806
2708
  {
2807
2709
  className: getClassNameItem2({ missing: props.missing }),
@@ -2819,14 +2721,14 @@ var HeadingAnalyzer = () => {
2819
2721
  }, 2e3);
2820
2722
  }
2821
2723
  },
2822
- children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2823
- /* @__PURE__ */ jsxs2("b", { children: [
2724
+ children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
2725
+ /* @__PURE__ */ jsxs("b", { children: [
2824
2726
  "H",
2825
2727
  props.rank
2826
2728
  ] }),
2827
2729
  ": Missing"
2828
- ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
2829
- /* @__PURE__ */ jsxs2("b", { children: [
2730
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2731
+ /* @__PURE__ */ jsxs("b", { children: [
2830
2732
  "H",
2831
2733
  props.rank
2832
2734
  ] }),
@@ -2835,7 +2737,7 @@ var HeadingAnalyzer = () => {
2835
2737
  ] })
2836
2738
  }
2837
2739
  ) }),
2838
- /* @__PURE__ */ jsx5(OutlineList, { children: props.children })
2740
+ /* @__PURE__ */ jsx2(OutlineList, { children: props.children })
2839
2741
  ] })
2840
2742
  },
2841
2743
  entry: {
@@ -2856,12 +2758,10 @@ var HeadingAnalyzer = () => {
2856
2758
  ] });
2857
2759
  };
2858
2760
  var headingAnalyzer = {
2859
- overrides: {
2860
- fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2861
- children,
2862
- /* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
2863
- ] })
2864
- }
2761
+ name: "heading-analyzer",
2762
+ label: "Audit",
2763
+ render: HeadingAnalyzer,
2764
+ icon: /* @__PURE__ */ jsx2(Heading1, {})
2865
2765
  };
2866
2766
  var HeadingAnalyzer_default = headingAnalyzer;
2867
2767
  export {
@@ -2880,7 +2780,7 @@ lucide-react/dist/esm/shared/src/utils.js:
2880
2780
  lucide-react/dist/esm/defaultAttributes.js:
2881
2781
  lucide-react/dist/esm/Icon.js:
2882
2782
  lucide-react/dist/esm/createLucideIcon.js:
2883
- lucide-react/dist/esm/icons/chevron-right.js:
2783
+ lucide-react/dist/esm/icons/heading-1.js:
2884
2784
  lucide-react/dist/esm/lucide-react.js:
2885
2785
  (**
2886
2786
  * @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.77444503",
3
+ "version": "0.21.0-canary.7c2f9283",
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.77444503",
28
+ "@measured/puck": "^0.21.0-canary.7c2f9283",
29
29
  "@types/minimatch": "3.0.5",
30
30
  "@types/react": "^19.0.1",
31
31
  "@types/react-dom": "^19.0.2",