@measured/puck 0.21.0-canary.c78dc826 → 0.21.0-canary.d1e8fa71

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 (50) hide show
  1. package/dist/{Editor-F2LSS6SE.css → Editor-IQP25PUX.css} +28 -27
  2. package/dist/{Editor-N46HUQEC.mjs → Editor-L3JAAT2X.mjs} +13 -10
  3. package/dist/{Render-QEMDIDQC.css → Render-3OV4N4MT.css} +28 -27
  4. package/dist/{Render-Y567PGZ7.mjs → Render-FXZX6NFH.mjs} +6 -4
  5. package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-tsxxcX1z.d.mts} +24 -35
  6. package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-tsxxcX1z.d.ts} +24 -35
  7. package/dist/chunk-23IZFPL7.mjs +528 -0
  8. package/dist/{chunk-C2TVYIYC.mjs → chunk-3SDLQIUZ.mjs} +57 -43
  9. package/dist/chunk-45I5SDOI.mjs +134 -0
  10. package/dist/{chunk-DNF2EMM4.mjs → chunk-5ZZVX2Z3.mjs} +2 -2
  11. package/dist/chunk-AOEDIUVK.mjs +11 -0
  12. package/dist/{chunk-DJSH5REF.mjs → chunk-B7REOAA7.mjs} +24 -126
  13. package/dist/{chunk-K3V4LVUL.mjs → chunk-BXQQARCR.mjs} +14 -10
  14. package/dist/{chunk-TB3SSIAY.mjs → chunk-CQUAWHOK.mjs} +5224 -4509
  15. package/dist/{chunk-7KY6RHEY.mjs → chunk-D2SRL6YA.mjs} +101 -524
  16. package/dist/{chunk-GQKMOYLG.mjs → chunk-LJEGWHDD.mjs} +2 -2
  17. package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
  18. package/dist/{chunk-FNWOH4R6.mjs → chunk-PBAAIKXA.mjs} +8 -6
  19. package/dist/{chunk-3QHWXJEI.mjs → chunk-U4VSQKO3.mjs} +2 -2
  20. package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/{full-NLUNPJWS.mjs → full-L7DWVNTZ.mjs} +10 -7
  23. package/dist/index-Ca6V6NQD.d.ts +118 -0
  24. package/dist/index-mQvUCH3C.d.mts +118 -0
  25. package/dist/index.css +732 -341
  26. package/dist/index.d.mts +29 -120
  27. package/dist/index.d.ts +29 -120
  28. package/dist/index.js +3273 -2392
  29. package/dist/index.mjs +22 -16
  30. package/dist/internal.d.mts +27 -0
  31. package/dist/internal.d.ts +27 -0
  32. package/dist/internal.js +927 -0
  33. package/dist/internal.mjs +13 -0
  34. package/dist/{loaded-HMSPJUZM.mjs → loaded-2HLHDP2G.mjs} +7 -4
  35. package/dist/{loaded-EV34KGYJ.mjs → loaded-LZUXYAGW.mjs} +7 -4
  36. package/dist/{loaded-ZXOU6S6R.mjs → loaded-UHVTB6OD.mjs} +7 -4
  37. package/dist/no-external.css +870 -475
  38. package/dist/no-external.d.mts +4 -2
  39. package/dist/no-external.d.ts +4 -2
  40. package/dist/no-external.js +3276 -2392
  41. package/dist/no-external.mjs +22 -11
  42. package/dist/rsc.css +28 -27
  43. package/dist/rsc.d.mts +2 -2
  44. package/dist/rsc.d.ts +2 -2
  45. package/dist/rsc.js +56 -29
  46. package/dist/rsc.mjs +6 -4
  47. package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
  48. package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
  49. package/package.json +9 -4
  50. package/dist/chunk-WUWXFMEM.mjs +0 -11
