@measured/puck 0.21.0-canary.eb8ea5ce → 0.21.0-canary.ed10e2a4
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/{chunk-YZQENDBP.mjs → chunk-JA7SEUEH.mjs} +499 -70
- package/dist/{chunk-MSIUWPEI.mjs → chunk-UABEUL66.mjs} +2681 -913
- package/dist/index.css +22 -278
- package/dist/index.d.mts +7 -104
- package/dist/index.d.ts +7 -104
- package/dist/index.js +2494 -5508
- package/dist/index.mjs +9 -19
- package/dist/no-external.css +22 -278
- package/dist/no-external.d.mts +2 -17
- package/dist/no-external.d.ts +2 -17
- package/dist/no-external.js +2494 -5508
- package/dist/no-external.mjs +9 -19
- package/dist/rsc.d.mts +2 -17
- package/dist/rsc.d.ts +2 -17
- package/dist/rsc.js +21 -407
- package/dist/rsc.mjs +9 -15
- package/dist/{walk-tree-Ja9bNCM9.d.mts → walk-tree-CgWnYC1X.d.mts} +3 -202
- package/dist/{walk-tree-Ja9bNCM9.d.ts → walk-tree-CgWnYC1X.d.ts} +3 -202
- package/package.json +1 -23
- package/dist/Editor-DR57V55X.mjs +0 -194
- package/dist/Editor-F2LSS6SE.css +0 -403
- package/dist/Render-6Q5WP25Y.mjs +0 -51
- package/dist/Render-QEMDIDQC.css +0 -101
- package/dist/chunk-A7EMVTSK.mjs +0 -413
- package/dist/chunk-CF5XA6LF.mjs +0 -103
- package/dist/chunk-GQ457KMA.mjs +0 -199
- package/dist/chunk-OPXWLTPM.mjs +0 -3140
- package/dist/rsc.css +0 -101
package/dist/Render-QEMDIDQC.css
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data */
|
|
2
|
-
._RichTextEditor_1elol_1 .ProseMirror {
|
|
3
|
-
white-space: pre-wrap;
|
|
4
|
-
word-wrap: break-word;
|
|
5
|
-
cursor: text;
|
|
6
|
-
outline: none;
|
|
7
|
-
position: relative;
|
|
8
|
-
}
|
|
9
|
-
._RichTextEditor_1elol_1 .rich-text * {
|
|
10
|
-
white-space: pre-wrap;
|
|
11
|
-
user-select: auto;
|
|
12
|
-
-webkit-user-select: auto;
|
|
13
|
-
}
|
|
14
|
-
._RichTextEditor_1elol_1 .rich-text blockquote {
|
|
15
|
-
margin: 1em 0;
|
|
16
|
-
padding: 0 1em;
|
|
17
|
-
border-left: 4px solid var(--puck-color-grey-09);
|
|
18
|
-
}
|
|
19
|
-
._RichTextEditor_1elol_1 .rich-text code {
|
|
20
|
-
background-color: var(--puck-color-grey-11);
|
|
21
|
-
padding: 4px 8px;
|
|
22
|
-
border-radius: 4px;
|
|
23
|
-
}
|
|
24
|
-
._RichTextEditor_1elol_1 .rich-text p:empty::before {
|
|
25
|
-
content: "\a0";
|
|
26
|
-
}
|
|
27
|
-
._RichTextEditor_1elol_1 .rich-text pre code {
|
|
28
|
-
display: block;
|
|
29
|
-
padding: 8px 12px;
|
|
30
|
-
}
|
|
31
|
-
._RichTextEditor_1elol_1 .rich-text > *:first-child,
|
|
32
|
-
._RichTextEditor_1elol_1 .ProseMirror > *:first-child,
|
|
33
|
-
._RichTextEditor_1elol_1 .rich-text * p:first-of-type {
|
|
34
|
-
margin-top: 0;
|
|
35
|
-
}
|
|
36
|
-
._RichTextEditor_1elol_1 .rich-text > *:last-child,
|
|
37
|
-
._RichTextEditor_1elol_1 .ProseMirror > *:last-child,
|
|
38
|
-
._RichTextEditor_1elol_1 .rich-text * p:last-of-type {
|
|
39
|
-
margin-bottom: 0;
|
|
40
|
-
}
|
|
41
|
-
._RichTextEditor--editor_1elol_50 {
|
|
42
|
-
background: var(--puck-color-white);
|
|
43
|
-
border-width: 1px;
|
|
44
|
-
border-style: solid;
|
|
45
|
-
border-color: var(--puck-color-grey-09);
|
|
46
|
-
border-radius: 4px;
|
|
47
|
-
box-sizing: border-box;
|
|
48
|
-
display: flex;
|
|
49
|
-
flex-direction: column;
|
|
50
|
-
font-family: inherit;
|
|
51
|
-
font-size: var(--puck-font-size-xxs);
|
|
52
|
-
resize: vertical;
|
|
53
|
-
transition: border-color 50ms ease-in;
|
|
54
|
-
width: 100%;
|
|
55
|
-
max-width: 100%;
|
|
56
|
-
min-height: 128px;
|
|
57
|
-
}
|
|
58
|
-
._RichTextEditor--editor_1elol_50 .rich-text {
|
|
59
|
-
flex-grow: 1;
|
|
60
|
-
}
|
|
61
|
-
._RichTextEditor--editor_1elol_50 .rich-text:not(:has(.ProseMirror)),
|
|
62
|
-
._RichTextEditor--editor_1elol_50 .rich-text .ProseMirror {
|
|
63
|
-
height: 100%;
|
|
64
|
-
padding: 12px 15px;
|
|
65
|
-
}
|
|
66
|
-
._RichTextEditor--editor_1elol_50 .rich-text ul,
|
|
67
|
-
._RichTextEditor--editor_1elol_50 .rich-text ol {
|
|
68
|
-
padding-left: 24px;
|
|
69
|
-
}
|
|
70
|
-
._RichTextEditor--editor_1elol_50 .rich-text li {
|
|
71
|
-
line-height: 1.5;
|
|
72
|
-
}
|
|
73
|
-
._RichTextEditor--editor_1elol_50 .rich-text p {
|
|
74
|
-
margin-block: 12px;
|
|
75
|
-
}
|
|
76
|
-
._RichTextEditor--editor_1elol_50 .rich-text ul {
|
|
77
|
-
list-style: disc;
|
|
78
|
-
}
|
|
79
|
-
._RichTextEditor--editor_1elol_50 .rich-text ol {
|
|
80
|
-
list-style: decimal;
|
|
81
|
-
}
|
|
82
|
-
._RichTextEditor--editor_1elol_50:focus-within {
|
|
83
|
-
border-color: var(--puck-color-grey-05);
|
|
84
|
-
outline: 2px solid var(--puck-color-azure-05);
|
|
85
|
-
transition: none;
|
|
86
|
-
}
|
|
87
|
-
._RichTextEditor--editor_1elol_50._RichTextEditor--disabled_1elol_106 {
|
|
88
|
-
background: var(--puck-color-grey-11);
|
|
89
|
-
}
|
|
90
|
-
._RichTextEditor_1elol_1:not(:focus-within):not(._RichTextEditor--isActive_1elol_110) .ProseMirror ::selection {
|
|
91
|
-
background-color: transparent;
|
|
92
|
-
}
|
|
93
|
-
._RichTextEditor-menu_1elol_116 {
|
|
94
|
-
border-bottom: 1px solid var(--puck-color-grey-10);
|
|
95
|
-
position: sticky;
|
|
96
|
-
top: 0;
|
|
97
|
-
z-index: 1;
|
|
98
|
-
}
|
|
99
|
-
._RichTextEditor--disabled_1elol_106 ._RichTextEditor-menu_1elol_116 {
|
|
100
|
-
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
101
|
-
}
|
package/dist/chunk-A7EMVTSK.mjs
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defaultAppState,
|
|
3
|
-
mapFields,
|
|
4
|
-
resolveComponentData,
|
|
5
|
-
walkAppState,
|
|
6
|
-
walkTree
|
|
7
|
-
} from "./chunk-YZQENDBP.mjs";
|
|
8
|
-
import {
|
|
9
|
-
__async,
|
|
10
|
-
__objRest,
|
|
11
|
-
__spreadProps,
|
|
12
|
-
__spreadValues,
|
|
13
|
-
get_class_name_factory_default,
|
|
14
|
-
init_react_import,
|
|
15
|
-
styles_module_default
|
|
16
|
-
} from "./chunk-GQ457KMA.mjs";
|
|
17
|
-
|
|
18
|
-
// lib/migrate.ts
|
|
19
|
-
init_react_import();
|
|
20
|
-
var migrations = [
|
|
21
|
-
// Migrate root to root.props
|
|
22
|
-
(data) => {
|
|
23
|
-
const rootProps = data.root.props || data.root;
|
|
24
|
-
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
|
25
|
-
console.warn(
|
|
26
|
-
"Migration applied: Root props moved from `root` to `root.props`."
|
|
27
|
-
);
|
|
28
|
-
return __spreadProps(__spreadValues({}, data), {
|
|
29
|
-
root: {
|
|
30
|
-
props: __spreadValues({}, rootProps)
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return data;
|
|
35
|
-
},
|
|
36
|
-
// Migrate zones to slots
|
|
37
|
-
(data, config, migrationOptions) => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
if (!config) return data;
|
|
40
|
-
console.log("Migrating DropZones to slots...");
|
|
41
|
-
const updatedItems = {};
|
|
42
|
-
const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
|
|
43
|
-
const { indexes } = walkAppState(appState, config);
|
|
44
|
-
const deletedCompounds = [];
|
|
45
|
-
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
|
46
|
-
var _a2, _b2, _c;
|
|
47
|
-
if (zoneType === "dropzone") {
|
|
48
|
-
const [id, slotName] = zoneCompound.split(":");
|
|
49
|
-
const nodeData = indexes.nodes[id].data;
|
|
50
|
-
const componentType = nodeData.type;
|
|
51
|
-
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
|
52
|
-
if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
|
|
53
|
-
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
|
54
|
-
props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
|
|
55
|
-
[slotName]: content
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
deletedCompounds.push(zoneCompound);
|
|
59
|
-
}
|
|
60
|
-
return content;
|
|
61
|
-
}
|
|
62
|
-
return content;
|
|
63
|
-
});
|
|
64
|
-
const updated = walkAppState(
|
|
65
|
-
appState,
|
|
66
|
-
config,
|
|
67
|
-
(content) => content,
|
|
68
|
-
(item) => {
|
|
69
|
-
var _a2;
|
|
70
|
-
return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
deletedCompounds.forEach((zoneCompound) => {
|
|
74
|
-
var _a2;
|
|
75
|
-
const [_, propName] = zoneCompound.split(":");
|
|
76
|
-
console.log(
|
|
77
|
-
`\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
|
|
78
|
-
);
|
|
79
|
-
(_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
|
|
80
|
-
});
|
|
81
|
-
if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
|
|
82
|
-
const unmigratedZonesGrouped = {};
|
|
83
|
-
Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
|
|
84
|
-
var _a2;
|
|
85
|
-
const [componentId, propName] = zoneCompound.split(":");
|
|
86
|
-
const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
|
|
87
|
-
if (!content) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (!unmigratedZonesGrouped[componentId]) {
|
|
91
|
-
unmigratedZonesGrouped[componentId] = {};
|
|
92
|
-
}
|
|
93
|
-
if (!unmigratedZonesGrouped[componentId][propName]) {
|
|
94
|
-
unmigratedZonesGrouped[componentId][propName] = content;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
|
|
98
|
-
updated.data = walkTree(updated.data, config, (content) => {
|
|
99
|
-
return content.map((child) => {
|
|
100
|
-
var _a2;
|
|
101
|
-
if (child.props.id !== componentId) {
|
|
102
|
-
return child;
|
|
103
|
-
}
|
|
104
|
-
const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
|
|
105
|
-
if (!migrateFn) {
|
|
106
|
-
return child;
|
|
107
|
-
}
|
|
108
|
-
const zones = unmigratedZonesGrouped[componentId];
|
|
109
|
-
const migratedProps = migrateFn(child.props, zones);
|
|
110
|
-
Object.keys(zones).forEach((propName) => {
|
|
111
|
-
var _a3;
|
|
112
|
-
const zoneCompound = `${componentId}:${propName}`;
|
|
113
|
-
console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
|
|
114
|
-
(_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
|
|
115
|
-
});
|
|
116
|
-
return __spreadProps(__spreadValues({}, child), {
|
|
117
|
-
props: migratedProps
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
|
|
124
|
-
const [_, propName] = zoneCompound.split(":");
|
|
125
|
-
throw new Error(
|
|
126
|
-
`Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
|
|
127
|
-
);
|
|
128
|
-
});
|
|
129
|
-
delete updated.data.zones;
|
|
130
|
-
return updated.data;
|
|
131
|
-
}
|
|
132
|
-
];
|
|
133
|
-
function migrate(data, config, migrationOptions) {
|
|
134
|
-
return migrations == null ? void 0 : migrations.reduce(
|
|
135
|
-
(acc, migration) => migration(acc, config, migrationOptions),
|
|
136
|
-
data
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// lib/transform-props.ts
|
|
141
|
-
init_react_import();
|
|
142
|
-
|
|
143
|
-
// lib/data/default-data.ts
|
|
144
|
-
init_react_import();
|
|
145
|
-
var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
|
146
|
-
root: data.root || {},
|
|
147
|
-
content: data.content || []
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// lib/transform-props.ts
|
|
151
|
-
function transformProps(data, propTransforms, config = { components: {} }) {
|
|
152
|
-
const mapItem = (item) => {
|
|
153
|
-
if (propTransforms[item.type]) {
|
|
154
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
155
|
-
props: __spreadValues({
|
|
156
|
-
id: item.props.id
|
|
157
|
-
}, propTransforms[item.type](item.props))
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
return item;
|
|
161
|
-
};
|
|
162
|
-
const defaultedData = defaultData(data);
|
|
163
|
-
const rootProps = defaultedData.root.props || defaultedData.root;
|
|
164
|
-
let newRoot = __spreadValues({}, defaultedData.root);
|
|
165
|
-
if (propTransforms["root"]) {
|
|
166
|
-
newRoot.props = propTransforms["root"](rootProps);
|
|
167
|
-
}
|
|
168
|
-
const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, 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/resolve-all-data.ts
|
|
181
|
-
init_react_import();
|
|
182
|
-
|
|
183
|
-
// lib/data/to-component.ts
|
|
184
|
-
init_react_import();
|
|
185
|
-
var toComponent = (item) => {
|
|
186
|
-
return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
|
|
187
|
-
props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
|
|
188
|
-
type: "root"
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
// lib/resolve-all-data.ts
|
|
193
|
-
function resolveAllData(_0, _1) {
|
|
194
|
-
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
|
195
|
-
var _a;
|
|
196
|
-
const defaultedData = defaultData(data);
|
|
197
|
-
const resolveNode = (_node) => __async(null, null, function* () {
|
|
198
|
-
const node = toComponent(_node);
|
|
199
|
-
onResolveStart == null ? void 0 : onResolveStart(node);
|
|
200
|
-
const resolved = (yield resolveComponentData(
|
|
201
|
-
node,
|
|
202
|
-
config,
|
|
203
|
-
metadata,
|
|
204
|
-
() => {
|
|
205
|
-
},
|
|
206
|
-
() => {
|
|
207
|
-
},
|
|
208
|
-
"force"
|
|
209
|
-
)).node;
|
|
210
|
-
const resolvedDeep = yield mapFields(
|
|
211
|
-
resolved,
|
|
212
|
-
{ slot: ({ value }) => processContent(value) },
|
|
213
|
-
config
|
|
214
|
-
);
|
|
215
|
-
onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
|
|
216
|
-
return resolvedDeep;
|
|
217
|
-
});
|
|
218
|
-
const processContent = (content) => __async(null, null, function* () {
|
|
219
|
-
return Promise.all(content.map(resolveNode));
|
|
220
|
-
});
|
|
221
|
-
const processZones = () => __async(null, null, function* () {
|
|
222
|
-
var _a2;
|
|
223
|
-
const zones = (_a2 = data.zones) != null ? _a2 : {};
|
|
224
|
-
Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
|
|
225
|
-
zones[zoneKey] = yield Promise.all(content.map(resolveNode));
|
|
226
|
-
}));
|
|
227
|
-
return zones;
|
|
228
|
-
});
|
|
229
|
-
const dynamic = {
|
|
230
|
-
root: yield resolveNode(defaultedData.root),
|
|
231
|
-
content: yield processContent(defaultedData.content),
|
|
232
|
-
zones: yield processZones()
|
|
233
|
-
};
|
|
234
|
-
Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
|
|
235
|
-
const content = defaultedData.zones[zoneKey];
|
|
236
|
-
dynamic.zones[zoneKey] = yield processContent(content);
|
|
237
|
-
}), {});
|
|
238
|
-
return dynamic;
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// lib/field-transforms/use-field-transforms.tsx
|
|
243
|
-
init_react_import();
|
|
244
|
-
import { useMemo } from "react";
|
|
245
|
-
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
246
|
-
const mappers = useMemo(() => {
|
|
247
|
-
return Object.keys(transforms).reduce((acc, _fieldType) => {
|
|
248
|
-
const fieldType = _fieldType;
|
|
249
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
250
|
-
[fieldType]: (_a) => {
|
|
251
|
-
var _b = _a, {
|
|
252
|
-
parentId
|
|
253
|
-
} = _b, params = __objRest(_b, [
|
|
254
|
-
"parentId"
|
|
255
|
-
]);
|
|
256
|
-
const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
|
|
257
|
-
const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
|
|
258
|
-
const fn = transforms[fieldType];
|
|
259
|
-
return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
|
|
260
|
-
isReadOnly,
|
|
261
|
-
componentId: parentId
|
|
262
|
-
}));
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}, {});
|
|
266
|
-
}, [transforms, readOnly, forceReadOnly]);
|
|
267
|
-
const transformedProps = useMemo(() => {
|
|
268
|
-
const mapped = mapFields(item, mappers, config).props;
|
|
269
|
-
return mapped;
|
|
270
|
-
}, [config, item, mappers]);
|
|
271
|
-
const mergedProps = useMemo(
|
|
272
|
-
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
273
|
-
[item.props, transformedProps]
|
|
274
|
-
);
|
|
275
|
-
return mergedProps;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// lib/field-transforms/default-transforms/slot-transform.tsx
|
|
279
|
-
init_react_import();
|
|
280
|
-
var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
|
|
281
|
-
slot: ({ value: content, propName, field, isReadOnly }) => {
|
|
282
|
-
const render = isReadOnly ? renderSlotRender : renderSlotEdit;
|
|
283
|
-
const Slot = (dzProps) => render(__spreadProps(__spreadValues({
|
|
284
|
-
allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
|
|
285
|
-
disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
|
|
286
|
-
}, dzProps), {
|
|
287
|
-
zone: propName,
|
|
288
|
-
content
|
|
289
|
-
}));
|
|
290
|
-
return Slot;
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
// lib/use-slots.tsx
|
|
295
|
-
init_react_import();
|
|
296
|
-
function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
|
|
297
|
-
return useFieldTransforms(
|
|
298
|
-
config,
|
|
299
|
-
item,
|
|
300
|
-
getSlotTransform(renderSlotEdit, renderSlotRender),
|
|
301
|
-
readOnly,
|
|
302
|
-
forceReadOnly
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
307
|
-
init_react_import();
|
|
308
|
-
import { lazy, Suspense, useMemo as useMemo2 } from "react";
|
|
309
|
-
|
|
310
|
-
// components/RichTextEditor/components/RenderFallback.tsx
|
|
311
|
-
init_react_import();
|
|
312
|
-
import { jsx } from "react/jsx-runtime";
|
|
313
|
-
var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
|
|
314
|
-
function RichTextRenderFallback({ content }) {
|
|
315
|
-
return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx(
|
|
316
|
-
"div",
|
|
317
|
-
{
|
|
318
|
-
className: "rich-text",
|
|
319
|
-
dangerouslySetInnerHTML: { __html: content }
|
|
320
|
-
}
|
|
321
|
-
) });
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
325
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
326
|
-
function useRichtextProps(fields, props) {
|
|
327
|
-
const findAllRichtextKeys = (fields2) => {
|
|
328
|
-
if (!fields2) return [];
|
|
329
|
-
const result = [];
|
|
330
|
-
for (const [key, field] of Object.entries(fields2)) {
|
|
331
|
-
if (field.type === "richtext") {
|
|
332
|
-
result.push(key);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return result;
|
|
336
|
-
};
|
|
337
|
-
const richtextKeys = useMemo2(() => findAllRichtextKeys(fields), [fields]);
|
|
338
|
-
const richtextProps = useMemo2(() => {
|
|
339
|
-
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
340
|
-
const RichTextRender = lazy(
|
|
341
|
-
() => import("./Render-6Q5WP25Y.mjs").then((m) => ({
|
|
342
|
-
default: m.RichTextRender
|
|
343
|
-
}))
|
|
344
|
-
);
|
|
345
|
-
return richtextKeys.reduce((acc, key) => {
|
|
346
|
-
acc[key] = /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ jsx2(
|
|
347
|
-
RichTextRender,
|
|
348
|
-
{
|
|
349
|
-
content: props[key],
|
|
350
|
-
field: fields[key]
|
|
351
|
-
}
|
|
352
|
-
) });
|
|
353
|
-
return acc;
|
|
354
|
-
}, {});
|
|
355
|
-
}, [richtextKeys, props, fields]);
|
|
356
|
-
return richtextProps;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// components/SlotRender/server.tsx
|
|
360
|
-
init_react_import();
|
|
361
|
-
import { forwardRef } from "react";
|
|
362
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
363
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, __spreadValues({}, props));
|
|
364
|
-
var Item = ({
|
|
365
|
-
config,
|
|
366
|
-
item,
|
|
367
|
-
metadata
|
|
368
|
-
}) => {
|
|
369
|
-
const Component = config.components[item.type];
|
|
370
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
371
|
-
const richtextProps = useRichtextProps(Component.fields, props);
|
|
372
|
-
return /* @__PURE__ */ jsx3(
|
|
373
|
-
Component.render,
|
|
374
|
-
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
375
|
-
puck: __spreadProps(__spreadValues({}, props.puck), {
|
|
376
|
-
metadata: metadata || {}
|
|
377
|
-
})
|
|
378
|
-
})
|
|
379
|
-
);
|
|
380
|
-
};
|
|
381
|
-
var SlotRender = forwardRef(
|
|
382
|
-
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
383
|
-
const El = as != null ? as : "div";
|
|
384
|
-
return /* @__PURE__ */ jsx3(El, { className, style, ref, children: content.map((item) => {
|
|
385
|
-
if (!config.components[item.type]) {
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
return /* @__PURE__ */ jsx3(
|
|
389
|
-
Item,
|
|
390
|
-
{
|
|
391
|
-
config,
|
|
392
|
-
item,
|
|
393
|
-
metadata
|
|
394
|
-
},
|
|
395
|
-
item.props.id
|
|
396
|
-
);
|
|
397
|
-
}) });
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
|
|
401
|
-
export {
|
|
402
|
-
useFieldTransforms,
|
|
403
|
-
getSlotTransform,
|
|
404
|
-
useSlots,
|
|
405
|
-
RichTextRenderFallback,
|
|
406
|
-
useRichtextProps,
|
|
407
|
-
SlotRenderPure,
|
|
408
|
-
SlotRender,
|
|
409
|
-
toComponent,
|
|
410
|
-
migrate,
|
|
411
|
-
transformProps,
|
|
412
|
-
resolveAllData
|
|
413
|
-
};
|
package/dist/chunk-CF5XA6LF.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadValues,
|
|
3
|
-
init_react_import
|
|
4
|
-
} from "./chunk-GQ457KMA.mjs";
|
|
5
|
-
|
|
6
|
-
// components/RichTextEditor/extension.ts
|
|
7
|
-
init_react_import();
|
|
8
|
-
import { Extension } from "@tiptap/core";
|
|
9
|
-
import { Blockquote } from "@tiptap/extension-blockquote";
|
|
10
|
-
import { Bold } from "@tiptap/extension-bold";
|
|
11
|
-
import { Code } from "@tiptap/extension-code";
|
|
12
|
-
import { CodeBlock } from "@tiptap/extension-code-block";
|
|
13
|
-
import { Document } from "@tiptap/extension-document";
|
|
14
|
-
import { HardBreak } from "@tiptap/extension-hard-break";
|
|
15
|
-
import { Heading } from "@tiptap/extension-heading";
|
|
16
|
-
import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
|
|
17
|
-
import { Italic } from "@tiptap/extension-italic";
|
|
18
|
-
import { Link } from "@tiptap/extension-link";
|
|
19
|
-
import {
|
|
20
|
-
BulletList,
|
|
21
|
-
ListItem,
|
|
22
|
-
ListKeymap,
|
|
23
|
-
OrderedList
|
|
24
|
-
} from "@tiptap/extension-list";
|
|
25
|
-
import { Paragraph } from "@tiptap/extension-paragraph";
|
|
26
|
-
import { Strike } from "@tiptap/extension-strike";
|
|
27
|
-
import { Text } from "@tiptap/extension-text";
|
|
28
|
-
import TextAlign from "@tiptap/extension-text-align";
|
|
29
|
-
import { Underline } from "@tiptap/extension-underline";
|
|
30
|
-
var defaultPuckRichTextOptions = {
|
|
31
|
-
textAlign: {
|
|
32
|
-
types: ["heading", "paragraph"]
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var PuckRichText = Extension.create({
|
|
36
|
-
name: "puckRichText",
|
|
37
|
-
addExtensions() {
|
|
38
|
-
const extensions = [];
|
|
39
|
-
const options = __spreadValues(__spreadValues({}, this.options), defaultPuckRichTextOptions);
|
|
40
|
-
if (options.bold !== false) {
|
|
41
|
-
extensions.push(Bold.configure(options.bold));
|
|
42
|
-
}
|
|
43
|
-
if (options.blockquote !== false) {
|
|
44
|
-
extensions.push(Blockquote.configure(options.blockquote));
|
|
45
|
-
}
|
|
46
|
-
if (options.bulletList !== false) {
|
|
47
|
-
extensions.push(BulletList.configure(options.bulletList));
|
|
48
|
-
}
|
|
49
|
-
if (options.code !== false) {
|
|
50
|
-
extensions.push(Code.configure(options.code));
|
|
51
|
-
}
|
|
52
|
-
if (options.codeBlock !== false) {
|
|
53
|
-
extensions.push(CodeBlock.configure(options.codeBlock));
|
|
54
|
-
}
|
|
55
|
-
if (options.document !== false) {
|
|
56
|
-
extensions.push(Document.configure(options.document));
|
|
57
|
-
}
|
|
58
|
-
if (options.hardBreak !== false) {
|
|
59
|
-
extensions.push(HardBreak.configure(options.hardBreak));
|
|
60
|
-
}
|
|
61
|
-
if (options.heading !== false) {
|
|
62
|
-
extensions.push(Heading.configure(options.heading));
|
|
63
|
-
}
|
|
64
|
-
if (options.horizontalRule !== false) {
|
|
65
|
-
extensions.push(HorizontalRule.configure(options.horizontalRule));
|
|
66
|
-
}
|
|
67
|
-
if (options.italic !== false) {
|
|
68
|
-
extensions.push(Italic.configure(options.italic));
|
|
69
|
-
}
|
|
70
|
-
if (options.listItem !== false) {
|
|
71
|
-
extensions.push(ListItem.configure(options.listItem));
|
|
72
|
-
}
|
|
73
|
-
if (options.listKeymap !== false) {
|
|
74
|
-
extensions.push(ListKeymap.configure(options == null ? void 0 : options.listKeymap));
|
|
75
|
-
}
|
|
76
|
-
if (options.link !== false) {
|
|
77
|
-
extensions.push(Link.configure(options == null ? void 0 : options.link));
|
|
78
|
-
}
|
|
79
|
-
if (options.orderedList !== false) {
|
|
80
|
-
extensions.push(OrderedList.configure(options.orderedList));
|
|
81
|
-
}
|
|
82
|
-
if (options.paragraph !== false) {
|
|
83
|
-
extensions.push(Paragraph.configure(options.paragraph));
|
|
84
|
-
}
|
|
85
|
-
if (options.strike !== false) {
|
|
86
|
-
extensions.push(Strike.configure(options.strike));
|
|
87
|
-
}
|
|
88
|
-
if (options.text !== false) {
|
|
89
|
-
extensions.push(Text.configure(options.text));
|
|
90
|
-
}
|
|
91
|
-
if (options.textAlign !== false) {
|
|
92
|
-
extensions.push(TextAlign.configure(options.textAlign));
|
|
93
|
-
}
|
|
94
|
-
if (options.underline !== false) {
|
|
95
|
-
extensions.push(Underline.configure(options == null ? void 0 : options.underline));
|
|
96
|
-
}
|
|
97
|
-
return extensions;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
export {
|
|
102
|
-
PuckRichText
|
|
103
|
-
};
|