@measured/puck-plugin-heading-analyzer 0.20.0-canary.5780043 → 0.20.0-canary.5cc56415
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 +274 -540
- package/dist/index.mjs +262 -528
- 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_react11 = 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,30 @@ 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
|
476
500
|
init_react_import();
|
477
|
-
|
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
|
512
|
+
init_react_import();
|
513
|
+
var import_react10 = require("react");
|
478
514
|
|
479
515
|
// ../core/store/index.ts
|
480
516
|
init_react_import();
|
@@ -521,7 +557,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
521
557
|
});
|
522
558
|
}
|
523
559
|
|
524
|
-
// ../core/lib/data/map-
|
560
|
+
// ../core/lib/data/map-fields.ts
|
525
561
|
init_react_import();
|
526
562
|
|
527
563
|
// ../core/lib/data/default-slots.ts
|
@@ -531,14 +567,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
531
567
|
value
|
532
568
|
);
|
533
569
|
|
534
|
-
// ../core/lib/data/map-
|
570
|
+
// ../core/lib/data/map-fields.ts
|
535
571
|
var isPromise = (v) => !!v && typeof v.then === "function";
|
536
572
|
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
537
573
|
var containsPromise = (arr) => arr.some(isPromise);
|
538
574
|
var walkField = ({
|
539
575
|
value,
|
540
576
|
fields,
|
541
|
-
|
577
|
+
mappers,
|
542
578
|
propKey = "",
|
543
579
|
propPath = "",
|
544
580
|
id = "",
|
@@ -546,7 +582,9 @@ var walkField = ({
|
|
546
582
|
recurseSlots = false
|
547
583
|
}) => {
|
548
584
|
var _a, _b, _c;
|
549
|
-
|
585
|
+
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
586
|
+
const map = mappers[fieldType];
|
587
|
+
if (map && fieldType === "slot") {
|
550
588
|
const content = value || [];
|
551
589
|
const mappedContent = recurseSlots ? content.map((el) => {
|
552
590
|
var _a2;
|
@@ -558,7 +596,7 @@ var walkField = ({
|
|
558
596
|
return walkField({
|
559
597
|
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
560
598
|
fields: fields2,
|
561
|
-
|
599
|
+
mappers,
|
562
600
|
id: el.props.id,
|
563
601
|
config,
|
564
602
|
recurseSlots
|
@@ -567,7 +605,21 @@ var walkField = ({
|
|
567
605
|
if (containsPromise(mappedContent)) {
|
568
606
|
return Promise.all(mappedContent);
|
569
607
|
}
|
570
|
-
return map(
|
608
|
+
return map({
|
609
|
+
value: mappedContent,
|
610
|
+
parentId: id,
|
611
|
+
propName: propKey,
|
612
|
+
field: fields[propKey],
|
613
|
+
propPath
|
614
|
+
});
|
615
|
+
} else if (map && fields[propKey]) {
|
616
|
+
return map({
|
617
|
+
value,
|
618
|
+
parentId: id,
|
619
|
+
propName: propKey,
|
620
|
+
field: fields[propKey],
|
621
|
+
propPath
|
622
|
+
});
|
571
623
|
}
|
572
624
|
if (value && typeof value === "object") {
|
573
625
|
if (Array.isArray(value)) {
|
@@ -577,7 +629,7 @@ var walkField = ({
|
|
577
629
|
(el, idx) => walkField({
|
578
630
|
value: el,
|
579
631
|
fields: arrayFields,
|
580
|
-
|
632
|
+
mappers,
|
581
633
|
propKey,
|
582
634
|
propPath: `${propPath}[${idx}]`,
|
583
635
|
id,
|
@@ -596,7 +648,7 @@ var walkField = ({
|
|
596
648
|
return walkObject({
|
597
649
|
value,
|
598
650
|
fields: objectFields,
|
599
|
-
|
651
|
+
mappers,
|
600
652
|
id,
|
601
653
|
getPropPath: (k) => `${propPath}.${k}`,
|
602
654
|
config,
|
@@ -609,7 +661,7 @@ var walkField = ({
|
|
609
661
|
var walkObject = ({
|
610
662
|
value,
|
611
663
|
fields,
|
612
|
-
|
664
|
+
mappers,
|
613
665
|
id,
|
614
666
|
getPropPath,
|
615
667
|
config,
|
@@ -619,7 +671,7 @@ var walkObject = ({
|
|
619
671
|
const opts = {
|
620
672
|
value: v,
|
621
673
|
fields,
|
622
|
-
|
674
|
+
mappers,
|
623
675
|
propKey: k,
|
624
676
|
propPath: getPropPath(k),
|
625
677
|
id,
|
@@ -641,14 +693,14 @@ var walkObject = ({
|
|
641
693
|
}
|
642
694
|
return flatten(newProps);
|
643
695
|
};
|
644
|
-
function
|
696
|
+
function mapFields(item, mappers, config, recurseSlots = false) {
|
645
697
|
var _a, _b, _c, _d, _e;
|
646
698
|
const itemType = "type" in item ? item.type : "root";
|
647
699
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
648
700
|
const newProps = walkObject({
|
649
701
|
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
650
702
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
651
|
-
|
703
|
+
mappers,
|
652
704
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
653
705
|
getPropPath: (k) => k,
|
654
706
|
config,
|
@@ -671,7 +723,7 @@ var import_flat = __toESM(require_flat());
|
|
671
723
|
// ../core/lib/data/strip-slots.ts
|
672
724
|
init_react_import();
|
673
725
|
var stripSlots = (data, config) => {
|
674
|
-
return
|
726
|
+
return mapFields(data, { slot: () => null }, config);
|
675
727
|
};
|
676
728
|
|
677
729
|
// ../core/lib/data/flatten-node.ts
|
@@ -724,18 +776,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
724
776
|
const mappedItem = mapNodeOrSkip(item, path, index);
|
725
777
|
if (!mappedItem) return item;
|
726
778
|
const id = mappedItem.props.id;
|
727
|
-
const newProps = __spreadProps(__spreadValues({},
|
779
|
+
const newProps = __spreadProps(__spreadValues({}, mapFields(
|
728
780
|
mappedItem,
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
781
|
+
{
|
782
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
783
|
+
const content = value;
|
784
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
785
|
+
const [_2, newContent2] = processContent(
|
786
|
+
path,
|
787
|
+
zoneCompound,
|
788
|
+
content,
|
789
|
+
"slot",
|
790
|
+
parentId2
|
791
|
+
);
|
792
|
+
return newContent2;
|
793
|
+
}
|
739
794
|
},
|
740
795
|
config
|
741
796
|
).props), {
|
@@ -910,11 +965,14 @@ init_react_import();
|
|
910
965
|
function walkTree(data, config, callbackFn) {
|
911
966
|
var _a, _b;
|
912
967
|
const walkItem = (item) => {
|
913
|
-
return
|
968
|
+
return mapFields(
|
914
969
|
item,
|
915
|
-
|
916
|
-
|
917
|
-
|
970
|
+
{
|
971
|
+
slot: ({ value, parentId, propName }) => {
|
972
|
+
var _a2;
|
973
|
+
const content = value;
|
974
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
975
|
+
}
|
918
976
|
},
|
919
977
|
config,
|
920
978
|
true
|
@@ -1000,275 +1058,6 @@ function insertAction(state, action, appStore) {
|
|
1000
1058
|
|
1001
1059
|
// ../core/reducer/actions/replace.ts
|
1002
1060
|
init_react_import();
|
1003
|
-
|
1004
|
-
// ../core/rsc.tsx
|
1005
|
-
init_react_import();
|
1006
|
-
|
1007
|
-
// ../core/components/ServerRender/index.tsx
|
1008
|
-
init_react_import();
|
1009
|
-
|
1010
|
-
// ../core/lib/data/setup-zone.ts
|
1011
|
-
init_react_import();
|
1012
|
-
var setupZone = (data, zoneKey) => {
|
1013
|
-
if (zoneKey === rootDroppableId) {
|
1014
|
-
return data;
|
1015
|
-
}
|
1016
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
1017
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1018
|
-
});
|
1019
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1020
|
-
return newData;
|
1021
|
-
};
|
1022
|
-
|
1023
|
-
// ../core/lib/use-slots.tsx
|
1024
|
-
init_react_import();
|
1025
|
-
var import_react4 = require("react");
|
1026
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
1027
|
-
const slotProps = (0, import_react4.useMemo)(() => {
|
1028
|
-
const mapped = mapSlots(
|
1029
|
-
item,
|
1030
|
-
(content, _parentId, propName, field, propPath) => {
|
1031
|
-
const wildcardPath = propPath.replace(/\[\d+\]/g, "[*]");
|
1032
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly;
|
1033
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
1034
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
1035
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
1036
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
1037
|
-
}, dzProps), {
|
1038
|
-
zone: propName,
|
1039
|
-
content
|
1040
|
-
}));
|
1041
|
-
return Slot;
|
1042
|
-
},
|
1043
|
-
config
|
1044
|
-
).props;
|
1045
|
-
return mapped;
|
1046
|
-
}, [config, item, readOnly, forceReadOnly]);
|
1047
|
-
const mergedProps = (0, import_react4.useMemo)(
|
1048
|
-
() => __spreadValues(__spreadValues({}, item.props), slotProps),
|
1049
|
-
[item.props, slotProps]
|
1050
|
-
);
|
1051
|
-
return mergedProps;
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
// ../core/components/SlotRender/server.tsx
|
1055
|
-
init_react_import();
|
1056
|
-
var import_react5 = require("react");
|
1057
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
1058
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRender, __spreadValues({}, props));
|
1059
|
-
var Item = ({
|
1060
|
-
config,
|
1061
|
-
item,
|
1062
|
-
metadata
|
1063
|
-
}) => {
|
1064
|
-
const Component = config.components[item.type];
|
1065
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
1066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
1067
|
-
Component.render,
|
1068
|
-
__spreadProps(__spreadValues({}, props), {
|
1069
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
1070
|
-
renderDropZone: DropZoneRender,
|
1071
|
-
metadata: metadata || {}
|
1072
|
-
})
|
1073
|
-
})
|
1074
|
-
);
|
1075
|
-
};
|
1076
|
-
var SlotRender = (0, import_react5.forwardRef)(
|
1077
|
-
function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
|
1078
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className, style, ref, children: content.map((item) => {
|
1079
|
-
if (!config.components[item.type]) {
|
1080
|
-
return null;
|
1081
|
-
}
|
1082
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
1083
|
-
Item,
|
1084
|
-
{
|
1085
|
-
config,
|
1086
|
-
item,
|
1087
|
-
metadata
|
1088
|
-
},
|
1089
|
-
item.props.id
|
1090
|
-
);
|
1091
|
-
}) });
|
1092
|
-
}
|
1093
|
-
);
|
1094
|
-
|
1095
|
-
// ../core/components/ServerRender/index.tsx
|
1096
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
1097
|
-
function DropZoneRender({
|
1098
|
-
zone,
|
1099
|
-
data,
|
1100
|
-
areaId = "root",
|
1101
|
-
config,
|
1102
|
-
metadata = {}
|
1103
|
-
}) {
|
1104
|
-
let zoneCompound = rootDroppableId;
|
1105
|
-
let content = (data == null ? void 0 : data.content) || [];
|
1106
|
-
if (!data || !config) {
|
1107
|
-
return null;
|
1108
|
-
}
|
1109
|
-
if (areaId !== rootAreaId && zone !== rootZone) {
|
1110
|
-
zoneCompound = `${areaId}:${zone}`;
|
1111
|
-
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
1112
|
-
}
|
1113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: content.map((item) => {
|
1114
|
-
const Component = config.components[item.type];
|
1115
|
-
const props = __spreadProps(__spreadValues({}, item.props), {
|
1116
|
-
puck: {
|
1117
|
-
renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
1118
|
-
DropZoneRender,
|
1119
|
-
{
|
1120
|
-
zone: zone2,
|
1121
|
-
data,
|
1122
|
-
areaId: item.props.id,
|
1123
|
-
config,
|
1124
|
-
metadata
|
1125
|
-
}
|
1126
|
-
),
|
1127
|
-
metadata,
|
1128
|
-
dragRef: null,
|
1129
|
-
isEditing: false
|
1130
|
-
}
|
1131
|
-
});
|
1132
|
-
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
1133
|
-
const propsWithSlots = useSlots(config, renderItem, (props2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
|
1134
|
-
if (Component) {
|
1135
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component.render, __spreadValues({}, propsWithSlots), renderItem.props.id);
|
1136
|
-
}
|
1137
|
-
return null;
|
1138
|
-
}) });
|
1139
|
-
}
|
1140
|
-
|
1141
|
-
// ../core/lib/resolve-all-data.ts
|
1142
|
-
init_react_import();
|
1143
|
-
|
1144
|
-
// ../core/lib/resolve-component-data.ts
|
1145
|
-
init_react_import();
|
1146
|
-
|
1147
|
-
// ../core/lib/get-changed.ts
|
1148
|
-
init_react_import();
|
1149
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1150
|
-
var getChanged = (newItem, oldItem) => {
|
1151
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1152
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1153
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1154
|
-
return __spreadProps(__spreadValues({}, acc), {
|
1155
|
-
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1156
|
-
});
|
1157
|
-
}, {}) : {};
|
1158
|
-
};
|
1159
|
-
|
1160
|
-
// ../core/lib/resolve-component-data.ts
|
1161
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1162
|
-
var cache = { lastChange: {} };
|
1163
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1164
|
-
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1165
|
-
const resolvedItem = __spreadValues({}, item);
|
1166
|
-
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1167
|
-
const id = "id" in item.props ? item.props.id : "root";
|
1168
|
-
if (shouldRunResolver) {
|
1169
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1170
|
-
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1171
|
-
return { node: resolved, didChange: false };
|
1172
|
-
}
|
1173
|
-
const changed = getChanged(item, oldItem);
|
1174
|
-
if (onResolveStart) {
|
1175
|
-
onResolveStart(item);
|
1176
|
-
}
|
1177
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1178
|
-
changed,
|
1179
|
-
lastData: oldItem,
|
1180
|
-
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1181
|
-
trigger
|
1182
|
-
});
|
1183
|
-
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1184
|
-
if (Object.keys(readOnly).length) {
|
1185
|
-
resolvedItem.readOnly = readOnly;
|
1186
|
-
}
|
1187
|
-
}
|
1188
|
-
let itemWithResolvedChildren = yield mapSlots(
|
1189
|
-
resolvedItem,
|
1190
|
-
(content) => __async(void 0, null, function* () {
|
1191
|
-
return yield Promise.all(
|
1192
|
-
content.map(
|
1193
|
-
(childItem) => __async(void 0, null, function* () {
|
1194
|
-
return (yield resolveComponentData(
|
1195
|
-
childItem,
|
1196
|
-
config,
|
1197
|
-
metadata,
|
1198
|
-
onResolveStart,
|
1199
|
-
onResolveEnd,
|
1200
|
-
trigger
|
1201
|
-
)).node;
|
1202
|
-
})
|
1203
|
-
)
|
1204
|
-
);
|
1205
|
-
}),
|
1206
|
-
config
|
1207
|
-
);
|
1208
|
-
if (shouldRunResolver && onResolveEnd) {
|
1209
|
-
onResolveEnd(resolvedItem);
|
1210
|
-
}
|
1211
|
-
cache.lastChange[id] = {
|
1212
|
-
item,
|
1213
|
-
resolved: itemWithResolvedChildren
|
1214
|
-
};
|
1215
|
-
return {
|
1216
|
-
node: itemWithResolvedChildren,
|
1217
|
-
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1218
|
-
};
|
1219
|
-
});
|
1220
|
-
|
1221
|
-
// ../core/lib/data/default-data.ts
|
1222
|
-
init_react_import();
|
1223
|
-
|
1224
|
-
// ../core/lib/data/to-component.ts
|
1225
|
-
init_react_import();
|
1226
|
-
|
1227
|
-
// ../core/lib/transform-props.ts
|
1228
|
-
init_react_import();
|
1229
|
-
|
1230
|
-
// ../core/lib/migrate.ts
|
1231
|
-
init_react_import();
|
1232
|
-
|
1233
|
-
// ../core/store/default-app-state.ts
|
1234
|
-
init_react_import();
|
1235
|
-
|
1236
|
-
// ../core/components/ViewportControls/default-viewports.ts
|
1237
|
-
init_react_import();
|
1238
|
-
var defaultViewports = [
|
1239
|
-
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1240
|
-
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1241
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1242
|
-
];
|
1243
|
-
|
1244
|
-
// ../core/store/default-app-state.ts
|
1245
|
-
var defaultAppState = {
|
1246
|
-
data: { content: [], root: {}, zones: {} },
|
1247
|
-
ui: {
|
1248
|
-
leftSideBarVisible: true,
|
1249
|
-
rightSideBarVisible: true,
|
1250
|
-
arrayState: {},
|
1251
|
-
itemSelector: null,
|
1252
|
-
componentList: {},
|
1253
|
-
isDragging: false,
|
1254
|
-
previewMode: "edit",
|
1255
|
-
viewports: {
|
1256
|
-
current: {
|
1257
|
-
width: defaultViewports[0].width,
|
1258
|
-
height: defaultViewports[0].height || "auto"
|
1259
|
-
},
|
1260
|
-
options: [],
|
1261
|
-
controlsVisible: true
|
1262
|
-
},
|
1263
|
-
field: { focus: null }
|
1264
|
-
},
|
1265
|
-
indexes: {
|
1266
|
-
nodes: {},
|
1267
|
-
zones: {}
|
1268
|
-
}
|
1269
|
-
};
|
1270
|
-
|
1271
|
-
// ../core/reducer/actions/replace.ts
|
1272
1061
|
var replaceAction = (state, action, appStore) => {
|
1273
1062
|
const [parentId] = action.destinationZone.split(":");
|
1274
1063
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
@@ -1519,6 +1308,21 @@ var removeAction = (state, action, appStore) => {
|
|
1519
1308
|
|
1520
1309
|
// ../core/reducer/actions/register-zone.ts
|
1521
1310
|
init_react_import();
|
1311
|
+
|
1312
|
+
// ../core/lib/data/setup-zone.ts
|
1313
|
+
init_react_import();
|
1314
|
+
var setupZone = (data, zoneKey) => {
|
1315
|
+
if (zoneKey === rootDroppableId) {
|
1316
|
+
return data;
|
1317
|
+
}
|
1318
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
1319
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1320
|
+
});
|
1321
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1322
|
+
return newData;
|
1323
|
+
};
|
1324
|
+
|
1325
|
+
// ../core/reducer/actions/register-zone.ts
|
1522
1326
|
var zoneCache = {};
|
1523
1327
|
function registerZoneAction(state, action) {
|
1524
1328
|
if (zoneCache[action.zone]) {
|
@@ -1671,6 +1475,14 @@ function createReducer({
|
|
1671
1475
|
);
|
1672
1476
|
}
|
1673
1477
|
|
1478
|
+
// ../core/components/ViewportControls/default-viewports.ts
|
1479
|
+
init_react_import();
|
1480
|
+
var defaultViewports = [
|
1481
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1482
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1483
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1484
|
+
];
|
1485
|
+
|
1674
1486
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
1675
1487
|
init_react_import();
|
1676
1488
|
var createStoreImpl = (createState) => {
|
@@ -1698,15 +1510,15 @@ var createStore = (createState) => createState ? createStoreImpl(createState) :
|
|
1698
1510
|
|
1699
1511
|
// ../../node_modules/zustand/esm/react.mjs
|
1700
1512
|
init_react_import();
|
1701
|
-
var
|
1513
|
+
var import_react4 = __toESM(require("react"), 1);
|
1702
1514
|
var identity = (arg) => arg;
|
1703
1515
|
function useStore(api, selector = identity) {
|
1704
|
-
const slice =
|
1516
|
+
const slice = import_react4.default.useSyncExternalStore(
|
1705
1517
|
api.subscribe,
|
1706
1518
|
() => selector(api.getState()),
|
1707
1519
|
() => selector(api.getInitialState())
|
1708
1520
|
);
|
1709
|
-
|
1521
|
+
import_react4.default.useDebugValue(slice);
|
1710
1522
|
return slice;
|
1711
1523
|
}
|
1712
1524
|
var createImpl = (createState) => {
|
@@ -1745,15 +1557,15 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1745
1557
|
var subscribeWithSelector = subscribeWithSelectorImpl;
|
1746
1558
|
|
1747
1559
|
// ../core/store/index.ts
|
1748
|
-
var
|
1560
|
+
var import_react9 = require("react");
|
1749
1561
|
|
1750
1562
|
// ../core/store/slices/history.ts
|
1751
1563
|
init_react_import();
|
1752
|
-
var
|
1564
|
+
var import_react6 = require("react");
|
1753
1565
|
|
1754
1566
|
// ../core/lib/use-hotkey.ts
|
1755
1567
|
init_react_import();
|
1756
|
-
var
|
1568
|
+
var import_react5 = require("react");
|
1757
1569
|
var useHotkeyStore = create()(
|
1758
1570
|
subscribeWithSelector((set) => ({
|
1759
1571
|
held: {},
|
@@ -1902,7 +1714,7 @@ var createNodesSlice = (set, get) => ({
|
|
1902
1714
|
|
1903
1715
|
// ../core/store/slices/permissions.ts
|
1904
1716
|
init_react_import();
|
1905
|
-
var
|
1717
|
+
var import_react7 = require("react");
|
1906
1718
|
|
1907
1719
|
// ../core/lib/data/flatten-data.ts
|
1908
1720
|
init_react_import();
|
@@ -1920,6 +1732,19 @@ var flattenData = (state, config) => {
|
|
1920
1732
|
return data;
|
1921
1733
|
};
|
1922
1734
|
|
1735
|
+
// ../core/lib/get-changed.ts
|
1736
|
+
init_react_import();
|
1737
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1738
|
+
var getChanged = (newItem, oldItem) => {
|
1739
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1740
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1741
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1742
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1743
|
+
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1744
|
+
});
|
1745
|
+
}, {}) : {};
|
1746
|
+
};
|
1747
|
+
|
1923
1748
|
// ../core/store/slices/permissions.ts
|
1924
1749
|
var createPermissionsSlice = (set, get) => {
|
1925
1750
|
const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
|
@@ -2028,7 +1853,7 @@ var createPermissionsSlice = (set, get) => {
|
|
2028
1853
|
|
2029
1854
|
// ../core/store/slices/fields.ts
|
2030
1855
|
init_react_import();
|
2031
|
-
var
|
1856
|
+
var import_react8 = require("react");
|
2032
1857
|
var createFieldsSlice = (_set, _get) => {
|
2033
1858
|
return {
|
2034
1859
|
fields: {},
|
@@ -2038,6 +1863,71 @@ var createFieldsSlice = (_set, _get) => {
|
|
2038
1863
|
};
|
2039
1864
|
};
|
2040
1865
|
|
1866
|
+
// ../core/lib/resolve-component-data.ts
|
1867
|
+
init_react_import();
|
1868
|
+
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1869
|
+
var cache = { lastChange: {} };
|
1870
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1871
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1872
|
+
const resolvedItem = __spreadValues({}, item);
|
1873
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1874
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1875
|
+
if (shouldRunResolver) {
|
1876
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1877
|
+
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1878
|
+
return { node: resolved, didChange: false };
|
1879
|
+
}
|
1880
|
+
const changed = getChanged(item, oldItem);
|
1881
|
+
if (onResolveStart) {
|
1882
|
+
onResolveStart(item);
|
1883
|
+
}
|
1884
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1885
|
+
changed,
|
1886
|
+
lastData: oldItem,
|
1887
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1888
|
+
trigger
|
1889
|
+
});
|
1890
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1891
|
+
if (Object.keys(readOnly).length) {
|
1892
|
+
resolvedItem.readOnly = readOnly;
|
1893
|
+
}
|
1894
|
+
}
|
1895
|
+
let itemWithResolvedChildren = yield mapFields(
|
1896
|
+
resolvedItem,
|
1897
|
+
{
|
1898
|
+
slot: (_02) => __async(void 0, [_02], function* ({ value }) {
|
1899
|
+
const content = value;
|
1900
|
+
return yield Promise.all(
|
1901
|
+
content.map(
|
1902
|
+
(childItem) => __async(void 0, null, function* () {
|
1903
|
+
return (yield resolveComponentData(
|
1904
|
+
childItem,
|
1905
|
+
config,
|
1906
|
+
metadata,
|
1907
|
+
onResolveStart,
|
1908
|
+
onResolveEnd,
|
1909
|
+
trigger
|
1910
|
+
)).node;
|
1911
|
+
})
|
1912
|
+
)
|
1913
|
+
);
|
1914
|
+
})
|
1915
|
+
},
|
1916
|
+
config
|
1917
|
+
);
|
1918
|
+
if (shouldRunResolver && onResolveEnd) {
|
1919
|
+
onResolveEnd(resolvedItem);
|
1920
|
+
}
|
1921
|
+
cache.lastChange[id] = {
|
1922
|
+
item,
|
1923
|
+
resolved: itemWithResolvedChildren
|
1924
|
+
};
|
1925
|
+
return {
|
1926
|
+
node: itemWithResolvedChildren,
|
1927
|
+
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1928
|
+
};
|
1929
|
+
});
|
1930
|
+
|
2041
1931
|
// ../core/lib/data/to-root.ts
|
2042
1932
|
init_react_import();
|
2043
1933
|
var toRoot = (item) => {
|
@@ -2055,6 +1945,34 @@ var toRoot = (item) => {
|
|
2055
1945
|
return { props: {}, readOnly };
|
2056
1946
|
};
|
2057
1947
|
|
1948
|
+
// ../core/store/default-app-state.ts
|
1949
|
+
init_react_import();
|
1950
|
+
var defaultAppState = {
|
1951
|
+
data: { content: [], root: {}, zones: {} },
|
1952
|
+
ui: {
|
1953
|
+
leftSideBarVisible: true,
|
1954
|
+
rightSideBarVisible: true,
|
1955
|
+
arrayState: {},
|
1956
|
+
itemSelector: null,
|
1957
|
+
componentList: {},
|
1958
|
+
isDragging: false,
|
1959
|
+
previewMode: "edit",
|
1960
|
+
viewports: {
|
1961
|
+
current: {
|
1962
|
+
width: defaultViewports[0].width,
|
1963
|
+
height: defaultViewports[0].height || "auto"
|
1964
|
+
},
|
1965
|
+
options: [],
|
1966
|
+
controlsVisible: true
|
1967
|
+
},
|
1968
|
+
field: { focus: null }
|
1969
|
+
},
|
1970
|
+
indexes: {
|
1971
|
+
nodes: {},
|
1972
|
+
zones: {}
|
1973
|
+
}
|
1974
|
+
};
|
1975
|
+
|
2058
1976
|
// ../core/store/index.ts
|
2059
1977
|
var defaultPageFields = {
|
2060
1978
|
title: { type: "text" }
|
@@ -2076,7 +1994,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
2076
1994
|
},
|
2077
1995
|
status: "LOADING",
|
2078
1996
|
iframe: {},
|
2079
|
-
metadata: {}
|
1997
|
+
metadata: {},
|
1998
|
+
fieldTransforms: {}
|
2080
1999
|
}, initialAppStore), {
|
2081
2000
|
fields: createFieldsSlice(set, get),
|
2082
2001
|
history: createHistorySlice(set, get),
|
@@ -2231,198 +2150,15 @@ var createAppStore = (initialAppStore) => create()(
|
|
2231
2150
|
});
|
2232
2151
|
})
|
2233
2152
|
);
|
2234
|
-
var appStoreContext = (0,
|
2235
|
-
function useAppStore(selector) {
|
2236
|
-
const context = (0, import_react11.useContext)(appStoreContext);
|
2237
|
-
return useStore(context, selector);
|
2238
|
-
}
|
2239
|
-
function useAppStoreApi() {
|
2240
|
-
return (0, import_react11.useContext)(appStoreContext);
|
2241
|
-
}
|
2153
|
+
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2242
2154
|
|
2243
|
-
// ../core/lib/
|
2244
|
-
var useBreadcrumbs = (renderCount) => {
|
2245
|
-
const selectedId = useAppStore((s) => {
|
2246
|
-
var _a;
|
2247
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2248
|
-
});
|
2249
|
-
const config = useAppStore((s) => s.config);
|
2250
|
-
const path = useAppStore((s) => {
|
2251
|
-
var _a;
|
2252
|
-
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2253
|
-
});
|
2254
|
-
const appStore = useAppStoreApi();
|
2255
|
-
return (0, import_react12.useMemo)(() => {
|
2256
|
-
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2257
|
-
var _a, _b, _c;
|
2258
|
-
const [componentId] = zoneCompound.split(":");
|
2259
|
-
if (componentId === "root") {
|
2260
|
-
return {
|
2261
|
-
label: "Page",
|
2262
|
-
selector: null
|
2263
|
-
};
|
2264
|
-
}
|
2265
|
-
const node = appStore.getState().state.indexes.nodes[componentId];
|
2266
|
-
const parentId = node.path[node.path.length - 1];
|
2267
|
-
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2268
|
-
const index = contentIds.indexOf(componentId);
|
2269
|
-
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2270
|
-
return {
|
2271
|
-
label,
|
2272
|
-
selector: node ? {
|
2273
|
-
index,
|
2274
|
-
zone: node.path[node.path.length - 1]
|
2275
|
-
} : null
|
2276
|
-
};
|
2277
|
-
})) || [];
|
2278
|
-
if (renderCount) {
|
2279
|
-
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2280
|
-
}
|
2281
|
-
return breadcrumbs;
|
2282
|
-
}, [path, renderCount]);
|
2283
|
-
};
|
2284
|
-
|
2285
|
-
// ../core/components/Loader/index.tsx
|
2286
|
-
init_react_import();
|
2287
|
-
|
2288
|
-
// ../core/lib/index.ts
|
2155
|
+
// ../core/lib/get-zoom-config.ts
|
2289
2156
|
init_react_import();
|
2290
2157
|
|
2291
|
-
// ../core/lib/filter.ts
|
2292
|
-
init_react_import();
|
2293
|
-
|
2294
|
-
// ../core/lib/data/reorder.ts
|
2295
|
-
init_react_import();
|
2296
|
-
|
2297
|
-
// ../core/lib/data/replace.ts
|
2298
|
-
init_react_import();
|
2299
|
-
|
2300
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2301
|
-
init_react_import();
|
2302
|
-
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2303
|
-
|
2304
|
-
// ../core/components/Loader/index.tsx
|
2305
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2306
|
-
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2307
|
-
var Loader = (_a) => {
|
2308
|
-
var _b = _a, {
|
2309
|
-
color,
|
2310
|
-
size = 16
|
2311
|
-
} = _b, props = __objRest(_b, [
|
2312
|
-
"color",
|
2313
|
-
"size"
|
2314
|
-
]);
|
2315
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
2316
|
-
"span",
|
2317
|
-
__spreadValues({
|
2318
|
-
className: getClassName2(),
|
2319
|
-
style: {
|
2320
|
-
width: size,
|
2321
|
-
height: size,
|
2322
|
-
color
|
2323
|
-
},
|
2324
|
-
"aria-label": "loading"
|
2325
|
-
}, props)
|
2326
|
-
);
|
2327
|
-
};
|
2328
|
-
|
2329
|
-
// ../core/components/SidebarSection/index.tsx
|
2330
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
2331
|
-
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2332
|
-
var SidebarSection = ({
|
2333
|
-
children,
|
2334
|
-
title,
|
2335
|
-
background,
|
2336
|
-
showBreadcrumbs,
|
2337
|
-
noBorderTop,
|
2338
|
-
noPadding,
|
2339
|
-
isLoading
|
2340
|
-
}) => {
|
2341
|
-
const setUi = useAppStore((s) => s.setUi);
|
2342
|
-
const breadcrumbs = useBreadcrumbs(1);
|
2343
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
2344
|
-
"div",
|
2345
|
-
{
|
2346
|
-
className: getClassName3({ noBorderTop, noPadding }),
|
2347
|
-
style: { background },
|
2348
|
-
children: [
|
2349
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
2350
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
2351
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2352
|
-
"button",
|
2353
|
-
{
|
2354
|
-
type: "button",
|
2355
|
-
className: getClassName3("breadcrumbLabel"),
|
2356
|
-
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2357
|
-
children: breadcrumb.label
|
2358
|
-
}
|
2359
|
-
),
|
2360
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronRight, { size: 16 })
|
2361
|
-
] }, i)) : null,
|
2362
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
2363
|
-
] }) }),
|
2364
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("content"), children }),
|
2365
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Loader, { size: 32 }) })
|
2366
|
-
]
|
2367
|
-
}
|
2368
|
-
);
|
2369
|
-
};
|
2370
|
-
|
2371
|
-
// ../core/components/OutlineList/index.tsx
|
2372
|
-
init_react_import();
|
2373
|
-
|
2374
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2375
|
-
init_react_import();
|
2376
|
-
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2377
|
-
|
2378
|
-
// ../core/components/OutlineList/index.tsx
|
2379
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
2380
|
-
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2381
|
-
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2382
|
-
var OutlineList = ({ children }) => {
|
2383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: getClassName4(), children });
|
2384
|
-
};
|
2385
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
2386
|
-
OutlineList.Item = ({
|
2387
|
-
children,
|
2388
|
-
onClick
|
2389
|
-
}) => {
|
2390
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
2391
|
-
"li",
|
2392
|
-
{
|
2393
|
-
className: getClassNameItem({ clickable: !!onClick }),
|
2394
|
-
onClick,
|
2395
|
-
children
|
2396
|
-
}
|
2397
|
-
);
|
2398
|
-
};
|
2399
|
-
|
2400
|
-
// ../core/lib/scroll-into-view.ts
|
2401
|
-
init_react_import();
|
2402
|
-
var scrollIntoView = (el) => {
|
2403
|
-
const oldStyle = __spreadValues({}, el.style);
|
2404
|
-
el.style.scrollMargin = "256px";
|
2405
|
-
if (el) {
|
2406
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2407
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2408
|
-
}
|
2409
|
-
};
|
2410
|
-
|
2411
|
-
// ../core/lib/get-frame.ts
|
2412
|
-
init_react_import();
|
2413
|
-
var getFrame = () => {
|
2414
|
-
if (typeof window === "undefined") return;
|
2415
|
-
let frameEl = document.querySelector("#preview-frame");
|
2416
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2417
|
-
return frameEl.contentDocument || document;
|
2418
|
-
}
|
2419
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2420
|
-
};
|
2421
|
-
|
2422
2158
|
// src/HeadingAnalyzer.tsx
|
2423
2159
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2424
|
-
var
|
2425
|
-
var
|
2160
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2161
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2426
2162
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2427
2163
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2428
2164
|
var getOutline = ({ frame } = {}) => {
|
@@ -2477,8 +2213,8 @@ function buildHierarchy(frame) {
|
|
2477
2213
|
var usePuck = (0, import_puck.createUsePuck)();
|
2478
2214
|
var HeadingAnalyzer = () => {
|
2479
2215
|
const data = usePuck((s) => s.appState.data);
|
2480
|
-
const [hierarchy, setHierarchy] = (0,
|
2481
|
-
(0,
|
2216
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
2217
|
+
(0, import_react11.useEffect)(() => {
|
2482
2218
|
const frame = getFrame();
|
2483
2219
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2484
2220
|
const createHierarchy = () => {
|
@@ -2513,11 +2249,11 @@ var HeadingAnalyzer = () => {
|
|
2513
2249
|
frameObserver.disconnect();
|
2514
2250
|
};
|
2515
2251
|
}, [data]);
|
2516
|
-
return /* @__PURE__ */ (0,
|
2517
|
-
/* @__PURE__ */ (0,
|
2252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
2518
2254
|
"small",
|
2519
2255
|
{
|
2520
|
-
className:
|
2256
|
+
className: getClassName2("cssWarning"),
|
2521
2257
|
style: {
|
2522
2258
|
color: "var(--puck-color-red-04)",
|
2523
2259
|
display: "block",
|
@@ -2526,19 +2262,19 @@ var HeadingAnalyzer = () => {
|
|
2526
2262
|
children: [
|
2527
2263
|
"Heading analyzer styles not loaded. Please review the",
|
2528
2264
|
" ",
|
2529
|
-
/* @__PURE__ */ (0,
|
2265
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2530
2266
|
"."
|
2531
2267
|
]
|
2532
2268
|
}
|
2533
2269
|
),
|
2534
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2535
|
-
/* @__PURE__ */ (0,
|
2270
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "No headings." }),
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2536
2272
|
ReactFromJSON,
|
2537
2273
|
{
|
2538
2274
|
mapping: {
|
2539
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2540
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2541
|
-
/* @__PURE__ */ (0,
|
2275
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: props.children }),
|
2276
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(OutlineList.Item, { children: [
|
2277
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2542
2278
|
"small",
|
2543
2279
|
{
|
2544
2280
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2556,14 +2292,14 @@ var HeadingAnalyzer = () => {
|
|
2556
2292
|
}, 2e3);
|
2557
2293
|
}
|
2558
2294
|
},
|
2559
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2560
|
-
/* @__PURE__ */ (0,
|
2295
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2561
2297
|
"H",
|
2562
2298
|
props.rank
|
2563
2299
|
] }),
|
2564
2300
|
": Missing"
|
2565
|
-
] }) : /* @__PURE__ */ (0,
|
2566
|
-
/* @__PURE__ */ (0,
|
2301
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2302
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2567
2303
|
"H",
|
2568
2304
|
props.rank
|
2569
2305
|
] }),
|
@@ -2572,7 +2308,7 @@ var HeadingAnalyzer = () => {
|
|
2572
2308
|
] })
|
2573
2309
|
}
|
2574
2310
|
) }),
|
2575
|
-
/* @__PURE__ */ (0,
|
2311
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
|
2576
2312
|
] })
|
2577
2313
|
},
|
2578
2314
|
entry: {
|
@@ -2593,12 +2329,10 @@ var HeadingAnalyzer = () => {
|
|
2593
2329
|
] });
|
2594
2330
|
};
|
2595
2331
|
var headingAnalyzer = {
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
] })
|
2601
|
-
}
|
2332
|
+
name: "heading-analyzer",
|
2333
|
+
label: "Audit",
|
2334
|
+
render: HeadingAnalyzer,
|
2335
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
|
2602
2336
|
};
|
2603
2337
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2604
2338
|
/*! Bundled license information:
|
@@ -2642,7 +2376,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2642
2376
|
* See the LICENSE file in the root directory of this source tree.
|
2643
2377
|
*)
|
2644
2378
|
|
2645
|
-
lucide-react/dist/esm/icons/
|
2379
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2646
2380
|
(**
|
2647
2381
|
* @license lucide-react v0.468.0 - ISC
|
2648
2382
|
*
|