@measured/puck 0.21.0-canary.3aa27d1d → 0.21.0-canary.56be3202

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.
Files changed (52) hide show
  1. package/dist/Editor-CYTATURR.mjs +204 -0
  2. package/dist/Editor-F2LSS6SE.css +403 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-16XYcbNo.d.mts → actions-tsxxcX1z.d.mts} +29 -40
  6. package/dist/{walk-tree-16XYcbNo.d.ts → actions-tsxxcX1z.d.ts} +29 -40
  7. package/dist/chunk-72SA22GI.mjs +134 -0
  8. package/dist/chunk-CSSRLPHM.mjs +11 -0
  9. package/dist/chunk-M4QBB3JM.mjs +111 -0
  10. package/dist/chunk-M6W7YEVX.mjs +95 -0
  11. package/dist/chunk-MLTVJA2A.mjs +63 -0
  12. package/dist/chunk-MVJKIFF6.mjs +419 -0
  13. package/dist/chunk-NLUHDYVR.mjs +416 -0
  14. package/dist/chunk-NOJQSXRU.mjs +33 -0
  15. package/dist/{chunk-GFIVKP2H.mjs → chunk-PZ4SED7H.mjs} +6848 -9297
  16. package/dist/chunk-QBGM4ELA.mjs +528 -0
  17. package/dist/chunk-UNQOU2OI.mjs +53 -0
  18. package/dist/chunk-UUOBSXZR.mjs +1807 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-V7333LON.mjs +708 -0
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-GZ4L3XCF.mjs +93 -0
  24. package/dist/index-Ca6V6NQD.d.ts +118 -0
  25. package/dist/index-mQvUCH3C.d.mts +118 -0
  26. package/dist/index.css +856 -458
  27. package/dist/index.d.mts +32 -129
  28. package/dist/index.d.ts +32 -129
  29. package/dist/index.js +11790 -9359
  30. package/dist/index.mjs +32 -14
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +908 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-2MNXXPJP.mjs +57 -0
  36. package/dist/loaded-6QT4HD2O.mjs +57 -0
  37. package/dist/loaded-RVWBFK7L.css +87 -0
  38. package/dist/loaded-ZVPBQVNE.mjs +60 -0
  39. package/dist/no-external.css +988 -586
  40. package/dist/no-external.d.mts +4 -2
  41. package/dist/no-external.d.ts +4 -2
  42. package/dist/no-external.js +11793 -9359
  43. package/dist/no-external.mjs +34 -11
  44. package/dist/rsc.css +34 -26
  45. package/dist/rsc.d.mts +2 -2
  46. package/dist/rsc.d.ts +2 -2
  47. package/dist/rsc.js +249 -189
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
  50. package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
  51. package/package.json +9 -4
  52. package/dist/chunk-SRDLYODX.mjs +0 -1245
