@measured/puck 0.16.0-canary.1beaf6b → 0.16.0-canary.2bef00b
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/{Config-VOJqVbHe.d.ts → Config-CkVFT1_w.d.mts} +15 -1
- package/dist/Config-CkVFT1_w.d.ts +276 -0
- package/dist/chunk-TM7CT64S.mjs +113 -0
- package/dist/index.css +31 -20
- package/dist/index.d.mts +391 -0
- package/dist/index.d.ts +30 -7
- package/dist/index.js +401 -28675
- package/dist/index.mjs +5843 -0
- package/dist/rsc.d.mts +10 -0
- package/dist/rsc.d.ts +1 -1
- package/dist/rsc.mjs +80 -0
- package/package.json +12 -6
package/dist/index.d.mts
ADDED
@@ -0,0 +1,391 @@
|
|
1
|
+
import { U as UiState, D as Data, A as AppState, I as ItemSelector, F as Field, a as FieldProps, C as Config, b as DropZoneProps, P as Permissions, V as Viewports, c as DefaultComponentProps, d as DefaultRootProps, M as MappedItem, R as RootData, e as RootDataWithProps, f as ComponentData } from './Config-CkVFT1_w.mjs';
|
2
|
+
export { r as Adaptor, q as ArrayField, m as ArrayState, B as BaseData, n as BaseField, j as ComponentConfig, g as Content, t as CustomField, s as ExternalField, E as ExternalFieldWithAdaptor, u as Fields, l as ItemWithId, N as NumberField, O as ObjectField, h as PuckComponent, i as PuckContext, p as RadioField, k as RootDataWithoutProps, S as SelectField, T as TextField, o as TextareaField } from './Config-CkVFT1_w.mjs';
|
3
|
+
import * as react from 'react';
|
4
|
+
import { ReactNode, ReactElement, SyntheticEvent, CSSProperties } from 'react';
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
6
|
+
import { DragStart, DragUpdate } from '@measured/dnd';
|
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
|
+
declare const ActionBar: {
|
136
|
+
({ label, children, }: {
|
137
|
+
label?: string;
|
138
|
+
children?: ReactNode;
|
139
|
+
}): react_jsx_runtime.JSX.Element;
|
140
|
+
Action: ({ children, label, onClick, }: {
|
141
|
+
children: ReactNode;
|
142
|
+
label?: string;
|
143
|
+
onClick: (e: SyntheticEvent) => void;
|
144
|
+
}) => react_jsx_runtime.JSX.Element;
|
145
|
+
};
|
146
|
+
declare const Action: ({ children, label, onClick, }: {
|
147
|
+
children: ReactNode;
|
148
|
+
label?: string;
|
149
|
+
onClick: (e: SyntheticEvent) => void;
|
150
|
+
}) => react_jsx_runtime.JSX.Element;
|
151
|
+
|
152
|
+
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
153
|
+
children?: ReactNode;
|
154
|
+
icon?: ReactNode;
|
155
|
+
label: string;
|
156
|
+
el?: "label" | "div";
|
157
|
+
readOnly?: boolean;
|
158
|
+
className?: string;
|
159
|
+
}) => react_jsx_runtime.JSX.Element;
|
160
|
+
type FieldLabelPropsInternal = {
|
161
|
+
children?: ReactNode;
|
162
|
+
icon?: ReactNode;
|
163
|
+
label?: string;
|
164
|
+
el?: "label" | "div";
|
165
|
+
readOnly?: boolean;
|
166
|
+
};
|
167
|
+
declare const FieldLabelInternal: ({ children, icon, label, el, readOnly, }: FieldLabelPropsInternal) => react_jsx_runtime.JSX.Element;
|
168
|
+
type FieldPropsInternalOptional<ValueType = any, F = Field<any>> = FieldProps<ValueType, F> & {
|
169
|
+
Label?: React.FC<FieldLabelPropsInternal>;
|
170
|
+
label?: string;
|
171
|
+
name?: string;
|
172
|
+
};
|
173
|
+
type FieldPropsInternal<ValueType = any, F = Field<any>> = FieldProps<ValueType, F> & {
|
174
|
+
Label: React.FC<FieldLabelPropsInternal>;
|
175
|
+
label?: string;
|
176
|
+
id: string;
|
177
|
+
name?: string;
|
178
|
+
};
|
179
|
+
declare function AutoFieldPrivate<ValueType = any, FieldType extends Field<ValueType> = Field<ValueType>>(props: FieldPropsInternalOptional<ValueType, FieldType> & {
|
180
|
+
Label?: React.FC<FieldLabelPropsInternal>;
|
181
|
+
}): react_jsx_runtime.JSX.Element;
|
182
|
+
declare function AutoField<ValueType = any, FieldType extends Field<ValueType> = Field<ValueType>>(props: FieldProps<ValueType, FieldType>): react_jsx_runtime.JSX.Element;
|
183
|
+
|
184
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
185
|
+
children: ReactNode;
|
186
|
+
href?: string;
|
187
|
+
onClick?: (e: any) => void | Promise<void>;
|
188
|
+
variant?: "primary" | "secondary";
|
189
|
+
type?: "button" | "submit" | "reset";
|
190
|
+
disabled?: boolean;
|
191
|
+
tabIndex?: number;
|
192
|
+
newTab?: boolean;
|
193
|
+
fullWidth?: boolean;
|
194
|
+
icon?: ReactNode;
|
195
|
+
size?: "medium" | "large";
|
196
|
+
loading?: boolean;
|
197
|
+
}) => react_jsx_runtime.JSX.Element;
|
198
|
+
|
199
|
+
declare const Drawer: {
|
200
|
+
({ children, droppableId: _droppableId, direction, }: {
|
201
|
+
children: ReactNode;
|
202
|
+
droppableId?: string;
|
203
|
+
direction?: "vertical" | "horizontal";
|
204
|
+
}): react_jsx_runtime.JSX.Element;
|
205
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
206
|
+
name: string;
|
207
|
+
children?: (props: {
|
208
|
+
children: ReactNode;
|
209
|
+
name: string;
|
210
|
+
}) => ReactElement;
|
211
|
+
id?: string;
|
212
|
+
label?: string;
|
213
|
+
index: number;
|
214
|
+
isDragDisabled?: boolean;
|
215
|
+
}) => react_jsx_runtime.JSX.Element;
|
216
|
+
};
|
217
|
+
|
218
|
+
type History<D = any> = {
|
219
|
+
id: string;
|
220
|
+
data: D;
|
221
|
+
};
|
222
|
+
type HistoryStore<D = any> = {
|
223
|
+
index: number;
|
224
|
+
hasPast: boolean;
|
225
|
+
hasFuture: boolean;
|
226
|
+
histories: History<D>[];
|
227
|
+
record: (data: D) => void;
|
228
|
+
back: VoidFunction;
|
229
|
+
forward: VoidFunction;
|
230
|
+
currentHistory: History;
|
231
|
+
nextHistory: History<D> | null;
|
232
|
+
prevHistory: History<D> | null;
|
233
|
+
setHistories: (histories: History[]) => void;
|
234
|
+
setHistoryIndex: (index: number) => void;
|
235
|
+
};
|
236
|
+
|
237
|
+
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
238
|
+
|
239
|
+
type PathData = Record<string, {
|
240
|
+
path: string[];
|
241
|
+
label: string;
|
242
|
+
}>;
|
243
|
+
type DropZoneContext<UserConfig extends Config = Config> = {
|
244
|
+
data: Data;
|
245
|
+
config: UserConfig;
|
246
|
+
componentState?: Record<string, any>;
|
247
|
+
itemSelector?: ItemSelector | null;
|
248
|
+
setItemSelector?: (newIndex: ItemSelector | null) => void;
|
249
|
+
dispatch?: (action: PuckAction) => void;
|
250
|
+
areaId?: string;
|
251
|
+
draggedItem?: DragStart & Partial<DragUpdate>;
|
252
|
+
placeholderStyle?: CSSProperties;
|
253
|
+
hoveringArea?: string | null;
|
254
|
+
setHoveringArea?: (area: string | null) => void;
|
255
|
+
hoveringZone?: string | null;
|
256
|
+
setHoveringZone?: (zone: string | null) => void;
|
257
|
+
hoveringComponent?: string | null;
|
258
|
+
setHoveringComponent?: (id: string | null) => void;
|
259
|
+
registerZoneArea?: (areaId: string) => void;
|
260
|
+
areasWithZones?: Record<string, boolean>;
|
261
|
+
registerZone?: (zoneCompound: string) => void;
|
262
|
+
unregisterZone?: (zoneCompound: string) => void;
|
263
|
+
activeZones?: Record<string, boolean>;
|
264
|
+
pathData?: PathData;
|
265
|
+
registerPath?: (selector: ItemSelector) => void;
|
266
|
+
mode?: "edit" | "render";
|
267
|
+
zoneWillDrag?: string;
|
268
|
+
setZoneWillDrag?: (zone: string) => void;
|
269
|
+
} | null;
|
270
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
271
|
+
declare const DropZoneProvider: ({ children, value, }: {
|
272
|
+
children: ReactNode;
|
273
|
+
value: DropZoneContext;
|
274
|
+
}) => react_jsx_runtime.JSX.Element;
|
275
|
+
|
276
|
+
declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
277
|
+
|
278
|
+
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
279
|
+
children: ReactNode;
|
280
|
+
href?: string;
|
281
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
282
|
+
variant?: "primary" | "secondary";
|
283
|
+
type?: "button" | "submit" | "reset";
|
284
|
+
disabled?: boolean;
|
285
|
+
tabIndex?: number;
|
286
|
+
newTab?: boolean;
|
287
|
+
fullWidth?: boolean;
|
288
|
+
title: string;
|
289
|
+
}) => react_jsx_runtime.JSX.Element;
|
290
|
+
|
291
|
+
type IframeConfig = {
|
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, }: {
|
296
|
+
children?: ReactNode;
|
297
|
+
config: UserConfig;
|
298
|
+
data: Partial<Data>;
|
299
|
+
ui?: Partial<UiState>;
|
300
|
+
onChange?: (data: Data) => void;
|
301
|
+
onPublish?: (data: Data) => void;
|
302
|
+
onAction?: OnAction;
|
303
|
+
permissions?: Partial<Permissions>;
|
304
|
+
plugins?: Plugin[];
|
305
|
+
overrides?: Partial<Overrides>;
|
306
|
+
renderHeader?: (props: {
|
307
|
+
children: ReactNode;
|
308
|
+
dispatch: (action: PuckAction) => void;
|
309
|
+
state: AppState;
|
310
|
+
}) => ReactElement;
|
311
|
+
renderHeaderActions?: (props: {
|
312
|
+
state: AppState;
|
313
|
+
dispatch: (action: PuckAction) => void;
|
314
|
+
}) => ReactElement;
|
315
|
+
headerTitle?: string;
|
316
|
+
headerPath?: string;
|
317
|
+
viewports?: Viewports;
|
318
|
+
iframe?: IframeConfig;
|
319
|
+
dnd?: {
|
320
|
+
disableAutoScroll?: boolean;
|
321
|
+
};
|
322
|
+
initialHistory?: {
|
323
|
+
histories: History<any>[];
|
324
|
+
index: number;
|
325
|
+
};
|
326
|
+
}): react_jsx_runtime.JSX.Element;
|
327
|
+
declare namespace Puck {
|
328
|
+
var Components: () => react_jsx_runtime.JSX.Element;
|
329
|
+
var Fields: () => react_jsx_runtime.JSX.Element;
|
330
|
+
var Outline: () => react_jsx_runtime.JSX.Element;
|
331
|
+
var Preview: ({ id }: {
|
332
|
+
id?: string;
|
333
|
+
}) => react_jsx_runtime.JSX.Element;
|
334
|
+
}
|
335
|
+
|
336
|
+
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
337
|
+
config: UserConfig;
|
338
|
+
data: Partial<Data>;
|
339
|
+
}): react_jsx_runtime.JSX.Element;
|
340
|
+
|
341
|
+
declare function migrate(data: Data): Data;
|
342
|
+
|
343
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = Partial<{
|
344
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
345
|
+
[key: string]: any;
|
346
|
+
}) => Props[ComponentName];
|
347
|
+
} & {
|
348
|
+
root: (props: RootProps & {
|
349
|
+
[key: string]: any;
|
350
|
+
}) => RootProps;
|
351
|
+
}>;
|
352
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
353
|
+
|
354
|
+
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
|
355
|
+
root: RootData<DefaultRootProps> | RootDataWithProps;
|
356
|
+
content: any;
|
357
|
+
zones: Record<string, MappedItem[]>;
|
358
|
+
}>;
|
359
|
+
|
360
|
+
declare const usePuck: () => {
|
361
|
+
appState: AppState;
|
362
|
+
config: Config;
|
363
|
+
dispatch: (action: PuckAction) => void;
|
364
|
+
getPermissions: ({ item, type, }?: {
|
365
|
+
item?: ComponentData;
|
366
|
+
type?: keyof DefaultComponentProps;
|
367
|
+
}) => {
|
368
|
+
[x: string]: boolean | undefined;
|
369
|
+
drag?: boolean | undefined;
|
370
|
+
duplicate?: boolean | undefined;
|
371
|
+
delete?: boolean | undefined;
|
372
|
+
edit?: boolean | undefined;
|
373
|
+
insert?: boolean | undefined;
|
374
|
+
};
|
375
|
+
history: {
|
376
|
+
back: VoidFunction;
|
377
|
+
forward: VoidFunction;
|
378
|
+
setHistories: (histories: History[]) => void;
|
379
|
+
setHistoryIndex: (index: number) => void;
|
380
|
+
hasPast: boolean;
|
381
|
+
hasFuture: boolean;
|
382
|
+
histories: History<any>[];
|
383
|
+
index: number;
|
384
|
+
historyStore: HistoryStore | undefined;
|
385
|
+
};
|
386
|
+
selectedItem: ComponentData<DefaultComponentProps & {
|
387
|
+
id: string;
|
388
|
+
}> | null;
|
389
|
+
};
|
390
|
+
|
391
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, MappedItem, Permissions, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { U as UiState, D as Data, A as AppState, I as ItemSelector, F as Field, a as FieldProps, C as Config, b as DropZoneProps, V as Viewports, c as DefaultComponentProps, d as DefaultRootProps, M as MappedItem, R as RootData, e as RootDataWithProps, f as ComponentData } from './Config-
|
2
|
-
export {
|
1
|
+
import { U as UiState, D as Data, A as AppState, I as ItemSelector, F as Field, a as FieldProps, C as Config, b as DropZoneProps, P as Permissions, V as Viewports, c as DefaultComponentProps, d as DefaultRootProps, M as MappedItem, R as RootData, e as RootDataWithProps, f as ComponentData } from './Config-CkVFT1_w.js';
|
2
|
+
export { r as Adaptor, q as ArrayField, m as ArrayState, B as BaseData, n as BaseField, j as ComponentConfig, g as Content, t as CustomField, s as ExternalField, E as ExternalFieldWithAdaptor, u as Fields, l as ItemWithId, N as NumberField, O as ObjectField, h as PuckComponent, i as PuckContext, p as RadioField, k as RootDataWithoutProps, S as SelectField, T as TextField, o as TextareaField } from './Config-CkVFT1_w.js';
|
3
3
|
import * as react from 'react';
|
4
4
|
import { ReactNode, ReactElement, SyntheticEvent, CSSProperties } from 'react';
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
@@ -81,6 +81,10 @@ type Overrides = OverridesGeneric<{
|
|
81
81
|
actions: ReactNode;
|
82
82
|
children: ReactNode;
|
83
83
|
}>;
|
84
|
+
actionBar: RenderFunc<{
|
85
|
+
label?: string;
|
86
|
+
children: ReactNode;
|
87
|
+
}>;
|
84
88
|
headerActions: RenderFunc<{
|
85
89
|
children: ReactNode;
|
86
90
|
}>;
|
@@ -103,6 +107,10 @@ type Overrides = OverridesGeneric<{
|
|
103
107
|
children: ReactNode;
|
104
108
|
name: string;
|
105
109
|
}>;
|
110
|
+
iframe: RenderFunc<{
|
111
|
+
children: ReactNode;
|
112
|
+
document?: Document;
|
113
|
+
}>;
|
106
114
|
outline: RenderFunc;
|
107
115
|
puck: RenderFunc;
|
108
116
|
}>;
|
@@ -129,13 +137,15 @@ declare const ActionBar: {
|
|
129
137
|
label?: string;
|
130
138
|
children?: ReactNode;
|
131
139
|
}): react_jsx_runtime.JSX.Element;
|
132
|
-
Action: ({ children, onClick, }: {
|
140
|
+
Action: ({ children, label, onClick, }: {
|
133
141
|
children: ReactNode;
|
142
|
+
label?: string;
|
134
143
|
onClick: (e: SyntheticEvent) => void;
|
135
144
|
}) => react_jsx_runtime.JSX.Element;
|
136
145
|
};
|
137
|
-
declare const Action: ({ children, onClick, }: {
|
146
|
+
declare const Action: ({ children, label, onClick, }: {
|
138
147
|
children: ReactNode;
|
148
|
+
label?: string;
|
139
149
|
onClick: (e: SyntheticEvent) => void;
|
140
150
|
}) => react_jsx_runtime.JSX.Element;
|
141
151
|
|
@@ -192,7 +202,7 @@ declare const Drawer: {
|
|
192
202
|
droppableId?: string;
|
193
203
|
direction?: "vertical" | "horizontal";
|
194
204
|
}): react_jsx_runtime.JSX.Element;
|
195
|
-
Item: ({ name, children, id, label, index, }: {
|
205
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
196
206
|
name: string;
|
197
207
|
children?: (props: {
|
198
208
|
children: ReactNode;
|
@@ -201,6 +211,7 @@ declare const Drawer: {
|
|
201
211
|
id?: string;
|
202
212
|
label?: string;
|
203
213
|
index: number;
|
214
|
+
isDragDisabled?: boolean;
|
204
215
|
}) => react_jsx_runtime.JSX.Element;
|
205
216
|
};
|
206
217
|
|
@@ -281,7 +292,7 @@ type IframeConfig = {
|
|
281
292
|
enabled?: boolean;
|
282
293
|
};
|
283
294
|
|
284
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistory, }: {
|
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, }: {
|
285
296
|
children?: ReactNode;
|
286
297
|
config: UserConfig;
|
287
298
|
data: Partial<Data>;
|
@@ -289,6 +300,7 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
|
|
289
300
|
onChange?: (data: Data) => void;
|
290
301
|
onPublish?: (data: Data) => void;
|
291
302
|
onAction?: OnAction;
|
303
|
+
permissions?: Partial<Permissions>;
|
292
304
|
plugins?: Plugin[];
|
293
305
|
overrides?: Partial<Overrides>;
|
294
306
|
renderHeader?: (props: {
|
@@ -349,6 +361,17 @@ declare const usePuck: () => {
|
|
349
361
|
appState: AppState;
|
350
362
|
config: Config;
|
351
363
|
dispatch: (action: PuckAction) => void;
|
364
|
+
getPermissions: ({ item, type, }?: {
|
365
|
+
item?: ComponentData;
|
366
|
+
type?: keyof DefaultComponentProps;
|
367
|
+
}) => {
|
368
|
+
[x: string]: boolean | undefined;
|
369
|
+
drag?: boolean | undefined;
|
370
|
+
duplicate?: boolean | undefined;
|
371
|
+
delete?: boolean | undefined;
|
372
|
+
edit?: boolean | undefined;
|
373
|
+
insert?: boolean | undefined;
|
374
|
+
};
|
352
375
|
history: {
|
353
376
|
back: VoidFunction;
|
354
377
|
forward: VoidFunction;
|
@@ -365,4 +388,4 @@ declare const usePuck: () => {
|
|
365
388
|
}> | null;
|
366
389
|
};
|
367
390
|
|
368
|
-
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, MappedItem, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|
391
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, MappedItem, Permissions, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|