@@ -0,0 +1,528 @@
1
+ import {
2
+ rootDroppableId,
3
+ setupZone,
4
+ walkAppState,
5
+ walkTree
6
+ } from "./chunk-B7REOAA7.mjs";
7
+ import {
8
+ __spreadProps,
9
+ __spreadValues,
10
+ init_react_import
11
+ } from "./chunk-M6W7YEVX.mjs";
12
+
13
+ // reducer/index.ts
14
+ init_react_import();
15
+
16
+ // reducer/actions/set.ts
17
+ init_react_import();
18
+ var setAction = (state, action, appStore) => {
19
+ if (typeof action.state === "object") {
20
+ const newState = __spreadValues(__spreadValues({}, state), action.state);
21
+ if (action.state.indexes) {
22
+ return newState;
23
+ }
24
+ console.warn(
25
+ "`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
26
+ );
27
+ return walkAppState(newState, appStore.config);
28
+ }
29
+ return __spreadValues(__spreadValues({}, state), action.state(state));
30
+ };
31
+
32
+ // reducer/actions/insert.ts
33
+ init_react_import();
34
+
35
+ // lib/data/insert.ts
36
+ init_react_import();
37
+ var insert = (list, index, item) => {
38
+ const result = Array.from(list || []);
39
+ result.splice(index, 0, item);
40
+ return result;
41
+ };
42
+
43
+ // lib/generate-id.ts
44
+ init_react_import();
45
+ import { v4 as uuidv4 } from "uuid";
46
+ var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
47
+
48
+ // lib/data/get-ids-for-parent.ts
49
+ init_react_import();
50
+ var getIdsForParent = (zoneCompound, state) => {
51
+ const [parentId] = zoneCompound.split(":");
52
+ const node = state.indexes.nodes[parentId];
53
+ return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
54
+ };
55
+
56
+ // lib/data/populate-ids.ts
57
+ init_react_import();
58
+ var populateIds = (data, config, override = false) => {
59
+ const id = generateId(data.type);
60
+ return walkTree(
61
+ __spreadProps(__spreadValues({}, data), {
62
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
63
+ }),
64
+ config,
65
+ (contents) => contents.map((item) => {
66
+ const id2 = generateId(item.type);
67
+ return __spreadProps(__spreadValues({}, item), {
68
+ props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
69
+ });
70
+ })
71
+ );
72
+ };
73
+
74
+ // reducer/actions/insert.ts
75
+ function insertAction(state, action, appStore) {
76
+ const id = action.id || generateId(action.componentType);
77
+ const emptyComponentData = populateIds(
78
+ {
79
+ type: action.componentType,
80
+ props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
81
+ id
82
+ })
83
+ },
84
+ appStore.config
85
+ );
86
+ const [parentId] = action.destinationZone.split(":");
87
+ const idsInPath = getIdsForParent(action.destinationZone, state);
88
+ return walkAppState(
89
+ state,
90
+ appStore.config,
91
+ (content, zoneCompound) => {
92
+ if (zoneCompound === action.destinationZone) {
93
+ return insert(
94
+ content || [],
95
+ action.destinationIndex,
96
+ emptyComponentData
97
+ );
98
+ }
99
+ return content;
100
+ },
101
+ (childItem, path) => {
102
+ if (childItem.props.id === id || childItem.props.id === parentId) {
103
+ return childItem;
104
+ } else if (idsInPath.includes(childItem.props.id)) {
105
+ return childItem;
106
+ } else if (path.includes(action.destinationZone)) {
107
+ return childItem;
108
+ }
109
+ return null;
110
+ }
111
+ );
112
+ }
113
+
114
+ // reducer/actions/replace.ts
115
+ init_react_import();
116
+ var replaceAction = (state, action, appStore) => {
117
+ const [parentId] = action.destinationZone.split(":");
118
+ const idsInPath = getIdsForParent(action.destinationZone, state);
119
+ const originalId = state.indexes.zones[action.destinationZone].contentIds[action.destinationIndex];
120
+ const idChanged = originalId !== action.data.props.id;
121
+ if (idChanged) {
122
+ throw new Error(
123
+ `Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
124
+ );
125
+ }
126
+ const newSlotIds = [];
127
+ const data = walkTree(action.data, appStore.config, (contents, opts) => {
128
+ newSlotIds.push(`${opts.parentId}:${opts.propName}`);
129
+ return contents.map((item) => {
130
+ const id = generateId(item.type);
131
+ return __spreadProps(__spreadValues({}, item), {
132
+ props: __spreadValues({ id }, item.props)
133
+ });
134
+ });
135
+ });
136
+ const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
137
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
138
+ });
139
+ Object.keys(state.indexes.zones).forEach((zoneCompound) => {
140
+ const id = zoneCompound.split(":")[0];
141
+ if (id === originalId) {
142
+ if (!newSlotIds.includes(zoneCompound)) {
143
+ delete stateWithDeepSlotsRemoved.indexes.zones[zoneCompound];
144
+ }
145
+ }
146
+ });
147
+ return walkAppState(
148
+ stateWithDeepSlotsRemoved,
149
+ appStore.config,
150
+ (content, zoneCompound) => {
151
+ const newContent = [...content];
152
+ if (zoneCompound === action.destinationZone) {
153
+ newContent[action.destinationIndex] = data;
154
+ }
155
+ return newContent;
156
+ },
157
+ (childItem, path) => {
158
+ const pathIds = path.map((p) => p.split(":")[0]);
159
+ if (childItem.props.id === data.props.id) {
160
+ return data;
161
+ } else if (childItem.props.id === parentId) {
162
+ return childItem;
163
+ } else if (idsInPath.indexOf(childItem.props.id) > -1) {
164
+ return childItem;
165
+ } else if (pathIds.indexOf(data.props.id) > -1) {
166
+ return childItem;
167
+ }
168
+ return null;
169
+ }
170
+ );
171
+ };
172
+
173
+ // reducer/actions/replace-root.ts
174
+ init_react_import();
175
+ var replaceRootAction = (state, action, appStore) => {
176
+ return walkAppState(
177
+ state,
178
+ appStore.config,
179
+ (content) => content,
180
+ (childItem) => {
181
+ if (childItem.props.id === "root") {
182
+ return __spreadProps(__spreadValues({}, childItem), {
183
+ props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
184
+ readOnly: action.root.readOnly
185
+ });
186
+ }
187
+ return childItem;
188
+ }
189
+ );
190
+ };
191
+
192
+ // reducer/actions/duplicate.ts
193
+ init_react_import();
194
+
195
+ // lib/data/get-item.ts
196
+ init_react_import();
197
+ function getItem(selector, state) {
198
+ var _a, _b;
199
+ const zone = (_a = state.indexes.zones) == null ? void 0 : _a[selector.zone || rootDroppableId];
200
+ return zone ? (_b = state.indexes.nodes[zone.contentIds[selector.index]]) == null ? void 0 : _b.data : void 0;
201
+ }
202
+
203
+ // reducer/actions/duplicate.ts
204
+ function duplicateAction(state, action, appStore) {
205
+ const item = getItem(
206
+ { index: action.sourceIndex, zone: action.sourceZone },
207
+ state
208
+ );
209
+ const idsInPath = getIdsForParent(action.sourceZone, state);
210
+ const newItem = __spreadProps(__spreadValues({}, item), {
211
+ props: __spreadProps(__spreadValues({}, item.props), {
212
+ id: generateId(item.type)
213
+ })
214
+ });
215
+ const modified = walkAppState(
216
+ state,
217
+ appStore.config,
218
+ (content, zoneCompound) => {
219
+ if (zoneCompound === action.sourceZone) {
220
+ return insert(content, action.sourceIndex + 1, item);
221
+ }
222
+ return content;
223
+ },
224
+ (childItem, path, index) => {
225
+ const zoneCompound = path[path.length - 1];
226
+ const parents = path.map((p) => p.split(":")[0]);
227
+ if (parents.indexOf(newItem.props.id) > -1) {
228
+ return __spreadProps(__spreadValues({}, childItem), {
229
+ props: __spreadProps(__spreadValues({}, childItem.props), {
230
+ id: generateId(childItem.type)
231
+ })
232
+ });
233
+ }
234
+ if (zoneCompound === action.sourceZone && index === action.sourceIndex + 1) {
235
+ return newItem;
236
+ }
237
+ const [sourceZoneParent] = action.sourceZone.split(":");
238
+ if (sourceZoneParent === childItem.props.id || idsInPath.indexOf(childItem.props.id) > -1) {
239
+ return childItem;
240
+ }
241
+ return null;
242
+ }
243
+ );
244
+ return __spreadProps(__spreadValues({}, modified), {
245
+ ui: __spreadProps(__spreadValues({}, modified.ui), {
246
+ itemSelector: {
247
+ index: action.sourceIndex + 1,
248
+ zone: action.sourceZone
249
+ }
250
+ })
251
+ });
252
+ }
253
+
254
+ // reducer/actions/reorder.ts
255
+ init_react_import();
256
+
257
+ // reducer/actions/move.ts
258
+ init_react_import();
259
+
260
+ // lib/data/remove.ts
261
+ init_react_import();
262
+ var remove = (list, index) => {
263
+ const result = Array.from(list);
264
+ result.splice(index, 1);
265
+ return result;
266
+ };
267
+
268
+ // reducer/actions/move.ts
269
+ var moveAction = (state, action, appStore) => {
270
+ if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
271
+ return state;
272
+ }
273
+ const item = getItem(
274
+ { zone: action.sourceZone, index: action.sourceIndex },
275
+ state
276
+ );
277
+ if (!item) return state;
278
+ const idsInSourcePath = getIdsForParent(action.sourceZone, state);
279
+ const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
280
+ return walkAppState(
281
+ state,
282
+ appStore.config,
283
+ (content, zoneCompound) => {
284
+ if (zoneCompound === action.sourceZone && zoneCompound === action.destinationZone) {
285
+ return insert(
286
+ remove(content, action.sourceIndex),
287
+ action.destinationIndex,
288
+ item
289
+ );
290
+ } else if (zoneCompound === action.sourceZone) {
291
+ return remove(content, action.sourceIndex);
292
+ } else if (zoneCompound === action.destinationZone) {
293
+ return insert(content, action.destinationIndex, item);
294
+ }
295
+ return content;
296
+ },
297
+ (childItem, path) => {
298
+ const [sourceZoneParent] = action.sourceZone.split(":");
299
+ const [destinationZoneParent] = action.destinationZone.split(":");
300
+ const childId = childItem.props.id;
301
+ if (sourceZoneParent === childId || destinationZoneParent === childId || item.props.id === childId || idsInSourcePath.indexOf(childId) > -1 || idsInDestinationPath.indexOf(childId) > -1 || path.includes(action.destinationZone)) {
302
+ return childItem;
303
+ }
304
+ return null;
305
+ }
306
+ );
307
+ };
308
+
309
+ // reducer/actions/reorder.ts
310
+ var reorderAction = (state, action, appStore) => {
311
+ return moveAction(
312
+ state,
313
+ {
314
+ type: "move",
315
+ sourceIndex: action.sourceIndex,
316
+ sourceZone: action.destinationZone,
317
+ destinationIndex: action.destinationIndex,
318
+ destinationZone: action.destinationZone
319
+ },
320
+ appStore
321
+ );
322
+ };
323
+
324
+ // reducer/actions/remove.ts
325
+ init_react_import();
326
+ var removeAction = (state, action, appStore) => {
327
+ const item = getItem({ index: action.index, zone: action.zone }, state);
328
+ const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
329
+ (acc, [nodeId, nodeData]) => {
330
+ const pathIds = nodeData.path.map((p) => p.split(":")[0]);
331
+ if (pathIds.includes(item.props.id)) {
332
+ return [...acc, nodeId];
333
+ }
334
+ return acc;
335
+ },
336
+ [item.props.id]
337
+ );
338
+ const newState = walkAppState(
339
+ state,
340
+ appStore.config,
341
+ (content, zoneCompound) => {
342
+ if (zoneCompound === action.zone) {
343
+ return remove(content, action.index);
344
+ }
345
+ return content;
346
+ }
347
+ );
348
+ Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
349
+ const parentId = zoneCompound.split(":")[0];
350
+ if (nodesToDelete.includes(parentId) && newState.data.zones) {
351
+ delete newState.data.zones[zoneCompound];
352
+ }
353
+ });
354
+ Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
355
+ const parentId = zoneCompound.split(":")[0];
356
+ if (nodesToDelete.includes(parentId)) {
357
+ delete newState.indexes.zones[zoneCompound];
358
+ }
359
+ });
360
+ nodesToDelete.forEach((id) => {
361
+ delete newState.indexes.nodes[id];
362
+ });
363
+ return newState;
364
+ };
365
+
366
+ // reducer/actions/register-zone.ts
367
+ init_react_import();
368
+ var zoneCache = {};
369
+ function registerZoneAction(state, action) {
370
+ if (zoneCache[action.zone]) {
371
+ return __spreadProps(__spreadValues({}, state), {
372
+ data: __spreadProps(__spreadValues({}, state.data), {
373
+ zones: __spreadProps(__spreadValues({}, state.data.zones), {
374
+ [action.zone]: zoneCache[action.zone]
375
+ })
376
+ }),
377
+ indexes: __spreadProps(__spreadValues({}, state.indexes), {
378
+ zones: __spreadProps(__spreadValues({}, state.indexes.zones), {
379
+ [action.zone]: __spreadProps(__spreadValues({}, state.indexes.zones[action.zone]), {
380
+ contentIds: zoneCache[action.zone].map((item) => item.props.id),
381
+ type: "dropzone"
382
+ })
383
+ })
384
+ })
385
+ });
386
+ }
387
+ return __spreadProps(__spreadValues({}, state), { data: setupZone(state.data, action.zone) });
388
+ }
389
+ function unregisterZoneAction(state, action) {
390
+ const _zones = __spreadValues({}, state.data.zones || {});
391
+ const zoneIndex = __spreadValues({}, state.indexes.zones || {});
392
+ if (_zones[action.zone]) {
393
+ zoneCache[action.zone] = _zones[action.zone];
394
+ delete _zones[action.zone];
395
+ }
396
+ delete zoneIndex[action.zone];
397
+ return __spreadProps(__spreadValues({}, state), {
398
+ data: __spreadProps(__spreadValues({}, state.data), {
399
+ zones: _zones
400
+ }),
401
+ indexes: __spreadProps(__spreadValues({}, state.indexes), {
402
+ zones: zoneIndex
403
+ })
404
+ });
405
+ }
406
+
407
+ // reducer/actions/set-data.ts
408
+ init_react_import();
409
+ var setDataAction = (state, action, appStore) => {
410
+ if (typeof action.data === "object") {
411
+ console.warn(
412
+ "`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
413
+ );
414
+ return walkAppState(
415
+ __spreadProps(__spreadValues({}, state), {
416
+ data: __spreadValues(__spreadValues({}, state.data), action.data)
417
+ }),
418
+ appStore.config
419
+ );
420
+ }
421
+ return walkAppState(
422
+ __spreadProps(__spreadValues({}, state), {
423
+ data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
424
+ }),
425
+ appStore.config
426
+ );
427
+ };
428
+
429
+ // reducer/actions/set-ui.ts
430
+ init_react_import();
431
+ var setUiAction = (state, action) => {
432
+ if (typeof action.ui === "object") {
433
+ return __spreadProps(__spreadValues({}, state), {
434
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
435
+ });
436
+ }
437
+ return __spreadProps(__spreadValues({}, state), {
438
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui(state.ui))
439
+ });
440
+ };
441
+
442
+ // lib/data/make-state-public.ts
443
+ init_react_import();
444
+ var makeStatePublic = (state) => {
445
+ const { data, ui } = state;
446
+ return { data, ui };
447
+ };
448
+
449
+ // reducer/actions.tsx
450
+ init_react_import();
451
+
452
+ // reducer/index.ts
453
+ function storeInterceptor(reducer, record, onAction) {
454
+ return (state, action) => {
455
+ const newAppState = reducer(state, action);
456
+ const isValidType = ![
457
+ "registerZone",
458
+ "unregisterZone",
459
+ "setData",
460
+ "setUi",
461
+ "set"
462
+ ].includes(action.type);
463
+ if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
464
+ if (record) record(newAppState);
465
+ }
466
+ onAction == null ? void 0 : onAction(action, makeStatePublic(newAppState), makeStatePublic(state));
467
+ return newAppState;
468
+ };
469
+ }
470
+ function createReducer({
471
+ record,
472
+ onAction,
473
+ appStore
474
+ }) {
475
+ return storeInterceptor(
476
+ (state, action) => {
477
+ if (action.type === "set") {
478
+ return setAction(state, action, appStore);
479
+ }
480
+ if (action.type === "insert") {
481
+ return insertAction(state, action, appStore);
482
+ }
483
+ if (action.type === "replace") {
484
+ return replaceAction(state, action, appStore);
485
+ }
486
+ if (action.type === "replaceRoot") {
487
+ return replaceRootAction(state, action, appStore);
488
+ }
489
+ if (action.type === "duplicate") {
490
+ return duplicateAction(state, action, appStore);
491
+ }
492
+ if (action.type === "reorder") {
493
+ return reorderAction(state, action, appStore);
494
+ }
495
+ if (action.type === "move") {
496
+ return moveAction(state, action, appStore);
497
+ }
498
+ if (action.type === "remove") {
499
+ return removeAction(state, action, appStore);
500
+ }
501
+ if (action.type === "registerZone") {
502
+ return registerZoneAction(state, action);
503
+ }
504
+ if (action.type === "unregisterZone") {
505
+ return unregisterZoneAction(state, action);
506
+ }
507
+ if (action.type === "setData") {
508
+ return setDataAction(state, action, appStore);
509
+ }
510
+ if (action.type === "setUi") {
511
+ return setUiAction(state, action);
512
+ }
513
+ return state;
514
+ },
515
+ record,
516
+ onAction
517
+ );
518
+ }
519
+
520
+ export {
521
+ insert,
522
+ generateId,
523
+ populateIds,
524
+ insertAction,
525
+ getItem,
526
+ makeStatePublic,
527
+ createReducer
528
+ };
@@ -1,21 +1,25 @@
1
1
  import {
2
2
  styles_module_default
3
- } from "./chunk-WUWXFMEM.mjs";
3
+ } from "./chunk-AOEDIUVK.mjs";
4
4
  import {
5
5
  defaultAppState,
6
+ resolveComponentData
7
+ } from "./chunk-45I5SDOI.mjs";
8
+ import {
9
+ get_class_name_factory_default
10
+ } from "./chunk-Y2EFNT5P.mjs";
11
+ import {
6
12
  mapFields,
7
- resolveComponentData,
8
13
  walkAppState,
9
14
  walkTree
10
- } from "./chunk-DJSH5REF.mjs";
15
+ } from "./chunk-B7REOAA7.mjs";
11
16
  import {
12
17
  __async,
13
18
  __objRest,
14
19
  __spreadProps,
15
20
  __spreadValues,
16
- get_class_name_factory_default,
17
21
  init_react_import
18
- } from "./chunk-DCSQEDMK.mjs";
22
+ } from "./chunk-M6W7YEVX.mjs";
19
23
 
