@puckeditor/core 0.21.0-canary.d1c0d6a2
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/README.md +114 -0
- package/dist/Editor-32UYWE6W.mjs +204 -0
- package/dist/Editor-IQP25PUX.css +404 -0
- package/dist/Render-3OV4N4MT.css +102 -0
- package/dist/Render-FXZX6NFH.mjs +55 -0
- package/dist/actions-BkBoKAc5.d.mts +838 -0
- package/dist/actions-BkBoKAc5.d.ts +838 -0
- package/dist/chunk-3VQHXASI.mjs +33 -0
- package/dist/chunk-6KNQXLQR.mjs +708 -0
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/chunk-GVKHZNTR.mjs +53 -0
- package/dist/chunk-K562SEXI.mjs +1813 -0
- package/dist/chunk-KN3XDS7U.mjs +528 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MEL7FUSF.mjs +63 -0
- package/dist/chunk-NYGQH27S.mjs +445 -0
- package/dist/chunk-PSLS3ZEH.mjs +8074 -0
- package/dist/chunk-Q3TJ2VYO.mjs +436 -0
- package/dist/chunk-REWRIUGR.mjs +156 -0
- package/dist/chunk-V2IQTPPK.mjs +111 -0
- package/dist/chunk-V5I7CVLT.mjs +103 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-4OS3O57Y.mjs +93 -0
- package/dist/index-bqD1SEOb.d.mts +118 -0
- package/dist/index-lt1zf5WR.d.ts +118 -0
- package/dist/index.css +2629 -0
- package/dist/index.d.mts +309 -0
- package/dist/index.d.ts +309 -0
- package/dist/index.js +14177 -0
- package/dist/index.mjs +78 -0
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-DCQVLO7I.mjs +57 -0
- package/dist/loaded-JGRO7BH7.mjs +57 -0
- package/dist/loaded-KKVJE5KH.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.css +2631 -0
- package/dist/no-external.d.mts +21 -0
- package/dist/no-external.d.ts +21 -0
- package/dist/no-external.js +14180 -0
- package/dist/no-external.mjs +83 -0
- package/dist/rsc.css +102 -0
- package/dist/rsc.d.mts +27 -0
- package/dist/rsc.d.ts +27 -0
- package/dist/rsc.js +1445 -0
- package/dist/rsc.mjs +130 -0
- package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
- package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
- package/package.json +137 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, i as ResolveDataTrigger, t as ItemSelector, c as ComponentData, u as PluginInternal } from './actions-BkBoKAc5.mjs';
|
|
2
|
+
export { ag as Adaptor, A as AppState, ae as ArrayField, N as ArrayState, ar as AsFieldProps, a0 as BaseData, a8 as BaseField, ai as CacheOpts, m as ComponentConfig, X as ComponentConfigExtensions, $ as ComponentConfigParams, a4 as ComponentDataMap, a2 as ComponentDataOptionalId, a6 as ComponentMetadata, _ as ConfigParams, b as Content, al as CustomField, ak as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, ap as DefaultRootProps, ao as DefaultRootRenderProps, x as Direction, y as DragAxis, aj as ExternalField, ah as ExternalFieldWithAdaptor, Z as ExtractConfigParams, at as ExtractField, a7 as FieldMetadata, K as FieldRenderFunctions, E as FieldTransformFn, B as FieldTransformFnParams, F as Fields, H as History, L as ItemWithId, a3 as MappedItem, aa as NumberField, af as ObjectField, J as OverrideKey, T as PuckComponent, an as PuckContext, a5 as PuckMetadata, ad as RadioField, w as RichText, o as RichtextField, Y as RootConfig, R as RootData, h as RootDataWithProps, a1 as RootDataWithoutProps, ac as SelectField, S as Slot, Q as SlotComponent, am as SlotField, a9 as TextField, ab as TextareaField, z as Viewport, as as WithChildren, W as WithId, aq as WithPuckProps, v as WithSlotProps, G as overrideKeys } from './actions-BkBoKAc5.mjs';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CRRDqx6_.mjs';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
|
7
|
+
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-bqD1SEOb.mjs';
|
|
8
|
+
import '@tiptap/react';
|
|
9
|
+
import '@tiptap/extension-blockquote';
|
|
10
|
+
import '@tiptap/extension-bold';
|
|
11
|
+
import '@tiptap/extension-code';
|
|
12
|
+
import '@tiptap/extension-code-block';
|
|
13
|
+
import '@tiptap/extension-hard-break';
|
|
14
|
+
import '@tiptap/extension-heading';
|
|
15
|
+
import '@tiptap/extension-horizontal-rule';
|
|
16
|
+
import '@tiptap/extension-italic';
|
|
17
|
+
import '@tiptap/extension-link';
|
|
18
|
+
import '@tiptap/extension-list';
|
|
19
|
+
import '@tiptap/extension-paragraph';
|
|
20
|
+
import '@tiptap/extension-strike';
|
|
21
|
+
import '@tiptap/extension-text-align';
|
|
22
|
+
import '@tiptap/extension-underline';
|
|
23
|
+
|
|
24
|
+
declare const ActionBar: {
|
|
25
|
+
({ label, children, }: {
|
|
26
|
+
label?: string;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
Action: ({ children, label, onClick, active, disabled, }: {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
label?: string;
|
|
32
|
+
onClick: (e: SyntheticEvent) => void;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
Label: ({ label }: {
|
|
37
|
+
label: string;
|
|
38
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
Group: ({ children }: {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
Separator: () => react_jsx_runtime.JSX.Element;
|
|
43
|
+
};
|
|
44
|
+
declare const Action: ({ children, label, onClick, active, disabled, }: {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
label?: string;
|
|
47
|
+
onClick: (e: SyntheticEvent) => void;
|
|
48
|
+
active?: boolean;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
51
|
+
declare const Group: ({ children }: {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const Label: ({ label }: {
|
|
55
|
+
label: string;
|
|
56
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare const Separator: () => react_jsx_runtime.JSX.Element;
|
|
58
|
+
|
|
59
|
+
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
icon?: ReactNode;
|
|
62
|
+
label: string;
|
|
63
|
+
el?: "label" | "div";
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
className?: string;
|
|
66
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
|
69
|
+
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType> & {
|
|
70
|
+
value: any;
|
|
71
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
72
|
+
|
|
73
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
href?: string;
|
|
76
|
+
onClick?: (e: any) => void | Promise<void>;
|
|
77
|
+
variant?: "primary" | "secondary";
|
|
78
|
+
type?: "button" | "submit" | "reset";
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
tabIndex?: number;
|
|
81
|
+
newTab?: boolean;
|
|
82
|
+
fullWidth?: boolean;
|
|
83
|
+
icon?: ReactNode;
|
|
84
|
+
size?: "medium" | "large";
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
declare const Drawer: {
|
|
89
|
+
({ children, droppableId, direction, }: {
|
|
90
|
+
children: ReactNode;
|
|
91
|
+
droppableId?: string;
|
|
92
|
+
direction?: "vertical" | "horizontal";
|
|
93
|
+
}): react_jsx_runtime.JSX.Element;
|
|
94
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
|
95
|
+
name: string;
|
|
96
|
+
children?: (props: {
|
|
97
|
+
children: ReactNode;
|
|
98
|
+
name: string;
|
|
99
|
+
}) => ReactElement;
|
|
100
|
+
id?: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
index?: number;
|
|
103
|
+
isDragDisabled?: boolean;
|
|
104
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
|
|
109
|
+
declare const IconButton: ({ active, children, href, onClick, type, disabled, tabIndex, newTab, fullWidth, title, suppressHydrationWarning, }: {
|
|
110
|
+
active?: boolean;
|
|
111
|
+
children: ReactNode;
|
|
112
|
+
href?: string;
|
|
113
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
|
114
|
+
type?: "button" | "submit" | "reset";
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
tabIndex?: number;
|
|
117
|
+
newTab?: boolean;
|
|
118
|
+
fullWidth?: boolean;
|
|
119
|
+
title: string;
|
|
120
|
+
suppressHydrationWarning?: boolean;
|
|
121
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
122
|
+
|
|
123
|
+
type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
124
|
+
children?: ReactNode;
|
|
125
|
+
config: UserConfig;
|
|
126
|
+
data: Partial<G["UserData"] | Data>;
|
|
127
|
+
ui?: Partial<UiState>;
|
|
128
|
+
onChange?: (data: G["UserData"]) => void;
|
|
129
|
+
onPublish?: (data: G["UserData"]) => void;
|
|
130
|
+
onAction?: OnAction<G["UserData"]>;
|
|
131
|
+
permissions?: Partial<Permissions>;
|
|
132
|
+
plugins?: Plugin<UserConfig>[];
|
|
133
|
+
overrides?: Partial<Overrides<UserConfig>>;
|
|
134
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
135
|
+
renderHeader?: (props: {
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
dispatch: (action: PuckAction) => void;
|
|
138
|
+
state: G["UserAppState"];
|
|
139
|
+
}) => ReactElement;
|
|
140
|
+
renderHeaderActions?: (props: {
|
|
141
|
+
state: G["UserAppState"];
|
|
142
|
+
dispatch: (action: PuckAction) => void;
|
|
143
|
+
}) => ReactElement;
|
|
144
|
+
headerTitle?: string;
|
|
145
|
+
headerPath?: string;
|
|
146
|
+
viewports?: Viewports;
|
|
147
|
+
iframe?: IframeConfig;
|
|
148
|
+
dnd?: {
|
|
149
|
+
disableAutoScroll?: boolean;
|
|
150
|
+
};
|
|
151
|
+
initialHistory?: InitialHistory;
|
|
152
|
+
metadata?: Metadata;
|
|
153
|
+
height?: CSSProperties["height"];
|
|
154
|
+
_experimentalFullScreenCanvas?: boolean;
|
|
155
|
+
};
|
|
156
|
+
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
|
157
|
+
declare namespace Puck {
|
|
158
|
+
var Components: () => react_jsx_runtime.JSX.Element;
|
|
159
|
+
var Fields: react.MemoExoticComponent<({ wrapFields }: {
|
|
160
|
+
wrapFields?: boolean;
|
|
161
|
+
}) => react_jsx_runtime.JSX.Element>;
|
|
162
|
+
var Layout: ({ children }: {
|
|
163
|
+
children?: ReactNode;
|
|
164
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
165
|
+
var Outline: () => react_jsx_runtime.JSX.Element;
|
|
166
|
+
var Preview: ({ id }: {
|
|
167
|
+
id?: string;
|
|
168
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare const renderContext: react__default.Context<{
|
|
172
|
+
config: Config;
|
|
173
|
+
data: Data;
|
|
174
|
+
metadata: Metadata;
|
|
175
|
+
}>;
|
|
176
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
|
177
|
+
config: UserConfig;
|
|
178
|
+
data: Partial<G["UserData"] | Data>;
|
|
179
|
+
metadata?: Metadata;
|
|
180
|
+
}): react_jsx_runtime.JSX.Element;
|
|
181
|
+
|
|
182
|
+
declare function AlignLeft(): react_jsx_runtime.JSX.Element;
|
|
183
|
+
|
|
184
|
+
declare function AlignCenter(): react_jsx_runtime.JSX.Element;
|
|
185
|
+
|
|
186
|
+
declare function AlignRight(): react_jsx_runtime.JSX.Element;
|
|
187
|
+
|
|
188
|
+
declare function AlignJustify(): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
declare function Bold(): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
declare function Italic(): react_jsx_runtime.JSX.Element;
|
|
193
|
+
|
|
194
|
+
declare function Underline(): react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
declare function Strikethrough(): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
declare function InlineCode(): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
declare function BulletList(): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
declare function OrderedList(): react_jsx_runtime.JSX.Element;
|
|
203
|
+
|
|
204
|
+
declare function CodeBlock(): react_jsx_runtime.JSX.Element;
|
|
205
|
+
|
|
206
|
+
declare function Blockquote(): react_jsx_runtime.JSX.Element;
|
|
207
|
+
|
|
208
|
+
declare function HorizontalRule(): react_jsx_runtime.JSX.Element;
|
|
209
|
+
|
|
210
|
+
declare function Control({ icon, disabled, active, onClick, title, }: {
|
|
211
|
+
icon: ReactNode;
|
|
212
|
+
disabled?: boolean;
|
|
213
|
+
active?: boolean;
|
|
214
|
+
onClick: (e: SyntheticEvent) => any;
|
|
215
|
+
title: string;
|
|
216
|
+
}): react_jsx_runtime.JSX.Element;
|
|
217
|
+
|
|
218
|
+
declare const RichTextMenu: {
|
|
219
|
+
({ children }: {
|
|
220
|
+
children: ReactNode;
|
|
221
|
+
}): react_jsx_runtime.JSX.Element;
|
|
222
|
+
Group: ({ children }: {
|
|
223
|
+
children: ReactNode;
|
|
224
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
225
|
+
Control: typeof Control;
|
|
226
|
+
AlignCenter: typeof AlignCenter;
|
|
227
|
+
AlignJustify: typeof AlignJustify;
|
|
228
|
+
AlignLeft: typeof AlignLeft;
|
|
229
|
+
AlignRight: typeof AlignRight;
|
|
230
|
+
AlignSelect: () => react_jsx_runtime.JSX.Element;
|
|
231
|
+
Blockquote: typeof Blockquote;
|
|
232
|
+
Bold: typeof Bold;
|
|
233
|
+
BulletList: typeof BulletList;
|
|
234
|
+
CodeBlock: typeof CodeBlock;
|
|
235
|
+
HeadingSelect: () => react_jsx_runtime.JSX.Element;
|
|
236
|
+
HorizontalRule: typeof HorizontalRule;
|
|
237
|
+
InlineCode: typeof InlineCode;
|
|
238
|
+
Italic: typeof Italic;
|
|
239
|
+
ListSelect: () => react_jsx_runtime.JSX.Element;
|
|
240
|
+
OrderedList: typeof OrderedList;
|
|
241
|
+
Strikethrough: typeof Strikethrough;
|
|
242
|
+
Underline: typeof Underline;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
|
|
246
|
+
disableDrag?: boolean;
|
|
247
|
+
disableDragOnFocus?: boolean;
|
|
248
|
+
}) => (() => void) | undefined;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Helper function to set a value based on a dot-notated path
|
|
252
|
+
*/
|
|
253
|
+
declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
|
|
254
|
+
|
|
255
|
+
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
256
|
+
appState: G["UserPublicAppState"];
|
|
257
|
+
config: UserConfig;
|
|
258
|
+
dispatch: AppStore["dispatch"];
|
|
259
|
+
getPermissions: GetPermissions<UserConfig>;
|
|
260
|
+
refreshPermissions: RefreshPermissions<UserConfig>;
|
|
261
|
+
resolveDataById: (id: string, trigger?: ResolveDataTrigger) => void;
|
|
262
|
+
resolveDataBySelector: (selector: ItemSelector, trigger?: ResolveDataTrigger) => void;
|
|
263
|
+
selectedItem: G["UserComponentData"] | null;
|
|
264
|
+
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
265
|
+
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
266
|
+
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
267
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
268
|
+
history: {
|
|
269
|
+
back: HistorySlice["back"];
|
|
270
|
+
forward: HistorySlice["forward"];
|
|
271
|
+
setHistories: HistorySlice["setHistories"];
|
|
272
|
+
setHistoryIndex: HistorySlice["setHistoryIndex"];
|
|
273
|
+
histories: HistorySlice["histories"];
|
|
274
|
+
index: HistorySlice["index"];
|
|
275
|
+
hasPast: boolean;
|
|
276
|
+
hasFuture: boolean;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
|
280
|
+
type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
|
|
281
|
+
/**
|
|
282
|
+
* createUsePuck
|
|
283
|
+
*
|
|
284
|
+
* Create a typed usePuck hook, which is necessary because the user may provide a generic type but not
|
|
285
|
+
* a selector type, and TS does not currently support partial inference.
|
|
286
|
+
* Related: https://github.com/microsoft/TypeScript/issues/26242
|
|
287
|
+
*
|
|
288
|
+
* @returns a typed usePuck function
|
|
289
|
+
*/
|
|
290
|
+
declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
|
|
291
|
+
declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
|
|
292
|
+
/**
|
|
293
|
+
* Get the latest state without relying on a render
|
|
294
|
+
*
|
|
295
|
+
* @returns PuckApi
|
|
296
|
+
*/
|
|
297
|
+
declare function useGetPuck(): () => UsePuckStore<Config>;
|
|
298
|
+
|
|
299
|
+
declare const blocksPlugin: () => Plugin;
|
|
300
|
+
|
|
301
|
+
declare const fieldsPlugin: (params?: {
|
|
302
|
+
desktopSideBar?: "left" | "right";
|
|
303
|
+
}) => PluginInternal;
|
|
304
|
+
|
|
305
|
+
declare const outlinePlugin: () => Plugin;
|
|
306
|
+
|
|
307
|
+
declare const legacySideBarPlugin: () => Plugin;
|
|
308
|
+
|
|
309
|
+
export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { p as Field, q as FieldProps, r as DropZoneProps, C as Config, U as UserGenerics, D as Data, l as UiState, O as OnAction, g as Permissions, j as Plugin, k as Overrides, n as FieldTransforms, a as PuckAction, V as Viewports, I as IframeConfig, s as InitialHistory, M as Metadata, i as ResolveDataTrigger, t as ItemSelector, c as ComponentData, u as PluginInternal } from './actions-BkBoKAc5.js';
|
|
2
|
+
export { ag as Adaptor, A as AppState, ae as ArrayField, N as ArrayState, ar as AsFieldProps, a0 as BaseData, a8 as BaseField, ai as CacheOpts, m as ComponentConfig, X as ComponentConfigExtensions, $ as ComponentConfigParams, a4 as ComponentDataMap, a2 as ComponentDataOptionalId, a6 as ComponentMetadata, _ as ConfigParams, b as Content, al as CustomField, ak as CustomFieldRender, e as DefaultComponentProps, d as DefaultComponents, f as DefaultRootFieldProps, ap as DefaultRootProps, ao as DefaultRootRenderProps, x as Direction, y as DragAxis, aj as ExternalField, ah as ExternalFieldWithAdaptor, Z as ExtractConfigParams, at as ExtractField, a7 as FieldMetadata, K as FieldRenderFunctions, E as FieldTransformFn, B as FieldTransformFnParams, F as Fields, H as History, L as ItemWithId, a3 as MappedItem, aa as NumberField, af as ObjectField, J as OverrideKey, T as PuckComponent, an as PuckContext, a5 as PuckMetadata, ad as RadioField, w as RichText, o as RichtextField, Y as RootConfig, R as RootData, h as RootDataWithProps, a1 as RootDataWithoutProps, ac as SelectField, S as Slot, Q as SlotComponent, am as SlotField, a9 as TextField, ab as TextareaField, z as Viewport, as as WithChildren, W as WithId, aq as WithPuckProps, v as WithSlotProps, G as overrideKeys } from './actions-BkBoKAc5.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CS7sEpfG.js';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
|
7
|
+
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-lt1zf5WR.js';
|
|
8
|
+
import '@tiptap/react';
|
|
9
|
+
import '@tiptap/extension-blockquote';
|
|
10
|
+
import '@tiptap/extension-bold';
|
|
11
|
+
import '@tiptap/extension-code';
|
|
12
|
+
import '@tiptap/extension-code-block';
|
|
13
|
+
import '@tiptap/extension-hard-break';
|
|
14
|
+
import '@tiptap/extension-heading';
|
|
15
|
+
import '@tiptap/extension-horizontal-rule';
|
|
16
|
+
import '@tiptap/extension-italic';
|
|
17
|
+
import '@tiptap/extension-link';
|
|
18
|
+
import '@tiptap/extension-list';
|
|
19
|
+
import '@tiptap/extension-paragraph';
|
|
20
|
+
import '@tiptap/extension-strike';
|
|
21
|
+
import '@tiptap/extension-text-align';
|
|
22
|
+
import '@tiptap/extension-underline';
|
|
23
|
+
|
|
24
|
+
declare const ActionBar: {
|
|
25
|
+
({ label, children, }: {
|
|
26
|
+
label?: string;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}): react_jsx_runtime.JSX.Element;
|
|
29
|
+
Action: ({ children, label, onClick, active, disabled, }: {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
label?: string;
|
|
32
|
+
onClick: (e: SyntheticEvent) => void;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
Label: ({ label }: {
|
|
37
|
+
label: string;
|
|
38
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
Group: ({ children }: {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
Separator: () => react_jsx_runtime.JSX.Element;
|
|
43
|
+
};
|
|
44
|
+
declare const Action: ({ children, label, onClick, active, disabled, }: {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
label?: string;
|
|
47
|
+
onClick: (e: SyntheticEvent) => void;
|
|
48
|
+
active?: boolean;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
51
|
+
declare const Group: ({ children }: {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const Label: ({ label }: {
|
|
55
|
+
label: string;
|
|
56
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare const Separator: () => react_jsx_runtime.JSX.Element;
|
|
58
|
+
|
|
59
|
+
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
icon?: ReactNode;
|
|
62
|
+
label: string;
|
|
63
|
+
el?: "label" | "div";
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
className?: string;
|
|
66
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
|
69
|
+
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType> & {
|
|
70
|
+
value: any;
|
|
71
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
72
|
+
|
|
73
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
href?: string;
|
|
76
|
+
onClick?: (e: any) => void | Promise<void>;
|
|
77
|
+
variant?: "primary" | "secondary";
|
|
78
|
+
type?: "button" | "submit" | "reset";
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
tabIndex?: number;
|
|
81
|
+
newTab?: boolean;
|
|
82
|
+
fullWidth?: boolean;
|
|
83
|
+
icon?: ReactNode;
|
|
84
|
+
size?: "medium" | "large";
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
declare const Drawer: {
|
|
89
|
+
({ children, droppableId, direction, }: {
|
|
90
|
+
children: ReactNode;
|
|
91
|
+
droppableId?: string;
|
|
92
|
+
direction?: "vertical" | "horizontal";
|
|
93
|
+
}): react_jsx_runtime.JSX.Element;
|
|
94
|
+
Item: ({ name, children, id, label, index, isDragDisabled, }: {
|
|
95
|
+
name: string;
|
|
96
|
+
children?: (props: {
|
|
97
|
+
children: ReactNode;
|
|
98
|
+
name: string;
|
|
99
|
+
}) => ReactElement;
|
|
100
|
+
id?: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
index?: number;
|
|
103
|
+
isDragDisabled?: boolean;
|
|
104
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
108
|
+
|
|
109
|
+
declare const IconButton: ({ active, children, href, onClick, type, disabled, tabIndex, newTab, fullWidth, title, suppressHydrationWarning, }: {
|
|
110
|
+
active?: boolean;
|
|
111
|
+
children: ReactNode;
|
|
112
|
+
href?: string;
|
|
113
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
|
114
|
+
type?: "button" | "submit" | "reset";
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
tabIndex?: number;
|
|
117
|
+
newTab?: boolean;
|
|
118
|
+
fullWidth?: boolean;
|
|
119
|
+
title: string;
|
|
120
|
+
suppressHydrationWarning?: boolean;
|
|
121
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
122
|
+
|
|
123
|
+
type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
124
|
+
children?: ReactNode;
|
|
125
|
+
config: UserConfig;
|
|
126
|
+
data: Partial<G["UserData"] | Data>;
|
|
127
|
+
ui?: Partial<UiState>;
|
|
128
|
+
onChange?: (data: G["UserData"]) => void;
|
|
129
|
+
onPublish?: (data: G["UserData"]) => void;
|
|
130
|
+
onAction?: OnAction<G["UserData"]>;
|
|
131
|
+
permissions?: Partial<Permissions>;
|
|
132
|
+
plugins?: Plugin<UserConfig>[];
|
|
133
|
+
overrides?: Partial<Overrides<UserConfig>>;
|
|
134
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
135
|
+
renderHeader?: (props: {
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
dispatch: (action: PuckAction) => void;
|
|
138
|
+
state: G["UserAppState"];
|
|
139
|
+
}) => ReactElement;
|
|
140
|
+
renderHeaderActions?: (props: {
|
|
141
|
+
state: G["UserAppState"];
|
|
142
|
+
dispatch: (action: PuckAction) => void;
|
|
143
|
+
}) => ReactElement;
|
|
144
|
+
headerTitle?: string;
|
|
145
|
+
headerPath?: string;
|
|
146
|
+
viewports?: Viewports;
|
|
147
|
+
iframe?: IframeConfig;
|
|
148
|
+
dnd?: {
|
|
149
|
+
disableAutoScroll?: boolean;
|
|
150
|
+
};
|
|
151
|
+
initialHistory?: InitialHistory;
|
|
152
|
+
metadata?: Metadata;
|
|
153
|
+
height?: CSSProperties["height"];
|
|
154
|
+
_experimentalFullScreenCanvas?: boolean;
|
|
155
|
+
};
|
|
156
|
+
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
|
157
|
+
declare namespace Puck {
|
|
158
|
+
var Components: () => react_jsx_runtime.JSX.Element;
|
|
159
|
+
var Fields: react.MemoExoticComponent<({ wrapFields }: {
|
|
160
|
+
wrapFields?: boolean;
|
|
161
|
+
}) => react_jsx_runtime.JSX.Element>;
|
|
162
|
+
var Layout: ({ children }: {
|
|
163
|
+
children?: ReactNode;
|
|
164
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
165
|
+
var Outline: () => react_jsx_runtime.JSX.Element;
|
|
166
|
+
var Preview: ({ id }: {
|
|
167
|
+
id?: string;
|
|
168
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare const renderContext: react__default.Context<{
|
|
172
|
+
config: Config;
|
|
173
|
+
data: Data;
|
|
174
|
+
metadata: Metadata;
|
|
175
|
+
}>;
|
|
176
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
|
177
|
+
config: UserConfig;
|
|
178
|
+
data: Partial<G["UserData"] | Data>;
|
|
179
|
+
metadata?: Metadata;
|
|
180
|
+
}): react_jsx_runtime.JSX.Element;
|
|
181
|
+
|
|
182
|
+
declare function AlignLeft(): react_jsx_runtime.JSX.Element;
|
|
183
|
+
|
|
184
|
+
declare function AlignCenter(): react_jsx_runtime.JSX.Element;
|
|
185
|
+
|
|
186
|
+
declare function AlignRight(): react_jsx_runtime.JSX.Element;
|
|
187
|
+
|
|
188
|
+
declare function AlignJustify(): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
declare function Bold(): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
declare function Italic(): react_jsx_runtime.JSX.Element;
|
|
193
|
+
|
|
194
|
+
declare function Underline(): react_jsx_runtime.JSX.Element;
|
|
195
|
+
|
|
196
|
+
declare function Strikethrough(): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
declare function InlineCode(): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
200
|
+
declare function BulletList(): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
declare function OrderedList(): react_jsx_runtime.JSX.Element;
|
|
203
|
+
|
|
204
|
+
declare function CodeBlock(): react_jsx_runtime.JSX.Element;
|
|
205
|
+
|
|
206
|
+
declare function Blockquote(): react_jsx_runtime.JSX.Element;
|
|
207
|
+
|
|
208
|
+
declare function HorizontalRule(): react_jsx_runtime.JSX.Element;
|
|
209
|
+
|
|
210
|
+
declare function Control({ icon, disabled, active, onClick, title, }: {
|
|
211
|
+
icon: ReactNode;
|
|
212
|
+
disabled?: boolean;
|
|
213
|
+
active?: boolean;
|
|
214
|
+
onClick: (e: SyntheticEvent) => any;
|
|
215
|
+
title: string;
|
|
216
|
+
}): react_jsx_runtime.JSX.Element;
|
|
217
|
+
|
|
218
|
+
declare const RichTextMenu: {
|
|
219
|
+
({ children }: {
|
|
220
|
+
children: ReactNode;
|
|
221
|
+
}): react_jsx_runtime.JSX.Element;
|
|
222
|
+
Group: ({ children }: {
|
|
223
|
+
children: ReactNode;
|
|
224
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
225
|
+
Control: typeof Control;
|
|
226
|
+
AlignCenter: typeof AlignCenter;
|
|
227
|
+
AlignJustify: typeof AlignJustify;
|
|
228
|
+
AlignLeft: typeof AlignLeft;
|
|
229
|
+
AlignRight: typeof AlignRight;
|
|
230
|
+
AlignSelect: () => react_jsx_runtime.JSX.Element;
|
|
231
|
+
Blockquote: typeof Blockquote;
|
|
232
|
+
Bold: typeof Bold;
|
|
233
|
+
BulletList: typeof BulletList;
|
|
234
|
+
CodeBlock: typeof CodeBlock;
|
|
235
|
+
HeadingSelect: () => react_jsx_runtime.JSX.Element;
|
|
236
|
+
HorizontalRule: typeof HorizontalRule;
|
|
237
|
+
InlineCode: typeof InlineCode;
|
|
238
|
+
Italic: typeof Italic;
|
|
239
|
+
ListSelect: () => react_jsx_runtime.JSX.Element;
|
|
240
|
+
OrderedList: typeof OrderedList;
|
|
241
|
+
Strikethrough: typeof Strikethrough;
|
|
242
|
+
Underline: typeof Underline;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
|
|
246
|
+
disableDrag?: boolean;
|
|
247
|
+
disableDragOnFocus?: boolean;
|
|
248
|
+
}) => (() => void) | undefined;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Helper function to set a value based on a dot-notated path
|
|
252
|
+
*/
|
|
253
|
+
declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
|
|
254
|
+
|
|
255
|
+
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
256
|
+
appState: G["UserPublicAppState"];
|
|
257
|
+
config: UserConfig;
|
|
258
|
+
dispatch: AppStore["dispatch"];
|
|
259
|
+
getPermissions: GetPermissions<UserConfig>;
|
|
260
|
+
refreshPermissions: RefreshPermissions<UserConfig>;
|
|
261
|
+
resolveDataById: (id: string, trigger?: ResolveDataTrigger) => void;
|
|
262
|
+
resolveDataBySelector: (selector: ItemSelector, trigger?: ResolveDataTrigger) => void;
|
|
263
|
+
selectedItem: G["UserComponentData"] | null;
|
|
264
|
+
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
265
|
+
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
266
|
+
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
267
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
268
|
+
history: {
|
|
269
|
+
back: HistorySlice["back"];
|
|
270
|
+
forward: HistorySlice["forward"];
|
|
271
|
+
setHistories: HistorySlice["setHistories"];
|
|
272
|
+
setHistoryIndex: HistorySlice["setHistoryIndex"];
|
|
273
|
+
histories: HistorySlice["histories"];
|
|
274
|
+
index: HistorySlice["index"];
|
|
275
|
+
hasPast: boolean;
|
|
276
|
+
hasFuture: boolean;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
|
280
|
+
type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
|
|
281
|
+
/**
|
|
282
|
+
* createUsePuck
|
|
283
|
+
*
|
|
284
|
+
* Create a typed usePuck hook, which is necessary because the user may provide a generic type but not
|
|
285
|
+
* a selector type, and TS does not currently support partial inference.
|
|
286
|
+
* Related: https://github.com/microsoft/TypeScript/issues/26242
|
|
287
|
+
*
|
|
288
|
+
* @returns a typed usePuck function
|
|
289
|
+
*/
|
|
290
|
+
declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
|
|
291
|
+
declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
|
|
292
|
+
/**
|
|
293
|
+
* Get the latest state without relying on a render
|
|
294
|
+
*
|
|
295
|
+
* @returns PuckApi
|
|
296
|
+
*/
|
|
297
|
+
declare function useGetPuck(): () => UsePuckStore<Config>;
|
|
298
|
+
|
|
299
|
+
declare const blocksPlugin: () => Plugin;
|
|
300
|
+
|
|
301
|
+
declare const fieldsPlugin: (params?: {
|
|
302
|
+
desktopSideBar?: "left" | "right";
|
|
303
|
+
}) => PluginInternal;
|
|
304
|
+
|
|
305
|
+
declare const outlinePlugin: () => Plugin;
|
|
306
|
+
|
|
307
|
+
declare const legacySideBarPlugin: () => Plugin;
|
|
308
|
+
|
|
309
|
+
export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
|