@measured/puck-plugin-heading-analyzer 0.20.0-canary.d405985b → 0.20.0-canary.f2447833
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 +0 -145
- package/dist/index.d.mts +48 -3
- package/dist/index.d.ts +48 -3
- package/dist/index.js +155 -279
- package/dist/index.mjs +152 -276
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -310,12 +310,12 @@ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v
|
|
310
310
|
// src/HeadingAnalyzer.tsx
|
311
311
|
import { createUsePuck } from "@measured/puck";
|
312
312
|
|
313
|
-
// ../core/components/
|
313
|
+
// ../core/components/OutlineList/index.tsx
|
314
314
|
init_react_import();
|
315
315
|
|
316
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
316
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
317
317
|
init_react_import();
|
318
|
-
var styles_module_default = { "
|
318
|
+
var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
319
319
|
|
320
320
|
// ../core/lib/get-class-name-factory.ts
|
321
321
|
init_react_import();
|
@@ -344,29 +344,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
344
344
|
};
|
345
345
|
var get_class_name_factory_default = getClassNameFactory;
|
346
346
|
|
347
|
-
// ../core/components/
|
348
|
-
init_react_import();
|
349
|
-
|
350
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
351
|
-
init_react_import();
|
352
|
-
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" };
|
353
|
-
|
354
|
-
// ../core/components/Heading/index.tsx
|
347
|
+
// ../core/components/OutlineList/index.tsx
|
355
348
|
import { jsx } from "react/jsx-runtime";
|
356
|
-
var getClassName = get_class_name_factory_default("
|
357
|
-
var
|
358
|
-
|
349
|
+
var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
|
350
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
|
351
|
+
var OutlineList = ({ children }) => {
|
352
|
+
return /* @__PURE__ */ jsx("ul", { className: getClassName(), children });
|
353
|
+
};
|
354
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassNameItem({ clickable: true }), children });
|
355
|
+
OutlineList.Item = ({
|
356
|
+
children,
|
357
|
+
onClick
|
358
|
+
}) => {
|
359
359
|
return /* @__PURE__ */ jsx(
|
360
|
-
|
360
|
+
"li",
|
361
361
|
{
|
362
|
-
className:
|
363
|
-
|
364
|
-
}),
|
362
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
363
|
+
onClick,
|
365
364
|
children
|
366
365
|
}
|
367
366
|
);
|
368
367
|
};
|
369
368
|
|
369
|
+
// ../core/lib/scroll-into-view.ts
|
370
|
+
init_react_import();
|
371
|
+
var scrollIntoView = (el) => {
|
372
|
+
const oldStyle = __spreadValues({}, el.style);
|
373
|
+
el.style.scrollMargin = "256px";
|
374
|
+
if (el) {
|
375
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
376
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
377
|
+
}
|
378
|
+
};
|
379
|
+
|
380
|
+
// ../core/lib/get-frame.ts
|
381
|
+
init_react_import();
|
382
|
+
var getFrame = () => {
|
383
|
+
if (typeof window === "undefined") return;
|
384
|
+
let frameEl = document.querySelector("#preview-frame");
|
385
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
386
|
+
return frameEl.contentDocument || document;
|
387
|
+
}
|
388
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
389
|
+
};
|
390
|
+
|
370
391
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
371
392
|
init_react_import();
|
372
393
|
|
@@ -454,15 +475,29 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
454
475
|
return Component;
|
455
476
|
};
|
456
477
|
|
457
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
478
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
458
479
|
init_react_import();
|
459
|
-
var
|
460
|
-
["path", { d: "
|
480
|
+
var Heading1 = createLucideIcon("Heading1", [
|
481
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
482
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
483
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
484
|
+
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
461
485
|
]);
|
462
486
|
|
463
|
-
// ../core/lib/
|
487
|
+
// ../core/lib/index.ts
|
488
|
+
init_react_import();
|
489
|
+
|
490
|
+
// ../core/lib/filter.ts
|
491
|
+
init_react_import();
|
492
|
+
|
493
|
+
// ../core/lib/data/reorder.ts
|
494
|
+
init_react_import();
|
495
|
+
|
496
|
+
// ../core/lib/data/replace.ts
|
497
|
+
init_react_import();
|
498
|
+
|
499
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
464
500
|
init_react_import();
|
465
|
-
import { useMemo } from "react";
|
466
501
|
|
467
502
|
// ../core/store/index.ts
|
468
503
|
init_react_import();
|
@@ -509,7 +544,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
509
544
|
});
|
510
545
|
}
|
511
546
|
|
512
|
-
// ../core/lib/data/map-
|
547
|
+
// ../core/lib/data/map-fields.ts
|
513
548
|
init_react_import();
|
514
549
|
|
515
550
|
// ../core/lib/data/default-slots.ts
|
@@ -519,14 +554,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
519
554
|
value
|
520
555
|
);
|
521
556
|
|
522
|
-
// ../core/lib/data/map-
|
557
|
+
// ../core/lib/data/map-fields.ts
|
523
558
|
var isPromise = (v) => !!v && typeof v.then === "function";
|
524
559
|
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
525
560
|
var containsPromise = (arr) => arr.some(isPromise);
|
526
561
|
var walkField = ({
|
527
562
|
value,
|
528
563
|
fields,
|
529
|
-
|
564
|
+
mappers,
|
530
565
|
propKey = "",
|
531
566
|
propPath = "",
|
532
567
|
id = "",
|
@@ -534,7 +569,9 @@ var walkField = ({
|
|
534
569
|
recurseSlots = false
|
535
570
|
}) => {
|
536
571
|
var _a, _b, _c;
|
537
|
-
|
572
|
+
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
573
|
+
const map = mappers[fieldType];
|
574
|
+
if (map && fieldType === "slot") {
|
538
575
|
const content = value || [];
|
539
576
|
const mappedContent = recurseSlots ? content.map((el) => {
|
540
577
|
var _a2;
|
@@ -546,7 +583,7 @@ var walkField = ({
|
|
546
583
|
return walkField({
|
547
584
|
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
548
585
|
fields: fields2,
|
549
|
-
|
586
|
+
mappers,
|
550
587
|
id: el.props.id,
|
551
588
|
config,
|
552
589
|
recurseSlots
|
@@ -555,7 +592,21 @@ var walkField = ({
|
|
555
592
|
if (containsPromise(mappedContent)) {
|
556
593
|
return Promise.all(mappedContent);
|
557
594
|
}
|
558
|
-
return map(
|
595
|
+
return map({
|
596
|
+
value: mappedContent,
|
597
|
+
parentId: id,
|
598
|
+
propName: propKey,
|
599
|
+
field: fields[propKey],
|
600
|
+
propPath
|
601
|
+
});
|
602
|
+
} else if (map && fields[propKey]) {
|
603
|
+
return map({
|
604
|
+
value,
|
605
|
+
parentId: id,
|
606
|
+
propName: propKey,
|
607
|
+
field: fields[propKey],
|
608
|
+
propPath
|
609
|
+
});
|
559
610
|
}
|
560
611
|
if (value && typeof value === "object") {
|
561
612
|
if (Array.isArray(value)) {
|
@@ -565,7 +616,7 @@ var walkField = ({
|
|
565
616
|
(el, idx) => walkField({
|
566
617
|
value: el,
|
567
618
|
fields: arrayFields,
|
568
|
-
|
619
|
+
mappers,
|
569
620
|
propKey,
|
570
621
|
propPath: `${propPath}[${idx}]`,
|
571
622
|
id,
|
@@ -584,7 +635,7 @@ var walkField = ({
|
|
584
635
|
return walkObject({
|
585
636
|
value,
|
586
637
|
fields: objectFields,
|
587
|
-
|
638
|
+
mappers,
|
588
639
|
id,
|
589
640
|
getPropPath: (k) => `${propPath}.${k}`,
|
590
641
|
config,
|
@@ -597,7 +648,7 @@ var walkField = ({
|
|
597
648
|
var walkObject = ({
|
598
649
|
value,
|
599
650
|
fields,
|
600
|
-
|
651
|
+
mappers,
|
601
652
|
id,
|
602
653
|
getPropPath,
|
603
654
|
config,
|
@@ -607,7 +658,7 @@ var walkObject = ({
|
|
607
658
|
const opts = {
|
608
659
|
value: v,
|
609
660
|
fields,
|
610
|
-
|
661
|
+
mappers,
|
611
662
|
propKey: k,
|
612
663
|
propPath: getPropPath(k),
|
613
664
|
id,
|
@@ -629,14 +680,14 @@ var walkObject = ({
|
|
629
680
|
}
|
630
681
|
return flatten(newProps);
|
631
682
|
};
|
632
|
-
function
|
683
|
+
function mapFields(item, mappers, config, recurseSlots = false) {
|
633
684
|
var _a, _b, _c, _d, _e;
|
634
685
|
const itemType = "type" in item ? item.type : "root";
|
635
686
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
636
687
|
const newProps = walkObject({
|
637
688
|
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
638
689
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
639
|
-
|
690
|
+
mappers,
|
640
691
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
641
692
|
getPropPath: (k) => k,
|
642
693
|
config,
|
@@ -659,7 +710,7 @@ var import_flat = __toESM(require_flat());
|
|
659
710
|
// ../core/lib/data/strip-slots.ts
|
660
711
|
init_react_import();
|
661
712
|
var stripSlots = (data, config) => {
|
662
|
-
return
|
713
|
+
return mapFields(data, { slot: () => null }, config);
|
663
714
|
};
|
664
715
|
|
665
716
|
// ../core/lib/data/flatten-node.ts
|
@@ -712,18 +763,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
712
763
|
const mappedItem = mapNodeOrSkip(item, path, index);
|
713
764
|
if (!mappedItem) return item;
|
714
765
|
const id = mappedItem.props.id;
|
715
|
-
const newProps = __spreadProps(__spreadValues({},
|
766
|
+
const newProps = __spreadProps(__spreadValues({}, mapFields(
|
716
767
|
mappedItem,
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
768
|
+
{
|
769
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
770
|
+
const content = value;
|
771
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
772
|
+
const [_2, newContent2] = processContent(
|
773
|
+
path,
|
774
|
+
zoneCompound,
|
775
|
+
content,
|
776
|
+
"slot",
|
777
|
+
parentId2
|
778
|
+
);
|
779
|
+
return newContent2;
|
780
|
+
}
|
727
781
|
},
|
728
782
|
config
|
729
783
|
).props), {
|
@@ -898,11 +952,14 @@ init_react_import();
|
|
898
952
|
function walkTree(data, config, callbackFn) {
|
899
953
|
var _a, _b;
|
900
954
|
const walkItem = (item) => {
|
901
|
-
return
|
955
|
+
return mapFields(
|
902
956
|
item,
|
903
|
-
|
904
|
-
|
905
|
-
|
957
|
+
{
|
958
|
+
slot: ({ value, parentId, propName }) => {
|
959
|
+
var _a2;
|
960
|
+
const content = value;
|
961
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
962
|
+
}
|
906
963
|
},
|
907
964
|
config,
|
908
965
|
true
|
@@ -1822,24 +1879,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1822
1879
|
resolvedItem.readOnly = readOnly;
|
1823
1880
|
}
|
1824
1881
|
}
|
1825
|
-
let itemWithResolvedChildren = yield
|
1882
|
+
let itemWithResolvedChildren = yield mapFields(
|
1826
1883
|
resolvedItem,
|
1827
|
-
|
1828
|
-
|
1829
|
-
content
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1884
|
+
{
|
1885
|
+
slot: (_02) => __async(void 0, [_02], function* ({ value }) {
|
1886
|
+
const content = value;
|
1887
|
+
return yield Promise.all(
|
1888
|
+
content.map(
|
1889
|
+
(childItem) => __async(void 0, null, function* () {
|
1890
|
+
return (yield resolveComponentData(
|
1891
|
+
childItem,
|
1892
|
+
config,
|
1893
|
+
metadata,
|
1894
|
+
onResolveStart,
|
1895
|
+
onResolveEnd,
|
1896
|
+
trigger
|
1897
|
+
)).node;
|
1898
|
+
})
|
1899
|
+
)
|
1900
|
+
);
|
1901
|
+
})
|
1902
|
+
},
|
1843
1903
|
config
|
1844
1904
|
);
|
1845
1905
|
if (shouldRunResolver && onResolveEnd) {
|
@@ -1921,7 +1981,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
1921
1981
|
},
|
1922
1982
|
status: "LOADING",
|
1923
1983
|
iframe: {},
|
1924
|
-
metadata: {}
|
1984
|
+
metadata: {},
|
1985
|
+
fieldTransforms: {}
|
1925
1986
|
}, initialAppStore), {
|
1926
1987
|
fields: createFieldsSlice(set, get),
|
1927
1988
|
history: createHistorySlice(set, get),
|
@@ -2077,197 +2138,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
2077
2138
|
})
|
2078
2139
|
);
|
2079
2140
|
var appStoreContext = createContext(createAppStore());
|
2080
|
-
function useAppStore(selector) {
|
2081
|
-
const context = useContext(appStoreContext);
|
2082
|
-
return useStore(context, selector);
|
2083
|
-
}
|
2084
|
-
function useAppStoreApi() {
|
2085
|
-
return useContext(appStoreContext);
|
2086
|
-
}
|
2087
|
-
|
2088
|
-
// ../core/lib/use-breadcrumbs.ts
|
2089
|
-
var useBreadcrumbs = (renderCount) => {
|
2090
|
-
const selectedId = useAppStore((s) => {
|
2091
|
-
var _a;
|
2092
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2093
|
-
});
|
2094
|
-
const config = useAppStore((s) => s.config);
|
2095
|
-
const path = useAppStore((s) => {
|
2096
|
-
var _a;
|
2097
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2098
|
-
});
|
2099
|
-
const appStore = useAppStoreApi();
|
2100
|
-
return useMemo(() => {
|
2101
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2102
|
-
var _a, _b, _c;
|
2103
|
-
const [componentId] = zoneCompound.split(":");
|
2104
|
-
if (componentId === "root") {
|
2105
|
-
return {
|
2106
|
-
label: "Page",
|
2107
|
-
selector: null
|
2108
|
-
};
|
2109
|
-
}
|
2110
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
2111
|
-
const parentId = node.path[node.path.length - 1];
|
2112
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2113
|
-
const index = contentIds.indexOf(componentId);
|
2114
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2115
|
-
return {
|
2116
|
-
label,
|
2117
|
-
selector: node ? {
|
2118
|
-
index,
|
2119
|
-
zone: node.path[node.path.length - 1]
|
2120
|
-
} : null
|
2121
|
-
};
|
2122
|
-
})) || [];
|
2123
|
-
if (renderCount) {
|
2124
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2125
|
-
}
|
2126
|
-
return breadcrumbs;
|
2127
|
-
}, [path, renderCount]);
|
2128
|
-
};
|
2129
|
-
|
2130
|
-
// ../core/components/Loader/index.tsx
|
2131
|
-
init_react_import();
|
2132
|
-
|
2133
|
-
// ../core/lib/index.ts
|
2134
|
-
init_react_import();
|
2135
|
-
|
2136
|
-
// ../core/lib/filter.ts
|
2137
|
-
init_react_import();
|
2138
2141
|
|
2139
|
-
// ../core/lib/
|
2140
|
-
init_react_import();
|
2141
|
-
|
2142
|
-
// ../core/lib/data/replace.ts
|
2142
|
+
// ../core/lib/get-zoom-config.ts
|
2143
2143
|
init_react_import();
|
2144
2144
|
|
2145
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2146
|
-
init_react_import();
|
2147
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2148
|
-
|
2149
|
-
// ../core/components/Loader/index.tsx
|
2150
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
2151
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2152
|
-
var Loader = (_a) => {
|
2153
|
-
var _b = _a, {
|
2154
|
-
color,
|
2155
|
-
size = 16
|
2156
|
-
} = _b, props = __objRest(_b, [
|
2157
|
-
"color",
|
2158
|
-
"size"
|
2159
|
-
]);
|
2160
|
-
return /* @__PURE__ */ jsx2(
|
2161
|
-
"span",
|
2162
|
-
__spreadValues({
|
2163
|
-
className: getClassName2(),
|
2164
|
-
style: {
|
2165
|
-
width: size,
|
2166
|
-
height: size,
|
2167
|
-
color
|
2168
|
-
},
|
2169
|
-
"aria-label": "loading"
|
2170
|
-
}, props)
|
2171
|
-
);
|
2172
|
-
};
|
2173
|
-
|
2174
|
-
// ../core/components/SidebarSection/index.tsx
|
2175
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
2176
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2177
|
-
var SidebarSection = ({
|
2178
|
-
children,
|
2179
|
-
title,
|
2180
|
-
background,
|
2181
|
-
showBreadcrumbs,
|
2182
|
-
noBorderTop,
|
2183
|
-
noPadding,
|
2184
|
-
isLoading
|
2185
|
-
}) => {
|
2186
|
-
const setUi = useAppStore((s) => s.setUi);
|
2187
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2188
|
-
return /* @__PURE__ */ jsxs(
|
2189
|
-
"div",
|
2190
|
-
{
|
2191
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2192
|
-
style: { background },
|
2193
|
-
children: [
|
2194
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
2195
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
2196
|
-
/* @__PURE__ */ jsx3(
|
2197
|
-
"button",
|
2198
|
-
{
|
2199
|
-
type: "button",
|
2200
|
-
className: getClassName3("breadcrumbLabel"),
|
2201
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2202
|
-
children: breadcrumb.label
|
2203
|
-
}
|
2204
|
-
),
|
2205
|
-
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
2206
|
-
] }, i)) : null,
|
2207
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
2208
|
-
] }) }),
|
2209
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
2210
|
-
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
2211
|
-
]
|
2212
|
-
}
|
2213
|
-
);
|
2214
|
-
};
|
2215
|
-
|
2216
|
-
// ../core/components/OutlineList/index.tsx
|
2217
|
-
init_react_import();
|
2218
|
-
|
2219
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2220
|
-
init_react_import();
|
2221
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2222
|
-
|
2223
|
-
// ../core/components/OutlineList/index.tsx
|
2224
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
2225
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2226
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2227
|
-
var OutlineList = ({ children }) => {
|
2228
|
-
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
2229
|
-
};
|
2230
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
2231
|
-
OutlineList.Item = ({
|
2232
|
-
children,
|
2233
|
-
onClick
|
2234
|
-
}) => {
|
2235
|
-
return /* @__PURE__ */ jsx4(
|
2236
|
-
"li",
|
2237
|
-
{
|
2238
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2239
|
-
onClick,
|
2240
|
-
children
|
2241
|
-
}
|
2242
|
-
);
|
2243
|
-
};
|
2244
|
-
|
2245
|
-
// ../core/lib/scroll-into-view.ts
|
2246
|
-
init_react_import();
|
2247
|
-
var scrollIntoView = (el) => {
|
2248
|
-
const oldStyle = __spreadValues({}, el.style);
|
2249
|
-
el.style.scrollMargin = "256px";
|
2250
|
-
if (el) {
|
2251
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2252
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2253
|
-
}
|
2254
|
-
};
|
2255
|
-
|
2256
|
-
// ../core/lib/get-frame.ts
|
2257
|
-
init_react_import();
|
2258
|
-
var getFrame = () => {
|
2259
|
-
if (typeof window === "undefined") return;
|
2260
|
-
let frameEl = document.querySelector("#preview-frame");
|
2261
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2262
|
-
return frameEl.contentDocument || document;
|
2263
|
-
}
|
2264
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2265
|
-
};
|
2266
|
-
|
2267
2145
|
// src/HeadingAnalyzer.tsx
|
2268
2146
|
import ReactFromJSONModule from "react-from-json";
|
2269
|
-
import { Fragment, jsx as
|
2270
|
-
var
|
2147
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
2148
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2271
2149
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2272
2150
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
2273
2151
|
var getOutline = ({ frame } = {}) => {
|
@@ -2358,11 +2236,11 @@ var HeadingAnalyzer = () => {
|
|
2358
2236
|
frameObserver.disconnect();
|
2359
2237
|
};
|
2360
2238
|
}, [data]);
|
2361
|
-
return /* @__PURE__ */
|
2362
|
-
/* @__PURE__ */
|
2239
|
+
return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
|
2240
|
+
/* @__PURE__ */ jsxs(
|
2363
2241
|
"small",
|
2364
2242
|
{
|
2365
|
-
className:
|
2243
|
+
className: getClassName2("cssWarning"),
|
2366
2244
|
style: {
|
2367
2245
|
color: "var(--puck-color-red-04)",
|
2368
2246
|
display: "block",
|
@@ -2371,19 +2249,19 @@ var HeadingAnalyzer = () => {
|
|
2371
2249
|
children: [
|
2372
2250
|
"Heading analyzer styles not loaded. Please review the",
|
2373
2251
|
" ",
|
2374
|
-
/* @__PURE__ */
|
2252
|
+
/* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2375
2253
|
"."
|
2376
2254
|
]
|
2377
2255
|
}
|
2378
2256
|
),
|
2379
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
2380
|
-
/* @__PURE__ */
|
2257
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
|
2258
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
|
2381
2259
|
ReactFromJSON,
|
2382
2260
|
{
|
2383
2261
|
mapping: {
|
2384
|
-
Root: (props) => /* @__PURE__ */
|
2385
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
2386
|
-
/* @__PURE__ */
|
2262
|
+
Root: (props) => /* @__PURE__ */ jsx2(Fragment, { children: props.children }),
|
2263
|
+
OutlineListItem: (props) => /* @__PURE__ */ jsxs(OutlineList.Item, { children: [
|
2264
|
+
/* @__PURE__ */ jsx2(OutlineList.Clickable, { children: /* @__PURE__ */ jsx2(
|
2387
2265
|
"small",
|
2388
2266
|
{
|
2389
2267
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2401,14 +2279,14 @@ var HeadingAnalyzer = () => {
|
|
2401
2279
|
}, 2e3);
|
2402
2280
|
}
|
2403
2281
|
},
|
2404
|
-
children: props.missing ? /* @__PURE__ */
|
2405
|
-
/* @__PURE__ */
|
2282
|
+
children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
2283
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2406
2284
|
"H",
|
2407
2285
|
props.rank
|
2408
2286
|
] }),
|
2409
2287
|
": Missing"
|
2410
|
-
] }) : /* @__PURE__ */
|
2411
|
-
/* @__PURE__ */
|
2288
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
2289
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2412
2290
|
"H",
|
2413
2291
|
props.rank
|
2414
2292
|
] }),
|
@@ -2417,7 +2295,7 @@ var HeadingAnalyzer = () => {
|
|
2417
2295
|
] })
|
2418
2296
|
}
|
2419
2297
|
) }),
|
2420
|
-
/* @__PURE__ */
|
2298
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: props.children })
|
2421
2299
|
] })
|
2422
2300
|
},
|
2423
2301
|
entry: {
|
@@ -2438,12 +2316,10 @@ var HeadingAnalyzer = () => {
|
|
2438
2316
|
] });
|
2439
2317
|
};
|
2440
2318
|
var headingAnalyzer = {
|
2441
|
-
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
] })
|
2446
|
-
}
|
2319
|
+
name: "heading-analyzer",
|
2320
|
+
label: "Audit",
|
2321
|
+
render: HeadingAnalyzer,
|
2322
|
+
icon: /* @__PURE__ */ jsx2(Heading1, {})
|
2447
2323
|
};
|
2448
2324
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2449
2325
|
export {
|
@@ -2490,7 +2366,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2490
2366
|
* See the LICENSE file in the root directory of this source tree.
|
2491
2367
|
*)
|
2492
2368
|
|
2493
|
-
lucide-react/dist/esm/icons/
|
2369
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2494
2370
|
(**
|
2495
2371
|
* @license lucide-react v0.468.0 - ISC
|
2496
2372
|
*
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.20.0-canary.
|
3
|
+
"version": "0.20.0-canary.f2447833",
|
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.20.0-canary.
|
28
|
+
"@measured/puck": "^0.20.0-canary.f2447833",
|
29
29
|
"@types/react": "^19.0.1",
|
30
30
|
"@types/react-dom": "^19.0.2",
|
31
31
|
"eslint": "^7.32.0",
|