@measured/puck-plugin-heading-analyzer 0.21.0-canary.c0db75c1 → 0.21.0-canary.c78dc826
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 +207 -19
- package/dist/index.d.ts +207 -19
- package/dist/index.js +246 -91
- package/dist/index.mjs +243 -88
- 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();
|
|
@@ -1041,7 +1006,9 @@ var replaceAction = (state, action, appStore) => {
|
|
|
1041
1006
|
});
|
|
1042
1007
|
});
|
|
1043
1008
|
});
|
|
1044
|
-
const stateWithDeepSlotsRemoved = __spreadValues({}, state)
|
|
1009
|
+
const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
|
|
1010
|
+
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
1011
|
+
});
|
|
1045
1012
|
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
|
1046
1013
|
const id = zoneCompound.split(":")[0];
|
|
1047
1014
|
if (id === originalId) {
|
|
@@ -1443,8 +1410,7 @@ init_react_import();
|
|
|
1443
1410
|
var defaultViewports = [
|
|
1444
1411
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
1445
1412
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
1446
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1447
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
|
1413
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
|
1448
1414
|
];
|
|
1449
1415
|
|
|
1450
1416
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
|
@@ -1554,9 +1520,9 @@ function debounce(func, timeout = 300) {
|
|
|
1554
1520
|
var tidyState = (state) => {
|
|
1555
1521
|
return __spreadProps(__spreadValues({}, state), {
|
|
1556
1522
|
ui: __spreadProps(__spreadValues({}, state.ui), {
|
|
1557
|
-
field: {
|
|
1523
|
+
field: __spreadProps(__spreadValues({}, state.ui.field), {
|
|
1558
1524
|
focus: null
|
|
1559
|
-
}
|
|
1525
|
+
})
|
|
1560
1526
|
})
|
|
1561
1527
|
});
|
|
1562
1528
|
};
|
|
@@ -2349,8 +2315,7 @@ var defaultAppState = {
|
|
|
2349
2315
|
options: [],
|
|
2350
2316
|
controlsVisible: true
|
|
2351
2317
|
},
|
|
2352
|
-
field: { focus: null }
|
|
2353
|
-
plugin: { current: null }
|
|
2318
|
+
field: { focus: null }
|
|
2354
2319
|
},
|
|
2355
2320
|
indexes: {
|
|
2356
2321
|
nodes: {},
|
|
@@ -2366,7 +2331,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2366
2331
|
subscribeWithSelector((set, get) => {
|
|
2367
2332
|
var _a, _b;
|
|
2368
2333
|
return __spreadProps(__spreadValues({
|
|
2369
|
-
instanceId: generateId(),
|
|
2370
2334
|
state: defaultAppState,
|
|
2371
2335
|
config: { components: {} },
|
|
2372
2336
|
componentState: {},
|
|
@@ -2537,14 +2501,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2537
2501
|
})
|
|
2538
2502
|
);
|
|
2539
2503
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
|
2504
|
+
function useAppStore(selector) {
|
|
2505
|
+
const context = (0, import_react9.useContext)(appStoreContext);
|
|
2506
|
+
return useStore(context, selector);
|
|
2507
|
+
}
|
|
2508
|
+
function useAppStoreApi() {
|
|
2509
|
+
return (0, import_react9.useContext)(appStoreContext);
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
// ../core/lib/use-breadcrumbs.ts
|
|
2513
|
+
var useBreadcrumbs = (renderCount) => {
|
|
2514
|
+
const selectedId = useAppStore((s) => {
|
|
2515
|
+
var _a;
|
|
2516
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
2517
|
+
});
|
|
2518
|
+
const config = useAppStore((s) => s.config);
|
|
2519
|
+
const path = useAppStore((s) => {
|
|
2520
|
+
var _a;
|
|
2521
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
2522
|
+
});
|
|
2523
|
+
const appStore = useAppStoreApi();
|
|
2524
|
+
return (0, import_react10.useMemo)(() => {
|
|
2525
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
2526
|
+
var _a, _b, _c;
|
|
2527
|
+
const [componentId] = zoneCompound.split(":");
|
|
2528
|
+
if (componentId === "root") {
|
|
2529
|
+
return {
|
|
2530
|
+
label: "Page",
|
|
2531
|
+
selector: null
|
|
2532
|
+
};
|
|
2533
|
+
}
|
|
2534
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
2535
|
+
const parentId = node.path[node.path.length - 1];
|
|
2536
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
2537
|
+
const index = contentIds.indexOf(componentId);
|
|
2538
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
2539
|
+
return {
|
|
2540
|
+
label,
|
|
2541
|
+
selector: node ? {
|
|
2542
|
+
index,
|
|
2543
|
+
zone: node.path[node.path.length - 1]
|
|
2544
|
+
} : null
|
|
2545
|
+
};
|
|
2546
|
+
})) || [];
|
|
2547
|
+
if (renderCount) {
|
|
2548
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
2549
|
+
}
|
|
2550
|
+
return breadcrumbs;
|
|
2551
|
+
}, [path, renderCount]);
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2554
|
+
// ../core/components/Loader/index.tsx
|
|
2555
|
+
init_react_import();
|
|
2556
|
+
|
|
2557
|
+
// ../core/lib/index.ts
|
|
2558
|
+
init_react_import();
|
|
2559
|
+
|
|
2560
|
+
// ../core/lib/filter.ts
|
|
2561
|
+
init_react_import();
|
|
2562
|
+
|
|
2563
|
+
// ../core/lib/data/reorder.ts
|
|
2564
|
+
init_react_import();
|
|
2565
|
+
|
|
2566
|
+
// ../core/lib/data/replace.ts
|
|
2567
|
+
init_react_import();
|
|
2568
|
+
|
|
2569
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
|
2570
|
+
init_react_import();
|
|
2540
2571
|
|
|
2541
2572
|
// ../core/lib/get-zoom-config.ts
|
|
2542
2573
|
init_react_import();
|
|
2543
2574
|
|
|
2575
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
|
2576
|
+
init_react_import();
|
|
2577
|
+
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
2578
|
+
|
|
2579
|
+
// ../core/components/Loader/index.tsx
|
|
2580
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2581
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
|
2582
|
+
var Loader = (_a) => {
|
|
2583
|
+
var _b = _a, {
|
|
2584
|
+
color,
|
|
2585
|
+
size = 16
|
|
2586
|
+
} = _b, props = __objRest(_b, [
|
|
2587
|
+
"color",
|
|
2588
|
+
"size"
|
|
2589
|
+
]);
|
|
2590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2591
|
+
"span",
|
|
2592
|
+
__spreadValues({
|
|
2593
|
+
className: getClassName2(),
|
|
2594
|
+
style: {
|
|
2595
|
+
width: size,
|
|
2596
|
+
height: size,
|
|
2597
|
+
color
|
|
2598
|
+
},
|
|
2599
|
+
"aria-label": "loading"
|
|
2600
|
+
}, props)
|
|
2601
|
+
);
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2604
|
+
// ../core/components/SidebarSection/index.tsx
|
|
2605
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2606
|
+
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
|
2607
|
+
var SidebarSection = ({
|
|
2608
|
+
children,
|
|
2609
|
+
title,
|
|
2610
|
+
background,
|
|
2611
|
+
showBreadcrumbs,
|
|
2612
|
+
noBorderTop,
|
|
2613
|
+
noPadding,
|
|
2614
|
+
isLoading
|
|
2615
|
+
}) => {
|
|
2616
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
2617
|
+
const breadcrumbs = useBreadcrumbs(1);
|
|
2618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2619
|
+
"div",
|
|
2620
|
+
{
|
|
2621
|
+
className: getClassName3({ noBorderTop, noPadding }),
|
|
2622
|
+
style: { background },
|
|
2623
|
+
children: [
|
|
2624
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
|
2625
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2627
|
+
"button",
|
|
2628
|
+
{
|
|
2629
|
+
type: "button",
|
|
2630
|
+
className: getClassName3("breadcrumbLabel"),
|
|
2631
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
2632
|
+
children: breadcrumb.label
|
|
2633
|
+
}
|
|
2634
|
+
),
|
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
|
2636
|
+
] }, i)) : null,
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
|
2638
|
+
] }) }),
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
|
2640
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
|
2641
|
+
]
|
|
2642
|
+
}
|
|
2643
|
+
);
|
|
2644
|
+
};
|
|
2645
|
+
|
|
2646
|
+
// ../core/components/OutlineList/index.tsx
|
|
2647
|
+
init_react_import();
|
|
2648
|
+
|
|
2649
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
2650
|
+
init_react_import();
|
|
2651
|
+
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
2652
|
+
|
|
2653
|
+
// ../core/components/OutlineList/index.tsx
|
|
2654
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2655
|
+
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
|
2656
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
|
2657
|
+
var OutlineList = ({ children }) => {
|
|
2658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
|
2659
|
+
};
|
|
2660
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
|
2661
|
+
OutlineList.Item = ({
|
|
2662
|
+
children,
|
|
2663
|
+
onClick
|
|
2664
|
+
}) => {
|
|
2665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2666
|
+
"li",
|
|
2667
|
+
{
|
|
2668
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
|
2669
|
+
onClick,
|
|
2670
|
+
children
|
|
2671
|
+
}
|
|
2672
|
+
);
|
|
2673
|
+
};
|
|
2674
|
+
|
|
2675
|
+
// ../core/lib/scroll-into-view.ts
|
|
2676
|
+
init_react_import();
|
|
2677
|
+
var scrollIntoView = (el) => {
|
|
2678
|
+
const oldStyle = __spreadValues({}, el.style);
|
|
2679
|
+
el.style.scrollMargin = "256px";
|
|
2680
|
+
if (el) {
|
|
2681
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
2682
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
2683
|
+
}
|
|
2684
|
+
};
|
|
2685
|
+
|
|
2686
|
+
// ../core/lib/get-frame.ts
|
|
2687
|
+
init_react_import();
|
|
2688
|
+
var getFrame = () => {
|
|
2689
|
+
if (typeof window === "undefined") return;
|
|
2690
|
+
let frameEl = document.querySelector("#preview-frame");
|
|
2691
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
2692
|
+
return frameEl.contentDocument || document;
|
|
2693
|
+
}
|
|
2694
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
2695
|
+
};
|
|
2696
|
+
|
|
2544
2697
|
// src/HeadingAnalyzer.tsx
|
|
2545
2698
|
var import_react_from_json = __toESM(require("react-from-json"));
|
|
2546
|
-
var
|
|
2547
|
-
var
|
|
2699
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2700
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
|
2548
2701
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
|
2549
2702
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
|
2550
2703
|
var getOutline = ({ frame } = {}) => {
|
|
@@ -2599,8 +2752,8 @@ function buildHierarchy(frame) {
|
|
|
2599
2752
|
var usePuck = (0, import_puck.createUsePuck)();
|
|
2600
2753
|
var HeadingAnalyzer = () => {
|
|
2601
2754
|
const data = usePuck((s) => s.appState.data);
|
|
2602
|
-
const [hierarchy, setHierarchy] = (0,
|
|
2603
|
-
(0,
|
|
2755
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
|
2756
|
+
(0, import_react11.useEffect)(() => {
|
|
2604
2757
|
const frame = getFrame();
|
|
2605
2758
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
|
2606
2759
|
const createHierarchy = () => {
|
|
@@ -2635,11 +2788,11 @@ var HeadingAnalyzer = () => {
|
|
|
2635
2788
|
frameObserver.disconnect();
|
|
2636
2789
|
};
|
|
2637
2790
|
}, [data]);
|
|
2638
|
-
return /* @__PURE__ */ (0,
|
|
2639
|
-
/* @__PURE__ */ (0,
|
|
2791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
|
2792
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2640
2793
|
"small",
|
|
2641
2794
|
{
|
|
2642
|
-
className:
|
|
2795
|
+
className: getClassName5("cssWarning"),
|
|
2643
2796
|
style: {
|
|
2644
2797
|
color: "var(--puck-color-red-04)",
|
|
2645
2798
|
display: "block",
|
|
@@ -2648,19 +2801,19 @@ var HeadingAnalyzer = () => {
|
|
|
2648
2801
|
children: [
|
|
2649
2802
|
"Heading analyzer styles not loaded. Please review the",
|
|
2650
2803
|
" ",
|
|
2651
|
-
/* @__PURE__ */ (0,
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
|
2652
2805
|
"."
|
|
2653
2806
|
]
|
|
2654
2807
|
}
|
|
2655
2808
|
),
|
|
2656
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
|
2657
|
-
/* @__PURE__ */ (0,
|
|
2809
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2658
2811
|
ReactFromJSON,
|
|
2659
2812
|
{
|
|
2660
2813
|
mapping: {
|
|
2661
|
-
Root: (props) => /* @__PURE__ */ (0,
|
|
2662
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
|
2663
|
-
/* @__PURE__ */ (0,
|
|
2814
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
|
|
2815
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2664
2817
|
"small",
|
|
2665
2818
|
{
|
|
2666
2819
|
className: getClassNameItem2({ missing: props.missing }),
|
|
@@ -2678,14 +2831,14 @@ var HeadingAnalyzer = () => {
|
|
|
2678
2831
|
}, 2e3);
|
|
2679
2832
|
}
|
|
2680
2833
|
},
|
|
2681
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
2834
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2835
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
|
2683
2836
|
"H",
|
|
2684
2837
|
props.rank
|
|
2685
2838
|
] }),
|
|
2686
2839
|
": Missing"
|
|
2687
|
-
] }) : /* @__PURE__ */ (0,
|
|
2688
|
-
/* @__PURE__ */ (0,
|
|
2840
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
|
2689
2842
|
"H",
|
|
2690
2843
|
props.rank
|
|
2691
2844
|
] }),
|
|
@@ -2694,7 +2847,7 @@ var HeadingAnalyzer = () => {
|
|
|
2694
2847
|
] })
|
|
2695
2848
|
}
|
|
2696
2849
|
) }),
|
|
2697
|
-
/* @__PURE__ */ (0,
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
|
2698
2851
|
] })
|
|
2699
2852
|
},
|
|
2700
2853
|
entry: {
|
|
@@ -2715,10 +2868,12 @@ var HeadingAnalyzer = () => {
|
|
|
2715
2868
|
] });
|
|
2716
2869
|
};
|
|
2717
2870
|
var headingAnalyzer = {
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2871
|
+
overrides: {
|
|
2872
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2873
|
+
children,
|
|
2874
|
+
/* @__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, {}) }) })
|
|
2875
|
+
] })
|
|
2876
|
+
}
|
|
2722
2877
|
};
|
|
2723
2878
|
var HeadingAnalyzer_default = headingAnalyzer;
|
|
2724
2879
|
/*! Bundled license information:
|
|
@@ -2734,7 +2889,7 @@ lucide-react/dist/esm/shared/src/utils.js:
|
|
|
2734
2889
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2735
2890
|
lucide-react/dist/esm/Icon.js:
|
|
2736
2891
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2737
|
-
lucide-react/dist/esm/icons/
|
|
2892
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
|
2738
2893
|
lucide-react/dist/esm/lucide-react.js:
|
|
2739
2894
|
(**
|
|
2740
2895
|
* @license lucide-react v0.468.0 - ISC
|