@measured/puck-plugin-heading-analyzer 0.20.0-canary.8c56aa8b → 0.20.0-canary.8ffbfdad
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 +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +154 -285
- package/dist/index.mjs +151 -282
- 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,204 +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
|
-
|
2139
|
-
// ../core/lib/data/reorder.ts
|
2140
|
-
init_react_import();
|
2141
|
-
|
2142
|
-
// ../core/lib/data/replace.ts
|
2143
|
-
init_react_import();
|
2144
|
-
|
2145
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
2146
|
-
init_react_import();
|
2147
|
-
import { useCallback as useCallback2 } from "react";
|
2148
2141
|
|
2149
2142
|
// ../core/lib/get-zoom-config.ts
|
2150
2143
|
init_react_import();
|
2151
2144
|
|
2152
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2153
|
-
init_react_import();
|
2154
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2155
|
-
|
2156
|
-
// ../core/components/Loader/index.tsx
|
2157
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
2158
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2159
|
-
var Loader = (_a) => {
|
2160
|
-
var _b = _a, {
|
2161
|
-
color,
|
2162
|
-
size = 16
|
2163
|
-
} = _b, props = __objRest(_b, [
|
2164
|
-
"color",
|
2165
|
-
"size"
|
2166
|
-
]);
|
2167
|
-
return /* @__PURE__ */ jsx2(
|
2168
|
-
"span",
|
2169
|
-
__spreadValues({
|
2170
|
-
className: getClassName2(),
|
2171
|
-
style: {
|
2172
|
-
width: size,
|
2173
|
-
height: size,
|
2174
|
-
color
|
2175
|
-
},
|
2176
|
-
"aria-label": "loading"
|
2177
|
-
}, props)
|
2178
|
-
);
|
2179
|
-
};
|
2180
|
-
|
2181
|
-
// ../core/components/SidebarSection/index.tsx
|
2182
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
2183
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2184
|
-
var SidebarSection = ({
|
2185
|
-
children,
|
2186
|
-
title,
|
2187
|
-
background,
|
2188
|
-
showBreadcrumbs,
|
2189
|
-
noBorderTop,
|
2190
|
-
noPadding,
|
2191
|
-
isLoading
|
2192
|
-
}) => {
|
2193
|
-
const setUi = useAppStore((s) => s.setUi);
|
2194
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2195
|
-
return /* @__PURE__ */ jsxs(
|
2196
|
-
"div",
|
2197
|
-
{
|
2198
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2199
|
-
style: { background },
|
2200
|
-
children: [
|
2201
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
2202
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
2203
|
-
/* @__PURE__ */ jsx3(
|
2204
|
-
"button",
|
2205
|
-
{
|
2206
|
-
type: "button",
|
2207
|
-
className: getClassName3("breadcrumbLabel"),
|
2208
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2209
|
-
children: breadcrumb.label
|
2210
|
-
}
|
2211
|
-
),
|
2212
|
-
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
2213
|
-
] }, i)) : null,
|
2214
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
2215
|
-
] }) }),
|
2216
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
2217
|
-
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
2218
|
-
]
|
2219
|
-
}
|
2220
|
-
);
|
2221
|
-
};
|
2222
|
-
|
2223
|
-
// ../core/components/OutlineList/index.tsx
|
2224
|
-
init_react_import();
|
2225
|
-
|
2226
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2227
|
-
init_react_import();
|
2228
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2229
|
-
|
2230
|
-
// ../core/components/OutlineList/index.tsx
|
2231
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
2232
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2233
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2234
|
-
var OutlineList = ({ children }) => {
|
2235
|
-
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
2236
|
-
};
|
2237
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
2238
|
-
OutlineList.Item = ({
|
2239
|
-
children,
|
2240
|
-
onClick
|
2241
|
-
}) => {
|
2242
|
-
return /* @__PURE__ */ jsx4(
|
2243
|
-
"li",
|
2244
|
-
{
|
2245
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2246
|
-
onClick,
|
2247
|
-
children
|
2248
|
-
}
|
2249
|
-
);
|
2250
|
-
};
|
2251
|
-
|
2252
|
-
// ../core/lib/scroll-into-view.ts
|
2253
|
-
init_react_import();
|
2254
|
-
var scrollIntoView = (el) => {
|
2255
|
-
const oldStyle = __spreadValues({}, el.style);
|
2256
|
-
el.style.scrollMargin = "256px";
|
2257
|
-
if (el) {
|
2258
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2259
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2260
|
-
}
|
2261
|
-
};
|
2262
|
-
|
2263
|
-
// ../core/lib/get-frame.ts
|
2264
|
-
init_react_import();
|
2265
|
-
var getFrame = () => {
|
2266
|
-
if (typeof window === "undefined") return;
|
2267
|
-
let frameEl = document.querySelector("#preview-frame");
|
2268
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2269
|
-
return frameEl.contentDocument || document;
|
2270
|
-
}
|
2271
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2272
|
-
};
|
2273
|
-
|
2274
2145
|
// src/HeadingAnalyzer.tsx
|
2275
2146
|
import ReactFromJSONModule from "react-from-json";
|
2276
|
-
import { Fragment, jsx as
|
2277
|
-
var
|
2147
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
2148
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2278
2149
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2279
2150
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
2280
2151
|
var getOutline = ({ frame } = {}) => {
|
@@ -2365,11 +2236,11 @@ var HeadingAnalyzer = () => {
|
|
2365
2236
|
frameObserver.disconnect();
|
2366
2237
|
};
|
2367
2238
|
}, [data]);
|
2368
|
-
return /* @__PURE__ */
|
2369
|
-
/* @__PURE__ */
|
2239
|
+
return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
|
2240
|
+
/* @__PURE__ */ jsxs(
|
2370
2241
|
"small",
|
2371
2242
|
{
|
2372
|
-
className:
|
2243
|
+
className: getClassName2("cssWarning"),
|
2373
2244
|
style: {
|
2374
2245
|
color: "var(--puck-color-red-04)",
|
2375
2246
|
display: "block",
|
@@ -2378,19 +2249,19 @@ var HeadingAnalyzer = () => {
|
|
2378
2249
|
children: [
|
2379
2250
|
"Heading analyzer styles not loaded. Please review the",
|
2380
2251
|
" ",
|
2381
|
-
/* @__PURE__ */
|
2252
|
+
/* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2382
2253
|
"."
|
2383
2254
|
]
|
2384
2255
|
}
|
2385
2256
|
),
|
2386
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
2387
|
-
/* @__PURE__ */
|
2257
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
|
2258
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
|
2388
2259
|
ReactFromJSON,
|
2389
2260
|
{
|
2390
2261
|
mapping: {
|
2391
|
-
Root: (props) => /* @__PURE__ */
|
2392
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
2393
|
-
/* @__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(
|
2394
2265
|
"small",
|
2395
2266
|
{
|
2396
2267
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2408,14 +2279,14 @@ var HeadingAnalyzer = () => {
|
|
2408
2279
|
}, 2e3);
|
2409
2280
|
}
|
2410
2281
|
},
|
2411
|
-
children: props.missing ? /* @__PURE__ */
|
2412
|
-
/* @__PURE__ */
|
2282
|
+
children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
2283
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2413
2284
|
"H",
|
2414
2285
|
props.rank
|
2415
2286
|
] }),
|
2416
2287
|
": Missing"
|
2417
|
-
] }) : /* @__PURE__ */
|
2418
|
-
/* @__PURE__ */
|
2288
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
2289
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2419
2290
|
"H",
|
2420
2291
|
props.rank
|
2421
2292
|
] }),
|
@@ -2424,7 +2295,7 @@ var HeadingAnalyzer = () => {
|
|
2424
2295
|
] })
|
2425
2296
|
}
|
2426
2297
|
) }),
|
2427
|
-
/* @__PURE__ */
|
2298
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: props.children })
|
2428
2299
|
] })
|
2429
2300
|
},
|
2430
2301
|
entry: {
|
@@ -2445,12 +2316,10 @@ var HeadingAnalyzer = () => {
|
|
2445
2316
|
] });
|
2446
2317
|
};
|
2447
2318
|
var headingAnalyzer = {
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
] })
|
2453
|
-
}
|
2319
|
+
name: "heading-analyzer",
|
2320
|
+
label: "Audit",
|
2321
|
+
render: HeadingAnalyzer,
|
2322
|
+
icon: /* @__PURE__ */ jsx2(Heading1, {})
|
2454
2323
|
};
|
2455
2324
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2456
2325
|
export {
|
@@ -2497,7 +2366,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2497
2366
|
* See the LICENSE file in the root directory of this source tree.
|
2498
2367
|
*)
|
2499
2368
|
|
2500
|
-
lucide-react/dist/esm/icons/
|
2369
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2501
2370
|
(**
|
2502
2371
|
* @license lucide-react v0.468.0 - ISC
|
2503
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.8ffbfdad",
|
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.8ffbfdad",
|
29
29
|
"@types/react": "^19.0.1",
|
30
30
|
"@types/react-dom": "^19.0.2",
|
31
31
|
"eslint": "^7.32.0",
|