react-bricks 3.1.0-alpha.0 → 3.1.3

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.1.0-alpha.0",
3
+ "version": "3.1.3",
4
4
  "description": "React Bricks is a CMS with visual editing based on React components.",
5
5
  "keywords": [
6
6
  "react bricks",
@@ -9,15 +9,27 @@
9
9
  "gatsby cms",
10
10
  "react visual editor",
11
11
  "react site builder",
12
- "react vidsual builder",
12
+ "react visual builder",
13
13
  "react blocks"
14
14
  ],
15
15
  "homepage": "https://reactbricks.com",
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
+ "exports": {
22
+ ".": {
23
+ "require": "./index.js",
24
+ "import": "./react-bricks.esm.js",
25
+ "default": "./react-bricks.esm.js"
26
+ },
27
+ "./frontend": {
28
+ "require": "./frontend/index.js",
29
+ "import": "./frontend/react-bricks-frontend.esm.js",
30
+ "default": "./frontend/react-bricks-frontend.esm.js"
31
+ }
32
+ },
21
33
  "peerDependencies": {
22
34
  "react": ">=17",
23
35
  "react-dom": ">=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
  /**
@@ -236,8 +234,8 @@ declare namespace types {
236
234
  className?: string;
237
235
  activeClassName?: string;
238
236
  isAdmin?: boolean;
239
- children: React__default.ReactNode;
240
- }) => React__default.ReactElement;
237
+ children: React.ReactNode;
238
+ }) => React.ReactElement;
241
239
  /**
242
240
  * Props of a content block
243
241
  */
@@ -302,7 +300,7 @@ declare namespace types {
302
300
  name: string;
303
301
  label: string;
304
302
  type: SideEditPropType;
305
- component?: React__default.FC<ICustomKnobProps>;
303
+ component?: React.FC<ICustomKnobProps>;
306
304
  validate?: (value: any, props?: Props) => boolean | string;
307
305
  show?: (props: Props) => boolean;
308
306
  textareaOptions?: {
@@ -349,6 +347,14 @@ declare namespace types {
349
347
  width: number;
350
348
  height: number;
351
349
  }
350
+ /**
351
+ * File value interface
352
+ */
353
+ interface IFileSource {
354
+ name: string;
355
+ url: string;
356
+ size: number;
357
+ }
352
358
  /**
353
359
  * A Color for a Select sidebar prop
354
360
  */
@@ -432,6 +438,7 @@ declare namespace types {
432
438
  isDarkColorMode?: boolean;
433
439
  toggleColorMode?: () => void;
434
440
  useCssInJs?: boolean;
441
+ appRootElement: string | HTMLElement;
435
442
  clickToEditSide?: ClickToEditSide;
436
443
  customFields?: Array<ISideEditPropPage | ISideGroup>;
437
444
  responsiveBreakpoints: ResponsiveBreakpoint[];
@@ -470,7 +477,7 @@ declare namespace types {
470
477
  renderLeaf?: (props: RenderLeafProps) => JSX.Element;
471
478
  toggle: (editor: Editor$1, plugins: RichTextPlugin[]) => void;
472
479
  button?: {
473
- icon: React__default.ReactElement;
480
+ icon: React.ReactElement;
474
481
  isActive: (editor: Editor$1) => boolean;
475
482
  };
476
483
  enhanceEditor?: (editor: Editor$1) => Editor$1;
@@ -483,7 +490,7 @@ declare namespace types {
483
490
  label?: string;
484
491
  hotKey?: string;
485
492
  render: (props: RenderLeafProps) => JSX.Element;
486
- icon: React__default.ReactElement;
493
+ icon: React.ReactElement;
487
494
  }
488
495
  /**
489
496
  * Constructor for a Mark plugin
@@ -500,7 +507,7 @@ declare namespace types {
500
507
  hotKey?: string;
501
508
  render: (props: RenderElementProps) => JSX.Element;
502
509
  renderItem?: (props: RenderElementProps) => JSX.Element;
503
- icon: React__default.ReactElement;
510
+ icon: React.ReactElement;
504
511
  }
505
512
  /**
506
513
  * Constructor for a Block plugin
@@ -521,7 +528,7 @@ interface RichTextProps {
521
528
  plugins?: types.RichTextPlugin[];
522
529
  multiline?: boolean;
523
530
  }
524
- declare const RichText: React.FC<RichTextProps>;
531
+ declare const RichText: FC<RichTextProps>;
525
532
 
526
533
  /**
527
534
  * Props for renderLink render function
@@ -536,6 +543,7 @@ interface CompatibleRichTextProps {
536
543
  renderBlock: (props: RenderElementProps) => JSX.Element;
537
544
  placeholder: string;
538
545
  propName: string;
546
+ multiline?: boolean;
539
547
  allowedFeatures?: types.RichTextFeatures[];
540
548
  renderBold?: (props: RenderLeafProps) => JSX.Element;
541
549
  renderItalic?: (props: RenderLeafProps) => JSX.Element;
@@ -553,7 +561,7 @@ interface CompatibleRichTextProps {
553
561
  renderH6?: (props: RenderElementProps) => JSX.Element;
554
562
  renderQuote?: (props: RenderElementProps) => JSX.Element;
555
563
  }
556
- declare const CompatibleRichText: React__default.FC<CompatibleRichTextProps>;
564
+ declare const CompatibleRichText: React.FC<CompatibleRichTextProps>;
557
565
 
558
566
  /**
559
567
  * Props for Image
@@ -569,7 +577,22 @@ interface ImageProps {
569
577
  imageClassName?: string;
570
578
  imageStyle?: object;
571
579
  }
572
- declare const Image: React.FC<ImageProps>;
580
+ declare const Image: FC<ImageProps>;
581
+
582
+ /**
583
+ * Props for Text
584
+ */
585
+ interface FileProps {
586
+ propName: string;
587
+ renderBlock: (props?: File) => JSX.Element;
588
+ allowedExtensions?: string[];
589
+ }
590
+ interface File {
591
+ name: string;
592
+ size: string;
593
+ url: string;
594
+ }
595
+ declare const File: React.FC<FileProps>;
573
596
 
574
597
  /**
575
598
  * Props for Repeater
@@ -577,29 +600,16 @@ declare const Image: React.FC<ImageProps>;
577
600
  interface RepeaterProps {
578
601
  propName: string;
579
602
  itemProps?: types.Props;
580
- renderWrapper?: (items: React.ReactElement) => React.ReactElement;
581
- renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
603
+ renderWrapper?: (items: ReactElement) => ReactElement;
604
+ renderItemWrapper?: (item: ReactElement, index: number, itemsCount: number) => ReactElement;
582
605
  }
583
- declare const Repeater: React.FC<RepeaterProps>;
606
+ declare const Repeater: FC<RepeaterProps>;
584
607
 
585
- declare const Link: React.FC<LinkProps>;
608
+ declare const Link: FC<LinkProps>;
586
609
 
587
- declare const ReactBricks: React.FC<types.ReactBricksConfig>;
610
+ declare const ReactBricks: FC<types.ReactBricksConfig>;
588
611
 
589
- declare const ReactBricksContext: React.Context<types.IReactBricksContext>;
590
-
591
- 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}";
592
- styleInject(css_248z);
593
-
594
- declare const Admin: React.FC<AdminProps>;
595
-
596
- declare const AdminContext: React.Context<types.IAdminContext>;
597
-
598
- declare const Header: React.FC<HeaderProps>;
599
-
600
- declare const Login: React.FC;
601
-
602
- declare const Editor: React.FC;
612
+ declare const ReactBricksContext: Context<types.IReactBricksContext>;
603
613
 
604
614
  /**
605
615
  * Props for PageViewer
@@ -607,48 +617,17 @@ declare const Editor: React.FC;
607
617
  interface PageViewerProps {
608
618
  page: types.Page | null | undefined;
609
619
  }
610
- declare const PageViewer: React.FC<PageViewerProps>;
620
+ declare const PageViewer: FC<PageViewerProps>;
611
621
 
612
- declare const Playground: () => JSX.Element;
622
+ declare const Editor: FC;
613
623
 
614
- declare const AppSettings: React.FC;
624
+ declare const Playground: () => JSX.Element;
615
625
 
616
- declare const useAuth: () => {
617
- loginUser: (email: string, password: string) => Promise<({
618
- id: string;
619
- email: string;
620
- firstName: string;
621
- lastName: string;
622
- company: string;
623
- avatarUrl?: string | undefined;
624
- isAdmin: boolean;
625
- token: string;
626
- appName: string;
627
- deployHookUrl?: string | undefined;
628
- deployHookMethod?: string | undefined;
629
- deployHookTriggerOnScheduledPublishing: boolean;
630
- deployHookStagingUrl?: string | undefined;
631
- deployHookStagingMethod?: string | undefined;
632
- deployHookStagingTriggerOnScheduledPublishing: boolean;
633
- eventsHookUrl?: string | undefined;
634
- eventsHookAuthToken?: string | undefined;
635
- canCreatePage: boolean;
636
- canDeletePage: boolean;
637
- canDeploy: boolean;
638
- canDeployStaging: boolean;
639
- role: string;
640
- plan: string;
641
- languages: types.Language[];
642
- defaultLanguage: string;
643
- } & {
644
- authToken: string;
645
- }) | null>;
646
- logoutUser: () => void;
647
- };
626
+ declare const AppSettings: FC;
648
627
 
649
- declare const usePage$1: (pageId: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
628
+ declare const usePage: (pageId: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
650
629
 
651
- declare const usePage: (slug: string, language?: string | undefined) => react_query.UseQueryResult<types.Page, unknown>;
630
+ declare const usePage$1: (slug: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
652
631
 
653
632
  /**
654
633
  * Values returned from usePages
@@ -710,8 +689,6 @@ declare const usePageValues: () => [types.PageValues, (pageData: types.PartialPa
710
689
 
711
690
  declare const useReactBricksContext: () => types.IReactBricksContext;
712
691
 
713
- declare const useAdminContext: () => types.IReadAdminContext;
714
-
715
692
  declare const fetchPage: (slug: string, apiKey: string, language?: string | undefined, pageTypes?: types.IPageType[] | undefined) => Promise<types.Page>;
716
693
 
717
694
  /**
@@ -745,7 +722,7 @@ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks
745
722
 
746
723
  declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
747
724
 
748
- declare const _default$1: {
725
+ declare const _default: {
749
726
  bold: types.RichTextPlugin;
750
727
  italic: types.RichTextPlugin;
751
728
  code: types.RichTextPlugin;
@@ -762,9 +739,56 @@ declare const _default$1: {
762
739
  unorderedList: types.RichTextPlugin;
763
740
  };
764
741
 
765
- declare const _default: {
742
+ declare const _default$1: {
766
743
  serialize: (nodes: Node[]) => string;
767
744
  deserialize: (input: string) => Descendant[];
745
+ isText: (value: any) => boolean;
746
+ };
747
+
748
+ 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}";
749
+ styleInject(css_248z);
750
+
751
+ declare const Admin: FC<AdminProps>;
752
+
753
+ declare const AdminContext: Context<types.IAdminContext>;
754
+
755
+ declare const Header: FC<HeaderProps>;
756
+
757
+ declare const Login: FC;
758
+
759
+ declare const useAuth: () => {
760
+ loginUser: (email: string, password: string) => Promise<({
761
+ id: string;
762
+ email: string;
763
+ firstName: string;
764
+ lastName: string;
765
+ company: string;
766
+ avatarUrl?: string | undefined;
767
+ isAdmin: boolean;
768
+ token: string;
769
+ appName: string;
770
+ deployHookUrl?: string | undefined;
771
+ deployHookMethod?: string | undefined;
772
+ deployHookTriggerOnScheduledPublishing: boolean;
773
+ deployHookStagingUrl?: string | undefined;
774
+ deployHookStagingMethod?: string | undefined;
775
+ deployHookStagingTriggerOnScheduledPublishing: boolean;
776
+ eventsHookUrl?: string | undefined;
777
+ eventsHookAuthToken?: string | undefined;
778
+ canCreatePage: boolean;
779
+ canDeletePage: boolean;
780
+ canDeploy: boolean;
781
+ canDeployStaging: boolean;
782
+ role: string;
783
+ plan: string;
784
+ languages: types.Language[];
785
+ defaultLanguage: string;
786
+ } & {
787
+ authToken: string;
788
+ }) | null>;
789
+ logoutUser: () => void;
768
790
  };
769
791
 
770
- 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 };
792
+ declare const useAdminContext: () => types.IReadAdminContext;
793
+
794
+ export { Admin, AdminContext, AppSettings, Editor, File, 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 };