@measured/puck 0.21.0-canary.f5820ce9 → 0.21.0-canary.fee2ba98

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-EHVB6NFF.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-Ctf3FZQI.d.mts → actions-DwdqNb63.d.mts} +265 -75
  6. package/dist/{walk-tree-Ctf3FZQI.d.ts → actions-DwdqNb63.d.ts} +265 -75
  7. package/dist/chunk-2334PLLL.mjs +111 -0
  8. package/dist/chunk-4N3WJM5Y.mjs +33 -0
  9. package/dist/{chunk-AO6Y47WD.mjs → chunk-6AGLD64M.mjs} +4819 -6477
  10. package/dist/chunk-CSSRLPHM.mjs +11 -0
  11. package/dist/chunk-D6RJOV2Z.mjs +1727 -0
  12. package/dist/chunk-M6W7YEVX.mjs +95 -0
  13. package/dist/chunk-NLUHDYVR.mjs +416 -0
  14. package/dist/chunk-NQEE2254.mjs +706 -0
  15. package/dist/chunk-PXYVL42X.mjs +53 -0
  16. package/dist/chunk-QBGM4ELA.mjs +528 -0
  17. package/dist/chunk-QLQZDFXM.mjs +63 -0
  18. package/dist/chunk-T3WX7XJ6.mjs +132 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  21. package/dist/chunk-Y656T6AQ.mjs +419 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-TVZATY2K.mjs +93 -0
  24. package/dist/index-AfAtzigt.d.ts +117 -0
  25. package/dist/index-jxA1wrW4.d.mts +117 -0
  26. package/dist/index.css +278 -22
  27. package/dist/index.d.mts +99 -113
  28. package/dist/index.d.ts +99 -113
  29. package/dist/index.js +6647 -3315
  30. package/dist/index.mjs +26 -12
  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-ICVILKS6.mjs +60 -0
  36. package/dist/loaded-IHAGHNLA.mjs +57 -0
  37. package/dist/loaded-ONU7LATV.mjs +57 -0
  38. package/dist/loaded-RVWBFK7L.css +87 -0
  39. package/dist/no-external.css +425 -165
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +6646 -3311
  43. package/dist/no-external.mjs +28 -9
  44. package/dist/rsc.css +101 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +417 -30
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-DRy9ca1P.d.ts +29 -0
  50. package/dist/walk-tree-Dppc3XGY.d.mts +29 -0
  51. package/package.json +31 -4
  52. package/dist/chunk-VBJEDLUM.mjs +0 -965
