@measured/puck 0.13.0-canary.b95050d → 0.13.0-canary.ecb276c
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-b8c102e9.d.ts → Config-4367c689.d.ts} +18 -4
- package/dist/index.css +531 -502
- package/dist/index.d.ts +122 -32
- package/dist/index.js +2171 -1928
- package/dist/rsc.d.ts +3 -3
- package/dist/rsc.js +4 -1
- package/package.json +1 -3
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { D as Data, C as Config, I as ItemSelector, U as UiState, A as AppState,
|
2
|
-
export {
|
1
|
+
import { D as Data, C as Config, I as ItemSelector, U as UiState, A as AppState, F as Field, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-4367c689.js';
|
2
|
+
export { g as Adaptor, f as ArrayField, r as ArrayState, n as BaseData, B as BaseField, m as ComponentConfig, o as ComponentData, k as Content, i as CustomField, s as DropZone, h as ExternalField, E as ExternalFieldWithAdaptor, j as Fields, q as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, l as PuckContext, e as RadioField, p as RootDataWithoutProps, S as SelectField, T as TextField, d as TextareaField } from './Config-4367c689.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
|
-
import { ReactNode, CSSProperties,
|
5
|
+
import { ReactNode, CSSProperties, ReactElement, SyntheticEvent } from 'react';
|
6
6
|
import { DragStart, DragUpdate } from '@hello-pangea/dnd';
|
7
7
|
|
8
8
|
type PathData = Record<string, {
|
@@ -33,6 +33,7 @@ type DropZoneContext = {
|
|
33
33
|
pathData?: PathData;
|
34
34
|
registerPath?: (selector: ItemSelector) => void;
|
35
35
|
mode?: "edit" | "render";
|
36
|
+
disableZoom?: boolean;
|
36
37
|
} | null;
|
37
38
|
declare const dropZoneContext: react.Context<DropZoneContext>;
|
38
39
|
declare const DropZoneProvider: ({ children, value, }: {
|
@@ -114,6 +115,22 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
|
|
114
115
|
loading?: boolean | undefined;
|
115
116
|
}) => react_jsx_runtime.JSX.Element;
|
116
117
|
|
118
|
+
declare const Drawer: {
|
119
|
+
({ children, droppableId, direction, }: {
|
120
|
+
children: ReactNode;
|
121
|
+
droppableId?: string | undefined;
|
122
|
+
direction?: "horizontal" | "vertical" | undefined;
|
123
|
+
}): react_jsx_runtime.JSX.Element;
|
124
|
+
Item: ({ name, children, id, index, }: {
|
125
|
+
name: string;
|
126
|
+
children?: ((props: {
|
127
|
+
children: ReactNode;
|
128
|
+
}) => ReactElement) | undefined;
|
129
|
+
id?: string | undefined;
|
130
|
+
index: number;
|
131
|
+
}) => react_jsx_runtime.JSX.Element;
|
132
|
+
};
|
133
|
+
|
117
134
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
118
135
|
children: ReactNode;
|
119
136
|
href?: string | undefined;
|
@@ -127,35 +144,88 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
127
144
|
title: string;
|
128
145
|
}) => react_jsx_runtime.JSX.Element;
|
129
146
|
|
130
|
-
|
131
|
-
|
147
|
+
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
148
|
+
children?: ReactNode;
|
149
|
+
icon?: ReactNode;
|
150
|
+
label: string;
|
151
|
+
el?: "label" | "div" | undefined;
|
152
|
+
readOnly?: boolean | undefined;
|
153
|
+
className?: string | undefined;
|
154
|
+
}) => react_jsx_runtime.JSX.Element;
|
155
|
+
type InputProps<F = Field<any>> = {
|
156
|
+
name: string;
|
157
|
+
field: F;
|
158
|
+
value: any;
|
159
|
+
id: string;
|
160
|
+
label?: string;
|
161
|
+
onChange: (value: any, uiState?: Partial<UiState>) => void;
|
162
|
+
readOnly?: boolean;
|
163
|
+
readOnlyFields?: Record<string, boolean | undefined>;
|
164
|
+
};
|
165
|
+
|
166
|
+
type RenderFunc<Props extends {
|
167
|
+
[key: string]: any;
|
168
|
+
} = {
|
169
|
+
children: ReactNode;
|
170
|
+
}> = React.FunctionComponent<Props>;
|
171
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
172
|
+
type OverrideKey = (typeof overrideKeys)[number];
|
173
|
+
type OverridesGeneric<Shape extends {
|
174
|
+
[key in OverrideKey]: any;
|
175
|
+
}> = Shape;
|
176
|
+
type Overrides = OverridesGeneric<{
|
177
|
+
fieldTypes: Partial<FieldRenderFunctions>;
|
178
|
+
header: RenderFunc<{
|
179
|
+
actions: ReactNode;
|
132
180
|
children: ReactNode;
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
181
|
+
}>;
|
182
|
+
headerActions: RenderFunc<{
|
183
|
+
children?: ReactNode;
|
184
|
+
}>;
|
185
|
+
preview: RenderFunc;
|
186
|
+
fields: RenderFunc<{
|
137
187
|
children: ReactNode;
|
138
|
-
|
139
|
-
|
140
|
-
}
|
141
|
-
|
188
|
+
isLoading: boolean;
|
189
|
+
itemSelector?: ItemSelector | null;
|
190
|
+
}>;
|
191
|
+
fieldLabel: RenderFunc<{
|
192
|
+
children?: ReactNode;
|
193
|
+
icon?: ReactNode;
|
194
|
+
label: string;
|
195
|
+
el?: "label" | "div";
|
196
|
+
readOnly?: boolean;
|
197
|
+
className?: string;
|
198
|
+
}>;
|
199
|
+
components: RenderFunc;
|
200
|
+
componentItem: RenderFunc;
|
201
|
+
outline: RenderFunc;
|
202
|
+
puck: RenderFunc;
|
203
|
+
}>;
|
204
|
+
type FieldRenderFunctions = Omit<{
|
205
|
+
[Type in Field["type"]]: React.FunctionComponent<InputProps<Extract<Field, {
|
206
|
+
type: Type;
|
207
|
+
}>> & {
|
142
208
|
children: ReactNode;
|
143
|
-
|
144
|
-
|
145
|
-
|
209
|
+
}>;
|
210
|
+
}, "custom"> & {
|
211
|
+
[key: string]: React.FunctionComponent<InputProps<any> & {
|
212
|
+
children: ReactNode;
|
213
|
+
}>;
|
214
|
+
};
|
215
|
+
|
216
|
+
type Plugin = {
|
217
|
+
overrides: Partial<Overrides>;
|
146
218
|
};
|
147
219
|
|
148
|
-
declare function Puck({ config, data: initialData, onChange, onPublish, plugins,
|
220
|
+
declare function Puck({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, }: {
|
221
|
+
children?: ReactNode;
|
149
222
|
config: Config<any, any, any>;
|
150
223
|
data: Data;
|
224
|
+
ui?: Partial<UiState>;
|
151
225
|
onChange?: (data: Data) => void;
|
152
|
-
onPublish
|
226
|
+
onPublish?: (data: Data) => void;
|
153
227
|
plugins?: Plugin[];
|
154
|
-
|
155
|
-
children: ReactNode;
|
156
|
-
dispatch: (action: PuckAction) => void;
|
157
|
-
state: AppState;
|
158
|
-
}) => ReactElement;
|
228
|
+
overrides?: Partial<Overrides>;
|
159
229
|
renderHeader?: (props: {
|
160
230
|
children: ReactNode;
|
161
231
|
dispatch: (action: PuckAction) => void;
|
@@ -168,25 +238,45 @@ declare function Puck({ config, data: initialData, onChange, onPublish, plugins,
|
|
168
238
|
headerTitle?: string;
|
169
239
|
headerPath?: string;
|
170
240
|
}): react_jsx_runtime.JSX.Element;
|
241
|
+
declare namespace Puck {
|
242
|
+
var Components: () => react_jsx_runtime.JSX.Element;
|
243
|
+
var Fields: () => react_jsx_runtime.JSX.Element;
|
244
|
+
var Outline: () => react_jsx_runtime.JSX.Element;
|
245
|
+
var Preview: ({ id }: {
|
246
|
+
id?: string | undefined;
|
247
|
+
}) => react_jsx_runtime.JSX.Element;
|
248
|
+
}
|
171
249
|
|
172
250
|
declare function Render({ config, data, }: {
|
173
251
|
config: Config<any, any, any>;
|
174
252
|
data: Data;
|
175
253
|
}): react_jsx_runtime.JSX.Element;
|
176
254
|
|
255
|
+
declare function migrate(data: Data): Data;
|
256
|
+
|
257
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = Partial<{
|
258
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
259
|
+
[key: string]: any;
|
260
|
+
}) => Props[ComponentName];
|
261
|
+
} & {
|
262
|
+
root: (props: RootProps & {
|
263
|
+
[key: string]: any;
|
264
|
+
}) => RootProps;
|
265
|
+
}>;
|
266
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
|
267
|
+
|
177
268
|
declare const resolveAllData: (data: Data, config: Config<any, any, any>, onResolveStart?: ((item: MappedItem) => void) | undefined, onResolveEnd?: ((item: MappedItem) => void) | undefined) => Promise<{
|
178
269
|
root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
|
179
270
|
content: any[];
|
180
271
|
zones: Record<string, MappedItem[]>;
|
181
272
|
}>;
|
182
273
|
|
183
|
-
declare const
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
}) => react_jsx_runtime.JSX.Element;
|
274
|
+
declare const usePuck: () => {
|
275
|
+
appState: AppState;
|
276
|
+
config: Config<{
|
277
|
+
[key: string]: any;
|
278
|
+
}, DefaultRootProps, string>;
|
279
|
+
dispatch: (action: PuckAction) => void;
|
280
|
+
};
|
191
281
|
|
192
|
-
export { AppState, Button, Config, Data, DefaultRootProps, DropZoneProvider, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, resolveAllData };
|
282
|
+
export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|