react-bricks 4.6.1 → 4.7.0-alpha.0

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