react-bricks 3.0.0-beta.4 → 3.1.1-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-bricks",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.1.1-beta.0",
4
4
  "description": "React Bricks is a CMS with visual editing based on React components.",
5
5
  "keywords": [
6
6
  "react bricks",
@@ -16,7 +16,7 @@
16
16
  "license": "UNLICENSED",
17
17
  "author": "Matteo Frana @ F2 .net engineering s.r.l. <f2@f2.net>",
18
18
  "main": "index.js",
19
- "module": "react-bricks.esm.production.min.js",
19
+ "module": "react-bricks.esm.js",
20
20
  "typings": "react-bricks.d.ts",
21
21
  "peerDependencies": {
22
22
  "react": ">=17",
package/react-bricks.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
1
+ import React, { FC, ReactElement, Context } from 'react';
3
2
  import { BaseEditor, Editor as Editor$1, Node, Descendant } from 'slate';
4
- import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
5
3
  import { HistoryEditor } from 'slate-history';
6
- import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
7
- import * as react_query from 'react-query';
4
+ import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
8
5
  import { UseQueryResult } from 'react-query';
6
+ import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
9
7
  export { v4 as uuid } from 'uuid';
10
8
 
11
9
  declare module 'slate' {
@@ -25,9 +23,9 @@ interface TextProps {
25
23
  children: any;
26
24
  }) => JSX.Element;
27
25
  propName: string;
28
- multiline: boolean;
26
+ multiline?: boolean;
29
27
  }
30
- declare const Text: React.FC<TextProps>;
28
+ declare const Text: FC<TextProps>;
31
29
 
32
30
  declare namespace types {
33
31
  /**
@@ -98,7 +96,7 @@ declare namespace types {
98
96
  /**
99
97
  * A Brick is a type of content block
100
98
  */
101
- type Brick<T = {}> = React__default.FC<T> & {
99
+ type Brick<T = {}> = React.FC<T> & {
102
100
  schema: IBlockType;
103
101
  };
104
102
  /**
@@ -154,6 +152,7 @@ declare namespace types {
154
152
  slug: string;
155
153
  meta: IMeta;
156
154
  customValues?: Props;
155
+ externalData?: Props;
157
156
  content: IContentBlock[];
158
157
  authorId?: string;
159
158
  author: Author;
@@ -235,8 +234,8 @@ declare namespace types {
235
234
  className?: string;
236
235
  activeClassName?: string;
237
236
  isAdmin?: boolean;
238
- children: React__default.ReactNode;
239
- }) => React__default.ReactElement;
237
+ children: React.ReactNode;
238
+ }) => React.ReactElement;
240
239
  /**
241
240
  * Props of a content block
242
241
  */
@@ -253,6 +252,7 @@ declare namespace types {
253
252
  hideFromAddMenu?: boolean;
254
253
  sideEditProps?: Array<ISideEditProp | ISideGroup>;
255
254
  repeaterItems?: IRepeaterItem[];
255
+ mapExternalDataToProps?: (externalData: Props, brickProps?: Props) => Props;
256
256
  playgroundLinkUrl?: string;
257
257
  playgroundLinkLabel?: string;
258
258
  category?: string;
@@ -300,7 +300,7 @@ declare namespace types {
300
300
  name: string;
301
301
  label: string;
302
302
  type: SideEditPropType;
303
- component?: React__default.FC<ICustomKnobProps>;
303
+ component?: React.FC<ICustomKnobProps>;
304
304
  validate?: (value: any, props?: Props) => boolean | string;
305
305
  show?: (props: Props) => boolean;
306
306
  textareaOptions?: {
@@ -368,6 +368,7 @@ declare namespace types {
368
368
  defaultFeaturedImage?: string;
369
369
  getDefaultContent?: () => string[];
370
370
  customFields?: Array<ISideEditPropPage | ISideGroup>;
371
+ getExternalData?: (page: Page) => Promise<Props>;
371
372
  }
372
373
  /**
373
374
  * Structure returned by the cleanBlocks function
@@ -429,6 +430,7 @@ declare namespace types {
429
430
  isDarkColorMode?: boolean;
430
431
  toggleColorMode?: () => void;
431
432
  useCssInJs?: boolean;
433
+ appRootElement: string | HTMLElement;
432
434
  clickToEditSide?: ClickToEditSide;
433
435
  customFields?: Array<ISideEditPropPage | ISideGroup>;
434
436
  responsiveBreakpoints: ResponsiveBreakpoint[];
@@ -467,7 +469,7 @@ declare namespace types {
467
469
  renderLeaf?: (props: RenderLeafProps) => JSX.Element;
468
470
  toggle: (editor: Editor$1, plugins: RichTextPlugin[]) => void;
469
471
  button?: {
470
- icon: React__default.ReactElement;
472
+ icon: React.ReactElement;
471
473
  isActive: (editor: Editor$1) => boolean;
472
474
  };
473
475
  enhanceEditor?: (editor: Editor$1) => Editor$1;
@@ -480,7 +482,7 @@ declare namespace types {
480
482
  label?: string;
481
483
  hotKey?: string;
482
484
  render: (props: RenderLeafProps) => JSX.Element;
483
- icon: React__default.ReactElement;
485
+ icon: React.ReactElement;
484
486
  }
485
487
  /**
486
488
  * Constructor for a Mark plugin
@@ -497,7 +499,7 @@ declare namespace types {
497
499
  hotKey?: string;
498
500
  render: (props: RenderElementProps) => JSX.Element;
499
501
  renderItem?: (props: RenderElementProps) => JSX.Element;
500
- icon: React__default.ReactElement;
502
+ icon: React.ReactElement;
501
503
  }
502
504
  /**
503
505
  * Constructor for a Block plugin
@@ -518,7 +520,7 @@ interface RichTextProps {
518
520
  plugins?: types.RichTextPlugin[];
519
521
  multiline?: boolean;
520
522
  }
521
- declare const RichText: React.FC<RichTextProps>;
523
+ declare const RichText: FC<RichTextProps>;
522
524
 
523
525
  /**
524
526
  * Props for renderLink render function
@@ -533,6 +535,7 @@ interface CompatibleRichTextProps {
533
535
  renderBlock: (props: RenderElementProps) => JSX.Element;
534
536
  placeholder: string;
535
537
  propName: string;
538
+ multiline?: boolean;
536
539
  allowedFeatures?: types.RichTextFeatures[];
537
540
  renderBold?: (props: RenderLeafProps) => JSX.Element;
538
541
  renderItalic?: (props: RenderLeafProps) => JSX.Element;
@@ -550,7 +553,7 @@ interface CompatibleRichTextProps {
550
553
  renderH6?: (props: RenderElementProps) => JSX.Element;
551
554
  renderQuote?: (props: RenderElementProps) => JSX.Element;
552
555
  }
553
- declare const CompatibleRichText: React__default.FC<CompatibleRichTextProps>;
556
+ declare const CompatibleRichText: React.FC<CompatibleRichTextProps>;
554
557
 
555
558
  /**
556
559
  * Props for Image
@@ -566,7 +569,7 @@ interface ImageProps {
566
569
  imageClassName?: string;
567
570
  imageStyle?: object;
568
571
  }
569
- declare const Image: React.FC<ImageProps>;
572
+ declare const Image: FC<ImageProps>;
570
573
 
571
574
  /**
572
575
  * Props for Repeater
@@ -574,29 +577,16 @@ declare const Image: React.FC<ImageProps>;
574
577
  interface RepeaterProps {
575
578
  propName: string;
576
579
  itemProps?: types.Props;
577
- renderWrapper?: (items: React.ReactElement) => React.ReactElement;
578
- renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
580
+ renderWrapper?: (items: ReactElement) => ReactElement;
581
+ renderItemWrapper?: (item: ReactElement, index: number, itemsCount: number) => ReactElement;
579
582
  }
580
- declare const Repeater: React.FC<RepeaterProps>;
581
-
582
- declare const Link: React.FC<LinkProps>;
583
-
584
- declare const ReactBricks: React.FC<types.ReactBricksConfig>;
585
-
586
- declare const ReactBricksContext: React.Context<types.IReactBricksContext>;
587
-
588
- var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:\"\";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}";
589
- styleInject(css_248z);
583
+ declare const Repeater: FC<RepeaterProps>;
590
584
 
591
- declare const Admin: React.FC<AdminProps>;
585
+ declare const Link: FC<LinkProps>;
592
586
 
593
- declare const AdminContext: React.Context<types.IAdminContext>;
587
+ declare const ReactBricks: FC<types.ReactBricksConfig>;
594
588
 
595
- declare const Header: React.FC<HeaderProps>;
596
-
597
- declare const Login: React.FC;
598
-
599
- declare const Editor: React.FC;
589
+ declare const ReactBricksContext: Context<types.IReactBricksContext>;
600
590
 
601
591
  /**
602
592
  * Props for PageViewer
@@ -604,48 +594,17 @@ declare const Editor: React.FC;
604
594
  interface PageViewerProps {
605
595
  page: types.Page | null | undefined;
606
596
  }
607
- declare const PageViewer: React.FC<PageViewerProps>;
597
+ declare const PageViewer: FC<PageViewerProps>;
608
598
 
609
- declare const Playground: () => JSX.Element;
599
+ declare const Editor: FC;
610
600
 
611
- declare const AppSettings: React.FC;
601
+ declare const Playground: () => JSX.Element;
612
602
 
613
- declare const useAuth: () => {
614
- loginUser: (email: string, password: string) => Promise<({
615
- id: string;
616
- email: string;
617
- firstName: string;
618
- lastName: string;
619
- company: string;
620
- avatarUrl?: string | undefined;
621
- isAdmin: boolean;
622
- token: string;
623
- appName: string;
624
- deployHookUrl?: string | undefined;
625
- deployHookMethod?: string | undefined;
626
- deployHookTriggerOnScheduledPublishing: boolean;
627
- deployHookStagingUrl?: string | undefined;
628
- deployHookStagingMethod?: string | undefined;
629
- deployHookStagingTriggerOnScheduledPublishing: boolean;
630
- eventsHookUrl?: string | undefined;
631
- eventsHookAuthToken?: string | undefined;
632
- canCreatePage: boolean;
633
- canDeletePage: boolean;
634
- canDeploy: boolean;
635
- canDeployStaging: boolean;
636
- role: string;
637
- plan: string;
638
- languages: types.Language[];
639
- defaultLanguage: string;
640
- } & {
641
- authToken: string;
642
- }) | null>;
643
- logoutUser: () => void;
644
- };
603
+ declare const AppSettings: FC;
645
604
 
646
- declare const usePage$1: (pageId: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
605
+ declare const usePage: (pageId: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
647
606
 
648
- declare const usePage: (slug: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
607
+ declare const usePage$1: (slug: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
649
608
 
650
609
  /**
651
610
  * Values returned from usePages
@@ -707,9 +666,7 @@ declare const usePageValues: () => [types.PageValues, (pageData: types.PartialPa
707
666
 
708
667
  declare const useReactBricksContext: () => types.IReactBricksContext;
709
668
 
710
- declare const useAdminContext: () => types.IReadAdminContext;
711
-
712
- declare const fetchPage: (slug: string, apiKey: string, language?: string | undefined) => Promise<types.Page>;
669
+ declare const fetchPage: (slug: string, apiKey: string, language?: string | undefined, pageTypes?: types.IPageType[] | undefined) => Promise<types.Page>;
713
670
 
714
671
  /**
715
672
  * Values returned from fetchPages
@@ -742,7 +699,7 @@ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks
742
699
 
743
700
  declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
744
701
 
745
- declare const _default$1: {
702
+ declare const _default: {
746
703
  bold: types.RichTextPlugin;
747
704
  italic: types.RichTextPlugin;
748
705
  code: types.RichTextPlugin;
@@ -759,9 +716,56 @@ declare const _default$1: {
759
716
  unorderedList: types.RichTextPlugin;
760
717
  };
761
718
 
762
- declare const _default: {
719
+ declare const _default$1: {
763
720
  serialize: (nodes: Node[]) => string;
764
721
  deserialize: (input: string) => Descendant[];
722
+ isText: (value: any) => boolean;
723
+ };
724
+
725
+ var css_248z = ".tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:\"\";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}";
726
+ styleInject(css_248z);
727
+
728
+ declare const Admin: FC<AdminProps>;
729
+
730
+ declare const AdminContext: Context<types.IAdminContext>;
731
+
732
+ declare const Header: FC<HeaderProps>;
733
+
734
+ declare const Login: FC;
735
+
736
+ declare const useAuth: () => {
737
+ loginUser: (email: string, password: string) => Promise<({
738
+ id: string;
739
+ email: string;
740
+ firstName: string;
741
+ lastName: string;
742
+ company: string;
743
+ avatarUrl?: string | undefined;
744
+ isAdmin: boolean;
745
+ token: string;
746
+ appName: string;
747
+ deployHookUrl?: string | undefined;
748
+ deployHookMethod?: string | undefined;
749
+ deployHookTriggerOnScheduledPublishing: boolean;
750
+ deployHookStagingUrl?: string | undefined;
751
+ deployHookStagingMethod?: string | undefined;
752
+ deployHookStagingTriggerOnScheduledPublishing: boolean;
753
+ eventsHookUrl?: string | undefined;
754
+ eventsHookAuthToken?: string | undefined;
755
+ canCreatePage: boolean;
756
+ canDeletePage: boolean;
757
+ canDeploy: boolean;
758
+ canDeployStaging: boolean;
759
+ role: string;
760
+ plan: string;
761
+ languages: types.Language[];
762
+ defaultLanguage: string;
763
+ } & {
764
+ authToken: string;
765
+ }) | null>;
766
+ logoutUser: () => void;
765
767
  };
766
768
 
767
- export { Admin, AdminContext, AppSettings, Editor, Header, Image, Link, Login, PageViewer, _default as Plain, Playground, ReactBricks, ReactBricksContext, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, cleanPage, fetchPage, fetchPages, getPagePlainText, _default$1 as plugins, types, useAdminContext, useAuth, usePage$1 as usePage, usePage as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useVisualEdit };
769
+ declare const useAdminContext: () => types.IReadAdminContext;
770
+
771
+ export { Admin, AdminContext, AppSettings, Editor, Header, Image, Link, Login, PageViewer, _default$1 as Plain, Playground, ReactBricks, ReactBricksContext, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, cleanPage, fetchPage, fetchPages, getPagePlainText, _default as plugins, types, useAdminContext, useAuth, usePage, usePage$1 as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useVisualEdit };