@measured/puck 0.21.0-canary.eb8ea5ce → 0.21.0-canary.ece26d91
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/{Editor-DR57V55X.mjs → Editor-O447AVCX.mjs} +17 -7
- package/dist/{Render-6Q5WP25Y.mjs → Render-OFE6QLI2.mjs} +8 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-ONhOkrvf.d.mts} +1 -27
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-ONhOkrvf.d.ts} +1 -27
- package/dist/chunk-2Q4PACDA.mjs +111 -0
- package/dist/chunk-62AAYNXG.mjs +63 -0
- package/dist/chunk-BSDEIOEK.mjs +706 -0
- package/dist/chunk-CSSRLPHM.mjs +11 -0
- package/dist/{chunk-OPXWLTPM.mjs → chunk-DAQLMM2T.mjs} +1377 -2795
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/{chunk-YZQENDBP.mjs → chunk-NLUHDYVR.mjs} +2 -123
- package/dist/chunk-PLXSMBAA.mjs +53 -0
- package/dist/chunk-QAWJTCV5.mjs +33 -0
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/{chunk-MSIUWPEI.mjs → chunk-QBJ2LDJB.mjs} +36 -20
- package/dist/chunk-T3WX7XJ6.mjs +132 -0
- package/dist/{chunk-CF5XA6LF.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{chunk-A7EMVTSK.mjs → chunk-Y656T6AQ.mjs} +13 -7
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-BEMDJKDS.mjs +93 -0
- package/dist/index-BEoNHRI1.d.ts +116 -0
- package/dist/index-DfxZ7tZF.d.mts +116 -0
- package/dist/index.d.mts +9 -125
- package/dist/index.d.ts +9 -125
- package/dist/index.js +1002 -775
- package/dist/index.mjs +14 -5
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +908 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-JU3A7Y4L.mjs +57 -0
- package/dist/loaded-N3FYGF2Y.mjs +57 -0
- package/dist/loaded-OBY7OMS6.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.d.mts +3 -1
- package/dist/no-external.d.ts +3 -1
- package/dist/no-external.js +1002 -775
- package/dist/no-external.mjs +14 -5
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +6 -3
- package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
- package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
- package/package.json +7 -2
- package/dist/chunk-GQ457KMA.mjs +0 -199
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rootDroppableId,
|
|
3
|
+
setupZone,
|
|
4
|
+
walkAppState,
|
|
5
|
+
walkTree
|
|
6
|
+
} from "./chunk-NLUHDYVR.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,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EditorInner,
|
|
3
|
+
LoadedRichTextMenu
|
|
4
|
+
} from "./chunk-2Q4PACDA.mjs";
|
|
1
5
|
import {
|
|
2
6
|
RichTextRenderFallback,
|
|
3
7
|
SlotRender,
|
|
@@ -7,27 +11,27 @@ import {
|
|
|
7
11
|
useFieldTransforms,
|
|
8
12
|
useRichtextProps,
|
|
9
13
|
useSlots
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y656T6AQ.mjs";
|
|
11
15
|
import {
|
|
12
16
|
ActionBar,
|
|
17
|
+
IconButton,
|
|
18
|
+
LoadedRichTextMenuInner,
|
|
19
|
+
Loader
|
|
20
|
+
} from "./chunk-BSDEIOEK.mjs";
|
|
21
|
+
import {
|
|
13
22
|
ChevronDown,
|
|
14
23
|
ChevronRight,
|
|
15
24
|
ChevronUp,
|
|
16
25
|
CircleCheckBig,
|
|
17
26
|
Copy,
|
|
18
27
|
CornerLeftUp,
|
|
19
|
-
EditorInner,
|
|
20
28
|
EllipsisVertical,
|
|
21
29
|
Globe,
|
|
22
30
|
Hash,
|
|
23
|
-
IconButton,
|
|
24
31
|
Layers,
|
|
25
32
|
LayoutGrid,
|
|
26
33
|
Link,
|
|
27
34
|
List,
|
|
28
|
-
LoadedRichTextMenu,
|
|
29
|
-
LoadedRichTextMenuInner,
|
|
30
|
-
Loader,
|
|
31
35
|
Lock,
|
|
32
36
|
LockOpen,
|
|
33
37
|
Monitor,
|
|
@@ -46,14 +50,8 @@ import {
|
|
|
46
50
|
ZoomOut,
|
|
47
51
|
appStoreContext,
|
|
48
52
|
createAppStore,
|
|
49
|
-
generateId,
|
|
50
53
|
getBox,
|
|
51
|
-
getItem,
|
|
52
|
-
insert,
|
|
53
|
-
insertAction,
|
|
54
|
-
makeStatePublic,
|
|
55
54
|
monitorHotkeys,
|
|
56
|
-
populateIds,
|
|
57
55
|
reorder,
|
|
58
56
|
replace,
|
|
59
57
|
useAppStore,
|
|
@@ -64,11 +62,24 @@ import {
|
|
|
64
62
|
useRegisterHistorySlice,
|
|
65
63
|
useRegisterPermissionsSlice,
|
|
66
64
|
useResetAutoZoom
|
|
67
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-DAQLMM2T.mjs";
|
|
66
|
+
import {
|
|
67
|
+
generateId,
|
|
68
|
+
getItem,
|
|
69
|
+
insert,
|
|
70
|
+
insertAction,
|
|
71
|
+
makeStatePublic,
|
|
72
|
+
populateIds
|
|
73
|
+
} from "./chunk-QBGM4ELA.mjs";
|
|
68
74
|
import {
|
|
69
75
|
defaultAppState,
|
|
76
|
+
defaultViewports
|
|
77
|
+
} from "./chunk-T3WX7XJ6.mjs";
|
|
78
|
+
import {
|
|
79
|
+
get_class_name_factory_default
|
|
80
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
81
|
+
import {
|
|
70
82
|
defaultSlots,
|
|
71
|
-
defaultViewports,
|
|
72
83
|
expandNode,
|
|
73
84
|
rootAreaId,
|
|
74
85
|
rootDroppableId,
|
|
@@ -76,7 +87,7 @@ import {
|
|
|
76
87
|
setupZone,
|
|
77
88
|
walkAppState,
|
|
78
89
|
walkField
|
|
79
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-NLUHDYVR.mjs";
|
|
80
91
|
import {
|
|
81
92
|
__async,
|
|
82
93
|
__commonJS,
|
|
@@ -84,9 +95,8 @@ import {
|
|
|
84
95
|
__spreadProps,
|
|
85
96
|
__spreadValues,
|
|
86
97
|
__toESM,
|
|
87
|
-
get_class_name_factory_default,
|
|
88
98
|
init_react_import
|
|
89
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
90
100
|
|
|
91
101
|
// ../../node_modules/fast-deep-equal/index.js
|
|
92
102
|
var require_fast_deep_equal = __commonJS({
|
|
@@ -1692,7 +1702,7 @@ EditorFallback.displayName = "EditorFallback";
|
|
|
1692
1702
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
1693
1703
|
import { Fragment as Fragment3, jsx as jsx15 } from "react/jsx-runtime";
|
|
1694
1704
|
var Editor = lazy(
|
|
1695
|
-
() => import("./Editor-
|
|
1705
|
+
() => import("./Editor-O447AVCX.mjs").then((m) => ({
|
|
1696
1706
|
default: m.Editor
|
|
1697
1707
|
}))
|
|
1698
1708
|
);
|
|
@@ -1784,6 +1794,9 @@ var ObjectField = ({
|
|
|
1784
1794
|
}),
|
|
1785
1795
|
value: data[subName],
|
|
1786
1796
|
onChange: (val, ui) => {
|
|
1797
|
+
if (data[subName] === val) {
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1787
1800
|
onChange(
|
|
1788
1801
|
__spreadProps(__spreadValues({}, data), {
|
|
1789
1802
|
[subName]: val
|
|
@@ -4099,12 +4112,12 @@ import {
|
|
|
4099
4112
|
} from "react";
|
|
4100
4113
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4101
4114
|
var Editor2 = lazy2(
|
|
4102
|
-
() => import("./Editor-
|
|
4115
|
+
() => import("./Editor-O447AVCX.mjs").then((m) => ({
|
|
4103
4116
|
default: m.Editor
|
|
4104
4117
|
}))
|
|
4105
4118
|
);
|
|
4106
4119
|
var RichTextRender = lazy2(
|
|
4107
|
-
() => import("./Render-
|
|
4120
|
+
() => import("./Render-OFE6QLI2.mjs").then((m) => ({
|
|
4108
4121
|
default: m.RichTextRender
|
|
4109
4122
|
}))
|
|
4110
4123
|
);
|
|
@@ -4723,6 +4736,9 @@ var generateUsePuck = (store) => {
|
|
|
4723
4736
|
return parentNode.data;
|
|
4724
4737
|
}
|
|
4725
4738
|
};
|
|
4739
|
+
storeData.__private = {
|
|
4740
|
+
appState: store.state
|
|
4741
|
+
};
|
|
4726
4742
|
return storeData;
|
|
4727
4743
|
};
|
|
4728
4744
|
var UsePuckStoreContext = createContext4(
|