@measured/puck 0.16.0-canary.54b5a87 → 0.16.0-canary.555902

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,7 +68,7 @@ type ObjectField<Props extends {
68
68
  [key: string]: any;
69
69
  }> = BaseField & {
70
70
  type: "object";
71
- objectFields: {
71
+ objectFields: Props extends any[] ? never : {
72
72
  [SubPropName in keyof Props]: Field<Props[SubPropName]>;
73
73
  };
74
74
  };
@@ -128,7 +128,7 @@ type Field<Props extends any = any> = TextField | NumberField | TextareaField |
128
128
  [key: string]: any;
129
129
  } ? Props : any> | CustomField<Props>;
130
130
  type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
131
- [PropName in keyof Omit<Required<ComponentProps>, "children" | "editMode">]: Field<ComponentProps[PropName]>;
131
+ [PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
132
132
  };
133
133
  type FieldProps<ValueType = any, F = Field<any>> = {
134
134
  field: F;
@@ -138,51 +138,64 @@ type FieldProps<ValueType = any, F = Field<any>> = {
138
138
  readOnly?: boolean;
139
139
  };
140
140
 
141
- type WithPuckProps<Props> = Props & {
141
+ type WithId<Props> = Props & {
142
142
  id: string;
143
143
  };
144
- type DefaultRootProps = {
144
+ type WithPuckProps<Props> = Props & {
145
+ puck: PuckContext;
146
+ editMode?: boolean;
147
+ };
148
+ type AsFieldProps<Props> = Omit<Props, "children" | "puck" | "editMode">;
149
+ type WithChildren<Props> = Props & {
150
+ children: ReactNode;
151
+ };
152
+ type DefaultRootFieldProps = {
145
153
  title?: string;
146
- [key: string]: any;
147
154
  };
155
+ type DefaultRootRenderProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = WithPuckProps<WithChildren<Props>>;
156
+ type DefaultRootProps = DefaultRootRenderProps;
148
157
  type DefaultComponentProps = {
149
158
  [key: string]: any;
150
- editMode?: boolean;
151
159
  };
152
- type Content<Props extends {
160
+ type Content<PropsMap extends {
153
161
  [key: string]: any;
154
162
  } = {
155
163
  [key: string]: any;
156
- }> = ComponentData<Props>[];
157
- type PuckComponent<Props> = (props: WithPuckProps<Props & {
158
- puck: PuckContext;
159
- }>) => JSX.Element;
164
+ }> = ComponentDataMap<PropsMap>[];
165
+ type PuckComponent<Props> = (props: WithId<WithPuckProps<Props>>) => JSX.Element;
160
166
  type PuckContext = {
161
167
  renderDropZone: React.FC<DropZoneProps>;
162
168
  isEditing: boolean;
163
169
  };
164
- type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps, DataShape = Omit<ComponentData<ComponentProps>, "type">> = {
165
- render: PuckComponent<ComponentProps>;
170
+ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
171
+ render: PuckComponent<RenderProps>;
166
172
  label?: string;
167
- defaultProps?: DefaultProps;
168
- fields?: Fields<ComponentProps>;
173
+ defaultProps?: FieldProps;
174
+ fields?: Fields<FieldProps>;
175
+ permissions?: Partial<Permissions>;
169
176
  resolveFields?: (data: DataShape, params: {
170
- changed: Partial<Record<keyof ComponentProps, boolean>>;
171
- fields: Fields<ComponentProps>;
172
- lastFields: Fields<ComponentProps>;
177
+ changed: Partial<Record<keyof FieldProps, boolean>>;
178
+ fields: Fields<FieldProps>;
179
+ lastFields: Fields<FieldProps>;
173
180
  lastData: DataShape;
174
181
  appState: AppState;
175
- }) => Promise<Fields<ComponentProps>> | Fields<ComponentProps>;
182
+ }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
176
183
  resolveData?: (data: DataShape, params: {
177
- changed: Partial<Record<keyof ComponentProps, boolean>>;
184
+ changed: Partial<Record<keyof FieldProps, boolean>>;
178
185
  lastData: DataShape;
179
186
  }) => Promise<{
180
- props?: Partial<ComponentProps>;
181
- readOnly?: Partial<Record<keyof ComponentProps, boolean>>;
187
+ props?: Partial<FieldProps>;
188
+ readOnly?: Partial<Record<keyof FieldProps, boolean>>;
182
189
  }> | {
183
- props?: Partial<ComponentProps>;
184
- readOnly?: Partial<Record<keyof ComponentProps, boolean>>;
190
+ props?: Partial<FieldProps>;
191
+ readOnly?: Partial<Record<keyof FieldProps, boolean>>;
185
192
  };
193
+ resolvePermissions?: (data: DataShape, params: {
194
+ changed: Partial<Record<keyof FieldProps, boolean>>;
195
+ lastPermissions: Partial<Permissions> | undefined;
196
+ initialPermissions: Partial<Permissions>;
197
+ appState: AppState;
198
+ }) => Partial<Permissions>;
186
199
  };
187
200
  type Category<ComponentName> = {
188
201
  components?: ComponentName[];
@@ -190,19 +203,17 @@ type Category<ComponentName> = {
190
203
  visible?: boolean;
191
204
  defaultExpanded?: boolean;
192
205
  };
193
- type Config<Props extends Record<string, any> = Record<string, any>, RootProps extends DefaultRootProps = DefaultRootProps, CategoryName extends string = string> = {
206
+ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = {
194
207
  categories?: Record<CategoryName, Category<keyof Props>> & {
195
208
  other?: Category<keyof Props>;
196
209
  };
197
210
  components: {
198
211
  [ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
199
212
  };
200
- root?: Partial<ComponentConfig<RootProps & {
201
- children?: ReactNode;
202
- }, Partial<RootProps & {
203
- children?: ReactNode;
204
- }>, RootData>>;
213
+ root?: Partial<ComponentConfig<DefaultRootRenderProps<RootProps>, AsFieldProps<RootProps>, RootData>>;
205
214
  };
215
+ type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
216
+ type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
206
217
  type BaseData<Props extends {
207
218
  [key: string]: any;
208
219
  } = {
@@ -210,20 +221,23 @@ type BaseData<Props extends {
210
221
  }> = {
211
222
  readOnly?: Partial<Record<keyof Props, boolean>>;
212
223
  };
213
- type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps> = {
214
- type: keyof Props;
215
- props: WithPuckProps<Props>;
224
+ type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps, Name = string> = {
225
+ type: Name;
226
+ props: WithId<Props>;
216
227
  } & BaseData<Props>;
217
- type RootDataWithProps<Props extends DefaultRootProps = DefaultRootProps> = BaseData<Props> & {
228
+ type ComponentDataMap<Props extends Record<string, DefaultComponentProps> = DefaultComponentProps> = {
229
+ [K in keyof Props]: ComponentData<Props[K], K extends string ? K : never>;
230
+ }[keyof Props];
231
+ type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
218
232
  props: Props;
219
233
  };
220
- type RootDataWithoutProps<Props extends DefaultRootProps = DefaultRootProps> = Props;
221
- type RootData<Props extends DefaultRootProps = DefaultRootProps> = Partial<RootDataWithProps<Props>> & Partial<RootDataWithoutProps<Props>>;
234
+ type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
235
+ type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
222
236
  type MappedItem = ComponentData;
223
- type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = {
237
+ type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = {
224
238
  root: RootData<RootProps>;
225
- content: Content<WithPuckProps<Props>>;
226
- zones?: Record<string, Content<WithPuckProps<Props>>>;
239
+ content: Content<Props>;
240
+ zones?: Record<string, Content<Props>>;
227
241
  };
228
242
  type ItemWithId = {
229
243
  _arrayId: string;
@@ -254,9 +268,16 @@ type UiState = {
254
268
  options: Viewport[];
255
269
  };
256
270
  };
257
- type AppState = {
258
- data: Data;
271
+ type AppState<UserData extends Data = Data> = {
272
+ data: UserData;
259
273
  ui: UiState;
260
274
  };
275
+ type Permissions = {
276
+ drag: boolean;
277
+ duplicate: boolean;
278
+ delete: boolean;
279
+ edit: boolean;
280
+ insert: boolean;
281
+ } & Record<string, boolean>;
261
282
 
262
- export { AppState as A, BaseData as B, Config as C, Data as D, ExternalFieldWithAdaptor as E, Field as F, ItemSelector as I, MappedItem as M, NumberField as N, ObjectField as O, PuckComponent as P, RootDataWithProps as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DefaultRootProps as b, DropZoneProps as c, DefaultComponentProps as d, RootData as e, ComponentData as f, Content as g, PuckContext as h, ComponentConfig as i, RootDataWithoutProps as j, ItemWithId as k, ArrayState as l, BaseField as m, TextareaField as n, RadioField as o, ArrayField as p, Adaptor as q, ExternalField as r, CustomField as s, Fields as t };
283
+ export type { AppState as A, BaseData as B, Config as C, Data as D, ExtractPropsFromConfig as E, Field as F, ItemSelector as I, MappedItem as M, NumberField as N, ObjectField as O, Permissions as P, RootDataWithProps as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, ExtractRootPropsFromConfig as c, DefaultComponentProps as d, DefaultRootFieldProps as e, ComponentData as f, DefaultRootRenderProps as g, DefaultRootProps as h, Content as i, PuckComponent as j, PuckContext as k, ComponentConfig as l, ComponentDataMap as m, RootDataWithoutProps as n, RootData as o, ItemWithId as p, ArrayState as q, BaseField as r, TextareaField as s, RadioField as t, ArrayField as u, Adaptor as v, ExternalFieldWithAdaptor as w, ExternalField as x, CustomField as y, Fields as z };
@@ -0,0 +1,283 @@
1
+ import { CSSProperties, ReactNode, ReactElement } from 'react';
2
+
3
+ type ItemSelector = {
4
+ index: number;
5
+ zone?: string;
6
+ };
7
+
8
+ type DropZoneProps = {
9
+ zone: string;
10
+ allow?: string[];
11
+ disallow?: string[];
12
+ style?: CSSProperties;
13
+ };
14
+
15
+ type iconTypes = "Smartphone" | "Monitor" | "Tablet";
16
+ type Viewport = {
17
+ width: number;
18
+ height?: number | "auto";
19
+ label?: string;
20
+ icon?: iconTypes | ReactNode;
21
+ };
22
+ type Viewports = Viewport[];
23
+
24
+ type FieldOption = {
25
+ label: string;
26
+ value: string | number | boolean;
27
+ };
28
+ type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
29
+ type BaseField = {
30
+ label?: string;
31
+ };
32
+ type TextField = BaseField & {
33
+ type: "text";
34
+ };
35
+ type NumberField = BaseField & {
36
+ type: "number";
37
+ min?: number;
38
+ max?: number;
39
+ };
40
+ type TextareaField = BaseField & {
41
+ type: "textarea";
42
+ };
43
+ type SelectField = BaseField & {
44
+ type: "select";
45
+ options: FieldOptions;
46
+ };
47
+ type RadioField = BaseField & {
48
+ type: "radio";
49
+ options: FieldOptions;
50
+ };
51
+ type ArrayField<Props extends {
52
+ [key: string]: any;
53
+ } = {
54
+ [key: string]: any;
55
+ }> = BaseField & {
56
+ type: "array";
57
+ arrayFields: {
58
+ [SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
59
+ };
60
+ defaultItemProps?: Props[0];
61
+ getItemSummary?: (item: Props[0], index?: number) => string;
62
+ max?: number;
63
+ min?: number;
64
+ };
65
+ type ObjectField<Props extends {
66
+ [key: string]: any;
67
+ } = {
68
+ [key: string]: any;
69
+ }> = BaseField & {
70
+ type: "object";
71
+ objectFields: Props extends any[] ? never : {
72
+ [SubPropName in keyof Props]: Field<Props[SubPropName]>;
73
+ };
74
+ };
75
+ type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
76
+ name: string;
77
+ fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
78
+ mapProp?: (value: TableShape) => PropShape;
79
+ };
80
+ type ExternalFieldWithAdaptor<Props extends {
81
+ [key: string]: any;
82
+ } = {
83
+ [key: string]: any;
84
+ }> = BaseField & {
85
+ type: "external";
86
+ placeholder?: string;
87
+ adaptor: Adaptor<any, any, Props>;
88
+ adaptorParams?: object;
89
+ getItemSummary: (item: Props, index?: number) => string;
90
+ };
91
+ type ExternalField<Props extends {
92
+ [key: string]: any;
93
+ } = {
94
+ [key: string]: any;
95
+ }> = BaseField & {
96
+ type: "external";
97
+ placeholder?: string;
98
+ fetchList: (params: {
99
+ query: string;
100
+ filters: Record<string, any>;
101
+ }) => Promise<any[] | null>;
102
+ mapProp?: (value: any) => Props;
103
+ mapRow?: (value: any) => Record<string, string | number>;
104
+ getItemSummary?: (item: Props, index?: number) => string;
105
+ showSearch?: boolean;
106
+ initialQuery?: string;
107
+ filterFields?: Record<string, Field>;
108
+ initialFilters?: Record<string, any>;
109
+ };
110
+ type CustomField<Props extends any = {}> = BaseField & {
111
+ type: "custom";
112
+ render: (props: {
113
+ field: CustomField<Props>;
114
+ name: string;
115
+ id: string;
116
+ value: Props;
117
+ onChange: (value: Props) => void;
118
+ readOnly?: boolean;
119
+ }) => ReactElement;
120
+ };
121
+ type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
122
+ [key: string]: any;
123
+ } ? Props : any> | ObjectField<Props extends {
124
+ [key: string]: any;
125
+ } ? Props : any> | ExternalField<Props extends {
126
+ [key: string]: any;
127
+ } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
128
+ [key: string]: any;
129
+ } ? Props : any> | CustomField<Props>;
130
+ type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
131
+ [PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
132
+ };
133
+ type FieldProps<ValueType = any, F = Field<any>> = {
134
+ field: F;
135
+ value: ValueType;
136
+ id?: string;
137
+ onChange: (value: ValueType, uiState?: Partial<UiState>) => void;
138
+ readOnly?: boolean;
139
+ };
140
+
141
+ type WithId<Props> = Props & {
142
+ id: string;
143
+ };
144
+ type WithPuckProps<Props> = Props & {
145
+ puck: PuckContext;
146
+ editMode?: boolean;
147
+ };
148
+ type AsFieldProps<Props> = Omit<Props, "children" | "puck" | "editMode">;
149
+ type WithChildren<Props> = Props & {
150
+ children: ReactNode;
151
+ };
152
+ type DefaultRootFieldProps = {
153
+ title?: string;
154
+ };
155
+ type DefaultRootRenderProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = WithPuckProps<WithChildren<Props>>;
156
+ type DefaultRootProps = DefaultRootRenderProps;
157
+ type DefaultComponentProps = {
158
+ [key: string]: any;
159
+ };
160
+ type Content<PropsMap extends {
161
+ [key: string]: any;
162
+ } = {
163
+ [key: string]: any;
164
+ }> = ComponentDataMap<PropsMap>[];
165
+ type PuckComponent<Props> = (props: WithId<WithPuckProps<Props>>) => JSX.Element;
166
+ type PuckContext = {
167
+ renderDropZone: React.FC<DropZoneProps>;
168
+ isEditing: boolean;
169
+ };
170
+ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
171
+ render: PuckComponent<RenderProps>;
172
+ label?: string;
173
+ defaultProps?: FieldProps;
174
+ fields?: Fields<FieldProps>;
175
+ permissions?: Partial<Permissions>;
176
+ resolveFields?: (data: DataShape, params: {
177
+ changed: Partial<Record<keyof FieldProps, boolean>>;
178
+ fields: Fields<FieldProps>;
179
+ lastFields: Fields<FieldProps>;
180
+ lastData: DataShape;
181
+ appState: AppState;
182
+ }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
183
+ resolveData?: (data: DataShape, params: {
184
+ changed: Partial<Record<keyof FieldProps, boolean>>;
185
+ lastData: DataShape;
186
+ }) => Promise<{
187
+ props?: Partial<FieldProps>;
188
+ readOnly?: Partial<Record<keyof FieldProps, boolean>>;
189
+ }> | {
190
+ props?: Partial<FieldProps>;
191
+ readOnly?: Partial<Record<keyof FieldProps, boolean>>;
192
+ };
193
+ resolvePermissions?: (data: DataShape, params: {
194
+ changed: Partial<Record<keyof FieldProps, boolean>>;
195
+ lastPermissions: Partial<Permissions> | undefined;
196
+ initialPermissions: Partial<Permissions>;
197
+ appState: AppState;
198
+ }) => Partial<Permissions>;
199
+ };
200
+ type Category<ComponentName> = {
201
+ components?: ComponentName[];
202
+ title?: string;
203
+ visible?: boolean;
204
+ defaultExpanded?: boolean;
205
+ };
206
+ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = {
207
+ categories?: Record<CategoryName, Category<keyof Props>> & {
208
+ other?: Category<keyof Props>;
209
+ };
210
+ components: {
211
+ [ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
212
+ };
213
+ root?: Partial<ComponentConfig<DefaultRootRenderProps<RootProps>, AsFieldProps<RootProps>, RootData>>;
214
+ };
215
+ type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
216
+ type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
217
+ type BaseData<Props extends {
218
+ [key: string]: any;
219
+ } = {
220
+ [key: string]: any;
221
+ }> = {
222
+ readOnly?: Partial<Record<keyof Props, boolean>>;
223
+ };
224
+ type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps, Name = string> = {
225
+ type: Name;
226
+ props: WithId<Props>;
227
+ } & BaseData<Props>;
228
+ type ComponentDataMap<Props extends Record<string, DefaultComponentProps> = DefaultComponentProps> = {
229
+ [K in keyof Props]: ComponentData<Props[K], K extends string ? K : never>;
230
+ }[keyof Props];
231
+ type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
232
+ props: Props;
233
+ };
234
+ type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
235
+ type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
236
+ type MappedItem = ComponentData;
237
+ type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = {
238
+ root: RootData<RootProps>;
239
+ content: Content<Props>;
240
+ zones?: Record<string, Content<Props>>;
241
+ };
242
+ type ItemWithId = {
243
+ _arrayId: string;
244
+ _originalIndex: number;
245
+ };
246
+ type ArrayState = {
247
+ items: ItemWithId[];
248
+ openId: string;
249
+ };
250
+ type UiState = {
251
+ leftSideBarVisible: boolean;
252
+ rightSideBarVisible: boolean;
253
+ itemSelector: ItemSelector | null;
254
+ arrayState: Record<string, ArrayState | undefined>;
255
+ componentList: Record<string, {
256
+ components?: string[];
257
+ title?: string;
258
+ visible?: boolean;
259
+ expanded?: boolean;
260
+ }>;
261
+ isDragging: boolean;
262
+ viewports: {
263
+ current: {
264
+ width: number;
265
+ height: number | "auto";
266
+ };
267
+ controlsVisible: boolean;
268
+ options: Viewport[];
269
+ };
270
+ };
271
+ type AppState<UserData extends Data = Data> = {
272
+ data: UserData;
273
+ ui: UiState;
274
+ };
275
+ type Permissions = {
276
+ drag: boolean;
277
+ duplicate: boolean;
278
+ delete: boolean;
279
+ edit: boolean;
280
+ insert: boolean;
281
+ } & Record<string, boolean>;
282
+
283
+ export type { AppState as A, BaseData as B, Config as C, Data as D, ExtractPropsFromConfig as E, Field as F, ItemSelector as I, MappedItem as M, NumberField as N, ObjectField as O, Permissions as P, RootDataWithProps as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, ExtractRootPropsFromConfig as c, DefaultComponentProps as d, DefaultRootFieldProps as e, ComponentData as f, DefaultRootRenderProps as g, DefaultRootProps as h, Content as i, PuckComponent as j, PuckContext as k, ComponentConfig as l, ComponentDataMap as m, RootDataWithoutProps as n, RootData as o, ItemWithId as p, ArrayState as q, BaseField as r, TextareaField as s, RadioField as t, ArrayField as u, Adaptor as v, ExternalFieldWithAdaptor as w, ExternalField as x, CustomField as y, Fields as z };
@@ -0,0 +1,117 @@
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/root-droppable-id.ts
88
+ init_react_import();
89
+ var rootDroppableId = "default-zone";
90
+
91
+ // lib/setup-zone.ts
92
+ init_react_import();
93
+ function ensureZones(data) {
94
+ return __spreadProps(__spreadValues({}, data), {
95
+ zones: data.zones || {}
96
+ });
97
+ }
98
+ var setupZone = (data, zoneKey) => {
99
+ if (zoneKey === rootDroppableId) {
100
+ return data;
101
+ }
102
+ const newData = ensureZones(data);
103
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
104
+ return newData;
105
+ };
106
+
107
+ export {
108
+ __spreadValues,
109
+ __spreadProps,
110
+ __objRest,
111
+ __commonJS,
112
+ __toESM,
113
+ __async,
114
+ init_react_import,
115
+ rootDroppableId,
116
+ setupZone
117
+ };