@measured/puck 0.16.0-canary.958dc25 → 0.16.0-canary.c7007ac
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 +41 -38
- package/dist/index.js +1610 -2189
- 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';
|
@@ -127,9 +127,9 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
127
127
|
children?: ReactNode;
|
128
128
|
icon?: ReactNode;
|
129
129
|
label: string;
|
130
|
-
el?: "label" | "div"
|
131
|
-
readOnly?: boolean
|
132
|
-
className?: string
|
130
|
+
el?: "label" | "div";
|
131
|
+
readOnly?: boolean;
|
132
|
+
className?: string;
|
133
133
|
}) => react_jsx_runtime.JSX.Element;
|
134
134
|
type FieldLabelPropsInternal = {
|
135
135
|
children?: ReactNode;
|
@@ -157,33 +157,33 @@ declare function AutoField<ValueType = any, FieldType extends Field<ValueType> =
|
|
157
157
|
|
158
158
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
159
159
|
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
|
160
|
+
href?: string;
|
161
|
+
onClick?: (e: any) => void | Promise<void>;
|
162
|
+
variant?: "primary" | "secondary";
|
163
|
+
type?: "button" | "submit" | "reset";
|
164
|
+
disabled?: boolean;
|
165
|
+
tabIndex?: number;
|
166
|
+
newTab?: boolean;
|
167
|
+
fullWidth?: boolean;
|
168
168
|
icon?: ReactNode;
|
169
|
-
size?: "medium" | "large"
|
170
|
-
loading?: boolean
|
169
|
+
size?: "medium" | "large";
|
170
|
+
loading?: boolean;
|
171
171
|
}) => react_jsx_runtime.JSX.Element;
|
172
172
|
|
173
173
|
declare const Drawer: {
|
174
174
|
({ children, droppableId: _droppableId, direction, }: {
|
175
175
|
children: ReactNode;
|
176
|
-
droppableId?: string
|
177
|
-
direction?: "vertical" | "horizontal"
|
176
|
+
droppableId?: string;
|
177
|
+
direction?: "vertical" | "horizontal";
|
178
178
|
}): react_jsx_runtime.JSX.Element;
|
179
179
|
Item: ({ name, children, id, label, index, }: {
|
180
180
|
name: string;
|
181
|
-
children?: (
|
181
|
+
children?: (props: {
|
182
182
|
children: ReactNode;
|
183
183
|
name: string;
|
184
|
-
}) => ReactElement
|
185
|
-
id?: string
|
186
|
-
label?: string
|
184
|
+
}) => ReactElement;
|
185
|
+
id?: string;
|
186
|
+
label?: string;
|
187
187
|
index: number;
|
188
188
|
}) => react_jsx_runtime.JSX.Element;
|
189
189
|
};
|
@@ -207,6 +207,8 @@ type HistoryStore<D = any> = {
|
|
207
207
|
setHistoryIndex: (index: number) => void;
|
208
208
|
};
|
209
209
|
|
210
|
+
type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
|
211
|
+
|
210
212
|
type PathData = Record<string, {
|
211
213
|
path: string[];
|
212
214
|
label: string;
|
@@ -238,7 +240,7 @@ type DropZoneContext<UserConfig extends Config = Config> = {
|
|
238
240
|
zoneWillDrag?: string;
|
239
241
|
setZoneWillDrag?: (zone: string) => void;
|
240
242
|
} | null;
|
241
|
-
declare const dropZoneContext: react.Context<DropZoneContext<Config
|
243
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
|
242
244
|
declare const DropZoneProvider: ({ children, value, }: {
|
243
245
|
children: ReactNode;
|
244
246
|
value: DropZoneContext;
|
@@ -248,14 +250,14 @@ declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
|
248
250
|
|
249
251
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
250
252
|
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
|
253
|
+
href?: string;
|
254
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
255
|
+
variant?: "primary" | "secondary";
|
256
|
+
type?: "button" | "submit" | "reset";
|
257
|
+
disabled?: boolean;
|
258
|
+
tabIndex?: number;
|
259
|
+
newTab?: boolean;
|
260
|
+
fullWidth?: boolean;
|
259
261
|
title: string;
|
260
262
|
}) => react_jsx_runtime.JSX.Element;
|
261
263
|
|
@@ -263,13 +265,14 @@ type IframeConfig = {
|
|
263
265
|
enabled?: boolean;
|
264
266
|
};
|
265
267
|
|
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, }: {
|
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, }: {
|
267
269
|
children?: ReactNode;
|
268
270
|
config: UserConfig;
|
269
271
|
data: Partial<Data>;
|
270
272
|
ui?: Partial<UiState>;
|
271
273
|
onChange?: (data: Data) => void;
|
272
274
|
onPublish?: (data: Data) => void;
|
275
|
+
onAction?: OnAction;
|
273
276
|
plugins?: Plugin[];
|
274
277
|
overrides?: Partial<Overrides>;
|
275
278
|
renderHeader?: (props: {
|
@@ -298,7 +301,7 @@ declare namespace Puck {
|
|
298
301
|
var Fields: () => react_jsx_runtime.JSX.Element;
|
299
302
|
var Outline: () => react_jsx_runtime.JSX.Element;
|
300
303
|
var Preview: ({ id }: {
|
301
|
-
id?: string
|
304
|
+
id?: string;
|
302
305
|
}) => react_jsx_runtime.JSX.Element;
|
303
306
|
}
|
304
307
|
|
@@ -321,29 +324,29 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
321
324
|
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
|
322
325
|
|
323
326
|
declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
|
324
|
-
root:
|
325
|
-
content: any
|
327
|
+
root: RootData<DefaultRootProps> | RootDataWithProps;
|
328
|
+
content: any;
|
326
329
|
zones: Record<string, MappedItem[]>;
|
327
330
|
}>;
|
328
331
|
|
329
332
|
declare const usePuck: () => {
|
330
333
|
appState: AppState;
|
331
|
-
config: Config
|
334
|
+
config: Config;
|
332
335
|
dispatch: (action: PuckAction) => void;
|
333
336
|
history: {
|
334
337
|
back: VoidFunction;
|
335
338
|
forward: VoidFunction;
|
336
|
-
setHistories: (histories: History
|
339
|
+
setHistories: (histories: History[]) => void;
|
337
340
|
setHistoryIndex: (index: number) => void;
|
338
341
|
hasPast: boolean;
|
339
342
|
hasFuture: boolean;
|
340
343
|
histories: History<any>[];
|
341
344
|
index: number;
|
342
|
-
historyStore: HistoryStore
|
345
|
+
historyStore: HistoryStore | undefined;
|
343
346
|
};
|
344
347
|
selectedItem: ComponentData<DefaultComponentProps & {
|
345
348
|
id: string;
|
346
349
|
}> | null;
|
347
350
|
};
|
348
351
|
|
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 };
|
352
|
+
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 };
|