@measured/puck 0.16.0-canary.60fe631 → 0.16.0-canary.6d43ba0
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-XUGMjfT5.d.mts} +58 -39
- package/dist/Config-XUGMjfT5.d.ts +281 -0
- package/dist/chunk-TM7CT64S.mjs +113 -0
- package/dist/index.css +95 -78
- package/dist/index.d.mts +389 -0
- package/dist/index.d.ts +55 -15
- package/dist/index.js +900 -29094
- package/dist/index.mjs +5855 -0
- package/dist/rsc.d.mts +10 -0
- package/dist/rsc.d.ts +1 -1
- package/dist/rsc.mjs +80 -0
- package/package.json +14 -6
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 DropZoneProps, V as Viewports, c as DefaultComponentProps, d 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 DefaultRootFieldProps, e as ComponentData, R as RootData, f as RootDataWithProps, g as Content } from './Config-XUGMjfT5.js';
|
2
|
+
export { u as Adaptor, t as ArrayField, p as ArrayState, B as BaseData, q as BaseField, l as ComponentConfig, m as ComponentDataMap, w as CustomField, i as DefaultRootProps, h as DefaultRootRenderProps, v as ExternalField, E as ExternalFieldWithAdaptor, x as Fields, o as ItemWithId, M as MappedItem, N as NumberField, O as ObjectField, j as PuckComponent, k as PuckContext, s as RadioField, n as RootDataWithoutProps, S as SelectField, T as TextField, r as TextareaField } from './Config-XUGMjfT5.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,6 +132,23 @@ 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;
|
@@ -176,7 +202,7 @@ declare const Drawer: {
|
|
176
202
|
droppableId?: string;
|
177
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
207
|
children?: (props: {
|
182
208
|
children: ReactNode;
|
@@ -185,6 +211,7 @@ declare const Drawer: {
|
|
185
211
|
id?: string;
|
186
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;
|
@@ -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: {
|
@@ -309,7 +340,7 @@ declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
|
309
340
|
|
310
341
|
declare function migrate(data: Data): Data;
|
311
342
|
|
312
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
343
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
313
344
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
314
345
|
[key: string]: any;
|
315
346
|
}) => Props[ComponentName];
|
@@ -318,18 +349,29 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
318
349
|
[key: string]: any;
|
319
350
|
}) => RootProps;
|
320
351
|
}>;
|
321
|
-
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps =
|
352
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
322
353
|
|
323
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item:
|
324
|
-
root: RootData<
|
325
|
-
content:
|
326
|
-
zones: Record<string,
|
354
|
+
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<{
|
355
|
+
root: RootData<DefaultRootFieldProps> | RootDataWithProps;
|
356
|
+
content: Content<Props>;
|
357
|
+
zones: Record<string, Content<Props>>;
|
327
358
|
}>;
|
328
359
|
|
329
360
|
declare const usePuck: () => {
|
330
361
|
appState: AppState;
|
331
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;
|
@@ -341,9 +383,7 @@ declare const usePuck: () => {
|
|
341
383
|
index: number;
|
342
384
|
historyStore: HistoryStore | undefined;
|
343
385
|
};
|
344
|
-
selectedItem: ComponentData<
|
345
|
-
id: string;
|
346
|
-
}> | null;
|
386
|
+
selectedItem: ComponentData<any, string> | null;
|
347
387
|
};
|
348
388
|
|
349
|
-
export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps,
|
389
|
+
export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Content, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, Permissions, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|