20
24
  // lib/migrate.ts
21
25
  init_react_import();
@@ -241,42 +245,6 @@ function resolveAllData(_0, _1) {
241
245
  });
242
246
  }
243
247
 
244
- // lib/field-transforms/use-field-transforms.tsx
245
- init_react_import();
246
- import { useMemo } from "react";
247
- function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
248
- const mappers = useMemo(() => {
249
- return Object.keys(transforms).reduce((acc, _fieldType) => {
250
- const fieldType = _fieldType;
251
- return __spreadProps(__spreadValues({}, acc), {
252
- [fieldType]: (_a) => {
253
- var _b = _a, {
254
- parentId
255
- } = _b, params = __objRest(_b, [
256
- "parentId"
257
- ]);
258
- const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
259
- const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
260
- const fn = transforms[fieldType];
261
- return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
262
- isReadOnly,
263
- componentId: parentId
264
- }));
265
- }
266
- });
267
- }, {});
268
- }, [transforms, readOnly, forceReadOnly]);
269
- const transformedProps = useMemo(() => {
270
- const mapped = mapFields(item, mappers, config).props;
271
- return mapped;
272
- }, [config, item, mappers]);
273
- const mergedProps = useMemo(
274
- () => __spreadValues(__spreadValues({}, item.props), transformedProps),
275
- [item.props, transformedProps]
276
- );
277
- return mergedProps;
278
- }
279
-
280
248
  // lib/field-transforms/default-transforms/slot-transform.tsx