@@ -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,416 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues,
4
+ init_react_import
5
+ } from "./chunk-M6W7YEVX.mjs";
6
+
7
+ // lib/data/walk-tree.ts
8
+ init_react_import();
9
+
10
+ // lib/data/map-fields.ts
11
+ init_react_import();
12
+
13
+ // lib/data/default-slots.ts
14
+ init_react_import();
15
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
16
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
17
+ value
18
+ );
19
+
20
+ // lib/data/map-fields.ts
21
+ var isPromise = (v) => !!v && typeof v.then === "function";
22
+ var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
23
+ var containsPromise = (arr) => arr.some(isPromise);
24
+ var walkField = ({
25
+ value,
26
+ fields,
27
+ mappers,
28
+ propKey = "",
29
+ propPath = "",
30
+ id = "",
31
+ config,
32
+ recurseSlots = false
33
+ }) => {
34
+ var _a, _b, _c;
35
+ const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
36
+ const map = mappers[fieldType];
37
+ if (map && fieldType === "slot") {
38
+ const content = value || [];
39
+ const mappedContent = recurseSlots ? content.map((el) => {
40
+ var _a2;
41
+ const componentConfig = config.components[el.type];
42
+ if (!componentConfig) {
43
+ throw new Error(`Could not find component config for ${el.type}`);
44
+ }
45
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
46
+ return walkField({
47
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
48
+ fields: fields2,
49
+ mappers,
50
+ id: el.props.id,
51
+ config,
52
+ recurseSlots
53
+ });
54
+ }) : content;
55
+ if (containsPromise(mappedContent)) {
56
+ return Promise.all(mappedContent);
57
+ }
58
+ return map({
59
+ value: mappedContent,
60
+ parentId: id,
61
+ propName: propPath,
62
+ field: fields[propKey],
63
+ propPath
64
+ });
65
+ } else if (map && fields[propKey]) {
66
+ return map({
67
+ value,
68
+ parentId: id,
69
+ propName: propKey,
70
+ field: fields[propKey],
71
+ propPath
72
+ });
73
+ }
74
+ if (value && typeof value === "object") {
75
+ if (Array.isArray(value)) {
76
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
77
+ if (!arrayFields) return value;
78
+ const newValue = value.map(
79
+ (el, idx) => walkField({
80
+ value: el,
81
+ fields: arrayFields,
82
+ mappers,
83
+ propKey,
84
+ propPath: `${propPath}[${idx}]`,
85
+ id,
86
+ config,
87
+ recurseSlots
88
+ })
89
+ );
90
+ if (containsPromise(newValue)) {
91
+ return Promise.all(newValue);
92
+ }
93
+ return newValue;
94
+ } else if ("$$typeof" in value) {
95
+ return value;
96
+ } else {
97
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
98
+ return walkObject({
99
+ value,
100
+ fields: objectFields,
101
+ mappers,
102
+ id,
103
+ getPropPath: (k) => `${propPath}.${k}`,
104
+ config,
105
+ recurseSlots
106
+ });
107
+ }
108
+ }
109
+ return value;
110
+ };
111
+ var walkObject = ({
112
+ value,
113
+ fields,
114
+ mappers,
115
+ id,
116
+ getPropPath,
117
+ config,
118
+ recurseSlots
119
+ }) => {
120
+ const newProps = Object.entries(value).map(([k, v]) => {
121
+ const opts = {
122
+ value: v,
123
+ fields,
124
+ mappers,
125
+ propKey: k,
126
+ propPath: getPropPath(k),
127
+ id,
128
+ config,
129
+ recurseSlots
130
+ };
131
+ const newValue = walkField(opts);
132
+ if (isPromise(newValue)) {
133
+ return newValue.then((resolvedValue) => ({
134
+ [k]: resolvedValue
135
+ }));
136
+ }
137
+ return {
138
+ [k]: newValue
139
+ };
140
+ }, {});
141
+ if (containsPromise(newProps)) {
142
+ return Promise.all(newProps).then(flatten);
143
+ }
144
+ return flatten(newProps);
145
+ };
146
+ function mapFields(item, mappers, config, recurseSlots = false) {
147
+ var _a, _b, _c, _d, _e;
148
+ const itemType = "type" in item ? item.type : "root";
149
+ const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
150
+ const newProps = walkObject({
151
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
152
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
153
+ mappers,
154
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
155
+ getPropPath: (k) => k,
156
+ config,
157
+ recurseSlots
158
+ });
159
+ if (isPromise(newProps)) {
160
+ return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
161
+ props: resolvedProps
162
+ }));
163
+ }
164
+ return __spreadProps(__spreadValues({}, item), {
165
+ props: newProps
166
+ });
167
+ }
168
+
169
+ // lib/data/walk-tree.ts
170
+ function walkTree(data, config, callbackFn) {
171
+ var _a, _b;
172
+ const walkItem = (item) => {
173
+ return mapFields(
174
+ item,
175
+ {
176
+ slot: ({ value, parentId, propName }) => {
177
+ var _a2;
178
+ const content = value;
179
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
180
+ }
181
+ },
182
+ config,
183
+ true
184
+ );
185
+ };
186
+ if ("props" in data) {
187
+ return walkItem(data);
188
+ }
189
+ const _data = data;
190
+ const zones = (_a = _data.zones) != null ? _a : {};
191
+ const mappedContent = _data.content.map(walkItem);
192
+ return {
193
+ root: walkItem(_data.root),
194
+ content: (_b = callbackFn(mappedContent, {
195
+ parentId: "root",
196
+ propName: "default-zone"
197
+ })) != null ? _b : mappedContent,
198
+ zones: Object.keys(zones).reduce(
199
+ (acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
200
+ [zoneCompound]: zones[zoneCompound].map(walkItem)
201
+ }),
202
+ {}
203
+ )
204
+ };
205
+ }
206
+
207
+ // lib/root-droppable-id.ts
208
+ init_react_import();
209
+ var rootAreaId = "root";
210
+ var rootZone = "default-zone";
211
+ var rootDroppableId = `${rootAreaId}:${rootZone}`;
212
+
213
+ // lib/data/flatten-node.ts
214
+ init_react_import();
215
+ import flat from "flat";
216
+
217
+ // lib/data/strip-slots.ts
218
+ init_react_import();
219
+ var stripSlots = (data, config) => {
220
+ return mapFields(data, { slot: () => null }, config);
221
+ };
222
+
223
+ // lib/data/flatten-node.ts
224
+ var { flatten: flatten2, unflatten } = flat;
225
+ var flattenNode = (node, config) => {
226
+ return __spreadProps(__spreadValues({}, node), {
227
+ props: flatten2(stripSlots(node, config).props)
228
+ });
229
+ };
230
+ var expandNode = (node) => {
231
+ const props = unflatten(node.props);
232
+ return __spreadProps(__spreadValues({}, node), {
233
+ props
234
+ });
235
+ };
236
+
237
+ // lib/data/walk-app-state.ts
238
+ init_react_import();
239
+
240
+ // lib/data/for-related-zones.ts
241
+ init_react_import();
242
+
243
+ // lib/get-zone-id.ts
244
+ init_react_import();
245
+ var getZoneId = (zoneCompound) => {
246
+ if (!zoneCompound) {
247
+ return [];
248
+ }
249
+ if (zoneCompound && zoneCompound.indexOf(":") > -1) {
250
+ return zoneCompound.split(":");
251
+ }
252
+ return [rootDroppableId, zoneCompound];
253
+ };
254
+
255
+ // lib/data/for-related-zones.ts
256
+ function forRelatedZones(item, data, cb, path = []) {
257
+ Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
258
+ const [parentId] = getZoneId(zoneCompound);
259
+ if (parentId === item.props.id) {
260
+ cb(path, zoneCompound, content);
261
+ }
262
+ });
263
+ }
264
+
265
+ // lib/data/walk-app-state.ts
266
+ function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
267
+ var _a;
268
+ let newZones = {};
269
+ const newZoneIndex = {};
270
+ const newNodeIndex = {};
271
+ const processContent = (path, zoneCompound, content, zoneType, newId) => {
272
+ var _a2;
273
+ const [parentId] = zoneCompound.split(":");
274
+ const mappedContent = ((_a2 = mapContent(content, zoneCompound, zoneType)) != null ? _a2 : content) || [];
275
+ const [_2, zone] = zoneCompound.split(":");
276
+ const newZoneCompound = `${newId || parentId}:${zone}`;
277
+ const newContent2 = mappedContent.map(
278
+ (zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
279
+ );
280
+ newZoneIndex[newZoneCompound] = {
281
+ contentIds: newContent2.map((item) => item.props.id),
282
+ type: zoneType
283
+ };
284
+ return [newZoneCompound, newContent2];
285
+ };
286
+ const processRelatedZones = (item, newId, initialPath) => {
287
+ forRelatedZones(
288
+ item,
289
+ state.data,
290
+ (relatedPath, relatedZoneCompound, relatedContent) => {
291
+ const [zoneCompound, newContent2] = processContent(
292
+ relatedPath,
293
+ relatedZoneCompound,
294
+ relatedContent,
295
+ "dropzone",
296
+ newId
297
+ );
298
+ newZones[zoneCompound] = newContent2;
299
+ },
300
+ initialPath
301
+ );
302
+ };
303
+ const processItem = (item, path, index) => {
304
+ const mappedItem = mapNodeOrSkip(item, path, index);
305
+ if (!mappedItem) return item;
306
+ const id = mappedItem.props.id;
307
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
308
+ mappedItem,
309
+ {
310
+ slot: ({ value, parentId: parentId2, propPath }) => {
311
+ const content = value;
312
+ const zoneCompound = `${parentId2}:${propPath}`;
313
+ const [_2, newContent2] = processContent(
314
+ path,
315
+ zoneCompound,
316
+ content,
317
+ "slot",
318
+ parentId2
319
+ );
320
+ return newContent2;
321
+ }
322
+ },
323
+ config
324
+ ).props), {
325
+ id
326
+ });
327
+ processRelatedZones(item, id, path);
328
+ const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
329
+ const thisZoneCompound = path[path.length - 1];
330
+ const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
331
+ newNodeIndex[id] = {
332
+ data: newItem,
333
+ flatData: flattenNode(newItem, config),
334
+ path,
335
+ parentId,
336
+ zone
337
+ };
338
+ const finalData = __spreadProps(__spreadValues({}, newItem), { props: __spreadValues({}, newItem.props) });
339
+ if (newProps.id === "root") {
340
+ delete finalData["type"];
341
+ delete finalData.props["id"];
342
+ }
343
+ return finalData;
344
+ };
345
+ const zones = state.data.zones || {};
346
+ const [_, newContent] = processContent(
347
+ [],
348
+ rootDroppableId,
349
+ state.data.content,
350
+ "root"
351
+ );
352
+ const processedContent = newContent;
353
+ const zonesAlreadyProcessed = Object.keys(newZones);
354
+ Object.keys(zones || {}).forEach((zoneCompound) => {
355
+ const [parentId] = zoneCompound.split(":");
356
+ if (zonesAlreadyProcessed.includes(zoneCompound)) {
357
+ return;
358
+ }
359
+ const [_2, newContent2] = processContent(
360
+ [rootDroppableId],
361
+ zoneCompound,
362
+ zones[zoneCompound],
363
+ "dropzone",
364
+ parentId
365
+ );
366
+ newZones[zoneCompound] = newContent2;
367
+ }, newZones);
368
+ const processedRoot = processItem(
369
+ {
370
+ type: "root",
371
+ props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
372
+ },
373
+ [],
374
+ -1
375
+ );
376
+ const root = __spreadProps(__spreadValues({}, state.data.root), {
377
+ props: processedRoot.props
378
+ });
379
+ return __spreadProps(__spreadValues({}, state), {
380
+ data: {
381
+ root,
382
+ content: processedContent,
383
+ zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
384
+ },
385
+ indexes: {
386
+ nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
387
+ zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
388
+ }
389
+ });
390
+ }
391
+
392
+ // lib/data/setup-zone.ts
393
+ init_react_import();
394
+ var setupZone = (data, zoneKey) => {
395
+ if (zoneKey === rootDroppableId) {
396
+ return data;
397
+ }
398
+ const newData = __spreadProps(__spreadValues({}, data), {
399
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
400
+ });
401
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
402
+ return newData;
403
+ };
404
+
405
+ export {
406
+ rootAreaId,
407
+ rootZone,
408
+ rootDroppableId,
409
+ defaultSlots,
410
+ walkField,
411
+ mapFields,
412
+ expandNode,
413
+ walkAppState,
414
+ walkTree,
415
+ setupZone
416
+ };