@measured/puck-plugin-heading-analyzer 0.20.0-canary.93d525c5 → 0.20.0-canary.b2d0f01a
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 +273 -540
- package/dist/index.mjs +261 -528
- 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 as useMemo2 } 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
|
@@ -988,275 +1045,6 @@ function insertAction(state, action, appStore) {
|
|
988
1045
|
|
989
1046
|
// ../core/reducer/actions/replace.ts
|
990
1047
|
init_react_import();
|
991
|
-
|
992
|
-
// ../core/rsc.tsx
|
993
|
-
init_react_import();
|
994
|
-
|
995
|
-
// ../core/components/ServerRender/index.tsx
|
996
|
-
init_react_import();
|
997
|
-
|
998
|
-
// ../core/lib/data/setup-zone.ts
|
999
|
-
init_react_import();
|
1000
|
-
var setupZone = (data, zoneKey) => {
|
1001
|
-
if (zoneKey === rootDroppableId) {
|
1002
|
-
return data;
|
1003
|
-
}
|
1004
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
1005
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1006
|
-
});
|
1007
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1008
|
-
return newData;
|
1009
|
-
};
|
1010
|
-
|
1011
|
-
// ../core/lib/use-slots.tsx
|
1012
|
-
init_react_import();
|
1013
|
-
import { useMemo } from "react";
|
1014
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
1015
|
-
const slotProps = useMemo(() => {
|
1016
|
-
const mapped = mapSlots(
|
1017
|
-
item,
|
1018
|
-
(content, _parentId, propName, field, propPath) => {
|
1019
|
-
const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
|
1020
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
|
1021
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
1022
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
1023
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
1024
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
1025
|
-
}, dzProps), {
|
1026
|
-
zone: propName,
|
1027
|
-
content
|
1028
|
-
}));
|
1029
|
-
return Slot;
|
1030
|
-
},
|
1031
|
-
config
|
1032
|
-
).props;
|
1033
|
-
return mapped;
|
1034
|
-
}, [config, item, readOnly, forceReadOnly]);
|
1035
|
-
const mergedProps = useMemo(
|
1036
|
-
() => __spreadValues(__spreadValues({}, item.props), slotProps),
|
1037
|
-
[item.props, slotProps]
|
1038
|
-
);
|
1039
|
-
return mergedProps;
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
// ../core/components/SlotRender/server.tsx
|
1043
|
-
init_react_import();
|
1044
|
-
import { forwardRef as forwardRef3 } from "react";
|
1045
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
1046
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ jsx2(SlotRender, __spreadValues({}, props));
|
1047
|
-
var Item = ({
|
1048
|
-
config,
|
1049
|
-
item,
|
1050
|
-
metadata
|
1051
|
-
}) => {
|
1052
|
-
const Component = config.components[item.type];
|
1053
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
1054
|
-
return /* @__PURE__ */ jsx2(
|
1055
|
-
Component.render,
|
1056
|
-
__spreadProps(__spreadValues({}, props), {
|
1057
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
1058
|
-
renderDropZone: DropZoneRender,
|
1059
|
-
metadata: metadata || {}
|
1060
|
-
})
|
1061
|
-
})
|
1062
|
-
);
|
1063
|
-
};
|
1064
|
-
var SlotRender = forwardRef3(
|
1065
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
1066
|
-
return /* @__PURE__ */ jsx2("div", { className, style, ref, children: content.map((item) => {
|
1067
|
-
if (!config.components[item.type]) {
|
1068
|
-
return null;
|
1069
|
-
}
|
1070
|
-
return /* @__PURE__ */ jsx2(
|
1071
|
-
Item,
|
1072
|
-
{
|
1073
|
-
config,
|
1074
|
-
item,
|
1075
|
-
metadata
|
1076
|
-
},
|
1077
|
-
item.props.id
|
1078
|
-
);
|
1079
|
-
}) });
|
1080
|
-
}
|
1081
|
-
);
|
1082
|
-
|
1083
|
-
// ../core/components/ServerRender/index.tsx
|
1084
|
-
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
1085
|
-
function DropZoneRender({
|
1086
|
-
zone,
|
1087
|
-
data,
|
1088
|
-
areaId = "root",
|
1089
|
-
config,
|
1090
|
-
metadata = {}
|
1091
|
-
}) {
|
1092
|
-
let zoneCompound = rootDroppableId;
|
1093
|
-
let content = (data == null ? void 0 : data.content) || [];
|
1094
|
-
if (!data || !config) {
|
1095
|
-
return null;
|
1096
|
-
}
|
1097
|
-
if (areaId !== rootAreaId && zone !== rootZone) {
|
1098
|
-
zoneCompound = `${areaId}:${zone}`;
|
1099
|
-
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
1100
|
-
}
|
1101
|
-
return /* @__PURE__ */ jsx3(Fragment, { children: content.map((item) => {
|
1102
|
-
const Component = config.components[item.type];
|
1103
|
-
const props = __spreadProps(__spreadValues({}, item.props), {
|
1104
|
-
puck: {
|
1105
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ jsx3(
|
1106
|
-
DropZoneRender,
|
1107
|
-
{
|
1108
|
-
zone: zone2,
|
1109
|
-
data,
|
1110
|
-
areaId: item.props.id,
|
1111
|
-
config,
|
1112
|
-
metadata
|
1113
|
-
}
|
1114
|
-
),
|
1115
|
-
metadata,
|
1116
|
-
dragRef: null,
|
1117
|
-
isEditing: false
|
1118
|
-
}
|
1119
|
-
});
|
1120
|
-
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
1121
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
1122
|
-
if (Component) {
|
1123
|
-
return /* @__PURE__ */ jsx3(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
1124
|
-
}
|
1125
|
-
return null;
|
1126
|
-
}) });
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
// ../core/lib/resolve-all-data.ts
|
1130
|
-
init_react_import();
|
1131
|
-
|
1132
|
-
// ../core/lib/resolve-component-data.ts
|
1133
|
-
init_react_import();
|
1134
|
-
|
1135
|
-
// ../core/lib/get-changed.ts
|
1136
|
-
init_react_import();
|
1137
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1138
|
-
var getChanged = (newItem, oldItem) => {
|
1139
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1140
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1141
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1142
|
-
return __spreadProps(__spreadValues({}, acc), {
|
1143
|
-
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1144
|
-
});
|
1145
|
-
}, {}) : {};
|
1146
|
-
};
|
1147
|
-
|
1148
|
-
// ../core/lib/resolve-component-data.ts
|
1149
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1150
|
-
var cache = { lastChange: {} };
|
1151
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1152
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1153
|
-
const resolvedItem = __spreadValues({}, item);
|
1154
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1155
|
-
const id = "id" in item.props ? item.props.id : "root";
|
1156
|
-
if (shouldRunResolver) {
|
1157
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1158
|
-
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1159
|
-
return { node: resolved, didChange: false };
|
1160
|
-
}
|
1161
|
-
const changed = getChanged(item, oldItem);
|
1162
|
-
if (onResolveStart) {
|
1163
|
-
onResolveStart(item);
|
1164
|
-
}
|
1165
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1166
|
-
changed,
|
1167
|
-
lastData: oldItem,
|
1168
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1169
|
-
trigger
|
1170
|
-
});
|
1171
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1172
|
-
if (Object.keys(readOnly).length) {
|
1173
|
-
resolvedItem.readOnly = readOnly;
|
1174
|
-
}
|
1175
|
-
}
|
1176
|
-
let itemWithResolvedChildren = yield mapSlots(
|
1177
|
-
resolvedItem,
|
1178
|
-
(content) => __async(void 0, null, function* () {
|
1179
|
-
return yield Promise.all(
|
1180
|
-
content.map(
|
1181
|
-
(childItem) => __async(void 0, null, function* () {
|
1182
|
-
return (yield resolveComponentData(
|
1183
|
-
childItem,
|
1184
|
-
config,
|
1185
|
-
metadata,
|
1186
|
-
onResolveStart,
|
1187
|
-
onResolveEnd,
|
1188
|
-
trigger
|
1189
|
-
)).node;
|
1190
|
-
})
|
1191
|
-
)
|
1192
|
-
);
|
1193
|
-
}),
|
1194
|
-
config
|
1195
|
-
);
|
1196
|
-
if (shouldRunResolver && onResolveEnd) {
|
1197
|
-
onResolveEnd(resolvedItem);
|
1198
|
-
}
|
1199
|
-
cache.lastChange[id] = {
|
1200
|
-
item,
|
1201
|
-
resolved: itemWithResolvedChildren
|
1202
|
-
};
|
1203
|
-
return {
|
1204
|
-
node: itemWithResolvedChildren,
|
1205
|
-
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1206
|
-
};
|
1207
|
-
});
|
1208
|
-
|
1209
|
-
// ../core/lib/data/default-data.ts
|
1210
|
-
init_react_import();
|
1211
|
-
|
1212
|
-
// ../core/lib/data/to-component.ts
|
1213
|
-
init_react_import();
|
1214
|
-
|
1215
|
-
// ../core/lib/transform-props.ts
|
1216
|
-
init_react_import();
|
1217
|
-
|
1218
|
-
// ../core/lib/migrate.ts
|
1219
|
-
init_react_import();
|
1220
|
-
|
1221
|
-
// ../core/store/default-app-state.ts
|
1222
|
-
init_react_import();
|
1223
|
-
|
1224
|
-
// ../core/components/ViewportControls/default-viewports.ts
|
1225
|
-
init_react_import();
|
1226
|
-
var defaultViewports = [
|
1227
|
-
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1228
|
-
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1229
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1230
|
-
];
|
1231
|
-
|
1232
|
-
// ../core/store/default-app-state.ts
|
1233
|
-
var defaultAppState = {
|
1234
|
-
data: { content: [], root: {}, zones: {} },
|
1235
|
-
ui: {
|
1236
|
-
leftSideBarVisible: true,
|
1237
|
-
rightSideBarVisible: true,
|
1238
|
-
arrayState: {},
|
1239
|
-
itemSelector: null,
|
1240
|
-
componentList: {},
|
1241
|
-
isDragging: false,
|
1242
|
-
previewMode: "edit",
|
1243
|
-
viewports: {
|
1244
|
-
current: {
|
1245
|
-
width: defaultViewports[0].width,
|
1246
|
-
height: defaultViewports[0].height || "auto"
|
1247
|
-
},
|
1248
|
-
options: [],
|
1249
|
-
controlsVisible: true
|
1250
|
-
},
|
1251
|
-
field: { focus: null }
|
1252
|
-
},
|
1253
|
-
indexes: {
|
1254
|
-
nodes: {},
|
1255
|
-
zones: {}
|
1256
|
-
}
|
1257
|
-
};
|
1258
|
-
|
1259
|
-
// ../core/reducer/actions/replace.ts
|
1260
1048
|
var replaceAction = (state, action, appStore) => {
|
1261
1049
|
const [parentId] = action.destinationZone.split(":");
|
1262
1050
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
@@ -1507,6 +1295,21 @@ var removeAction = (state, action, appStore) => {
|
|
1507
1295
|
|
1508
1296
|
// ../core/reducer/actions/register-zone.ts
|
1509
1297
|
init_react_import();
|
1298
|
+
|
1299
|
+
// ../core/lib/data/setup-zone.ts
|
1300
|
+
init_react_import();
|
1301
|
+
var setupZone = (data, zoneKey) => {
|
1302
|
+
if (zoneKey === rootDroppableId) {
|
1303
|
+
return data;
|
1304
|
+
}
|
1305
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
1306
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1307
|
+
});
|
1308
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1309
|
+
return newData;
|
1310
|
+
};
|
1311
|
+
|
1312
|
+
// ../core/reducer/actions/register-zone.ts
|
1510
1313
|
var zoneCache = {};
|
1511
1314
|
function registerZoneAction(state, action) {
|
1512
1315
|
if (zoneCache[action.zone]) {
|
@@ -1659,6 +1462,14 @@ function createReducer({
|
|
1659
1462
|
);
|
1660
1463
|
}
|
1661
1464
|
|
1465
|
+
// ../core/components/ViewportControls/default-viewports.ts
|
1466
|
+
init_react_import();
|
1467
|
+
var defaultViewports = [
|
1468
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1469
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1470
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1471
|
+
];
|
1472
|
+
|
1662
1473
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
1663
1474
|
init_react_import();
|
1664
1475
|
var createStoreImpl = (createState) => {
|
@@ -1908,6 +1719,19 @@ var flattenData = (state, config) => {
|
|
1908
1719
|
return data;
|
1909
1720
|
};
|
1910
1721
|
|
1722
|
+
// ../core/lib/get-changed.ts
|
1723
|
+
init_react_import();
|
1724
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1725
|
+
var getChanged = (newItem, oldItem) => {
|
1726
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1727
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1728
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1729
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1730
|
+
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1731
|
+
});
|
1732
|
+
}, {}) : {};
|
1733
|
+
};
|
1734
|
+
|
1911
1735
|
// ../core/store/slices/permissions.ts
|
1912
1736
|
var createPermissionsSlice = (set, get) => {
|
1913
1737
|
const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
|
@@ -2026,6 +1850,71 @@ var createFieldsSlice = (_set, _get) => {
|
|
2026
1850
|
};
|
2027
1851
|
};
|
2028
1852
|
|
1853
|
+
// ../core/lib/resolve-component-data.ts
|
1854
|
+
init_react_import();
|
1855
|
+
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1856
|
+
var cache = { lastChange: {} };
|
1857
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1858
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1859
|
+
const resolvedItem = __spreadValues({}, item);
|
1860
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1861
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1862
|
+
if (shouldRunResolver) {
|
1863
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1864
|
+
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1865
|
+
return { node: resolved, didChange: false };
|
1866
|
+
}
|
1867
|
+
const changed = getChanged(item, oldItem);
|
1868
|
+
if (onResolveStart) {
|
1869
|
+
onResolveStart(item);
|
1870
|
+
}
|
1871
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1872
|
+
changed,
|
1873
|
+
lastData: oldItem,
|
1874
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1875
|
+
trigger
|
1876
|
+
});
|
1877
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1878
|
+
if (Object.keys(readOnly).length) {
|
1879
|
+
resolvedItem.readOnly = readOnly;
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
let itemWithResolvedChildren = yield mapFields(
|
1883
|
+
resolvedItem,
|
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
|
+
},
|
1903
|
+
config
|
1904
|
+
);
|
1905
|
+
if (shouldRunResolver && onResolveEnd) {
|
1906
|
+
onResolveEnd(resolvedItem);
|
1907
|
+
}
|
1908
|
+
cache.lastChange[id] = {
|
1909
|
+
item,
|
1910
|
+
resolved: itemWithResolvedChildren
|
1911
|
+
};
|
1912
|
+
return {
|
1913
|
+
node: itemWithResolvedChildren,
|
1914
|
+
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1915
|
+
};
|
1916
|
+
});
|
1917
|
+
|
2029
1918
|
// ../core/lib/data/to-root.ts
|
2030
1919
|
init_react_import();
|
2031
1920
|
var toRoot = (item) => {
|
@@ -2043,6 +1932,34 @@ var toRoot = (item) => {
|
|
2043
1932
|
return { props: {}, readOnly };
|
2044
1933
|
};
|
2045
1934
|
|
1935
|
+
// ../core/store/default-app-state.ts
|
1936
|
+
init_react_import();
|
1937
|
+
var defaultAppState = {
|
1938
|
+
data: { content: [], root: {}, zones: {} },
|
1939
|
+
ui: {
|
1940
|
+
leftSideBarVisible: true,
|
1941
|
+
rightSideBarVisible: true,
|
1942
|
+
arrayState: {},
|
1943
|
+
itemSelector: null,
|
1944
|
+
componentList: {},
|
1945
|
+
isDragging: false,
|
1946
|
+
previewMode: "edit",
|
1947
|
+
viewports: {
|
1948
|
+
current: {
|
1949
|
+
width: defaultViewports[0].width,
|
1950
|
+
height: defaultViewports[0].height || "auto"
|
1951
|
+
},
|
1952
|
+
options: [],
|
1953
|
+
controlsVisible: true
|
1954
|
+
},
|
1955
|
+
field: { focus: null }
|
1956
|
+
},
|
1957
|
+
indexes: {
|
1958
|
+
nodes: {},
|
1959
|
+
zones: {}
|
1960
|
+
}
|
1961
|
+
};
|
1962
|
+
|
2046
1963
|
// ../core/store/index.ts
|
2047
1964
|
var defaultPageFields = {
|
2048
1965
|
title: { type: "text" }
|
@@ -2064,7 +1981,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
2064
1981
|
},
|
2065
1982
|
status: "LOADING",
|
2066
1983
|
iframe: {},
|
2067
|
-
metadata: {}
|
1984
|
+
metadata: {},
|
1985
|
+
fieldTransforms: {}
|
2068
1986
|
}, initialAppStore), {
|
2069
1987
|
fields: createFieldsSlice(set, get),
|
2070
1988
|
history: createHistorySlice(set, get),
|
@@ -2220,197 +2138,14 @@ var createAppStore = (initialAppStore) => create()(
|
|
2220
2138
|
})
|
2221
2139
|
);
|
2222
2140
|
var appStoreContext = createContext(createAppStore());
|
2223
|
-
function useAppStore(selector) {
|
2224
|
-
const context = useContext(appStoreContext);
|
2225
|
-
return useStore(context, selector);
|
2226
|
-
}
|
2227
|
-
function useAppStoreApi() {
|
2228
|
-
return useContext(appStoreContext);
|
2229
|
-
}
|
2230
2141
|
|
2231
|
-
// ../core/lib/
|
2232
|
-
var useBreadcrumbs = (renderCount) => {
|
2233
|
-
const selectedId = useAppStore((s) => {
|
2234
|
-
var _a;
|
2235
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2236
|
-
});
|
2237
|
-
const config = useAppStore((s) => s.config);
|
2238
|
-
const path = useAppStore((s) => {
|
2239
|
-
var _a;
|
2240
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2241
|
-
});
|
2242
|
-
const appStore = useAppStoreApi();
|
2243
|
-
return useMemo2(() => {
|
2244
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2245
|
-
var _a, _b, _c;
|
2246
|
-
const [componentId] = zoneCompound.split(":");
|
2247
|
-
if (componentId === "root") {
|
2248
|
-
return {
|
2249
|
-
label: "Page",
|
2250
|
-
selector: null
|
2251
|
-
};
|
2252
|
-
}
|
2253
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
2254
|
-
const parentId = node.path[node.path.length - 1];
|
2255
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2256
|
-
const index = contentIds.indexOf(componentId);
|
2257
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2258
|
-
return {
|
2259
|
-
label,
|
2260
|
-
selector: node ? {
|
2261
|
-
index,
|
2262
|
-
zone: node.path[node.path.length - 1]
|
2263
|
-
} : null
|
2264
|
-
};
|
2265
|
-
})) || [];
|
2266
|
-
if (renderCount) {
|
2267
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2268
|
-
}
|
2269
|
-
return breadcrumbs;
|
2270
|
-
}, [path, renderCount]);
|
2271
|
-
};
|
2272
|
-
|
2273
|
-
// ../core/components/Loader/index.tsx
|
2274
|
-
init_react_import();
|
2275
|
-
|
2276
|
-
// ../core/lib/index.ts
|
2277
|
-
init_react_import();
|
2278
|
-
|
2279
|
-
// ../core/lib/filter.ts
|
2280
|
-
init_react_import();
|
2281
|
-
|
2282
|
-
// ../core/lib/data/reorder.ts
|
2142
|
+
// ../core/lib/get-zoom-config.ts
|
2283
2143
|
init_react_import();
|
2284
2144
|
|
2285
|
-
// ../core/lib/data/replace.ts
|
2286
|
-
init_react_import();
|
2287
|
-
|
2288
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2289
|
-
init_react_import();
|
2290
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2291
|
-
|
2292
|
-
// ../core/components/Loader/index.tsx
|
2293
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
2294
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2295
|
-
var Loader = (_a) => {
|
2296
|
-
var _b = _a, {
|
2297
|
-
color,
|
2298
|
-
size = 16
|
2299
|
-
} = _b, props = __objRest(_b, [
|
2300
|
-
"color",
|
2301
|
-
"size"
|
2302
|
-
]);
|
2303
|
-
return /* @__PURE__ */ jsx4(
|
2304
|
-
"span",
|
2305
|
-
__spreadValues({
|
2306
|
-
className: getClassName2(),
|
2307
|
-
style: {
|
2308
|
-
width: size,
|
2309
|
-
height: size,
|
2310
|
-
color
|
2311
|
-
},
|
2312
|
-
"aria-label": "loading"
|
2313
|
-
}, props)
|
2314
|
-
);
|
2315
|
-
};
|
2316
|
-
|
2317
|
-
// ../core/components/SidebarSection/index.tsx
|
2318
|
-
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
2319
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2320
|
-
var SidebarSection = ({
|
2321
|
-
children,
|
2322
|
-
title,
|
2323
|
-
background,
|
2324
|
-
showBreadcrumbs,
|
2325
|
-
noBorderTop,
|
2326
|
-
noPadding,
|
2327
|
-
isLoading
|
2328
|
-
}) => {
|
2329
|
-
const setUi = useAppStore((s) => s.setUi);
|
2330
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2331
|
-
return /* @__PURE__ */ jsxs(
|
2332
|
-
"div",
|
2333
|
-
{
|
2334
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2335
|
-
style: { background },
|
2336
|
-
children: [
|
2337
|
-
/* @__PURE__ */ jsx5("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
2338
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
2339
|
-
/* @__PURE__ */ jsx5(
|
2340
|
-
"button",
|
2341
|
-
{
|
2342
|
-
type: "button",
|
2343
|
-
className: getClassName3("breadcrumbLabel"),
|
2344
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2345
|
-
children: breadcrumb.label
|
2346
|
-
}
|
2347
|
-
),
|
2348
|
-
/* @__PURE__ */ jsx5(ChevronRight, { size: 16 })
|
2349
|
-
] }, i)) : null,
|
2350
|
-
/* @__PURE__ */ jsx5("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx5(Heading, { rank: "2", size: "xs", children: title }) })
|
2351
|
-
] }) }),
|
2352
|
-
/* @__PURE__ */ jsx5("div", { className: getClassName3("content"), children }),
|
2353
|
-
isLoading && /* @__PURE__ */ jsx5("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx5(Loader, { size: 32 }) })
|
2354
|
-
]
|
2355
|
-
}
|
2356
|
-
);
|
2357
|
-
};
|
2358
|
-
|
2359
|
-
// ../core/components/OutlineList/index.tsx
|
2360
|
-
init_react_import();
|
2361
|
-
|
2362
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2363
|
-
init_react_import();
|
2364
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2365
|
-
|
2366
|
-
// ../core/components/OutlineList/index.tsx
|
2367
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
2368
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2369
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2370
|
-
var OutlineList = ({ children }) => {
|
2371
|
-
return /* @__PURE__ */ jsx6("ul", { className: getClassName4(), children });
|
2372
|
-
};
|
2373
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx6("div", { className: getClassNameItem({ clickable: true }), children });
|
2374
|
-
OutlineList.Item = ({
|
2375
|
-
children,
|
2376
|
-
onClick
|
2377
|
-
}) => {
|
2378
|
-
return /* @__PURE__ */ jsx6(
|
2379
|
-
"li",
|
2380
|
-
{
|
2381
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2382
|
-
onClick,
|
2383
|
-
children
|
2384
|
-
}
|
2385
|
-
);
|
2386
|
-
};
|
2387
|
-
|
2388
|
-
// ../core/lib/scroll-into-view.ts
|
2389
|
-
init_react_import();
|
2390
|
-
var scrollIntoView = (el) => {
|
2391
|
-
const oldStyle = __spreadValues({}, el.style);
|
2392
|
-
el.style.scrollMargin = "256px";
|
2393
|
-
if (el) {
|
2394
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2395
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2396
|
-
}
|
2397
|
-
};
|
2398
|
-
|
2399
|
-
// ../core/lib/get-frame.ts
|
2400
|
-
init_react_import();
|
2401
|
-
var getFrame = () => {
|
2402
|
-
if (typeof window === "undefined") return;
|
2403
|
-
let frameEl = document.querySelector("#preview-frame");
|
2404
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2405
|
-
return frameEl.contentDocument || document;
|
2406
|
-
}
|
2407
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2408
|
-
};
|
2409
|
-
|
2410
2145
|
// src/HeadingAnalyzer.tsx
|
2411
2146
|
import ReactFromJSONModule from "react-from-json";
|
2412
|
-
import { Fragment
|
2413
|
-
var
|
2147
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
2148
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2414
2149
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2415
2150
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
2416
2151
|
var getOutline = ({ frame } = {}) => {
|
@@ -2501,11 +2236,11 @@ var HeadingAnalyzer = () => {
|
|
2501
2236
|
frameObserver.disconnect();
|
2502
2237
|
};
|
2503
2238
|
}, [data]);
|
2504
|
-
return /* @__PURE__ */
|
2505
|
-
/* @__PURE__ */
|
2239
|
+
return /* @__PURE__ */ jsxs("div", { className: getClassName2(), children: [
|
2240
|
+
/* @__PURE__ */ jsxs(
|
2506
2241
|
"small",
|
2507
2242
|
{
|
2508
|
-
className:
|
2243
|
+
className: getClassName2("cssWarning"),
|
2509
2244
|
style: {
|
2510
2245
|
color: "var(--puck-color-red-04)",
|
2511
2246
|
display: "block",
|
@@ -2514,19 +2249,19 @@ var HeadingAnalyzer = () => {
|
|
2514
2249
|
children: [
|
2515
2250
|
"Heading analyzer styles not loaded. Please review the",
|
2516
2251
|
" ",
|
2517
|
-
/* @__PURE__ */
|
2252
|
+
/* @__PURE__ */ jsx2("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2518
2253
|
"."
|
2519
2254
|
]
|
2520
2255
|
}
|
2521
2256
|
),
|
2522
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
2523
|
-
/* @__PURE__ */
|
2257
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx2("div", { children: "No headings." }),
|
2258
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: /* @__PURE__ */ jsx2(
|
2524
2259
|
ReactFromJSON,
|
2525
2260
|
{
|
2526
2261
|
mapping: {
|
2527
|
-
Root: (props) => /* @__PURE__ */
|
2528
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
2529
|
-
/* @__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(
|
2530
2265
|
"small",
|
2531
2266
|
{
|
2532
2267
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2544,14 +2279,14 @@ var HeadingAnalyzer = () => {
|
|
2544
2279
|
}, 2e3);
|
2545
2280
|
}
|
2546
2281
|
},
|
2547
|
-
children: props.missing ? /* @__PURE__ */
|
2548
|
-
/* @__PURE__ */
|
2282
|
+
children: props.missing ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
2283
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2549
2284
|
"H",
|
2550
2285
|
props.rank
|
2551
2286
|
] }),
|
2552
2287
|
": Missing"
|
2553
|
-
] }) : /* @__PURE__ */
|
2554
|
-
/* @__PURE__ */
|
2288
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
2289
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
2555
2290
|
"H",
|
2556
2291
|
props.rank
|
2557
2292
|
] }),
|
@@ -2560,7 +2295,7 @@ var HeadingAnalyzer = () => {
|
|
2560
2295
|
] })
|
2561
2296
|
}
|
2562
2297
|
) }),
|
2563
|
-
/* @__PURE__ */
|
2298
|
+
/* @__PURE__ */ jsx2(OutlineList, { children: props.children })
|
2564
2299
|
] })
|
2565
2300
|
},
|
2566
2301
|
entry: {
|
@@ -2581,12 +2316,10 @@ var HeadingAnalyzer = () => {
|
|
2581
2316
|
] });
|
2582
2317
|
};
|
2583
2318
|
var headingAnalyzer = {
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
] })
|
2589
|
-
}
|
2319
|
+
name: "heading-analyzer",
|
2320
|
+
label: "Audit",
|
2321
|
+
render: HeadingAnalyzer,
|
2322
|
+
icon: /* @__PURE__ */ jsx2(Heading1, {})
|
2590
2323
|
};
|
2591
2324
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2592
2325
|
export {
|
@@ -2633,7 +2366,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2633
2366
|
* See the LICENSE file in the root directory of this source tree.
|
2634
2367
|
*)
|
2635
2368
|
|
2636
|
-
lucide-react/dist/esm/icons/
|
2369
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2637
2370
|
(**
|
2638
2371
|
* @license lucide-react v0.468.0 - ISC
|
2639
2372
|
*
|