@measured/puck 0.21.0-canary.b818cb1f → 0.21.0-canary.c0db75c1
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/{walk-tree-DkTSFbz_.d.mts → actions-CaYAKtsG.d.mts} +79 -81
- package/dist/{walk-tree-DkTSFbz_.d.ts → actions-CaYAKtsG.d.ts} +79 -81
- package/dist/{chunk-CBXRJMRZ.mjs → chunk-E4BOPJJV.mjs} +2771 -2922
- package/dist/chunk-J32NOAUF.mjs +524 -0
- package/dist/chunk-PJYARUPI.mjs +477 -0
- package/dist/chunk-S3RM5GHZ.mjs +503 -0
- package/dist/index-C6QwyW4B.d.ts +109 -0
- package/dist/index-IMRjDHZk.d.mts +109 -0
- package/dist/index.css +649 -270
- package/dist/index.d.mts +19 -109
- package/dist/index.d.ts +19 -109
- package/dist/index.js +2284 -1944
- package/dist/index.mjs +13 -4
- package/dist/internal.d.mts +12 -0
- package/dist/internal.d.ts +12 -0
- package/dist/internal.js +906 -0
- package/dist/internal.mjs +12 -0
- package/dist/no-external.css +649 -270
- package/dist/no-external.d.mts +4 -2
- package/dist/no-external.d.ts +4 -2
- package/dist/no-external.js +2281 -1941
- package/dist/no-external.mjs +13 -4
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +15 -12
- package/dist/rsc.mjs +7 -5
- package/dist/walk-tree-B-Q2gpMX.d.mts +29 -0
- package/dist/walk-tree-ksvZ7C4q.d.ts +29 -0
- package/package.json +7 -2
- package/dist/chunk-VBJEDLUM.mjs +0 -965
|
@@ -0,0 +1,503 @@
|
|
|
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
|
+
// lib/data/walk-tree.ts
|
|
88
|
+
init_react_import();
|
|
89
|
+
|
|
90
|
+
// lib/data/map-fields.ts
|
|
91
|
+
init_react_import();
|
|
92
|
+
|
|
93
|
+
// lib/data/default-slots.ts
|
|
94
|
+
init_react_import();
|
|
95
|
+
var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
96
|
+
(acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
|
|
97
|
+
value
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// lib/data/map-fields.ts
|
|
101
|
+
var isPromise = (v) => !!v && typeof v.then === "function";
|
|
102
|
+
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
|
103
|
+
var containsPromise = (arr) => arr.some(isPromise);
|
|
104
|
+
var walkField = ({
|
|
105
|
+
value,
|
|
106
|
+
fields,
|
|
107
|
+
mappers,
|
|
108
|
+
propKey = "",
|
|
109
|
+
propPath = "",
|
|
110
|
+
id = "",
|
|
111
|
+
config,
|
|
112
|
+
recurseSlots = false
|
|
113
|
+
}) => {
|
|
114
|
+
var _a, _b, _c;
|
|
115
|
+
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
|
116
|
+
const map = mappers[fieldType];
|
|
117
|
+
if (map && fieldType === "slot") {
|
|
118
|
+
const content = value || [];
|
|
119
|
+
const mappedContent = recurseSlots ? content.map((el) => {
|
|
120
|
+
var _a2;
|
|
121
|
+
const componentConfig = config.components[el.type];
|
|
122
|
+
if (!componentConfig) {
|
|
123
|
+
throw new Error(`Could not find component config for ${el.type}`);
|
|
124
|
+
}
|
|
125
|
+
const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
|
|
126
|
+
return walkField({
|
|
127
|
+
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
|
128
|
+
fields: fields2,
|
|
129
|
+
mappers,
|
|
130
|
+
id: el.props.id,
|
|
131
|
+
config,
|
|
132
|
+
recurseSlots
|
|
133
|
+
});
|
|
134
|
+
}) : content;
|
|
135
|
+
if (containsPromise(mappedContent)) {
|
|
136
|
+
return Promise.all(mappedContent);
|
|
137
|
+
}
|
|
138
|
+
return map({
|
|
139
|
+
value: mappedContent,
|
|
140
|
+
parentId: id,
|
|
141
|
+
propName: propPath,
|
|
142
|
+
field: fields[propKey],
|
|
143
|
+
propPath
|
|
144
|
+
});
|
|
145
|
+
} else if (map && fields[propKey]) {
|
|
146
|
+
return map({
|
|
147
|
+
value,
|
|
148
|
+
parentId: id,
|
|
149
|
+
propName: propKey,
|
|
150
|
+
field: fields[propKey],
|
|
151
|
+
propPath
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (value && typeof value === "object") {
|
|
155
|
+
if (Array.isArray(value)) {
|
|
156
|
+
const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
|
|
157
|
+
if (!arrayFields) return value;
|
|
158
|
+
const newValue = value.map(
|
|
159
|
+
(el, idx) => walkField({
|
|
160
|
+
value: el,
|
|
161
|
+
fields: arrayFields,
|
|
162
|
+
mappers,
|
|
163
|
+
propKey,
|
|
164
|
+
propPath: `${propPath}[${idx}]`,
|
|
165
|
+
id,
|
|
166
|
+
config,
|
|
167
|
+
recurseSlots
|
|
168
|
+
})
|
|
169
|
+
);
|
|
170
|
+
if (containsPromise(newValue)) {
|
|
171
|
+
return Promise.all(newValue);
|
|
172
|
+
}
|
|
173
|
+
return newValue;
|
|
174
|
+
} else if ("$$typeof" in value) {
|
|
175
|
+
return value;
|
|
176
|
+
} else {
|
|
177
|
+
const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
|
|
178
|
+
return walkObject({
|
|
179
|
+
value,
|
|
180
|
+
fields: objectFields,
|
|
181
|
+
mappers,
|
|
182
|
+
id,
|
|
183
|
+
getPropPath: (k) => `${propPath}.${k}`,
|
|
184
|
+
config,
|
|
185
|
+
recurseSlots
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return value;
|
|
190
|
+
};
|
|
191
|
+
var walkObject = ({
|
|
192
|
+
value,
|
|
193
|
+
fields,
|
|
194
|
+
mappers,
|
|
195
|
+
id,
|
|
196
|
+
getPropPath,
|
|
197
|
+
config,
|
|
198
|
+
recurseSlots
|
|
199
|
+
}) => {
|
|
200
|
+
const newProps = Object.entries(value).map(([k, v]) => {
|
|
201
|
+
const opts = {
|
|
202
|
+
value: v,
|
|
203
|
+
fields,
|
|
204
|
+
mappers,
|
|
205
|
+
propKey: k,
|
|
206
|
+
propPath: getPropPath(k),
|
|
207
|
+
id,
|
|
208
|
+
config,
|
|
209
|
+
recurseSlots
|
|
210
|
+
};
|
|
211
|
+
const newValue = walkField(opts);
|
|
212
|
+
if (isPromise(newValue)) {
|
|
213
|
+
return newValue.then((resolvedValue) => ({
|
|
214
|
+
[k]: resolvedValue
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
[k]: newValue
|
|
219
|
+
};
|
|
220
|
+
}, {});
|
|
221
|
+
if (containsPromise(newProps)) {
|
|
222
|
+
return Promise.all(newProps).then(flatten);
|
|
223
|
+
}
|
|
224
|
+
return flatten(newProps);
|
|
225
|
+
};
|
|
226
|
+
function mapFields(item, mappers, config, recurseSlots = false) {
|
|
227
|
+
var _a, _b, _c, _d, _e;
|
|
228
|
+
const itemType = "type" in item ? item.type : "root";
|
|
229
|
+
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
|
230
|
+
const newProps = walkObject({
|
|
231
|
+
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
|
232
|
+
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
|
233
|
+
mappers,
|
|
234
|
+
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
|
235
|
+
getPropPath: (k) => k,
|
|
236
|
+
config,
|
|
237
|
+
recurseSlots
|
|
238
|
+
});
|
|
239
|
+
if (isPromise(newProps)) {
|
|
240
|
+
return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
|
|
241
|
+
props: resolvedProps
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
245
|
+
props: newProps
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// lib/data/walk-tree.ts
|
|
250
|
+
function walkTree(data, config, callbackFn) {
|
|
251
|
+
var _a, _b;
|
|
252
|
+
const walkItem = (item) => {
|
|
253
|
+
return mapFields(
|
|
254
|
+
item,
|
|
255
|
+
{
|
|
256
|
+
slot: ({ value, parentId, propName }) => {
|
|
257
|
+
var _a2;
|
|
258
|
+
const content = value;
|
|
259
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
config,
|
|
263
|
+
true
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
if ("props" in data) {
|
|
267
|
+
return walkItem(data);
|
|
268
|
+
}
|
|
269
|
+
const _data = data;
|
|
270
|
+
const zones = (_a = _data.zones) != null ? _a : {};
|
|
271
|
+
const mappedContent = _data.content.map(walkItem);
|
|
272
|
+
return {
|
|
273
|
+
root: walkItem(_data.root),
|
|
274
|
+
content: (_b = callbackFn(mappedContent, {
|
|
275
|
+
parentId: "root",
|
|
276
|
+
propName: "default-zone"
|
|
277
|
+
})) != null ? _b : mappedContent,
|
|
278
|
+
zones: Object.keys(zones).reduce(
|
|
279
|
+
(acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
|
|
280
|
+
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
|
281
|
+
}),
|
|
282
|
+
{}
|
|
283
|
+
)
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// lib/root-droppable-id.ts
|
|
288
|
+
init_react_import();
|
|
289
|
+
var rootAreaId = "root";
|
|
290
|
+
var rootZone = "default-zone";
|
|
291
|
+
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
|
292
|
+
|
|
293
|
+
// lib/data/flatten-node.ts
|
|
294
|
+
init_react_import();
|
|
295
|
+
import flat from "flat";
|
|
296
|
+
|
|
297
|
+
// lib/data/strip-slots.ts
|
|
298
|
+
init_react_import();
|
|
299
|
+
var stripSlots = (data, config) => {
|
|
300
|
+
return mapFields(data, { slot: () => null }, config);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// lib/data/flatten-node.ts
|
|
304
|
+
var { flatten: flatten2, unflatten } = flat;
|
|
305
|
+
var flattenNode = (node, config) => {
|
|
306
|
+
return __spreadProps(__spreadValues({}, node), {
|
|
307
|
+
props: flatten2(stripSlots(node, config).props)
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
var expandNode = (node) => {
|
|
311
|
+
const props = unflatten(node.props);
|
|
312
|
+
return __spreadProps(__spreadValues({}, node), {
|
|
313
|
+
props
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// lib/data/walk-app-state.ts
|
|
318
|
+
init_react_import();
|
|
319
|
+
|
|
320
|
+
// lib/data/for-related-zones.ts
|
|
321
|
+
init_react_import();
|
|
322
|
+
|
|
323
|
+
// lib/get-zone-id.ts
|
|
324
|
+
init_react_import();
|
|
325
|
+
var getZoneId = (zoneCompound) => {
|
|
326
|
+
if (!zoneCompound) {
|
|
327
|
+
return [];
|
|
328
|
+
}
|
|
329
|
+
if (zoneCompound && zoneCompound.indexOf(":") > -1) {
|
|
330
|
+
return zoneCompound.split(":");
|
|
331
|
+
}
|
|
332
|
+
return [rootDroppableId, zoneCompound];
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// lib/data/for-related-zones.ts
|
|
336
|
+
function forRelatedZones(item, data, cb, path = []) {
|
|
337
|
+
Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
|
|
338
|
+
const [parentId] = getZoneId(zoneCompound);
|
|
339
|
+
if (parentId === item.props.id) {
|
|
340
|
+
cb(path, zoneCompound, content);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// lib/data/walk-app-state.ts
|
|
346
|
+
function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
|
347
|
+
var _a;
|
|
348
|
+
let newZones = {};
|
|
349
|
+
const newZoneIndex = {};
|
|
350
|
+
const newNodeIndex = {};
|
|
351
|
+
const processContent = (path, zoneCompound, content, zoneType, newId) => {
|
|
352
|
+
var _a2;
|
|
353
|
+
const [parentId] = zoneCompound.split(":");
|
|
354
|
+
const mappedContent = ((_a2 = mapContent(content, zoneCompound, zoneType)) != null ? _a2 : content) || [];
|
|
355
|
+
const [_2, zone] = zoneCompound.split(":");
|
|
356
|
+
const newZoneCompound = `${newId || parentId}:${zone}`;
|
|
357
|
+
const newContent2 = mappedContent.map(
|
|
358
|
+
(zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
|
|
359
|
+
);
|
|
360
|
+
newZoneIndex[newZoneCompound] = {
|
|
361
|
+
contentIds: newContent2.map((item) => item.props.id),
|
|
362
|
+
type: zoneType
|
|
363
|
+
};
|
|
364
|
+
return [newZoneCompound, newContent2];
|
|
365
|
+
};
|
|
366
|
+
const processRelatedZones = (item, newId, initialPath) => {
|
|
367
|
+
forRelatedZones(
|
|
368
|
+
item,
|
|
369
|
+
state.data,
|
|
370
|
+
(relatedPath, relatedZoneCompound, relatedContent) => {
|
|
371
|
+
const [zoneCompound, newContent2] = processContent(
|
|
372
|
+
relatedPath,
|
|
373
|
+
relatedZoneCompound,
|
|
374
|
+
relatedContent,
|
|
375
|
+
"dropzone",
|
|
376
|
+
newId
|
|
377
|
+
);
|
|
378
|
+
newZones[zoneCompound] = newContent2;
|
|
379
|
+
},
|
|
380
|
+
initialPath
|
|
381
|
+
);
|
|
382
|
+
};
|
|
383
|
+
const processItem = (item, path, index) => {
|
|
384
|
+
const mappedItem = mapNodeOrSkip(item, path, index);
|
|
385
|
+
if (!mappedItem) return item;
|
|
386
|
+
const id = mappedItem.props.id;
|
|
387
|
+
const newProps = __spreadProps(__spreadValues({}, mapFields(
|
|
388
|
+
mappedItem,
|
|
389
|
+
{
|
|
390
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
|
391
|
+
const content = value;
|
|
392
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
|
393
|
+
const [_2, newContent2] = processContent(
|
|
394
|
+
path,
|
|
395
|
+
zoneCompound,
|
|
396
|
+
content,
|
|
397
|
+
"slot",
|
|
398
|
+
parentId2
|
|
399
|
+
);
|
|
400
|
+
return newContent2;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
config
|
|
404
|
+
).props), {
|
|
405
|
+
id
|
|
406
|
+
});
|
|
407
|
+
processRelatedZones(item, id, path);
|
|
408
|
+
const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
|
|
409
|
+
const thisZoneCompound = path[path.length - 1];
|
|
410
|
+
const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
|
|
411
|
+
newNodeIndex[id] = {
|
|
412
|
+
data: newItem,
|
|
413
|
+
flatData: flattenNode(newItem, config),
|
|
414
|
+
path,
|
|
415
|
+
parentId,
|
|
416
|
+
zone
|
|
417
|
+
};
|
|
418
|
+
const finalData = __spreadProps(__spreadValues({}, newItem), { props: __spreadValues({}, newItem.props) });
|
|
419
|
+
if (newProps.id === "root") {
|
|
420
|
+
delete finalData["type"];
|
|
421
|
+
delete finalData.props["id"];
|
|
422
|
+
}
|
|
423
|
+
return finalData;
|
|
424
|
+
};
|
|
425
|
+
const zones = state.data.zones || {};
|
|
426
|
+
const [_, newContent] = processContent(
|
|
427
|
+
[],
|
|
428
|
+
rootDroppableId,
|
|
429
|
+
state.data.content,
|
|
430
|
+
"root"
|
|
431
|
+
);
|
|
432
|
+
const processedContent = newContent;
|
|
433
|
+
const zonesAlreadyProcessed = Object.keys(newZones);
|
|
434
|
+
Object.keys(zones || {}).forEach((zoneCompound) => {
|
|
435
|
+
const [parentId] = zoneCompound.split(":");
|
|
436
|
+
if (zonesAlreadyProcessed.includes(zoneCompound)) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const [_2, newContent2] = processContent(
|
|
440
|
+
[rootDroppableId],
|
|
441
|
+
zoneCompound,
|
|
442
|
+
zones[zoneCompound],
|
|
443
|
+
"dropzone",
|
|
444
|
+
parentId
|
|
445
|
+
);
|
|
446
|
+
newZones[zoneCompound] = newContent2;
|
|
447
|
+
}, newZones);
|
|
448
|
+
const processedRoot = processItem(
|
|
449
|
+
{
|
|
450
|
+
type: "root",
|
|
451
|
+
props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
|
|
452
|
+
},
|
|
453
|
+
[],
|
|
454
|
+
-1
|
|
455
|
+
);
|
|
456
|
+
const root = __spreadProps(__spreadValues({}, state.data.root), {
|
|
457
|
+
props: processedRoot.props
|
|
458
|
+
});
|
|
459
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
460
|
+
data: {
|
|
461
|
+
root,
|
|
462
|
+
content: processedContent,
|
|
463
|
+
zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
|
|
464
|
+
},
|
|
465
|
+
indexes: {
|
|
466
|
+
nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
|
|
467
|
+
zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// lib/data/setup-zone.ts
|
|
473
|
+
init_react_import();
|
|
474
|
+
var setupZone = (data, zoneKey) => {
|
|
475
|
+
if (zoneKey === rootDroppableId) {
|
|
476
|
+
return data;
|
|
477
|
+
}
|
|
478
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
|
479
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
|
480
|
+
});
|
|
481
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
|
482
|
+
return newData;
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
export {
|
|
486
|
+
__spreadValues,
|
|
487
|
+
__spreadProps,
|
|
488
|
+
__objRest,
|
|
489
|
+
__commonJS,
|
|
490
|
+
__toESM,
|
|
491
|
+
__async,
|
|
492
|
+
init_react_import,
|
|
493
|
+
rootAreaId,
|
|
494
|
+
rootZone,
|
|
495
|
+
rootDroppableId,
|
|
496
|
+
defaultSlots,
|
|
497
|
+
walkField,
|
|
498
|
+
mapFields,
|
|
499
|
+
expandNode,
|
|
500
|
+
walkAppState,
|
|
501
|
+
walkTree,
|
|
502
|
+
setupZone
|
|
503
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { H as History, g as Permissions, c as ComponentData, C as Config, U as UserGenerics, F as Fields, a as PuckAction, h as RootDataWithProps, i as ResolveDataTrigger, j as Plugin, k as Overrides, V as Viewports, I as IframeConfig, l as UiState, m as ComponentConfig, A as AppState, M as Metadata, n as FieldTransforms } from './actions-CaYAKtsG.js';
|
|
2
|
+
|
|
3
|
+
type HistorySlice<D = any> = {
|
|
4
|
+
index: number;
|
|
5
|
+
hasPast: () => boolean;
|
|
6
|
+
hasFuture: () => boolean;
|
|
7
|
+
histories: History<D>[];
|
|
8
|
+
record: (data: D) => void;
|
|
9
|
+
back: VoidFunction;
|
|
10
|
+
forward: VoidFunction;
|
|
11
|
+
currentHistory: () => History;
|
|
12
|
+
nextHistory: () => History<D> | null;
|
|
13
|
+
prevHistory: () => History<D> | null;
|
|
14
|
+
setHistories: (histories: History[]) => void;
|
|
15
|
+
setHistoryIndex: (index: number) => void;
|
|
16
|
+
initialAppState: D;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type NodeMethods = {
|
|
20
|
+
sync: () => void;
|
|
21
|
+
hideOverlay: () => void;
|
|
22
|
+
showOverlay: () => void;
|
|
23
|
+
};
|
|
24
|
+
type PuckNodeInstance = {
|
|
25
|
+
id: string;
|
|
26
|
+
methods: NodeMethods;
|
|
27
|
+
element: HTMLElement | null;
|
|
28
|
+
};
|
|
29
|
+
type NodesSlice = {
|
|
30
|
+
nodes: Record<string, PuckNodeInstance | undefined>;
|
|
31
|
+
registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
|
|
32
|
+
unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
36
|
+
item?: G["UserComponentData"] | null;
|
|
37
|
+
type?: keyof G["UserProps"];
|
|
38
|
+
root?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
|
41
|
+
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
42
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
|
43
|
+
type Cache = Record<string, {
|
|
44
|
+
lastPermissions: Partial<Permissions>;
|
|
45
|
+
lastData: ComponentData | null;
|
|
46
|
+
lastParentId: string | null;
|
|
47
|
+
}>;
|
|
48
|
+
type PermissionsSlice = {
|
|
49
|
+
cache: Cache;
|
|
50
|
+
globalPermissions: Permissions;
|
|
51
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
52
|
+
getPermissions: GetPermissions<Config>;
|
|
53
|
+
resolvePermissions: ResolvePermissions<Config>;
|
|
54
|
+
refreshPermissions: RefreshPermissions<Config>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
58
|
+
type FieldsSlice = {
|
|
59
|
+
fields: Fields | Partial<Fields>;
|
|
60
|
+
loading: boolean;
|
|
61
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
|
62
|
+
id: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
66
|
+
type ZoomConfig = {
|
|
67
|
+
autoZoom: number;
|
|
68
|
+
rootHeight: number;
|
|
69
|
+
zoom: number;
|
|
70
|
+
};
|
|
71
|
+
type ComponentState = Record<string, {
|
|
72
|
+
loadingCount: number;
|
|
73
|
+
}>;
|
|
74
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
75
|
+
instanceId: string;
|
|
76
|
+
state: G["UserAppState"];
|
|
77
|
+
dispatch: (action: PuckAction) => void;
|
|
78
|
+
config: UserConfig;
|
|
79
|
+
componentState: ComponentState;
|
|
80
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
81
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
82
|
+
unsetComponentLoading: (id: string) => void;
|
|
83
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
84
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
85
|
+
node: T;
|
|
86
|
+
didChange: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
resolveAndCommitData: () => void;
|
|
89
|
+
plugins: Plugin[];
|
|
90
|
+
overrides: Partial<Overrides>;
|
|
91
|
+
viewports: Viewports;
|
|
92
|
+
zoomConfig: ZoomConfig;
|
|
93
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
94
|
+
status: Status;
|
|
95
|
+
setStatus: (status: Status) => void;
|
|
96
|
+
iframe: IframeConfig;
|
|
97
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
98
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
99
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
100
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
101
|
+
metadata: Metadata;
|
|
102
|
+
fields: FieldsSlice;
|
|
103
|
+
history: HistorySlice;
|
|
104
|
+
nodes: NodesSlice;
|
|
105
|
+
permissions: PermissionsSlice;
|
|
106
|
+
fieldTransforms: FieldTransforms;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|