@measured/puck 0.16.0-canary.ef2e5ec → 0.16.0-canary.f761e5f
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 +107 -198
- package/dist/index.js +1050 -29736
- package/dist/index.mjs +5900 -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 +17 -9
- package/dist/Config-041c35a2.d.ts +0 -262
package/dist/index.d.ts
CHANGED
@@ -1,76 +1,34 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
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';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
|
-
import { ReactNode, ReactElement, CSSProperties
|
5
|
+
import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
6
6
|
import { DragStart, DragUpdate } from '@measured/dnd';
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
};
|
19
|
-
type ReplaceAction = {
|
20
|
-
type: "replace";
|
21
|
-
destinationIndex: number;
|
22
|
-
destinationZone: string;
|
23
|
-
data: any;
|
24
|
-
};
|
25
|
-
type ReorderAction = {
|
26
|
-
type: "reorder";
|
27
|
-
sourceIndex: number;
|
28
|
-
destinationIndex: number;
|
29
|
-
destinationZone: string;
|
30
|
-
};
|
31
|
-
type MoveAction = {
|
32
|
-
type: "move";
|
33
|
-
sourceIndex: number;
|
34
|
-
sourceZone: string;
|
35
|
-
destinationIndex: number;
|
36
|
-
destinationZone: string;
|
37
|
-
};
|
38
|
-
type RemoveAction = {
|
39
|
-
type: "remove";
|
40
|
-
index: number;
|
41
|
-
zone: string;
|
42
|
-
};
|
43
|
-
type SetUiAction = {
|
44
|
-
type: "setUi";
|
45
|
-
ui: Partial<UiState> | ((previous: UiState) => Partial<UiState>);
|
46
|
-
};
|
47
|
-
type SetDataAction = {
|
48
|
-
type: "setData";
|
49
|
-
data: Partial<Data> | ((previous: Data) => Partial<Data>);
|
50
|
-
};
|
51
|
-
type SetAction = {
|
52
|
-
type: "set";
|
53
|
-
state: Partial<AppState> | ((previous: AppState) => Partial<AppState>);
|
54
|
-
};
|
55
|
-
type RegisterZoneAction = {
|
56
|
-
type: "registerZone";
|
57
|
-
zone: string;
|
58
|
-
};
|
59
|
-
type UnregisterZoneAction = {
|
60
|
-
type: "unregisterZone";
|
61
|
-
zone: string;
|
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;
|
62
18
|
};
|
63
|
-
|
64
|
-
|
65
|
-
|
19
|
+
declare const Action: ({ children, label, onClick, }: {
|
20
|
+
children: ReactNode;
|
21
|
+
label?: string;
|
22
|
+
onClick: (e: SyntheticEvent) => void;
|
23
|
+
}) => react_jsx_runtime.JSX.Element;
|
66
24
|
|
67
25
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
68
26
|
children?: ReactNode;
|
69
27
|
icon?: ReactNode;
|
70
28
|
label: string;
|
71
|
-
el?: "label" | "div"
|
72
|
-
readOnly?: boolean
|
73
|
-
className?: string
|
29
|
+
el?: "label" | "div";
|
30
|
+
readOnly?: boolean;
|
31
|
+
className?: string;
|
74
32
|
}) => react_jsx_runtime.JSX.Element;
|
75
33
|
type FieldLabelPropsInternal = {
|
76
34
|
children?: ReactNode;
|
@@ -98,37 +56,57 @@ declare function AutoField<ValueType = any, FieldType extends Field<ValueType> =
|
|
98
56
|
|
99
57
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
100
58
|
children: ReactNode;
|
101
|
-
href?: string
|
102
|
-
onClick?: (
|
103
|
-
variant?: "primary" | "secondary"
|
104
|
-
type?: "button" | "submit" | "reset"
|
105
|
-
disabled?: boolean
|
106
|
-
tabIndex?: number
|
107
|
-
newTab?: boolean
|
108
|
-
fullWidth?: boolean
|
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;
|
109
67
|
icon?: ReactNode;
|
110
|
-
size?: "medium" | "large"
|
111
|
-
loading?: boolean
|
68
|
+
size?: "medium" | "large";
|
69
|
+
loading?: boolean;
|
112
70
|
}) => react_jsx_runtime.JSX.Element;
|
113
71
|
|
114
72
|
declare const Drawer: {
|
115
73
|
({ children, droppableId: _droppableId, direction, }: {
|
116
74
|
children: ReactNode;
|
117
|
-
droppableId?: string
|
118
|
-
direction?: "vertical" | "horizontal"
|
75
|
+
droppableId?: string;
|
76
|
+
direction?: "vertical" | "horizontal";
|
119
77
|
}): react_jsx_runtime.JSX.Element;
|
120
|
-
Item: ({ name, children, id, label, index, }: {
|
78
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
121
79
|
name: string;
|
122
|
-
children?: (
|
80
|
+
children?: (props: {
|
123
81
|
children: ReactNode;
|
124
82
|
name: string;
|
125
|
-
}) => ReactElement
|
126
|
-
id?: string
|
127
|
-
label?: string
|
83
|
+
}) => ReactElement;
|
84
|
+
id?: string;
|
85
|
+
label?: string;
|
128
86
|
index: number;
|
87
|
+
isDragDisabled?: boolean;
|
129
88
|
}) => react_jsx_runtime.JSX.Element;
|
130
89
|
};
|
131
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
|
+
|
132
110
|
type PathData = Record<string, {
|
133
111
|
path: string[];
|
134
112
|
label: string;
|
@@ -160,7 +138,7 @@ type DropZoneContext<UserConfig extends Config = Config> = {
|
|
160
138
|
zoneWillDrag?: string;
|
161
139
|
setZoneWillDrag?: (zone: string) => void;
|
162
140
|
} | null;
|
163
|
-
declare const dropZoneContext: react.Context<DropZoneContext<Config
|
141
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
164
142
|
declare const DropZoneProvider: ({ children, value, }: {
|
165
143
|
children: ReactNode;
|
166
144
|
value: DropZoneContext;
|
@@ -170,113 +148,35 @@ declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
|
170
148
|
|
171
149
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
172
150
|
children: ReactNode;
|
173
|
-
href?: string
|
174
|
-
onClick?: (
|
175
|
-
variant?: "primary" | "secondary"
|
176
|
-
type?: "button" | "submit" | "reset"
|
177
|
-
disabled?: boolean
|
178
|
-
tabIndex?: number
|
179
|
-
newTab?: boolean
|
180
|
-
fullWidth?: boolean
|
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;
|
181
159
|
title: string;
|
182
160
|
}) => react_jsx_runtime.JSX.Element;
|
183
161
|
|
184
|
-
|
185
|
-
[key: string]: any;
|
186
|
-
} = {
|
187
|
-
children: ReactNode;
|
188
|
-
}> = (props: Props) => ReactElement;
|
189
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
190
|
-
type OverrideKey = (typeof overrideKeys)[number];
|
191
|
-
type OverridesGeneric<Shape extends {
|
192
|
-
[key in OverrideKey]: any;
|
193
|
-
}> = Shape;
|
194
|
-
type Overrides = OverridesGeneric<{
|
195
|
-
fieldTypes: Partial<FieldRenderFunctions>;
|
196
|
-
header: RenderFunc<{
|
197
|
-
actions: ReactNode;
|
198
|
-
children: ReactNode;
|
199
|
-
}>;
|
200
|
-
headerActions: RenderFunc<{
|
201
|
-
children: ReactNode;
|
202
|
-
}>;
|
203
|
-
preview: RenderFunc;
|
204
|
-
fields: RenderFunc<{
|
205
|
-
children: ReactNode;
|
206
|
-
isLoading: boolean;
|
207
|
-
itemSelector?: ItemSelector | null;
|
208
|
-
}>;
|
209
|
-
fieldLabel: RenderFunc<{
|
210
|
-
children?: ReactNode;
|
211
|
-
icon?: ReactNode;
|
212
|
-
label: string;
|
213
|
-
el?: "label" | "div";
|
214
|
-
readOnly?: boolean;
|
215
|
-
className?: string;
|
216
|
-
}>;
|
217
|
-
components: RenderFunc;
|
218
|
-
componentItem: RenderFunc<{
|
219
|
-
children: ReactNode;
|
220
|
-
name: string;
|
221
|
-
}>;
|
222
|
-
outline: RenderFunc;
|
223
|
-
puck: RenderFunc;
|
224
|
-
}>;
|
225
|
-
type FieldRenderFunctions = Omit<{
|
226
|
-
[Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
|
227
|
-
type: Type;
|
228
|
-
}>> & {
|
229
|
-
children: ReactNode;
|
230
|
-
name: string;
|
231
|
-
}>;
|
232
|
-
}, "custom"> & {
|
233
|
-
[key: string]: React.FunctionComponent<FieldProps<any> & {
|
234
|
-
children: ReactNode;
|
235
|
-
name: string;
|
236
|
-
}>;
|
237
|
-
};
|
238
|
-
|
239
|
-
type Plugin = {
|
240
|
-
overrides: Partial<Overrides>;
|
241
|
-
};
|
242
|
-
|
243
|
-
type History<D = any> = {
|
244
|
-
id: string;
|
245
|
-
data: D;
|
246
|
-
};
|
247
|
-
type HistoryStore<D = any> = {
|
248
|
-
index: number;
|
249
|
-
currentHistory: History;
|
250
|
-
hasPast: boolean;
|
251
|
-
hasFuture: boolean;
|
252
|
-
record: (data: D) => void;
|
253
|
-
back: VoidFunction;
|
254
|
-
forward: VoidFunction;
|
255
|
-
nextHistory: History<D> | null;
|
256
|
-
prevHistory: History<D> | null;
|
257
|
-
histories: History<D>[];
|
258
|
-
};
|
259
|
-
|
260
|
-
type IframeConfig = {
|
261
|
-
enabled?: boolean;
|
262
|
-
};
|
263
|
-
|
264
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistories, }: {
|
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, }: {
|
265
163
|
children?: ReactNode;
|
266
164
|
config: UserConfig;
|
267
|
-
data: Partial<
|
165
|
+
data: Partial<UserData>;
|
268
166
|
ui?: Partial<UiState>;
|
269
|
-
onChange?: (data:
|
270
|
-
onPublish?: (data:
|
167
|
+
onChange?: (data: UserData) => void;
|
168
|
+
onPublish?: (data: UserData) => void;
|
169
|
+
onAction?: OnAction<UserData>;
|
170
|
+
permissions?: Partial<Permissions>;
|
271
171
|
plugins?: Plugin[];
|
272
172
|
overrides?: Partial<Overrides>;
|
273
173
|
renderHeader?: (props: {
|
274
174
|
children: ReactNode;
|
275
175
|
dispatch: (action: PuckAction) => void;
|
276
|
-
state: AppState
|
176
|
+
state: AppState<UserData>;
|
277
177
|
}) => ReactElement;
|
278
178
|
renderHeaderActions?: (props: {
|
279
|
-
state: AppState
|
179
|
+
state: AppState<UserData>;
|
280
180
|
dispatch: (action: PuckAction) => void;
|
281
181
|
}) => ReactElement;
|
282
182
|
headerTitle?: string;
|
@@ -286,7 +186,7 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
|
|
286
186
|
dnd?: {
|
287
187
|
disableAutoScroll?: boolean;
|
288
188
|
};
|
289
|
-
|
189
|
+
initialHistory?: {
|
290
190
|
histories: History<any>[];
|
291
191
|
index: number;
|
292
192
|
};
|
@@ -296,18 +196,18 @@ declare namespace Puck {
|
|
296
196
|
var Fields: () => react_jsx_runtime.JSX.Element;
|
297
197
|
var Outline: () => react_jsx_runtime.JSX.Element;
|
298
198
|
var Preview: ({ id }: {
|
299
|
-
id?: string
|
199
|
+
id?: string;
|
300
200
|
}) => react_jsx_runtime.JSX.Element;
|
301
201
|
}
|
302
202
|
|
303
|
-
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 }: {
|
304
204
|
config: UserConfig;
|
305
|
-
data: Partial<
|
205
|
+
data: Partial<UserData>;
|
306
206
|
}): react_jsx_runtime.JSX.Element;
|
307
207
|
|
308
208
|
declare function migrate(data: Data): Data;
|
309
209
|
|
310
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
210
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
311
211
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
312
212
|
[key: string]: any;
|
313
213
|
}) => Props[ComponentName];
|
@@ -316,28 +216,37 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
316
216
|
[key: string]: any;
|
317
217
|
}) => RootProps;
|
318
218
|
}>;
|
319
|
-
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps =
|
320
|
-
|
321
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
|
322
|
-
root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
|
323
|
-
content: any[];
|
324
|
-
zones: Record<string, MappedItem[]>;
|
325
|
-
}>;
|
219
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
326
220
|
|
327
|
-
|
328
|
-
back: VoidFunction;
|
329
|
-
forward: VoidFunction;
|
330
|
-
historyStore: HistoryStore;
|
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
|
-
config: Config
|
225
|
+
config: Config;
|
336
226
|
dispatch: (action: PuckAction) => void;
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
}
|
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;
|
341
250
|
};
|
342
251
|
|
343
|
-
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 };
|