react-bricks 3.1.0-alpha.0 → 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/frontend/index.js +2 -0
- package/frontend/package.json +7 -0
- package/frontend/react-bricks-frontend.esm.js +2 -0
- package/getPagePlainText-3dc4494e.js +20 -0
- package/getPagePlainText-bc4381ad.js +6 -0
- package/index.js +2 -1
- package/package.json +2 -2
- package/react-bricks.d.ts +79 -78
- package/react-bricks.esm.js +2 -0
- package/react-bricks.cjs.production.min.js +0 -2
- package/react-bricks.esm.production.min.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-bricks",
|
|
3
|
-
"version": "3.1.
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
26
|
+
multiline?: boolean;
|
|
29
27
|
}
|
|
30
|
-
declare const Text:
|
|
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 = {}> =
|
|
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:
|
|
240
|
-
}) =>
|
|
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?:
|
|
303
|
+
component?: React.FC<ICustomKnobProps>;
|
|
306
304
|
validate?: (value: any, props?: Props) => boolean | string;
|
|
307
305
|
show?: (props: Props) => boolean;
|
|
308
306
|
textareaOptions?: {
|
|
@@ -432,6 +430,7 @@ declare namespace types {
|
|
|
432
430
|
isDarkColorMode?: boolean;
|
|
433
431
|
toggleColorMode?: () => void;
|
|
434
432
|
useCssInJs?: boolean;
|
|
433
|
+
appRootElement: string | HTMLElement;
|
|
435
434
|
clickToEditSide?: ClickToEditSide;
|
|
436
435
|
customFields?: Array<ISideEditPropPage | ISideGroup>;
|
|
437
436
|
responsiveBreakpoints: ResponsiveBreakpoint[];
|
|
@@ -470,7 +469,7 @@ declare namespace types {
|
|
|
470
469
|
renderLeaf?: (props: RenderLeafProps) => JSX.Element;
|
|
471
470
|
toggle: (editor: Editor$1, plugins: RichTextPlugin[]) => void;
|
|
472
471
|
button?: {
|
|
473
|
-
icon:
|
|
472
|
+
icon: React.ReactElement;
|
|
474
473
|
isActive: (editor: Editor$1) => boolean;
|
|
475
474
|
};
|
|
476
475
|
enhanceEditor?: (editor: Editor$1) => Editor$1;
|
|
@@ -483,7 +482,7 @@ declare namespace types {
|
|
|
483
482
|
label?: string;
|
|
484
483
|
hotKey?: string;
|
|
485
484
|
render: (props: RenderLeafProps) => JSX.Element;
|
|
486
|
-
icon:
|
|
485
|
+
icon: React.ReactElement;
|
|
487
486
|
}
|
|
488
487
|
/**
|
|
489
488
|
* Constructor for a Mark plugin
|
|
@@ -500,7 +499,7 @@ declare namespace types {
|
|
|
500
499
|
hotKey?: string;
|
|
501
500
|
render: (props: RenderElementProps) => JSX.Element;
|
|
502
501
|
renderItem?: (props: RenderElementProps) => JSX.Element;
|
|
503
|
-
icon:
|
|
502
|
+
icon: React.ReactElement;
|
|
504
503
|
}
|
|
505
504
|
/**
|
|
506
505
|
* Constructor for a Block plugin
|
|
@@ -521,7 +520,7 @@ interface RichTextProps {
|
|
|
521
520
|
plugins?: types.RichTextPlugin[];
|
|
522
521
|
multiline?: boolean;
|
|
523
522
|
}
|
|
524
|
-
declare const RichText:
|
|
523
|
+
declare const RichText: FC<RichTextProps>;
|
|
525
524
|
|
|
526
525
|
/**
|
|
527
526
|
* Props for renderLink render function
|
|
@@ -536,6 +535,7 @@ interface CompatibleRichTextProps {
|
|
|
536
535
|
renderBlock: (props: RenderElementProps) => JSX.Element;
|
|
537
536
|
placeholder: string;
|
|
538
537
|
propName: string;
|
|
538
|
+
multiline?: boolean;
|
|
539
539
|
allowedFeatures?: types.RichTextFeatures[];
|
|
540
540
|
renderBold?: (props: RenderLeafProps) => JSX.Element;
|
|
541
541
|
renderItalic?: (props: RenderLeafProps) => JSX.Element;
|
|
@@ -553,7 +553,7 @@ interface CompatibleRichTextProps {
|
|
|
553
553
|
renderH6?: (props: RenderElementProps) => JSX.Element;
|
|
554
554
|
renderQuote?: (props: RenderElementProps) => JSX.Element;
|
|
555
555
|
}
|
|
556
|
-
declare const CompatibleRichText:
|
|
556
|
+
declare const CompatibleRichText: React.FC<CompatibleRichTextProps>;
|
|
557
557
|
|
|
558
558
|
/**
|
|
559
559
|
* Props for Image
|
|
@@ -569,7 +569,7 @@ interface ImageProps {
|
|
|
569
569
|
imageClassName?: string;
|
|
570
570
|
imageStyle?: object;
|
|
571
571
|
}
|
|
572
|
-
declare const Image:
|
|
572
|
+
declare const Image: FC<ImageProps>;
|
|
573
573
|
|
|
574
574
|
/**
|
|
575
575
|
* Props for Repeater
|
|
@@ -577,29 +577,16 @@ declare const Image: React.FC<ImageProps>;
|
|
|
577
577
|
interface RepeaterProps {
|
|
578
578
|
propName: string;
|
|
579
579
|
itemProps?: types.Props;
|
|
580
|
-
renderWrapper?: (items:
|
|
581
|
-
renderItemWrapper?: (item:
|
|
580
|
+
renderWrapper?: (items: ReactElement) => ReactElement;
|
|
581
|
+
renderItemWrapper?: (item: ReactElement, index: number, itemsCount: number) => ReactElement;
|
|
582
582
|
}
|
|
583
|
-
declare const Repeater:
|
|
584
|
-
|
|
585
|
-
declare const Link: React.FC<LinkProps>;
|
|
586
|
-
|
|
587
|
-
declare const ReactBricks: React.FC<types.ReactBricksConfig>;
|
|
588
|
-
|
|
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);
|
|
583
|
+
declare const Repeater: FC<RepeaterProps>;
|
|
593
584
|
|
|
594
|
-
declare const
|
|
585
|
+
declare const Link: FC<LinkProps>;
|
|
595
586
|
|
|
596
|
-
declare const
|
|
587
|
+
declare const ReactBricks: FC<types.ReactBricksConfig>;
|
|
597
588
|
|
|
598
|
-
declare const
|
|
599
|
-
|
|
600
|
-
declare const Login: React.FC;
|
|
601
|
-
|
|
602
|
-
declare const Editor: React.FC;
|
|
589
|
+
declare const ReactBricksContext: Context<types.IReactBricksContext>;
|
|
603
590
|
|
|
604
591
|
/**
|
|
605
592
|
* Props for PageViewer
|
|
@@ -607,48 +594,17 @@ declare const Editor: React.FC;
|
|
|
607
594
|
interface PageViewerProps {
|
|
608
595
|
page: types.Page | null | undefined;
|
|
609
596
|
}
|
|
610
|
-
declare const PageViewer:
|
|
597
|
+
declare const PageViewer: FC<PageViewerProps>;
|
|
611
598
|
|
|
612
|
-
declare const
|
|
599
|
+
declare const Editor: FC;
|
|
613
600
|
|
|
614
|
-
declare const
|
|
601
|
+
declare const Playground: () => JSX.Element;
|
|
615
602
|
|
|
616
|
-
declare const
|
|
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
|
-
};
|
|
603
|
+
declare const AppSettings: FC;
|
|
648
604
|
|
|
649
|
-
declare const usePage
|
|
605
|
+
declare const usePage: (pageId: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
|
|
650
606
|
|
|
651
|
-
declare const usePage: (slug: string, language?: string | undefined) =>
|
|
607
|
+
declare const usePage$1: (slug: string, language?: string | undefined) => UseQueryResult<types.Page, unknown>;
|
|
652
608
|
|
|
653
609
|
/**
|
|
654
610
|
* Values returned from usePages
|
|
@@ -710,8 +666,6 @@ declare const usePageValues: () => [types.PageValues, (pageData: types.PartialPa
|
|
|
710
666
|
|
|
711
667
|
declare const useReactBricksContext: () => types.IReactBricksContext;
|
|
712
668
|
|
|
713
|
-
declare const useAdminContext: () => types.IReadAdminContext;
|
|
714
|
-
|
|
715
669
|
declare const fetchPage: (slug: string, apiKey: string, language?: string | undefined, pageTypes?: types.IPageType[] | undefined) => Promise<types.Page>;
|
|
716
670
|
|
|
717
671
|
/**
|
|
@@ -745,7 +699,7 @@ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks
|
|
|
745
699
|
|
|
746
700
|
declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
|
|
747
701
|
|
|
748
|
-
declare const _default
|
|
702
|
+
declare const _default: {
|
|
749
703
|
bold: types.RichTextPlugin;
|
|
750
704
|
italic: types.RichTextPlugin;
|
|
751
705
|
code: types.RichTextPlugin;
|
|
@@ -762,9 +716,56 @@ declare const _default$1: {
|
|
|
762
716
|
unorderedList: types.RichTextPlugin;
|
|
763
717
|
};
|
|
764
718
|
|
|
765
|
-
declare const _default: {
|
|
719
|
+
declare const _default$1: {
|
|
766
720
|
serialize: (nodes: Node[]) => string;
|
|
767
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;
|
|
768
767
|
};
|
|
769
768
|
|
|
770
|
-
|
|
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 };
|