@measured/puck-plugin-heading-analyzer 0.21.0-canary.a3dabae1 → 0.21.0-canary.a5160e5d
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.css +149 -5
- package/dist/index.d.mts +11 -17
- package/dist/index.d.ts +11 -17
- package/dist/index.js +259 -111
- package/dist/index.mjs +256 -108
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -277,21 +277,21 @@ init_react_import();
|
|
277
277
|
|
278
278
|
// src/HeadingAnalyzer.tsx
|
279
279
|
init_react_import();
|
280
|
-
var
|
280
|
+
var import_react11 = 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": "
|
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" };
|
285
285
|
|
286
286
|
// src/HeadingAnalyzer.tsx
|
287
287
|
var import_puck = require("@measured/puck");
|
288
288
|
|
289
|
-
// ../core/components/
|
289
|
+
// ../core/components/SidebarSection/index.tsx
|
290
290
|
init_react_import();
|
291
291
|
|
292
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
292
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
293
293
|
init_react_import();
|
294
|
-
var styles_module_default = { "
|
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" };
|
295
295
|
|
296
296
|
// ../core/lib/get-class-name-factory.ts
|
297
297
|
init_react_import();
|
@@ -320,50 +320,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
320
320
|
};
|
321
321
|
var get_class_name_factory_default = getClassNameFactory;
|
322
322
|
|
323
|
-
// ../core/components/
|
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
|
324
331
|
var import_jsx_runtime = require("react/jsx-runtime");
|
325
|
-
var getClassName = get_class_name_factory_default("
|
326
|
-
var
|
327
|
-
|
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
|
-
}) => {
|
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";
|
335
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
336
|
-
|
336
|
+
Tag,
|
337
337
|
{
|
338
|
-
className:
|
339
|
-
|
338
|
+
className: getClassName({
|
339
|
+
[size]: true
|
340
|
+
}),
|
340
341
|
children
|
341
342
|
}
|
342
343
|
);
|
343
344
|
};
|
344
345
|
|
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
|
-
|
367
346
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
368
347
|
init_react_import();
|
369
348
|
|
@@ -451,29 +430,15 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
451
430
|
return Component;
|
452
431
|
};
|
453
432
|
|
454
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
433
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
455
434
|
init_react_import();
|
456
|
-
var
|
457
|
-
["path", { d: "
|
458
|
-
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
459
|
-
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
460
|
-
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
435
|
+
var ChevronRight = createLucideIcon("ChevronRight", [
|
436
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
461
437
|
]);
|
462
438
|
|
463
|
-
// ../core/lib/
|
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
|
439
|
+
// ../core/lib/use-breadcrumbs.ts
|
476
440
|
init_react_import();
|
441
|
+
var import_react10 = require("react");
|
477
442
|
|
478
443
|
// ../core/store/index.ts
|
479
444
|
init_react_import();
|
@@ -544,32 +509,27 @@ var walkField = ({
|
|
544
509
|
config,
|
545
510
|
recurseSlots = false
|
546
511
|
}) => {
|
547
|
-
var _a, _b, _c
|
512
|
+
var _a, _b, _c;
|
548
513
|
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
549
514
|
const map = mappers[fieldType];
|
550
515
|
if (map && fieldType === "slot") {
|
551
516
|
const content = value || [];
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
if (!componentConfig || !((_b = el.props) == null ? void 0 : _b.id)) {
|
558
|
-
continue;
|
559
|
-
}
|
560
|
-
const fields2 = (_c = componentConfig.fields) != null ? _c : {};
|
561
|
-
mappedContent.push(
|
562
|
-
walkField({
|
563
|
-
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
564
|
-
fields: fields2,
|
565
|
-
mappers,
|
566
|
-
id: el.props.id,
|
567
|
-
config,
|
568
|
-
recurseSlots
|
569
|
-
})
|
570
|
-
);
|
517
|
+
const mappedContent = recurseSlots ? content.map((el) => {
|
518
|
+
var _a2;
|
519
|
+
const componentConfig = config.components[el.type];
|
520
|
+
if (!componentConfig) {
|
521
|
+
throw new Error(`Could not find component config for ${el.type}`);
|
571
522
|
}
|
572
|
-
|
523
|
+
const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
|
524
|
+
return walkField({
|
525
|
+
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
526
|
+
fields: fields2,
|
527
|
+
mappers,
|
528
|
+
id: el.props.id,
|
529
|
+
config,
|
530
|
+
recurseSlots
|
531
|
+
});
|
532
|
+
}) : content;
|
573
533
|
if (containsPromise(mappedContent)) {
|
574
534
|
return Promise.all(mappedContent);
|
575
535
|
}
|
@@ -591,7 +551,7 @@ var walkField = ({
|
|
591
551
|
}
|
592
552
|
if (value && typeof value === "object") {
|
593
553
|
if (Array.isArray(value)) {
|
594
|
-
const arrayFields = ((
|
554
|
+
const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
|
595
555
|
if (!arrayFields) return value;
|
596
556
|
const newValue = value.map(
|
597
557
|
(el, idx) => walkField({
|
@@ -612,7 +572,7 @@ var walkField = ({
|
|
612
572
|
} else if ("$$typeof" in value) {
|
613
573
|
return value;
|
614
574
|
} else {
|
615
|
-
const objectFields = ((
|
575
|
+
const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
|
616
576
|
return walkObject({
|
617
577
|
value,
|
618
578
|
fields: objectFields,
|
@@ -1448,8 +1408,7 @@ init_react_import();
|
|
1448
1408
|
var defaultViewports = [
|
1449
1409
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1450
1410
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1451
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1452
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1411
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1453
1412
|
];
|
1454
1413
|
|
1455
1414
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -2345,8 +2304,7 @@ var defaultAppState = {
|
|
2345
2304
|
options: [],
|
2346
2305
|
controlsVisible: true
|
2347
2306
|
},
|
2348
|
-
field: { focus: null }
|
2349
|
-
plugin: { current: null }
|
2307
|
+
field: { focus: null }
|
2350
2308
|
},
|
2351
2309
|
indexes: {
|
2352
2310
|
nodes: {},
|
@@ -2362,7 +2320,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
2362
2320
|
subscribeWithSelector((set, get) => {
|
2363
2321
|
var _a, _b;
|
2364
2322
|
return __spreadProps(__spreadValues({
|
2365
|
-
instanceId: generateId(),
|
2366
2323
|
state: defaultAppState,
|
2367
2324
|
config: { components: {} },
|
2368
2325
|
componentState: {},
|
@@ -2533,14 +2490,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
2533
2490
|
})
|
2534
2491
|
);
|
2535
2492
|
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();
|
2536
2560
|
|
2537
2561
|
// ../core/lib/get-zoom-config.ts
|
2538
2562
|
init_react_import();
|
2539
2563
|
|
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
|
+
|
2540
2686
|
// src/HeadingAnalyzer.tsx
|
2541
2687
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2542
|
-
var
|
2543
|
-
var
|
2688
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
2689
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2544
2690
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2545
2691
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2546
2692
|
var getOutline = ({ frame } = {}) => {
|
@@ -2595,8 +2741,8 @@ function buildHierarchy(frame) {
|
|
2595
2741
|
var usePuck = (0, import_puck.createUsePuck)();
|
2596
2742
|
var HeadingAnalyzer = () => {
|
2597
2743
|
const data = usePuck((s) => s.appState.data);
|
2598
|
-
const [hierarchy, setHierarchy] = (0,
|
2599
|
-
(0,
|
2744
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
2745
|
+
(0, import_react11.useEffect)(() => {
|
2600
2746
|
const frame = getFrame();
|
2601
2747
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2602
2748
|
const createHierarchy = () => {
|
@@ -2631,11 +2777,11 @@ var HeadingAnalyzer = () => {
|
|
2631
2777
|
frameObserver.disconnect();
|
2632
2778
|
};
|
2633
2779
|
}, [data]);
|
2634
|
-
return /* @__PURE__ */ (0,
|
2635
|
-
/* @__PURE__ */ (0,
|
2780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
2636
2782
|
"small",
|
2637
2783
|
{
|
2638
|
-
className:
|
2784
|
+
className: getClassName5("cssWarning"),
|
2639
2785
|
style: {
|
2640
2786
|
color: "var(--puck-color-red-04)",
|
2641
2787
|
display: "block",
|
@@ -2644,19 +2790,19 @@ var HeadingAnalyzer = () => {
|
|
2644
2790
|
children: [
|
2645
2791
|
"Heading analyzer styles not loaded. Please review the",
|
2646
2792
|
" ",
|
2647
|
-
/* @__PURE__ */ (0,
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2648
2794
|
"."
|
2649
2795
|
]
|
2650
2796
|
}
|
2651
2797
|
),
|
2652
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2653
|
-
/* @__PURE__ */ (0,
|
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)(
|
2654
2800
|
ReactFromJSON,
|
2655
2801
|
{
|
2656
2802
|
mapping: {
|
2657
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2658
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2659
|
-
/* @__PURE__ */ (0,
|
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)(
|
2660
2806
|
"small",
|
2661
2807
|
{
|
2662
2808
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2674,14 +2820,14 @@ var HeadingAnalyzer = () => {
|
|
2674
2820
|
}, 2e3);
|
2675
2821
|
}
|
2676
2822
|
},
|
2677
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2678
|
-
/* @__PURE__ */ (0,
|
2823
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2679
2825
|
"H",
|
2680
2826
|
props.rank
|
2681
2827
|
] }),
|
2682
2828
|
": Missing"
|
2683
|
-
] }) : /* @__PURE__ */ (0,
|
2684
|
-
/* @__PURE__ */ (0,
|
2829
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2685
2831
|
"H",
|
2686
2832
|
props.rank
|
2687
2833
|
] }),
|
@@ -2690,7 +2836,7 @@ var HeadingAnalyzer = () => {
|
|
2690
2836
|
] })
|
2691
2837
|
}
|
2692
2838
|
) }),
|
2693
|
-
/* @__PURE__ */ (0,
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
2694
2840
|
] })
|
2695
2841
|
},
|
2696
2842
|
entry: {
|
@@ -2711,10 +2857,12 @@ var HeadingAnalyzer = () => {
|
|
2711
2857
|
] });
|
2712
2858
|
};
|
2713
2859
|
var headingAnalyzer = {
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
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
|
+
}
|
2718
2866
|
};
|
2719
2867
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2720
2868
|
/*! Bundled license information:
|
@@ -2758,7 +2906,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2758
2906
|
* See the LICENSE file in the root directory of this source tree.
|
2759
2907
|
*)
|
2760
2908
|
|
2761
|
-
lucide-react/dist/esm/icons/
|
2909
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
2762
2910
|
(**
|
2763
2911
|
* @license lucide-react v0.468.0 - ISC
|
2764
2912
|
*
|