@measured/puck-plugin-heading-analyzer 0.21.0-canary.38e79ba8 → 0.21.0-canary.41d0882b
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 +5 -149
- package/dist/index.d.mts +219 -10
- package/dist/index.d.ts +219 -10
- package/dist/index.js +120 -247
- package/dist/index.mjs +117 -244
- package/package.json +2 -2
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": "
|
|
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/
|
|
277
|
+
// ../core/components/OutlineList/index.tsx
|
|
278
278
|
init_react_import();
|
|
279
279
|
|
|
280
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
|
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 = { "
|
|
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/
|
|
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("
|
|
321
|
-
var
|
|
322
|
-
|
|
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
|
-
|
|
324
|
+
"li",
|
|
325
325
|
{
|
|
326
|
-
className:
|
|
327
|
-
|
|
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/
|
|
442
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
|
422
443
|
init_react_import();
|
|
423
|
-
var
|
|
424
|
-
["path", { d: "
|
|
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/
|
|
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
|
|
|
@@ -994,7 +1048,9 @@ var replaceAction = (state, action, appStore) => {
|
|
|
994
1048
|
});
|
|
995
1049
|
});
|
|
996
1050
|
});
|
|
997
|
-
const stateWithDeepSlotsRemoved = __spreadValues({}, state)
|
|
1051
|
+
const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
|
|
1052
|
+
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
1053
|
+
});
|
|
998
1054
|
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
|
999
1055
|
const id = zoneCompound.split(":")[0];
|
|
1000
1056
|
if (id === originalId) {
|
|
@@ -1396,7 +1452,8 @@ init_react_import();
|
|
|
1396
1452
|
var defaultViewports = [
|
|
1397
1453
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
|
1398
1454
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
|
1399
|
-
{ 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" }
|
|
1400
1457
|
];
|
|
1401
1458
|
|
|
1402
1459
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
|
@@ -1506,9 +1563,9 @@ function debounce(func, timeout = 300) {
|
|
|
1506
1563
|
var tidyState = (state) => {
|
|
1507
1564
|
return __spreadProps(__spreadValues({}, state), {
|
|
1508
1565
|
ui: __spreadProps(__spreadValues({}, state.ui), {
|
|
1509
|
-
field: {
|
|
1566
|
+
field: __spreadProps(__spreadValues({}, state.ui.field), {
|
|
1510
1567
|
focus: null
|
|
1511
|
-
}
|
|
1568
|
+
})
|
|
1512
1569
|
})
|
|
1513
1570
|
});
|
|
1514
1571
|
};
|
|
@@ -2301,7 +2358,8 @@ var defaultAppState = {
|
|
|
2301
2358
|
options: [],
|
|
2302
2359
|
controlsVisible: true
|
|
2303
2360
|
},
|
|
2304
|
-
field: { focus: null }
|
|
2361
|
+
field: { focus: null },
|
|
2362
|
+
plugin: { current: null }
|
|
2305
2363
|
},
|
|
2306
2364
|
indexes: {
|
|
2307
2365
|
nodes: {},
|
|
@@ -2317,6 +2375,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2317
2375
|
subscribeWithSelector((set, get) => {
|
|
2318
2376
|
var _a, _b;
|
|
2319
2377
|
return __spreadProps(__spreadValues({
|
|
2378
|
+
instanceId: generateId(),
|
|
2320
2379
|
state: defaultAppState,
|
|
2321
2380
|
config: { components: {} },
|
|
2322
2381
|
componentState: {},
|
|
@@ -2337,6 +2396,11 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2337
2396
|
history: createHistorySlice(set, get),
|
|
2338
2397
|
nodes: createNodesSlice(set, get),
|
|
2339
2398
|
permissions: createPermissionsSlice(set, get),
|
|
2399
|
+
getCurrentData: () => {
|
|
2400
|
+
var _a2;
|
|
2401
|
+
const s = get();
|
|
2402
|
+
return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
|
|
2403
|
+
},
|
|
2340
2404
|
getComponentConfig: (type) => {
|
|
2341
2405
|
var _a2;
|
|
2342
2406
|
const { config, selectedItem } = get();
|
|
@@ -2487,203 +2551,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2487
2551
|
})
|
|
2488
2552
|
);
|
|
2489
2553
|
var appStoreContext = createContext(createAppStore());
|
|
2490
|
-
function useAppStore(selector) {
|
|
2491
|
-
const context = useContext(appStoreContext);
|
|
2492
|
-
return useStore(context, selector);
|
|
2493
|
-
}
|
|
2494
|
-
function useAppStoreApi() {
|
|
2495
|
-
return useContext(appStoreContext);
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
// ../core/lib/use-breadcrumbs.ts
|
|
2499
|
-
var useBreadcrumbs = (renderCount) => {
|
|
2500
|
-
const selectedId = useAppStore((s) => {
|
|
2501
|
-
var _a;
|
|
2502
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
2503
|
-
});
|
|
2504
|
-
const config = useAppStore((s) => s.config);
|
|
2505
|
-
const path = useAppStore((s) => {
|
|
2506
|
-
var _a;
|
|
2507
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
2508
|
-
});
|
|
2509
|
-
const appStore = useAppStoreApi();
|
|
2510
|
-
return useMemo(() => {
|
|
2511
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
2512
|
-
var _a, _b, _c;
|
|
2513
|
-
const [componentId] = zoneCompound.split(":");
|
|
2514
|
-
if (componentId === "root") {
|
|
2515
|
-
return {
|
|
2516
|
-
label: "Page",
|
|
2517
|
-
selector: null
|
|
2518
|
-
};
|
|
2519
|
-
}
|
|
2520
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
|
2521
|
-
const parentId = node.path[node.path.length - 1];
|
|
2522
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
|
2523
|
-
const index = contentIds.indexOf(componentId);
|
|
2524
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
|
2525
|
-
return {
|
|
2526
|
-
label,
|
|
2527
|
-
selector: node ? {
|
|
2528
|
-
index,
|
|
2529
|
-
zone: node.path[node.path.length - 1]
|
|
2530
|
-
} : null
|
|
2531
|
-
};
|
|
2532
|
-
})) || [];
|
|
2533
|
-
if (renderCount) {
|
|
2534
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
|
2535
|
-
}
|
|
2536
|
-
return breadcrumbs;
|
|
2537
|
-
}, [path, renderCount]);
|
|
2538
|
-
};
|
|
2539
|
-
|
|
2540
|
-
// ../core/components/Loader/index.tsx
|
|
2541
|
-
init_react_import();
|
|
2542
|
-
|
|
2543
|
-
// ../core/lib/index.ts
|
|
2544
|
-
init_react_import();
|
|
2545
|
-
|
|
2546
|
-
// ../core/lib/filter.ts
|
|
2547
|
-
init_react_import();
|
|
2548
|
-
|
|
2549
|
-
// ../core/lib/data/reorder.ts
|
|
2550
|
-
init_react_import();
|
|
2551
|
-
|
|
2552
|
-
// ../core/lib/data/replace.ts
|
|
2553
|
-
init_react_import();
|
|
2554
|
-
|
|
2555
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
|
2556
|
-
init_react_import();
|
|
2557
2554
|
|
|
2558
2555
|
// ../core/lib/get-zoom-config.ts
|
|
2559
2556
|
init_react_import();
|
|
2560
2557
|
|
|
2561
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
|
2562
|
-
init_react_import();
|
|
2563
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
2564
|
-
|
|
2565
|
-
// ../core/components/Loader/index.tsx
|
|
2566
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2567
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
|
2568
|
-
var Loader = (_a) => {
|
|
2569
|
-
var _b = _a, {
|
|
2570
|
-
color,
|
|
2571
|
-
size = 16
|
|
2572
|
-
} = _b, props = __objRest(_b, [
|
|
2573
|
-
"color",
|
|
2574
|
-
"size"
|
|
2575
|
-
]);
|
|
2576
|
-
return /* @__PURE__ */ jsx2(
|
|
2577
|
-
"span",
|
|
2578
|
-
__spreadValues({
|
|
2579
|
-
className: getClassName2(),
|
|
2580
|
-
style: {
|
|
2581
|
-
width: size,
|
|
2582
|
-
height: size,
|
|
2583
|
-
color
|
|
2584
|
-
},
|
|
2585
|
-
"aria-label": "loading"
|
|
2586
|
-
}, props)
|
|
2587
|
-
);
|
|
2588
|
-
};
|
|
2589
|
-
|
|
2590
|
-
// ../core/components/SidebarSection/index.tsx
|
|
2591
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
2592
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
|
2593
|
-
var SidebarSection = ({
|
|
2594
|
-
children,
|
|
2595
|
-
title,
|
|
2596
|
-
background,
|
|
2597
|
-
showBreadcrumbs,
|
|
2598
|
-
noBorderTop,
|
|
2599
|
-
noPadding,
|
|
2600
|
-
isLoading
|
|
2601
|
-
}) => {
|
|
2602
|
-
const setUi = useAppStore((s) => s.setUi);
|
|
2603
|
-
const breadcrumbs = useBreadcrumbs(1);
|
|
2604
|
-
return /* @__PURE__ */ jsxs(
|
|
2605
|
-
"div",
|
|
2606
|
-
{
|
|
2607
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
|
2608
|
-
style: { background },
|
|
2609
|
-
children: [
|
|
2610
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
|
2611
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
|
2612
|
-
/* @__PURE__ */ jsx3(
|
|
2613
|
-
"button",
|
|
2614
|
-
{
|
|
2615
|
-
type: "button",
|
|
2616
|
-
className: getClassName3("breadcrumbLabel"),
|
|
2617
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
2618
|
-
children: breadcrumb.label
|
|
2619
|
-
}
|
|
2620
|
-
),
|
|
2621
|
-
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
|
2622
|
-
] }, i)) : null,
|
|
2623
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
|
2624
|
-
] }) }),
|
|
2625
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
|
2626
|
-
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
|
2627
|
-
]
|
|
2628
|
-
}
|
|
2629
|
-
);
|
|
2630
|
-
};
|
|
2631
|
-
|
|
2632
|
-
// ../core/components/OutlineList/index.tsx
|
|
2633
|
-
init_react_import();
|
|
2634
|
-
|
|
2635
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
|
2636
|
-
init_react_import();
|
|
2637
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
|
2638
|
-
|
|
2639
|
-
// ../core/components/OutlineList/index.tsx
|
|
2640
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2641
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
|
2642
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
|
2643
|
-
var OutlineList = ({ children }) => {
|
|
2644
|
-
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
|
2645
|
-
};
|
|
2646
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
|
2647
|
-
OutlineList.Item = ({
|
|
2648
|
-
children,
|
|
2649
|
-
onClick
|
|
2650
|
-
}) => {
|
|
2651
|
-
return /* @__PURE__ */ jsx4(
|
|
2652
|
-
"li",
|
|
2653
|
-
{
|
|
2654
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
|
2655
|
-
onClick,
|
|
2656
|
-
children
|
|
2657
|
-
}
|
|
2658
|
-
);
|
|
2659
|
-
};
|
|
2660
|
-
|
|
2661
|
-
// ../core/lib/scroll-into-view.ts
|
|
2662
|
-
init_react_import();
|
|
2663
|
-
var scrollIntoView = (el) => {
|
|
2664
|
-
const oldStyle = __spreadValues({}, el.style);
|
|
2665
|
-
el.style.scrollMargin = "256px";
|
|
2666
|
-
if (el) {
|
|
2667
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
|
2668
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
|
2669
|
-
}
|
|
2670
|
-
};
|
|
2671
|
-
|
|
2672
|
-
// ../core/lib/get-frame.ts
|
|
2673
|
-
init_react_import();
|
|
2674
|
-
var getFrame = () => {
|
|
2675
|
-
if (typeof window === "undefined") return;
|
|
2676
|
-
let frameEl = document.querySelector("#preview-frame");
|
|
2677
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
|
2678
|
-
return frameEl.contentDocument || document;
|
|
2679
|
-
}
|
|
2680
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
|
2681
|
-
};
|
|
2682
|
-
|
|
2683
2558
|
// src/HeadingAnalyzer.tsx
|
|
2684
2559
|
import ReactFromJSONModule from "react-from-json";
|
|
2685
|
-
import { Fragment, jsx as
|
|
2686
|
-
var
|
|
2560
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
2561
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
|
2687
2562
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
|
2688
2563
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
|
2689
2564
|
var getOutline = ({ frame } = {}) => {
|
|
@@ -2774,11 +2649,11 @@ var HeadingAnalyzer = () => {
|
|
|
2774
2649
|
frameObserver.disconnect();
|
|
2775
2650
|
};
|
|
2776
2651
|
}, [data]);
|
|
2777
|
-
return /* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2652
|
+
return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
|
|
2653
|
+
/* @__PURE__ */ jsxs(
|
|
2779
2654
|
"small",
|
|
2780
2655
|
{
|
|
2781
|
-
className:
|
|
2656
|
+
className: getClassName2("cssWarning"),
|
|
2782
2657
|
style: {
|
|
2783
2658
|
color: "var(--puck-color-red-04)",
|
|
2784
2659
|
display: "block",
|
|
@@ -2787,19 +2662,19 @@ var HeadingAnalyzer = () => {
|
|
|
2787
2662
|
children: [
|
|
2788
2663
|
"Heading analyzer styles not loaded. Please review the",
|
|
2789
2664
|
" ",
|
|
2790
|
-
/* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
|
2791
2666
|
"."
|
|
2792
2667
|
]
|
|
2793
2668
|
}
|
|
2794
2669
|
),
|
|
2795
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2670
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
|
|
2671
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
|
|
2797
2672
|
ReactFromJSON,
|
|
2798
2673
|
{
|
|
2799
2674
|
mapping: {
|
|
2800
|
-
Root: (props) => /* @__PURE__ */
|
|
2801
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
|
2802
|
-
/* @__PURE__ */
|
|
2675
|
+
Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
|
|
2676
|
+
OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
|
|
2677
|
+
/* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
|
|
2803
2678
|
"small",
|
|
2804
2679
|
{
|
|
2805
2680
|
className: getClassNameItem2({ missing: props.missing }),
|
|
@@ -2817,14 +2692,14 @@ var HeadingAnalyzer = () => {
|
|
|
2817
2692
|
}, 2e3);
|
|
2818
2693
|
}
|
|
2819
2694
|
},
|
|
2820
|
-
children: props.missing ? /* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
2695
|
+
children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2696
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
2822
2697
|
"H",
|
|
2823
2698
|
props.rank
|
|
2824
2699
|
] }),
|
|
2825
2700
|
": Missing"
|
|
2826
|
-
] }) : /* @__PURE__ */
|
|
2827
|
-
/* @__PURE__ */
|
|
2701
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2702
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
2828
2703
|
"H",
|
|
2829
2704
|
props.rank
|
|
2830
2705
|
] }),
|
|
@@ -2833,7 +2708,7 @@ var HeadingAnalyzer = () => {
|
|
|
2833
2708
|
] })
|
|
2834
2709
|
}
|
|
2835
2710
|
) }),
|
|
2836
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: props.children })
|
|
2837
2712
|
] })
|
|
2838
2713
|
},
|
|
2839
2714
|
entry: {
|
|
@@ -2854,12 +2729,10 @@ var HeadingAnalyzer = () => {
|
|
|
2854
2729
|
] });
|
|
2855
2730
|
};
|
|
2856
2731
|
var headingAnalyzer = {
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
] })
|
|
2862
|
-
}
|
|
2732
|
+
name: "heading-analyzer",
|
|
2733
|
+
label: "Audit",
|
|
2734
|
+
render: HeadingAnalyzer,
|
|
2735
|
+
icon: /* @__PURE__ */ jsx2(Heading1, {})
|
|
2863
2736
|
};
|
|
2864
2737
|
var HeadingAnalyzer_default = headingAnalyzer;
|
|
2865
2738
|
export {
|
|
@@ -2878,7 +2751,7 @@ lucide-react/dist/esm/shared/src/utils.js:
|
|
|
2878
2751
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2879
2752
|
lucide-react/dist/esm/Icon.js:
|
|
2880
2753
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2881
|
-
lucide-react/dist/esm/icons/
|
|
2754
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
|
2882
2755
|
lucide-react/dist/esm/lucide-react.js:
|
|
2883
2756
|
(**
|
|
2884
2757
|
* @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.
|
|
3
|
+
"version": "0.21.0-canary.41d0882b",
|
|
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.
|
|
28
|
+
"@measured/puck": "^0.21.0-canary.41d0882b",
|
|
29
29
|
"@types/minimatch": "3.0.5",
|
|
30
30
|
"@types/react": "^19.0.1",
|
|
31
31
|
"@types/react-dom": "^19.0.2",
|