281
249
  init_react_import();
282
250
  var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
@@ -295,6 +263,52 @@ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
295
263
 
296
264
  // lib/use-slots.tsx
297
265
  init_react_import();
266
+
267
+ // lib/field-transforms/use-field-transforms.tsx
268
+ init_react_import();
269
+ import { useMemo } from "react";
270
+
271
+ // lib/field-transforms/build-mappers.ts
272
+ init_react_import();
273
+ function buildMappers(transforms, readOnly, forceReadOnly) {
274
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
275
+ const fieldType = _fieldType;
276
+ return __spreadProps(__spreadValues({}, acc), {
277
+ [fieldType]: (_a) => {
278
+ var _b = _a, {
279
+ parentId
280
+ } = _b, params = __objRest(_b, [
281
+ "parentId"
282
+ ]);
283
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
284
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
285
+ const fn = transforms[fieldType];
286
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
287
+ isReadOnly,
288
+ componentId: parentId
289
+ }));
290
+ }
291
+ });
292
+ }, {});
293
+ }
294
+
295
+ // lib/field-transforms/use-field-transforms.tsx
296
+ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
297
+ const mappers = useMemo(
298
+ () => buildMappers(transforms, readOnly, forceReadOnly),
299
+ [transforms, readOnly, forceReadOnly]
300
+ );
301
+ const transformedProps = useMemo(() => {
302
+ return mapFields(item, mappers, config).props;
303
+ }, [config, item, mappers]);
304
+ const mergedProps = useMemo(
305
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
306
+ [item.props, transformedProps]
307
+ );
308
+ return mergedProps;
309
+ }
310
+
311
+ // lib/use-slots.tsx
298
312
  function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
299
313
  return useFieldTransforms(
300
314
  config,
@@ -340,7 +354,7 @@ function useRichtextProps(fields, props) {
340
354
  const richtextProps = useMemo2(() => {
341
355
  if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
342
356
  const RichTextRender = lazy(
343
- () => import("./Render-Y567PGZ7.mjs").then((m) => ({
357
+ () => import("./Render-FXZX6NFH.mjs").then((m) => ({
344
358
  default: m.RichTextRender
345
359
  }))
346
360
  );
@@ -401,7 +415,7 @@ var SlotRender = forwardRef(
401
415
  );
402
416
 
403
417
  export {
404
- useFieldTransforms,
418
+ buildMappers,
405
419
  getSlotTransform,
406
420
  useSlots,
407
421
  RichTextRenderFallback,