@measured/puck 0.16.0-canary.cad95b8 → 0.16.0-canary.cfecf54
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/actions-DDAd8cys.d.mts +418 -0
- package/dist/actions-DDAd8cys.d.ts +418 -0
- package/dist/chunk-LM7YWFFF.mjs +114 -0
- package/dist/index.css +25 -9
- package/dist/index.d.mts +252 -0
- package/dist/index.d.ts +18 -153
- package/dist/index.js +433 -28752
- package/dist/index.mjs +5910 -0
- package/dist/rsc.d.mts +10 -0
- package/dist/rsc.d.ts +1 -1
- package/dist/rsc.js +3 -2
- package/dist/rsc.mjs +80 -0
- package/package.json +14 -6
- package/dist/Config-DCrYvDkL.d.ts +0 -270
package/dist/index.d.mts
ADDED
@@ -0,0 +1,252 @@
|
|
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-DDAd8cys.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-DDAd8cys.mjs';
|
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
|
+
import { DragStart, DragUpdate } from '@measured/dnd';
|
7
|
+
|
8
|
+
declare const ActionBar: {
|
9
|
+
({ label, children, }: {
|
10
|
+
label?: string;
|
11
|
+
children?: ReactNode;
|
12
|
+
}): react_jsx_runtime.JSX.Element;
|
13
|
+
Action: ({ children, label, onClick, }: {
|
14
|
+
children: ReactNode;
|
15
|
+
label?: string;
|
16
|
+
onClick: (e: SyntheticEvent) => void;
|
17
|
+
}) => react_jsx_runtime.JSX.Element;
|
18
|
+
};
|
19
|
+
declare const Action: ({ children, label, onClick, }: {
|
20
|
+
children: ReactNode;
|
21
|
+
label?: string;
|
22
|
+
onClick: (e: SyntheticEvent) => void;
|
23
|
+
}) => react_jsx_runtime.JSX.Element;
|
24
|
+
|
25
|
+
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
26
|
+
children?: ReactNode;
|
27
|
+
icon?: ReactNode;
|
28
|
+
label: string;
|
29
|
+
el?: "label" | "div";
|
30
|
+
readOnly?: boolean;
|
31
|
+
className?: string;
|
32
|
+
}) => react_jsx_runtime.JSX.Element;
|
33
|
+
type FieldLabelPropsInternal = {
|
34
|
+
children?: ReactNode;
|
35
|
+
icon?: ReactNode;
|
36
|
+
label?: string;
|
37
|
+
el?: "label" | "div";
|
38
|
+
readOnly?: boolean;
|
39
|
+
};
|
40
|
+
declare const FieldLabelInternal: ({ children, icon, label, el, readOnly, }: FieldLabelPropsInternal) => react_jsx_runtime.JSX.Element;
|
41
|
+
type FieldPropsInternalOptional<ValueType = any, F = Field<any>> = FieldProps<ValueType, F> & {
|
42
|
+
Label?: React.FC<FieldLabelPropsInternal>;
|
43
|
+
label?: string;
|
44
|
+
name?: string;
|
45
|
+
};
|
46
|
+
type FieldPropsInternal<ValueType = any, F = Field<any>> = FieldProps<ValueType, F> & {
|
47
|
+
Label: React.FC<FieldLabelPropsInternal>;
|
48
|
+
label?: string;
|
49
|
+
id: string;
|
50
|
+
name?: string;
|
51
|
+
};
|
52
|
+
declare function AutoFieldPrivate<ValueType = any, FieldType extends Field<ValueType> = Field<ValueType>>(props: FieldPropsInternalOptional<ValueType, FieldType> & {
|
53
|
+
Label?: React.FC<FieldLabelPropsInternal>;
|
54
|
+
}): react_jsx_runtime.JSX.Element;
|
55
|
+
declare function AutoField<ValueType = any, FieldType extends Field<ValueType> = Field<ValueType>>(props: FieldProps<ValueType, FieldType>): react_jsx_runtime.JSX.Element;
|
56
|
+
|
57
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
58
|
+
children: ReactNode;
|
59
|
+
href?: string;
|
60
|
+
onClick?: (e: any) => void | Promise<void>;
|
61
|
+
variant?: "primary" | "secondary";
|
62
|
+
type?: "button" | "submit" | "reset";
|
63
|
+
disabled?: boolean;
|
64
|
+
tabIndex?: number;
|
65
|
+
newTab?: boolean;
|
66
|
+
fullWidth?: boolean;
|
67
|
+
icon?: ReactNode;
|
68
|
+
size?: "medium" | "large";
|
69
|
+
loading?: boolean;
|
70
|
+
}) => react_jsx_runtime.JSX.Element;
|
71
|
+
|
72
|
+
declare const Drawer: {
|
73
|
+
({ children, droppableId: _droppableId, direction, }: {
|
74
|
+
children: ReactNode;
|
75
|
+
droppableId?: string;
|
76
|
+
direction?: "vertical" | "horizontal";
|
77
|
+
}): react_jsx_runtime.JSX.Element;
|
78
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
79
|
+
name: string;
|
80
|
+
children?: (props: {
|
81
|
+
children: ReactNode;
|
82
|
+
name: string;
|
83
|
+
}) => ReactElement;
|
84
|
+
id?: string;
|
85
|
+
label?: string;
|
86
|
+
index: number;
|
87
|
+
isDragDisabled?: boolean;
|
88
|
+
}) => react_jsx_runtime.JSX.Element;
|
89
|
+
};
|
90
|
+
|
91
|
+
type History<D = any> = {
|
92
|
+
id: string;
|
93
|
+
data: D;
|
94
|
+
};
|
95
|
+
type HistoryStore<D = any> = {
|
96
|
+
index: number;
|
97
|
+
hasPast: boolean;
|
98
|
+
hasFuture: boolean;
|
99
|
+
histories: History<D>[];
|
100
|
+
record: (data: D) => void;
|
101
|
+
back: VoidFunction;
|
102
|
+
forward: VoidFunction;
|
103
|
+
currentHistory: History;
|
104
|
+
nextHistory: History<D> | null;
|
105
|
+
prevHistory: History<D> | null;
|
106
|
+
setHistories: (histories: History[]) => void;
|
107
|
+
setHistoryIndex: (index: number) => void;
|
108
|
+
};
|
109
|
+
|
110
|
+
type PathData = Record<string, {
|
111
|
+
path: string[];
|
112
|
+
label: string;
|
113
|
+
}>;
|
114
|
+
type DropZoneContext<UserConfig extends Config = Config> = {
|
115
|
+
data: Data;
|
116
|
+
config: UserConfig;
|
117
|
+
componentState?: Record<string, any>;
|
118
|
+
itemSelector?: ItemSelector | null;
|
119
|
+
setItemSelector?: (newIndex: ItemSelector | null) => void;
|
120
|
+
dispatch?: (action: PuckAction) => void;
|
121
|
+
areaId?: string;
|
122
|
+
draggedItem?: DragStart & Partial<DragUpdate>;
|
123
|
+
placeholderStyle?: CSSProperties;
|
124
|
+
hoveringArea?: string | null;
|
125
|
+
setHoveringArea?: (area: string | null) => void;
|
126
|
+
hoveringZone?: string | null;
|
127
|
+
setHoveringZone?: (zone: string | null) => void;
|
128
|
+
hoveringComponent?: string | null;
|
129
|
+
setHoveringComponent?: (id: string | null) => void;
|
130
|
+
registerZoneArea?: (areaId: string) => void;
|
131
|
+
areasWithZones?: Record<string, boolean>;
|
132
|
+
registerZone?: (zoneCompound: string) => void;
|
133
|
+
unregisterZone?: (zoneCompound: string) => void;
|
134
|
+
activeZones?: Record<string, boolean>;
|
135
|
+
pathData?: PathData;
|
136
|
+
registerPath?: (selector: ItemSelector) => void;
|
137
|
+
mode?: "edit" | "render";
|
138
|
+
zoneWillDrag?: string;
|
139
|
+
setZoneWillDrag?: (zone: string) => void;
|
140
|
+
} | null;
|
141
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
142
|
+
declare const DropZoneProvider: ({ children, value, }: {
|
143
|
+
children: ReactNode;
|
144
|
+
value: DropZoneContext;
|
145
|
+
}) => react_jsx_runtime.JSX.Element;
|
146
|
+
|
147
|
+
declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
148
|
+
|
149
|
+
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
150
|
+
children: ReactNode;
|
151
|
+
href?: string;
|
152
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
153
|
+
variant?: "primary" | "secondary";
|
154
|
+
type?: "button" | "submit" | "reset";
|
155
|
+
disabled?: boolean;
|
156
|
+
tabIndex?: number;
|
157
|
+
newTab?: boolean;
|
158
|
+
fullWidth?: boolean;
|
159
|
+
title: string;
|
160
|
+
}) => react_jsx_runtime.JSX.Element;
|
161
|
+
|
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, dnd, initialHistory, }: {
|
163
|
+
children?: ReactNode;
|
164
|
+
config: UserConfig;
|
165
|
+
data: Partial<UserData>;
|
166
|
+
ui?: Partial<UiState>;
|
167
|
+
onChange?: (data: UserData) => void;
|
168
|
+
onPublish?: (data: UserData) => void;
|
169
|
+
onAction?: OnAction<UserData>;
|
170
|
+
permissions?: Partial<Permissions>;
|
171
|
+
plugins?: Plugin[];
|
172
|
+
overrides?: Partial<Overrides>;
|
173
|
+
renderHeader?: (props: {
|
174
|
+
children: ReactNode;
|
175
|
+
dispatch: (action: PuckAction) => void;
|
176
|
+
state: AppState<UserData>;
|
177
|
+
}) => ReactElement;
|
178
|
+
renderHeaderActions?: (props: {
|
179
|
+
state: AppState<UserData>;
|
180
|
+
dispatch: (action: PuckAction) => void;
|
181
|
+
}) => ReactElement;
|
182
|
+
headerTitle?: string;
|
183
|
+
headerPath?: string;
|
184
|
+
viewports?: Viewports;
|
185
|
+
iframe?: IframeConfig;
|
186
|
+
dnd?: {
|
187
|
+
disableAutoScroll?: boolean;
|
188
|
+
};
|
189
|
+
initialHistory?: {
|
190
|
+
histories: History<any>[];
|
191
|
+
index: number;
|
192
|
+
};
|
193
|
+
}): react_jsx_runtime.JSX.Element;
|
194
|
+
declare namespace Puck {
|
195
|
+
var Components: () => react_jsx_runtime.JSX.Element;
|
196
|
+
var Fields: () => react_jsx_runtime.JSX.Element;
|
197
|
+
var Outline: () => react_jsx_runtime.JSX.Element;
|
198
|
+
var Preview: ({ id }: {
|
199
|
+
id?: string;
|
200
|
+
}) => react_jsx_runtime.JSX.Element;
|
201
|
+
}
|
202
|
+
|
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 }: {
|
204
|
+
config: UserConfig;
|
205
|
+
data: Partial<UserData>;
|
206
|
+
}): react_jsx_runtime.JSX.Element;
|
207
|
+
|
208
|
+
declare function migrate(data: Data): Data;
|
209
|
+
|
210
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
211
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
212
|
+
[key: string]: any;
|
213
|
+
}) => Props[ComponentName];
|
214
|
+
} & {
|
215
|
+
root: (props: RootProps & {
|
216
|
+
[key: string]: any;
|
217
|
+
}) => RootProps;
|
218
|
+
}>;
|
219
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
220
|
+
|
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>>;
|
222
|
+
|
223
|
+
declare const usePuck: () => {
|
224
|
+
appState: AppState;
|
225
|
+
config: Config;
|
226
|
+
dispatch: (action: PuckAction) => void;
|
227
|
+
getPermissions: ({ item, type, }?: {
|
228
|
+
item?: ComponentData;
|
229
|
+
type?: keyof DefaultComponentProps;
|
230
|
+
}) => {
|
231
|
+
[x: string]: boolean | undefined;
|
232
|
+
drag?: boolean | undefined;
|
233
|
+
duplicate?: boolean | undefined;
|
234
|
+
delete?: boolean | undefined;
|
235
|
+
edit?: boolean | undefined;
|
236
|
+
insert?: boolean | undefined;
|
237
|
+
};
|
238
|
+
history: {
|
239
|
+
back: VoidFunction;
|
240
|
+
forward: VoidFunction;
|
241
|
+
setHistories: (histories: History[]) => void;
|
242
|
+
setHistoryIndex: (index: number) => void;
|
243
|
+
hasPast: boolean;
|
244
|
+
hasFuture: boolean;
|
245
|
+
histories: History<any>[];
|
246
|
+
index: number;
|
247
|
+
historyStore: HistoryStore | undefined;
|
248
|
+
};
|
249
|
+
selectedItem: ComponentData<any, string> | null;
|
250
|
+
};
|
251
|
+
|
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,133 +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-DDAd8cys.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-DDAd8cys.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
|
-
outline: RenderFunc;
|
111
|
-
puck: RenderFunc;
|
112
|
-
}>;
|
113
|
-
type FieldRenderFunctions = Omit<{
|
114
|
-
[Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
|
115
|
-
type: Type;
|
116
|
-
}>> & {
|
117
|
-
children: ReactNode;
|
118
|
-
name: string;
|
119
|
-
}>;
|
120
|
-
}, "custom"> & {
|
121
|
-
[key: string]: React.FunctionComponent<FieldProps<any> & {
|
122
|
-
children: ReactNode;
|
123
|
-
name: string;
|
124
|
-
}>;
|
125
|
-
};
|
126
|
-
|
127
|
-
type Plugin = {
|
128
|
-
overrides: Partial<Overrides>;
|
129
|
-
};
|
130
|
-
|
131
8
|
declare const ActionBar: {
|
132
9
|
({ label, children, }: {
|
133
10
|
label?: string;
|
@@ -230,8 +107,6 @@ type HistoryStore<D = any> = {
|
|
230
107
|
setHistoryIndex: (index: number) => void;
|
231
108
|
};
|
232
109
|
|
233
|
-
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
234
|
-
|
235
110
|
type PathData = Record<string, {
|
236
111
|
path: string[];
|
237
112
|
label: string;
|
@@ -284,28 +159,24 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
284
159
|
title: string;
|
285
160
|
}) => react_jsx_runtime.JSX.Element;
|
286
161
|
|
287
|
-
|
288
|
-
enabled?: boolean;
|
289
|
-
};
|
290
|
-
|
291
|
-
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, dnd, initialHistory, }: {
|
292
163
|
children?: ReactNode;
|
293
164
|
config: UserConfig;
|
294
|
-
data: Partial<
|
165
|
+
data: Partial<UserData>;
|
295
166
|
ui?: Partial<UiState>;
|
296
|
-
onChange?: (data:
|
297
|
-
onPublish?: (data:
|
298
|
-
onAction?: OnAction
|
167
|
+
onChange?: (data: UserData) => void;
|
168
|
+
onPublish?: (data: UserData) => void;
|
169
|
+
onAction?: OnAction<UserData>;
|
299
170
|
permissions?: Partial<Permissions>;
|
300
171
|
plugins?: Plugin[];
|
301
172
|
overrides?: Partial<Overrides>;
|
302
173
|
renderHeader?: (props: {
|
303
174
|
children: ReactNode;
|
304
175
|
dispatch: (action: PuckAction) => void;
|
305
|
-
state: AppState
|
176
|
+
state: AppState<UserData>;
|
306
177
|
}) => ReactElement;
|
307
178
|
renderHeaderActions?: (props: {
|
308
|
-
state: AppState
|
179
|
+
state: AppState<UserData>;
|
309
180
|
dispatch: (action: PuckAction) => void;
|
310
181
|
}) => ReactElement;
|
311
182
|
headerTitle?: string;
|
@@ -329,14 +200,14 @@ declare namespace Puck {
|
|
329
200
|
}) => react_jsx_runtime.JSX.Element;
|
330
201
|
}
|
331
202
|
|
332
|
-
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 }: {
|
333
204
|
config: UserConfig;
|
334
|
-
data: Partial<
|
205
|
+
data: Partial<UserData>;
|
335
206
|
}): react_jsx_runtime.JSX.Element;
|
336
207
|
|
337
208
|
declare function migrate(data: Data): Data;
|
338
209
|
|
339
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
210
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
340
211
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
341
212
|
[key: string]: any;
|
342
213
|
}) => Props[ComponentName];
|
@@ -345,13 +216,9 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
345
216
|
[key: string]: any;
|
346
217
|
}) => RootProps;
|
347
218
|
}>;
|
348
|
-
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;
|
349
220
|
|
350
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item:
|
351
|
-
root: RootData<DefaultRootProps> | RootDataWithProps;
|
352
|
-
content: any;
|
353
|
-
zones: Record<string, MappedItem[]>;
|
354
|
-
}>;
|
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>>;
|
355
222
|
|
356
223
|
declare const usePuck: () => {
|
357
224
|
appState: AppState;
|
@@ -379,9 +246,7 @@ declare const usePuck: () => {
|
|
379
246
|
index: number;
|
380
247
|
historyStore: HistoryStore | undefined;
|
381
248
|
};
|
382
|
-
selectedItem: ComponentData<
|
383
|
-
id: string;
|
384
|
-
}> | null;
|
249
|
+
selectedItem: ComponentData<any, string> | null;
|
385
250
|
};
|
386
251
|
|
387
|
-
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 };
|