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

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