@measured/puck 0.19.0-canary.b918900 → 0.19.0-canary.bc5bfff1
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/README.md +2 -4
- package/dist/chunk-DCJTUSJF.mjs +925 -0
- package/dist/index.css +201 -184
- package/dist/index.d.mts +122 -123
- package/dist/index.d.ts +122 -123
- package/dist/index.js +3257 -2692
- package/dist/index.mjs +2401 -2443
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +663 -134
- package/dist/rsc.mjs +9 -104
- package/dist/{resolve-all-data-wwgDuTnC.d.mts → walk-tree-lpK_Xw1z.d.mts} +117 -28
- package/dist/{resolve-all-data-wwgDuTnC.d.ts → walk-tree-lpK_Xw1z.d.ts} +117 -28
- package/package.json +8 -6
- package/dist/chunk-T6VJEBJD.mjs +0 -272
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CSSProperties, ReactElement,
|
1
|
+
import { CSSProperties, ReactElement, ReactNode, JSX } from 'react';
|
2
2
|
|
3
3
|
type ItemSelector = {
|
4
4
|
index: number;
|
@@ -22,6 +22,8 @@ type FieldOption = {
|
|
22
22
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
23
23
|
type BaseField = {
|
24
24
|
label?: string;
|
25
|
+
labelIcon?: ReactElement;
|
26
|
+
metadata?: Metadata;
|
25
27
|
};
|
26
28
|
type TextField = BaseField & {
|
27
29
|
type: "text";
|
@@ -108,16 +110,22 @@ type ExternalField<Props extends {
|
|
108
110
|
filterFields?: Record<string, Field>;
|
109
111
|
initialFilters?: Record<string, any>;
|
110
112
|
};
|
111
|
-
type
|
113
|
+
type CustomFieldRender<Value extends any> = (props: {
|
114
|
+
field: CustomField<Value>;
|
115
|
+
name: string;
|
116
|
+
id: string;
|
117
|
+
value: Value;
|
118
|
+
onChange: (value: Value) => void;
|
119
|
+
readOnly?: boolean;
|
120
|
+
}) => ReactElement;
|
121
|
+
type CustomField<Value extends any> = BaseField & {
|
112
122
|
type: "custom";
|
113
|
-
render:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
readOnly?: boolean;
|
120
|
-
}) => ReactElement;
|
123
|
+
render: CustomFieldRender<Value>;
|
124
|
+
};
|
125
|
+
type SlotField = BaseField & {
|
126
|
+
type: "slot";
|
127
|
+
allow?: string[];
|
128
|
+
disallow?: string[];
|
121
129
|
};
|
122
130
|
type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
|
123
131
|
[key: string]: any;
|
@@ -127,7 +135,7 @@ type Field<Props extends any = any> = TextField | NumberField | TextareaField |
|
|
127
135
|
[key: string]: any;
|
128
136
|
} ? Props : any> | ExternalFieldWithAdaptor<Props extends {
|
129
137
|
[key: string]: any;
|
130
|
-
} ? Props : any> | CustomField<Props
|
138
|
+
} ? Props : any> | CustomField<Props> | SlotField;
|
131
139
|
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
|
132
140
|
[PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
|
133
141
|
};
|
@@ -139,7 +147,17 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
139
147
|
readOnly?: boolean;
|
140
148
|
};
|
141
149
|
|
142
|
-
type
|
150
|
+
type SlotComponent = (props?: Omit<DropZoneProps, "zone">) => ReactNode;
|
151
|
+
/**
|
152
|
+
* Recursively walk T and replace Slots with SlotComponents
|
153
|
+
*/
|
154
|
+
type WithDeepSlots<T> = T extends Slot ? SlotComponent : T extends readonly (infer U)[] ? ReadonlyArray<WithDeepSlots<U>> : T extends (infer U)[] ? WithDeepSlots<U>[] : T extends object ? {
|
155
|
+
[K in keyof T]: WithDeepSlots<T[K]>;
|
156
|
+
} : T;
|
157
|
+
type PuckComponent<Props> = (props: WithId<WithPuckProps<{
|
158
|
+
[K in keyof Props]: WithDeepSlots<Props[K]>;
|
159
|
+
}>>) => JSX.Element;
|
160
|
+
type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
143
161
|
type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
|
144
162
|
render: PuckComponent<RenderProps>;
|
145
163
|
label?: string;
|
@@ -148,7 +166,9 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
148
166
|
permissions?: Partial<Permissions>;
|
149
167
|
inline?: boolean;
|
150
168
|
resolveFields?: (data: DataShape, params: {
|
151
|
-
changed: Partial<Record<keyof FieldProps, boolean
|
169
|
+
changed: Partial<Record<keyof FieldProps, boolean> & {
|
170
|
+
id: string;
|
171
|
+
}>;
|
152
172
|
fields: Fields<FieldProps>;
|
153
173
|
lastFields: Fields<FieldProps>;
|
154
174
|
lastData: DataShape | null;
|
@@ -156,24 +176,31 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
|
|
156
176
|
parent: ComponentData | null;
|
157
177
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
158
178
|
resolveData?: (data: DataShape, params: {
|
159
|
-
changed: Partial<Record<keyof FieldProps, boolean
|
179
|
+
changed: Partial<Record<keyof FieldProps, boolean> & {
|
180
|
+
id: string;
|
181
|
+
}>;
|
160
182
|
lastData: DataShape | null;
|
161
183
|
metadata: Metadata;
|
184
|
+
trigger: ResolveDataTrigger;
|
162
185
|
}) => Promise<{
|
163
186
|
props?: Partial<FieldProps>;
|
164
|
-
readOnly?: Partial<Record<keyof FieldProps, boolean
|
187
|
+
readOnly?: Partial<Record<keyof FieldProps, boolean>> & Record<string, boolean>;
|
165
188
|
}> | {
|
166
189
|
props?: Partial<FieldProps>;
|
167
|
-
readOnly?: Partial<Record<keyof FieldProps, boolean
|
190
|
+
readOnly?: Partial<Record<keyof FieldProps, boolean>> & Record<string, boolean>;
|
168
191
|
};
|
169
192
|
resolvePermissions?: (data: DataShape, params: {
|
170
|
-
changed: Partial<Record<keyof FieldProps, boolean
|
193
|
+
changed: Partial<Record<keyof FieldProps, boolean> & {
|
194
|
+
id: string;
|
195
|
+
}>;
|
171
196
|
lastPermissions: Partial<Permissions>;
|
172
197
|
permissions: Partial<Permissions>;
|
173
198
|
appState: AppState;
|
174
199
|
lastData: DataShape | null;
|
175
200
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
201
|
+
metadata?: Metadata;
|
176
202
|
};
|
203
|
+
type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
|
177
204
|
type Category<ComponentName> = {
|
178
205
|
components?: ComponentName[];
|
179
206
|
title?: string;
|
@@ -187,7 +214,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
|
|
187
214
|
components: {
|
188
215
|
[ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
|
189
216
|
};
|
190
|
-
root?:
|
217
|
+
root?: RootConfig<RootProps>;
|
191
218
|
};
|
192
219
|
|
193
220
|
type WithId<Props> = Props & {
|
@@ -203,7 +230,7 @@ type WithChildren<Props> = Props & {
|
|
203
230
|
};
|
204
231
|
type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
|
205
232
|
type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
|
206
|
-
type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends
|
233
|
+
type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
|
207
234
|
UserConfig: UserConfig;
|
208
235
|
UserProps: UserProps;
|
209
236
|
UserRootProps: UserRootProps;
|
@@ -235,22 +262,28 @@ type BaseData<Props extends {
|
|
235
262
|
readOnly?: Partial<Record<keyof Props, boolean>>;
|
236
263
|
};
|
237
264
|
type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
|
238
|
-
props: Props
|
265
|
+
props: WithSlotProps<Props>;
|
239
266
|
};
|
240
267
|
type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
|
241
268
|
type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
|
242
269
|
type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps, Name = string> = {
|
243
270
|
type: Name;
|
244
|
-
props: WithId<Props
|
271
|
+
props: WithId<WithSlotProps<Props>>;
|
272
|
+
} & BaseData<Props>;
|
273
|
+
type ComponentDataOptionalId<Props extends DefaultComponentProps = DefaultComponentProps, Name = string> = {
|
274
|
+
type: Name;
|
275
|
+
props: Props & {
|
276
|
+
id?: string;
|
277
|
+
};
|
245
278
|
} & BaseData<Props>;
|
246
279
|
type MappedItem = ComponentData;
|
247
280
|
type ComponentDataMap<Props extends Record<string, DefaultComponentProps> = DefaultComponentProps> = {
|
248
281
|
[K in keyof Props]: ComponentData<Props[K], K extends string ? K : never>;
|
249
282
|
}[keyof Props];
|
250
283
|
type Content<PropsMap extends {
|
251
|
-
[key: string]:
|
284
|
+
[key: string]: DefaultComponentProps;
|
252
285
|
} = {
|
253
|
-
[key: string]:
|
286
|
+
[key: string]: DefaultComponentProps;
|
254
287
|
}> = ComponentDataMap<PropsMap>[];
|
255
288
|
type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = {
|
256
289
|
root: RootData<RootProps>;
|
@@ -299,6 +332,27 @@ type AppState<UserData extends Data = Data> = {
|
|
299
332
|
ui: UiState;
|
300
333
|
};
|
301
334
|
|
335
|
+
type ZoneType = "root" | "dropzone" | "slot";
|
336
|
+
type PuckNodeData = {
|
337
|
+
data: ComponentData;
|
338
|
+
flatData: ComponentData;
|
339
|
+
parentId: string | null;
|
340
|
+
zone: string;
|
341
|
+
path: string[];
|
342
|
+
};
|
343
|
+
type PuckZoneData = {
|
344
|
+
contentIds: string[];
|
345
|
+
type: ZoneType;
|
346
|
+
};
|
347
|
+
type NodeIndex = Record<string, PuckNodeData>;
|
348
|
+
type ZoneIndex = Record<string, PuckZoneData>;
|
349
|
+
type PrivateAppState<UserData extends Data = Data> = AppState<UserData> & {
|
350
|
+
indexes: {
|
351
|
+
nodes: NodeIndex;
|
352
|
+
zones: ZoneIndex;
|
353
|
+
};
|
354
|
+
};
|
355
|
+
|
302
356
|
type RenderFunc<Props extends {
|
303
357
|
[key: string]: any;
|
304
358
|
} = {
|
@@ -405,6 +459,16 @@ type InitialHistoryNoAppend<AS = Partial<AppState>> = {
|
|
405
459
|
appendData?: false;
|
406
460
|
};
|
407
461
|
type InitialHistory<AS = Partial<AppState>> = InitialHistoryAppend<AS> | InitialHistoryNoAppend<AS>;
|
462
|
+
type Slot<Props extends {
|
463
|
+
[key: string]: DefaultComponentProps;
|
464
|
+
} = {
|
465
|
+
[key: string]: DefaultComponentProps;
|
466
|
+
}> = {
|
467
|
+
[K in keyof Props]: ComponentDataOptionalId<Props[K], K extends string ? K : never>;
|
468
|
+
}[keyof Props][];
|
469
|
+
type WithSlotProps<Props extends DefaultComponentProps = DefaultComponentProps, SlotProps extends DefaultComponentProps = Props> = Props extends any ? any : {
|
470
|
+
[PropName in keyof Props]: Props[PropName] extends Slot<SlotProps> ? Content<SlotProps> : Props[PropName];
|
471
|
+
};
|
408
472
|
|
409
473
|
type InsertAction = {
|
410
474
|
type: "insert";
|
@@ -418,11 +482,17 @@ type DuplicateAction = {
|
|
418
482
|
sourceIndex: number;
|
419
483
|
sourceZone: string;
|
420
484
|
};
|
421
|
-
type ReplaceAction = {
|
485
|
+
type ReplaceAction<UserData extends Data = Data> = {
|
422
486
|
type: "replace";
|
423
487
|
destinationIndex: number;
|
424
488
|
destinationZone: string;
|
425
|
-
data:
|
489
|
+
data: ComponentData;
|
490
|
+
ui?: Partial<AppState<UserData>["ui"]>;
|
491
|
+
};
|
492
|
+
type ReplaceRootAction<UserData extends Data = Data> = {
|
493
|
+
type: "replaceRoot";
|
494
|
+
root: RootData;
|
495
|
+
ui?: Partial<AppState<UserData>["ui"]>;
|
426
496
|
};
|
427
497
|
type ReorderAction = {
|
428
498
|
type: "reorder";
|
@@ -452,7 +522,7 @@ type SetDataAction = {
|
|
452
522
|
};
|
453
523
|
type SetAction<UserData extends Data = Data> = {
|
454
524
|
type: "set";
|
455
|
-
state: Partial<
|
525
|
+
state: Partial<PrivateAppState<UserData>> | ((previous: PrivateAppState<UserData>) => Partial<PrivateAppState<UserData>>);
|
456
526
|
};
|
457
527
|
type RegisterZoneAction = {
|
458
528
|
type: "registerZone";
|
@@ -464,8 +534,27 @@ type UnregisterZoneAction = {
|
|
464
534
|
};
|
465
535
|
type PuckAction = {
|
466
536
|
recordHistory?: boolean;
|
467
|
-
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
537
|
+
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
538
|
+
|
539
|
+
declare function migrate(data: Data, config?: Config): Data;
|
540
|
+
|
541
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
542
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
543
|
+
[key: string]: any;
|
544
|
+
}) => Props[ComponentName];
|
545
|
+
} & {
|
546
|
+
root: (props: RootProps & {
|
547
|
+
[key: string]: any;
|
548
|
+
}) => RootProps;
|
549
|
+
}>;
|
550
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>, config?: Config): Data;
|
468
551
|
|
469
552
|
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
470
553
|
|
471
|
-
|
554
|
+
type WalkTreeOptions = {
|
555
|
+
parentId: string;
|
556
|
+
propName: string;
|
557
|
+
};
|
558
|
+
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
559
|
+
|
560
|
+
export { type ExternalFieldWithAdaptor as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type MappedItem as E, type Fields as F, type ComponentDataMap as G, type History as H, type IframeConfig as I, type Content as J, type BaseField as K, type TextareaField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type SelectField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type RadioField as X, type ArrayField as Y, type ObjectField as Z, type Adaptor as _, type Config as a, type ExternalField as a0, type CustomFieldRender as a1, type CustomField as a2, type SlotField as a3, type PuckContext as a4, type DefaultRootFieldProps as a5, type DefaultRootRenderProps as a6, type DefaultRootProps as a7, type DefaultComponentProps as a8, type WithId as a9, type WithPuckProps as aa, type AsFieldProps as ab, type WithChildren as ac, type ExtractPropsFromConfig as ad, type ExtractRootPropsFromConfig as ae, migrate as af, transformProps as ag, resolveAllData as ah, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type ItemSelector as l, type Direction as m, type DragAxis as n, type Viewport as o, overrideKeys as p, type OverrideKey as q, type FieldRenderFunctions as r, type ItemWithId as s, type ArrayState as t, type PuckComponent as u, type RootConfig as v, walkTree as w, type RootDataWithoutProps as x, type RootData as y, type ComponentDataOptionalId as z };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck",
|
3
|
-
"version": "0.19.0-canary.
|
4
|
-
"author": "
|
3
|
+
"version": "0.19.0-canary.bc5bfff1",
|
4
|
+
"author": "Chris Villa <chris@puckeditor.com>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
7
7
|
"homepage": "https://puckeditor.com",
|
@@ -51,6 +51,7 @@
|
|
51
51
|
"devDependencies": {
|
52
52
|
"@testing-library/react": "^16.1.0",
|
53
53
|
"@types/deep-diff": "^1.0.3",
|
54
|
+
"@types/flat": "^5.0.5",
|
54
55
|
"@types/jest": "^29.5.4",
|
55
56
|
"@types/object-hash": "^3.0.6",
|
56
57
|
"@types/react": "^19.0.1",
|
@@ -69,17 +70,18 @@
|
|
69
70
|
"typescript": "^5.5.4"
|
70
71
|
},
|
71
72
|
"dependencies": {
|
72
|
-
"@dnd-kit/helpers": "0.
|
73
|
-
"@dnd-kit/react": "0.
|
73
|
+
"@dnd-kit/helpers": "0.1.18-beta-20250525014052",
|
74
|
+
"@dnd-kit/react": "0.1.18-beta-20250525014052",
|
74
75
|
"deep-diff": "^1.0.2",
|
75
76
|
"fast-deep-equal": "^3.1.3",
|
77
|
+
"flat": "^5.0.2",
|
76
78
|
"object-hash": "^3.0.0",
|
77
79
|
"react-hotkeys-hook": "^4.6.1",
|
78
80
|
"use-debounce": "^9.0.4",
|
79
81
|
"uuid": "^9.0.1",
|
80
|
-
"zustand": "^5.0.
|
82
|
+
"zustand": "^5.0.3"
|
81
83
|
},
|
82
84
|
"peerDependencies": {
|
83
|
-
"react": "^
|
85
|
+
"react": "^18.0.0 || ^19.0.0"
|
84
86
|
}
|
85
87
|
}
|
package/dist/chunk-T6VJEBJD.mjs
DELETED
@@ -1,272 +0,0 @@
|
|
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 __typeError = (msg) => {
|
12
|
-
throw TypeError(msg);
|
13
|
-
};
|
14
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
15
|
-
var __spreadValues = (a, b) => {
|
16
|
-
for (var prop in b || (b = {}))
|
17
|
-
if (__hasOwnProp.call(b, prop))
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
19
|
-
if (__getOwnPropSymbols)
|
20
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
21
|
-
if (__propIsEnum.call(b, prop))
|
22
|
-
__defNormalProp(a, prop, b[prop]);
|
23
|
-
}
|
24
|
-
return a;
|
25
|
-
};
|
26
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
27
|
-
var __objRest = (source, exclude) => {
|
28
|
-
var target = {};
|
29
|
-
for (var prop in source)
|
30
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
31
|
-
target[prop] = source[prop];
|
32
|
-
if (source != null && __getOwnPropSymbols)
|
33
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
34
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
35
|
-
target[prop] = source[prop];
|
36
|
-
}
|
37
|
-
return target;
|
38
|
-
};
|
39
|
-
var __esm = (fn, res) => function __init() {
|
40
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
41
|
-
};
|
42
|
-
var __commonJS = (cb, mod) => function __require() {
|
43
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
44
|
-
};
|
45
|
-
var __copyProps = (to, from, except, desc) => {
|
46
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
47
|
-
for (let key of __getOwnPropNames(from))
|
48
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
49
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
50
|
-
}
|
51
|
-
return to;
|
52
|
-
};
|
53
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
54
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
55
|
-
// file that has been converted to a CommonJS file using a Babel-
|
56
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
57
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
58
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
59
|
-
mod
|
60
|
-
));
|
61
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
62
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
63
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
64
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
65
|
-
var __async = (__this, __arguments, generator) => {
|
66
|
-
return new Promise((resolve, reject) => {
|
67
|
-
var fulfilled = (value) => {
|
68
|
-
try {
|
69
|
-
step(generator.next(value));
|
70
|
-
} catch (e) {
|
71
|
-
reject(e);
|
72
|
-
}
|
73
|
-
};
|
74
|
-
var rejected = (value) => {
|
75
|
-
try {
|
76
|
-
step(generator.throw(value));
|
77
|
-
} catch (e) {
|
78
|
-
reject(e);
|
79
|
-
}
|
80
|
-
};
|
81
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
82
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
83
|
-
});
|
84
|
-
};
|
85
|
-
|
86
|
-
// ../tsup-config/react-import.js
|
87
|
-
import React from "react";
|
88
|
-
var init_react_import = __esm({
|
89
|
-
"../tsup-config/react-import.js"() {
|
90
|
-
"use strict";
|
91
|
-
}
|
92
|
-
});
|
93
|
-
|
94
|
-
// lib/resolve-all-data.ts
|
95
|
-
init_react_import();
|
96
|
-
|
97
|
-
// lib/resolve-component-data.ts
|
98
|
-
init_react_import();
|
99
|
-
|
100
|
-
// lib/get-changed.ts
|
101
|
-
init_react_import();
|
102
|
-
var getChanged = (newItem, oldItem) => {
|
103
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
104
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
105
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
106
|
-
return __spreadProps(__spreadValues({}, acc), {
|
107
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
108
|
-
});
|
109
|
-
}, {}) : {};
|
110
|
-
};
|
111
|
-
|
112
|
-
// lib/resolve-component-data.ts
|
113
|
-
var cache = { lastChange: {} };
|
114
|
-
var resolveAllComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (content, config, metadata = {}, onResolveStart, onResolveEnd) {
|
115
|
-
return yield Promise.all(
|
116
|
-
content.map((item) => __async(void 0, null, function* () {
|
117
|
-
return yield resolveComponentData(
|
118
|
-
item,
|
119
|
-
config,
|
120
|
-
metadata,
|
121
|
-
onResolveStart,
|
122
|
-
onResolveEnd
|
123
|
-
);
|
124
|
-
}))
|
125
|
-
);
|
126
|
-
});
|
127
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd) {
|
128
|
-
const configForItem = config.components[item.type];
|
129
|
-
if (configForItem.resolveData) {
|
130
|
-
const { item: oldItem = null, resolved = {} } = cache.lastChange[item.props.id] || {};
|
131
|
-
if (item && item === oldItem) {
|
132
|
-
return resolved;
|
133
|
-
}
|
134
|
-
const changed = getChanged(item, oldItem);
|
135
|
-
if (onResolveStart) {
|
136
|
-
onResolveStart(item);
|
137
|
-
}
|
138
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
139
|
-
changed,
|
140
|
-
lastData: oldItem,
|
141
|
-
metadata
|
142
|
-
});
|
143
|
-
const resolvedItem = __spreadProps(__spreadValues({}, item), {
|
144
|
-
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
145
|
-
});
|
146
|
-
if (Object.keys(readOnly).length) {
|
147
|
-
resolvedItem.readOnly = readOnly;
|
148
|
-
}
|
149
|
-
cache.lastChange[item.props.id] = {
|
150
|
-
item,
|
151
|
-
resolved: resolvedItem
|
152
|
-
};
|
153
|
-
if (onResolveEnd) {
|
154
|
-
onResolveEnd(resolvedItem);
|
155
|
-
}
|
156
|
-
return resolvedItem;
|
157
|
-
}
|
158
|
-
return item;
|
159
|
-
});
|
160
|
-
|
161
|
-
// lib/resolve-root-data.ts
|
162
|
-
init_react_import();
|
163
|
-
var cache2 = {};
|
164
|
-
function resolveRootData(data, config, metadata) {
|
165
|
-
return __async(this, null, function* () {
|
166
|
-
var _a, _b, _c, _d, _e;
|
167
|
-
if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
|
168
|
-
if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
|
169
|
-
return cache2.lastChange.resolved;
|
170
|
-
}
|
171
|
-
const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
|
172
|
-
const rootWithProps = data.root;
|
173
|
-
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
174
|
-
changed,
|
175
|
-
lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {},
|
176
|
-
metadata: metadata || {}
|
177
|
-
});
|
178
|
-
cache2.lastChange = {
|
179
|
-
original: data.root,
|
180
|
-
resolved: resolvedRoot
|
181
|
-
};
|
182
|
-
return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
|
183
|
-
props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
|
184
|
-
});
|
185
|
-
}
|
186
|
-
return data.root;
|
187
|
-
});
|
188
|
-
}
|
189
|
-
|
190
|
-
// lib/default-data.ts
|
191
|
-
init_react_import();
|
192
|
-
var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
|
193
|
-
root: data.root || {},
|
194
|
-
content: data.content || []
|
195
|
-
});
|
196
|
-
|
197
|
-
// lib/resolve-all-data.ts
|
198
|
-
function resolveAllData(_0, _1) {
|
199
|
-
return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
|
200
|
-
const defaultedData = defaultData(data);
|
201
|
-
const dynamicRoot = yield resolveRootData(
|
202
|
-
defaultedData,
|
203
|
-
config,
|
204
|
-
metadata
|
205
|
-
);
|
206
|
-
const { zones = {} } = data;
|
207
|
-
const zoneKeys = Object.keys(zones);
|
208
|
-
const resolvedZones = {};
|
209
|
-
for (let i = 0; i < zoneKeys.length; i++) {
|
210
|
-
const zoneKey = zoneKeys[i];
|
211
|
-
resolvedZones[zoneKey] = yield resolveAllComponentData(
|
212
|
-
zones[zoneKey],
|
213
|
-
config,
|
214
|
-
metadata,
|
215
|
-
onResolveStart,
|
216
|
-
onResolveEnd
|
217
|
-
);
|
218
|
-
}
|
219
|
-
return __spreadProps(__spreadValues({}, defaultedData), {
|
220
|
-
root: dynamicRoot,
|
221
|
-
content: yield resolveAllComponentData(
|
222
|
-
defaultedData.content,
|
223
|
-
config,
|
224
|
-
metadata,
|
225
|
-
onResolveStart,
|
226
|
-
onResolveEnd
|
227
|
-
),
|
228
|
-
zones: resolvedZones
|
229
|
-
});
|
230
|
-
});
|
231
|
-
}
|
232
|
-
|
233
|
-
// lib/root-droppable-id.ts
|
234
|
-
init_react_import();
|
235
|
-
var rootAreaId = "root";
|
236
|
-
var rootZone = "default-zone";
|
237
|
-
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
238
|
-
|
239
|
-
// lib/setup-zone.ts
|
240
|
-
init_react_import();
|
241
|
-
var setupZone = (data, zoneKey) => {
|
242
|
-
if (zoneKey === rootDroppableId) {
|
243
|
-
return data;
|
244
|
-
}
|
245
|
-
const newData = __spreadProps(__spreadValues({}, data), {
|
246
|
-
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
247
|
-
});
|
248
|
-
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
249
|
-
return newData;
|
250
|
-
};
|
251
|
-
|
252
|
-
export {
|
253
|
-
__spreadValues,
|
254
|
-
__spreadProps,
|
255
|
-
__objRest,
|
256
|
-
__commonJS,
|
257
|
-
__toESM,
|
258
|
-
__privateGet,
|
259
|
-
__privateAdd,
|
260
|
-
__privateSet,
|
261
|
-
__async,
|
262
|
-
init_react_import,
|
263
|
-
rootAreaId,
|
264
|
-
rootZone,
|
265
|
-
rootDroppableId,
|
266
|
-
setupZone,
|
267
|
-
getChanged,
|
268
|
-
resolveComponentData,
|
269
|
-
resolveRootData,
|
270
|
-
defaultData,
|
271
|
-
resolveAllData
|
272
|
-
};
|