@puckeditor/core 0.23.0 → 0.24.0-canary.03e660bb
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/LICENSE +21 -0
- package/dist/{Editor-44C53YAG.mjs → Editor-7KNCA6HK.mjs} +9 -9
- package/dist/{Render-DQXAYUBI.mjs → Render-H3USS5FU.mjs} +2 -2
- package/dist/{actions-DA1J5F56.d.mts → actions-BEt6vA0O.d.mts} +78 -20
- package/dist/{actions-DA1J5F56.d.ts → actions-BEt6vA0O.d.ts} +78 -20
- package/dist/{chunk-YQWFSBOU.mjs → chunk-3GJJSXCL.mjs} +138 -50
- package/dist/{chunk-55V3NZVF.mjs → chunk-DQGTW26I.mjs} +1678 -1064
- package/dist/{chunk-NJTGWYYH.mjs → chunk-EPCBCOJF.mjs} +1 -1
- package/dist/{chunk-4P4VZS4P.mjs → chunk-I4C7LRQ7.mjs} +1 -1
- package/dist/{chunk-GNR2HNTB.mjs → chunk-J6CJWYPQ.mjs} +8 -8
- package/dist/{chunk-WF6I3XOL.mjs → chunk-NZHU34KT.mjs} +4 -4
- package/dist/{chunk-Y2EFNT5P.mjs → chunk-OT7NKYY4.mjs} +2 -2
- package/dist/{chunk-K2LNXU54.mjs → chunk-SBDTCWI2.mjs} +109 -76
- package/dist/{chunk-67Y7M4OJ.mjs → chunk-VCJQYLHO.mjs} +1 -1
- package/dist/{chunk-ZRAERXB4.mjs → chunk-XMN55NON.mjs} +3 -2
- package/dist/{chunk-2CNEFIQP.mjs → chunk-ZOLLDKZQ.mjs} +4 -1
- package/dist/{full-7ZJV44EE.mjs → full-FCIISNOL.mjs} +7 -7
- package/dist/{index-DIZKfHDN.d.ts → index-BjizoAHc.d.ts} +1 -1
- package/dist/{index-n9eR_SWx.d.mts → index-Cw7CQGG8.d.mts} +1 -1
- package/dist/index.css +217 -51
- package/dist/index.d.mts +50 -9
- package/dist/index.d.ts +50 -9
- package/dist/index.js +2227 -1485
- package/dist/index.mjs +16 -10
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-36WRJPBT.mjs → loaded-6K36DBBN.mjs} +4 -4
- package/dist/{loaded-SMPR6KZF.mjs → loaded-GZTG57BI.mjs} +4 -4
- package/dist/{loaded-JKA25A3T.mjs → loaded-SBKSTOMK.mjs} +4 -4
- package/dist/no-external.css +217 -51
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +2227 -1485
- package/dist/no-external.mjs +16 -10
- package/dist/rsc.d.mts +4 -3
- package/dist/rsc.d.ts +4 -3
- package/dist/rsc.js +194 -71
- package/dist/rsc.mjs +51 -21
- package/dist/{walk-tree-DbY5zG2K.d.ts → walk-tree-COvy_ERJ.d.ts} +1 -1
- package/dist/{walk-tree-DHP1pWEM.d.mts → walk-tree-CrM-tWuf.d.mts} +1 -1
- package/package.json +34 -33
package/dist/no-external.mjs
CHANGED
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
Button,
|
|
4
4
|
Drawer,
|
|
5
5
|
DropZone,
|
|
6
|
+
FieldGroup,
|
|
7
|
+
FieldGroupItem,
|
|
6
8
|
FieldLabel,
|
|
9
|
+
InlineTextField,
|
|
7
10
|
Puck,
|
|
8
11
|
Render,
|
|
9
12
|
blocksPlugin,
|
|
@@ -17,20 +20,20 @@ import {
|
|
|
17
20
|
setDeep,
|
|
18
21
|
useGetPuck,
|
|
19
22
|
usePuck
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-DQGTW26I.mjs";
|
|
24
|
+
import "./chunk-NZHU34KT.mjs";
|
|
22
25
|
import {
|
|
23
26
|
migrate,
|
|
24
27
|
resolveAllData,
|
|
25
28
|
transformProps
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-3GJJSXCL.mjs";
|
|
27
30
|
import "./chunk-H635BA2V.mjs";
|
|
28
31
|
import {
|
|
29
32
|
RichTextMenu
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-J6CJWYPQ.mjs";
|
|
34
|
+
import "./chunk-VCJQYLHO.mjs";
|
|
35
|
+
import "./chunk-I4C7LRQ7.mjs";
|
|
36
|
+
import "./chunk-EPCBCOJF.mjs";
|
|
34
37
|
import {
|
|
35
38
|
Action,
|
|
36
39
|
ActionBar,
|
|
@@ -38,10 +41,10 @@ import {
|
|
|
38
41
|
IconButton,
|
|
39
42
|
Label,
|
|
40
43
|
Separator
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-SBDTCWI2.mjs";
|
|
42
45
|
import "./chunk-Z2MS6UIF.mjs";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-XMN55NON.mjs";
|
|
47
|
+
import "./chunk-OT7NKYY4.mjs";
|
|
45
48
|
import {
|
|
46
49
|
walkTree
|
|
47
50
|
} from "./chunk-H65MT2JK.mjs";
|
|
@@ -58,9 +61,12 @@ export {
|
|
|
58
61
|
Button,
|
|
59
62
|
Drawer,
|
|
60
63
|
DropZone,
|
|
64
|
+
FieldGroup,
|
|
65
|
+
FieldGroupItem,
|
|
61
66
|
FieldLabel,
|
|
62
67
|
Group,
|
|
63
68
|
IconButton,
|
|
69
|
+
InlineTextField,
|
|
64
70
|
Label,
|
|
65
71
|
Puck,
|
|
66
72
|
Render,
|
package/dist/rsc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { n as Config, ap as UserGenerics, Y as Metadata, Q as FieldTransforms } from './actions-BEt6vA0O.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CrM-tWuf.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@tiptap/react';
|
|
6
6
|
import '@tiptap/extension-blockquote';
|
|
@@ -18,10 +18,11 @@ import '@tiptap/extension-strike';
|
|
|
18
18
|
import '@tiptap/extension-text-align';
|
|
19
19
|
import '@tiptap/extension-underline';
|
|
20
20
|
|
|
21
|
-
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
|
21
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, fieldTransforms: userFieldTransforms, }: {
|
|
22
22
|
config: UserConfig;
|
|
23
23
|
data: G["UserData"];
|
|
24
24
|
metadata?: Metadata;
|
|
25
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
25
26
|
}): react_jsx_runtime.JSX.Element;
|
|
26
27
|
|
|
27
28
|
export { Render };
|
package/dist/rsc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { n as Config, ap as UserGenerics, Y as Metadata, Q as FieldTransforms } from './actions-BEt6vA0O.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-COvy_ERJ.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@tiptap/react';
|
|
6
6
|
import '@tiptap/extension-blockquote';
|
|
@@ -18,10 +18,11 @@ import '@tiptap/extension-strike';
|
|
|
18
18
|
import '@tiptap/extension-text-align';
|
|
19
19
|
import '@tiptap/extension-underline';
|
|
20
20
|
|
|
21
|
-
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
|
21
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, fieldTransforms: userFieldTransforms, }: {
|
|
22
22
|
config: UserConfig;
|
|
23
23
|
data: G["UserData"];
|
|
24
24
|
metadata?: Metadata;
|
|
25
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
25
26
|
}): react_jsx_runtime.JSX.Element;
|
|
26
27
|
|
|
27
28
|
export { Render };
|
package/dist/rsc.js
CHANGED
|
@@ -91,9 +91,9 @@ var init_react_import = __esm({
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
// ../../node_modules/classnames/index.js
|
|
94
|
+
// ../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
95
95
|
var require_classnames = __commonJS({
|
|
96
|
-
"../../node_modules/classnames/index.js"(exports2, module2) {
|
|
96
|
+
"../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports2, module2) {
|
|
97
97
|
"use strict";
|
|
98
98
|
init_react_import();
|
|
99
99
|
(function() {
|
|
@@ -235,7 +235,10 @@ var init_extension = __esm({
|
|
|
235
235
|
name: "puckRichText",
|
|
236
236
|
addExtensions() {
|
|
237
237
|
const extensions = [];
|
|
238
|
-
const options = __spreadValues(
|
|
238
|
+
const options = __spreadValues({}, this.options);
|
|
239
|
+
if (options.textAlign !== false) {
|
|
240
|
+
options.textAlign = __spreadValues(__spreadValues({}, defaultPuckRichTextOptions.textAlign), options.textAlign);
|
|
241
|
+
}
|
|
239
242
|
if (options.bold !== false) {
|
|
240
243
|
extensions.push(import_extension_bold.Bold.configure(options.bold));
|
|
241
244
|
}
|
|
@@ -376,20 +379,7 @@ var rootAreaId = "root";
|
|
|
376
379
|
var rootZone = "default-zone";
|
|
377
380
|
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
|
378
381
|
|
|
379
|
-
// lib/
|
|
380
|
-
init_react_import();
|
|
381
|
-
var setupZone = (data, zoneKey) => {
|
|
382
|
-
if (zoneKey === rootDroppableId) {
|
|
383
|
-
return data;
|
|
384
|
-
}
|
|
385
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
|
386
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
|
387
|
-
});
|
|
388
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
|
389
|
-
return newData;
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
// lib/use-slots.tsx
|
|
382
|
+
// lib/props/render/use-render-props.tsx
|
|
393
383
|
init_react_import();
|
|
394
384
|
|
|
395
385
|
// lib/field-transforms/use-field-transforms.tsx
|
|
@@ -613,21 +603,6 @@ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
|
613
603
|
}
|
|
614
604
|
});
|
|
615
605
|
|
|
616
|
-
// lib/use-slots.tsx
|
|
617
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
618
|
-
return useFieldTransforms(
|
|
619
|
-
config,
|
|
620
|
-
item,
|
|
621
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
622
|
-
readOnly,
|
|
623
|
-
forceReadOnly
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
// components/SlotRender/server.tsx
|
|
628
|
-
init_react_import();
|
|
629
|
-
var import_react5 = require("react");
|
|
630
|
-
|
|
631
606
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
632
607
|
init_react_import();
|
|
633
608
|
var import_react4 = require("react");
|
|
@@ -673,11 +648,14 @@ var RichTextRender2 = (0, import_react4.lazy)(
|
|
|
673
648
|
default: m.RichTextRender
|
|
674
649
|
}))
|
|
675
650
|
);
|
|
676
|
-
function useRichtextProps(fields, props) {
|
|
651
|
+
function useRichtextProps(fields, props, fieldTransforms) {
|
|
677
652
|
const findAllRichtextKeys = (fields2, path = []) => {
|
|
678
653
|
if (!fields2) return [];
|
|
679
654
|
const result = [];
|
|
680
655
|
for (const [key, field] of Object.entries(fields2)) {
|
|
656
|
+
if (fieldTransforms == null ? void 0 : fieldTransforms[field.type]) {
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
681
659
|
const currentPath = [...path, key];
|
|
682
660
|
if (field.type === "richtext") {
|
|
683
661
|
result.push({
|
|
@@ -694,7 +672,10 @@ function useRichtextProps(fields, props) {
|
|
|
694
672
|
}
|
|
695
673
|
return result;
|
|
696
674
|
};
|
|
697
|
-
const richtextKeys = (0, import_react4.useMemo)(
|
|
675
|
+
const richtextKeys = (0, import_react4.useMemo)(
|
|
676
|
+
() => findAllRichtextKeys(fields),
|
|
677
|
+
[fields, fieldTransforms]
|
|
678
|
+
);
|
|
698
679
|
const richtextProps = (0, import_react4.useMemo)(() => {
|
|
699
680
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
700
681
|
let result = __spreadValues({}, props);
|
|
@@ -713,20 +694,122 @@ function useRichtextProps(fields, props) {
|
|
|
713
694
|
return richtextProps;
|
|
714
695
|
}
|
|
715
696
|
|
|
697
|
+
// lib/props/render/use-render-props.tsx
|
|
698
|
+
var EMPTY_FIELD_CONFIG = {};
|
|
699
|
+
function useRenderProps(config, component, renderSlot, fieldTransforms) {
|
|
700
|
+
var _a, _b;
|
|
701
|
+
const transformedProps = useFieldTransforms(
|
|
702
|
+
config,
|
|
703
|
+
component,
|
|
704
|
+
__spreadValues(__spreadValues({}, getSlotTransform(renderSlot)), fieldTransforms),
|
|
705
|
+
void 0,
|
|
706
|
+
true
|
|
707
|
+
);
|
|
708
|
+
const isRoot = !("type" in component) || component.type === "root";
|
|
709
|
+
const componentFields = isRoot ? (_a = config.root) == null ? void 0 : _a.fields : ((_b = config.components[component.type]) == null ? void 0 : _b.fields) || EMPTY_FIELD_CONFIG;
|
|
710
|
+
const richtextProps = useRichtextProps(
|
|
711
|
+
componentFields,
|
|
712
|
+
transformedProps,
|
|
713
|
+
fieldTransforms
|
|
714
|
+
);
|
|
715
|
+
return __spreadValues(__spreadValues({}, transformedProps), richtextProps);
|
|
716
|
+
}
|
|
717
|
+
var use_render_props_default = useRenderProps;
|
|
718
|
+
|
|
719
|
+
// lib/data/setup-zone.ts
|
|
720
|
+
init_react_import();
|
|
721
|
+
var setupZone = (data, zoneKey) => {
|
|
722
|
+
if (zoneKey === rootDroppableId) {
|
|
723
|
+
return data;
|
|
724
|
+
}
|
|
725
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
|
726
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
|
727
|
+
});
|
|
728
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
|
729
|
+
return newData;
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// components/SlotRender/server.tsx
|
|
733
|
+
init_react_import();
|
|
734
|
+
var import_react5 = require("react");
|
|
735
|
+
|
|
736
|
+
// lib/props/shared/get-drop-zone-props.ts
|
|
737
|
+
init_react_import();
|
|
738
|
+
var CONSUMED_PROP_KEYS = {
|
|
739
|
+
zone: true,
|
|
740
|
+
allow: true,
|
|
741
|
+
disallow: true,
|
|
742
|
+
style: true,
|
|
743
|
+
minEmptyHeight: true,
|
|
744
|
+
className: true,
|
|
745
|
+
collisionAxis: true,
|
|
746
|
+
ref: true,
|
|
747
|
+
as: true,
|
|
748
|
+
content: true,
|
|
749
|
+
config: true,
|
|
750
|
+
metadata: true,
|
|
751
|
+
fieldTransforms: true
|
|
752
|
+
};
|
|
753
|
+
var NON_FORWARDABLE_PROP_KEYS = {
|
|
754
|
+
children: true,
|
|
755
|
+
dangerouslySetInnerHTML: true
|
|
756
|
+
};
|
|
757
|
+
var CONSUMED_KEY_SET = new Set(
|
|
758
|
+
Object.keys(CONSUMED_PROP_KEYS)
|
|
759
|
+
);
|
|
760
|
+
var NON_FORWARDABLE_KEY_SET = new Set(
|
|
761
|
+
Object.keys(NON_FORWARDABLE_PROP_KEYS)
|
|
762
|
+
);
|
|
763
|
+
var getDropZoneProps = (allProps) => {
|
|
764
|
+
const props = /* @__PURE__ */ Object.create(null);
|
|
765
|
+
const forwardableProps = /* @__PURE__ */ Object.create(null);
|
|
766
|
+
const nonForwardableProps = /* @__PURE__ */ Object.create(null);
|
|
767
|
+
for (const key of Object.keys(allProps)) {
|
|
768
|
+
if (NON_FORWARDABLE_KEY_SET.has(key)) {
|
|
769
|
+
console.warn(
|
|
770
|
+
"The following prop is not supported by Puck DropZones or slots and will not be forwarded to the `as` element:",
|
|
771
|
+
key
|
|
772
|
+
);
|
|
773
|
+
nonForwardableProps[key] = allProps[key];
|
|
774
|
+
} else if (CONSUMED_KEY_SET.has(key)) {
|
|
775
|
+
props[key] = allProps[key];
|
|
776
|
+
} else {
|
|
777
|
+
forwardableProps[key] = allProps[key];
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
props,
|
|
782
|
+
forwardableProps,
|
|
783
|
+
nonForwardableProps
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
|
|
716
787
|
// components/SlotRender/server.tsx
|
|
717
788
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
718
789
|
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotRender, __spreadValues({}, props));
|
|
719
790
|
var Item = ({
|
|
720
791
|
config,
|
|
721
792
|
item,
|
|
722
|
-
metadata
|
|
793
|
+
metadata,
|
|
794
|
+
fieldTransforms
|
|
723
795
|
}) => {
|
|
724
796
|
const Component = config.components[item.type];
|
|
725
|
-
const props =
|
|
726
|
-
|
|
797
|
+
const props = use_render_props_default(
|
|
798
|
+
config,
|
|
799
|
+
item,
|
|
800
|
+
(slotProps) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
801
|
+
SlotRenderPure,
|
|
802
|
+
__spreadProps(__spreadValues({}, slotProps), {
|
|
803
|
+
config,
|
|
804
|
+
metadata,
|
|
805
|
+
fieldTransforms
|
|
806
|
+
})
|
|
807
|
+
),
|
|
808
|
+
fieldTransforms
|
|
809
|
+
);
|
|
727
810
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
728
811
|
Component.render,
|
|
729
|
-
__spreadProps(__spreadValues(
|
|
812
|
+
__spreadProps(__spreadValues({}, props), {
|
|
730
813
|
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
731
814
|
metadata: metadata || {}
|
|
732
815
|
})
|
|
@@ -734,9 +817,21 @@ var Item = ({
|
|
|
734
817
|
);
|
|
735
818
|
};
|
|
736
819
|
var SlotRender = (0, import_react5.forwardRef)(
|
|
737
|
-
function SlotRenderInternal(
|
|
820
|
+
function SlotRenderInternal(allProps, ref) {
|
|
821
|
+
const {
|
|
822
|
+
props: {
|
|
823
|
+
className,
|
|
824
|
+
style,
|
|
825
|
+
content,
|
|
826
|
+
config,
|
|
827
|
+
metadata,
|
|
828
|
+
as,
|
|
829
|
+
fieldTransforms
|
|
830
|
+
},
|
|
831
|
+
forwardableProps
|
|
832
|
+
} = getDropZoneProps(allProps);
|
|
738
833
|
const El = as != null ? as : "div";
|
|
739
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(El, __spreadProps(__spreadValues({}, forwardableProps), { className, style, ref, children: content.map((item) => {
|
|
740
835
|
if (!config.components[item.type]) {
|
|
741
836
|
return null;
|
|
742
837
|
}
|
|
@@ -745,11 +840,12 @@ var SlotRender = (0, import_react5.forwardRef)(
|
|
|
745
840
|
{
|
|
746
841
|
config,
|
|
747
842
|
item,
|
|
748
|
-
metadata
|
|
843
|
+
metadata,
|
|
844
|
+
fieldTransforms
|
|
749
845
|
},
|
|
750
846
|
item.props.id
|
|
751
847
|
);
|
|
752
|
-
}) });
|
|
848
|
+
}) }));
|
|
753
849
|
}
|
|
754
850
|
);
|
|
755
851
|
|
|
@@ -759,7 +855,8 @@ function DropZoneRenderItem({
|
|
|
759
855
|
item,
|
|
760
856
|
data,
|
|
761
857
|
config,
|
|
762
|
-
metadata
|
|
858
|
+
metadata,
|
|
859
|
+
fieldTransforms
|
|
763
860
|
}) {
|
|
764
861
|
const Component = config.components[item.type];
|
|
765
862
|
const props = __spreadProps(__spreadValues({}, item.props), {
|
|
@@ -771,7 +868,8 @@ function DropZoneRenderItem({
|
|
|
771
868
|
data,
|
|
772
869
|
areaId: item.props.id,
|
|
773
870
|
config,
|
|
774
|
-
metadata
|
|
871
|
+
metadata,
|
|
872
|
+
fieldTransforms
|
|
775
873
|
}
|
|
776
874
|
),
|
|
777
875
|
metadata,
|
|
@@ -780,19 +878,31 @@ function DropZoneRenderItem({
|
|
|
780
878
|
}
|
|
781
879
|
});
|
|
782
880
|
const renderItem = __spreadProps(__spreadValues({}, item), { props });
|
|
783
|
-
const
|
|
784
|
-
|
|
881
|
+
const renderProps = use_render_props_default(
|
|
882
|
+
config,
|
|
883
|
+
renderItem,
|
|
884
|
+
(slotProps) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
885
|
+
SlotRenderPure,
|
|
886
|
+
__spreadProps(__spreadValues({}, slotProps), {
|
|
887
|
+
config,
|
|
888
|
+
metadata,
|
|
889
|
+
fieldTransforms
|
|
890
|
+
})
|
|
891
|
+
),
|
|
892
|
+
fieldTransforms
|
|
893
|
+
);
|
|
785
894
|
if (!Component) {
|
|
786
895
|
return null;
|
|
787
896
|
}
|
|
788
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component.render, __spreadValues(
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component.render, __spreadValues({}, renderProps));
|
|
789
898
|
}
|
|
790
899
|
function DropZoneRender({
|
|
791
900
|
zone,
|
|
792
901
|
data,
|
|
793
902
|
areaId = "root",
|
|
794
903
|
config,
|
|
795
|
-
metadata = {}
|
|
904
|
+
metadata = {},
|
|
905
|
+
fieldTransforms
|
|
796
906
|
}) {
|
|
797
907
|
let zoneCompound = rootDroppableId;
|
|
798
908
|
let content = (data == null ? void 0 : data.content) || [];
|
|
@@ -810,7 +920,8 @@ function DropZoneRender({
|
|
|
810
920
|
item,
|
|
811
921
|
data,
|
|
812
922
|
config,
|
|
813
|
-
metadata
|
|
923
|
+
metadata,
|
|
924
|
+
fieldTransforms
|
|
814
925
|
},
|
|
815
926
|
item.props.id
|
|
816
927
|
);
|
|
@@ -819,9 +930,11 @@ function DropZoneRender({
|
|
|
819
930
|
function Render({
|
|
820
931
|
config,
|
|
821
932
|
data,
|
|
822
|
-
metadata = {}
|
|
933
|
+
metadata = {},
|
|
934
|
+
fieldTransforms: userFieldTransforms
|
|
823
935
|
}) {
|
|
824
|
-
var _a
|
|
936
|
+
var _a;
|
|
937
|
+
const fieldTransforms = userFieldTransforms;
|
|
825
938
|
const rootProps = "props" in data.root ? data.root.props : data.root;
|
|
826
939
|
const title = rootProps.title || "";
|
|
827
940
|
const props = __spreadProps(__spreadValues({}, rootProps), {
|
|
@@ -832,7 +945,8 @@ function Render({
|
|
|
832
945
|
zone,
|
|
833
946
|
data,
|
|
834
947
|
config,
|
|
835
|
-
metadata
|
|
948
|
+
metadata,
|
|
949
|
+
fieldTransforms
|
|
836
950
|
}
|
|
837
951
|
),
|
|
838
952
|
isEditing: false,
|
|
@@ -843,16 +957,28 @@ function Render({
|
|
|
843
957
|
editMode: false,
|
|
844
958
|
id: "puck-root"
|
|
845
959
|
});
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
960
|
+
const renderProps = use_render_props_default(
|
|
961
|
+
config,
|
|
962
|
+
{ type: "root", props },
|
|
963
|
+
(props2) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
964
|
+
SlotRenderPure,
|
|
965
|
+
__spreadProps(__spreadValues({}, props2), {
|
|
966
|
+
config,
|
|
967
|
+
metadata,
|
|
968
|
+
fieldTransforms
|
|
969
|
+
})
|
|
970
|
+
),
|
|
971
|
+
fieldTransforms
|
|
972
|
+
);
|
|
973
|
+
if ((_a = config.root) == null ? void 0 : _a.render) {
|
|
974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(config.root.render, __spreadProps(__spreadValues({}, renderProps), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
850
975
|
DropZoneRender,
|
|
851
976
|
{
|
|
852
977
|
config,
|
|
853
978
|
data,
|
|
854
979
|
zone: rootZone,
|
|
855
|
-
metadata
|
|
980
|
+
metadata,
|
|
981
|
+
fieldTransforms
|
|
856
982
|
}
|
|
857
983
|
) }));
|
|
858
984
|
}
|
|
@@ -862,7 +988,8 @@ function Render({
|
|
|
862
988
|
config,
|
|
863
989
|
data,
|
|
864
990
|
zone: rootZone,
|
|
865
|
-
metadata
|
|
991
|
+
metadata,
|
|
992
|
+
fieldTransforms
|
|
866
993
|
}
|
|
867
994
|
);
|
|
868
995
|
}
|
|
@@ -898,7 +1025,7 @@ var getChanged = (newItem, oldItem) => {
|
|
|
898
1025
|
// lib/resolve-component-data.ts
|
|
899
1026
|
var import_fast_equals2 = require("fast-equals");
|
|
900
1027
|
var cache = { lastChange: {} };
|
|
901
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache) {
|
|
1028
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", parent = null, root = { props: {} }, cacheStore = cache, resolveChild) {
|
|
902
1029
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
903
1030
|
const resolvedItem = __spreadValues({}, item);
|
|
904
1031
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -942,7 +1069,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], fun
|
|
|
942
1069
|
return yield Promise.all(
|
|
943
1070
|
content.map(
|
|
944
1071
|
(childItem) => __async(null, null, function* () {
|
|
945
|
-
return (yield resolveComponentData(
|
|
1072
|
+
return resolveChild ? resolveChild(childItem, itemAsComponentData) : (yield resolveComponentData(
|
|
946
1073
|
childItem,
|
|
947
1074
|
config,
|
|
948
1075
|
metadata,
|
|
@@ -1032,16 +1159,12 @@ function resolveAllData(_0, _1) {
|
|
|
1032
1159
|
"force",
|
|
1033
1160
|
parent,
|
|
1034
1161
|
root,
|
|
1035
|
-
cacheStore
|
|
1162
|
+
cacheStore,
|
|
1163
|
+
// Slot children resolve through resolveNode, not a second walk of
|
|
1164
|
+
// the resolved tree, so each resolveData runs once.
|
|
1165
|
+
(child, resolvedParent) => resolveNode(child, resolvedParent, root)
|
|
1036
1166
|
)).node;
|
|
1037
1167
|
const resolvedAsComponent = toComponent(resolved);
|
|
1038
|
-
const resolvedDeepPromise = mapFields(
|
|
1039
|
-
resolved,
|
|
1040
|
-
{
|
|
1041
|
-
slot: ({ value }) => processContent(value, resolvedAsComponent, root)
|
|
1042
|
-
},
|
|
1043
|
-
config
|
|
1044
|
-
);
|
|
1045
1168
|
let resolveZonePromises = [];
|
|
1046
1169
|
if (zonesByComponent[resolvedAsComponent.props.id]) {
|
|
1047
1170
|
resolveZonePromises = zonesByComponent[resolvedAsComponent.props.id].map(
|
|
@@ -1054,10 +1177,9 @@ function resolveAllData(_0, _1) {
|
|
|
1054
1177
|
})
|
|
1055
1178
|
);
|
|
1056
1179
|
}
|
|
1057
|
-
const resolvedDeep = yield resolvedDeepPromise;
|
|
1058
1180
|
yield Promise.all(resolveZonePromises);
|
|
1059
|
-
onResolveEnd == null ? void 0 : onResolveEnd(
|
|
1060
|
-
return
|
|
1181
|
+
onResolveEnd == null ? void 0 : onResolveEnd(resolvedAsComponent);
|
|
1182
|
+
return resolved;
|
|
1061
1183
|
});
|
|
1062
1184
|
const processContent = (content, parent, root) => __async(null, null, function* () {
|
|
1063
1185
|
return Promise.all(content.map((item) => resolveNode(item, parent, root)));
|
|
@@ -1181,6 +1303,7 @@ var defaultAppState = {
|
|
|
1181
1303
|
options: [],
|
|
1182
1304
|
controlsVisible: true
|
|
1183
1305
|
},
|
|
1306
|
+
expandedFieldGroups: {},
|
|
1184
1307
|
field: { focus: null },
|
|
1185
1308
|
plugin: { current: null }
|
|
1186
1309
|
},
|