@measured/puck 0.16.0-canary.2bef00b → 0.16.0-canary.2cce878
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/actions-B02fIT66.d.mts +419 -0
- package/dist/actions-B02fIT66.d.ts +419 -0
- package/dist/{chunk-TM7CT64S.mjs → chunk-LM7YWFFF.mjs} +3 -2
- package/dist/index.css +25 -9
- package/dist/index.d.mts +18 -157
- package/dist/index.d.ts +18 -157
- package/dist/index.js +212 -126
- package/dist/index.mjs +209 -125
- package/dist/rsc.d.mts +1 -1
- package/dist/rsc.d.ts +1 -1
- package/dist/rsc.js +3 -2
- package/dist/rsc.mjs +1 -1
- package/package.json +3 -1
- package/dist/Config-CkVFT1_w.d.mts +0 -276
- package/dist/Config-CkVFT1_w.d.ts +0 -276
package/dist/index.d.mts
CHANGED
@@ -1,137 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
3
|
-
import * as react from 'react';
|
4
|
-
import { ReactNode, ReactElement, SyntheticEvent, CSSProperties } from 'react';
|
1
|
+
import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, E as ExtractPropsFromConfig, c as ExtractRootPropsFromConfig, U as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, A as AppState, V as Viewports, g as IframeConfig, h as DefaultComponentProps, i as DefaultRootFieldProps, j as ComponentData } from './actions-B02fIT66.mjs';
|
2
|
+
export { H as Adaptor, z as ArrayField, p as ArrayState, $ as AsFieldProps, B as BaseData, w as BaseField, r as ComponentConfig, u as ComponentDataMap, v as Content, L as CustomField, Y as DefaultRootProps, X as DefaultRootRenderProps, K as ExternalField, J as ExternalFieldWithAdaptor, m as FieldRenderFunctions, Q as Fields, n as ItemWithId, M as MappedItem, N as NumberField, G as ObjectField, l as OverrideKey, q as PuckComponent, W as PuckContext, y as RadioField, t as RootData, R as RootDataWithProps, s as RootDataWithoutProps, S as SelectField, T as TextField, x as TextareaField, k as Viewport, a0 as WithChildren, Z as WithId, _ as WithPuckProps, o as overrideKeys } from './actions-B02fIT66.mjs';
|
5
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
|
+
import * as react from 'react';
|
5
|
+
import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
6
6
|
import { DragStart, DragUpdate } from '@measured/dnd';
|
7
7
|
|
8
|
-
type InsertAction = {
|
9
|
-
type: "insert";
|
10
|
-
componentType: string;
|
11
|
-
destinationIndex: number;
|
12
|
-
destinationZone: string;
|
13
|
-
id?: string;
|
14
|
-
};
|
15
|
-
type DuplicateAction = {
|
16
|
-
type: "duplicate";
|
17
|
-
sourceIndex: number;
|
18
|
-
sourceZone: string;
|
19
|
-
};
|
20
|
-
type ReplaceAction = {
|
21
|
-
type: "replace";
|
22
|
-
destinationIndex: number;
|
23
|
-
destinationZone: string;
|
24
|
-
data: any;
|
25
|
-
};
|
26
|
-
type ReorderAction = {
|
27
|
-
type: "reorder";
|
28
|
-
sourceIndex: number;
|
29
|
-
destinationIndex: number;
|
30
|
-
destinationZone: string;
|
31
|
-
};
|
32
|
-
type MoveAction = {
|
33
|
-
type: "move";
|
34
|
-
sourceIndex: number;
|
35
|
-
sourceZone: string;
|
36
|
-
destinationIndex: number;
|
37
|
-
destinationZone: string;
|
38
|
-
};
|
39
|
-
type RemoveAction = {
|
40
|
-
type: "remove";
|
41
|
-
index: number;
|
42
|
-
zone: string;
|
43
|
-
};
|
44
|
-
type SetUiAction = {
|
45
|
-
type: "setUi";
|
46
|
-
ui: Partial<UiState> | ((previous: UiState) => Partial<UiState>);
|
47
|
-
};
|
48
|
-
type SetDataAction = {
|
49
|
-
type: "setData";
|
50
|
-
data: Partial<Data> | ((previous: Data) => Partial<Data>);
|
51
|
-
};
|
52
|
-
type SetAction = {
|
53
|
-
type: "set";
|
54
|
-
state: Partial<AppState> | ((previous: AppState) => Partial<AppState>);
|
55
|
-
};
|
56
|
-
type RegisterZoneAction = {
|
57
|
-
type: "registerZone";
|
58
|
-
zone: string;
|
59
|
-
};
|
60
|
-
type UnregisterZoneAction = {
|
61
|
-
type: "unregisterZone";
|
62
|
-
zone: string;
|
63
|
-
};
|
64
|
-
type PuckAction = {
|
65
|
-
recordHistory?: boolean;
|
66
|
-
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
67
|
-
|
68
|
-
type RenderFunc<Props extends {
|
69
|
-
[key: string]: any;
|
70
|
-
} = {
|
71
|
-
children: ReactNode;
|
72
|
-
}> = (props: Props) => ReactElement;
|
73
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
74
|
-
type OverrideKey = (typeof overrideKeys)[number];
|
75
|
-
type OverridesGeneric<Shape extends {
|
76
|
-
[key in OverrideKey]: any;
|
77
|
-
}> = Shape;
|
78
|
-
type Overrides = OverridesGeneric<{
|
79
|
-
fieldTypes: Partial<FieldRenderFunctions>;
|
80
|
-
header: RenderFunc<{
|
81
|
-
actions: ReactNode;
|
82
|
-
children: ReactNode;
|
83
|
-
}>;
|
84
|
-
actionBar: RenderFunc<{
|
85
|
-
label?: string;
|
86
|
-
children: ReactNode;
|
87
|
-
}>;
|
88
|
-
headerActions: RenderFunc<{
|
89
|
-
children: ReactNode;
|
90
|
-
}>;
|
91
|
-
preview: RenderFunc;
|
92
|
-
fields: RenderFunc<{
|
93
|
-
children: ReactNode;
|
94
|
-
isLoading: boolean;
|
95
|
-
itemSelector?: ItemSelector | null;
|
96
|
-
}>;
|
97
|
-
fieldLabel: RenderFunc<{
|
98
|
-
children?: ReactNode;
|
99
|
-
icon?: ReactNode;
|
100
|
-
label: string;
|
101
|
-
el?: "label" | "div";
|
102
|
-
readOnly?: boolean;
|
103
|
-
className?: string;
|
104
|
-
}>;
|
105
|
-
components: RenderFunc;
|
106
|
-
componentItem: RenderFunc<{
|
107
|
-
children: ReactNode;
|
108
|
-
name: string;
|
109
|
-
}>;
|
110
|
-
iframe: RenderFunc<{
|
111
|
-
children: ReactNode;
|
112
|
-
document?: Document;
|
113
|
-
}>;
|
114
|
-
outline: RenderFunc;
|
115
|
-
puck: RenderFunc;
|
116
|
-
}>;
|
117
|
-
type FieldRenderFunctions = Omit<{
|
118
|
-
[Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
|
119
|
-
type: Type;
|
120
|
-
}>> & {
|
121
|
-
children: ReactNode;
|
122
|
-
name: string;
|
123
|
-
}>;
|
124
|
-
}, "custom"> & {
|
125
|
-
[key: string]: React.FunctionComponent<FieldProps<any> & {
|
126
|
-
children: ReactNode;
|
127
|
-
name: string;
|
128
|
-
}>;
|
129
|
-
};
|
130
|
-
|
131
|
-
type Plugin = {
|
132
|
-
overrides: Partial<Overrides>;
|
133
|
-
};
|
134
|
-
|
135
8
|
declare const ActionBar: {
|
136
9
|
({ label, children, }: {
|
137
10
|
label?: string;
|
@@ -234,8 +107,6 @@ type HistoryStore<D = any> = {
|
|
234
107
|
setHistoryIndex: (index: number) => void;
|
235
108
|
};
|
236
109
|
|
237
|
-
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
238
|
-
|
239
110
|
type PathData = Record<string, {
|
240
111
|
path: string[];
|
241
112
|
label: string;
|
@@ -288,28 +159,24 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
288
159
|
title: string;
|
289
160
|
}) => react_jsx_runtime.JSX.Element;
|
290
161
|
|
291
|
-
|
292
|
-
enabled?: boolean;
|
293
|
-
};
|
294
|
-
|
295
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistory, }: {
|
162
|
+
declare function Puck<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>>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe: _iframe, dnd, initialHistory, }: {
|
296
163
|
children?: ReactNode;
|
297
164
|
config: UserConfig;
|
298
|
-
data: Partial<
|
165
|
+
data: Partial<UserData>;
|
299
166
|
ui?: Partial<UiState>;
|
300
|
-
onChange?: (data:
|
301
|
-
onPublish?: (data:
|
302
|
-
onAction?: OnAction
|
167
|
+
onChange?: (data: UserData) => void;
|
168
|
+
onPublish?: (data: UserData) => void;
|
169
|
+
onAction?: OnAction<UserData>;
|
303
170
|
permissions?: Partial<Permissions>;
|
304
171
|
plugins?: Plugin[];
|
305
172
|
overrides?: Partial<Overrides>;
|
306
173
|
renderHeader?: (props: {
|
307
174
|
children: ReactNode;
|
308
175
|
dispatch: (action: PuckAction) => void;
|
309
|
-
state: AppState
|
176
|
+
state: AppState<UserData>;
|
310
177
|
}) => ReactElement;
|
311
178
|
renderHeaderActions?: (props: {
|
312
|
-
state: AppState
|
179
|
+
state: AppState<UserData>;
|
313
180
|
dispatch: (action: PuckAction) => void;
|
314
181
|
}) => ReactElement;
|
315
182
|
headerTitle?: string;
|
@@ -333,14 +200,14 @@ declare namespace Puck {
|
|
333
200
|
}) => react_jsx_runtime.JSX.Element;
|
334
201
|
}
|
335
202
|
|
336
|
-
declare function Render<UserConfig extends Config = Config>({ config, data
|
203
|
+
declare function Render<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>>({ config, data }: {
|
337
204
|
config: UserConfig;
|
338
|
-
data: Partial<
|
205
|
+
data: Partial<UserData>;
|
339
206
|
}): react_jsx_runtime.JSX.Element;
|
340
207
|
|
341
208
|
declare function migrate(data: Data): Data;
|
342
209
|
|
343
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
210
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
344
211
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
345
212
|
[key: string]: any;
|
346
213
|
}) => Props[ComponentName];
|
@@ -349,13 +216,9 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
349
216
|
[key: string]: any;
|
350
217
|
}) => RootProps;
|
351
218
|
}>;
|
352
|
-
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps =
|
219
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
353
220
|
|
354
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item:
|
355
|
-
root: RootData<DefaultRootProps> | RootDataWithProps;
|
356
|
-
content: any;
|
357
|
-
zones: Record<string, MappedItem[]>;
|
358
|
-
}>;
|
221
|
+
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
359
222
|
|
360
223
|
declare const usePuck: () => {
|
361
224
|
appState: AppState;
|
@@ -383,9 +246,7 @@ declare const usePuck: () => {
|
|
383
246
|
index: number;
|
384
247
|
historyStore: HistoryStore | undefined;
|
385
248
|
};
|
386
|
-
selectedItem: ComponentData<
|
387
|
-
id: string;
|
388
|
-
}> | null;
|
249
|
+
selectedItem: ComponentData<any, string> | null;
|
389
250
|
};
|
390
251
|
|
391
|
-
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps,
|
252
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, IframeConfig, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, Viewports, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|
package/dist/index.d.ts
CHANGED
@@ -1,137 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
3
|
-
import * as react from 'react';
|
4
|
-
import { ReactNode, ReactElement, SyntheticEvent, CSSProperties } from 'react';
|
1
|
+
import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, E as ExtractPropsFromConfig, c as ExtractRootPropsFromConfig, U as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, A as AppState, V as Viewports, g as IframeConfig, h as DefaultComponentProps, i as DefaultRootFieldProps, j as ComponentData } from './actions-B02fIT66.js';
|
2
|
+
export { H as Adaptor, z as ArrayField, p as ArrayState, $ as AsFieldProps, B as BaseData, w as BaseField, r as ComponentConfig, u as ComponentDataMap, v as Content, L as CustomField, Y as DefaultRootProps, X as DefaultRootRenderProps, K as ExternalField, J as ExternalFieldWithAdaptor, m as FieldRenderFunctions, Q as Fields, n as ItemWithId, M as MappedItem, N as NumberField, G as ObjectField, l as OverrideKey, q as PuckComponent, W as PuckContext, y as RadioField, t as RootData, R as RootDataWithProps, s as RootDataWithoutProps, S as SelectField, T as TextField, x as TextareaField, k as Viewport, a0 as WithChildren, Z as WithId, _ as WithPuckProps, o as overrideKeys } from './actions-B02fIT66.js';
|
5
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
|
+
import * as react from 'react';
|
5
|
+
import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
6
6
|
import { DragStart, DragUpdate } from '@measured/dnd';
|
7
7
|
|
8
|
-
type InsertAction = {
|
9
|
-
type: "insert";
|
10
|
-
componentType: string;
|
11
|
-
destinationIndex: number;
|
12
|
-
destinationZone: string;
|
13
|
-
id?: string;
|
14
|
-
};
|
15
|
-
type DuplicateAction = {
|
16
|
-
type: "duplicate";
|
17
|
-
sourceIndex: number;
|
18
|
-
sourceZone: string;
|
19
|
-
};
|
20
|
-
type ReplaceAction = {
|
21
|
-
type: "replace";
|
22
|
-
destinationIndex: number;
|
23
|
-
destinationZone: string;
|
24
|
-
data: any;
|
25
|
-
};
|
26
|
-
type ReorderAction = {
|
27
|
-
type: "reorder";
|
28
|
-
sourceIndex: number;
|
29
|
-
destinationIndex: number;
|
30
|
-
destinationZone: string;
|
31
|
-
};
|
32
|
-
type MoveAction = {
|
33
|
-
type: "move";
|
34
|
-
sourceIndex: number;
|
35
|
-
sourceZone: string;
|
36
|
-
destinationIndex: number;
|
37
|
-
destinationZone: string;
|
38
|
-
};
|
39
|
-
type RemoveAction = {
|
40
|
-
type: "remove";
|
41
|
-
index: number;
|
42
|
-
zone: string;
|
43
|
-
};
|
44
|
-
type SetUiAction = {
|
45
|
-
type: "setUi";
|
46
|
-
ui: Partial<UiState> | ((previous: UiState) => Partial<UiState>);
|
47
|
-
};
|
48
|
-
type SetDataAction = {
|
49
|
-
type: "setData";
|
50
|
-
data: Partial<Data> | ((previous: Data) => Partial<Data>);
|
51
|
-
};
|
52
|
-
type SetAction = {
|
53
|
-
type: "set";
|
54
|
-
state: Partial<AppState> | ((previous: AppState) => Partial<AppState>);
|
55
|
-
};
|
56
|
-
type RegisterZoneAction = {
|
57
|
-
type: "registerZone";
|
58
|
-
zone: string;
|
59
|
-
};
|
60
|
-
type UnregisterZoneAction = {
|
61
|
-
type: "unregisterZone";
|
62
|
-
zone: string;
|
63
|
-
};
|
64
|
-
type PuckAction = {
|
65
|
-
recordHistory?: boolean;
|
66
|
-
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
67
|
-
|
68
|
-
type RenderFunc<Props extends {
|
69
|
-
[key: string]: any;
|
70
|
-
} = {
|
71
|
-
children: ReactNode;
|
72
|
-
}> = (props: Props) => ReactElement;
|
73
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
74
|
-
type OverrideKey = (typeof overrideKeys)[number];
|
75
|
-
type OverridesGeneric<Shape extends {
|
76
|
-
[key in OverrideKey]: any;
|
77
|
-
}> = Shape;
|
78
|
-
type Overrides = OverridesGeneric<{
|
79
|
-
fieldTypes: Partial<FieldRenderFunctions>;
|
80
|
-
header: RenderFunc<{
|
81
|
-
actions: ReactNode;
|
82
|
-
children: ReactNode;
|
83
|
-
}>;
|
84
|
-
actionBar: RenderFunc<{
|
85
|
-
label?: string;
|
86
|
-
children: ReactNode;
|
87
|
-
}>;
|
88
|
-
headerActions: RenderFunc<{
|
89
|
-
children: ReactNode;
|
90
|
-
}>;
|
91
|
-
preview: RenderFunc;
|
92
|
-
fields: RenderFunc<{
|
93
|
-
children: ReactNode;
|
94
|
-
isLoading: boolean;
|
95
|
-
itemSelector?: ItemSelector | null;
|
96
|
-
}>;
|
97
|
-
fieldLabel: RenderFunc<{
|
98
|
-
children?: ReactNode;
|
99
|
-
icon?: ReactNode;
|
100
|
-
label: string;
|
101
|
-
el?: "label" | "div";
|
102
|
-
readOnly?: boolean;
|
103
|
-
className?: string;
|
104
|
-
}>;
|
105
|
-
components: RenderFunc;
|
106
|
-
componentItem: RenderFunc<{
|
107
|
-
children: ReactNode;
|
108
|
-
name: string;
|
109
|
-
}>;
|
110
|
-
iframe: RenderFunc<{
|
111
|
-
children: ReactNode;
|
112
|
-
document?: Document;
|
113
|
-
}>;
|
114
|
-
outline: RenderFunc;
|
115
|
-
puck: RenderFunc;
|
116
|
-
}>;
|
117
|
-
type FieldRenderFunctions = Omit<{
|
118
|
-
[Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
|
119
|
-
type: Type;
|
120
|
-
}>> & {
|
121
|
-
children: ReactNode;
|
122
|
-
name: string;
|
123
|
-
}>;
|
124
|
-
}, "custom"> & {
|
125
|
-
[key: string]: React.FunctionComponent<FieldProps<any> & {
|
126
|
-
children: ReactNode;
|
127
|
-
name: string;
|
128
|
-
}>;
|
129
|
-
};
|
130
|
-
|
131
|
-
type Plugin = {
|
132
|
-
overrides: Partial<Overrides>;
|
133
|
-
};
|
134
|
-
|
135
8
|
declare const ActionBar: {
|
136
9
|
({ label, children, }: {
|
137
10
|
label?: string;
|
@@ -234,8 +107,6 @@ type HistoryStore<D = any> = {
|
|
234
107
|
setHistoryIndex: (index: number) => void;
|
235
108
|
};
|
236
109
|
|
237
|
-
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
238
|
-
|
239
110
|
type PathData = Record<string, {
|
240
111
|
path: string[];
|
241
112
|
label: string;
|
@@ -288,28 +159,24 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
288
159
|
title: string;
|
289
160
|
}) => react_jsx_runtime.JSX.Element;
|
290
161
|
|
291
|
-
|
292
|
-
enabled?: boolean;
|
293
|
-
};
|
294
|
-
|
295
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistory, }: {
|
162
|
+
declare function Puck<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>>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe: _iframe, dnd, initialHistory, }: {
|
296
163
|
children?: ReactNode;
|
297
164
|
config: UserConfig;
|
298
|
-
data: Partial<
|
165
|
+
data: Partial<UserData>;
|
299
166
|
ui?: Partial<UiState>;
|
300
|
-
onChange?: (data:
|
301
|
-
onPublish?: (data:
|
302
|
-
onAction?: OnAction
|
167
|
+
onChange?: (data: UserData) => void;
|
168
|
+
onPublish?: (data: UserData) => void;
|
169
|
+
onAction?: OnAction<UserData>;
|
303
170
|
permissions?: Partial<Permissions>;
|
304
171
|
plugins?: Plugin[];
|
305
172
|
overrides?: Partial<Overrides>;
|
306
173
|
renderHeader?: (props: {
|
307
174
|
children: ReactNode;
|
308
175
|
dispatch: (action: PuckAction) => void;
|
309
|
-
state: AppState
|
176
|
+
state: AppState<UserData>;
|
310
177
|
}) => ReactElement;
|
311
178
|
renderHeaderActions?: (props: {
|
312
|
-
state: AppState
|
179
|
+
state: AppState<UserData>;
|
313
180
|
dispatch: (action: PuckAction) => void;
|
314
181
|
}) => ReactElement;
|
315
182
|
headerTitle?: string;
|
@@ -333,14 +200,14 @@ declare namespace Puck {
|
|
333
200
|
}) => react_jsx_runtime.JSX.Element;
|
334
201
|
}
|
335
202
|
|
336
|
-
declare function Render<UserConfig extends Config = Config>({ config, data
|
203
|
+
declare function Render<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>>({ config, data }: {
|
337
204
|
config: UserConfig;
|
338
|
-
data: Partial<
|
205
|
+
data: Partial<UserData>;
|
339
206
|
}): react_jsx_runtime.JSX.Element;
|
340
207
|
|
341
208
|
declare function migrate(data: Data): Data;
|
342
209
|
|
343
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
210
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
344
211
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
345
212
|
[key: string]: any;
|
346
213
|
}) => Props[ComponentName];
|
@@ -349,13 +216,9 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
349
216
|
[key: string]: any;
|
350
217
|
}) => RootProps;
|
351
218
|
}>;
|
352
|
-
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps =
|
219
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
353
220
|
|
354
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item:
|
355
|
-
root: RootData<DefaultRootProps> | RootDataWithProps;
|
356
|
-
content: any;
|
357
|
-
zones: Record<string, MappedItem[]>;
|
358
|
-
}>;
|
221
|
+
declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
|
359
222
|
|
360
223
|
declare const usePuck: () => {
|
361
224
|
appState: AppState;
|
@@ -383,9 +246,7 @@ declare const usePuck: () => {
|
|
383
246
|
index: number;
|
384
247
|
historyStore: HistoryStore | undefined;
|
385
248
|
};
|
386
|
-
selectedItem: ComponentData<
|
387
|
-
id: string;
|
388
|
-
}> | null;
|
249
|
+
selectedItem: ComponentData<any, string> | null;
|
389
250
|
};
|
390
251
|
|
391
|
-
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps,
|
252
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, IframeConfig, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, Viewports, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|