@reacteditor/core 0.0.1-alpha.0
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 +85 -0
- package/dist/Editor-GBV2O5RD.css +415 -0
- package/dist/Editor-IKMJILGR.mjs +204 -0
- package/dist/Render-EFT7YD2C.css +103 -0
- package/dist/Render-VDC7AEQK.mjs +55 -0
- package/dist/actions-BCDhqbeL.d.mts +849 -0
- package/dist/actions-BCDhqbeL.d.ts +849 -0
- package/dist/chunk-2YLS65V2.mjs +103 -0
- package/dist/chunk-6B2Q5R3C.mjs +53 -0
- package/dist/chunk-DXGQXXQG.mjs +63 -0
- package/dist/chunk-F7S5S6I2.mjs +114 -0
- package/dist/chunk-GAUBBDIR.mjs +463 -0
- package/dist/chunk-GUMYXUO3.mjs +33 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MFI3RDA4.mjs +11 -0
- package/dist/chunk-QNHSXCWU.mjs +8692 -0
- package/dist/chunk-SURZYH7D.mjs +1726 -0
- package/dist/chunk-V2OPYD42.mjs +708 -0
- package/dist/chunk-VD3EVRUF.mjs +476 -0
- package/dist/chunk-VOLQMQPK.mjs +146 -0
- package/dist/chunk-VUEM62JF.mjs +523 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-ELX6RALJ.css +311 -0
- package/dist/full-OBTPW7TC.mjs +93 -0
- package/dist/index-ComBHfdn.d.ts +117 -0
- package/dist/index-DVwiIwYU.d.mts +117 -0
- package/dist/index.css +3033 -0
- package/dist/index.d.mts +396 -0
- package/dist/index.d.ts +396 -0
- package/dist/index.js +14688 -0
- package/dist/index.mjs +87 -0
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +931 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-35WC23HJ.mjs +60 -0
- package/dist/loaded-TBSVRJPY.css +90 -0
- package/dist/loaded-ULSROV73.mjs +57 -0
- package/dist/loaded-YYRJPIWZ.mjs +57 -0
- package/dist/no-external.css +3031 -0
- package/dist/no-external.d.mts +21 -0
- package/dist/no-external.d.ts +21 -0
- package/dist/no-external.js +14688 -0
- package/dist/no-external.mjs +87 -0
- package/dist/rsc.css +103 -0
- package/dist/rsc.d.mts +27 -0
- package/dist/rsc.d.ts +27 -0
- package/dist/rsc.js +1493 -0
- package/dist/rsc.mjs +148 -0
- package/dist/walk-tree-BPIigVTF.d.mts +29 -0
- package/dist/walk-tree-BZq1CPCH.d.ts +29 -0
- package/package.json +139 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { o as Field, p as FieldProps, q as DropZoneProps, C as Config, U as UserGenerics, D as Data, k as UiState, O as OnAction, f as Permissions, i as Plugin, j as Overrides, m as FieldTransforms, E as EditorAction, V as Viewports, I as IframeConfig, r as InitialHistory, M as Metadata, h as ResolveDataTrigger, s as ItemSelector, b as ComponentData, t as PluginInternal } from './actions-BCDhqbeL.js';
|
|
2
|
+
export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, l as ComponentConfig, G as ComponentConfigExtensions, J as ComponentConfigParams, K as ComponentDataMap, L as ComponentDataOptionalId, N as ComponentMetadata, Q as ConfigParams, a as Content, S as CustomField, T as CustomFieldRender, d as DefaultComponentProps, c as DefaultComponents, e as DefaultRootFieldProps, X as DefaultRootProps, Y as DefaultRootRenderProps, Z as Direction, _ as DragAxis, $ as EditorComponent, a0 as EditorContext, a1 as EditorMetadata, a2 as ExternalField, a3 as ExternalFieldWithAdaptor, a4 as ExtractConfigParams, a5 as ExtractField, a6 as FieldMetadata, a7 as FieldRenderFunctions, a8 as FieldTransformFn, a9 as FieldTransformFnParams, F as Fields, H as History, aa as ItemWithId, ab as MappedItem, ac as NumberField, ad as ObjectField, ae as OverrideKey, af as RadioField, ag as RichText, n as RichtextField, ah as RootConfig, R as RootData, g as RootDataWithProps, ai as RootDataWithoutProps, aj as SelectField, ak as Slot, al as SlotComponent, am as SlotField, an as TextField, ao as TextareaField, ap as Viewport, aq as WithChildren, ar as WithEditorProps, W as WithId, as as WithSlotProps, at as overrideKeys } from './actions-BCDhqbeL.js';
|
|
3
|
+
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BZq1CPCH.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-ComBHfdn.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
|
+
/**
|
|
25
|
+
* Shared state for components whose config has `global: true`. Keyed by
|
|
26
|
+
* component type. Every instance of a global-marked component renders from
|
|
27
|
+
* its entry in this map instead of its own props (except `children`, which
|
|
28
|
+
* is always extrinsic).
|
|
29
|
+
*
|
|
30
|
+
* There is exactly one entry per component type. Multiple named variants of
|
|
31
|
+
* the same component type are not supported in this shape — deliberately, to
|
|
32
|
+
* avoid introducing references / IDs.
|
|
33
|
+
*/
|
|
34
|
+
type GlobalData = Record<string, {
|
|
35
|
+
props: Record<string, any>;
|
|
36
|
+
}>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A concrete page destination surfaced in the editor's page switcher.
|
|
40
|
+
* `path` is the stable identifier AND the URL; `title` is the display
|
|
41
|
+
* label. Keep this type light — full page content lives in separate
|
|
42
|
+
* per-page data blobs owned by the consumer. When Editor eventually
|
|
43
|
+
* introduces a richer `Page` type (data + metadata + path + title),
|
|
44
|
+
* `Route` can stay as the summary / reference projection of it.
|
|
45
|
+
*/
|
|
46
|
+
type Route = {
|
|
47
|
+
path: string;
|
|
48
|
+
title: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
declare const ActionBar: {
|
|
52
|
+
({ label, children, }: {
|
|
53
|
+
label?: string;
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
}): react_jsx_runtime.JSX.Element;
|
|
56
|
+
Action: ({ children, label, onClick, active, disabled, }: {
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
label?: string;
|
|
59
|
+
onClick: (e: SyntheticEvent) => void;
|
|
60
|
+
active?: boolean;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
63
|
+
Label: ({ label }: {
|
|
64
|
+
label: string;
|
|
65
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
66
|
+
Group: ({ children }: {
|
|
67
|
+
children: ReactNode;
|
|
68
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
69
|
+
Separator: () => react_jsx_runtime.JSX.Element;
|
|
70
|
+
};
|
|
71
|
+
declare const Action: ({ children, label, onClick, active, disabled, }: {
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
label?: string;
|
|
74
|
+
onClick: (e: SyntheticEvent) => void;
|
|
75
|
+
active?: boolean;
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
78
|
+
declare const Group: ({ children }: {
|
|
79
|
+
children: ReactNode;
|
|
80
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
81
|
+
declare const Label: ({ label }: {
|
|
82
|
+
label: string;
|
|
83
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
84
|
+
declare const Separator: () => react_jsx_runtime.JSX.Element;
|
|
85
|
+
|
|
86
|
+
declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
|
|
87
|
+
children?: ReactNode;
|
|
88
|
+
icon?: ReactNode;
|
|
89
|
+
label: string;
|
|
90
|
+
el?: "label" | "div";
|
|
91
|
+
readOnly?: boolean;
|
|
92
|
+
className?: string;
|
|
93
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
94
|
+
|
|
95
|
+
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
|
96
|
+
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType> & {
|
|
97
|
+
value: any;
|
|
98
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
99
|
+
|
|
100
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
101
|
+
children: ReactNode;
|
|
102
|
+
href?: string;
|
|
103
|
+
onClick?: (e: any) => void | Promise<void>;
|
|
104
|
+
variant?: "primary" | "secondary";
|
|
105
|
+
type?: "button" | "submit" | "reset";
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
tabIndex?: number;
|
|
108
|
+
newTab?: boolean;
|
|
109
|
+
fullWidth?: boolean;
|
|
110
|
+
icon?: ReactNode;
|
|
111
|
+
size?: "medium" | "large";
|
|
112
|
+
loading?: boolean;
|
|
113
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
114
|
+
|
|
115
|
+
declare const ComponentList: {
|
|
116
|
+
({ children, title, id, }: {
|
|
117
|
+
id: string;
|
|
118
|
+
children?: ReactNode;
|
|
119
|
+
title?: string;
|
|
120
|
+
}): react_jsx_runtime.JSX.Element;
|
|
121
|
+
Item: ({ name, label, icon, }: {
|
|
122
|
+
name: string;
|
|
123
|
+
label?: string;
|
|
124
|
+
icon?: ReactNode;
|
|
125
|
+
index?: number;
|
|
126
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
declare const Drawer: {
|
|
130
|
+
({ children, droppableId, direction, variant, }: {
|
|
131
|
+
children: ReactNode;
|
|
132
|
+
droppableId?: string;
|
|
133
|
+
direction?: "vertical" | "horizontal";
|
|
134
|
+
variant?: "list" | "tile";
|
|
135
|
+
}): react_jsx_runtime.JSX.Element;
|
|
136
|
+
Item: ({ name, children, id, label, icon, index, isDragDisabled, }: {
|
|
137
|
+
name: string;
|
|
138
|
+
children?: (props: {
|
|
139
|
+
children: ReactNode;
|
|
140
|
+
name: string;
|
|
141
|
+
}) => ReactElement;
|
|
142
|
+
id?: string;
|
|
143
|
+
label?: string;
|
|
144
|
+
icon?: ReactNode;
|
|
145
|
+
index?: number;
|
|
146
|
+
isDragDisabled?: boolean;
|
|
147
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
declare const DropZone: react.ForwardRefExoticComponent<Omit<DropZoneProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
151
|
+
|
|
152
|
+
declare const IconButton: ({ active, children, href, onClick, type, disabled, tabIndex, newTab, fullWidth, title, suppressHydrationWarning, }: {
|
|
153
|
+
active?: boolean;
|
|
154
|
+
children: ReactNode;
|
|
155
|
+
href?: string;
|
|
156
|
+
onClick?: (e: SyntheticEvent) => void | Promise<void>;
|
|
157
|
+
type?: "button" | "submit" | "reset";
|
|
158
|
+
disabled?: boolean;
|
|
159
|
+
tabIndex?: number;
|
|
160
|
+
newTab?: boolean;
|
|
161
|
+
fullWidth?: boolean;
|
|
162
|
+
title: string;
|
|
163
|
+
suppressHydrationWarning?: boolean;
|
|
164
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
165
|
+
|
|
166
|
+
type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
167
|
+
children?: ReactNode;
|
|
168
|
+
config: UserConfig;
|
|
169
|
+
data: Partial<G["UserData"] | Data>;
|
|
170
|
+
globalData?: GlobalData;
|
|
171
|
+
ui?: Partial<UiState>;
|
|
172
|
+
onChange?: (data: G["UserData"]) => void;
|
|
173
|
+
onGlobalsChange?: (globalData: GlobalData) => void;
|
|
174
|
+
onPublish?: (data: G["UserData"]) => void;
|
|
175
|
+
onAction?: OnAction<G["UserData"]>;
|
|
176
|
+
permissions?: Partial<Permissions>;
|
|
177
|
+
plugins?: Plugin<UserConfig>[];
|
|
178
|
+
overrides?: Partial<Overrides<UserConfig>>;
|
|
179
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
180
|
+
renderHeader?: (props: {
|
|
181
|
+
children: ReactNode;
|
|
182
|
+
dispatch: (action: EditorAction) => void;
|
|
183
|
+
state: G["UserAppState"];
|
|
184
|
+
}) => ReactElement;
|
|
185
|
+
renderHeaderActions?: (props: {
|
|
186
|
+
state: G["UserAppState"];
|
|
187
|
+
dispatch: (action: EditorAction) => void;
|
|
188
|
+
}) => ReactElement;
|
|
189
|
+
headerTitle?: string;
|
|
190
|
+
headerPath?: string;
|
|
191
|
+
title?: ReactNode;
|
|
192
|
+
routes?: Route[];
|
|
193
|
+
currentPath?: string;
|
|
194
|
+
onRouteChange?: (path: string) => void | Promise<void>;
|
|
195
|
+
viewports?: Viewports;
|
|
196
|
+
iframe?: IframeConfig;
|
|
197
|
+
dnd?: {
|
|
198
|
+
disableAutoScroll?: boolean;
|
|
199
|
+
};
|
|
200
|
+
initialHistory?: InitialHistory;
|
|
201
|
+
metadata?: Metadata;
|
|
202
|
+
height?: CSSProperties["height"];
|
|
203
|
+
fullScreenCanvas?: boolean;
|
|
204
|
+
_experimentalVirtualization?: boolean;
|
|
205
|
+
};
|
|
206
|
+
declare function Editor<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: EditorProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
|
207
|
+
declare namespace Editor {
|
|
208
|
+
var Components: () => react_jsx_runtime.JSX.Element;
|
|
209
|
+
var Fields: react.MemoExoticComponent<({ wrapFields }: {
|
|
210
|
+
wrapFields?: boolean;
|
|
211
|
+
}) => react_jsx_runtime.JSX.Element>;
|
|
212
|
+
var Layout: ({ children }: {
|
|
213
|
+
children?: ReactNode;
|
|
214
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
215
|
+
var Outline: () => react_jsx_runtime.JSX.Element;
|
|
216
|
+
var Preview: ({ id }: {
|
|
217
|
+
id?: string;
|
|
218
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
declare const renderContext: react__default.Context<{
|
|
222
|
+
config: Config;
|
|
223
|
+
data: Data;
|
|
224
|
+
metadata: Metadata;
|
|
225
|
+
}>;
|
|
226
|
+
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, globalData, metadata, }: {
|
|
227
|
+
config: UserConfig;
|
|
228
|
+
data: Partial<G["UserData"] | Data>;
|
|
229
|
+
globalData?: GlobalData;
|
|
230
|
+
metadata?: Metadata;
|
|
231
|
+
}): react_jsx_runtime.JSX.Element;
|
|
232
|
+
|
|
233
|
+
declare function AlignLeft(): react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
235
|
+
declare function AlignCenter(): react_jsx_runtime.JSX.Element;
|
|
236
|
+
|
|
237
|
+
declare function AlignRight(): react_jsx_runtime.JSX.Element;
|
|
238
|
+
|
|
239
|
+
declare function AlignJustify(): react_jsx_runtime.JSX.Element;
|
|
240
|
+
|
|
241
|
+
declare function Bold(): react_jsx_runtime.JSX.Element;
|
|
242
|
+
|
|
243
|
+
declare function Italic(): react_jsx_runtime.JSX.Element;
|
|
244
|
+
|
|
245
|
+
declare function Underline(): react_jsx_runtime.JSX.Element;
|
|
246
|
+
|
|
247
|
+
declare function Strikethrough(): react_jsx_runtime.JSX.Element;
|
|
248
|
+
|
|
249
|
+
declare function InlineCode(): react_jsx_runtime.JSX.Element;
|
|
250
|
+
|
|
251
|
+
declare function BulletList(): react_jsx_runtime.JSX.Element;
|
|
252
|
+
|
|
253
|
+
declare function OrderedList(): react_jsx_runtime.JSX.Element;
|
|
254
|
+
|
|
255
|
+
declare function CodeBlock(): react_jsx_runtime.JSX.Element;
|
|
256
|
+
|
|
257
|
+
declare function Blockquote(): react_jsx_runtime.JSX.Element;
|
|
258
|
+
|
|
259
|
+
declare function HorizontalRule(): react_jsx_runtime.JSX.Element;
|
|
260
|
+
|
|
261
|
+
declare function Control({ icon, disabled, active, onClick, title, }: {
|
|
262
|
+
icon: ReactNode;
|
|
263
|
+
disabled?: boolean;
|
|
264
|
+
active?: boolean;
|
|
265
|
+
onClick: (e: SyntheticEvent) => any;
|
|
266
|
+
title: string;
|
|
267
|
+
}): react_jsx_runtime.JSX.Element;
|
|
268
|
+
|
|
269
|
+
declare const RichTextMenu: {
|
|
270
|
+
({ children }: {
|
|
271
|
+
children: ReactNode;
|
|
272
|
+
}): react_jsx_runtime.JSX.Element;
|
|
273
|
+
Group: ({ children }: {
|
|
274
|
+
children: ReactNode;
|
|
275
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
276
|
+
Control: typeof Control;
|
|
277
|
+
AlignCenter: typeof AlignCenter;
|
|
278
|
+
AlignJustify: typeof AlignJustify;
|
|
279
|
+
AlignLeft: typeof AlignLeft;
|
|
280
|
+
AlignRight: typeof AlignRight;
|
|
281
|
+
AlignSelect: () => react_jsx_runtime.JSX.Element;
|
|
282
|
+
Blockquote: typeof Blockquote;
|
|
283
|
+
Bold: typeof Bold;
|
|
284
|
+
BulletList: typeof BulletList;
|
|
285
|
+
CodeBlock: typeof CodeBlock;
|
|
286
|
+
HeadingSelect: () => react_jsx_runtime.JSX.Element;
|
|
287
|
+
HorizontalRule: typeof HorizontalRule;
|
|
288
|
+
InlineCode: typeof InlineCode;
|
|
289
|
+
Italic: typeof Italic;
|
|
290
|
+
ListSelect: () => react_jsx_runtime.JSX.Element;
|
|
291
|
+
OrderedList: typeof OrderedList;
|
|
292
|
+
Strikethrough: typeof Strikethrough;
|
|
293
|
+
Underline: typeof Underline;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Framework-agnostic SEO output shape. Mirrors the subset of Next.js's
|
|
298
|
+
* Metadata type that most page builders care about — title, description,
|
|
299
|
+
* Open Graph, canonical. Consumers can feed this directly into Next's
|
|
300
|
+
* generateMetadata or adapt it for other frameworks.
|
|
301
|
+
*/
|
|
302
|
+
type PageMetadata = {
|
|
303
|
+
title?: string;
|
|
304
|
+
description?: string;
|
|
305
|
+
openGraph?: {
|
|
306
|
+
title?: string;
|
|
307
|
+
description?: string;
|
|
308
|
+
images?: Array<{
|
|
309
|
+
url: string;
|
|
310
|
+
}>;
|
|
311
|
+
};
|
|
312
|
+
alternates?: {
|
|
313
|
+
canonical?: string;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Extracts SEO fields from a page's Root props. The convention: authors add
|
|
318
|
+
* `title`, `description`, `ogTitle`, `ogDescription`, `ogImage`, `canonical`
|
|
319
|
+
* fields to their root config. This helper maps them into a metadata shape
|
|
320
|
+
* you can return from Next's generateMetadata (or equivalent).
|
|
321
|
+
*
|
|
322
|
+
* export async function generateMetadata({ params }) {
|
|
323
|
+
* const data = await loadPage(params.slug);
|
|
324
|
+
* return pageMetadata(data);
|
|
325
|
+
* }
|
|
326
|
+
*
|
|
327
|
+
* Returns an empty object when no fields are set — safe to call on any
|
|
328
|
+
* data, including missing-page fallbacks.
|
|
329
|
+
*/
|
|
330
|
+
declare function pageMetadata(data: Data | undefined | null): PageMetadata;
|
|
331
|
+
|
|
332
|
+
declare const registerOverlayPortal: (el: HTMLElement | null | undefined, opts?: {
|
|
333
|
+
disableDrag?: boolean;
|
|
334
|
+
disableDragOnFocus?: boolean;
|
|
335
|
+
}) => (() => void) | undefined;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Helper function to set a value based on a dot-notated path
|
|
339
|
+
*/
|
|
340
|
+
declare function setDeep<T extends Record<string, any>>(node: T, path: string, newVal: any): T;
|
|
341
|
+
|
|
342
|
+
type UseEditorData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
343
|
+
appState: G["UserPublicAppState"];
|
|
344
|
+
config: UserConfig;
|
|
345
|
+
dispatch: AppStore["dispatch"];
|
|
346
|
+
getPermissions: GetPermissions<UserConfig>;
|
|
347
|
+
refreshPermissions: RefreshPermissions<UserConfig>;
|
|
348
|
+
resolveDataById: (id: string, trigger?: ResolveDataTrigger) => void;
|
|
349
|
+
resolveDataBySelector: (selector: ItemSelector, trigger?: ResolveDataTrigger) => void;
|
|
350
|
+
selectedItem: G["UserComponentData"] | null;
|
|
351
|
+
getItemBySelector: (selector: ItemSelector) => G["UserComponentData"] | undefined;
|
|
352
|
+
getItemById: (id: string) => G["UserComponentData"] | undefined;
|
|
353
|
+
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
|
354
|
+
getParentById: (id: string) => ComponentData | undefined;
|
|
355
|
+
history: {
|
|
356
|
+
back: HistorySlice["back"];
|
|
357
|
+
forward: HistorySlice["forward"];
|
|
358
|
+
setHistories: HistorySlice["setHistories"];
|
|
359
|
+
setHistoryIndex: HistorySlice["setHistoryIndex"];
|
|
360
|
+
histories: HistorySlice["histories"];
|
|
361
|
+
index: HistorySlice["index"];
|
|
362
|
+
hasPast: boolean;
|
|
363
|
+
hasFuture: boolean;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
type EditorApi<UserConfig extends Config = Config> = UseEditorData<UserConfig>;
|
|
367
|
+
type UseEditorStore<UserConfig extends Config = Config> = EditorApi<UserConfig>;
|
|
368
|
+
/**
|
|
369
|
+
* createUseEditor
|
|
370
|
+
*
|
|
371
|
+
* Create a typed useEditor hook, which is necessary because the user may provide a generic type but not
|
|
372
|
+
* a selector type, and TS does not currently support partial inference.
|
|
373
|
+
* Related: https://github.com/microsoft/TypeScript/issues/26242
|
|
374
|
+
*
|
|
375
|
+
* @returns a typed useEditor function
|
|
376
|
+
*/
|
|
377
|
+
declare function createUseEditor<UserConfig extends Config = Config>(): <T = EditorApi<UserConfig>>(selector: (state: UseEditorStore<UserConfig>) => T) => T;
|
|
378
|
+
declare function useEditor<UserConfig extends Config = Config>(): UseEditorStore<UserConfig>;
|
|
379
|
+
/**
|
|
380
|
+
* Get the latest state without relying on a render
|
|
381
|
+
*
|
|
382
|
+
* @returns EditorApi
|
|
383
|
+
*/
|
|
384
|
+
declare function useGetEditor(): () => UseEditorStore<Config>;
|
|
385
|
+
|
|
386
|
+
declare const blocksPlugin: () => Plugin;
|
|
387
|
+
|
|
388
|
+
declare const fieldsPlugin: (params?: {
|
|
389
|
+
desktopSideBar?: "left" | "right";
|
|
390
|
+
}) => PluginInternal;
|
|
391
|
+
|
|
392
|
+
declare const outlinePlugin: () => Plugin;
|
|
393
|
+
|
|
394
|
+
declare const legacySideBarPlugin: () => Plugin;
|
|
395
|
+
|
|
396
|
+
export { Action, ActionBar, AutoField, Button, ComponentData, ComponentList, Config, Data, Drawer, DropZone, Editor, EditorAction, type EditorApi, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalData, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, type PageMetadata, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, Separator, UiState, type UseEditorData, UserGenerics, Viewports, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useEditor, useGetEditor };
|