@measured/puck 0.16.0-canary.7c79787 → 0.16.0-canary.937bb92
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 +95 -78
- package/dist/index.d.mts +252 -0
- package/dist/index.d.ts +45 -146
- package/dist/index.js +875 -29061
- package/dist/index.mjs +5887 -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-VOJqVbHe.d.ts +0 -262
package/dist/index.d.ts
CHANGED
@@ -1,128 +1,26 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
3
|
-
import * as react from 'react';
|
4
|
-
import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } 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
|
-
|
9
|
-
|
10
|
-
|
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
|
-
headerActions: RenderFunc<{
|
85
|
-
children: ReactNode;
|
86
|
-
}>;
|
87
|
-
preview: RenderFunc;
|
88
|
-
fields: RenderFunc<{
|
89
|
-
children: ReactNode;
|
90
|
-
isLoading: boolean;
|
91
|
-
itemSelector?: ItemSelector | null;
|
92
|
-
}>;
|
93
|
-
fieldLabel: RenderFunc<{
|
8
|
+
declare const ActionBar: {
|
9
|
+
({ label, children, }: {
|
10
|
+
label?: string;
|
94
11
|
children?: ReactNode;
|
95
|
-
|
96
|
-
|
97
|
-
el?: "label" | "div";
|
98
|
-
readOnly?: boolean;
|
99
|
-
className?: string;
|
100
|
-
}>;
|
101
|
-
components: RenderFunc;
|
102
|
-
componentItem: RenderFunc<{
|
103
|
-
children: ReactNode;
|
104
|
-
name: string;
|
105
|
-
}>;
|
106
|
-
outline: RenderFunc;
|
107
|
-
puck: RenderFunc;
|
108
|
-
}>;
|
109
|
-
type FieldRenderFunctions = Omit<{
|
110
|
-
[Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
|
111
|
-
type: Type;
|
112
|
-
}>> & {
|
113
|
-
children: ReactNode;
|
114
|
-
name: string;
|
115
|
-
}>;
|
116
|
-
}, "custom"> & {
|
117
|
-
[key: string]: React.FunctionComponent<FieldProps<any> & {
|
12
|
+
}): react_jsx_runtime.JSX.Element;
|
13
|
+
Action: ({ children, label, onClick, }: {
|
118
14
|
children: ReactNode;
|
119
|
-
|
120
|
-
|
121
|
-
};
|
122
|
-
|
123
|
-
type Plugin = {
|
124
|
-
overrides: Partial<Overrides>;
|
15
|
+
label?: string;
|
16
|
+
onClick: (e: SyntheticEvent) => void;
|
17
|
+
}) => react_jsx_runtime.JSX.Element;
|
125
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;
|
126
24
|
|
127
25
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
128
26
|
children?: ReactNode;
|
@@ -177,7 +75,7 @@ declare const Drawer: {
|
|
177
75
|
droppableId?: string;
|
178
76
|
direction?: "vertical" | "horizontal";
|
179
77
|
}): react_jsx_runtime.JSX.Element;
|
180
|
-
Item: ({ name, children, id, label, index, }: {
|
78
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
181
79
|
name: string;
|
182
80
|
children?: (props: {
|
183
81
|
children: ReactNode;
|
@@ -186,6 +84,7 @@ declare const Drawer: {
|
|
186
84
|
id?: string;
|
187
85
|
label?: string;
|
188
86
|
index: number;
|
87
|
+
isDragDisabled?: boolean;
|
189
88
|
}) => react_jsx_runtime.JSX.Element;
|
190
89
|
};
|
191
90
|
|
@@ -208,8 +107,6 @@ type HistoryStore<D = any> = {
|
|
208
107
|
setHistoryIndex: (index: number) => void;
|
209
108
|
};
|
210
109
|
|
211
|
-
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
212
|
-
|
213
110
|
type PathData = Record<string, {
|
214
111
|
path: string[];
|
215
112
|
label: string;
|
@@ -262,27 +159,24 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
262
159
|
title: string;
|
263
160
|
}) => react_jsx_runtime.JSX.Element;
|
264
161
|
|
265
|
-
|
266
|
-
enabled?: boolean;
|
267
|
-
};
|
268
|
-
|
269
|
-
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, }: {
|
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, }: {
|
270
163
|
children?: ReactNode;
|
271
164
|
config: UserConfig;
|
272
|
-
data: Partial<
|
165
|
+
data: Partial<UserData>;
|
273
166
|
ui?: Partial<UiState>;
|
274
|
-
onChange?: (data:
|
275
|
-
onPublish?: (data:
|
276
|
-
onAction?: OnAction
|
167
|
+
onChange?: (data: UserData) => void;
|
168
|
+
onPublish?: (data: UserData) => void;
|
169
|
+
onAction?: OnAction<UserData>;
|
170
|
+
permissions?: Partial<Permissions>;
|
277
171
|
plugins?: Plugin[];
|
278
172
|
overrides?: Partial<Overrides>;
|
279
173
|
renderHeader?: (props: {
|
280
174
|
children: ReactNode;
|
281
175
|
dispatch: (action: PuckAction) => void;
|
282
|
-
state: AppState
|
176
|
+
state: AppState<UserData>;
|
283
177
|
}) => ReactElement;
|
284
178
|
renderHeaderActions?: (props: {
|
285
|
-
state: AppState
|
179
|
+
state: AppState<UserData>;
|
286
180
|
dispatch: (action: PuckAction) => void;
|
287
181
|
}) => ReactElement;
|
288
182
|
headerTitle?: string;
|
@@ -306,14 +200,14 @@ declare namespace Puck {
|
|
306
200
|
}) => react_jsx_runtime.JSX.Element;
|
307
201
|
}
|
308
202
|
|
309
|
-
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 }: {
|
310
204
|
config: UserConfig;
|
311
|
-
data: Partial<
|
205
|
+
data: Partial<UserData>;
|
312
206
|
}): react_jsx_runtime.JSX.Element;
|
313
207
|
|
314
208
|
declare function migrate(data: Data): Data;
|
315
209
|
|
316
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
210
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
317
211
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
318
212
|
[key: string]: any;
|
319
213
|
}) => Props[ComponentName];
|
@@ -322,18 +216,25 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
322
216
|
[key: string]: any;
|
323
217
|
}) => RootProps;
|
324
218
|
}>;
|
325
|
-
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;
|
326
220
|
|
327
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item:
|
328
|
-
root: RootData<DefaultRootProps> | RootDataWithProps;
|
329
|
-
content: any;
|
330
|
-
zones: Record<string, MappedItem[]>;
|
331
|
-
}>;
|
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>>;
|
332
222
|
|
333
223
|
declare const usePuck: () => {
|
334
224
|
appState: AppState;
|
335
225
|
config: Config;
|
336
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
|
+
};
|
337
238
|
history: {
|
338
239
|
back: VoidFunction;
|
339
240
|
forward: VoidFunction;
|
@@ -345,9 +246,7 @@ declare const usePuck: () => {
|
|
345
246
|
index: number;
|
346
247
|
historyStore: HistoryStore | undefined;
|
347
248
|
};
|
348
|
-
selectedItem: ComponentData<
|
349
|
-
id: string;
|
350
|
-
}> | null;
|
249
|
+
selectedItem: ComponentData<any, string> | null;
|
351
250
|
};
|
352
251
|
|
353
|
-
export { 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 };
|