@measured/puck 0.16.0-canary.6386bd1 → 0.16.0-canary.6d43ba0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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> = Partial<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,18 +203,14 @@ 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 Record<string, any> = Record<string, any>, RootProps extends DefaultComponentProps = DefaultRootFieldProps, 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
  };
206
215
  type BaseData<Props extends {
207
216
  [key: string]: any;
@@ -210,20 +219,23 @@ type BaseData<Props extends {
210
219
  }> = {
211
220
  readOnly?: Partial<Record<keyof Props, boolean>>;
212
221
  };
213
- type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps> = {
214
- type: keyof Props;
215
- props: WithPuckProps<Props>;
222
+ type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps, Name = string> = {
223
+ type: Name;
224
+ props: WithId<Props>;
216
225
  } & BaseData<Props>;
217
- type RootDataWithProps<Props extends DefaultRootProps = DefaultRootProps> = BaseData<Props> & {
226
+ type ComponentDataMap<Props extends Record<string, DefaultComponentProps> = DefaultComponentProps> = {
227
+ [K in keyof Props]: ComponentData<Props[K], K>;
228
+ }[keyof Props];
229
+ type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
218
230
  props: Props;
219
231
  };
220
- type RootDataWithoutProps<Props extends DefaultRootProps = DefaultRootProps> = Props;
221
- type RootData<Props extends DefaultRootProps = DefaultRootProps> = Partial<RootDataWithProps<Props>> & Partial<RootDataWithoutProps<Props>>;
232
+ type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
233
+ type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
222
234
  type MappedItem = ComponentData;
223
- type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = {
235
+ type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = {
224
236
  root: RootData<RootProps>;
225
- content: Content<WithPuckProps<Props>>;
226
- zones?: Record<string, Content<WithPuckProps<Props>>>;
237
+ content: Content<Props>;
238
+ zones?: Record<string, Content<Props>>;
227
239
  };
228
240
  type ItemWithId = {
229
241
  _arrayId: string;
@@ -258,5 +270,12 @@ type AppState = {
258
270
  data: Data;
259
271
  ui: UiState;
260
272
  };
273
+ type Permissions = {
274
+ drag: boolean;
275
+ duplicate: boolean;
276
+ delete: boolean;
277
+ edit: boolean;
278
+ insert: boolean;
279
+ } & Record<string, boolean>;
261
280
 
262
- export type { 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, RootData as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, DefaultComponentProps as c, DefaultRootProps as d, RootDataWithProps 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 };
281
+ export type { 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, Permissions as P, RootData as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, DefaultComponentProps as c, DefaultRootFieldProps as d, ComponentData as e, RootDataWithProps as f, Content as g, DefaultRootRenderProps as h, DefaultRootProps as i, PuckComponent as j, PuckContext as k, ComponentConfig as l, ComponentDataMap as m, RootDataWithoutProps as n, ItemWithId as o, ArrayState as p, BaseField as q, TextareaField as r, RadioField as s, ArrayField as t, Adaptor as u, ExternalField as v, CustomField as w, Fields as x };
@@ -0,0 +1,281 @@
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> = Partial<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 Record<string, any> = Record<string, any>, RootProps extends DefaultComponentProps = DefaultRootFieldProps, 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 BaseData<Props extends {
216
+ [key: string]: any;
217
+ } = {
218
+ [key: string]: any;
219
+ }> = {
220
+ readOnly?: Partial<Record<keyof Props, boolean>>;
221
+ };
222
+ type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps, Name = string> = {
223
+ type: Name;
224
+ props: WithId<Props>;
225
+ } & BaseData<Props>;
226
+ type ComponentDataMap<Props extends Record<string, DefaultComponentProps> = DefaultComponentProps> = {
227
+ [K in keyof Props]: ComponentData<Props[K], K>;
228
+ }[keyof Props];
229
+ type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
230
+ props: Props;
231
+ };
232
+ type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
233
+ type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
234
+ type MappedItem = ComponentData;
235
+ type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = {
236
+ root: RootData<RootProps>;
237
+ content: Content<Props>;
238
+ zones?: Record<string, Content<Props>>;
239
+ };
240
+ type ItemWithId = {
241
+ _arrayId: string;
242
+ _originalIndex: number;
243
+ };
244
+ type ArrayState = {
245
+ items: ItemWithId[];
246
+ openId: string;
247
+ };
248
+ type UiState = {
249
+ leftSideBarVisible: boolean;
250
+ rightSideBarVisible: boolean;
251
+ itemSelector: ItemSelector | null;
252
+ arrayState: Record<string, ArrayState | undefined>;
253
+ componentList: Record<string, {
254
+ components?: string[];
255
+ title?: string;
256
+ visible?: boolean;
257
+ expanded?: boolean;
258
+ }>;
259
+ isDragging: boolean;
260
+ viewports: {
261
+ current: {
262
+ width: number;
263
+ height: number | "auto";
264
+ };
265
+ controlsVisible: boolean;
266
+ options: Viewport[];
267
+ };
268
+ };
269
+ type AppState = {
270
+ data: Data;
271
+ ui: UiState;
272
+ };
273
+ type Permissions = {
274
+ drag: boolean;
275
+ duplicate: boolean;
276
+ delete: boolean;
277
+ edit: boolean;
278
+ insert: boolean;
279
+ } & Record<string, boolean>;
280
+
281
+ export type { 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, Permissions as P, RootData as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, DefaultComponentProps as c, DefaultRootFieldProps as d, ComponentData as e, RootDataWithProps as f, Content as g, DefaultRootRenderProps as h, DefaultRootProps as i, PuckComponent as j, PuckContext as k, ComponentConfig as l, ComponentDataMap as m, RootDataWithoutProps as n, ItemWithId as o, ArrayState as p, BaseField as q, TextareaField as r, RadioField as s, ArrayField as t, Adaptor as u, ExternalField as v, CustomField as w, Fields as x };
@@ -0,0 +1,113 @@
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
+ var setupZone = (data, zoneKey) => {
94
+ if (zoneKey === rootDroppableId) {
95
+ return data;
96
+ }
97
+ const newData = __spreadValues({}, data);
98
+ newData.zones = data.zones || {};
99
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
100
+ return newData;
101
+ };
102
+
103
+ export {
104
+ __spreadValues,
105
+ __spreadProps,
106
+ __objRest,
107
+ __commonJS,
108
+ __toESM,
109
+ __async,
110
+ init_react_import,
111
+ rootDroppableId,
112
+ setupZone
113
+ };