react-bricks 4.1.3 → 4.2.0-beta.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/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 +1 -1
- package/react-bricks-1fe0449c.js +2 -0
- package/react-bricks-27431547.esm.js +2 -0
- package/react-bricks-3f61a551.js +2 -0
- package/react-bricks-55118de8.esm.js +2 -0
- package/react-bricks-6938821a.js +2 -0
- package/react-bricks-a7704f44.esm.js +2 -0
- package/react-bricks-bbceedb7.js +2 -0
- package/react-bricks-bc985f77.js +2 -0
- package/react-bricks-bf89d53a.js +2 -0
- package/react-bricks-c543bd01.esm.js +2 -0
- package/react-bricks-d422f49b.esm.js +2 -0
- package/react-bricks-e6fd4139.esm.js +2 -0
- package/react-bricks.d.ts +155 -153
- package/react-bricks.esm.js +1 -1
- package/rsc/client/index.js +2 -0
- package/rsc/client/package.json +13 -0
- package/rsc/client/react-bricks-rsc-client.d.ts +849 -0
- package/rsc/client/react-bricks-rsc-client.esm.js +2 -0
- package/rsc/index.js +2 -0
- package/rsc/package.json +13 -0
- package/rsc/react-bricks-rsc.d.ts +1267 -0
- package/rsc/react-bricks-rsc.esm.js +2 -0
- package/react-bricks-a0a53b7c.js +0 -2
- package/react-bricks-d54ecec5.esm.js +0 -2
|
@@ -0,0 +1,1267 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Props for Link component
|
|
9
|
+
*/
|
|
10
|
+
interface LinkProps {
|
|
11
|
+
href: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
activeClassName?: string;
|
|
15
|
+
simpleAnchor?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare type LinkPropsReal = React.PropsWithChildren<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> & LinkProps>;
|
|
18
|
+
declare const Link: React.FC<LinkPropsReal>;
|
|
19
|
+
|
|
20
|
+
declare namespace types {
|
|
21
|
+
export const EmbedProp = "RB_PAGE_EMBED";
|
|
22
|
+
export const EmbedContent = "RB_PAGE_EMBED_CONTENT";
|
|
23
|
+
/**
|
|
24
|
+
* Type of Sidebar control
|
|
25
|
+
*/
|
|
26
|
+
export enum SideEditPropType {
|
|
27
|
+
Text = "TEXT",
|
|
28
|
+
Textarea = "TEXTAREA",
|
|
29
|
+
Number = "NUMBER",
|
|
30
|
+
Date = "DATE",
|
|
31
|
+
Range = "RANGE",
|
|
32
|
+
Boolean = "BOOLEAN",
|
|
33
|
+
Select = "SELECT",
|
|
34
|
+
Image = "IMAGE",
|
|
35
|
+
Custom = "CUSTOM",
|
|
36
|
+
Relationship = "RELATIONSHIP"
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* How to display the options
|
|
40
|
+
*/
|
|
41
|
+
export enum OptionsDisplay {
|
|
42
|
+
Select = "SELECT",
|
|
43
|
+
Radio = "RADIO",
|
|
44
|
+
Color = "COLOR"
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Features for RichText: see also the new RichTextExt
|
|
48
|
+
*/
|
|
49
|
+
export enum RichTextFeatures {
|
|
50
|
+
Bold = "BOLD",
|
|
51
|
+
Italic = "ITALIC",
|
|
52
|
+
Code = "CODE",
|
|
53
|
+
Highlight = "HIGHLIGHT",
|
|
54
|
+
Link = "LINK",
|
|
55
|
+
UnorderedList = "UL",
|
|
56
|
+
OrderedList = "OL",
|
|
57
|
+
Heading1 = "H1",
|
|
58
|
+
Heading2 = "H2",
|
|
59
|
+
Heading3 = "H3",
|
|
60
|
+
Heading4 = "H4",
|
|
61
|
+
Heading5 = "H5",
|
|
62
|
+
Heading6 = "H6",
|
|
63
|
+
Quote = "QUOTE"
|
|
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
|
+
};
|
|
239
|
+
} | null;
|
|
240
|
+
/**
|
|
241
|
+
* Translation for a Page
|
|
242
|
+
*/
|
|
243
|
+
export type Translation = {
|
|
244
|
+
language: string;
|
|
245
|
+
slug: string;
|
|
246
|
+
name: string;
|
|
247
|
+
status: PageStatus;
|
|
248
|
+
editStatus: EditStatus;
|
|
249
|
+
isLocked: boolean;
|
|
250
|
+
scheduledForPublishingOn: string;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* The page editing User
|
|
254
|
+
*/
|
|
255
|
+
export type EditingUser = {
|
|
256
|
+
id: string;
|
|
257
|
+
email: string;
|
|
258
|
+
firstName: string;
|
|
259
|
+
lastName: string;
|
|
260
|
+
company: string;
|
|
261
|
+
avatarUrl?: string;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Date and User of last edit
|
|
265
|
+
*/
|
|
266
|
+
export type LastEditedBy = {
|
|
267
|
+
date: string;
|
|
268
|
+
user: EditingUser;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* A React Bricks Page
|
|
272
|
+
*/
|
|
273
|
+
export type Page = {
|
|
274
|
+
id: string;
|
|
275
|
+
type: string;
|
|
276
|
+
name: string;
|
|
277
|
+
slug: string;
|
|
278
|
+
meta: IMeta;
|
|
279
|
+
customValues?: Props;
|
|
280
|
+
externalData?: Props;
|
|
281
|
+
content: IContentBlock[];
|
|
282
|
+
workingContent?: IContentBlock[];
|
|
283
|
+
committedContent?: IContentBlock[];
|
|
284
|
+
authorId?: string;
|
|
285
|
+
author: Author;
|
|
286
|
+
invalidBlocksTypes?: string[];
|
|
287
|
+
status: PageStatus;
|
|
288
|
+
editStatus: EditStatus;
|
|
289
|
+
isLocked: boolean;
|
|
290
|
+
tags: string[];
|
|
291
|
+
category?: string;
|
|
292
|
+
createdAt: string;
|
|
293
|
+
publishedAt?: string;
|
|
294
|
+
scheduledForPublishingOn?: string;
|
|
295
|
+
language: string;
|
|
296
|
+
translations: Translation[];
|
|
297
|
+
lastEditedBy: LastEditedBy;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Page fields (without content)
|
|
301
|
+
*/
|
|
302
|
+
export type PageValues = Omit<Page, 'content'>;
|
|
303
|
+
/**
|
|
304
|
+
* A Page with all optional fields, used for the patch
|
|
305
|
+
*/
|
|
306
|
+
export type PartialPage = Partial<Page>;
|
|
307
|
+
/**
|
|
308
|
+
* Page from a list (no content)
|
|
309
|
+
*/
|
|
310
|
+
export type PageFromList = Omit<Page, 'content'>;
|
|
311
|
+
/**
|
|
312
|
+
* Page from a list with pagination
|
|
313
|
+
*/
|
|
314
|
+
export type PagesFromListWithPagination = {
|
|
315
|
+
items: PageFromList[];
|
|
316
|
+
pagination: {
|
|
317
|
+
page: number;
|
|
318
|
+
pageSize: number;
|
|
319
|
+
totalItems: number;
|
|
320
|
+
totalPages: number;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* The Author of a Page
|
|
325
|
+
*/
|
|
326
|
+
export type Author = {
|
|
327
|
+
id: string;
|
|
328
|
+
email: string;
|
|
329
|
+
firstName: string;
|
|
330
|
+
lastName: string;
|
|
331
|
+
avatarUrl?: string;
|
|
332
|
+
company?: string;
|
|
333
|
+
};
|
|
334
|
+
export type BrickStory<T = Props> = {
|
|
335
|
+
id: string;
|
|
336
|
+
name: string;
|
|
337
|
+
showAsBrick?: boolean;
|
|
338
|
+
previewImageUrl?: string;
|
|
339
|
+
props: T;
|
|
340
|
+
};
|
|
341
|
+
export type RepeaterItems = IContentBlock[] | Omit<IContentBlock, 'id'>[] | Props[];
|
|
342
|
+
/**
|
|
343
|
+
* A Language for i18n
|
|
344
|
+
*/
|
|
345
|
+
export type Language = {
|
|
346
|
+
code: string;
|
|
347
|
+
name: string;
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* Render function for local links (should use the app's Router)
|
|
351
|
+
*/
|
|
352
|
+
interface LocalLinkProps {
|
|
353
|
+
href: string;
|
|
354
|
+
target?: string;
|
|
355
|
+
className?: string;
|
|
356
|
+
activeClassName?: string;
|
|
357
|
+
isAdmin?: boolean;
|
|
358
|
+
}
|
|
359
|
+
type LocalLinkPropsReal = React__default.PropsWithChildren<Omit<React__default.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LocalLinkProps> & LocalLinkProps>;
|
|
360
|
+
export type RenderLocalLink = ({ href, target, className, activeClassName, isAdmin, children, }: LocalLinkPropsReal) => React__default.ReactElement;
|
|
361
|
+
/**-
|
|
362
|
+
* The type of Text and RichText value
|
|
363
|
+
*/
|
|
364
|
+
export type TextValue = Descendant[] | string;
|
|
365
|
+
/**
|
|
366
|
+
* Props of a content block
|
|
367
|
+
*/
|
|
368
|
+
export type Props = {
|
|
369
|
+
[key: string]: any;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Interface for the Schema of a Brick
|
|
373
|
+
*/
|
|
374
|
+
export interface IBlockType<T = Props> {
|
|
375
|
+
name: string;
|
|
376
|
+
label: string;
|
|
377
|
+
getDefaultProps?: () => Partial<T>;
|
|
378
|
+
hideFromAddMenu?: boolean;
|
|
379
|
+
sideEditProps?: Array<ISideEditProp<T> | ISideGroup<T>>;
|
|
380
|
+
repeaterItems?: IRepeaterItem[];
|
|
381
|
+
newItemMenuOpen?: boolean;
|
|
382
|
+
groupByRepeater?: boolean;
|
|
383
|
+
mapExternalDataToProps?: (externalData: Props, brickProps?: T) => Partial<T>;
|
|
384
|
+
playgroundLinkUrl?: string;
|
|
385
|
+
playgroundLinkLabel?: string;
|
|
386
|
+
theme?: string;
|
|
387
|
+
category?: string;
|
|
388
|
+
tags?: string[];
|
|
389
|
+
previewImageUrl?: string;
|
|
390
|
+
previewIcon?: React__default.ReactElement;
|
|
391
|
+
stories?: BrickStory<Partial<T>>[];
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Item of a Repeater
|
|
395
|
+
*/
|
|
396
|
+
export interface IRepeaterItem {
|
|
397
|
+
name: string;
|
|
398
|
+
itemType?: string;
|
|
399
|
+
itemLabel?: string;
|
|
400
|
+
min?: number;
|
|
401
|
+
max?: number;
|
|
402
|
+
positionLabel?: string;
|
|
403
|
+
getDefaultProps?: () => Props;
|
|
404
|
+
items?: {
|
|
405
|
+
type: string;
|
|
406
|
+
label?: string;
|
|
407
|
+
min?: number;
|
|
408
|
+
max?: number;
|
|
409
|
+
getDefaultProps?: () => Props;
|
|
410
|
+
}[];
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* The content of a block (instance of a Brick)
|
|
414
|
+
*/
|
|
415
|
+
export interface IContentBlock {
|
|
416
|
+
id: string;
|
|
417
|
+
type: string;
|
|
418
|
+
props: Props;
|
|
419
|
+
locked?: boolean;
|
|
420
|
+
canAddAfter?: boolean;
|
|
421
|
+
canAddBefore?: boolean;
|
|
422
|
+
canEditContent?: boolean;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Option of a select sidebar prop
|
|
426
|
+
*/
|
|
427
|
+
export interface IOption {
|
|
428
|
+
value: any;
|
|
429
|
+
label: string;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Interface for Props of a Custom sidebar component
|
|
433
|
+
*/
|
|
434
|
+
export interface ICustomKnobProps {
|
|
435
|
+
id: string;
|
|
436
|
+
value: any;
|
|
437
|
+
onChange: any;
|
|
438
|
+
isValid: boolean;
|
|
439
|
+
errorMessage?: string;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Sidebar edit Props for a Page
|
|
443
|
+
*/
|
|
444
|
+
export interface ISideEditPropPage<T = Props> {
|
|
445
|
+
name: string;
|
|
446
|
+
label: string;
|
|
447
|
+
type: SideEditPropType;
|
|
448
|
+
component?: React__default.FC<ICustomKnobProps>;
|
|
449
|
+
validate?: (value: any, props?: T) => boolean | string;
|
|
450
|
+
show?: (props: T, page?: Page, user?: User) => boolean;
|
|
451
|
+
helperText?: string;
|
|
452
|
+
textareaOptions?: {
|
|
453
|
+
height?: number;
|
|
454
|
+
};
|
|
455
|
+
imageOptions?: {
|
|
456
|
+
maxWidth?: number;
|
|
457
|
+
aspectRatio?: number;
|
|
458
|
+
};
|
|
459
|
+
rangeOptions?: {
|
|
460
|
+
min?: number;
|
|
461
|
+
max?: number;
|
|
462
|
+
step?: number;
|
|
463
|
+
};
|
|
464
|
+
selectOptions?: {
|
|
465
|
+
options?: IOption[];
|
|
466
|
+
getOptions?: (props: Props) => IOption[] | Promise<IOption[]>;
|
|
467
|
+
display: OptionsDisplay;
|
|
468
|
+
};
|
|
469
|
+
relationshipOptions?: {
|
|
470
|
+
label?: string;
|
|
471
|
+
references: string;
|
|
472
|
+
multiple: boolean;
|
|
473
|
+
embedValues?: boolean;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Sidebar Edit Props
|
|
478
|
+
*/
|
|
479
|
+
export interface ISideEditProp<T = Props> extends ISideEditPropPage<T> {
|
|
480
|
+
shouldRefreshText?: boolean;
|
|
481
|
+
shouldRefreshStyles?: boolean;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* A collapsible Group of sidebar Props
|
|
485
|
+
*/
|
|
486
|
+
export interface ISideGroup<T = Props> {
|
|
487
|
+
groupName: string;
|
|
488
|
+
defaultOpen?: boolean;
|
|
489
|
+
show?: (props: T, page?: Page, user?: User) => boolean;
|
|
490
|
+
props: ISideEditProp<T>[] | ISideEditPropPage<T>[];
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Image Crop interface
|
|
494
|
+
*/
|
|
495
|
+
export interface ICrop {
|
|
496
|
+
x: number;
|
|
497
|
+
y: number;
|
|
498
|
+
width: number;
|
|
499
|
+
height: number;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Image Transform interface
|
|
503
|
+
*/
|
|
504
|
+
export interface ITransform {
|
|
505
|
+
rotate?: number;
|
|
506
|
+
flip?: {
|
|
507
|
+
horizontal: boolean;
|
|
508
|
+
vertical: boolean;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Image value interface
|
|
513
|
+
*/
|
|
514
|
+
export interface IImageSource {
|
|
515
|
+
src: string;
|
|
516
|
+
srcSet?: string;
|
|
517
|
+
type?: string;
|
|
518
|
+
fallbackSrc?: string;
|
|
519
|
+
fallbackSrcSet?: string;
|
|
520
|
+
fallbackType?: string;
|
|
521
|
+
placeholderSrc?: string;
|
|
522
|
+
alt?: string;
|
|
523
|
+
seoName?: string;
|
|
524
|
+
width?: number;
|
|
525
|
+
height?: number;
|
|
526
|
+
highPriority?: boolean;
|
|
527
|
+
hashId?: string;
|
|
528
|
+
crop?: ICrop;
|
|
529
|
+
transform?: ITransform;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* File value interface
|
|
533
|
+
*/
|
|
534
|
+
export interface IFileSource {
|
|
535
|
+
name: string;
|
|
536
|
+
url: string;
|
|
537
|
+
size: number;
|
|
538
|
+
extension: string;
|
|
539
|
+
pagesNum: number;
|
|
540
|
+
title?: string | undefined;
|
|
541
|
+
alt?: string | undefined;
|
|
542
|
+
copyright?: string | undefined;
|
|
543
|
+
source?: string | undefined;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* A Color for a Select sidebar prop
|
|
547
|
+
*/
|
|
548
|
+
export interface IColor {
|
|
549
|
+
color: string;
|
|
550
|
+
[propName: string]: any;
|
|
551
|
+
}
|
|
552
|
+
export interface IBrickStory {
|
|
553
|
+
brickName: string;
|
|
554
|
+
storyName: string;
|
|
555
|
+
locked?: boolean;
|
|
556
|
+
canAddAfter?: boolean;
|
|
557
|
+
canAddBefore?: boolean;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Page type
|
|
561
|
+
*/
|
|
562
|
+
export interface IPageType {
|
|
563
|
+
name: string;
|
|
564
|
+
pluralName: string;
|
|
565
|
+
isEntity?: boolean;
|
|
566
|
+
allowedBlockTypes?: string[];
|
|
567
|
+
excludedBlockTypes?: string[];
|
|
568
|
+
defaultLocked?: boolean;
|
|
569
|
+
defaultStatus?: PageStatus;
|
|
570
|
+
defaultLanguage?: string;
|
|
571
|
+
defaultFeaturedImage?: string;
|
|
572
|
+
getDefaultContent?: () => (string | IBrickStory | IContentBlock)[];
|
|
573
|
+
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
574
|
+
getExternalData?: (page: Page, args?: any) => Promise<Props>;
|
|
575
|
+
metaImageAspectRatio?: number;
|
|
576
|
+
categories?: ICategory[];
|
|
577
|
+
slugPrefix?: ISlugPrefix;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Structure returned by the cleanBlocks function
|
|
581
|
+
*/
|
|
582
|
+
export interface ICleanBlocks {
|
|
583
|
+
blocks: IContentBlock[];
|
|
584
|
+
invalidBlocksTypes: string[];
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Responsive breakpoint for preview
|
|
588
|
+
*/
|
|
589
|
+
export interface ResponsiveBreakpoint {
|
|
590
|
+
type: DeviceType;
|
|
591
|
+
width: number | string;
|
|
592
|
+
label: string;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Login UI customization
|
|
596
|
+
*/
|
|
597
|
+
export interface LoginUI {
|
|
598
|
+
sideImage?: string;
|
|
599
|
+
logo?: string;
|
|
600
|
+
logoWidth?: number;
|
|
601
|
+
logoHeight?: number;
|
|
602
|
+
welcomeText?: string;
|
|
603
|
+
welcomeTextStyle?: React__default.CSSProperties;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* MenuItem interface
|
|
607
|
+
*/
|
|
608
|
+
export interface IMenuItem {
|
|
609
|
+
label: string;
|
|
610
|
+
path?: string;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* The ReactBricks configuration
|
|
614
|
+
*/
|
|
615
|
+
export interface ReactBricksConfig {
|
|
616
|
+
appId: string;
|
|
617
|
+
apiKey: string;
|
|
618
|
+
environment?: string;
|
|
619
|
+
bricks?: types.Brick<any>[] | types.Theme[];
|
|
620
|
+
pageTypes?: types.IPageType[];
|
|
621
|
+
logo?: string;
|
|
622
|
+
loginUI?: LoginUI;
|
|
623
|
+
contentClassName?: string;
|
|
624
|
+
defaultTheme?: string;
|
|
625
|
+
renderLocalLink: types.RenderLocalLink;
|
|
626
|
+
navigate: (path: string) => void;
|
|
627
|
+
loginPath?: string;
|
|
628
|
+
editorPath?: string;
|
|
629
|
+
mediaLibraryPath?: string;
|
|
630
|
+
playgroundPath?: string;
|
|
631
|
+
appSettingsPath?: string;
|
|
632
|
+
previewPath?: string;
|
|
633
|
+
getAdminMenu?: (args: {
|
|
634
|
+
isAdmin: boolean;
|
|
635
|
+
}) => IMenuItem[];
|
|
636
|
+
isDarkColorMode?: boolean;
|
|
637
|
+
toggleColorMode?: () => void;
|
|
638
|
+
useCssInJs?: boolean;
|
|
639
|
+
appRootElement: string | HTMLElement;
|
|
640
|
+
clickToEditSide?: ClickToEditSide;
|
|
641
|
+
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
642
|
+
responsiveBreakpoints?: ResponsiveBreakpoint[];
|
|
643
|
+
enableAutoSave?: boolean;
|
|
644
|
+
disableSaveIfInvalidProps?: boolean;
|
|
645
|
+
enablePreview?: boolean;
|
|
646
|
+
blockIconsPosition?: BlockIconsPosition;
|
|
647
|
+
enablePreviewImage?: boolean;
|
|
648
|
+
enablePreviewIcon?: boolean;
|
|
649
|
+
enableUnsplash?: boolean;
|
|
650
|
+
unsplashApiKey?: string;
|
|
651
|
+
enableDefaultEmbedBrick?: boolean;
|
|
652
|
+
permissions?: Permissions;
|
|
653
|
+
allowAccentsInSlugs?: boolean;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* The ReactBricks context
|
|
657
|
+
*/
|
|
658
|
+
export interface IReactBricksContext {
|
|
659
|
+
version: string;
|
|
660
|
+
appId: string;
|
|
661
|
+
apiKey: string;
|
|
662
|
+
environment?: string;
|
|
663
|
+
bricks: Bricks;
|
|
664
|
+
themes: types.Theme[];
|
|
665
|
+
pageTypes: IPageType[];
|
|
666
|
+
logo: string;
|
|
667
|
+
loginUI: LoginUI;
|
|
668
|
+
contentClassName: string;
|
|
669
|
+
defaultTheme: string;
|
|
670
|
+
renderLocalLink: RenderLocalLink;
|
|
671
|
+
navigate: (path: string) => void;
|
|
672
|
+
loginPath: string;
|
|
673
|
+
editorPath: string;
|
|
674
|
+
mediaLibraryPath: string;
|
|
675
|
+
playgroundPath: string;
|
|
676
|
+
appSettingsPath: string;
|
|
677
|
+
previewPath: string;
|
|
678
|
+
getAdminMenu?: (args: {
|
|
679
|
+
isAdmin: boolean;
|
|
680
|
+
}) => IMenuItem[];
|
|
681
|
+
isDarkColorMode?: boolean;
|
|
682
|
+
toggleColorMode?: () => void;
|
|
683
|
+
useCssInJs?: boolean;
|
|
684
|
+
appRootElement: string | HTMLElement;
|
|
685
|
+
clickToEditSide?: ClickToEditSide;
|
|
686
|
+
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
687
|
+
responsiveBreakpoints: ResponsiveBreakpoint[];
|
|
688
|
+
enableAutoSave: boolean;
|
|
689
|
+
disableSaveIfInvalidProps: boolean;
|
|
690
|
+
enablePreview: boolean;
|
|
691
|
+
browserSupport: {
|
|
692
|
+
webP: boolean;
|
|
693
|
+
lazyLoading: boolean;
|
|
694
|
+
};
|
|
695
|
+
blockIconsPosition: BlockIconsPosition;
|
|
696
|
+
enablePreviewImage: boolean;
|
|
697
|
+
enablePreviewIcon: boolean;
|
|
698
|
+
enableUnsplash: boolean;
|
|
699
|
+
unsplashApiKey?: string;
|
|
700
|
+
enableDefaultEmbedBrick: boolean;
|
|
701
|
+
permissions?: Permissions;
|
|
702
|
+
allowAccentsInSlugs: boolean;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* The current page in Admin
|
|
706
|
+
*/
|
|
707
|
+
export interface ICurrentPage {
|
|
708
|
+
pageId: string;
|
|
709
|
+
language?: string;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* The Admin context returned from useAdminContext
|
|
713
|
+
*/
|
|
714
|
+
export interface IReadAdminContext {
|
|
715
|
+
isAdmin: boolean;
|
|
716
|
+
previewMode: boolean;
|
|
717
|
+
currentPage: ICurrentPage;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Opengraph type
|
|
721
|
+
*/
|
|
722
|
+
export type OpenGraphType = 'article' | 'website' | 'profile' | 'book' | 'video' | 'music';
|
|
723
|
+
/**
|
|
724
|
+
* OpenGraph data
|
|
725
|
+
*/
|
|
726
|
+
export type OpenGraphData = {
|
|
727
|
+
url?: string;
|
|
728
|
+
type?: OpenGraphType;
|
|
729
|
+
title?: string;
|
|
730
|
+
description?: string;
|
|
731
|
+
image?: types.IImageSource;
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* Twitter card type
|
|
735
|
+
*/
|
|
736
|
+
export type TwitterCardType = 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
737
|
+
/**
|
|
738
|
+
* Data for Twitter card
|
|
739
|
+
*/
|
|
740
|
+
export type TwitterCardData = {
|
|
741
|
+
card?: TwitterCardType;
|
|
742
|
+
site?: string;
|
|
743
|
+
creator?: string;
|
|
744
|
+
title?: string;
|
|
745
|
+
description?: string;
|
|
746
|
+
image?: types.IImageSource;
|
|
747
|
+
};
|
|
748
|
+
/**
|
|
749
|
+
* Meta Fields type
|
|
750
|
+
* */
|
|
751
|
+
export type MetaData = {
|
|
752
|
+
title?: string;
|
|
753
|
+
description?: string;
|
|
754
|
+
keywords?: string;
|
|
755
|
+
featuredImage?: string;
|
|
756
|
+
image?: IImageSource;
|
|
757
|
+
};
|
|
758
|
+
/**
|
|
759
|
+
* Meta fields on Page
|
|
760
|
+
*/
|
|
761
|
+
export interface IMeta extends MetaData {
|
|
762
|
+
language?: string;
|
|
763
|
+
openGraph?: OpenGraphData;
|
|
764
|
+
twitterCard?: TwitterCardData;
|
|
765
|
+
schemaOrg?: SchemaOrgData;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Category on categories (pageTypes)
|
|
769
|
+
*/
|
|
770
|
+
export interface ICategory {
|
|
771
|
+
category?: string;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* A RichTextExt Plugin
|
|
775
|
+
*/
|
|
776
|
+
export interface RichTextPlugin {
|
|
777
|
+
type: 'Mark' | 'Block' | 'List';
|
|
778
|
+
name: string;
|
|
779
|
+
isInline?: boolean;
|
|
780
|
+
itemName?: string;
|
|
781
|
+
label: string;
|
|
782
|
+
hotKey?: string;
|
|
783
|
+
renderElement?: (props: RenderElementProps) => JSX.Element;
|
|
784
|
+
renderItemElement?: (props: RenderElementProps) => JSX.Element;
|
|
785
|
+
renderLeaf?: (props: RenderLeafProps) => JSX.Element;
|
|
786
|
+
toggle: (editor: Editor, plugins: RichTextPlugin[]) => void;
|
|
787
|
+
button?: {
|
|
788
|
+
icon: React__default.ReactElement;
|
|
789
|
+
isActive: (editor: Editor) => boolean;
|
|
790
|
+
};
|
|
791
|
+
enhanceEditor?: (editor: Editor) => Editor;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Definition for a Mark plugin
|
|
795
|
+
*/
|
|
796
|
+
export interface MarkPlugin {
|
|
797
|
+
name: string;
|
|
798
|
+
label?: string;
|
|
799
|
+
hotKey?: string;
|
|
800
|
+
render: (props: RenderLeafProps) => JSX.Element;
|
|
801
|
+
icon?: React__default.ReactElement;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Constructor for a Mark plugin
|
|
805
|
+
*/
|
|
806
|
+
export type MarkPluginConstructor = (markPlugin: MarkPlugin) => RichTextPlugin;
|
|
807
|
+
/**
|
|
808
|
+
* Definition for a Block plugin
|
|
809
|
+
*/
|
|
810
|
+
export interface BlockPlugin {
|
|
811
|
+
name: string;
|
|
812
|
+
isInline?: boolean;
|
|
813
|
+
itemName?: string;
|
|
814
|
+
label?: string;
|
|
815
|
+
hotKey?: string;
|
|
816
|
+
render: (props: RenderElementProps) => JSX.Element;
|
|
817
|
+
renderItem?: (props: RenderElementProps) => JSX.Element;
|
|
818
|
+
icon?: React__default.ReactElement;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Constructor for a Block plugin
|
|
822
|
+
*/
|
|
823
|
+
export type BlockPluginConstructor = (blockPlugin: BlockPlugin) => RichTextPlugin;
|
|
824
|
+
export {};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Props for Text
|
|
829
|
+
*/
|
|
830
|
+
interface FileProps {
|
|
831
|
+
propName: string;
|
|
832
|
+
renderBlock: (props: types.IFileSource | null) => JSX.Element;
|
|
833
|
+
allowedExtensions?: string[];
|
|
834
|
+
source: types.IFileSource;
|
|
835
|
+
}
|
|
836
|
+
declare const File: React__default.FC<FileProps>;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Arguments for the renderWrapper function
|
|
840
|
+
*/
|
|
841
|
+
interface IRenderWrapperArgs {
|
|
842
|
+
children: React.ReactNode;
|
|
843
|
+
width?: number;
|
|
844
|
+
height?: number;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* renderWrapper function type
|
|
848
|
+
*/
|
|
849
|
+
declare type RenderWrapper = (args: IRenderWrapperArgs) => React.ReactElement;
|
|
850
|
+
interface PlaceholderProps {
|
|
851
|
+
aspectRatio?: number;
|
|
852
|
+
maxWidth?: number;
|
|
853
|
+
isDarkColorMode?: boolean;
|
|
854
|
+
isAdmin: boolean;
|
|
855
|
+
}
|
|
856
|
+
interface SharedImageProps {
|
|
857
|
+
readonly?: boolean;
|
|
858
|
+
alt: string;
|
|
859
|
+
noLazyLoad?: boolean;
|
|
860
|
+
containerClassName?: string;
|
|
861
|
+
containerStyle?: React.CSSProperties;
|
|
862
|
+
imageClassName?: string;
|
|
863
|
+
imageStyle?: React.CSSProperties;
|
|
864
|
+
noWrapper?: boolean;
|
|
865
|
+
sizes?: string;
|
|
866
|
+
loading?: 'lazy' | 'eager';
|
|
867
|
+
renderWrapper?: RenderWrapper;
|
|
868
|
+
useNativeLazyLoading?: boolean;
|
|
869
|
+
useWebP?: boolean;
|
|
870
|
+
placeholder?: (props: PlaceholderProps) => string;
|
|
871
|
+
source: types.IImageSource;
|
|
872
|
+
}
|
|
873
|
+
interface EditableImage extends SharedImageProps {
|
|
874
|
+
readonly?: false;
|
|
875
|
+
propName?: string;
|
|
876
|
+
metaFieldName?: 'image';
|
|
877
|
+
customFieldName?: string;
|
|
878
|
+
aspectRatio?: number;
|
|
879
|
+
maxWidth?: number;
|
|
880
|
+
}
|
|
881
|
+
interface ReadOnlyImage extends SharedImageProps {
|
|
882
|
+
readonly: true;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Props for Image
|
|
886
|
+
*/
|
|
887
|
+
declare type ImageProps = EditableImage | ReadOnlyImage;
|
|
888
|
+
declare const Image: React.FC<ImageProps>;
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Props for Repeater
|
|
892
|
+
*/
|
|
893
|
+
interface RepeaterProps {
|
|
894
|
+
propName: string;
|
|
895
|
+
itemProps?: types.Props;
|
|
896
|
+
renderWrapper?: (items: React.ReactElement) => React.ReactElement;
|
|
897
|
+
renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
|
|
898
|
+
items: types.RepeaterItems;
|
|
899
|
+
}
|
|
900
|
+
declare const Repeater: React.FC<RepeaterProps>;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Props for renderLink render function
|
|
904
|
+
*/
|
|
905
|
+
interface RenderLinkElementProps extends RenderElementProps {
|
|
906
|
+
href: string;
|
|
907
|
+
}
|
|
908
|
+
interface BaseRichTextProps {
|
|
909
|
+
renderBlock?: (props: RenderElementProps) => JSX.Element;
|
|
910
|
+
placeholder?: string;
|
|
911
|
+
renderPlaceholder?: (props: {
|
|
912
|
+
children: any;
|
|
913
|
+
}) => JSX.Element;
|
|
914
|
+
multiline?: boolean;
|
|
915
|
+
softLineBreak?: boolean;
|
|
916
|
+
allowedFeatures?: types.RichTextFeatures[];
|
|
917
|
+
metaFieldName?: 'title' | 'description' | 'language';
|
|
918
|
+
customFieldName?: string;
|
|
919
|
+
renderBold?: (props: RenderLeafProps) => JSX.Element;
|
|
920
|
+
renderItalic?: (props: RenderLeafProps) => JSX.Element;
|
|
921
|
+
renderHighlight?: (props: RenderLeafProps) => JSX.Element;
|
|
922
|
+
renderCode?: (props: RenderLeafProps) => JSX.Element;
|
|
923
|
+
renderLink?: (props: RenderLinkElementProps) => JSX.Element;
|
|
924
|
+
renderUL?: (props: RenderElementProps) => JSX.Element;
|
|
925
|
+
renderOL?: (props: RenderElementProps) => JSX.Element;
|
|
926
|
+
renderLI?: (props: RenderElementProps) => JSX.Element;
|
|
927
|
+
renderH1?: (props: RenderElementProps) => JSX.Element;
|
|
928
|
+
renderH2?: (props: RenderElementProps) => JSX.Element;
|
|
929
|
+
renderH3?: (props: RenderElementProps) => JSX.Element;
|
|
930
|
+
renderH4?: (props: RenderElementProps) => JSX.Element;
|
|
931
|
+
renderH5?: (props: RenderElementProps) => JSX.Element;
|
|
932
|
+
renderH6?: (props: RenderElementProps) => JSX.Element;
|
|
933
|
+
renderQuote?: (props: RenderElementProps) => JSX.Element;
|
|
934
|
+
}
|
|
935
|
+
interface RichTextPropsWithPropName extends BaseRichTextProps {
|
|
936
|
+
propName: string;
|
|
937
|
+
value: Descendant[] | string;
|
|
938
|
+
metaFieldName?: never;
|
|
939
|
+
customFieldName?: never;
|
|
940
|
+
customFieldPlainText?: never;
|
|
941
|
+
}
|
|
942
|
+
interface RichTextPropsWithMetaFieldName extends BaseRichTextProps {
|
|
943
|
+
propName?: never;
|
|
944
|
+
value?: never;
|
|
945
|
+
metaFieldName: 'title' | 'description' | 'language';
|
|
946
|
+
customFieldName?: never;
|
|
947
|
+
customFieldPlainText?: never;
|
|
948
|
+
}
|
|
949
|
+
interface RichTextPropsWithCustomFieldName extends BaseRichTextProps {
|
|
950
|
+
propName?: never;
|
|
951
|
+
value?: never;
|
|
952
|
+
metaFieldName?: never;
|
|
953
|
+
customFieldName: string;
|
|
954
|
+
customFieldPlainText?: boolean;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Props for RichText component
|
|
958
|
+
*/
|
|
959
|
+
declare type RichTextProps$1 = RichTextPropsWithPropName | RichTextPropsWithMetaFieldName | RichTextPropsWithCustomFieldName;
|
|
960
|
+
declare const CompatibleRichText: React__default.FC<RichTextProps$1>;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Props for RichTextExt (v3)
|
|
964
|
+
*/
|
|
965
|
+
interface RichTextProps {
|
|
966
|
+
renderBlock?: (props: RenderElementProps) => JSX.Element;
|
|
967
|
+
placeholder?: string;
|
|
968
|
+
renderPlaceholder?: (props: {
|
|
969
|
+
children: any;
|
|
970
|
+
}) => JSX.Element;
|
|
971
|
+
plugins?: types.RichTextPlugin[];
|
|
972
|
+
multiline?: boolean;
|
|
973
|
+
softLineBreak?: boolean;
|
|
974
|
+
propName?: string;
|
|
975
|
+
value?: Descendant[] | string;
|
|
976
|
+
metaFieldName?: 'title' | 'description' | 'language';
|
|
977
|
+
customFieldName?: string;
|
|
978
|
+
customFieldPlainText?: boolean;
|
|
979
|
+
}
|
|
980
|
+
declare const RichText: React.FC<RichTextProps>;
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* CustomElement for Slate
|
|
984
|
+
*/
|
|
985
|
+
declare type CustomElement$1 = {
|
|
986
|
+
type: string;
|
|
987
|
+
element?: Element;
|
|
988
|
+
children: CustomText$1[];
|
|
989
|
+
[key: string]: any;
|
|
990
|
+
};
|
|
991
|
+
/**
|
|
992
|
+
* CustomText for Slate
|
|
993
|
+
*/
|
|
994
|
+
declare type CustomText$1 = {
|
|
995
|
+
text?: string;
|
|
996
|
+
[key: string]: any;
|
|
997
|
+
};
|
|
998
|
+
declare module 'slate' {
|
|
999
|
+
interface CustomTypes {
|
|
1000
|
+
Editor: BaseEditor & ReactEditor & HistoryEditor;
|
|
1001
|
+
Element: CustomElement$1;
|
|
1002
|
+
Text: CustomText$1;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
interface BaseTextProps {
|
|
1006
|
+
renderBlock?: (props: RenderElementProps) => JSX.Element;
|
|
1007
|
+
placeholder?: string;
|
|
1008
|
+
renderPlaceholder?: (props: {
|
|
1009
|
+
children: any;
|
|
1010
|
+
}) => JSX.Element;
|
|
1011
|
+
multiline?: boolean;
|
|
1012
|
+
softLineBreak?: boolean;
|
|
1013
|
+
}
|
|
1014
|
+
interface TextPropsWithPropName extends BaseTextProps {
|
|
1015
|
+
propName: string;
|
|
1016
|
+
value: Descendant[] | string;
|
|
1017
|
+
metaFieldName?: never;
|
|
1018
|
+
customFieldName?: never;
|
|
1019
|
+
}
|
|
1020
|
+
interface TextPropsWithMetaFieldName extends BaseTextProps {
|
|
1021
|
+
propName?: never;
|
|
1022
|
+
value?: never;
|
|
1023
|
+
metaFieldName: 'title' | 'description' | 'language';
|
|
1024
|
+
customFieldName?: never;
|
|
1025
|
+
}
|
|
1026
|
+
interface TextPropsWithCustomFieldName extends BaseTextProps {
|
|
1027
|
+
propName?: never;
|
|
1028
|
+
value?: never;
|
|
1029
|
+
metaFieldName?: never;
|
|
1030
|
+
customFieldName: string;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Props for Text component
|
|
1034
|
+
*/
|
|
1035
|
+
declare type TextProps = TextPropsWithPropName | TextPropsWithMetaFieldName | TextPropsWithCustomFieldName;
|
|
1036
|
+
declare const Text: React.FC<TextProps>;
|
|
1037
|
+
|
|
1038
|
+
declare const blockPluginConstructor: types.BlockPluginConstructor;
|
|
1039
|
+
|
|
1040
|
+
declare const markPluginConstructor: types.MarkPluginConstructor;
|
|
1041
|
+
|
|
1042
|
+
declare const plugin$d: types.RichTextPlugin;
|
|
1043
|
+
|
|
1044
|
+
declare const plugin$c: types.RichTextPlugin;
|
|
1045
|
+
|
|
1046
|
+
declare const plugin$b: types.RichTextPlugin;
|
|
1047
|
+
|
|
1048
|
+
declare const plugin$a: types.RichTextPlugin;
|
|
1049
|
+
|
|
1050
|
+
declare const plugin$9: types.RichTextPlugin;
|
|
1051
|
+
|
|
1052
|
+
declare const plugin$8: types.RichTextPlugin;
|
|
1053
|
+
|
|
1054
|
+
declare const plugin$7: types.RichTextPlugin;
|
|
1055
|
+
|
|
1056
|
+
declare const plugin$6: types.RichTextPlugin;
|
|
1057
|
+
|
|
1058
|
+
declare const plugin$5: types.RichTextPlugin;
|
|
1059
|
+
|
|
1060
|
+
declare const plugin$4: types.RichTextPlugin;
|
|
1061
|
+
|
|
1062
|
+
declare const plugin$3: types.RichTextPlugin;
|
|
1063
|
+
|
|
1064
|
+
declare const plugin$2: types.RichTextPlugin;
|
|
1065
|
+
|
|
1066
|
+
declare const plugin$1: types.RichTextPlugin;
|
|
1067
|
+
|
|
1068
|
+
declare const plugin: types.RichTextPlugin;
|
|
1069
|
+
|
|
1070
|
+
declare namespace index {
|
|
1071
|
+
export {
|
|
1072
|
+
plugin$d as bold,
|
|
1073
|
+
plugin$c as italic,
|
|
1074
|
+
plugin$b as code,
|
|
1075
|
+
plugin$a as highlight,
|
|
1076
|
+
plugin$9 as link,
|
|
1077
|
+
plugin$8 as heading1,
|
|
1078
|
+
plugin$7 as heading2,
|
|
1079
|
+
plugin$6 as heading3,
|
|
1080
|
+
plugin$5 as heading4,
|
|
1081
|
+
plugin$4 as heading5,
|
|
1082
|
+
plugin$3 as heading6,
|
|
1083
|
+
plugin$2 as quote,
|
|
1084
|
+
plugin$1 as orderedList,
|
|
1085
|
+
plugin as unorderedList,
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
declare function fetchPage({ slug, language, getExternalDataArgs, config, }: {
|
|
1090
|
+
slug: string;
|
|
1091
|
+
language?: string;
|
|
1092
|
+
getExternalDataArgs?: any;
|
|
1093
|
+
config: types.ReactBricksConfig;
|
|
1094
|
+
}): Promise<types.Page>;
|
|
1095
|
+
declare function fetchPage(slug: string, apiKey: string, language?: string, pageTypes?: types.IPageType[], getExternalDataArgs?: any): Promise<types.Page>;
|
|
1096
|
+
|
|
1097
|
+
declare function fetchPages<T extends boolean>(apiKey: string, { type, types, tag, language, page, pageSize, sort, filterBy, usePagination, }: {
|
|
1098
|
+
type?: string;
|
|
1099
|
+
types?: string[];
|
|
1100
|
+
tag?: string;
|
|
1101
|
+
language?: string;
|
|
1102
|
+
page?: number;
|
|
1103
|
+
pageSize?: number;
|
|
1104
|
+
sort?: string;
|
|
1105
|
+
filterBy?: {
|
|
1106
|
+
[key: string]: any;
|
|
1107
|
+
};
|
|
1108
|
+
usePagination: T;
|
|
1109
|
+
}): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
|
|
1110
|
+
declare function fetchPages(apiKey: string, { type, types, tag, language, page, pageSize, filterBy, sort, }: {
|
|
1111
|
+
type?: string;
|
|
1112
|
+
types?: string[];
|
|
1113
|
+
tag?: string;
|
|
1114
|
+
language?: string;
|
|
1115
|
+
page?: number;
|
|
1116
|
+
pageSize?: number;
|
|
1117
|
+
sort?: string;
|
|
1118
|
+
filterBy?: {
|
|
1119
|
+
[key: string]: any;
|
|
1120
|
+
};
|
|
1121
|
+
}): Promise<types.PageFromList[]>;
|
|
1122
|
+
declare function fetchPages(apiKey: string): Promise<types.PageFromList[]>;
|
|
1123
|
+
declare function fetchPages<T extends boolean>(options: {
|
|
1124
|
+
type?: string;
|
|
1125
|
+
types?: string[];
|
|
1126
|
+
tag?: string;
|
|
1127
|
+
language?: string;
|
|
1128
|
+
page?: number;
|
|
1129
|
+
pageSize?: number;
|
|
1130
|
+
sort?: string;
|
|
1131
|
+
filterBy?: {
|
|
1132
|
+
[key: string]: any;
|
|
1133
|
+
};
|
|
1134
|
+
usePagination: T;
|
|
1135
|
+
fetchExternalData?: boolean;
|
|
1136
|
+
getExternalDataArgs?: any;
|
|
1137
|
+
config: types.ReactBricksConfig;
|
|
1138
|
+
}): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
|
|
1139
|
+
declare function fetchPages<T extends boolean>(options: {
|
|
1140
|
+
type?: string;
|
|
1141
|
+
types?: string[];
|
|
1142
|
+
tag?: string;
|
|
1143
|
+
language?: string;
|
|
1144
|
+
page?: number;
|
|
1145
|
+
pageSize?: number;
|
|
1146
|
+
sort?: string;
|
|
1147
|
+
filterBy?: {
|
|
1148
|
+
[key: string]: any;
|
|
1149
|
+
};
|
|
1150
|
+
fetchExternalData?: boolean;
|
|
1151
|
+
getExternalDataArgs?: any;
|
|
1152
|
+
config: types.ReactBricksConfig;
|
|
1153
|
+
}): Promise<types.PageFromList[]>;
|
|
1154
|
+
|
|
1155
|
+
declare const fetchTags: (apiKey: string, page?: number, pageSize?: number, options?: {
|
|
1156
|
+
q?: string;
|
|
1157
|
+
language?: string;
|
|
1158
|
+
}) => Promise<{
|
|
1159
|
+
items: string[];
|
|
1160
|
+
pagination: {
|
|
1161
|
+
page: number;
|
|
1162
|
+
pageSize: number;
|
|
1163
|
+
totalItems: number;
|
|
1164
|
+
totalPages: number;
|
|
1165
|
+
};
|
|
1166
|
+
}>;
|
|
1167
|
+
|
|
1168
|
+
declare const DynamicComponent: ({ block, index, itemsCount, page, ...props }: {
|
|
1169
|
+
[x: string]: unknown;
|
|
1170
|
+
block: types.IContentBlock;
|
|
1171
|
+
index?: number | undefined;
|
|
1172
|
+
itemsCount?: number | undefined;
|
|
1173
|
+
page?: types.Page | undefined;
|
|
1174
|
+
}) => React__default.JSX.Element | null;
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* CustomElement for Slate
|
|
1178
|
+
*/
|
|
1179
|
+
declare type CustomElement = {
|
|
1180
|
+
type: string;
|
|
1181
|
+
element?: Element;
|
|
1182
|
+
children: CustomText[];
|
|
1183
|
+
[key: string]: any;
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* CustomText for Slate
|
|
1187
|
+
*/
|
|
1188
|
+
declare type CustomText = {
|
|
1189
|
+
text?: string;
|
|
1190
|
+
[key: string]: any;
|
|
1191
|
+
};
|
|
1192
|
+
declare module 'slate' {
|
|
1193
|
+
interface CustomTypes {
|
|
1194
|
+
Editor: BaseEditor & ReactEditor & HistoryEditor;
|
|
1195
|
+
Element: CustomElement;
|
|
1196
|
+
Text: CustomText;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
interface JsonLdProps {
|
|
1201
|
+
page: types.Page;
|
|
1202
|
+
}
|
|
1203
|
+
declare const JsonLd: React__default.FC<JsonLdProps>;
|
|
1204
|
+
|
|
1205
|
+
declare const _default: {
|
|
1206
|
+
serialize: (nodes: Node[]) => string;
|
|
1207
|
+
serializeLight: (nodes: any[]) => string | any[];
|
|
1208
|
+
deserialize: (input: string) => Descendant[];
|
|
1209
|
+
isText: (value: any) => boolean;
|
|
1210
|
+
isSlateContent: (value: any) => boolean;
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks: types.Bricks) => types.Page;
|
|
1214
|
+
|
|
1215
|
+
declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
|
|
1216
|
+
|
|
1217
|
+
interface IMetadata {
|
|
1218
|
+
title?: string;
|
|
1219
|
+
description?: string;
|
|
1220
|
+
keywords?: string;
|
|
1221
|
+
openGraph?: {
|
|
1222
|
+
url?: string;
|
|
1223
|
+
type?: string;
|
|
1224
|
+
title?: string;
|
|
1225
|
+
description?: string;
|
|
1226
|
+
images?: string[];
|
|
1227
|
+
};
|
|
1228
|
+
twitter?: {
|
|
1229
|
+
card?: string;
|
|
1230
|
+
site?: string;
|
|
1231
|
+
creator?: string;
|
|
1232
|
+
title?: string;
|
|
1233
|
+
description?: string;
|
|
1234
|
+
images?: string[];
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
declare const getMetadata: (page: types.Page) => IMetadata;
|
|
1238
|
+
|
|
1239
|
+
declare const PageViewer: ({ page, main, ...props }: {
|
|
1240
|
+
[x: string]: unknown;
|
|
1241
|
+
page: types.Page;
|
|
1242
|
+
main?: boolean | undefined;
|
|
1243
|
+
}) => React__default.JSX.Element;
|
|
1244
|
+
|
|
1245
|
+
declare const ReactBricks: ({ children, }: {
|
|
1246
|
+
children: React__default.ReactNode;
|
|
1247
|
+
}) => React__default.JSX.Element;
|
|
1248
|
+
|
|
1249
|
+
declare function ClientComponentWrapper<T>({ ClientComponent, RegisterComponent, schema, }: {
|
|
1250
|
+
ClientComponent: React__default.FC<T>;
|
|
1251
|
+
RegisterComponent: React__default.FC<any>;
|
|
1252
|
+
schema: types.IBlockType<T>;
|
|
1253
|
+
}): types.Brick<T>;
|
|
1254
|
+
|
|
1255
|
+
declare function wrapClientComponent<T>({ ClientComponent, RegisterComponent, schema, }: {
|
|
1256
|
+
ClientComponent: React__default.FC<T>;
|
|
1257
|
+
RegisterComponent: React__default.FC<any>;
|
|
1258
|
+
schema: types.IBlockType<T>;
|
|
1259
|
+
}): types.Brick<T>;
|
|
1260
|
+
|
|
1261
|
+
declare const getBricks: () => types.Bricks;
|
|
1262
|
+
declare const getPageValues: () => types.PageValues | null;
|
|
1263
|
+
declare const getBlockValue: (propName: string) => any;
|
|
1264
|
+
declare const isAdmin: () => boolean;
|
|
1265
|
+
declare const register: (config: types.ReactBricksConfig) => void;
|
|
1266
|
+
|
|
1267
|
+
export { ClientComponentWrapper, DynamicComponent, File, Image, JsonLd, Link, PageViewer, _default as Plain, ReactBricks, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, blockPluginConstructor, cleanPage, fetchPage, fetchPages, fetchTags, getBlockValue, getBricks, getMetadata, getPagePlainText, getPageValues, isAdmin, markPluginConstructor, index as plugins, register, types, wrapClientComponent };
|