@measured/puck 0.14.0-canary.1c4c076 → 0.14.0-canary.26bc4ff
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -0
- package/dist/{Config-ab049d49.d.ts → Config-09628f3c.d.ts} +39 -26
- package/dist/index.css +315 -221
- package/dist/index.d.ts +86 -49
- package/dist/index.js +1414 -673
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +4 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
@@ -1,45 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
1
|
+
import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-09628f3c.js';
|
2
|
+
export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-09628f3c.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
|
-
import { ReactNode,
|
6
|
-
import { DragStart, DragUpdate } from '@
|
7
|
-
|
8
|
-
type PathData = Record<string, {
|
9
|
-
path: string[];
|
10
|
-
label: string;
|
11
|
-
}>;
|
12
|
-
type DropZoneContext<UserConfig extends Config<any, any, any> = Config<any, any, any>> = {
|
13
|
-
data: Data;
|
14
|
-
config: UserConfig;
|
15
|
-
componentState?: Record<string, any>;
|
16
|
-
itemSelector?: ItemSelector | null;
|
17
|
-
setItemSelector?: (newIndex: ItemSelector | null) => void;
|
18
|
-
dispatch?: (action: PuckAction) => void;
|
19
|
-
areaId?: string;
|
20
|
-
draggedItem?: DragStart & Partial<DragUpdate>;
|
21
|
-
placeholderStyle?: CSSProperties;
|
22
|
-
hoveringArea?: string | null;
|
23
|
-
setHoveringArea?: (area: string | null) => void;
|
24
|
-
hoveringZone?: string | null;
|
25
|
-
setHoveringZone?: (zone: string | null) => void;
|
26
|
-
hoveringComponent?: string | null;
|
27
|
-
setHoveringComponent?: (id: string | null) => void;
|
28
|
-
registerZoneArea?: (areaId: string) => void;
|
29
|
-
areasWithZones?: Record<string, boolean>;
|
30
|
-
registerZone?: (zoneCompound: string) => void;
|
31
|
-
unregisterZone?: (zoneCompound: string) => void;
|
32
|
-
activeZones?: Record<string, boolean>;
|
33
|
-
pathData?: PathData;
|
34
|
-
registerPath?: (selector: ItemSelector) => void;
|
35
|
-
mode?: "edit" | "render";
|
36
|
-
disableZoom?: boolean;
|
37
|
-
} | null;
|
38
|
-
declare const dropZoneContext: react.Context<DropZoneContext<Config<any, any, any>>>;
|
39
|
-
declare const DropZoneProvider: ({ children, value, }: {
|
40
|
-
children: ReactNode;
|
41
|
-
value: DropZoneContext;
|
42
|
-
}) => react_jsx_runtime.JSX.Element;
|
5
|
+
import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
|
6
|
+
import { DragStart, DragUpdate } from '@measured/dnd';
|
43
7
|
|
44
8
|
type InsertAction = {
|
45
9
|
type: "insert";
|
@@ -105,7 +69,7 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
|
|
105
69
|
href?: string | undefined;
|
106
70
|
onClick?: ((e: any) => void | Promise<void>) | undefined;
|
107
71
|
variant?: "primary" | "secondary" | undefined;
|
108
|
-
type?: "
|
72
|
+
type?: "button" | "submit" | "reset" | undefined;
|
109
73
|
disabled?: boolean | undefined;
|
110
74
|
tabIndex?: number | undefined;
|
111
75
|
newTab?: boolean | undefined;
|
@@ -119,25 +83,65 @@ declare const Drawer: {
|
|
119
83
|
({ children, droppableId, direction, }: {
|
120
84
|
children: ReactNode;
|
121
85
|
droppableId?: string | undefined;
|
122
|
-
direction?: "
|
86
|
+
direction?: "vertical" | "horizontal" | undefined;
|
123
87
|
}): react_jsx_runtime.JSX.Element;
|
124
|
-
Item: ({ name, children, id, index, }: {
|
88
|
+
Item: ({ name, children, id, label, index, }: {
|
125
89
|
name: string;
|
126
90
|
children?: ((props: {
|
127
91
|
children: ReactNode;
|
128
92
|
name: string;
|
129
93
|
}) => ReactElement) | undefined;
|
130
94
|
id?: string | undefined;
|
95
|
+
label?: string | undefined;
|
131
96
|
index: number;
|
132
97
|
}) => react_jsx_runtime.JSX.Element;
|
133
98
|
};
|
134
99
|
|
100
|
+
type PathData = Record<string, {
|
101
|
+
path: string[];
|
102
|
+
label: string;
|
103
|
+
}>;
|
104
|
+
type DropZoneContext<UserConfig extends Config = Config> = {
|
105
|
+
data: Data;
|
106
|
+
config: UserConfig;
|
107
|
+
componentState?: Record<string, any>;
|
108
|
+
itemSelector?: ItemSelector | null;
|
109
|
+
setItemSelector?: (newIndex: ItemSelector | null) => void;
|
110
|
+
dispatch?: (action: PuckAction) => void;
|
111
|
+
areaId?: string;
|
112
|
+
draggedItem?: DragStart & Partial<DragUpdate>;
|
113
|
+
placeholderStyle?: CSSProperties;
|
114
|
+
hoveringArea?: string | null;
|
115
|
+
setHoveringArea?: (area: string | null) => void;
|
116
|
+
hoveringZone?: string | null;
|
117
|
+
setHoveringZone?: (zone: string | null) => void;
|
118
|
+
hoveringComponent?: string | null;
|
119
|
+
setHoveringComponent?: (id: string | null) => void;
|
120
|
+
registerZoneArea?: (areaId: string) => void;
|
121
|
+
areasWithZones?: Record<string, boolean>;
|
122
|
+
registerZone?: (zoneCompound: string) => void;
|
123
|
+
unregisterZone?: (zoneCompound: string) => void;
|
124
|
+
activeZones?: Record<string, boolean>;
|
125
|
+
pathData?: PathData;
|
126
|
+
registerPath?: (selector: ItemSelector) => void;
|
127
|
+
mode?: "edit" | "render";
|
128
|
+
zoneWillDrag?: string;
|
129
|
+
setZoneWillDrag?: (zone: string) => void;
|
130
|
+
} | null;
|
131
|
+
declare const dropZoneContext: react.Context<DropZoneContext<Config<Record<string, any>, DefaultRootProps, string>>>;
|
132
|
+
declare const DropZoneProvider: ({ children, value, }: {
|
133
|
+
children: ReactNode;
|
134
|
+
value: DropZoneContext;
|
135
|
+
}) => react_jsx_runtime.JSX.Element;
|
136
|
+
|
137
|
+
declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
138
|
+
|
135
139
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
136
140
|
children: ReactNode;
|
137
141
|
href?: string | undefined;
|
138
142
|
onClick?: ((e: SyntheticEvent) => void | Promise<void>) | undefined;
|
139
143
|
variant?: "primary" | "secondary" | undefined;
|
140
|
-
type?: "
|
144
|
+
type?: "button" | "submit" | "reset" | undefined;
|
141
145
|
disabled?: boolean | undefined;
|
142
146
|
tabIndex?: number | undefined;
|
143
147
|
newTab?: boolean | undefined;
|
@@ -221,7 +225,11 @@ type Plugin = {
|
|
221
225
|
overrides: Partial<Overrides>;
|
222
226
|
};
|
223
227
|
|
224
|
-
|
228
|
+
type IframeConfig = {
|
229
|
+
enabled?: boolean;
|
230
|
+
};
|
231
|
+
|
232
|
+
declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, }: {
|
225
233
|
children?: ReactNode;
|
226
234
|
config: UserConfig;
|
227
235
|
data: Data;
|
@@ -241,6 +249,8 @@ declare function Puck<UserConfig extends Config<any, any, any> = Config<any, any
|
|
241
249
|
}) => ReactElement;
|
242
250
|
headerTitle?: string;
|
243
251
|
headerPath?: string;
|
252
|
+
viewports?: Viewports;
|
253
|
+
iframe?: IframeConfig;
|
244
254
|
}): react_jsx_runtime.JSX.Element;
|
245
255
|
declare namespace Puck {
|
246
256
|
var Components: () => react_jsx_runtime.JSX.Element;
|
@@ -251,7 +261,7 @@ declare namespace Puck {
|
|
251
261
|
}) => react_jsx_runtime.JSX.Element;
|
252
262
|
}
|
253
263
|
|
254
|
-
declare function Render<UserConfig extends Config
|
264
|
+
declare function Render<UserConfig extends Config = Config>({ config, data, }: {
|
255
265
|
config: UserConfig;
|
256
266
|
data: Data;
|
257
267
|
}): react_jsx_runtime.JSX.Element;
|
@@ -269,16 +279,43 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
|
|
269
279
|
}>;
|
270
280
|
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
|
271
281
|
|
272
|
-
declare
|
282
|
+
declare function resolveAllData(data: Data, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
|
273
283
|
root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
|
274
284
|
content: any[];
|
275
285
|
zones: Record<string, MappedItem[]>;
|
276
286
|
}>;
|
277
287
|
|
288
|
+
type History<D = any> = {
|
289
|
+
id: string;
|
290
|
+
data: D;
|
291
|
+
};
|
292
|
+
type HistoryStore<D = any> = {
|
293
|
+
index: number;
|
294
|
+
currentHistory: History;
|
295
|
+
hasPast: boolean;
|
296
|
+
hasFuture: boolean;
|
297
|
+
record: (data: D) => void;
|
298
|
+
back: VoidFunction;
|
299
|
+
forward: VoidFunction;
|
300
|
+
nextHistory: History<D> | null;
|
301
|
+
prevHistory: History<D> | null;
|
302
|
+
histories: History<D>[];
|
303
|
+
};
|
304
|
+
|
305
|
+
type PuckHistory = {
|
306
|
+
back: VoidFunction;
|
307
|
+
forward: VoidFunction;
|
308
|
+
historyStore: HistoryStore;
|
309
|
+
};
|
310
|
+
|
278
311
|
declare const usePuck: () => {
|
279
312
|
appState: AppState;
|
280
|
-
config: Config<
|
313
|
+
config: Config<Record<string, any>, DefaultRootProps, string>;
|
281
314
|
dispatch: (action: PuckAction) => void;
|
315
|
+
history: Partial<PuckHistory>;
|
316
|
+
selectedItem: ComponentData<DefaultComponentProps & {
|
317
|
+
id: string;
|
318
|
+
}> | null;
|
282
319
|
};
|
283
320
|
|
284
|
-
export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|
321
|
+
export { AppState, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|