@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.js
CHANGED
@@ -313,7 +313,7 @@ init_react_import();
|
|
313
313
|
|
314
314
|
// src/HeadingAnalyzer.tsx
|
315
315
|
init_react_import();
|
316
|
-
var
|
316
|
+
var import_react10 = require("react");
|
317
317
|
|
318
318
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
319
319
|
init_react_import();
|
@@ -322,12 +322,12 @@ var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v
|
|
322
322
|
// src/HeadingAnalyzer.tsx
|
323
323
|
var import_puck = require("@measured/puck");
|
324
324
|
|
325
|
-
// ../core/components/
|
325
|
+
// ../core/components/OutlineList/index.tsx
|
326
326
|
init_react_import();
|
327
327
|
|
328
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
328
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
329
329
|
init_react_import();
|
330
|
-
var styles_module_default = { "
|
330
|
+
var styles_module_default = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
331
331
|
|
332
332
|
// ../core/lib/get-class-name-factory.ts
|
333
333
|
init_react_import();
|
@@ -356,29 +356,50 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
356
356
|
};
|
357
357
|
var get_class_name_factory_default = getClassNameFactory;
|
358
358
|
|
359
|
-
// ../core/components/
|
360
|
-
init_react_import();
|
361
|
-
|
362
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
363
|
-
init_react_import();
|
364
|
-
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" };
|
365
|
-
|
366
|
-
// ../core/components/Heading/index.tsx
|
359
|
+
// ../core/components/OutlineList/index.tsx
|
367
360
|
var import_jsx_runtime = require("react/jsx-runtime");
|
368
|
-
var getClassName = get_class_name_factory_default("
|
369
|
-
var
|
370
|
-
|
361
|
+
var getClassName = get_class_name_factory_default("OutlineList", styles_module_default);
|
362
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default);
|
363
|
+
var OutlineList = ({ children }) => {
|
364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
|
365
|
+
};
|
366
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
367
|
+
OutlineList.Item = ({
|
368
|
+
children,
|
369
|
+
onClick
|
370
|
+
}) => {
|
371
371
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
372
|
-
|
372
|
+
"li",
|
373
373
|
{
|
374
|
-
className:
|
375
|
-
|
376
|
-
}),
|
374
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
375
|
+
onClick,
|
377
376
|
children
|
378
377
|
}
|
379
378
|
);
|
380
379
|
};
|
381
380
|
|
381
|
+
// ../core/lib/scroll-into-view.ts
|
382
|
+
init_react_import();
|
383
|
+
var scrollIntoView = (el) => {
|
384
|
+
const oldStyle = __spreadValues({}, el.style);
|
385
|
+
el.style.scrollMargin = "256px";
|
386
|
+
if (el) {
|
387
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
388
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
389
|
+
}
|
390
|
+
};
|
391
|
+
|
392
|
+
// ../core/lib/get-frame.ts
|
393
|
+
init_react_import();
|
394
|
+
var getFrame = () => {
|
395
|
+
if (typeof window === "undefined") return;
|
396
|
+
let frameEl = document.querySelector("#preview-frame");
|
397
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
398
|
+
return frameEl.contentDocument || document;
|
399
|
+
}
|
400
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
401
|
+
};
|
402
|
+
|
382
403
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
383
404
|
init_react_import();
|
384
405
|
|
@@ -466,15 +487,29 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
466
487
|
return Component;
|
467
488
|
};
|
468
489
|
|
469
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
490
|
+
// ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
|
470
491
|
init_react_import();
|
471
|
-
var
|
472
|
-
["path", { d: "
|
492
|
+
var Heading1 = createLucideIcon("Heading1", [
|
493
|
+
["path", { d: "M4 12h8", key: "17cfdx" }],
|
494
|
+
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
495
|
+
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
496
|
+
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
473
497
|
]);
|
474
498
|
|
475
|
-
// ../core/lib/
|
499
|
+
// ../core/lib/index.ts
|
500
|
+
init_react_import();
|
501
|
+
|
502
|
+
// ../core/lib/filter.ts
|
503
|
+
init_react_import();
|
504
|
+
|
505
|
+
// ../core/lib/data/reorder.ts
|
506
|
+
init_react_import();
|
507
|
+
|
508
|
+
// ../core/lib/data/replace.ts
|
509
|
+
init_react_import();
|
510
|
+
|
511
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
476
512
|
init_react_import();
|
477
|
-
var import_react10 = require("react");
|
478
513
|
|
479
514
|
// ../core/store/index.ts
|
480
515
|
init_react_import();
|
@@ -521,7 +556,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
521
556
|
});
|
522
557
|
}
|
523
558
|
|
524
|
-
// ../core/lib/data/map-
|
559
|
+
// ../core/lib/data/map-fields.ts
|
525
560
|
init_react_import();
|
526
561
|
|
527
562
|
// ../core/lib/data/default-slots.ts
|
@@ -531,14 +566,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
531
566
|
value
|
532
567
|
);
|
533
568
|
|
534
|
-
// ../core/lib/data/map-
|
569
|
+
// ../core/lib/data/map-fields.ts
|
535
570
|
var isPromise = (v) => !!v && typeof v.then === "function";
|
536
571
|
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
537
572
|
var containsPromise = (arr) => arr.some(isPromise);
|
538
573
|
var walkField = ({
|
539
574
|
value,
|
540
575
|
fields,
|
541
|
-
|
576
|
+
mappers,
|
542
577
|
propKey = "",
|
543
578
|
propPath = "",
|
544
579
|
id = "",
|
@@ -546,7 +581,9 @@ var walkField = ({
|
|
546
581
|
recurseSlots = false
|
547
582
|
}) => {
|
548
583
|
var _a, _b, _c;
|
549
|
-
|
584
|
+
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
585
|
+
const map = mappers[fieldType];
|
586
|
+
if (map && fieldType === "slot") {
|
550
587
|
const content = value || [];
|
551
588
|
const mappedContent = recurseSlots ? content.map((el) => {
|
552
589
|
var _a2;
|
@@ -558,7 +595,7 @@ var walkField = ({
|
|
558
595
|
return walkField({
|
559
596
|
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
560
597
|
fields: fields2,
|
561
|
-
|
598
|
+
mappers,
|
562
599
|
id: el.props.id,
|
563
600
|
config,
|
564
601
|
recurseSlots
|
@@ -567,7 +604,21 @@ var walkField = ({
|
|
567
604
|
if (containsPromise(mappedContent)) {
|
568
605
|
return Promise.all(mappedContent);
|
569
606
|
}
|
570
|
-
return map(
|
607
|
+
return map({
|
608
|
+
value: mappedContent,
|
609
|
+
parentId: id,
|
610
|
+
propName: propKey,
|
611
|
+
field: fields[propKey],
|
612
|
+
propPath
|
613
|
+
});
|
614
|
+
} else if (map && fields[propKey]) {
|
615
|
+
return map({
|
616
|
+
value,
|
617
|
+
parentId: id,
|
618
|
+
propName: propKey,
|
619
|
+
field: fields[propKey],
|
620
|
+
propPath
|
621
|
+
});
|
571
622
|
}
|
572
623
|
if (value && typeof value === "object") {
|
573
624
|
if (Array.isArray(value)) {
|
@@ -577,7 +628,7 @@ var walkField = ({
|
|
577
628
|
(el, idx) => walkField({
|
578
629
|
value: el,
|
579
630
|
fields: arrayFields,
|
580
|
-
|
631
|
+
mappers,
|
581
632
|
propKey,
|
582
633
|
propPath: `${propPath}[${idx}]`,
|
583
634
|
id,
|
@@ -596,7 +647,7 @@ var walkField = ({
|
|
596
647
|
return walkObject({
|
597
648
|
value,
|
598
649
|
fields: objectFields,
|
599
|
-
|
650
|
+
mappers,
|
600
651
|
id,
|
601
652
|
getPropPath: (k) => `${propPath}.${k}`,
|
602
653
|
config,
|
@@ -609,7 +660,7 @@ var walkField = ({
|
|
609
660
|
var walkObject = ({
|
610
661
|
value,
|
611
662
|
fields,
|
612
|
-
|
663
|
+
mappers,
|
613
664
|
id,
|
614
665
|
getPropPath,
|
615
666
|
config,
|
@@ -619,7 +670,7 @@ var walkObject = ({
|
|
619
670
|
const opts = {
|
620
671
|
value: v,
|
621
672
|
fields,
|
622
|
-
|
673
|
+
mappers,
|
623
674
|
propKey: k,
|
624
675
|
propPath: getPropPath(k),
|
625
676
|
id,
|
@@ -641,14 +692,14 @@ var walkObject = ({
|
|
641
692
|
}
|
642
693
|
return flatten(newProps);
|
643
694
|
};
|
644
|
-
function
|
695
|
+
function mapFields(item, mappers, config, recurseSlots = false) {
|
645
696
|
var _a, _b, _c, _d, _e;
|
646
697
|
const itemType = "type" in item ? item.type : "root";
|
647
698
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
648
699
|
const newProps = walkObject({
|
649
700
|
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
650
701
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
651
|
-
|
702
|
+
mappers,
|
652
703
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
653
704
|
getPropPath: (k) => k,
|
654
705
|
config,
|
@@ -671,7 +722,7 @@ var import_flat = __toESM(require_flat());
|
|
671
722
|
// ../core/lib/data/strip-slots.ts
|
672
723
|
init_react_import();
|
673
724
|
var stripSlots = (data, config) => {
|
674
|
-
return
|
725
|
+
return mapFields(data, { slot: () => null }, config);
|
675
726
|
};
|
676
727
|
|
677
728
|
// ../core/lib/data/flatten-node.ts
|
@@ -724,18 +775,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
724
775
|
const mappedItem = mapNodeOrSkip(item, path, index);
|
725
776
|
if (!mappedItem) return item;
|
726
777
|
const id = mappedItem.props.id;
|
727
|
-
const newProps = __spreadProps(__spreadValues({},
|
778
|
+
const newProps = __spreadProps(__spreadValues({}, mapFields(
|
728
779
|
mappedItem,
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
780
|
+
{
|
781
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
782
|
+
const content = value;
|
783
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
784
|
+
const [_2, newContent2] = processContent(
|
785
|
+
path,
|
786
|
+
zoneCompound,
|
787
|
+
content,
|
788
|
+
"slot",
|
789
|
+
parentId2
|
790
|
+
);
|
791
|
+
return newContent2;
|
792
|
+
}
|
739
793
|
},
|
740
794
|
config
|
741
795
|
).props), {
|
@@ -910,11 +964,14 @@ init_react_import();
|
|
910
964
|
function walkTree(data, config, callbackFn) {
|
911
965
|
var _a, _b;
|
912
966
|
const walkItem = (item) => {
|
913
|
-
return
|
967
|
+
return mapFields(
|
914
968
|
item,
|
915
|
-
|
916
|
-
|
917
|
-
|
969
|
+
{
|
970
|
+
slot: ({ value, parentId, propName }) => {
|
971
|
+
var _a2;
|
972
|
+
const content = value;
|
973
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
974
|
+
}
|
918
975
|
},
|
919
976
|
config,
|
920
977
|
true
|
@@ -1834,24 +1891,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1834
1891
|
resolvedItem.readOnly = readOnly;
|
1835
1892
|
}
|
1836
1893
|
}
|
1837
|
-
let itemWithResolvedChildren = yield
|
1894
|
+
let itemWithResolvedChildren = yield mapFields(
|
1838
1895
|
resolvedItem,
|
1839
|
-
|
1840
|
-
|
1841
|
-
content
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1896
|
+
{
|
1897
|
+
slot: (_02) => __async(void 0, [_02], function* ({ value }) {
|
1898
|
+
const content = value;
|
1899
|
+
return yield Promise.all(
|
1900
|
+
content.map(
|
1901
|
+
(childItem) => __async(void 0, null, function* () {
|
1902
|
+
return (yield resolveComponentData(
|
1903
|
+
childItem,
|
1904
|
+
config,
|
1905
|
+
metadata,
|
1906
|
+
onResolveStart,
|
1907
|
+
onResolveEnd,
|
1908
|
+
trigger
|
1909
|
+
)).node;
|
1910
|
+
})
|
1911
|
+
)
|
1912
|
+
);
|
1913
|
+
})
|
1914
|
+
},
|
1855
1915
|
config
|
1856
1916
|
);
|
1857
1917
|
if (shouldRunResolver && onResolveEnd) {
|
@@ -1933,7 +1993,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
1933
1993
|
},
|
1934
1994
|
status: "LOADING",
|
1935
1995
|
iframe: {},
|
1936
|
-
metadata: {}
|
1996
|
+
metadata: {},
|
1997
|
+
fieldTransforms: {}
|
1937
1998
|
}, initialAppStore), {
|
1938
1999
|
fields: createFieldsSlice(set, get),
|
1939
2000
|
history: createHistorySlice(set, get),
|
@@ -2089,197 +2150,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
2089
2150
|
})
|
2090
2151
|
);
|
2091
2152
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2092
|
-
function useAppStore(selector) {
|
2093
|
-
const context = (0, import_react9.useContext)(appStoreContext);
|
2094
|
-
return useStore(context, selector);
|
2095
|
-
}
|
2096
|
-
function useAppStoreApi() {
|
2097
|
-
return (0, import_react9.useContext)(appStoreContext);
|
2098
|
-
}
|
2099
|
-
|
2100
|
-
// ../core/lib/use-breadcrumbs.ts
|
2101
|
-
var useBreadcrumbs = (renderCount) => {
|
2102
|
-
const selectedId = useAppStore((s) => {
|
2103
|
-
var _a;
|
2104
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2105
|
-
});
|
2106
|
-
const config = useAppStore((s) => s.config);
|
2107
|
-
const path = useAppStore((s) => {
|
2108
|
-
var _a;
|
2109
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2110
|
-
});
|
2111
|
-
const appStore = useAppStoreApi();
|
2112
|
-
return (0, import_react10.useMemo)(() => {
|
2113
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2114
|
-
var _a, _b, _c;
|
2115
|
-
const [componentId] = zoneCompound.split(":");
|
2116
|
-
if (componentId === "root") {
|
2117
|
-
return {
|
2118
|
-
label: "Page",
|
2119
|
-
selector: null
|
2120
|
-
};
|
2121
|
-
}
|
2122
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
2123
|
-
const parentId = node.path[node.path.length - 1];
|
2124
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2125
|
-
const index = contentIds.indexOf(componentId);
|
2126
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2127
|
-
return {
|
2128
|
-
label,
|
2129
|
-
selector: node ? {
|
2130
|
-
index,
|
2131
|
-
zone: node.path[node.path.length - 1]
|
2132
|
-
} : null
|
2133
|
-
};
|
2134
|
-
})) || [];
|
2135
|
-
if (renderCount) {
|
2136
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2137
|
-
}
|
2138
|
-
return breadcrumbs;
|
2139
|
-
}, [path, renderCount]);
|
2140
|
-
};
|
2141
|
-
|
2142
|
-
// ../core/components/Loader/index.tsx
|
2143
|
-
init_react_import();
|
2144
|
-
|
2145
|
-
// ../core/lib/index.ts
|
2146
|
-
init_react_import();
|
2147
|
-
|
2148
|
-
// ../core/lib/filter.ts
|
2149
|
-
init_react_import();
|
2150
|
-
|
2151
|
-
// ../core/lib/data/reorder.ts
|
2152
|
-
init_react_import();
|
2153
|
-
|
2154
|
-
// ../core/lib/data/replace.ts
|
2155
|
-
init_react_import();
|
2156
|
-
|
2157
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2158
|
-
init_react_import();
|
2159
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2160
|
-
|
2161
|
-
// ../core/components/Loader/index.tsx
|
2162
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2163
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2164
|
-
var Loader = (_a) => {
|
2165
|
-
var _b = _a, {
|
2166
|
-
color,
|
2167
|
-
size = 16
|
2168
|
-
} = _b, props = __objRest(_b, [
|
2169
|
-
"color",
|
2170
|
-
"size"
|
2171
|
-
]);
|
2172
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2173
|
-
"span",
|
2174
|
-
__spreadValues({
|
2175
|
-
className: getClassName2(),
|
2176
|
-
style: {
|
2177
|
-
width: size,
|
2178
|
-
height: size,
|
2179
|
-
color
|
2180
|
-
},
|
2181
|
-
"aria-label": "loading"
|
2182
|
-
}, props)
|
2183
|
-
);
|
2184
|
-
};
|
2185
|
-
|
2186
|
-
// ../core/components/SidebarSection/index.tsx
|
2187
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
2188
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2189
|
-
var SidebarSection = ({
|
2190
|
-
children,
|
2191
|
-
title,
|
2192
|
-
background,
|
2193
|
-
showBreadcrumbs,
|
2194
|
-
noBorderTop,
|
2195
|
-
noPadding,
|
2196
|
-
isLoading
|
2197
|
-
}) => {
|
2198
|
-
const setUi = useAppStore((s) => s.setUi);
|
2199
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2200
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
2201
|
-
"div",
|
2202
|
-
{
|
2203
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2204
|
-
style: { background },
|
2205
|
-
children: [
|
2206
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
2207
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
2208
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
2209
|
-
"button",
|
2210
|
-
{
|
2211
|
-
type: "button",
|
2212
|
-
className: getClassName3("breadcrumbLabel"),
|
2213
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2214
|
-
children: breadcrumb.label
|
2215
|
-
}
|
2216
|
-
),
|
2217
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
2218
|
-
] }, i)) : null,
|
2219
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
2220
|
-
] }) }),
|
2221
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
2222
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
2223
|
-
]
|
2224
|
-
}
|
2225
|
-
);
|
2226
|
-
};
|
2227
|
-
|
2228
|
-
// ../core/components/OutlineList/index.tsx
|
2229
|
-
init_react_import();
|
2230
|
-
|
2231
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2232
|
-
init_react_import();
|
2233
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2234
|
-
|
2235
|
-
// ../core/components/OutlineList/index.tsx
|
2236
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2237
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2238
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2239
|
-
var OutlineList = ({ children }) => {
|
2240
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
2241
|
-
};
|
2242
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
2243
|
-
OutlineList.Item = ({
|
2244
|
-
children,
|
2245
|
-
onClick
|
2246
|
-
}) => {
|
2247
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
2248
|
-
"li",
|
2249
|
-
{
|
2250
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2251
|
-
onClick,
|
2252
|
-
children
|
2253
|
-
}
|
2254
|
-
);
|
2255
|
-
};
|
2256
|
-
|
2257
|
-
// ../core/lib/scroll-into-view.ts
|
2258
|
-
init_react_import();
|
2259
|
-
var scrollIntoView = (el) => {
|
2260
|
-
const oldStyle = __spreadValues({}, el.style);
|
2261
|
-
el.style.scrollMargin = "256px";
|
2262
|
-
if (el) {
|
2263
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2264
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2265
|
-
}
|
2266
|
-
};
|
2267
2153
|
|
2268
|
-
// ../core/lib/get-
|
2154
|
+
// ../core/lib/get-zoom-config.ts
|
2269
2155
|
init_react_import();
|
2270
|
-
var getFrame = () => {
|
2271
|
-
if (typeof window === "undefined") return;
|
2272
|
-
let frameEl = document.querySelector("#preview-frame");
|
2273
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2274
|
-
return frameEl.contentDocument || document;
|
2275
|
-
}
|
2276
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2277
|
-
};
|
2278
2156
|
|
2279
2157
|
// src/HeadingAnalyzer.tsx
|
2280
2158
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2281
|
-
var
|
2282
|
-
var
|
2159
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2160
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2283
2161
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2284
2162
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2285
2163
|
var getOutline = ({ frame } = {}) => {
|
@@ -2334,8 +2212,8 @@ function buildHierarchy(frame) {
|
|
2334
2212
|
var usePuck = (0, import_puck.createUsePuck)();
|
2335
2213
|
var HeadingAnalyzer = () => {
|
2336
2214
|
const data = usePuck((s) => s.appState.data);
|
2337
|
-
const [hierarchy, setHierarchy] = (0,
|
2338
|
-
(0,
|
2215
|
+
const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
|
2216
|
+
(0, import_react10.useEffect)(() => {
|
2339
2217
|
const frame = getFrame();
|
2340
2218
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2341
2219
|
const createHierarchy = () => {
|
@@ -2370,11 +2248,11 @@ var HeadingAnalyzer = () => {
|
|
2370
2248
|
frameObserver.disconnect();
|
2371
2249
|
};
|
2372
2250
|
}, [data]);
|
2373
|
-
return /* @__PURE__ */ (0,
|
2374
|
-
/* @__PURE__ */ (0,
|
2251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
|
2252
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
2375
2253
|
"small",
|
2376
2254
|
{
|
2377
|
-
className:
|
2255
|
+
className: getClassName2("cssWarning"),
|
2378
2256
|
style: {
|
2379
2257
|
color: "var(--puck-color-red-04)",
|
2380
2258
|
display: "block",
|
@@ -2383,19 +2261,19 @@ var HeadingAnalyzer = () => {
|
|
2383
2261
|
children: [
|
2384
2262
|
"Heading analyzer styles not loaded. Please review the",
|
2385
2263
|
" ",
|
2386
|
-
/* @__PURE__ */ (0,
|
2264
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2387
2265
|
"."
|
2388
2266
|
]
|
2389
2267
|
}
|
2390
2268
|
),
|
2391
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2392
|
-
/* @__PURE__ */ (0,
|
2269
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2393
2271
|
ReactFromJSON,
|
2394
2272
|
{
|
2395
2273
|
mapping: {
|
2396
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2397
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2398
|
-
/* @__PURE__ */ (0,
|
2274
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
|
2275
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2399
2277
|
"small",
|
2400
2278
|
{
|
2401
2279
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2413,14 +2291,14 @@ var HeadingAnalyzer = () => {
|
|
2413
2291
|
}, 2e3);
|
2414
2292
|
}
|
2415
2293
|
},
|
2416
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2417
|
-
/* @__PURE__ */ (0,
|
2294
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2418
2296
|
"H",
|
2419
2297
|
props.rank
|
2420
2298
|
] }),
|
2421
2299
|
": Missing"
|
2422
|
-
] }) : /* @__PURE__ */ (0,
|
2423
|
-
/* @__PURE__ */ (0,
|
2300
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2301
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2424
2302
|
"H",
|
2425
2303
|
props.rank
|
2426
2304
|
] }),
|
@@ -2429,7 +2307,7 @@ var HeadingAnalyzer = () => {
|
|
2429
2307
|
] })
|
2430
2308
|
}
|
2431
2309
|
) }),
|
2432
|
-
/* @__PURE__ */ (0,
|
2310
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
|
2433
2311
|
] })
|
2434
2312
|
},
|
2435
2313
|
entry: {
|
@@ -2450,12 +2328,10 @@ var HeadingAnalyzer = () => {
|
|
2450
2328
|
] });
|
2451
2329
|
};
|
2452
2330
|
var headingAnalyzer = {
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
|
2457
|
-
] })
|
2458
|
-
}
|
2331
|
+
name: "heading-analyzer",
|
2332
|
+
label: "Audit",
|
2333
|
+
render: HeadingAnalyzer,
|
2334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
|
2459
2335
|
};
|
2460
2336
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2461
2337
|
/*! Bundled license information:
|
@@ -2499,7 +2375,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2499
2375
|
* See the LICENSE file in the root directory of this source tree.
|
2500
2376
|
*)
|
2501
2377
|
|
2502
|
-
lucide-react/dist/esm/icons/
|
2378
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2503
2379
|
(**
|
2504
2380
|
* @license lucide-react v0.468.0 - ISC
|
2505
2381
|
*
|