@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.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_react12 = 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
|
@@ -1000,275 +1057,6 @@ function insertAction(state, action, appStore) {
|
|
1000
1057
|
|
1001
1058
|
// ../core/reducer/actions/replace.ts
|
1002
1059
|
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
1060
|
var replaceAction = (state, action, appStore) => {
|
1273
1061
|
const [parentId] = action.destinationZone.split(":");
|
1274
1062
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
@@ -1519,6 +1307,21 @@ var removeAction = (state, action, appStore) => {
|
|
1519
1307
|
|
1520
1308
|
// ../core/reducer/actions/register-zone.ts
|
1521
1309
|
init_react_import();
|
1310
|
+
|
1311
|
+
// ../core/lib/data/setup-zone.ts
|
1312
|
+
init_react_import();
|
1313
|
+
var setupZone = (data, zoneKey) => {
|
1314
|
+
if (zoneKey === rootDroppableId) {
|
1315
|
+
return data;
|
1316
|
+
}
|
1317
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
1318
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
1319
|
+
});
|
1320
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
1321
|
+
return newData;
|
1322
|
+
};
|
1323
|
+
|
1324
|
+
// ../core/reducer/actions/register-zone.ts
|
1522
1325
|
var zoneCache = {};
|
1523
1326
|
function registerZoneAction(state, action) {
|
1524
1327
|
if (zoneCache[action.zone]) {
|
@@ -1671,6 +1474,14 @@ function createReducer({
|
|
1671
1474
|
);
|
1672
1475
|
}
|
1673
1476
|
|
1477
|
+
// ../core/components/ViewportControls/default-viewports.ts
|
1478
|
+
init_react_import();
|
1479
|
+
var defaultViewports = [
|
1480
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1481
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1482
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1483
|
+
];
|
1484
|
+
|
1674
1485
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
1675
1486
|
init_react_import();
|
1676
1487
|
var createStoreImpl = (createState) => {
|
@@ -1698,15 +1509,15 @@ var createStore = (createState) => createState ? createStoreImpl(createState) :
|
|
1698
1509
|
|
1699
1510
|
// ../../node_modules/zustand/esm/react.mjs
|
1700
1511
|
init_react_import();
|
1701
|
-
var
|
1512
|
+
var import_react4 = __toESM(require("react"), 1);
|
1702
1513
|
var identity = (arg) => arg;
|
1703
1514
|
function useStore(api, selector = identity) {
|
1704
|
-
const slice =
|
1515
|
+
const slice = import_react4.default.useSyncExternalStore(
|
1705
1516
|
api.subscribe,
|
1706
1517
|
() => selector(api.getState()),
|
1707
1518
|
() => selector(api.getInitialState())
|
1708
1519
|
);
|
1709
|
-
|
1520
|
+
import_react4.default.useDebugValue(slice);
|
1710
1521
|
return slice;
|
1711
1522
|
}
|
1712
1523
|
var createImpl = (createState) => {
|
@@ -1745,15 +1556,15 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1745
1556
|
var subscribeWithSelector = subscribeWithSelectorImpl;
|
1746
1557
|
|
1747
1558
|
// ../core/store/index.ts
|
1748
|
-
var
|
1559
|
+
var import_react9 = require("react");
|
1749
1560
|
|
1750
1561
|
// ../core/store/slices/history.ts
|
1751
1562
|
init_react_import();
|
1752
|
-
var
|
1563
|
+
var import_react6 = require("react");
|
1753
1564
|
|
1754
1565
|
// ../core/lib/use-hotkey.ts
|
1755
1566
|
init_react_import();
|
1756
|
-
var
|
1567
|
+
var import_react5 = require("react");
|
1757
1568
|
var useHotkeyStore = create()(
|
1758
1569
|
subscribeWithSelector((set) => ({
|
1759
1570
|
held: {},
|
@@ -1902,7 +1713,7 @@ var createNodesSlice = (set, get) => ({
|
|
1902
1713
|
|
1903
1714
|
// ../core/store/slices/permissions.ts
|
1904
1715
|
init_react_import();
|
1905
|
-
var
|
1716
|
+
var import_react7 = require("react");
|
1906
1717
|
|
1907
1718
|
// ../core/lib/data/flatten-data.ts
|
1908
1719
|
init_react_import();
|
@@ -1920,6 +1731,19 @@ var flattenData = (state, config) => {
|
|
1920
1731
|
return data;
|
1921
1732
|
};
|
1922
1733
|
|
1734
|
+
// ../core/lib/get-changed.ts
|
1735
|
+
init_react_import();
|
1736
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1737
|
+
var getChanged = (newItem, oldItem) => {
|
1738
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1739
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1740
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1741
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1742
|
+
[item]: !(0, import_fast_deep_equal.default)(oldItemProps[item], newItemProps[item])
|
1743
|
+
});
|
1744
|
+
}, {}) : {};
|
1745
|
+
};
|
1746
|
+
|
1923
1747
|
// ../core/store/slices/permissions.ts
|
1924
1748
|
var createPermissionsSlice = (set, get) => {
|
1925
1749
|
const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
|
@@ -2028,7 +1852,7 @@ var createPermissionsSlice = (set, get) => {
|
|
2028
1852
|
|
2029
1853
|
// ../core/store/slices/fields.ts
|
2030
1854
|
init_react_import();
|
2031
|
-
var
|
1855
|
+
var import_react8 = require("react");
|
2032
1856
|
var createFieldsSlice = (_set, _get) => {
|
2033
1857
|
return {
|
2034
1858
|
fields: {},
|
@@ -2038,6 +1862,71 @@ var createFieldsSlice = (_set, _get) => {
|
|
2038
1862
|
};
|
2039
1863
|
};
|
2040
1864
|
|
1865
|
+
// ../core/lib/resolve-component-data.ts
|
1866
|
+
init_react_import();
|
1867
|
+
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
1868
|
+
var cache = { lastChange: {} };
|
1869
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
1870
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1871
|
+
const resolvedItem = __spreadValues({}, item);
|
1872
|
+
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
1873
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1874
|
+
if (shouldRunResolver) {
|
1875
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1876
|
+
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1877
|
+
return { node: resolved, didChange: false };
|
1878
|
+
}
|
1879
|
+
const changed = getChanged(item, oldItem);
|
1880
|
+
if (onResolveStart) {
|
1881
|
+
onResolveStart(item);
|
1882
|
+
}
|
1883
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1884
|
+
changed,
|
1885
|
+
lastData: oldItem,
|
1886
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1887
|
+
trigger
|
1888
|
+
});
|
1889
|
+
resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
|
1890
|
+
if (Object.keys(readOnly).length) {
|
1891
|
+
resolvedItem.readOnly = readOnly;
|
1892
|
+
}
|
1893
|
+
}
|
1894
|
+
let itemWithResolvedChildren = yield mapFields(
|
1895
|
+
resolvedItem,
|
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
|
+
},
|
1915
|
+
config
|
1916
|
+
);
|
1917
|
+
if (shouldRunResolver && onResolveEnd) {
|
1918
|
+
onResolveEnd(resolvedItem);
|
1919
|
+
}
|
1920
|
+
cache.lastChange[id] = {
|
1921
|
+
item,
|
1922
|
+
resolved: itemWithResolvedChildren
|
1923
|
+
};
|
1924
|
+
return {
|
1925
|
+
node: itemWithResolvedChildren,
|
1926
|
+
didChange: !(0, import_fast_deep_equal2.default)(item, itemWithResolvedChildren)
|
1927
|
+
};
|
1928
|
+
});
|
1929
|
+
|
2041
1930
|
// ../core/lib/data/to-root.ts
|
2042
1931
|
init_react_import();
|
2043
1932
|
var toRoot = (item) => {
|
@@ -2055,6 +1944,34 @@ var toRoot = (item) => {
|
|
2055
1944
|
return { props: {}, readOnly };
|
2056
1945
|
};
|
2057
1946
|
|
1947
|
+
// ../core/store/default-app-state.ts
|
1948
|
+
init_react_import();
|
1949
|
+
var defaultAppState = {
|
1950
|
+
data: { content: [], root: {}, zones: {} },
|
1951
|
+
ui: {
|
1952
|
+
leftSideBarVisible: true,
|
1953
|
+
rightSideBarVisible: true,
|
1954
|
+
arrayState: {},
|
1955
|
+
itemSelector: null,
|
1956
|
+
componentList: {},
|
1957
|
+
isDragging: false,
|
1958
|
+
previewMode: "edit",
|
1959
|
+
viewports: {
|
1960
|
+
current: {
|
1961
|
+
width: defaultViewports[0].width,
|
1962
|
+
height: defaultViewports[0].height || "auto"
|
1963
|
+
},
|
1964
|
+
options: [],
|
1965
|
+
controlsVisible: true
|
1966
|
+
},
|
1967
|
+
field: { focus: null }
|
1968
|
+
},
|
1969
|
+
indexes: {
|
1970
|
+
nodes: {},
|
1971
|
+
zones: {}
|
1972
|
+
}
|
1973
|
+
};
|
1974
|
+
|
2058
1975
|
// ../core/store/index.ts
|
2059
1976
|
var defaultPageFields = {
|
2060
1977
|
title: { type: "text" }
|
@@ -2076,7 +1993,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
2076
1993
|
},
|
2077
1994
|
status: "LOADING",
|
2078
1995
|
iframe: {},
|
2079
|
-
metadata: {}
|
1996
|
+
metadata: {},
|
1997
|
+
fieldTransforms: {}
|
2080
1998
|
}, initialAppStore), {
|
2081
1999
|
fields: createFieldsSlice(set, get),
|
2082
2000
|
history: createHistorySlice(set, get),
|
@@ -2231,198 +2149,15 @@ var createAppStore = (initialAppStore) => create()(
|
|
2231
2149
|
});
|
2232
2150
|
})
|
2233
2151
|
);
|
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
|
-
}
|
2242
|
-
|
2243
|
-
// ../core/lib/use-breadcrumbs.ts
|
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
|
2289
|
-
init_react_import();
|
2290
|
-
|
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
|
-
};
|
2152
|
+
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2399
2153
|
|
2400
|
-
// ../core/lib/
|
2154
|
+
// ../core/lib/get-zoom-config.ts
|
2401
2155
|
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
2156
|
|
2422
2157
|
// src/HeadingAnalyzer.tsx
|
2423
2158
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2424
|
-
var
|
2425
|
-
var
|
2159
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2160
|
+
var getClassName2 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2426
2161
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2427
2162
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2428
2163
|
var getOutline = ({ frame } = {}) => {
|
@@ -2477,8 +2212,8 @@ function buildHierarchy(frame) {
|
|
2477
2212
|
var usePuck = (0, import_puck.createUsePuck)();
|
2478
2213
|
var HeadingAnalyzer = () => {
|
2479
2214
|
const data = usePuck((s) => s.appState.data);
|
2480
|
-
const [hierarchy, setHierarchy] = (0,
|
2481
|
-
(0,
|
2215
|
+
const [hierarchy, setHierarchy] = (0, import_react10.useState)([]);
|
2216
|
+
(0, import_react10.useEffect)(() => {
|
2482
2217
|
const frame = getFrame();
|
2483
2218
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2484
2219
|
const createHierarchy = () => {
|
@@ -2513,11 +2248,11 @@ var HeadingAnalyzer = () => {
|
|
2513
2248
|
frameObserver.disconnect();
|
2514
2249
|
};
|
2515
2250
|
}, [data]);
|
2516
|
-
return /* @__PURE__ */ (0,
|
2517
|
-
/* @__PURE__ */ (0,
|
2251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: getClassName2(), children: [
|
2252
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
2518
2253
|
"small",
|
2519
2254
|
{
|
2520
|
-
className:
|
2255
|
+
className: getClassName2("cssWarning"),
|
2521
2256
|
style: {
|
2522
2257
|
color: "var(--puck-color-red-04)",
|
2523
2258
|
display: "block",
|
@@ -2526,19 +2261,19 @@ var HeadingAnalyzer = () => {
|
|
2526
2261
|
children: [
|
2527
2262
|
"Heading analyzer styles not loaded. Please review the",
|
2528
2263
|
" ",
|
2529
|
-
/* @__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" }),
|
2530
2265
|
"."
|
2531
2266
|
]
|
2532
2267
|
}
|
2533
2268
|
),
|
2534
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2535
|
-
/* @__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)(
|
2536
2271
|
ReactFromJSON,
|
2537
2272
|
{
|
2538
2273
|
mapping: {
|
2539
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2540
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2541
|
-
/* @__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)(
|
2542
2277
|
"small",
|
2543
2278
|
{
|
2544
2279
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2556,14 +2291,14 @@ var HeadingAnalyzer = () => {
|
|
2556
2291
|
}, 2e3);
|
2557
2292
|
}
|
2558
2293
|
},
|
2559
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2560
|
-
/* @__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: [
|
2561
2296
|
"H",
|
2562
2297
|
props.rank
|
2563
2298
|
] }),
|
2564
2299
|
": Missing"
|
2565
|
-
] }) : /* @__PURE__ */ (0,
|
2566
|
-
/* @__PURE__ */ (0,
|
2300
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
2301
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("b", { children: [
|
2567
2302
|
"H",
|
2568
2303
|
props.rank
|
2569
2304
|
] }),
|
@@ -2572,7 +2307,7 @@ var HeadingAnalyzer = () => {
|
|
2572
2307
|
] })
|
2573
2308
|
}
|
2574
2309
|
) }),
|
2575
|
-
/* @__PURE__ */ (0,
|
2310
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OutlineList, { children: props.children })
|
2576
2311
|
] })
|
2577
2312
|
},
|
2578
2313
|
entry: {
|
@@ -2593,12 +2328,10 @@ var HeadingAnalyzer = () => {
|
|
2593
2328
|
] });
|
2594
2329
|
};
|
2595
2330
|
var headingAnalyzer = {
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
] })
|
2601
|
-
}
|
2331
|
+
name: "heading-analyzer",
|
2332
|
+
label: "Audit",
|
2333
|
+
render: HeadingAnalyzer,
|
2334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Heading1, {})
|
2602
2335
|
};
|
2603
2336
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2604
2337
|
/*! Bundled license information:
|
@@ -2642,7 +2375,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2642
2375
|
* See the LICENSE file in the root directory of this source tree.
|
2643
2376
|
*)
|
2644
2377
|
|
2645
|
-
lucide-react/dist/esm/icons/
|
2378
|
+
lucide-react/dist/esm/icons/heading-1.js:
|
2646
2379
|
(**
|
2647
2380
|
* @license lucide-react v0.468.0 - ISC
|
2648
2381
|
*
|