@measured/puck 0.16.0-canary.958dc25 → 0.16.0-canary.abe8c52
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-ab1c145c.d.ts → Config-VOJqVbHe.d.ts} +1 -1
- package/dist/index.d.ts +42 -38
- package/dist/index.js +1677 -2237
- package/dist/rsc.d.ts +1 -1
- package/package.json +4 -4
@@ -259,4 +259,4 @@ type AppState = {
|
|
259
259
|
ui: UiState;
|
260
260
|
};
|
261
261
|
|
262
|
-
export { AppState as A, BaseData as B, Config as C, Data as D, ExternalFieldWithAdaptor as E, Field as F, ItemSelector as I, MappedItem as M, NumberField as N, ObjectField as O, PuckComponent as P,
|
262
|
+
export type { AppState as A, BaseData as B, Config as C, Data as D, ExternalFieldWithAdaptor as E, Field as F, ItemSelector as I, MappedItem as M, NumberField as N, ObjectField as O, PuckComponent as P, RootData as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, DefaultComponentProps as c, DefaultRootProps as d, RootDataWithProps as e, ComponentData as f, Content as g, PuckContext as h, ComponentConfig as i, RootDataWithoutProps as j, ItemWithId as k, ArrayState as l, BaseField as m, TextareaField as n, RadioField as o, ArrayField as p, Adaptor as q, ExternalField as r, CustomField as s, Fields as t };
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
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 { q as Adaptor, p as ArrayField, l as ArrayState, B as BaseData, m as BaseField, i as ComponentConfig, g as Content, s as CustomField, r as ExternalField, E as ExternalFieldWithAdaptor, t as Fields, k as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, h as PuckContext, o as RadioField, j as RootDataWithoutProps, S as SelectField, T as TextField, n as TextareaField } from './Config-
|
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 DefaultRootProps, M as MappedItem, R as RootData, e as RootDataWithProps, f as ComponentData } from './Config-VOJqVbHe.js';
|
2
|
+
export { q as Adaptor, p as ArrayField, l as ArrayState, B as BaseData, m as BaseField, i as ComponentConfig, g as Content, s as CustomField, r as ExternalField, E as ExternalFieldWithAdaptor, t as Fields, k as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, h as PuckContext, o as RadioField, j as RootDataWithoutProps, S as SelectField, T as TextField, n as TextareaField } from './Config-VOJqVbHe.js';
|
3
3
|
import * as react from 'react';
|
4
4
|
import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
@@ -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";
|
@@ -127,9 +128,9 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
127
128
|
children?: ReactNode;
|
128
129
|
icon?: ReactNode;
|
129
130
|
label: string;
|
130
|
-
el?: "label" | "div"
|
131
|
-
readOnly?: boolean
|
132
|
-
className?: string
|
131
|
+
el?: "label" | "div";
|
132
|
+
readOnly?: boolean;
|
133
|
+
className?: string;
|
133
134
|
}) => react_jsx_runtime.JSX.Element;
|
134
135
|
type FieldLabelPropsInternal = {
|
135
136
|
children?: ReactNode;
|
@@ -157,33 +158,33 @@ declare function AutoField<ValueType = any, FieldType extends Field<ValueType> =
|
|
157
158
|
|
158
159
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
159
160
|
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
|
161
|
+
href?: string;
|
162
|
+
onClick?: (e: any) => void | Promise<void>;
|
163
|
+
variant?: "primary" | "secondary";
|
164
|
+
type?: "button" | "submit" | "reset";
|
165
|
+
disabled?: boolean;
|
166
|
+
tabIndex?: number;
|
167
|
+
newTab?: boolean;
|
168
|
+
fullWidth?: boolean;
|
168
169
|
icon?: ReactNode;
|
169
|
-
size?: "medium" | "large"
|
170
|
-
loading?: boolean
|
170
|
+
size?: "medium" | "large";
|
171
|
+
loading?: boolean;
|
171
172
|
}) => react_jsx_runtime.JSX.Element;
|
172
173
|
|
173
174
|
declare const Drawer: {
|
174
175
|
({ children, droppableId: _droppableId, direction, }: {
|
175
176
|
children: ReactNode;
|
176
|
-
droppableId?: string
|
177
|
-
direction?: "vertical" | "horizontal"
|
177
|
+
droppableId?: string;
|
178
|
+
direction?: "vertical" | "horizontal";
|
178
179
|
}): react_jsx_runtime.JSX.Element;
|
179
180
|
Item: ({ name, children, id, label, index, }: {
|
180
181
|
name: string;
|
181
|
-
children?: (
|
182
|
+
children?: (props: {
|
182
183
|
children: ReactNode;
|
183
184
|
name: string;
|
184
|
-
}) => ReactElement
|
185
|
-
id?: string
|
186
|
-
label?: string
|
185
|
+
}) => ReactElement;
|
186
|
+
id?: string;
|
187
|
+
label?: string;
|
187
188
|
index: number;
|
188
189
|
}) => react_jsx_runtime.JSX.Element;
|
189
190
|
};
|
@@ -207,6 +208,8 @@ type HistoryStore<D = any> = {
|
|
207
208
|
setHistoryIndex: (index: number) => void;
|
208
209
|
};
|
209
210
|
|
211
|
+
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
212
|
+
|
210
213
|
type PathData = Record<string, {
|
211
214
|
path: string[];
|
212
215
|
label: string;
|
@@ -238,7 +241,7 @@ type DropZoneContext<UserConfig extends Config = Config> = {
|
|
238
241
|
zoneWillDrag?: string;
|
239
242
|
setZoneWillDrag?: (zone: string) => void;
|
240
243
|
} | null;
|
241
|
-
declare const dropZoneContext: react.Context<DropZoneContext<Config
|
244
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
242
245
|
declare const DropZoneProvider: ({ children, value, }: {
|
243
246
|
children: ReactNode;
|
244
247
|
value: DropZoneContext;
|
@@ -248,14 +251,14 @@ declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
|
248
251
|
|
249
252
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
250
253
|
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
|
254
|
+
href?: string;
|
255
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
256
|
+
variant?: "primary" | "secondary";
|
257
|
+
type?: "button" | "submit" | "reset";
|
258
|
+
disabled?: boolean;
|
259
|
+
tabIndex?: number;
|
260
|
+
newTab?: boolean;
|
261
|
+
fullWidth?: boolean;
|
259
262
|
title: string;
|
260
263
|
}) => react_jsx_runtime.JSX.Element;
|
261
264
|
|
@@ -263,13 +266,14 @@ type IframeConfig = {
|
|
263
266
|
enabled?: boolean;
|
264
267
|
};
|
265
268
|
|
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, }: {
|
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, }: {
|
267
270
|
children?: ReactNode;
|
268
271
|
config: UserConfig;
|
269
272
|
data: Partial<Data>;
|
270
273
|
ui?: Partial<UiState>;
|
271
274
|
onChange?: (data: Data) => void;
|
272
275
|
onPublish?: (data: Data) => void;
|
276
|
+
onAction?: OnAction;
|
273
277
|
plugins?: Plugin[];
|
274
278
|
overrides?: Partial<Overrides>;
|
275
279
|
renderHeader?: (props: {
|
@@ -298,7 +302,7 @@ declare namespace Puck {
|
|
298
302
|
var Fields: () => react_jsx_runtime.JSX.Element;
|
299
303
|
var Outline: () => react_jsx_runtime.JSX.Element;
|
300
304
|
var Preview: ({ id }: {
|
301
|
-
id?: string
|
305
|
+
id?: string;
|
302
306
|
}) => react_jsx_runtime.JSX.Element;
|
303
307
|
}
|
304
308
|
|
@@ -321,29 +325,29 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
321
325
|
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
322
326
|
|
323
327
|
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
|
324
|
-
root:
|
325
|
-
content: any
|
328
|
+
root: RootData<DefaultRootProps> | RootDataWithProps;
|
329
|
+
content: any;
|
326
330
|
zones: Record<string, MappedItem[]>;
|
327
331
|
}>;
|
328
332
|
|
329
333
|
declare const usePuck: () => {
|
330
334
|
appState: AppState;
|
331
|
-
config: Config
|
335
|
+
config: Config;
|
332
336
|
dispatch: (action: PuckAction) => void;
|
333
337
|
history: {
|
334
338
|
back: VoidFunction;
|
335
339
|
forward: VoidFunction;
|
336
|
-
setHistories: (histories: History
|
340
|
+
setHistories: (histories: History[]) => void;
|
337
341
|
setHistoryIndex: (index: number) => void;
|
338
342
|
hasPast: boolean;
|
339
343
|
hasFuture: boolean;
|
340
344
|
histories: History<any>[];
|
341
345
|
index: number;
|
342
|
-
historyStore: HistoryStore
|
346
|
+
historyStore: HistoryStore | undefined;
|
343
347
|
};
|
344
348
|
selectedItem: ComponentData<DefaultComponentProps & {
|
345
349
|
id: string;
|
346
350
|
}> | null;
|
347
351
|
};
|
348
352
|
|
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 };
|
353
|
+
export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, MappedItem, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|