@measured/puck 0.12.1-canary.1c3372b → 0.13.0-canary.10a6025
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Config-35e6eaae.d.ts → Config-4367c689.d.ts} +35 -5
- package/dist/index.css +633 -524
- package/dist/index.d.ts +128 -37
- package/dist/index.js +2970 -2405
- package/dist/rsc.d.ts +3 -3
- package/dist/rsc.js +4 -1
- package/package.json +1 -1
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, }: {
|
@@ -99,7 +100,7 @@ type PuckAction = {
|
|
99
100
|
recordHistory?: boolean;
|
100
101
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
101
102
|
|
102
|
-
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, }: {
|
103
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
103
104
|
children: ReactNode;
|
104
105
|
href?: string | undefined;
|
105
106
|
onClick?: ((e: any) => void | Promise<void>) | undefined;
|
@@ -111,8 +112,25 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
|
|
111
112
|
fullWidth?: boolean | undefined;
|
112
113
|
icon?: ReactNode;
|
113
114
|
size?: "medium" | "large" | undefined;
|
115
|
+
loading?: boolean | undefined;
|
114
116
|
}) => react_jsx_runtime.JSX.Element;
|
115
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
|
+
|
116
134
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
117
135
|
children: ReactNode;
|
118
136
|
href?: string | undefined;
|
@@ -126,35 +144,88 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
|
|
126
144
|
title: string;
|
127
145
|
}) => react_jsx_runtime.JSX.Element;
|
128
146
|
|
129
|
-
|
130
|
-
|
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;
|
131
180
|
children: ReactNode;
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
181
|
+
}>;
|
182
|
+
headerActions: RenderFunc<{
|
183
|
+
children?: ReactNode;
|
184
|
+
}>;
|
185
|
+
preview: RenderFunc;
|
186
|
+
fields: RenderFunc<{
|
136
187
|
children: ReactNode;
|
137
|
-
|
138
|
-
|
139
|
-
}
|
140
|
-
|
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
|
+
}>> & {
|
141
208
|
children: ReactNode;
|
142
|
-
|
143
|
-
|
144
|
-
|
209
|
+
}>;
|
210
|
+
}, "custom"> & {
|
211
|
+
[key: string]: React.FunctionComponent<InputProps<any> & {
|
212
|
+
children: ReactNode;
|
213
|
+
}>;
|
145
214
|
};
|
146
215
|
|
147
|
-
|
148
|
-
|
216
|
+
type Plugin = {
|
217
|
+
overrides: Partial<Overrides>;
|
218
|
+
};
|
219
|
+
|
220
|
+
declare function Puck({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, }: {
|
221
|
+
children?: ReactNode;
|
222
|
+
config: Config<any, any, any>;
|
149
223
|
data: Data;
|
224
|
+
ui?: Partial<UiState>;
|
150
225
|
onChange?: (data: Data) => void;
|
151
|
-
onPublish
|
226
|
+
onPublish?: (data: Data) => void;
|
152
227
|
plugins?: Plugin[];
|
153
|
-
|
154
|
-
children: ReactNode;
|
155
|
-
dispatch: (action: PuckAction) => void;
|
156
|
-
state: AppState;
|
157
|
-
}) => ReactElement;
|
228
|
+
overrides?: Partial<Overrides>;
|
158
229
|
renderHeader?: (props: {
|
159
230
|
children: ReactNode;
|
160
231
|
dispatch: (action: PuckAction) => void;
|
@@ -167,25 +238,45 @@ declare function Puck({ config, data: initialData, onChange, onPublish, plugins,
|
|
167
238
|
headerTitle?: string;
|
168
239
|
headerPath?: string;
|
169
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
|
+
}
|
170
249
|
|
171
|
-
declare function Render({ config, data }: {
|
172
|
-
config: Config
|
250
|
+
declare function Render({ config, data, }: {
|
251
|
+
config: Config<any, any, any>;
|
173
252
|
data: Data;
|
174
253
|
}): react_jsx_runtime.JSX.Element;
|
175
254
|
|
176
|
-
declare
|
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
|
+
|
268
|
+
declare const resolveAllData: (data: Data, config: Config<any, any, any>, onResolveStart?: ((item: MappedItem) => void) | undefined, onResolveEnd?: ((item: MappedItem) => void) | undefined) => Promise<{
|
177
269
|
root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
|
178
270
|
content: any[];
|
179
271
|
zones: Record<string, MappedItem[]>;
|
180
272
|
}>;
|
181
273
|
|
182
|
-
declare const
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
}) => 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
|
+
};
|
190
281
|
|
191
|
-
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 };
|