@measured/puck 0.16.0-canary.6386bd1 → 0.16.0-canary.6d43ba0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +52 -15
- package/dist/index.js +881 -29070
- 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
|
|
@@ -265,7 +292,7 @@ type IframeConfig = {
|
|
265
292
|
enabled?: boolean;
|
266
293
|
};
|
267
294
|
|
268
|
-
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, }: {
|
269
296
|
children?: ReactNode;
|
270
297
|
config: UserConfig;
|
271
298
|
data: Partial<Data>;
|
@@ -273,6 +300,7 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
|
|
273
300
|
onChange?: (data: Data) => void;
|
274
301
|
onPublish?: (data: Data) => void;
|
275
302
|
onAction?: OnAction;
|
303
|
+
permissions?: Partial<Permissions>;
|
276
304
|
plugins?: Plugin[];
|
277
305
|
overrides?: Partial<Overrides>;
|
278
306
|
renderHeader?: (props: {
|
@@ -312,7 +340,7 @@ declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
|
312
340
|
|
313
341
|
declare function migrate(data: Data): Data;
|
314
342
|
|
315
|
-
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends
|
343
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
|
316
344
|
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
317
345
|
[key: string]: any;
|
318
346
|
}) => Props[ComponentName];
|
@@ -321,18 +349,29 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
321
349
|
[key: string]: any;
|
322
350
|
}) => RootProps;
|
323
351
|
}>;
|
324
|
-
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;
|
325
353
|
|
326
|
-
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item:
|
327
|
-
root: RootData<
|
328
|
-
content:
|
329
|
-
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>>;
|
330
358
|
}>;
|
331
359
|
|
332
360
|
declare const usePuck: () => {
|
333
361
|
appState: AppState;
|
334
362
|
config: Config;
|
335
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
|
+
};
|
336
375
|
history: {
|
337
376
|
back: VoidFunction;
|
338
377
|
forward: VoidFunction;
|
@@ -344,9 +383,7 @@ declare const usePuck: () => {
|
|
344
383
|
index: number;
|
345
384
|
historyStore: HistoryStore | undefined;
|
346
385
|
};
|
347
|
-
selectedItem: ComponentData<
|
348
|
-
id: string;
|
349
|
-
}> | null;
|
386
|
+
selectedItem: ComponentData<any, string> | null;
|
350
387
|
};
|
351
388
|
|
352
|
-
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 };
|