@crediblemark/build 0.25.7 → 0.25.8
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/ArrayField-HYHS4HCO.mjs +17 -0
- package/dist/{Editor-GDIQRAYD.mjs → Editor-P3UUWNSZ.mjs} +8 -10
- package/dist/ObjectField-4N5XWAFL.mjs +17 -0
- package/dist/{actions-LaZpJ1KE.d.ts → actions-CKSDxt4l.d.mts} +1 -1
- package/dist/{actions-LaZpJ1KE.d.mts → actions-CKSDxt4l.d.ts} +1 -1
- package/dist/{chunk-J2UWT4L6.mjs → chunk-44PQTFGV.mjs} +5 -7
- package/dist/{chunk-23V3TMNT.mjs → chunk-AZFZRLP7.mjs} +7 -7
- package/dist/{chunk-ETN6FGIH.mjs → chunk-E4F5M5JH.mjs} +1 -1
- package/dist/chunk-HHKM5MBJ.mjs +3163 -0
- package/dist/{chunk-M4S65TWW.mjs → chunk-KN26YZZJ.mjs} +285 -130
- package/dist/{chunk-ERLZ5CJF.mjs → chunk-MWCFPGI6.mjs} +1153 -3236
- package/dist/{chunk-64A37UUC.mjs → chunk-O44M27KT.mjs} +442 -7
- package/dist/{chunk-EDTYTRV5.mjs → chunk-P2AZFZ7Q.mjs} +2 -2
- package/dist/{chunk-GUUI5HW3.mjs → chunk-PFHKXXSV.mjs} +1 -1
- package/dist/{chunk-JERQUUM4.mjs → chunk-S32JZ2HU.mjs} +1 -1
- package/dist/{chunk-35OY5UFR.mjs → chunk-T2LBDQLG.mjs} +7 -7
- package/dist/{chunk-EWOJLVHT.mjs → chunk-XLRMLBFR.mjs} +1 -1
- package/dist/{chunk-BXF2PDCW.mjs → chunk-Z7DDX2XU.mjs} +2 -2
- package/dist/{full-Y52CQK4X.mjs → full-3VRJOFG5.mjs} +6 -8
- package/dist/{index-CD3PszvP.d.mts → index-Ds4Dkkyr.d.mts} +1 -1
- package/dist/{index-Bj2x5pZ7.d.ts → index-DwajIHZf.d.ts} +1 -1
- package/dist/index.css +188 -2
- package/dist/index.d.mts +8 -40
- package/dist/index.d.ts +8 -40
- package/dist/index.js +1224 -567
- package/dist/index.mjs +25 -25
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.mjs +1 -2
- package/dist/{loaded-K43N3OFP.mjs → loaded-C2JGMUXV.mjs} +3 -5
- package/dist/{loaded-MWBOE5CB.mjs → loaded-FJHWTGH6.mjs} +3 -5
- package/dist/{loaded-IWWCJE75.mjs → loaded-NTEK7RT3.mjs} +3 -5
- package/dist/no-external.css +188 -2
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +1224 -567
- package/dist/no-external.mjs +25 -25
- package/dist/rsc.css +1420 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +10324 -1007
- package/dist/rsc.mjs +20 -3
- package/dist/{walk-tree-BEw6kTXm.d.ts → walk-tree-B_jHFa3L.d.mts} +39 -2
- package/dist/{walk-tree-BO8uRNcW.d.mts → walk-tree-DHMRjk5Z.d.ts} +39 -2
- package/package.json +1 -1
- package/dist/ArrayField-OIQQLS2B.mjs +0 -19
- package/dist/ObjectField-WOW3T2WS.mjs +0 -19
- package/dist/chunk-2RLA42JA.mjs +0 -455
- package/dist/chunk-7LXZOPYT.mjs +0 -445
- package/dist/chunk-SMAWAXVX.mjs +0 -139
package/dist/rsc.mjs
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ColorPickerField,
|
|
3
|
+
DropZone,
|
|
4
|
+
ResponsiveSliderField,
|
|
5
|
+
SliderField,
|
|
2
6
|
SlotRenderPure,
|
|
3
7
|
migrate,
|
|
4
8
|
resolveAllData,
|
|
5
9
|
transformProps,
|
|
6
10
|
useRichtextProps,
|
|
7
11
|
useSlots
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HHKM5MBJ.mjs";
|
|
13
|
+
import "./chunk-Z7DDX2XU.mjs";
|
|
14
|
+
import "./chunk-44PQTFGV.mjs";
|
|
15
|
+
import "./chunk-P2AZFZ7Q.mjs";
|
|
16
|
+
import "./chunk-T2LBDQLG.mjs";
|
|
17
|
+
import "./chunk-E4F5M5JH.mjs";
|
|
9
18
|
import "./chunk-ISXFLTBM.mjs";
|
|
10
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-AZFZRLP7.mjs";
|
|
20
|
+
import "./chunk-XLRMLBFR.mjs";
|
|
21
|
+
import "./chunk-PFHKXXSV.mjs";
|
|
22
|
+
import "./chunk-S32JZ2HU.mjs";
|
|
23
|
+
import "./chunk-KN26YZZJ.mjs";
|
|
11
24
|
import "./chunk-BFHV72KK.mjs";
|
|
12
25
|
import {
|
|
13
26
|
rootAreaId,
|
|
@@ -15,7 +28,7 @@ import {
|
|
|
15
28
|
rootZone,
|
|
16
29
|
setupZone,
|
|
17
30
|
walkTree
|
|
18
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-O44M27KT.mjs";
|
|
19
32
|
import "./chunk-AFVEAZTD.mjs";
|
|
20
33
|
|
|
21
34
|
// components/ServerRender/index.tsx
|
|
@@ -133,7 +146,11 @@ function Render({
|
|
|
133
146
|
);
|
|
134
147
|
}
|
|
135
148
|
export {
|
|
149
|
+
ColorPickerField,
|
|
150
|
+
DropZone,
|
|
136
151
|
Render,
|
|
152
|
+
ResponsiveSliderField,
|
|
153
|
+
SliderField,
|
|
137
154
|
migrate,
|
|
138
155
|
resolveAllData,
|
|
139
156
|
transformProps,
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
import { k as ResponsiveValue, l as DropZoneProps, a as Config, D as Data, W as WithId, U as UserGenerics, m as Content, c as ComponentData, n as DefaultComponents, o as DefaultComponentProps, p as DefaultRootFieldProps, M as Metadata, q as RootData } from './actions-CKSDxt4l.mjs';
|
|
5
|
+
|
|
6
|
+
type SliderFieldProps = {
|
|
7
|
+
value: string | number;
|
|
8
|
+
onChange: (value: string | number) => void;
|
|
9
|
+
label?: string;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
step?: number;
|
|
13
|
+
unit?: string;
|
|
14
|
+
defaultValue?: string | number;
|
|
15
|
+
useUnits?: boolean;
|
|
16
|
+
style?: react__default.CSSProperties;
|
|
17
|
+
};
|
|
18
|
+
declare const SliderField: ({ value, onChange, min, max, step, unit, defaultValue, useUnits, style }: SliderFieldProps) => react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
type ResponsiveSliderFieldProps = {
|
|
21
|
+
value: ResponsiveValue;
|
|
22
|
+
onChange: (value: ResponsiveValue) => void;
|
|
23
|
+
label?: string;
|
|
24
|
+
unit?: string;
|
|
25
|
+
max?: number;
|
|
26
|
+
min?: number;
|
|
27
|
+
step?: number;
|
|
28
|
+
defaultValue?: number | ResponsiveValue;
|
|
29
|
+
};
|
|
30
|
+
declare const ResponsiveSliderField: ({ value, onChange, label, unit, max, min, step, defaultValue }: ResponsiveSliderFieldProps) => react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
type ColorPickerFieldProps = {
|
|
33
|
+
value: string;
|
|
34
|
+
onChange: (value: string) => void;
|
|
35
|
+
};
|
|
36
|
+
declare const ColorPickerField: ({ value, onChange }: ColorPickerFieldProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
2
39
|
|
|
3
40
|
type MigrationOptions<UserConfig extends Config> = {
|
|
4
41
|
migrateDynamicZonesForComponent?: {
|
|
@@ -26,4 +63,4 @@ type WalkTreeOptions = {
|
|
|
26
63
|
};
|
|
27
64
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
28
65
|
|
|
29
|
-
export { migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
66
|
+
export { ColorPickerField as C, DropZone as D, ResponsiveSliderField as R, SliderField as S, migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import react__default from 'react';
|
|
4
|
+
import { k as ResponsiveValue, l as DropZoneProps, a as Config, D as Data, W as WithId, U as UserGenerics, m as Content, c as ComponentData, n as DefaultComponents, o as DefaultComponentProps, p as DefaultRootFieldProps, M as Metadata, q as RootData } from './actions-CKSDxt4l.js';
|
|
5
|
+
|
|
6
|
+
type SliderFieldProps = {
|
|
7
|
+
value: string | number;
|
|
8
|
+
onChange: (value: string | number) => void;
|
|
9
|
+
label?: string;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
step?: number;
|
|
13
|
+
unit?: string;
|
|
14
|
+
defaultValue?: string | number;
|
|
15
|
+
useUnits?: boolean;
|
|
16
|
+
style?: react__default.CSSProperties;
|
|
17
|
+
};
|
|
18
|
+
declare const SliderField: ({ value, onChange, min, max, step, unit, defaultValue, useUnits, style }: SliderFieldProps) => react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
type ResponsiveSliderFieldProps = {
|
|
21
|
+
value: ResponsiveValue;
|
|
22
|
+
onChange: (value: ResponsiveValue) => void;
|
|
23
|
+
label?: string;
|
|
24
|
+
unit?: string;
|
|
25
|
+
max?: number;
|
|
26
|
+
min?: number;
|
|
27
|
+
step?: number;
|
|
28
|
+
defaultValue?: number | ResponsiveValue;
|
|
29
|
+
};
|
|
30
|
+
declare const ResponsiveSliderField: ({ value, onChange, label, unit, max, min, step, defaultValue }: ResponsiveSliderFieldProps) => react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
type ColorPickerFieldProps = {
|
|
33
|
+
value: string;
|
|
34
|
+
onChange: (value: string) => void;
|
|
35
|
+
};
|
|
36
|
+
declare const ColorPickerField: ({ value, onChange }: ColorPickerFieldProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
2
39
|
|
|
3
40
|
type MigrationOptions<UserConfig extends Config> = {
|
|
4
41
|
migrateDynamicZonesForComponent?: {
|
|
@@ -26,4 +63,4 @@ type WalkTreeOptions = {
|
|
|
26
63
|
};
|
|
27
64
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
28
65
|
|
|
29
|
-
export { migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
66
|
+
export { ColorPickerField as C, DropZone as D, ResponsiveSliderField as R, SliderField as S, migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ArrayField
|
|
3
|
-
} from "./chunk-J2UWT4L6.mjs";
|
|
4
|
-
import "./chunk-35OY5UFR.mjs";
|
|
5
|
-
import "./chunk-ETN6FGIH.mjs";
|
|
6
|
-
import "./chunk-ISXFLTBM.mjs";
|
|
7
|
-
import "./chunk-23V3TMNT.mjs";
|
|
8
|
-
import "./chunk-EWOJLVHT.mjs";
|
|
9
|
-
import "./chunk-GUUI5HW3.mjs";
|
|
10
|
-
import "./chunk-JERQUUM4.mjs";
|
|
11
|
-
import "./chunk-M4S65TWW.mjs";
|
|
12
|
-
import "./chunk-64A37UUC.mjs";
|
|
13
|
-
import "./chunk-SMAWAXVX.mjs";
|
|
14
|
-
import "./chunk-BFHV72KK.mjs";
|
|
15
|
-
import "./chunk-7LXZOPYT.mjs";
|
|
16
|
-
import "./chunk-AFVEAZTD.mjs";
|
|
17
|
-
export {
|
|
18
|
-
ArrayField
|
|
19
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ObjectField
|
|
3
|
-
} from "./chunk-EDTYTRV5.mjs";
|
|
4
|
-
import "./chunk-35OY5UFR.mjs";
|
|
5
|
-
import "./chunk-ETN6FGIH.mjs";
|
|
6
|
-
import "./chunk-ISXFLTBM.mjs";
|
|
7
|
-
import "./chunk-23V3TMNT.mjs";
|
|
8
|
-
import "./chunk-EWOJLVHT.mjs";
|
|
9
|
-
import "./chunk-GUUI5HW3.mjs";
|
|
10
|
-
import "./chunk-JERQUUM4.mjs";
|
|
11
|
-
import "./chunk-M4S65TWW.mjs";
|
|
12
|
-
import "./chunk-64A37UUC.mjs";
|
|
13
|
-
import "./chunk-SMAWAXVX.mjs";
|
|
14
|
-
import "./chunk-BFHV72KK.mjs";
|
|
15
|
-
import "./chunk-7LXZOPYT.mjs";
|
|
16
|
-
import "./chunk-AFVEAZTD.mjs";
|
|
17
|
-
export {
|
|
18
|
-
ObjectField
|
|
19
|
-
};
|
package/dist/chunk-2RLA42JA.mjs
DELETED
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
styles_module_default
|
|
3
|
-
} from "./chunk-ISXFLTBM.mjs";
|
|
4
|
-
import {
|
|
5
|
-
defaultAppState,
|
|
6
|
-
resolveComponentData
|
|
7
|
-
} from "./chunk-SMAWAXVX.mjs";
|
|
8
|
-
import {
|
|
9
|
-
get_class_name_factory_default
|
|
10
|
-
} from "./chunk-BFHV72KK.mjs";
|
|
11
|
-
import {
|
|
12
|
-
generateId,
|
|
13
|
-
getZoneId,
|
|
14
|
-
mapFields,
|
|
15
|
-
toComponent,
|
|
16
|
-
walkAppState,
|
|
17
|
-
walkTree
|
|
18
|
-
} from "./chunk-7LXZOPYT.mjs";
|
|
19
|
-
|
|
20
|
-
// lib/migrate.ts
|
|
21
|
-
var migrations = [
|
|
22
|
-
// Migrate root to root.props
|
|
23
|
-
(data) => {
|
|
24
|
-
const rootProps = data.root.props || data.root;
|
|
25
|
-
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
|
26
|
-
console.warn(
|
|
27
|
-
"Migration applied: Root props moved from `root` to `root.props`."
|
|
28
|
-
);
|
|
29
|
-
return {
|
|
30
|
-
...data,
|
|
31
|
-
root: {
|
|
32
|
-
props: {
|
|
33
|
-
...rootProps
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return data;
|
|
39
|
-
},
|
|
40
|
-
// Migrate zones to slots
|
|
41
|
-
(data, config, migrationOptions) => {
|
|
42
|
-
if (!config) return data;
|
|
43
|
-
console.log("Migrating DropZones to slots...");
|
|
44
|
-
const updatedItems = {};
|
|
45
|
-
const appState = { ...defaultAppState, data };
|
|
46
|
-
const { indexes } = walkAppState(appState, config);
|
|
47
|
-
const deletedCompounds = [];
|
|
48
|
-
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
|
49
|
-
if (zoneType === "dropzone") {
|
|
50
|
-
const [id, slotName] = zoneCompound.split(":");
|
|
51
|
-
const nodeData = indexes.nodes[id].data;
|
|
52
|
-
const componentType = nodeData.type;
|
|
53
|
-
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
|
54
|
-
if (configForComponent?.fields?.[slotName]?.type === "slot") {
|
|
55
|
-
updatedItems[id] = {
|
|
56
|
-
...nodeData,
|
|
57
|
-
props: {
|
|
58
|
-
...nodeData.props,
|
|
59
|
-
...updatedItems[id]?.props,
|
|
60
|
-
[slotName]: content
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
deletedCompounds.push(zoneCompound);
|
|
64
|
-
}
|
|
65
|
-
return content;
|
|
66
|
-
}
|
|
67
|
-
return content;
|
|
68
|
-
});
|
|
69
|
-
const updated = walkAppState(
|
|
70
|
-
appState,
|
|
71
|
-
config,
|
|
72
|
-
(content) => content,
|
|
73
|
-
(item) => {
|
|
74
|
-
return updatedItems[item.props.id] ?? item;
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
deletedCompounds.forEach((zoneCompound) => {
|
|
78
|
-
const [_, propName] = zoneCompound.split(":");
|
|
79
|
-
console.log(
|
|
80
|
-
`\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
|
|
81
|
-
);
|
|
82
|
-
delete updated.data.zones?.[zoneCompound];
|
|
83
|
-
});
|
|
84
|
-
if (migrationOptions?.migrateDynamicZonesForComponent) {
|
|
85
|
-
const unmigratedZonesGrouped = {};
|
|
86
|
-
Object.keys(updated.data.zones ?? {}).forEach((zoneCompound) => {
|
|
87
|
-
const [componentId, propName] = zoneCompound.split(":");
|
|
88
|
-
const content = updated.data.zones?.[zoneCompound];
|
|
89
|
-
if (!content) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (!unmigratedZonesGrouped[componentId]) {
|
|
93
|
-
unmigratedZonesGrouped[componentId] = {};
|
|
94
|
-
}
|
|
95
|
-
if (!unmigratedZonesGrouped[componentId][propName]) {
|
|
96
|
-
unmigratedZonesGrouped[componentId][propName] = content;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
|
|
100
|
-
updated.data = walkTree(updated.data, config, (content) => {
|
|
101
|
-
return content.map((child) => {
|
|
102
|
-
if (child.props.id !== componentId) {
|
|
103
|
-
return child;
|
|
104
|
-
}
|
|
105
|
-
const migrateFn = migrationOptions?.migrateDynamicZonesForComponent?.[child.type];
|
|
106
|
-
if (!migrateFn) {
|
|
107
|
-
return child;
|
|
108
|
-
}
|
|
109
|
-
const zones = unmigratedZonesGrouped[componentId];
|
|
110
|
-
const migratedProps = migrateFn(child.props, zones);
|
|
111
|
-
Object.keys(zones).forEach((propName) => {
|
|
112
|
-
const zoneCompound = `${componentId}:${propName}`;
|
|
113
|
-
console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
|
|
114
|
-
delete updated.data.zones?.[zoneCompound];
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
...child,
|
|
118
|
-
props: migratedProps
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
Object.keys(updated.data.zones ?? {}).forEach((zoneCompound) => {
|
|
125
|
-
const [_, propName] = zoneCompound.split(":");
|
|
126
|
-
throw new Error(
|
|
127
|
-
`Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
|
|
128
|
-
);
|
|
129
|
-
});
|
|
130
|
-
delete updated.data.zones;
|
|
131
|
-
return updated.data;
|
|
132
|
-
}
|
|
133
|
-
];
|
|
134
|
-
function migrate(data, config, migrationOptions) {
|
|
135
|
-
return migrations?.reduce(
|
|
136
|
-
(acc, migration) => migration(acc, config, migrationOptions),
|
|
137
|
-
data
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// lib/data/default-data.ts
|
|
142
|
-
var defaultData = (data) => ({
|
|
143
|
-
...data,
|
|
144
|
-
root: data.root || {},
|
|
145
|
-
content: data.content || []
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// lib/transform-props.ts
|
|
149
|
-
function transformProps(data, propTransforms, config = { components: {} }) {
|
|
150
|
-
const mapItem = (item) => {
|
|
151
|
-
if (propTransforms[item.type]) {
|
|
152
|
-
return {
|
|
153
|
-
...item,
|
|
154
|
-
props: {
|
|
155
|
-
id: item.props.id,
|
|
156
|
-
...propTransforms[item.type](item.props)
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
return item;
|
|
161
|
-
};
|
|
162
|
-
const defaultedData = defaultData(data);
|
|
163
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
|
164
|
-
let newRoot = { ...defaultedData.root };
|
|
165
|
-
if (propTransforms["root"]) {
|
|
166
|
-
newRoot.props = propTransforms["root"](rootProps);
|
|
167
|
-
}
|
|
168
|
-
const dataWithUpdatedRoot = { ...defaultedData, root: newRoot };
|
|
169
|
-
const updatedData = walkTree(
|
|
170
|
-
dataWithUpdatedRoot,
|
|
171
|
-
config,
|
|
172
|
-
(content) => content.map(mapItem)
|
|
173
|
-
);
|
|
174
|
-
if (!defaultedData.root.props) {
|
|
175
|
-
updatedData.root = updatedData.root.props;
|
|
176
|
-
}
|
|
177
|
-
return updatedData;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// lib/group-zones-by-component.ts
|
|
181
|
-
var groupZonesByComponent = (data) => {
|
|
182
|
-
const zoneEntries = Object.entries(data.zones ?? {});
|
|
183
|
-
return zoneEntries.reduce((acc, [zoneCompound, zoneContent]) => {
|
|
184
|
-
const [componentId, zoneName] = getZoneId(zoneCompound);
|
|
185
|
-
if (!componentId.length || !zoneName.length) return acc;
|
|
186
|
-
if (!acc[componentId]) {
|
|
187
|
-
acc[componentId] = [];
|
|
188
|
-
}
|
|
189
|
-
acc[componentId].push({ zoneCompound, content: zoneContent });
|
|
190
|
-
return acc;
|
|
191
|
-
}, {});
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// lib/resolve-all-data.ts
|
|
195
|
-
async function resolveAllData(data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
196
|
-
const defaultedData = defaultData(data);
|
|
197
|
-
const zonesByComponent = groupZonesByComponent(defaultedData);
|
|
198
|
-
let resolvedZones = {};
|
|
199
|
-
const resolveNode = async (_node, parent) => {
|
|
200
|
-
const node = toComponent(_node);
|
|
201
|
-
onResolveStart?.(node);
|
|
202
|
-
const resolved = (await resolveComponentData(
|
|
203
|
-
node,
|
|
204
|
-
config,
|
|
205
|
-
metadata,
|
|
206
|
-
() => {
|
|
207
|
-
},
|
|
208
|
-
() => {
|
|
209
|
-
},
|
|
210
|
-
"force",
|
|
211
|
-
parent
|
|
212
|
-
)).node;
|
|
213
|
-
const resolvedAsComponent = toComponent(resolved);
|
|
214
|
-
const resolvedDeepPromise = mapFields(
|
|
215
|
-
resolved,
|
|
216
|
-
{
|
|
217
|
-
slot: ({ value }) => processContent(value, resolvedAsComponent)
|
|
218
|
-
},
|
|
219
|
-
config
|
|
220
|
-
);
|
|
221
|
-
let resolveZonePromises = [];
|
|
222
|
-
if (zonesByComponent[resolvedAsComponent.props.id]) {
|
|
223
|
-
resolveZonePromises = zonesByComponent[resolvedAsComponent.props.id].map(
|
|
224
|
-
async ({ zoneCompound, content }) => {
|
|
225
|
-
resolvedZones[zoneCompound] = await processContent(
|
|
226
|
-
content,
|
|
227
|
-
resolvedAsComponent
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
const resolvedDeep = await resolvedDeepPromise;
|
|
233
|
-
await Promise.all(resolveZonePromises);
|
|
234
|
-
onResolveEnd?.(toComponent(resolvedDeep));
|
|
235
|
-
return resolvedDeep;
|
|
236
|
-
};
|
|
237
|
-
const processContent = async (content, parent) => {
|
|
238
|
-
return Promise.all(content.map((item) => resolveNode(item, parent)));
|
|
239
|
-
};
|
|
240
|
-
const result = defaultData({});
|
|
241
|
-
result.root = await resolveNode(defaultedData.root, null);
|
|
242
|
-
result.content = await processContent(
|
|
243
|
-
defaultedData.content,
|
|
244
|
-
toComponent(result.root)
|
|
245
|
-
);
|
|
246
|
-
result.zones = resolvedZones;
|
|
247
|
-
return result;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
251
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
252
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
253
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
254
|
-
const Slot = (dzProps) => render({
|
|
255
|
-
allow: field?.type === "slot" ? field.allow : [],
|
|
256
|
-
disallow: field?.type === "slot" ? field.disallow : [],
|
|
257
|
-
...dzProps,
|
|
258
|
-
zone: propName,
|
|
259
|
-
content
|
|
260
|
-
});
|
|
261
|
-
return Slot;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
// lib/field-transforms/use-field-transforms.tsx
|
|
266
|
-
import { useMemo } from "react";
|
|
267
|
-
|
|
268
|
-
// lib/field-transforms/build-mappers.ts
|
|
269
|
-
function buildMappers(transforms, readOnly, forceReadOnly) {
|
|
270
|
-
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
271
|
-
const fieldType = _fieldType;
|
|
272
|
-
return {
|
|
273
|
-
...acc,
|
|
274
|
-
[fieldType]: ({
|
|
275
|
-
parentId,
|
|
276
|
-
...params
|
|
277
|
-
}) => {
|
|
278
|
-
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
279
|
-
const isReadOnly = readOnly?.[params.propPath] || readOnly?.[wildcardPath] || forceReadOnly || false;
|
|
280
|
-
const fn = transforms[fieldType];
|
|
281
|
-
return fn?.({
|
|
282
|
-
...params,
|
|
283
|
-
isReadOnly,
|
|
284
|
-
componentId: parentId
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
}, {});
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// lib/field-transforms/use-field-transforms.tsx
|
|
292
|
-
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
293
|
-
const mappers = useMemo(
|
|
294
|
-
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
295
|
-
[transforms, readOnly, forceReadOnly]
|
|
296
|
-
);
|
|
297
|
-
const transformedProps = useMemo(() => {
|
|
298
|
-
return mapFields(item, mappers, config).props;
|
|
299
|
-
}, [config, item, mappers]);
|
|
300
|
-
const mergedProps = useMemo(
|
|
301
|
-
() => ({ ...item.props, ...transformedProps }),
|
|
302
|
-
[item.props, transformedProps]
|
|
303
|
-
);
|
|
304
|
-
return mergedProps;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// lib/use-slots.tsx
|
|
308
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
309
|
-
return useFieldTransforms(
|
|
310
|
-
config,
|
|
311
|
-
item,
|
|
312
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
313
|
-
readOnly,
|
|
314
|
-
forceReadOnly
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
319
|
-
import { lazy, Suspense, useMemo as useMemo2 } from "react";
|
|
320
|
-
|
|
321
|
-
// components/RichTextEditor/components/RenderFallback.tsx
|
|
322
|
-
import DOMPurify from "isomorphic-dompurify";
|
|
323
|
-
import { jsx } from "react/jsx-runtime";
|
|
324
|
-
var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
|
|
325
|
-
function RichTextRenderFallback({ content }) {
|
|
326
|
-
return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx(
|
|
327
|
-
"div",
|
|
328
|
-
{
|
|
329
|
-
className: "rich-text",
|
|
330
|
-
dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(content) }
|
|
331
|
-
}
|
|
332
|
-
) });
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// components/RichTextEditor/lib/mapDeep.ts
|
|
336
|
-
var mapDeep = (source, path, render) => {
|
|
337
|
-
if (!source) {
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
if (path.length === 0) {
|
|
341
|
-
return render(source);
|
|
342
|
-
}
|
|
343
|
-
const [key, ...rest] = path;
|
|
344
|
-
if (Array.isArray(source)) {
|
|
345
|
-
return source.map((item) => mapDeep(item, path, render));
|
|
346
|
-
}
|
|
347
|
-
return {
|
|
348
|
-
...source,
|
|
349
|
-
[key]: mapDeep(source[key], rest, render)
|
|
350
|
-
};
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
354
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
355
|
-
var findAllRichtextKeys = (fields, path = []) => {
|
|
356
|
-
if (!fields) return [];
|
|
357
|
-
const result = [];
|
|
358
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
359
|
-
const currentPath = [...path, key];
|
|
360
|
-
if (field.type === "richtext") {
|
|
361
|
-
result.push({
|
|
362
|
-
path: currentPath,
|
|
363
|
-
field
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
if (field.type === "array" && "arrayFields" in field) {
|
|
367
|
-
result.push(...findAllRichtextKeys(field.arrayFields, currentPath));
|
|
368
|
-
}
|
|
369
|
-
if (field.type === "object" && "objectFields" in field) {
|
|
370
|
-
result.push(...findAllRichtextKeys(field.objectFields, currentPath));
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return result;
|
|
374
|
-
};
|
|
375
|
-
function useRichtextProps(fields, props) {
|
|
376
|
-
const richtextKeys = useMemo2(() => findAllRichtextKeys(fields), [fields]);
|
|
377
|
-
const richtextProps = useMemo2(() => {
|
|
378
|
-
if (!richtextKeys?.length) return {};
|
|
379
|
-
const RichTextRender = lazy(
|
|
380
|
-
() => import("./Render-I6PZ5MEA.mjs").then((m) => ({
|
|
381
|
-
default: m.RichTextRender
|
|
382
|
-
}))
|
|
383
|
-
);
|
|
384
|
-
let result = { ...props };
|
|
385
|
-
for (const { path, field } of richtextKeys) {
|
|
386
|
-
result = mapDeep(result, path, (content) => /* @__PURE__ */ jsx2(
|
|
387
|
-
Suspense,
|
|
388
|
-
{
|
|
389
|
-
fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content }),
|
|
390
|
-
children: /* @__PURE__ */ jsx2(RichTextRender, { content, field })
|
|
391
|
-
},
|
|
392
|
-
generateId()
|
|
393
|
-
));
|
|
394
|
-
}
|
|
395
|
-
return result;
|
|
396
|
-
}, [richtextKeys, props]);
|
|
397
|
-
return richtextProps;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// components/SlotRender/server.tsx
|
|
401
|
-
import { forwardRef } from "react";
|
|
402
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
403
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, { ...props });
|
|
404
|
-
var Item = ({
|
|
405
|
-
config,
|
|
406
|
-
item,
|
|
407
|
-
metadata
|
|
408
|
-
}) => {
|
|
409
|
-
const Component = config.components[item.type];
|
|
410
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx3(SlotRenderPure, { ...slotProps, config, metadata }));
|
|
411
|
-
const richtextProps = useRichtextProps(Component.fields, props);
|
|
412
|
-
return /* @__PURE__ */ jsx3(
|
|
413
|
-
Component.render,
|
|
414
|
-
{
|
|
415
|
-
...props,
|
|
416
|
-
...richtextProps,
|
|
417
|
-
credbuild: {
|
|
418
|
-
...props.credbuild,
|
|
419
|
-
metadata: metadata || {}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
);
|
|
423
|
-
};
|
|
424
|
-
var SlotRender = forwardRef(
|
|
425
|
-
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
426
|
-
const El = as ?? "div";
|
|
427
|
-
return /* @__PURE__ */ jsx3(El, { className, style, ref, children: content.map((item) => {
|
|
428
|
-
if (!config.components[item.type]) {
|
|
429
|
-
return null;
|
|
430
|
-
}
|
|
431
|
-
return /* @__PURE__ */ jsx3(
|
|
432
|
-
Item,
|
|
433
|
-
{
|
|
434
|
-
config,
|
|
435
|
-
item,
|
|
436
|
-
metadata
|
|
437
|
-
},
|
|
438
|
-
item.props.id
|
|
439
|
-
);
|
|
440
|
-
}) });
|
|
441
|
-
}
|
|
442
|
-
);
|
|
443
|
-
|
|
444
|
-
export {
|
|
445
|
-
buildMappers,
|
|
446
|
-
getSlotTransform,
|
|
447
|
-
useSlots,
|
|
448
|
-
RichTextRenderFallback,
|
|
449
|
-
useRichtextProps,
|
|
450
|
-
SlotRenderPure,
|
|
451
|
-
SlotRender,
|
|
452
|
-
migrate,
|
|
453
|
-
transformProps,
|
|
454
|
-
resolveAllData
|
|
455
|
-
};
|