@measured/puck 0.16.0-canary.958dc25 → 0.16.0-canary.96ee704
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-ab1c145c.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 +95 -78
- package/dist/index.d.mts +391 -0
- package/dist/index.d.ts +82 -40
- package/dist/index.js +873 -29665
- 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 +15 -9
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
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
|
-
import { ReactNode, ReactElement,
|
4
|
+
import { ReactNode, ReactElement, SyntheticEvent, CSSProperties } from 'react';
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
6
6
|
import { DragStart, DragUpdate } from '@measured/dnd';
|
7
7
|
|
@@ -10,6 +10,7 @@ type InsertAction = {
|
|
10
10
|
componentType: string;
|
11
11
|
destinationIndex: number;
|
12
12
|
destinationZone: string;
|
13
|
+
id?: string;
|
13
14
|
};
|
14
15
|
type DuplicateAction = {
|
15
16
|
type: "duplicate";
|
@@ -80,6 +81,10 @@ type Overrides = OverridesGeneric<{
|
|
80
81
|
actions: ReactNode;
|
81
82
|
children: ReactNode;
|
82
83
|
}>;
|
84
|
+
actionBar: RenderFunc<{
|
85
|
+
label?: string;
|
86
|
+
children: ReactNode;
|
87
|
+
}>;
|
83
88
|
headerActions: RenderFunc<{
|
84
89
|
children: ReactNode;
|
85
90
|
}>;
|
@@ -102,6 +107,10 @@ type Overrides = OverridesGeneric<{
|
|
102
107
|
children: ReactNode;
|
103
108
|
name: string;
|
104
109
|
}>;
|
110
|
+
iframe: RenderFunc<{
|
111
|
+
children: ReactNode;
|
112
|
+
document?: Document;
|
113
|
+
}>;
|
105
114
|
outline: RenderFunc;
|
106
115
|
puck: RenderFunc;
|
107
116
|
}>;
|
@@ -123,13 +132,30 @@ type Plugin = {
|
|
123
132
|
overrides: Partial<Overrides>;
|
124
133
|
};
|
125
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
|
+
|
126
152
|
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
127
153
|
children?: ReactNode;
|
128
154
|
icon?: ReactNode;
|
129
155
|
label: string;
|
130
|
-
el?: "label" | "div"
|
131
|
-
readOnly?: boolean
|
132
|
-
className?: string
|
156
|
+
el?: "label" | "div";
|
157
|
+
readOnly?: boolean;
|
158
|
+
className?: string;
|
133
159
|
}) => react_jsx_runtime.JSX.Element;
|
134
160
|
type FieldLabelPropsInternal = {
|
135
161
|
children?: ReactNode;
|
@@ -157,34 +183,35 @@ declare function AutoField<ValueType = any, FieldType extends Field<ValueType> =
|
|
157
183
|
|
158
184
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
159
185
|
children: ReactNode;
|
160
|
-
href?: string
|
161
|
-
onClick?: (
|
162
|
-
variant?: "primary" | "secondary"
|
163
|
-
type?: "button" | "submit" | "reset"
|
164
|
-
disabled?: boolean
|
165
|
-
tabIndex?: number
|
166
|
-
newTab?: boolean
|
167
|
-
fullWidth?: boolean
|
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;
|
168
194
|
icon?: ReactNode;
|
169
|
-
size?: "medium" | "large"
|
170
|
-
loading?: boolean
|
195
|
+
size?: "medium" | "large";
|
196
|
+
loading?: boolean;
|
171
197
|
}) => react_jsx_runtime.JSX.Element;
|
172
198
|
|
173
199
|
declare const Drawer: {
|
174
200
|
({ children, droppableId: _droppableId, direction, }: {
|
175
201
|
children: ReactNode;
|
176
|
-
droppableId?: string
|
177
|
-
direction?: "vertical" | "horizontal"
|
202
|
+
droppableId?: string;
|
203
|
+
direction?: "vertical" | "horizontal";
|
178
204
|
}): react_jsx_runtime.JSX.Element;
|
179
|
-
Item: ({ name, children, id, label, index, }: {
|
205
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
180
206
|
name: string;
|
181
|
-
children?: (
|
207
|
+
children?: (props: {
|
182
208
|
children: ReactNode;
|
183
209
|
name: string;
|
184
|
-
}) => ReactElement
|
185
|
-
id?: string
|
186
|
-
label?: string
|
210
|
+
}) => ReactElement;
|
211
|
+
id?: string;
|
212
|
+
label?: string;
|
187
213
|
index: number;
|
214
|
+
isDragDisabled?: boolean;
|
188
215
|
}) => react_jsx_runtime.JSX.Element;
|
189
216
|
};
|
190
217
|
|
@@ -207,6 +234,8 @@ type HistoryStore<D = any> = {
|
|
207
234
|
setHistoryIndex: (index: number) => void;
|
208
235
|
};
|
209
236
|
|
237
|
+
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
238
|
+
|
210
239
|
type PathData = Record<string, {
|
211
240
|
path: string[];
|
212
241
|
label: string;
|
@@ -238,7 +267,7 @@ type DropZoneContext<UserConfig extends Config = Config> = {
|
|
238
267
|
zoneWillDrag?: string;
|
239
268
|
setZoneWillDrag?: (zone: string) => void;
|
240
269
|
} | null;
|
241
|
-
declare const dropZoneContext: react.Context<DropZoneContext<Config
|
270
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
242
271
|
declare const DropZoneProvider: ({ children, value, }: {
|
243
272
|
children: ReactNode;
|
244
273
|
value: DropZoneContext;
|
@@ -248,14 +277,14 @@ declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
|
248
277
|
|
249
278
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
250
279
|
children: ReactNode;
|
251
|
-
href?: string
|
252
|
-
onClick?: (
|
253
|
-
variant?: "primary" | "secondary"
|
254
|
-
type?: "button" | "submit" | "reset"
|
255
|
-
disabled?: boolean
|
256
|
-
tabIndex?: number
|
257
|
-
newTab?: boolean
|
258
|
-
fullWidth?: boolean
|
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;
|
259
288
|
title: string;
|
260
289
|
}) => react_jsx_runtime.JSX.Element;
|
261
290
|
|
@@ -263,13 +292,15 @@ type IframeConfig = {
|
|
263
292
|
enabled?: boolean;
|
264
293
|
};
|
265
294
|
|
266
|
-
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, 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, }: {
|
267
296
|
children?: ReactNode;
|
268
297
|
config: UserConfig;
|
269
298
|
data: Partial<Data>;
|
270
299
|
ui?: Partial<UiState>;
|
271
300
|
onChange?: (data: Data) => void;
|
272
301
|
onPublish?: (data: Data) => void;
|
302
|
+
onAction?: OnAction;
|
303
|
+
permissions?: Partial<Permissions>;
|
273
304
|
plugins?: Plugin[];
|
274
305
|
overrides?: Partial<Overrides>;
|
275
306
|
renderHeader?: (props: {
|
@@ -298,7 +329,7 @@ declare namespace Puck {
|
|
298
329
|
var Fields: () => react_jsx_runtime.JSX.Element;
|
299
330
|
var Outline: () => react_jsx_runtime.JSX.Element;
|
300
331
|
var Preview: ({ id }: {
|
301
|
-
id?: string
|
332
|
+
id?: string;
|
302
333
|
}) => react_jsx_runtime.JSX.Element;
|
303
334
|
}
|
304
335
|
|
@@ -321,29 +352,40 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
321
352
|
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
322
353
|
|
323
354
|
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
|
324
|
-
root:
|
325
|
-
content: any
|
355
|
+
root: RootData<DefaultRootProps> | RootDataWithProps;
|
356
|
+
content: any;
|
326
357
|
zones: Record<string, MappedItem[]>;
|
327
358
|
}>;
|
328
359
|
|
329
360
|
declare const usePuck: () => {
|
330
361
|
appState: AppState;
|
331
|
-
config: Config
|
362
|
+
config: Config;
|
332
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
|
+
};
|
333
375
|
history: {
|
334
376
|
back: VoidFunction;
|
335
377
|
forward: VoidFunction;
|
336
|
-
setHistories: (histories: History
|
378
|
+
setHistories: (histories: History[]) => void;
|
337
379
|
setHistoryIndex: (index: number) => void;
|
338
380
|
hasPast: boolean;
|
339
381
|
hasFuture: boolean;
|
340
382
|
histories: History<any>[];
|
341
383
|
index: number;
|
342
|
-
historyStore: HistoryStore
|
384
|
+
historyStore: HistoryStore | undefined;
|
343
385
|
};
|
344
386
|
selectedItem: ComponentData<DefaultComponentProps & {
|
345
387
|
id: string;
|
346
388
|
}> | null;
|
347
389
|
};
|
348
390
|
|
349
|
-
export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, FieldPropsInternal, History, IconButton, MappedItem, Plugin, Puck, 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 };
|