react-bricks 4.6.1 → 4.7.0-beta.1
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/astro/DynamicComponent.astro +170 -0
- package/astro/PageViewer.astro +47 -0
- package/astro/index.js +1 -0
- package/astro/package.json +17 -0
- package/astro/react-bricks-astro.d.ts +1216 -0
- package/astro/react-bricks-astro.esm.js +1 -0
- package/astro/server/index.js +1 -0
- package/astro/server/package.json +14 -0
- package/astro/server/react-bricks-astro-server.d.ts +1023 -0
- package/astro/server/react-bricks-astro-server.esm.js +1 -0
- package/frontend/index.js +1 -1
- package/frontend/package.json +1 -1
- package/frontend/react-bricks-frontend.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +30 -16
- package/react-bricks-1Be065Jm.js +1 -0
- package/react-bricks-B5lVuSry.esm.js +1 -0
- package/react-bricks-BFoJ4_oR.js +1 -0
- package/react-bricks-BNV57e5L.js +1 -0
- package/react-bricks-BNm3bMhQ.js +1 -0
- package/react-bricks-BO8V0Yxk.esm.js +1 -0
- package/react-bricks-BX28H7sD.js +1 -0
- package/react-bricks-Btf-citH.js +1 -0
- package/react-bricks-Bxd2YQWA.esm.js +1 -0
- package/react-bricks-C6NB1NCl.js +1 -0
- package/react-bricks-C8uZEwAc.esm.js +1 -0
- package/react-bricks-CI44eOAm.js +1 -0
- package/{react-bricks-amKwgsHP.esm.js → react-bricks-CSYRGq7N.esm.js} +1 -1
- package/react-bricks-CehpE_Dj.esm.js +1 -0
- package/react-bricks-DBsyFafC.js +1 -0
- package/react-bricks-DJfUVCN6.esm.js +1 -0
- package/react-bricks-DPkjyT2r.esm.js +1 -0
- package/react-bricks-DVKooNi6.esm.js +1 -0
- package/react-bricks-DzZdqeB7.esm.js +1 -0
- package/react-bricks-EDdZkV0N.js +1 -0
- package/react-bricks-HPMmwU16.esm.js +1 -0
- package/{react-bricks-C4Xaxf69.js → react-bricks-NL2q_6Ub.js} +1 -1
- package/react-bricks-rwnTYUVT.js +1 -0
- package/react-bricks-vrNJ5_JL.esm.js +1 -0
- package/react-bricks.d.ts +51 -32
- package/react-bricks.esm.js +1 -1
- package/rsc/client/index.js +1 -1
- package/rsc/client/package.json +1 -1
- package/rsc/client/react-bricks-rsc-client.d.ts +27 -8
- package/rsc/client/react-bricks-rsc-client.esm.js +1 -1
- package/rsc/index.js +1 -1
- package/rsc/package.json +1 -1
- package/rsc/react-bricks-rsc.d.ts +51 -32
- package/rsc/react-bricks-rsc.esm.js +1 -1
- package/react-bricks-8DGKndRH.esm.js +0 -1
- package/react-bricks-BI0lOdOd.js +0 -1
- package/react-bricks-BKgyRVXN.js +0 -1
- package/react-bricks-BQVp1I6D.js +0 -1
- package/react-bricks-C8TC7BiB.esm.js +0 -1
- package/react-bricks-CaxnQSIm.js +0 -1
- package/react-bricks-Cb_1qAfs.js +0 -1
- package/react-bricks-CjeZxHOb.esm.js +0 -1
- package/react-bricks-Cogx-YCi.esm.js +0 -1
- package/react-bricks-D3cMjNMP.esm.js +0 -1
- package/react-bricks-D8vmjvBM.js +0 -1
- package/react-bricks-ufYPAS2z.esm.js +0 -1
|
@@ -0,0 +1,1216 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { Descendant, Editor, BaseEditor, Element, Node } from 'slate';
|
|
4
|
+
import { RenderElementProps, RenderLeafProps, ReactEditor } from 'slate-react';
|
|
5
|
+
import { HistoryEditor } from 'slate-history';
|
|
6
|
+
|
|
7
|
+
declare namespace types {
|
|
8
|
+
export const EmbedProp = "RB_PAGE_EMBED";
|
|
9
|
+
export const EmbedContent = "RB_PAGE_EMBED_CONTENT";
|
|
10
|
+
/**
|
|
11
|
+
* Type of Sidebar control
|
|
12
|
+
*/
|
|
13
|
+
export enum SideEditPropType {
|
|
14
|
+
Text = "TEXT",
|
|
15
|
+
Textarea = "TEXTAREA",
|
|
16
|
+
Number = "NUMBER",
|
|
17
|
+
Date = "DATE",
|
|
18
|
+
Range = "RANGE",
|
|
19
|
+
Boolean = "BOOLEAN",
|
|
20
|
+
Select = "SELECT",
|
|
21
|
+
Autocomplete = "AUTOCOMPLETE",
|
|
22
|
+
Image = "IMAGE",
|
|
23
|
+
Custom = "CUSTOM",
|
|
24
|
+
Relationship = "RELATIONSHIP",
|
|
25
|
+
IconSelector = "ICON-SELECTOR"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* How to display the options
|
|
29
|
+
*/
|
|
30
|
+
export enum OptionsDisplay {
|
|
31
|
+
Select = "SELECT",
|
|
32
|
+
Radio = "RADIO",
|
|
33
|
+
Color = "COLOR"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Features for RichText: see also the new RichTextExt
|
|
37
|
+
*/
|
|
38
|
+
export enum RichTextFeatures {
|
|
39
|
+
Bold = "BOLD",
|
|
40
|
+
Italic = "ITALIC",
|
|
41
|
+
Code = "CODE",
|
|
42
|
+
Highlight = "HIGHLIGHT",
|
|
43
|
+
Subscript = "SUB",
|
|
44
|
+
Superscript = "SUP",
|
|
45
|
+
Link = "LINK",
|
|
46
|
+
UnorderedList = "UL",
|
|
47
|
+
OrderedList = "OL",
|
|
48
|
+
Heading1 = "H1",
|
|
49
|
+
Heading2 = "H2",
|
|
50
|
+
Heading3 = "H3",
|
|
51
|
+
Heading4 = "H4",
|
|
52
|
+
Heading5 = "H5",
|
|
53
|
+
Heading6 = "H6",
|
|
54
|
+
Quote = "QUOTE"
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Supported Icon Sets
|
|
58
|
+
*/
|
|
59
|
+
export enum IconSets {
|
|
60
|
+
HeroIconSolid = "hi-solid",
|
|
61
|
+
HeroIconOutline = "hi-outline",
|
|
62
|
+
FontAwesome = "fa6",
|
|
63
|
+
Feather = "fi"
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Page status
|
|
67
|
+
*/
|
|
68
|
+
export enum PageStatus {
|
|
69
|
+
Draft = "DRAFT",
|
|
70
|
+
Published = "PUBLISHED"
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Approval status
|
|
74
|
+
*/
|
|
75
|
+
export enum EditStatus {
|
|
76
|
+
Merged = "MERGED",
|
|
77
|
+
Working = "WORKING",
|
|
78
|
+
MergeRequested = "MERGE_REQUESTED"
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Device type for responsive preview (for the icon)
|
|
82
|
+
*/
|
|
83
|
+
export enum DeviceType {
|
|
84
|
+
Desktop = "DESKTOP",
|
|
85
|
+
Tablet = "TABLET",
|
|
86
|
+
Phone = "PHONE"
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Corner for the click-to-edit button
|
|
90
|
+
*/
|
|
91
|
+
export enum ClickToEditSide {
|
|
92
|
+
BottomRight = "BOTTOM-RIGHT",
|
|
93
|
+
BottomLeft = "BOTTOM-LEFT",
|
|
94
|
+
TopRight = "TOP-RIGHT",
|
|
95
|
+
TopLeft = "TOP-LEFT",
|
|
96
|
+
None = "NONE"
|
|
97
|
+
}
|
|
98
|
+
export enum BlockIconsPosition {
|
|
99
|
+
InsideBlock = "INSIDE-BLOCK",
|
|
100
|
+
OutsideBlock = "OUTSIDE-BLOCK"
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A Brick is a type of content block
|
|
104
|
+
*/
|
|
105
|
+
export type Brick<T = {}> = React__default.FC<T> & {
|
|
106
|
+
schema: IBlockType<T>;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Bricks are types of content block
|
|
110
|
+
*/
|
|
111
|
+
export type Bricks = {
|
|
112
|
+
[key: string]: Brick<any>;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* A Category contains bricks
|
|
116
|
+
*/
|
|
117
|
+
export type Category = {
|
|
118
|
+
categoryName: string;
|
|
119
|
+
bricks: Brick<any>[];
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* A Theme contains categories and bricks
|
|
123
|
+
*/
|
|
124
|
+
export type Theme = {
|
|
125
|
+
themeName: string;
|
|
126
|
+
categories: Category[];
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Custom role type
|
|
130
|
+
*/
|
|
131
|
+
export type CustomRole = {
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* The type of the user passed to permission functions
|
|
137
|
+
*/
|
|
138
|
+
export type PermissionUser = {
|
|
139
|
+
firstName: string;
|
|
140
|
+
lastName: string;
|
|
141
|
+
email: string;
|
|
142
|
+
isAdmin: boolean;
|
|
143
|
+
role: string;
|
|
144
|
+
customRole?: CustomRole;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* The type of the page passed to permission functions
|
|
148
|
+
*/
|
|
149
|
+
export type PermissionPage = {
|
|
150
|
+
slug: string;
|
|
151
|
+
pageType: string;
|
|
152
|
+
language: string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* The type of the brick passed to permission functions
|
|
156
|
+
*/
|
|
157
|
+
export type PermissionBrick = {
|
|
158
|
+
name: string;
|
|
159
|
+
category: string;
|
|
160
|
+
theme: string;
|
|
161
|
+
tags: string[];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* The permission functions
|
|
165
|
+
*/
|
|
166
|
+
export type Permissions = {
|
|
167
|
+
canAddPage?: (user: PermissionUser, pageType: string) => boolean;
|
|
168
|
+
canAddTranslation?: (user: PermissionUser, pageType: string, language: string) => boolean;
|
|
169
|
+
canSeePageType?: (user: PermissionUser, pageType: string) => boolean;
|
|
170
|
+
canSeePage?: (user: PermissionUser, page: Omit<PermissionPage, 'language'>) => boolean;
|
|
171
|
+
canEditPage?: (user: PermissionUser, page: PermissionPage) => boolean;
|
|
172
|
+
canDeletePage?: (user: PermissionUser, page: Omit<PermissionPage, 'language'>) => boolean;
|
|
173
|
+
canDeleteTranslation?: (user: PermissionUser, page: PermissionPage) => boolean;
|
|
174
|
+
canUseBrick?: (user: PermissionUser, brick: PermissionBrick) => boolean;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* The logged-in User
|
|
178
|
+
*/
|
|
179
|
+
export type User = {
|
|
180
|
+
id: string;
|
|
181
|
+
email: string;
|
|
182
|
+
firstName: string;
|
|
183
|
+
lastName: string;
|
|
184
|
+
company: string;
|
|
185
|
+
avatarUrl?: string;
|
|
186
|
+
isAdmin: boolean;
|
|
187
|
+
token: string;
|
|
188
|
+
appName: string;
|
|
189
|
+
appId: string;
|
|
190
|
+
appEnv: string;
|
|
191
|
+
deployHookUrl?: string;
|
|
192
|
+
deployHookMethod?: string;
|
|
193
|
+
deployHookTriggerOnScheduledPublishing: boolean;
|
|
194
|
+
deployHookStagingUrl?: string;
|
|
195
|
+
deployHookStagingMethod?: string;
|
|
196
|
+
deployHookStagingTriggerOnScheduledPublishing: boolean;
|
|
197
|
+
deployHookDevUrl?: string;
|
|
198
|
+
deployHookDevMethod?: string;
|
|
199
|
+
deployHookDevTriggerOnScheduledPublishing: boolean;
|
|
200
|
+
eventsHookUrl?: string;
|
|
201
|
+
eventsHookAuthToken?: string;
|
|
202
|
+
canCreatePage: boolean;
|
|
203
|
+
canDeletePage: boolean;
|
|
204
|
+
canDeploy: boolean;
|
|
205
|
+
canDeployStaging: boolean;
|
|
206
|
+
canDeployDev: boolean;
|
|
207
|
+
canEditPageAttributes: boolean;
|
|
208
|
+
canEditSeo: boolean;
|
|
209
|
+
canApprove: boolean;
|
|
210
|
+
role: string;
|
|
211
|
+
customRole?: CustomRole;
|
|
212
|
+
plan: string;
|
|
213
|
+
isVerified: boolean;
|
|
214
|
+
languages: Language[];
|
|
215
|
+
defaultLanguage: string;
|
|
216
|
+
hostname: string;
|
|
217
|
+
useWorkingCopy: boolean;
|
|
218
|
+
useApprovalWorkflow: boolean;
|
|
219
|
+
subscription: {
|
|
220
|
+
maxStories: number;
|
|
221
|
+
collaboration: boolean;
|
|
222
|
+
deployHookStaging: boolean;
|
|
223
|
+
deployHookDev: boolean;
|
|
224
|
+
scheduledPublishing: boolean;
|
|
225
|
+
embedPages: boolean;
|
|
226
|
+
lockBlocks: boolean;
|
|
227
|
+
flexibleRoles: boolean;
|
|
228
|
+
advancedSeo: boolean;
|
|
229
|
+
eventsLog: boolean;
|
|
230
|
+
maxFileSize: number;
|
|
231
|
+
maxImageSize: number;
|
|
232
|
+
maxFilesBatch: number;
|
|
233
|
+
maxFilesConcurrency: number;
|
|
234
|
+
diskSpace: number;
|
|
235
|
+
advancedDam: boolean;
|
|
236
|
+
workingCopy: boolean;
|
|
237
|
+
approvalWorkflow: boolean;
|
|
238
|
+
template: boolean;
|
|
239
|
+
};
|
|
240
|
+
} | null;
|
|
241
|
+
/**
|
|
242
|
+
* Translation for a Page
|
|
243
|
+
*/
|
|
244
|
+
export type Translation = {
|
|
245
|
+
language: string;
|
|
246
|
+
slug: string;
|
|
247
|
+
name: string;
|
|
248
|
+
status: PageStatus;
|
|
249
|
+
editStatus: EditStatus;
|
|
250
|
+
isLocked: boolean;
|
|
251
|
+
scheduledForPublishingOn: string;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* The page editing User
|
|
255
|
+
*/
|
|
256
|
+
export type EditingUser = {
|
|
257
|
+
id: string;
|
|
258
|
+
email: string;
|
|
259
|
+
firstName: string;
|
|
260
|
+
lastName: string;
|
|
261
|
+
company: string;
|
|
262
|
+
avatarUrl?: string;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Date and User of last edit
|
|
266
|
+
*/
|
|
267
|
+
export type LastEditedBy = {
|
|
268
|
+
date: string;
|
|
269
|
+
user: EditingUser;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* A React Bricks Page
|
|
273
|
+
*/
|
|
274
|
+
export type Page = {
|
|
275
|
+
id: string;
|
|
276
|
+
type: string;
|
|
277
|
+
name: string;
|
|
278
|
+
slug: string;
|
|
279
|
+
meta: IMeta;
|
|
280
|
+
customValues?: Props;
|
|
281
|
+
externalData?: Props;
|
|
282
|
+
content: IContentBlock[];
|
|
283
|
+
workingContent?: IContentBlock[];
|
|
284
|
+
committedContent?: IContentBlock[];
|
|
285
|
+
authorId?: string;
|
|
286
|
+
author: Author;
|
|
287
|
+
invalidBlocksTypes?: string[];
|
|
288
|
+
status: PageStatus;
|
|
289
|
+
editStatus: EditStatus;
|
|
290
|
+
isLocked: boolean;
|
|
291
|
+
tags: string[];
|
|
292
|
+
category?: string;
|
|
293
|
+
createdAt: string;
|
|
294
|
+
publishedAt?: string;
|
|
295
|
+
scheduledForPublishingOn?: string;
|
|
296
|
+
language: string;
|
|
297
|
+
translations: Translation[];
|
|
298
|
+
lastEditedBy: LastEditedBy;
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Page fields (without content)
|
|
302
|
+
*/
|
|
303
|
+
export type PageValues = Omit<Page, 'content'>;
|
|
304
|
+
/**
|
|
305
|
+
* A Page with all optional fields, used for the patch
|
|
306
|
+
*/
|
|
307
|
+
export type PartialPage = Partial<Page>;
|
|
308
|
+
/**
|
|
309
|
+
* Page from a list (no content)
|
|
310
|
+
*/
|
|
311
|
+
export type PageFromList = Omit<Page, 'content'>;
|
|
312
|
+
/**
|
|
313
|
+
* Page from a list with pagination
|
|
314
|
+
*/
|
|
315
|
+
export type PagesFromListWithPagination = {
|
|
316
|
+
items: PageFromList[];
|
|
317
|
+
pagination: {
|
|
318
|
+
page: number;
|
|
319
|
+
pageSize: number;
|
|
320
|
+
totalItems: number;
|
|
321
|
+
totalPages: number;
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* The Author of a Page
|
|
326
|
+
*/
|
|
327
|
+
export type Author = {
|
|
328
|
+
id: string;
|
|
329
|
+
email: string;
|
|
330
|
+
firstName: string;
|
|
331
|
+
lastName: string;
|
|
332
|
+
avatarUrl?: string;
|
|
333
|
+
company?: string;
|
|
334
|
+
};
|
|
335
|
+
export type BrickStory<T = Props> = {
|
|
336
|
+
id: string;
|
|
337
|
+
name: string;
|
|
338
|
+
showAsBrick?: boolean;
|
|
339
|
+
previewImageUrl?: string;
|
|
340
|
+
props: T;
|
|
341
|
+
};
|
|
342
|
+
type RepeaterItemDefault = IContentBlock | Omit<IContentBlock, 'id'> | Props;
|
|
343
|
+
export type RepeaterItems<T = RepeaterItemDefault> = Array<T>;
|
|
344
|
+
/**
|
|
345
|
+
* A Language for i18n
|
|
346
|
+
*/
|
|
347
|
+
export type Language = {
|
|
348
|
+
code: string;
|
|
349
|
+
name: string;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Render function for local links (should use the app's Router)
|
|
353
|
+
*/
|
|
354
|
+
interface LocalLinkProps {
|
|
355
|
+
href: string;
|
|
356
|
+
target?: string;
|
|
357
|
+
className?: string;
|
|
358
|
+
activeClassName?: string;
|
|
359
|
+
isAdmin?: boolean;
|
|
360
|
+
tabIndex?: number;
|
|
361
|
+
}
|
|
362
|
+
type LocalLinkPropsReal = React__default.PropsWithChildren<Omit<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LocalLinkProps> & LocalLinkProps>;
|
|
363
|
+
export type RenderLocalLink = ({ href, target, className, activeClassName, isAdmin, tabIndex, children, }: LocalLinkPropsReal) => React__default.ReactElement;
|
|
364
|
+
/**-
|
|
365
|
+
* The type of Text and RichText value
|
|
366
|
+
*/
|
|
367
|
+
export type TextValue = Descendant[] | string;
|
|
368
|
+
/**
|
|
369
|
+
* Props of a content block
|
|
370
|
+
*/
|
|
371
|
+
export type Props = {
|
|
372
|
+
[key: string]: any;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Options passed to the fetch function
|
|
376
|
+
*/
|
|
377
|
+
export type FetchOptions = {
|
|
378
|
+
cache?: string;
|
|
379
|
+
next?: {
|
|
380
|
+
[key: string]: any;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Interface for the Schema of a Brick
|
|
385
|
+
*/
|
|
386
|
+
export interface IBlockType<T = Props> {
|
|
387
|
+
name: string;
|
|
388
|
+
label: string;
|
|
389
|
+
getDefaultProps?: () => Partial<T>;
|
|
390
|
+
hideFromAddMenu?: boolean;
|
|
391
|
+
sideEditProps?: Array<ISideEditProp<T> | ISideGroup<T>>;
|
|
392
|
+
repeaterItems?: IRepeaterItem[];
|
|
393
|
+
newItemMenuOpen?: boolean;
|
|
394
|
+
groupByRepeater?: boolean;
|
|
395
|
+
mapExternalDataToProps?: (externalData: Props, brickProps?: T) => Partial<T>;
|
|
396
|
+
getData?: (page: Page, brickProps?: T, args?: any) => Promise<Partial<T>>;
|
|
397
|
+
getExternalData?: (page: Page, brickProps?: T, args?: any) => Promise<Partial<T>>;
|
|
398
|
+
playgroundLinkUrl?: string;
|
|
399
|
+
playgroundLinkLabel?: string;
|
|
400
|
+
theme?: string;
|
|
401
|
+
category?: string;
|
|
402
|
+
tags?: string[];
|
|
403
|
+
previewImageUrl?: string;
|
|
404
|
+
previewIcon?: React__default.ReactElement;
|
|
405
|
+
stories?: BrickStory<Partial<T>>[];
|
|
406
|
+
astroInteractivity?: 'load' | {
|
|
407
|
+
load: true;
|
|
408
|
+
} | 'idle' | {
|
|
409
|
+
idle: true;
|
|
410
|
+
} | {
|
|
411
|
+
idle: {
|
|
412
|
+
timeout: number;
|
|
413
|
+
};
|
|
414
|
+
} | 'visible' | {
|
|
415
|
+
visible: true;
|
|
416
|
+
} | {
|
|
417
|
+
visible: {
|
|
418
|
+
rootMargin: string;
|
|
419
|
+
};
|
|
420
|
+
} | {
|
|
421
|
+
media: string;
|
|
422
|
+
} | {
|
|
423
|
+
only: string;
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Item of a Repeater
|
|
428
|
+
*/
|
|
429
|
+
export interface IRepeaterItem {
|
|
430
|
+
name: string;
|
|
431
|
+
label?: string;
|
|
432
|
+
itemType?: string;
|
|
433
|
+
itemLabel?: string;
|
|
434
|
+
defaultOpen?: boolean;
|
|
435
|
+
min?: number;
|
|
436
|
+
max?: number;
|
|
437
|
+
positionLabel?: string;
|
|
438
|
+
getDefaultProps?: () => Props;
|
|
439
|
+
items?: {
|
|
440
|
+
type: string;
|
|
441
|
+
label?: string;
|
|
442
|
+
min?: number;
|
|
443
|
+
max?: number;
|
|
444
|
+
getDefaultProps?: () => Props;
|
|
445
|
+
}[];
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* The content of a block (instance of a Brick)
|
|
449
|
+
*/
|
|
450
|
+
export interface IContentBlock {
|
|
451
|
+
id: string;
|
|
452
|
+
type: string;
|
|
453
|
+
props: Props;
|
|
454
|
+
locked?: boolean;
|
|
455
|
+
canAddAfter?: boolean;
|
|
456
|
+
canAddBefore?: boolean;
|
|
457
|
+
canEditContent?: boolean;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Option of a select sidebar prop
|
|
461
|
+
*/
|
|
462
|
+
export interface IOption {
|
|
463
|
+
value: any;
|
|
464
|
+
label: string;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Interface for Props of a Custom sidebar component
|
|
468
|
+
*/
|
|
469
|
+
export interface ICustomKnobProps {
|
|
470
|
+
id: string;
|
|
471
|
+
value: any;
|
|
472
|
+
onChange: any;
|
|
473
|
+
isValid: boolean;
|
|
474
|
+
errorMessage?: string;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Sidebar edit Props for a Page
|
|
478
|
+
*/
|
|
479
|
+
export interface ISideEditPropPage<T = Props> {
|
|
480
|
+
name: string;
|
|
481
|
+
label: string;
|
|
482
|
+
type: SideEditPropType;
|
|
483
|
+
component?: React__default.FC<ICustomKnobProps>;
|
|
484
|
+
validate?: (value: any, props?: T) => boolean | string;
|
|
485
|
+
show?: (props: T, page?: Page, user?: User) => boolean;
|
|
486
|
+
helperText?: string;
|
|
487
|
+
textareaOptions?: {
|
|
488
|
+
height?: number;
|
|
489
|
+
};
|
|
490
|
+
imageOptions?: {
|
|
491
|
+
maxWidth?: number;
|
|
492
|
+
quality?: number;
|
|
493
|
+
aspectRatio?: number;
|
|
494
|
+
};
|
|
495
|
+
rangeOptions?: {
|
|
496
|
+
min?: number;
|
|
497
|
+
max?: number;
|
|
498
|
+
step?: number;
|
|
499
|
+
};
|
|
500
|
+
selectOptions?: {
|
|
501
|
+
options?: IOption[];
|
|
502
|
+
getOptions?: (props: Props) => IOption[] | Promise<IOption[]>;
|
|
503
|
+
display: OptionsDisplay;
|
|
504
|
+
};
|
|
505
|
+
autocompleteOptions?: {
|
|
506
|
+
placeholder?: string;
|
|
507
|
+
getOptions: (input: string, props: Props) => any[] | Promise<any[]>;
|
|
508
|
+
getKey: (option: any) => string | number;
|
|
509
|
+
getLabel: (option: any) => string;
|
|
510
|
+
renderOption?: ({ option, selected, focus, }: {
|
|
511
|
+
option: any;
|
|
512
|
+
selected: boolean;
|
|
513
|
+
focus: boolean;
|
|
514
|
+
}) => React__default.ReactElement;
|
|
515
|
+
debounceTime?: number;
|
|
516
|
+
getNoOptionsMessage?: (input?: string) => string;
|
|
517
|
+
};
|
|
518
|
+
iconSelectorOptions?: {
|
|
519
|
+
iconSets?: IconSets[];
|
|
520
|
+
};
|
|
521
|
+
relationshipOptions?: {
|
|
522
|
+
label?: string;
|
|
523
|
+
references: string;
|
|
524
|
+
multiple: boolean;
|
|
525
|
+
embedValues?: boolean;
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Sidebar Edit Props
|
|
530
|
+
*/
|
|
531
|
+
export interface ISideEditProp<T = Props> extends ISideEditPropPage<T> {
|
|
532
|
+
shouldRefreshText?: boolean;
|
|
533
|
+
shouldRefreshStyles?: boolean;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* A collapsible Group of sidebar Props
|
|
537
|
+
*/
|
|
538
|
+
export interface ISideGroup<T = Props> {
|
|
539
|
+
groupName: string;
|
|
540
|
+
defaultOpen?: boolean;
|
|
541
|
+
show?: (props: T, page?: Page, user?: User) => boolean;
|
|
542
|
+
props: ISideEditProp<T>[] | ISideEditPropPage<T>[];
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Image Crop interface
|
|
546
|
+
*/
|
|
547
|
+
export interface ICrop {
|
|
548
|
+
x: number;
|
|
549
|
+
y: number;
|
|
550
|
+
width: number;
|
|
551
|
+
height: number;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Image Transform interface
|
|
555
|
+
*/
|
|
556
|
+
export interface ITransform {
|
|
557
|
+
rotate?: number;
|
|
558
|
+
flip?: {
|
|
559
|
+
horizontal: boolean;
|
|
560
|
+
vertical: boolean;
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Image value interface
|
|
565
|
+
*/
|
|
566
|
+
export interface IImageSource {
|
|
567
|
+
src: string;
|
|
568
|
+
srcSet?: string;
|
|
569
|
+
type?: string;
|
|
570
|
+
fallbackSrc?: string;
|
|
571
|
+
fallbackSrcSet?: string;
|
|
572
|
+
fallbackType?: string;
|
|
573
|
+
placeholderSrc?: string;
|
|
574
|
+
alt?: string;
|
|
575
|
+
seoName?: string;
|
|
576
|
+
width?: number;
|
|
577
|
+
height?: number;
|
|
578
|
+
highPriority?: boolean;
|
|
579
|
+
hashId?: string;
|
|
580
|
+
crop?: ICrop;
|
|
581
|
+
transform?: ITransform;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* File value interface
|
|
585
|
+
*/
|
|
586
|
+
export interface IFileSource {
|
|
587
|
+
name: string;
|
|
588
|
+
url: string;
|
|
589
|
+
size: number;
|
|
590
|
+
extension: string;
|
|
591
|
+
pagesNum: number;
|
|
592
|
+
title?: string | undefined;
|
|
593
|
+
alt?: string | undefined;
|
|
594
|
+
copyright?: string | undefined;
|
|
595
|
+
source?: string | undefined;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* A Color for a Select sidebar prop
|
|
599
|
+
*/
|
|
600
|
+
export interface IColor {
|
|
601
|
+
color: string;
|
|
602
|
+
[propName: string]: any;
|
|
603
|
+
}
|
|
604
|
+
export interface IBrickStory {
|
|
605
|
+
brickName: string;
|
|
606
|
+
storyName: string;
|
|
607
|
+
locked?: boolean;
|
|
608
|
+
canAddAfter?: boolean;
|
|
609
|
+
canAddBefore?: boolean;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* TemplateSlot type
|
|
613
|
+
*/
|
|
614
|
+
export type TemplateSlot = {
|
|
615
|
+
slotName: string;
|
|
616
|
+
label: string;
|
|
617
|
+
min?: number;
|
|
618
|
+
max?: number;
|
|
619
|
+
allowedBlockTypes?: string[];
|
|
620
|
+
excludedBlockTypes?: string[];
|
|
621
|
+
editable?: boolean;
|
|
622
|
+
getDefaultContent?: () => (string | IBrickStory | IContentBlock)[];
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* Page type
|
|
626
|
+
*/
|
|
627
|
+
export interface IPageType {
|
|
628
|
+
name: string;
|
|
629
|
+
pluralName: string;
|
|
630
|
+
isEntity?: boolean;
|
|
631
|
+
allowedBlockTypes?: string[];
|
|
632
|
+
excludedBlockTypes?: string[];
|
|
633
|
+
defaultLocked?: boolean;
|
|
634
|
+
defaultStatus?: PageStatus;
|
|
635
|
+
defaultFeaturedImage?: string;
|
|
636
|
+
getDefaultContent?: () => (string | IBrickStory | IContentBlock)[];
|
|
637
|
+
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
638
|
+
getExternalData?: (page: Page, args?: any) => Promise<Props>;
|
|
639
|
+
getDefaultMeta?: (page: PageFromList, externalData: Props) => Partial<IMeta>;
|
|
640
|
+
metaImageAspectRatio?: number;
|
|
641
|
+
categories?: ICategory[];
|
|
642
|
+
slugPrefix?: ISlugPrefix;
|
|
643
|
+
template?: Array<TemplateSlot>;
|
|
644
|
+
headlessView?: boolean;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Structure returned by the cleanBlocks function
|
|
648
|
+
*/
|
|
649
|
+
export interface ICleanBlocks {
|
|
650
|
+
blocks: IContentBlock[];
|
|
651
|
+
invalidBlocksTypes: string[];
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Responsive breakpoint for preview
|
|
655
|
+
*/
|
|
656
|
+
export interface ResponsiveBreakpoint {
|
|
657
|
+
type: DeviceType;
|
|
658
|
+
width: number | string;
|
|
659
|
+
label: string;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Login UI customization
|
|
663
|
+
*/
|
|
664
|
+
export interface LoginUI {
|
|
665
|
+
sideImage?: string;
|
|
666
|
+
logo?: string;
|
|
667
|
+
logoWidth?: number;
|
|
668
|
+
logoHeight?: number;
|
|
669
|
+
welcomeText?: string;
|
|
670
|
+
welcomeTextStyle?: React__default.CSSProperties;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* MenuItem interface
|
|
674
|
+
*/
|
|
675
|
+
export interface IMenuItem {
|
|
676
|
+
label: string;
|
|
677
|
+
path?: string;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* The ReactBricks configuration
|
|
681
|
+
*/
|
|
682
|
+
export interface ReactBricksConfig {
|
|
683
|
+
appId: string;
|
|
684
|
+
apiKey: string;
|
|
685
|
+
environment?: string;
|
|
686
|
+
bricks?: types.Brick<any>[] | types.Theme[];
|
|
687
|
+
pageTypes?: types.IPageType[];
|
|
688
|
+
logo?: string;
|
|
689
|
+
loginUI?: LoginUI;
|
|
690
|
+
contentClassName?: string;
|
|
691
|
+
defaultTheme?: string;
|
|
692
|
+
renderLocalLink: types.RenderLocalLink;
|
|
693
|
+
navigate: (path: string) => void;
|
|
694
|
+
loginPath?: string;
|
|
695
|
+
editorPath?: string;
|
|
696
|
+
mediaLibraryPath?: string;
|
|
697
|
+
playgroundPath?: string;
|
|
698
|
+
appSettingsPath?: string;
|
|
699
|
+
previewPath?: string;
|
|
700
|
+
getAdminMenu?: (args: {
|
|
701
|
+
isAdmin: boolean;
|
|
702
|
+
}) => IMenuItem[];
|
|
703
|
+
isDarkColorMode?: boolean;
|
|
704
|
+
toggleColorMode?: () => void;
|
|
705
|
+
useCssInJs?: boolean;
|
|
706
|
+
appRootElement: string | HTMLElement;
|
|
707
|
+
clickToEditSide?: ClickToEditSide;
|
|
708
|
+
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
709
|
+
responsiveBreakpoints?: ResponsiveBreakpoint[];
|
|
710
|
+
enableAutoSave?: boolean;
|
|
711
|
+
disableSaveIfInvalidProps?: boolean;
|
|
712
|
+
enablePreview?: boolean;
|
|
713
|
+
blockIconsPosition?: BlockIconsPosition;
|
|
714
|
+
enablePreviewImage?: boolean;
|
|
715
|
+
enablePreviewIcon?: boolean;
|
|
716
|
+
enableUnsplash?: boolean;
|
|
717
|
+
unsplashApiKey?: string;
|
|
718
|
+
enableDefaultEmbedBrick?: boolean;
|
|
719
|
+
permissions?: Permissions;
|
|
720
|
+
allowAccentsInSlugs?: boolean;
|
|
721
|
+
warningIfLowBattery?: boolean;
|
|
722
|
+
rtlLanguages?: Array<string>;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* The ReactBricks context
|
|
726
|
+
*/
|
|
727
|
+
export interface IReactBricksContext {
|
|
728
|
+
version: string;
|
|
729
|
+
appId: string;
|
|
730
|
+
apiKey: string;
|
|
731
|
+
environment?: string;
|
|
732
|
+
bricks: Bricks;
|
|
733
|
+
themes: types.Theme[];
|
|
734
|
+
pageTypes: IPageType[];
|
|
735
|
+
logo: string;
|
|
736
|
+
loginUI: LoginUI;
|
|
737
|
+
contentClassName: string;
|
|
738
|
+
defaultTheme: string;
|
|
739
|
+
renderLocalLink: RenderLocalLink;
|
|
740
|
+
navigate: (path: string) => void;
|
|
741
|
+
loginPath: string;
|
|
742
|
+
editorPath: string;
|
|
743
|
+
mediaLibraryPath: string;
|
|
744
|
+
playgroundPath: string;
|
|
745
|
+
appSettingsPath: string;
|
|
746
|
+
previewPath: string;
|
|
747
|
+
getAdminMenu?: (args: {
|
|
748
|
+
isAdmin: boolean;
|
|
749
|
+
}) => IMenuItem[];
|
|
750
|
+
isDarkColorMode?: boolean;
|
|
751
|
+
toggleColorMode?: () => void;
|
|
752
|
+
useCssInJs?: boolean;
|
|
753
|
+
appRootElement: string | HTMLElement;
|
|
754
|
+
clickToEditSide?: ClickToEditSide;
|
|
755
|
+
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
756
|
+
responsiveBreakpoints: ResponsiveBreakpoint[];
|
|
757
|
+
enableAutoSave: boolean;
|
|
758
|
+
disableSaveIfInvalidProps: boolean;
|
|
759
|
+
enablePreview: boolean;
|
|
760
|
+
browserSupport: {
|
|
761
|
+
webP: boolean;
|
|
762
|
+
lazyLoading: boolean;
|
|
763
|
+
};
|
|
764
|
+
blockIconsPosition: BlockIconsPosition;
|
|
765
|
+
enablePreviewImage: boolean;
|
|
766
|
+
enablePreviewIcon: boolean;
|
|
767
|
+
enableUnsplash: boolean;
|
|
768
|
+
unsplashApiKey?: string;
|
|
769
|
+
enableDefaultEmbedBrick: boolean;
|
|
770
|
+
permissions?: Permissions;
|
|
771
|
+
allowAccentsInSlugs: boolean;
|
|
772
|
+
warningIfLowBattery: boolean;
|
|
773
|
+
isRtlLanguage: ({ language }: {
|
|
774
|
+
language: string;
|
|
775
|
+
}) => boolean;
|
|
776
|
+
rtlLanguages: string[];
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* The current page in Admin
|
|
780
|
+
*/
|
|
781
|
+
export interface ICurrentPage {
|
|
782
|
+
pageId: string;
|
|
783
|
+
language?: string;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* The Admin context returned from useAdminContext
|
|
787
|
+
*/
|
|
788
|
+
export interface IReadAdminContext {
|
|
789
|
+
isAdmin: boolean;
|
|
790
|
+
previewMode: boolean;
|
|
791
|
+
currentPage: ICurrentPage;
|
|
792
|
+
showRichTextModal: ShowRichTextModal;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Opengraph type
|
|
796
|
+
*/
|
|
797
|
+
export type OpenGraphType = 'article' | 'website' | 'profile' | 'book' | 'video' | 'music';
|
|
798
|
+
/**
|
|
799
|
+
* OpenGraph data
|
|
800
|
+
*/
|
|
801
|
+
export type OpenGraphData = {
|
|
802
|
+
url?: string;
|
|
803
|
+
type?: OpenGraphType;
|
|
804
|
+
title?: string;
|
|
805
|
+
description?: string;
|
|
806
|
+
image?: types.IImageSource;
|
|
807
|
+
};
|
|
808
|
+
/**
|
|
809
|
+
* Twitter card type
|
|
810
|
+
*/
|
|
811
|
+
export type TwitterCardType = 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
812
|
+
/**
|
|
813
|
+
* Data for Twitter card
|
|
814
|
+
*/
|
|
815
|
+
export type TwitterCardData = {
|
|
816
|
+
card?: TwitterCardType;
|
|
817
|
+
site?: string;
|
|
818
|
+
creator?: string;
|
|
819
|
+
title?: string;
|
|
820
|
+
description?: string;
|
|
821
|
+
image?: types.IImageSource;
|
|
822
|
+
};
|
|
823
|
+
/**
|
|
824
|
+
* Meta Fields type
|
|
825
|
+
* */
|
|
826
|
+
export type MetaData = {
|
|
827
|
+
title?: string;
|
|
828
|
+
description?: string;
|
|
829
|
+
keywords?: string;
|
|
830
|
+
featuredImage?: string;
|
|
831
|
+
image?: IImageSource;
|
|
832
|
+
};
|
|
833
|
+
/**
|
|
834
|
+
* Meta fields on Page
|
|
835
|
+
*/
|
|
836
|
+
export interface IMeta extends MetaData {
|
|
837
|
+
language?: string;
|
|
838
|
+
openGraph?: OpenGraphData;
|
|
839
|
+
twitterCard?: TwitterCardData;
|
|
840
|
+
schemaOrg?: SchemaOrgData;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Category on categories (pageTypes)
|
|
844
|
+
*/
|
|
845
|
+
export interface ICategory {
|
|
846
|
+
category?: string;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* A RichTextExt Plugin
|
|
850
|
+
*/
|
|
851
|
+
export interface RichTextPlugin {
|
|
852
|
+
type: 'Mark' | 'Block' | 'List';
|
|
853
|
+
name: string;
|
|
854
|
+
isInline?: boolean;
|
|
855
|
+
itemName?: string;
|
|
856
|
+
label: string;
|
|
857
|
+
hotKey?: string;
|
|
858
|
+
renderElement?: (props: RenderElementProps) => React__default.ReactElement;
|
|
859
|
+
renderItemElement?: (props: RenderElementProps) => React__default.ReactElement;
|
|
860
|
+
renderLeaf?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
861
|
+
toggle: (editor: Editor, plugins: RichTextPlugin[], showRichTextModal: types.ShowRichTextModal) => void;
|
|
862
|
+
button?: {
|
|
863
|
+
icon: React__default.ReactElement;
|
|
864
|
+
isActive: (editor: Editor) => boolean;
|
|
865
|
+
};
|
|
866
|
+
enhanceEditor?: (editor: Editor) => Editor;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Definition for a Mark plugin
|
|
870
|
+
*/
|
|
871
|
+
export interface MarkPlugin {
|
|
872
|
+
name: string;
|
|
873
|
+
label?: string;
|
|
874
|
+
hotKey?: string;
|
|
875
|
+
render: (props: RenderLeafProps) => React__default.ReactElement;
|
|
876
|
+
icon?: React__default.ReactElement;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Constructor for a Mark plugin
|
|
880
|
+
*/
|
|
881
|
+
export type MarkPluginConstructor = (markPlugin: MarkPlugin) => RichTextPlugin;
|
|
882
|
+
/**
|
|
883
|
+
* Definition for a Block plugin
|
|
884
|
+
*/
|
|
885
|
+
export interface BlockPlugin {
|
|
886
|
+
name: string;
|
|
887
|
+
isInline?: boolean;
|
|
888
|
+
itemName?: string;
|
|
889
|
+
label?: string;
|
|
890
|
+
hotKey?: string;
|
|
891
|
+
render: (props: RenderElementProps) => React__default.ReactElement;
|
|
892
|
+
renderItem?: (props: RenderElementProps) => React__default.ReactElement;
|
|
893
|
+
icon?: React__default.ReactElement;
|
|
894
|
+
}
|
|
895
|
+
export type BlockWithModalPlugin = BlockPlugin & {
|
|
896
|
+
getDefaultProps?: () => Props;
|
|
897
|
+
renderAdmin?: (props: RenderElementProps) => React__default.ReactElement;
|
|
898
|
+
renderItemAdmin?: (props: RenderElementProps) => React__default.ReactElement;
|
|
899
|
+
pluginCustomFields: Array<types.ISideEditPropPage | types.ISideGroup>;
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* Constructor for a Block plugin
|
|
903
|
+
*/
|
|
904
|
+
export type BlockPluginConstructor = (blockPlugin: BlockPlugin) => RichTextPlugin;
|
|
905
|
+
/**
|
|
906
|
+
* Constructor for a Block with Modal plugin
|
|
907
|
+
*/
|
|
908
|
+
export type BlockWithModalPluginConstructor = (blockPlugin: BlockWithModalPlugin) => RichTextPlugin;
|
|
909
|
+
/**
|
|
910
|
+
* Icon
|
|
911
|
+
*/
|
|
912
|
+
export type Icon = {
|
|
913
|
+
name: string;
|
|
914
|
+
svg: string;
|
|
915
|
+
url: string;
|
|
916
|
+
set: string;
|
|
917
|
+
};
|
|
918
|
+
export { };
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
interface AstroBrickProps {
|
|
922
|
+
index?: number;
|
|
923
|
+
itemsCount?: number;
|
|
924
|
+
blockProps: {
|
|
925
|
+
[x: string]: any;
|
|
926
|
+
};
|
|
927
|
+
page?: types.Page;
|
|
928
|
+
block: types.IContentBlock;
|
|
929
|
+
pathname?: string;
|
|
930
|
+
}
|
|
931
|
+
declare const AstroBrick: React__default.FC<AstroBrickProps>;
|
|
932
|
+
|
|
933
|
+
declare const ClickToEdit: React__default.FC<ClickToEditProps>;
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Props for Link component
|
|
937
|
+
*/
|
|
938
|
+
interface LinkProps {
|
|
939
|
+
href: string;
|
|
940
|
+
target?: string;
|
|
941
|
+
className?: string;
|
|
942
|
+
activeClassName?: string;
|
|
943
|
+
simpleAnchor?: boolean;
|
|
944
|
+
}
|
|
945
|
+
type LinkPropsReal = React.PropsWithChildren<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> & LinkProps>;
|
|
946
|
+
declare const Link: React.FC<LinkPropsReal>;
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Props for Text
|
|
950
|
+
*/
|
|
951
|
+
interface FileProps {
|
|
952
|
+
propName: string;
|
|
953
|
+
renderBlock: (props: types.IFileSource | null) => React__default.ReactElement;
|
|
954
|
+
allowedExtensions?: string[];
|
|
955
|
+
source: types.IFileSource;
|
|
956
|
+
}
|
|
957
|
+
declare const File: React__default.FC<FileProps>;
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Arguments for the renderWrapper function
|
|
961
|
+
*/
|
|
962
|
+
interface IRenderWrapperArgs {
|
|
963
|
+
children: React.ReactNode;
|
|
964
|
+
width?: number;
|
|
965
|
+
height?: number;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* renderWrapper function type
|
|
969
|
+
*/
|
|
970
|
+
type RenderWrapper = (args: IRenderWrapperArgs) => React.ReactElement;
|
|
971
|
+
interface PlaceholderProps {
|
|
972
|
+
aspectRatio?: number;
|
|
973
|
+
maxWidth?: number;
|
|
974
|
+
isDarkColorMode?: boolean;
|
|
975
|
+
isAdmin: boolean;
|
|
976
|
+
}
|
|
977
|
+
interface SharedImageProps {
|
|
978
|
+
readonly?: boolean;
|
|
979
|
+
alt: string;
|
|
980
|
+
noLazyLoad?: boolean;
|
|
981
|
+
containerClassName?: string;
|
|
982
|
+
containerStyle?: React.CSSProperties;
|
|
983
|
+
imageClassName?: string;
|
|
984
|
+
imageStyle?: React.CSSProperties;
|
|
985
|
+
noWrapper?: boolean;
|
|
986
|
+
quality?: number;
|
|
987
|
+
sizes?: string;
|
|
988
|
+
loading?: 'lazy' | 'eager';
|
|
989
|
+
renderWrapper?: RenderWrapper;
|
|
990
|
+
useNativeLazyLoading?: boolean;
|
|
991
|
+
useWebP?: boolean;
|
|
992
|
+
placeholder?: (props: PlaceholderProps) => string;
|
|
993
|
+
source: types.IImageSource;
|
|
994
|
+
}
|
|
995
|
+
interface EditableImage extends SharedImageProps {
|
|
996
|
+
readonly?: false;
|
|
997
|
+
propName?: string;
|
|
998
|
+
metaFieldName?: 'image';
|
|
999
|
+
customFieldName?: string;
|
|
1000
|
+
aspectRatio?: number;
|
|
1001
|
+
maxWidth?: number;
|
|
1002
|
+
}
|
|
1003
|
+
interface ReadOnlyImage extends SharedImageProps {
|
|
1004
|
+
readonly: true;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Props for Image
|
|
1008
|
+
*/
|
|
1009
|
+
type ImageProps = EditableImage | ReadOnlyImage;
|
|
1010
|
+
declare const Image: React.FC<ImageProps>;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Props for Repeater
|
|
1014
|
+
*/
|
|
1015
|
+
interface RepeaterProps {
|
|
1016
|
+
propName: string;
|
|
1017
|
+
itemProps?: types.Props;
|
|
1018
|
+
renderWrapper?: (items: React.ReactElement) => React.ReactElement;
|
|
1019
|
+
renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
|
|
1020
|
+
items: types.RepeaterItems;
|
|
1021
|
+
}
|
|
1022
|
+
declare const Repeater: React.FC<RepeaterProps>;
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Props for renderLink render function
|
|
1026
|
+
*/
|
|
1027
|
+
interface RenderLinkElementProps extends RenderElementProps {
|
|
1028
|
+
href: string;
|
|
1029
|
+
target?: string;
|
|
1030
|
+
rel?: string;
|
|
1031
|
+
}
|
|
1032
|
+
interface BaseRichTextProps {
|
|
1033
|
+
renderBlock?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1034
|
+
placeholder?: string;
|
|
1035
|
+
renderPlaceholder?: (props: {
|
|
1036
|
+
children: any;
|
|
1037
|
+
}) => React__default.ReactElement;
|
|
1038
|
+
multiline?: boolean;
|
|
1039
|
+
softLineBreak?: boolean;
|
|
1040
|
+
allowedFeatures?: types.RichTextFeatures[];
|
|
1041
|
+
renderBold?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
1042
|
+
renderItalic?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
1043
|
+
renderHighlight?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
1044
|
+
renderCode?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
1045
|
+
renderSub?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
1046
|
+
renderSup?: (props: RenderLeafProps) => React__default.ReactElement;
|
|
1047
|
+
renderLink?: (props: RenderLinkElementProps) => React__default.ReactElement;
|
|
1048
|
+
renderUL?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1049
|
+
renderOL?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1050
|
+
renderLI?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1051
|
+
renderH1?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1052
|
+
renderH2?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1053
|
+
renderH3?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1054
|
+
renderH4?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1055
|
+
renderH5?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1056
|
+
renderH6?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1057
|
+
renderQuote?: (props: RenderElementProps) => React__default.ReactElement;
|
|
1058
|
+
}
|
|
1059
|
+
interface RichTextPropsWithPropName extends BaseRichTextProps {
|
|
1060
|
+
propName: string;
|
|
1061
|
+
value: Descendant[] | string;
|
|
1062
|
+
metaFieldName?: never;
|
|
1063
|
+
customFieldName?: never;
|
|
1064
|
+
customFieldPlainText?: never;
|
|
1065
|
+
}
|
|
1066
|
+
interface RichTextPropsWithMetaFieldName extends BaseRichTextProps {
|
|
1067
|
+
propName?: never;
|
|
1068
|
+
value?: never;
|
|
1069
|
+
metaFieldName: 'title' | 'description' | 'language';
|
|
1070
|
+
customFieldName?: never;
|
|
1071
|
+
customFieldPlainText?: never;
|
|
1072
|
+
}
|
|
1073
|
+
interface RichTextPropsWithCustomFieldName extends BaseRichTextProps {
|
|
1074
|
+
propName?: never;
|
|
1075
|
+
value?: never;
|
|
1076
|
+
metaFieldName?: never;
|
|
1077
|
+
customFieldName: string;
|
|
1078
|
+
customFieldPlainText?: boolean;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Props for RichText component
|
|
1082
|
+
*/
|
|
1083
|
+
type RichTextProps$1 = RichTextPropsWithPropName | RichTextPropsWithMetaFieldName | RichTextPropsWithCustomFieldName;
|
|
1084
|
+
declare const CompatibleRichText: React__default.FC<RichTextProps$1>;
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Props for RichTextExt (v3)
|
|
1088
|
+
*/
|
|
1089
|
+
interface RichTextProps {
|
|
1090
|
+
renderBlock?: (props: RenderElementProps) => React.ReactElement;
|
|
1091
|
+
placeholder?: string;
|
|
1092
|
+
renderPlaceholder?: (props: {
|
|
1093
|
+
children: any;
|
|
1094
|
+
}) => React.ReactElement;
|
|
1095
|
+
plugins?: types.RichTextPlugin[];
|
|
1096
|
+
multiline?: boolean;
|
|
1097
|
+
softLineBreak?: boolean;
|
|
1098
|
+
propName?: string;
|
|
1099
|
+
value?: Descendant[] | string;
|
|
1100
|
+
metaFieldName?: 'title' | 'description' | 'language';
|
|
1101
|
+
customFieldName?: string;
|
|
1102
|
+
customFieldPlainText?: boolean;
|
|
1103
|
+
}
|
|
1104
|
+
declare const RichText: React.FC<RichTextProps>;
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* CustomElement for Slate
|
|
1108
|
+
*/
|
|
1109
|
+
type CustomElement = {
|
|
1110
|
+
type: string;
|
|
1111
|
+
element?: Element;
|
|
1112
|
+
children: CustomText[];
|
|
1113
|
+
[key: string]: any;
|
|
1114
|
+
};
|
|
1115
|
+
/**
|
|
1116
|
+
* CustomText for Slate
|
|
1117
|
+
*/
|
|
1118
|
+
type CustomText = {
|
|
1119
|
+
text?: string;
|
|
1120
|
+
[key: string]: any;
|
|
1121
|
+
};
|
|
1122
|
+
declare module 'slate' {
|
|
1123
|
+
interface CustomTypes {
|
|
1124
|
+
Editor: BaseEditor & ReactEditor & HistoryEditor;
|
|
1125
|
+
Element: CustomElement;
|
|
1126
|
+
Text: CustomText;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
interface BaseTextProps {
|
|
1130
|
+
renderBlock?: (props: RenderElementProps) => React.ReactElement;
|
|
1131
|
+
placeholder?: string;
|
|
1132
|
+
renderPlaceholder?: (props: {
|
|
1133
|
+
children: any;
|
|
1134
|
+
}) => React.ReactElement;
|
|
1135
|
+
multiline?: boolean;
|
|
1136
|
+
softLineBreak?: boolean;
|
|
1137
|
+
}
|
|
1138
|
+
interface TextPropsWithPropName extends BaseTextProps {
|
|
1139
|
+
propName: string;
|
|
1140
|
+
value: Descendant[] | string;
|
|
1141
|
+
metaFieldName?: never;
|
|
1142
|
+
customFieldName?: never;
|
|
1143
|
+
}
|
|
1144
|
+
interface TextPropsWithMetaFieldName extends BaseTextProps {
|
|
1145
|
+
propName?: never;
|
|
1146
|
+
value?: never;
|
|
1147
|
+
metaFieldName: 'title' | 'description' | 'language';
|
|
1148
|
+
customFieldName?: never;
|
|
1149
|
+
}
|
|
1150
|
+
interface TextPropsWithCustomFieldName extends BaseTextProps {
|
|
1151
|
+
propName?: never;
|
|
1152
|
+
value?: never;
|
|
1153
|
+
metaFieldName?: never;
|
|
1154
|
+
customFieldName: string;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Props for Text component
|
|
1158
|
+
*/
|
|
1159
|
+
type TextProps = TextPropsWithPropName | TextPropsWithMetaFieldName | TextPropsWithCustomFieldName;
|
|
1160
|
+
declare const Text: React.FC<TextProps>;
|
|
1161
|
+
|
|
1162
|
+
declare class ReactBricksAstroStore {
|
|
1163
|
+
static instance: any;
|
|
1164
|
+
private configListeners;
|
|
1165
|
+
private pageListeners;
|
|
1166
|
+
constructor();
|
|
1167
|
+
register(config: types.ReactBricksConfig): void;
|
|
1168
|
+
setPage(page: types.Page): void;
|
|
1169
|
+
setBlock(block: types.IContentBlock): void;
|
|
1170
|
+
setIsAdmin(isAdmin: boolean): void;
|
|
1171
|
+
setPathname(pathname: string): void;
|
|
1172
|
+
getConfig(): types.ReactBricksConfig;
|
|
1173
|
+
getBrick(block: types.IContentBlock): types.Brick<any> | null;
|
|
1174
|
+
getBricks(): types.Bricks;
|
|
1175
|
+
getThemes(): types.Theme[];
|
|
1176
|
+
getPage(): types.Page | undefined;
|
|
1177
|
+
getPageValues(): types.PageValues | null;
|
|
1178
|
+
getBlock(): types.IContentBlock | null;
|
|
1179
|
+
getBlockValue(propName: string): any | null;
|
|
1180
|
+
getPageType(page: types.Page): types.IPageType | undefined;
|
|
1181
|
+
getPathname(): string | undefined;
|
|
1182
|
+
isAdmin(): boolean;
|
|
1183
|
+
isRegistered(): boolean;
|
|
1184
|
+
mapConfig(config: types.ReactBricksConfig): {
|
|
1185
|
+
bricks: any;
|
|
1186
|
+
themes: types.Theme[];
|
|
1187
|
+
};
|
|
1188
|
+
__subscribeConfig(listener: () => void): () => void;
|
|
1189
|
+
__subscribePage(listener: () => void): () => void;
|
|
1190
|
+
private notifyConfigListeners;
|
|
1191
|
+
private notifyPageListeners;
|
|
1192
|
+
}
|
|
1193
|
+
declare const reactBricksAstroStore: ReactBricksAstroStore;
|
|
1194
|
+
|
|
1195
|
+
declare const useAdminContext: () => types.IReadAdminContext;
|
|
1196
|
+
|
|
1197
|
+
declare const usePageValues: () => [types.PageValues | null, (pageData: types.PartialPage) => void];
|
|
1198
|
+
|
|
1199
|
+
declare function useReactBricksContext(): any;
|
|
1200
|
+
|
|
1201
|
+
declare const useVisualEdit: (propName: string) => [(value: any) => void, boolean];
|
|
1202
|
+
|
|
1203
|
+
declare const _default: {
|
|
1204
|
+
serialize: (nodes: Node[]) => string;
|
|
1205
|
+
serializeLight: (nodes: any[]) => string | any[];
|
|
1206
|
+
deserialize: (input: string) => Descendant[];
|
|
1207
|
+
isText: (value: any) => boolean;
|
|
1208
|
+
isSlateContent: (value: any) => boolean;
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1211
|
+
declare const getBricks: () => types.Bricks;
|
|
1212
|
+
declare const getPageValues: () => types.PageValues | null;
|
|
1213
|
+
declare const getBlockValue: (propName: string) => any | null;
|
|
1214
|
+
declare const isAdmin: () => boolean;
|
|
1215
|
+
|
|
1216
|
+
export { AstroBrick, ClickToEdit, File, Image, Link, _default as Plain, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, getBlockValue, getBricks, getPageValues, isAdmin, reactBricksAstroStore, types, useAdminContext, usePageValues, useReactBricksContext, useVisualEdit };
|