@@ -0,0 +1,95 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __esm = (fn, res) => function __init() {
37
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
38
+ };
39
+ var __commonJS = (cb, mod) => function __require() {
40
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
41
+ };
42
+ var __copyProps = (to, from, except, desc) => {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ for (let key of __getOwnPropNames(from))
45
+ if (!__hasOwnProp.call(to, key) && key !== except)
46
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
+ }
48
+ return to;
49
+ };
50
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
+ // If the importer is in node compatibility mode or this is not an ESM
52
+ // file that has been converted to a CommonJS file using a Babel-
53
+ // compatible transform (i.e. "__esModule" has not been set), then set
54
+ // "default" to the CommonJS "module.exports" for node compatibility.
55
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
+ mod
57
+ ));
58
+ var __async = (__this, __arguments, generator) => {
59
+ return new Promise((resolve, reject) => {
60
+ var fulfilled = (value) => {
61
+ try {
62
+ step(generator.next(value));
63
+ } catch (e) {
64
+ reject(e);
65
+ }
66
+ };
67
+ var rejected = (value) => {
68
+ try {
69
+ step(generator.throw(value));
70
+ } catch (e) {
71
+ reject(e);
72
+ }
73
+ };
74
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75
+ step((generator = generator.apply(__this, __arguments)).next());
76
+ });
77
+ };
78
+
79
+ // ../tsup-config/react-import.js
80
+ import React from "react";
81
+ var init_react_import = __esm({
82
+ "../tsup-config/react-import.js"() {
83
+ "use strict";
84
+ }
85
+ });
86
+
87
+ export {
88
+ __spreadValues,
89
+ __spreadProps,
90
+ __objRest,
91
+ __commonJS,
92
+ __toESM,
93
+ __async,
94
+ init_react_import
95
+ };
@@ -0,0 +1,63 @@
1
+ import {
2
+ Heading1,
3
+ Heading2,
4
+ Heading3,
5
+ Heading4,
6
+ Heading5,
7
+ Heading6
8
+ } from "./chunk-UUOBSXZR.mjs";
9
+ import {
10
+ init_react_import
11
+ } from "./chunk-M6W7YEVX.mjs";
12
+
13
+ // components/RichTextMenu/controls/HeadingSelect/use-options.ts
14
+ init_react_import();
15
+ import { useMemo } from "react";
16
+ var optionNodes = {
17
+ h1: { label: "Heading 1", icon: Heading1 },
18
+ h2: { label: "Heading 2", icon: Heading2 },
19
+ h3: { label: "Heading 3", icon: Heading3 },
20
+ h4: { label: "Heading 4", icon: Heading4 },
21
+ h5: { label: "Heading 5", icon: Heading5 },
22
+ h6: { label: "Heading 6", icon: Heading6 }
23
+ };
24
+ var useHeadingOptions = (fieldOptions) => {
25
+ var _a;
26
+ let blockOptions = [];
27
+ if ((fieldOptions == null ? void 0 : fieldOptions.heading) !== false) {
28
+ if (!((_a = fieldOptions == null ? void 0 : fieldOptions.heading) == null ? void 0 : _a.levels)) {
29
+ blockOptions = ["h1", "h2", "h3", "h4", "h5", "h6"];
30
+ } else {
31
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(1)) {
32
+ blockOptions.push("h1");
33
+ }
34
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(2)) {
35
+ blockOptions.push("h2");
36
+ }
37
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(3)) {
38
+ blockOptions.push("h3");
39
+ }
40
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(4)) {
41
+ blockOptions.push("h4");
42
+ }
43
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(5)) {
44
+ blockOptions.push("h5");
45
+ }
46
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(6)) {
47
+ blockOptions.push("h6");
48
+ }
49
+ }
50
+ }
51
+ return useMemo(
52
+ () => blockOptions.map((item) => ({
53
+ value: item,
54
+ label: optionNodes[item].label,
55
+ icon: optionNodes[item].icon
56
+ })),
57
+ [blockOptions]
58
+ );
59
+ };
60
+
61
+ export {
62
+ useHeadingOptions
63
+ };
@@ -0,0 +1,419 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-CSSRLPHM.mjs";
4
+ import {
5
+ defaultAppState,
6
+ resolveComponentData
7
+ } from "./chunk-72SA22GI.mjs";
8
+ import {
9
+ get_class_name_factory_default
10
+ } from "./chunk-Y2EFNT5P.mjs";
11
+ import {
12
+ mapFields,
13
+ walkAppState,
14
+ walkTree
15
+ } from "./chunk-NLUHDYVR.mjs";
16
+ import {
17
+ __async,
18
+ __objRest,
19
+ __spreadProps,
20
+ __spreadValues,
21
+ init_react_import
22
+ } from "./chunk-M6W7YEVX.mjs";
23
+
24
+ // lib/migrate.ts
25
+ init_react_import();
26
+ var migrations = [
27
+ // Migrate root to root.props
28
+ (data) => {
29
+ const rootProps = data.root.props || data.root;
30
+ if (Object.keys(data.root).length > 0 && !data.root.props) {
31
+ console.warn(
32
+ "Migration applied: Root props moved from `root` to `root.props`."
33
+ );
34
+ return __spreadProps(__spreadValues({}, data), {
35
+ root: {
36
+ props: __spreadValues({}, rootProps)
37
+ }
38
+ });
39
+ }
40
+ return data;
41
+ },
42
+ // Migrate zones to slots
43
+ (data, config, migrationOptions) => {
44
+ var _a, _b;
45
+ if (!config) return data;
46
+ console.log("Migrating DropZones to slots...");
47
+ const updatedItems = {};
48
+ const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
49
+ const { indexes } = walkAppState(appState, config);
50
+ const deletedCompounds = [];
51
+ walkAppState(appState, config, (content, zoneCompound, zoneType) => {
52
+ var _a2, _b2, _c;
53
+ if (zoneType === "dropzone") {
54
+ const [id, slotName] = zoneCompound.split(":");
55
+ const nodeData = indexes.nodes[id].data;
56
+ const componentType = nodeData.type;
57
+ const configForComponent = id === "root" ? config.root : config.components[componentType];
58
+ if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
59
+ updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
60
+ props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
61
+ [slotName]: content
62
+ })
63
+ });
64
+ deletedCompounds.push(zoneCompound);
65
+ }
66
+ return content;
67
+ }
68
+ return content;
69
+ });
70
+ const updated = walkAppState(
71
+ appState,
72
+ config,
73
+ (content) => content,
74
+ (item) => {
75
+ var _a2;
76
+ return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
77
+ }
78
+ );
79
+ deletedCompounds.forEach((zoneCompound) => {
80
+ var _a2;
81
+ const [_, propName] = zoneCompound.split(":");
82
+ console.log(
83
+ `\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
84
+ );
85
+ (_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
86
+ });
87
+ if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
88
+ const unmigratedZonesGrouped = {};
89
+ Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
90
+ var _a2;
91
+ const [componentId, propName] = zoneCompound.split(":");
92
+ const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
93
+ if (!content) {
94
+ return;
95
+ }
96
+ if (!unmigratedZonesGrouped[componentId]) {
97
+ unmigratedZonesGrouped[componentId] = {};
98
+ }
99
+ if (!unmigratedZonesGrouped[componentId][propName]) {
100
+ unmigratedZonesGrouped[componentId][propName] = content;
101
+ }
102
+ });
103
+ Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
104
+ updated.data = walkTree(updated.data, config, (content) => {
105
+ return content.map((child) => {
106
+ var _a2;
107
+ if (child.props.id !== componentId) {
108
+ return child;
109
+ }
110
+ const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
111
+ if (!migrateFn) {
112
+ return child;
113
+ }
114
+ const zones = unmigratedZonesGrouped[componentId];
115
+ const migratedProps = migrateFn(child.props, zones);
116
+ Object.keys(zones).forEach((propName) => {
117
+ var _a3;
118
+ const zoneCompound = `${componentId}:${propName}`;
119
+ console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
120
+ (_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
121
+ });
122
+ return __spreadProps(__spreadValues({}, child), {
123
+ props: migratedProps
124
+ });
125
+ });
126
+ });
127
+ });
128
+ }
129
+ Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
130
+ const [_, propName] = zoneCompound.split(":");
131
+ throw new Error(
132
+ `Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
133
+ );
134
+ });
135
+ delete updated.data.zones;
136
+ return updated.data;
137
+ }
138
+ ];
139
+ function migrate(data, config, migrationOptions) {
140
+ return migrations == null ? void 0 : migrations.reduce(
141
+ (acc, migration) => migration(acc, config, migrationOptions),
142
+ data
143
+ );
144
+ }
145
+
146
+ // lib/transform-props.ts
147
+ init_react_import();
148
+
149
+ // lib/data/default-data.ts
150
+ init_react_import();
151
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
152
+ root: data.root || {},
153
+ content: data.content || []
154
+ });
155
+
156
+ // lib/transform-props.ts
157
+ function transformProps(data, propTransforms, config = { components: {} }) {
158
+ const mapItem = (item) => {
159
+ if (propTransforms[item.type]) {
160
+ return __spreadProps(__spreadValues({}, item), {
161
+ props: __spreadValues({
162
+ id: item.props.id
163
+ }, propTransforms[item.type](item.props))
164
+ });
165
+ }
166
+ return item;
167
+ };
168
+ const defaultedData = defaultData(data);
169
+ const rootProps = defaultedData.root.props || defaultedData.root;
170
+ let newRoot = __spreadValues({}, defaultedData.root);
171
+ if (propTransforms["root"]) {
172
+ newRoot.props = propTransforms["root"](rootProps);
173
+ }
174
+ const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
175
+ const updatedData = walkTree(
176
+ dataWithUpdatedRoot,
177
+ config,
178
+ (content) => content.map(mapItem)
179
+ );
180
+ if (!defaultedData.root.props) {
181
+ updatedData.root = updatedData.root.props;
182
+ }
183
+ return updatedData;
184
+ }
185
+
186
+ // lib/resolve-all-data.ts
187
+ init_react_import();
188
+
189
+ // lib/data/to-component.ts
190
+ init_react_import();
191
+ var toComponent = (item) => {
192
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
193
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
194
+ type: "root"
195
+ });
196
+ };
197
+
198
+ // lib/resolve-all-data.ts
199
+ function resolveAllData(_0, _1) {
200
+ return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
201
+ var _a;
202
+ const defaultedData = defaultData(data);
203
+ const resolveNode = (_node) => __async(null, null, function* () {
204
+ const node = toComponent(_node);
205
+ onResolveStart == null ? void 0 : onResolveStart(node);
206
+ const resolved = (yield resolveComponentData(
207
+ node,
208
+ config,
209
+ metadata,
210
+ () => {
211
+ },
212
+ () => {
213
+ },
214
+ "force"
215
+ )).node;
216
+ const resolvedDeep = yield mapFields(
217
+ resolved,
218
+ { slot: ({ value }) => processContent(value) },
219
+ config
220
+ );
221
+ onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
222
+ return resolvedDeep;
223
+ });
224
+ const processContent = (content) => __async(null, null, function* () {
225
+ return Promise.all(content.map(resolveNode));
226
+ });
227
+ const processZones = () => __async(null, null, function* () {
228
+ var _a2;
229
+ const zones = (_a2 = data.zones) != null ? _a2 : {};
230
+ Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
231
+ zones[zoneKey] = yield Promise.all(content.map(resolveNode));
232
+ }));
233
+ return zones;
234
+ });
235
+ const dynamic = {
236
+ root: yield resolveNode(defaultedData.root),
237
+ content: yield processContent(defaultedData.content),
238
+ zones: yield processZones()
239
+ };
240
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
241
+ const content = defaultedData.zones[zoneKey];
242
+ dynamic.zones[zoneKey] = yield processContent(content);
243
+ }), {});
244
+ return dynamic;
245
+ });
246
+ }
247
+
248
+ // lib/field-transforms/use-field-transforms.tsx
249
+ init_react_import();
250
+ import { useMemo } from "react";
251
+ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
252
+ const mappers = useMemo(() => {
253
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
254
+ const fieldType = _fieldType;
255
+ return __spreadProps(__spreadValues({}, acc), {
256
+ [fieldType]: (_a) => {
257
+ var _b = _a, {
258
+ parentId
259
+ } = _b, params = __objRest(_b, [
260
+ "parentId"
261
+ ]);
262
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
263
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
264
+ const fn = transforms[fieldType];
265
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
266
+ isReadOnly,
267
+ componentId: parentId
268
+ }));
269
+ }
270
+ });
271
+ }, {});
272
+ }, [transforms, readOnly, forceReadOnly]);
273
+ const transformedProps = useMemo(() => {
274
+ const mapped = mapFields(item, mappers, config).props;
275
+ return mapped;
276
+ }, [config, item, mappers]);
277
+ const mergedProps = useMemo(
278
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
279
+ [item.props, transformedProps]
280
+ );
281
+ return mergedProps;
282
+ }
283
+
284
+ // lib/field-transforms/default-transforms/slot-transform.tsx
285
+ init_react_import();
286
+ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
287
+ slot: ({ value: content, propName, field, isReadOnly }) => {
288
+ const render = isReadOnly ? renderSlotRender : renderSlotEdit;
289
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
290
+ allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
291
+ disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
292
+ }, dzProps), {
293
+ zone: propName,
294
+ content
295
+ }));
296
+ return Slot;
297
+ }
298
+ });
299
+
300
+ // lib/use-slots.tsx
301
+ init_react_import();
302
+ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
303
+ return useFieldTransforms(
304
+ config,
305
+ item,
306
+ getSlotTransform(renderSlotEdit, renderSlotRender),
307
+ readOnly,
308
+ forceReadOnly
309
+ );
310
+ }
311
+
312
+ // components/RichTextEditor/lib/use-richtext-props.tsx
313
+ init_react_import();
314
+ import { lazy, Suspense, useMemo as useMemo2 } from "react";
315
+
316
+ // components/RichTextEditor/components/RenderFallback.tsx
317
+ init_react_import();
318
+ import { jsx } from "react/jsx-runtime";
319
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
320
+ function RichTextRenderFallback({ content }) {
321
+ return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx(
322
+ "div",
323
+ {
324
+ className: "rich-text",
325
+ dangerouslySetInnerHTML: { __html: content }
326
+ }
327
+ ) });
328
+ }
329
+
330
+ // components/RichTextEditor/lib/use-richtext-props.tsx
331
+ import { jsx as jsx2 } from "react/jsx-runtime";
332
+ function useRichtextProps(fields, props) {
333
+ const findAllRichtextKeys = (fields2) => {
334
+ if (!fields2) return [];
335
+ const result = [];
336
+ for (const [key, field] of Object.entries(fields2)) {
337
+ if (field.type === "richtext") {
338
+ result.push(key);
339
+ }
340
+ }
341
+ return result;
342
+ };
343
+ const richtextKeys = useMemo2(() => findAllRichtextKeys(fields), [fields]);
344
+ const richtextProps = useMemo2(() => {
345
+ if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
346
+ const RichTextRender = lazy(
347
+ () => import("./Render-OFE6QLI2.mjs").then((m) => ({
348
+ default: m.RichTextRender
349
+ }))
350
+ );
351
+ return richtextKeys.reduce((acc, key) => {
352
+ acc[key] = /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ jsx2(
353
+ RichTextRender,
354
+ {
355
+ content: props[key],
356
+ field: fields[key]
357
+ }
358
+ ) });
359
+ return acc;
360
+ }, {});
361
+ }, [richtextKeys, props, fields]);
362
+ return richtextProps;
363
+ }
364
+
365
+ // components/SlotRender/server.tsx
366
+ init_react_import();
367
+ import { forwardRef } from "react";
368
+ import { jsx as jsx3 } from "react/jsx-runtime";
369
+ var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, __spreadValues({}, props));
370
+ var Item = ({
371
+ config,
372
+ item,
373
+ metadata
374
+ }) => {
375
+ const Component = config.components[item.type];
376
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
377
+ const richtextProps = useRichtextProps(Component.fields, props);
378
+ return /* @__PURE__ */ jsx3(
379
+ Component.render,
380
+ __spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
381
+ puck: __spreadProps(__spreadValues({}, props.puck), {
382
+ metadata: metadata || {}
383
+ })
384
+ })
385
+ );
386
+ };
387
+ var SlotRender = forwardRef(
388
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
389
+ const El = as != null ? as : "div";
390
+ return /* @__PURE__ */ jsx3(El, { className, style, ref, children: content.map((item) => {
391
+ if (!config.components[item.type]) {
392
+ return null;
393
+ }
394
+ return /* @__PURE__ */ jsx3(
395
+ Item,
396
+ {
397
+ config,
398
+ item,
399
+ metadata
400
+ },
401
+ item.props.id
402
+ );
403
+ }) });
404
+ }
405
+ );
406
+
407
+ export {
408
+ useFieldTransforms,
409
+ getSlotTransform,
410
+ useSlots,
411
+ RichTextRenderFallback,
412
+ useRichtextProps,
413
+ SlotRenderPure,
414
+ SlotRender,
415
+ toComponent,
416
+ migrate,
417
+ transformProps,
418
+ resolveAllData
419
+ };