@measured/puck 0.21.0-canary.16a3eee1 → 0.21.0-canary.1d823fd9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X7YZ3YE7.mjs → chunk-MHKBV5D3.mjs} +577 -58
- package/dist/{chunk-JZ2BPCUI.mjs → chunk-SWIW6GHU.mjs} +2735 -2895
- package/dist/index.css +653 -273
- package/dist/index.d.mts +16 -109
- package/dist/index.d.ts +16 -109
- package/dist/index.js +2302 -1967
- package/dist/index.mjs +10 -2
- package/dist/no-external.css +653 -273
- package/dist/no-external.d.mts +2 -2
- package/dist/no-external.d.ts +2 -2
- package/dist/no-external.js +2299 -1964
- package/dist/no-external.mjs +10 -2
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +487 -10
- package/dist/rsc.mjs +3 -1
- package/dist/{walk-tree-Ctf3FZQI.d.mts → walk-tree-CegGHme5.d.mts} +189 -51
- package/dist/{walk-tree-Ctf3FZQI.d.ts → walk-tree-CegGHme5.d.ts} +189 -51
- package/package.json +1 -1
|
@@ -1,4 +1,65 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
|
|
1
|
+
import { ReactElement, CSSProperties, ReactNode, JSX, Reducer } from 'react';
|
|
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
|
+
}>;
|
|
47
|
+
type PermissionsSlice = {
|
|
48
|
+
cache: Cache;
|
|
49
|
+
globalPermissions: Permissions;
|
|
50
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
|
51
|
+
getPermissions: GetPermissions<Config>;
|
|
52
|
+
resolvePermissions: ResolvePermissions<Config>;
|
|
53
|
+
refreshPermissions: RefreshPermissions<Config>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
|
57
|
+
type FieldsSlice = {
|
|
58
|
+
fields: Fields | Partial<Fields>;
|
|
59
|
+
loading: boolean;
|
|
60
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
|
61
|
+
id: string | undefined;
|
|
62
|
+
};
|
|
2
63
|
|
|
3
64
|
type ItemSelector = {
|
|
4
65
|
index: number;
|
|
@@ -10,63 +71,63 @@ type FieldOption = {
|
|
|
10
71
|
value: string | number | boolean | undefined | null | object;
|
|
11
72
|
};
|
|
12
73
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
13
|
-
|
|
74
|
+
interface BaseField {
|
|
14
75
|
label?: string;
|
|
15
76
|
labelIcon?: ReactElement;
|
|
16
|
-
metadata?:
|
|
77
|
+
metadata?: FieldMetadata;
|
|
17
78
|
visible?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
79
|
+
}
|
|
80
|
+
interface TextField extends BaseField {
|
|
20
81
|
type: "text";
|
|
21
82
|
placeholder?: string;
|
|
22
83
|
contentEditable?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
84
|
+
}
|
|
85
|
+
interface NumberField extends BaseField {
|
|
25
86
|
type: "number";
|
|
26
87
|
placeholder?: string;
|
|
27
88
|
min?: number;
|
|
28
89
|
max?: number;
|
|
29
90
|
step?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
91
|
+
}
|
|
92
|
+
interface TextareaField extends BaseField {
|
|
32
93
|
type: "textarea";
|
|
33
94
|
placeholder?: string;
|
|
34
95
|
contentEditable?: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
96
|
+
}
|
|
97
|
+
interface SelectField extends BaseField {
|
|
37
98
|
type: "select";
|
|
38
99
|
options: FieldOptions;
|
|
39
|
-
}
|
|
40
|
-
|
|
100
|
+
}
|
|
101
|
+
interface RadioField extends BaseField {
|
|
41
102
|
type: "radio";
|
|
42
103
|
options: FieldOptions;
|
|
43
|
-
}
|
|
44
|
-
|
|
104
|
+
}
|
|
105
|
+
interface ArrayField<Props extends {
|
|
45
106
|
[key: string]: any;
|
|
46
107
|
}[] = {
|
|
47
108
|
[key: string]: any;
|
|
48
|
-
}[], UserField extends {} = {}>
|
|
109
|
+
}[], UserField extends {} = {}> extends BaseField {
|
|
49
110
|
type: "array";
|
|
50
111
|
arrayFields: {
|
|
51
112
|
[SubPropName in keyof Props[0]]: UserField extends {
|
|
52
113
|
type: PropertyKey;
|
|
53
114
|
} ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
|
|
54
115
|
};
|
|
55
|
-
defaultItemProps?: Props[0];
|
|
116
|
+
defaultItemProps?: Props[0] | ((index: number) => Props[0]);
|
|
56
117
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
|
57
118
|
max?: number;
|
|
58
119
|
min?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
120
|
+
}
|
|
121
|
+
interface ObjectField<Props extends any = {
|
|
61
122
|
[key: string]: any;
|
|
62
|
-
}, UserField extends {} = {}>
|
|
123
|
+
}, UserField extends {} = {}> extends BaseField {
|
|
63
124
|
type: "object";
|
|
64
125
|
objectFields: {
|
|
65
126
|
[SubPropName in keyof Props]: UserField extends {
|
|
66
127
|
type: PropertyKey;
|
|
67
128
|
} ? Field<Props[SubPropName]> | UserField : Field<Props[SubPropName]>;
|
|
68
129
|
};
|
|
69
|
-
}
|
|
130
|
+
}
|
|
70
131
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
|
71
132
|
name: string;
|
|
72
133
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
@@ -82,10 +143,14 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
|
82
143
|
adaptorParams?: object;
|
|
83
144
|
getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
|
|
84
145
|
};
|
|
85
|
-
type
|
|
146
|
+
type CacheOpts = {
|
|
147
|
+
enabled?: boolean;
|
|
148
|
+
};
|
|
149
|
+
interface ExternalField<Props extends any = {
|
|
86
150
|
[key: string]: any;
|
|
87
|
-
}>
|
|
151
|
+
}> extends BaseField {
|
|
88
152
|
type: "external";
|
|
153
|
+
cache?: CacheOpts;
|
|
89
154
|
placeholder?: string;
|
|
90
155
|
fetchList: (params: {
|
|
91
156
|
query: string;
|
|
@@ -101,7 +166,7 @@ type ExternalField<Props extends any = {
|
|
|
101
166
|
initialQuery?: string;
|
|
102
167
|
filterFields?: Record<string, Field>;
|
|
103
168
|
initialFilters?: Record<string, any>;
|
|
104
|
-
}
|
|
169
|
+
}
|
|
105
170
|
type CustomFieldRender<Value extends any> = (props: {
|
|
106
171
|
field: CustomField<Value>;
|
|
107
172
|
name: string;
|
|
@@ -110,16 +175,17 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
|
110
175
|
onChange: (value: Value) => void;
|
|
111
176
|
readOnly?: boolean;
|
|
112
177
|
}) => ReactElement;
|
|
113
|
-
|
|
178
|
+
interface CustomField<Value extends any> extends BaseField {
|
|
114
179
|
type: "custom";
|
|
115
180
|
render: CustomFieldRender<Value>;
|
|
116
181
|
contentEditable?: boolean;
|
|
117
|
-
|
|
118
|
-
|
|
182
|
+
key?: string;
|
|
183
|
+
}
|
|
184
|
+
interface SlotField extends BaseField {
|
|
119
185
|
type: "slot";
|
|
120
186
|
allow?: string[];
|
|
121
187
|
disallow?: string[];
|
|
122
|
-
}
|
|
188
|
+
}
|
|
123
189
|
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
124
190
|
[key: string]: any;
|
|
125
191
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
@@ -147,7 +213,7 @@ type DropZoneProps = {
|
|
|
147
213
|
};
|
|
148
214
|
|
|
149
215
|
type PuckContext = {
|
|
150
|
-
renderDropZone: React.
|
|
216
|
+
renderDropZone: (props: DropZoneProps) => React.ReactNode;
|
|
151
217
|
metadata: Metadata;
|
|
152
218
|
isEditing: boolean;
|
|
153
219
|
dragRef: ((element: Element | null) => void) | null;
|
|
@@ -197,6 +263,8 @@ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
|
|
197
263
|
type WithPartialProps<T, Props extends DefaultComponentProps> = Omit<T, "props"> & {
|
|
198
264
|
props?: Partial<Props>;
|
|
199
265
|
};
|
|
266
|
+
interface ComponentConfigExtensions {
|
|
267
|
+
}
|
|
200
268
|
type ComponentConfigInternal<RenderProps extends DefaultComponentProps, FieldProps extends DefaultComponentProps, DataShape = Omit<ComponentData<FieldProps>, "type">, // NB this doesn't include AllProps, so types will not contain deep slot types. To fix, we require a breaking change.
|
|
201
269
|
UserField extends BaseField = {}> = {
|
|
202
270
|
render: PuckComponent<RenderProps>;
|
|
@@ -212,7 +280,7 @@ UserField extends BaseField = {}> = {
|
|
|
212
280
|
fields: Fields<FieldProps>;
|
|
213
281
|
lastFields: Fields<FieldProps>;
|
|
214
282
|
lastData: DataShape | null;
|
|
215
|
-
metadata:
|
|
283
|
+
metadata: ComponentMetadata;
|
|
216
284
|
appState: AppState;
|
|
217
285
|
parent: ComponentData | null;
|
|
218
286
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
|
@@ -221,7 +289,7 @@ UserField extends BaseField = {}> = {
|
|
|
221
289
|
id: string;
|
|
222
290
|
}>;
|
|
223
291
|
lastData: DataShape | null;
|
|
224
|
-
metadata:
|
|
292
|
+
metadata: ComponentMetadata;
|
|
225
293
|
trigger: ResolveDataTrigger;
|
|
226
294
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
227
295
|
resolvePermissions?: (data: DataShape, params: {
|
|
@@ -233,8 +301,8 @@ UserField extends BaseField = {}> = {
|
|
|
233
301
|
appState: AppState;
|
|
234
302
|
lastData: DataShape | null;
|
|
235
303
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
|
236
|
-
metadata?:
|
|
237
|
-
};
|
|
304
|
+
metadata?: ComponentMetadata;
|
|
305
|
+
} & ComponentConfigExtensions;
|
|
238
306
|
type ComponentConfig<RenderPropsOrParams extends LeftOrExactRight<RenderPropsOrParams, DefaultComponentProps, ComponentConfigParams> = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderPropsOrParams extends {
|
|
239
307
|
props: any;
|
|
240
308
|
} ? RenderPropsOrParams["props"] : RenderPropsOrParams, DataShape = Omit<ComponentData<FieldProps>, "type">> = RenderPropsOrParams extends ComponentConfigParams<infer ParamsRenderProps, never> ? ComponentConfigInternal<ParamsRenderProps, FieldProps, DataShape, {}> : RenderPropsOrParams extends ComponentConfigParams<infer ParamsRenderProps, infer ParamsFields> ? ComponentConfigInternal<ParamsRenderProps, FieldProps, DataShape, ParamsFields[keyof ParamsFields] & BaseField> : ComponentConfigInternal<RenderPropsOrParams, FieldProps, DataShape>;
|
|
@@ -265,6 +333,16 @@ type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends
|
|
|
265
333
|
type: string;
|
|
266
334
|
} ? UserField : Field;
|
|
267
335
|
} : never;
|
|
336
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
337
|
+
components?: Components;
|
|
338
|
+
root?: RootProps;
|
|
339
|
+
categories?: CategoryNames;
|
|
340
|
+
fields?: AssertHasValue<UserFields>;
|
|
341
|
+
};
|
|
342
|
+
type ComponentConfigParams<Props extends DefaultComponentProps = DefaultComponentProps, UserFields extends FieldsExtension = never> = {
|
|
343
|
+
props: Props;
|
|
344
|
+
fields?: AssertHasValue<UserFields>;
|
|
345
|
+
};
|
|
268
346
|
|
|
269
347
|
type BaseData<Props extends {
|
|
270
348
|
[key: string]: any;
|
|
@@ -305,10 +383,17 @@ type Data<Components extends DefaultComponents = DefaultComponents, RootProps ex
|
|
|
305
383
|
type Metadata = {
|
|
306
384
|
[key: string]: any;
|
|
307
385
|
};
|
|
386
|
+
interface PuckMetadata extends Metadata {
|
|
387
|
+
}
|
|
388
|
+
interface ComponentMetadata extends PuckMetadata {
|
|
389
|
+
}
|
|
390
|
+
interface FieldMetadata extends Metadata {
|
|
391
|
+
}
|
|
308
392
|
|
|
309
393
|
type ItemWithId = {
|
|
310
394
|
_arrayId: string;
|
|
311
395
|
_originalIndex: number;
|
|
396
|
+
_currentIndex: number;
|
|
312
397
|
};
|
|
313
398
|
type ArrayState = {
|
|
314
399
|
items: ItemWithId[];
|
|
@@ -319,6 +404,7 @@ type UiState = {
|
|
|
319
404
|
rightSideBarVisible: boolean;
|
|
320
405
|
leftSideBarWidth?: number | null;
|
|
321
406
|
rightSideBarWidth?: number | null;
|
|
407
|
+
mobilePanelExpanded?: boolean;
|
|
322
408
|
itemSelector: ItemSelector | null;
|
|
323
409
|
arrayState: Record<string, ArrayState | undefined>;
|
|
324
410
|
previewMode: "interactive" | "edit";
|
|
@@ -331,7 +417,7 @@ type UiState = {
|
|
|
331
417
|
isDragging: boolean;
|
|
332
418
|
viewports: {
|
|
333
419
|
current: {
|
|
334
|
-
width: number;
|
|
420
|
+
width: number | "100%";
|
|
335
421
|
height: number | "auto";
|
|
336
422
|
};
|
|
337
423
|
controlsVisible: boolean;
|
|
@@ -340,6 +426,9 @@ type UiState = {
|
|
|
340
426
|
field: {
|
|
341
427
|
focus?: string | null;
|
|
342
428
|
};
|
|
429
|
+
plugin: {
|
|
430
|
+
current: string | null;
|
|
431
|
+
};
|
|
343
432
|
};
|
|
344
433
|
type AppState<UserData extends Data = Data> = {
|
|
345
434
|
data: UserData;
|
|
@@ -373,26 +462,24 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
|
373
462
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
|
374
463
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
|
375
464
|
} : T;
|
|
376
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
377
|
-
components?: Components;
|
|
378
|
-
root?: RootProps;
|
|
379
|
-
categories?: CategoryNames;
|
|
380
|
-
fields?: AssertHasValue<UserFields>;
|
|
381
|
-
};
|
|
382
465
|
type FieldsExtension = {
|
|
383
466
|
[Type in string]: {
|
|
384
467
|
type: Type;
|
|
385
468
|
};
|
|
386
469
|
};
|
|
387
|
-
type ComponentConfigParams<Props extends DefaultComponentProps = DefaultComponentProps, UserFields extends FieldsExtension = never> = {
|
|
388
|
-
props: Props;
|
|
389
|
-
fields?: AssertHasValue<UserFields>;
|
|
390
|
-
};
|
|
391
470
|
type Exact<T, Target> = Record<Exclude<keyof T, keyof Target>, never>;
|
|
392
471
|
type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<Union, Right> : Left) | (Right & Exact<Union, Right>);
|
|
393
472
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
|
394
473
|
never
|
|
395
474
|
] ? False : True;
|
|
475
|
+
type RenderFunc<Props extends {
|
|
476
|
+
[key: string]: any;
|
|
477
|
+
} = {
|
|
478
|
+
children: ReactNode;
|
|
479
|
+
}> = (props: Props) => ReactElement;
|
|
480
|
+
type PluginInternal = Plugin & {
|
|
481
|
+
mobileOnly?: boolean;
|
|
482
|
+
};
|
|
396
483
|
|
|
397
484
|
type MapFnParams<ThisField = Field> = {
|
|
398
485
|
value: any;
|
|
@@ -416,11 +503,57 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
|
416
503
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
|
417
504
|
}>;
|
|
418
505
|
|
|
419
|
-
type
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
506
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
|
507
|
+
type ZoomConfig = {
|
|
508
|
+
autoZoom: number;
|
|
509
|
+
rootHeight: number;
|
|
510
|
+
zoom: number;
|
|
511
|
+
};
|
|
512
|
+
type ComponentState = Record<string, {
|
|
513
|
+
loadingCount: number;
|
|
514
|
+
}>;
|
|
515
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
516
|
+
instanceId: string;
|
|
517
|
+
state: G["UserAppState"];
|
|
518
|
+
dispatch: (action: PuckAction) => void;
|
|
519
|
+
config: UserConfig;
|
|
520
|
+
componentState: ComponentState;
|
|
521
|
+
setComponentState: (componentState: ComponentState) => void;
|
|
522
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
|
523
|
+
unsetComponentLoading: (id: string) => void;
|
|
524
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
|
525
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
|
526
|
+
node: T;
|
|
527
|
+
didChange: boolean;
|
|
528
|
+
}>;
|
|
529
|
+
resolveAndCommitData: () => void;
|
|
530
|
+
plugins: Plugin[];
|
|
531
|
+
overrides: Partial<Overrides>;
|
|
532
|
+
viewports: Viewports;
|
|
533
|
+
zoomConfig: ZoomConfig;
|
|
534
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
|
535
|
+
status: Status;
|
|
536
|
+
setStatus: (status: Status) => void;
|
|
537
|
+
iframe: IframeConfig;
|
|
538
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
|
539
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
|
540
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
|
541
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
|
542
|
+
metadata: Metadata;
|
|
543
|
+
fields: FieldsSlice;
|
|
544
|
+
history: HistorySlice;
|
|
545
|
+
nodes: NodesSlice;
|
|
546
|
+
permissions: PermissionsSlice;
|
|
547
|
+
fieldTransforms: FieldTransforms;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
type StateReducer<UserData extends Data = Data> = Reducer<PrivateAppState<UserData>, PuckAction>;
|
|
551
|
+
declare function createReducer<UserData extends Data>({ record, onAction, appStore, }: {
|
|
552
|
+
record?: (appState: AppState<UserData>) => void;
|
|
553
|
+
onAction?: OnAction<UserData>;
|
|
554
|
+
appStore: AppStore;
|
|
555
|
+
}): StateReducer<UserData>;
|
|
556
|
+
|
|
424
557
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
|
425
558
|
type OverrideKey = (typeof overrideKeys)[number];
|
|
426
559
|
type OverridesGeneric<Shape extends {
|
|
@@ -492,7 +625,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
|
492
625
|
|
|
493
626
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
|
494
627
|
type Viewport = {
|
|
495
|
-
width: number;
|
|
628
|
+
width: number | "100%";
|
|
496
629
|
height?: number | "auto";
|
|
497
630
|
label?: string;
|
|
498
631
|
icon?: iconTypes | ReactNode;
|
|
@@ -512,8 +645,13 @@ type IframeConfig = {
|
|
|
512
645
|
};
|
|
513
646
|
type OnAction<UserData extends Data = Data> = (action: PuckAction, appState: AppState<UserData>, prevAppState: AppState<UserData>) => void;
|
|
514
647
|
type Plugin<UserConfig extends Config = Config> = {
|
|
648
|
+
name?: string;
|
|
649
|
+
label?: string;
|
|
650
|
+
icon?: ReactNode;
|
|
651
|
+
render?: () => ReactElement;
|
|
515
652
|
overrides?: Partial<Overrides<UserConfig>>;
|
|
516
653
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
654
|
+
mobilePanelHeight?: "toggle" | "min-content";
|
|
517
655
|
};
|
|
518
656
|
type History<D = any> = {
|
|
519
657
|
state: D;
|
|
@@ -631,4 +769,4 @@ type WalkTreeOptions = {
|
|
|
631
769
|
};
|
|
632
770
|
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;
|
|
633
771
|
|
|
634
|
-
export { type
|
|
772
|
+
export { type RootDataWithProps as $, type AppStore as A, type AppState as B, type Config as C, type DropZoneProps as D, type SlotComponent as E, type Field as F, type GetPermissions as G, type HistorySlice as H, type IframeConfig as I, type PuckComponent as J, type ResolveDataTrigger as K, type ComponentConfigExtensions as L, type Metadata as M, type ComponentConfig as N, type OnAction as O, type Permissions as P, type RootConfig as Q, type RefreshPermissions as R, type Slot as S, type DefaultComponents as T, type UserGenerics as U, type Viewports as V, type WithSlotProps as W, type ExtractConfigParams as X, type ConfigParams as Y, type ComponentConfigParams as Z, type BaseData as _, type FieldProps as a, type RootDataWithoutProps as a0, type RootData as a1, type ComponentData as a2, type ComponentDataOptionalId as a3, type MappedItem as a4, type ComponentDataMap as a5, type Content as a6, type PuckMetadata as a7, type ComponentMetadata as a8, type FieldMetadata as a9, type BaseField as aa, type TextField as ab, type NumberField as ac, type TextareaField as ad, type SelectField as ae, type RadioField as af, type ArrayField as ag, type ObjectField as ah, type Adaptor as ai, type ExternalFieldWithAdaptor as aj, type CacheOpts as ak, type ExternalField as al, type CustomFieldRender as am, type CustomField as an, type SlotField as ao, type Fields as ap, type PuckContext as aq, type DefaultRootFieldProps as ar, type DefaultRootRenderProps as as, type DefaultRootProps as at, type DefaultComponentProps as au, type WithId as av, type WithPuckProps as aw, type AsFieldProps as ax, type WithChildren as ay, type ExtractField as az, type Data as b, createReducer as c, type UiState as d, type Plugin as e, type Overrides as f, type FieldTransforms as g, type PuckAction as h, type InitialHistory as i, type ItemSelector as j, type PluginInternal as k, type History as l, migrate as m, type Direction as n, type DragAxis as o, type Viewport as p, type FieldTransformFnParams as q, resolveAllData as r, type FieldTransformFn as s, transformProps as t, overrideKeys as u, type OverrideKey as v, walkTree as w, type FieldRenderFunctions as x, type ItemWithId as y, type ArrayState as z };
|