react-bricks 4.1.3 → 4.2.0-beta.1
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 +13 -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
package/react-bricks.d.ts
CHANGED
|
@@ -1,64 +1,26 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Descendant, Editor as Editor$1, BaseEditor, Element, Node } from 'slate';
|
|
4
|
+
import { RenderElementProps, RenderLeafProps, ReactEditor } from 'slate-react';
|
|
4
5
|
import { HistoryEditor } from 'slate-history';
|
|
5
|
-
import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
|
|
6
6
|
import * as react_query from 'react-query';
|
|
7
7
|
import { UseQueryResult } from 'react-query';
|
|
8
8
|
export { v4 as uuid } from 'uuid';
|
|
9
9
|
|
|
10
|
+
declare const useAdminContext: () => types.IReadAdminContext;
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
declare type CustomElement = {
|
|
14
|
-
type: string;
|
|
15
|
-
element?: Element;
|
|
16
|
-
children: CustomText[];
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* CustomText for Slate
|
|
13
|
+
* Props for Link component
|
|
21
14
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Editor: BaseEditor & ReactEditor & HistoryEditor;
|
|
29
|
-
Element: CustomElement;
|
|
30
|
-
Text: CustomText;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
interface BaseTextProps {
|
|
34
|
-
renderBlock?: (props: RenderElementProps) => JSX.Element;
|
|
35
|
-
placeholder?: string;
|
|
36
|
-
renderPlaceholder?: (props: {
|
|
37
|
-
children: any;
|
|
38
|
-
}) => JSX.Element;
|
|
39
|
-
multiline?: boolean;
|
|
40
|
-
softLineBreak?: boolean;
|
|
41
|
-
}
|
|
42
|
-
interface TextPropsWithPropName extends BaseTextProps {
|
|
43
|
-
propName: string;
|
|
44
|
-
metaFieldName?: never;
|
|
45
|
-
customFieldName?: never;
|
|
46
|
-
}
|
|
47
|
-
interface TextPropsWithMetaFieldName extends BaseTextProps {
|
|
48
|
-
propName?: never;
|
|
49
|
-
metaFieldName: 'title' | 'description' | 'language';
|
|
50
|
-
customFieldName?: never;
|
|
51
|
-
}
|
|
52
|
-
interface TextPropsWithCustomFieldName extends BaseTextProps {
|
|
53
|
-
propName?: never;
|
|
54
|
-
metaFieldName?: never;
|
|
55
|
-
customFieldName: string;
|
|
15
|
+
interface LinkProps {
|
|
16
|
+
href: string;
|
|
17
|
+
target?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
activeClassName?: string;
|
|
20
|
+
simpleAnchor?: boolean;
|
|
56
21
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
declare type TextProps = TextPropsWithPropName | TextPropsWithMetaFieldName | TextPropsWithCustomFieldName;
|
|
61
|
-
declare const Text: React.FC<TextProps>;
|
|
22
|
+
declare type LinkPropsReal = React.PropsWithChildren<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> & LinkProps>;
|
|
23
|
+
declare const Link: React.FC<LinkPropsReal>;
|
|
62
24
|
|
|
63
25
|
declare namespace types {
|
|
64
26
|
export const EmbedProp = "RB_PAGE_EMBED";
|
|
@@ -381,6 +343,7 @@ declare namespace types {
|
|
|
381
343
|
previewImageUrl?: string;
|
|
382
344
|
props: T;
|
|
383
345
|
};
|
|
346
|
+
export type RepeaterItems = IContentBlock[] | Omit<IContentBlock, 'id'>[] | Props[];
|
|
384
347
|
/**
|
|
385
348
|
* A Language for i18n
|
|
386
349
|
*/
|
|
@@ -418,7 +381,7 @@ declare namespace types {
|
|
|
418
381
|
label: string;
|
|
419
382
|
getDefaultProps?: () => Partial<T>;
|
|
420
383
|
hideFromAddMenu?: boolean;
|
|
421
|
-
sideEditProps?: Array<ISideEditProp | ISideGroup
|
|
384
|
+
sideEditProps?: Array<ISideEditProp<T> | ISideGroup<T>>;
|
|
422
385
|
repeaterItems?: IRepeaterItem[];
|
|
423
386
|
newItemMenuOpen?: boolean;
|
|
424
387
|
groupByRepeater?: boolean;
|
|
@@ -483,13 +446,13 @@ declare namespace types {
|
|
|
483
446
|
/**
|
|
484
447
|
* Sidebar edit Props for a Page
|
|
485
448
|
*/
|
|
486
|
-
export interface ISideEditPropPage {
|
|
449
|
+
export interface ISideEditPropPage<T = Props> {
|
|
487
450
|
name: string;
|
|
488
451
|
label: string;
|
|
489
452
|
type: SideEditPropType;
|
|
490
453
|
component?: React__default.FC<ICustomKnobProps>;
|
|
491
|
-
validate?: (value: any, props?:
|
|
492
|
-
show?: (props:
|
|
454
|
+
validate?: (value: any, props?: T) => boolean | string;
|
|
455
|
+
show?: (props: T, page?: Page, user?: User) => boolean;
|
|
493
456
|
helperText?: string;
|
|
494
457
|
textareaOptions?: {
|
|
495
458
|
height?: number;
|
|
@@ -518,18 +481,18 @@ declare namespace types {
|
|
|
518
481
|
/**
|
|
519
482
|
* Sidebar Edit Props
|
|
520
483
|
*/
|
|
521
|
-
export interface ISideEditProp extends ISideEditPropPage {
|
|
484
|
+
export interface ISideEditProp<T = Props> extends ISideEditPropPage<T> {
|
|
522
485
|
shouldRefreshText?: boolean;
|
|
523
486
|
shouldRefreshStyles?: boolean;
|
|
524
487
|
}
|
|
525
488
|
/**
|
|
526
489
|
* A collapsible Group of sidebar Props
|
|
527
490
|
*/
|
|
528
|
-
export interface ISideGroup {
|
|
491
|
+
export interface ISideGroup<T = Props> {
|
|
529
492
|
groupName: string;
|
|
530
493
|
defaultOpen?: boolean;
|
|
531
|
-
show?: (props:
|
|
532
|
-
props: ISideEditProp[] | ISideEditPropPage[];
|
|
494
|
+
show?: (props: T, page?: Page, user?: User) => boolean;
|
|
495
|
+
props: ISideEditProp<T>[] | ISideEditPropPage<T>[];
|
|
533
496
|
}
|
|
534
497
|
/**
|
|
535
498
|
* Image Crop interface
|
|
@@ -867,23 +830,77 @@ declare namespace types {
|
|
|
867
830
|
}
|
|
868
831
|
|
|
869
832
|
/**
|
|
870
|
-
* Props for
|
|
833
|
+
* Props for Text
|
|
871
834
|
*/
|
|
872
|
-
interface
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
835
|
+
interface FileProps {
|
|
836
|
+
propName: string;
|
|
837
|
+
renderBlock: (props: types.IFileSource | null) => JSX.Element;
|
|
838
|
+
allowedExtensions?: string[];
|
|
839
|
+
}
|
|
840
|
+
declare const File$1: React__default.FC<FileProps>;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Arguments for the renderWrapper function
|
|
844
|
+
*/
|
|
845
|
+
interface IRenderWrapperArgs {
|
|
846
|
+
children: React.ReactNode;
|
|
847
|
+
width?: number;
|
|
848
|
+
height?: number;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* renderWrapper function type
|
|
852
|
+
*/
|
|
853
|
+
declare type RenderWrapper = (args: IRenderWrapperArgs) => React.ReactElement;
|
|
854
|
+
interface PlaceholderProps {
|
|
855
|
+
aspectRatio?: number;
|
|
856
|
+
maxWidth?: number;
|
|
857
|
+
isDarkColorMode?: boolean;
|
|
858
|
+
isAdmin: boolean;
|
|
859
|
+
}
|
|
860
|
+
interface SharedImageProps {
|
|
861
|
+
readonly?: boolean;
|
|
862
|
+
alt: string;
|
|
863
|
+
noLazyLoad?: boolean;
|
|
864
|
+
containerClassName?: string;
|
|
865
|
+
containerStyle?: React.CSSProperties;
|
|
866
|
+
imageClassName?: string;
|
|
867
|
+
imageStyle?: React.CSSProperties;
|
|
868
|
+
noWrapper?: boolean;
|
|
869
|
+
sizes?: string;
|
|
870
|
+
loading?: 'lazy' | 'eager';
|
|
871
|
+
renderWrapper?: RenderWrapper;
|
|
872
|
+
useNativeLazyLoading?: boolean;
|
|
873
|
+
useWebP?: boolean;
|
|
874
|
+
placeholder?: (props: PlaceholderProps) => string;
|
|
875
|
+
}
|
|
876
|
+
interface EditableImage extends SharedImageProps {
|
|
877
|
+
readonly?: false;
|
|
881
878
|
propName?: string;
|
|
882
|
-
metaFieldName?: '
|
|
879
|
+
metaFieldName?: 'image';
|
|
883
880
|
customFieldName?: string;
|
|
884
|
-
|
|
881
|
+
aspectRatio?: number;
|
|
882
|
+
maxWidth?: number;
|
|
883
|
+
}
|
|
884
|
+
interface ReadOnlyImage extends SharedImageProps {
|
|
885
|
+
readonly: true;
|
|
886
|
+
source: types.IImageSource;
|
|
885
887
|
}
|
|
886
|
-
|
|
888
|
+
/**
|
|
889
|
+
* Props for Image
|
|
890
|
+
*/
|
|
891
|
+
declare type ImageProps = EditableImage | ReadOnlyImage;
|
|
892
|
+
declare const Image$1: React.FC<ImageProps>;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Props for Repeater
|
|
896
|
+
*/
|
|
897
|
+
interface RepeaterProps {
|
|
898
|
+
propName: string;
|
|
899
|
+
itemProps?: types.Props;
|
|
900
|
+
renderWrapper?: (items: React.ReactElement) => React.ReactElement;
|
|
901
|
+
renderItemWrapper?: (item: React.ReactElement, index: number, itemsCount: number) => React.ReactElement;
|
|
902
|
+
}
|
|
903
|
+
declare const Repeater: React.FC<RepeaterProps>;
|
|
887
904
|
|
|
888
905
|
/**
|
|
889
906
|
* Props for renderLink render function
|
|
@@ -939,96 +956,80 @@ interface RichTextPropsWithCustomFieldName extends BaseRichTextProps {
|
|
|
939
956
|
/**
|
|
940
957
|
* Props for RichText component
|
|
941
958
|
*/
|
|
942
|
-
declare type RichTextProps = RichTextPropsWithPropName | RichTextPropsWithMetaFieldName | RichTextPropsWithCustomFieldName;
|
|
943
|
-
declare const CompatibleRichText: React__default.FC<RichTextProps>;
|
|
959
|
+
declare type RichTextProps$1 = RichTextPropsWithPropName | RichTextPropsWithMetaFieldName | RichTextPropsWithCustomFieldName;
|
|
960
|
+
declare const CompatibleRichText: React__default.FC<RichTextProps$1>;
|
|
944
961
|
|
|
945
962
|
/**
|
|
946
|
-
*
|
|
947
|
-
*/
|
|
948
|
-
interface IRenderWrapperArgs {
|
|
949
|
-
children: React.ReactNode;
|
|
950
|
-
width?: number;
|
|
951
|
-
height?: number;
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* renderWrapper function type
|
|
963
|
+
* Props for RichTextExt (v3)
|
|
955
964
|
*/
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
alt: string;
|
|
966
|
-
noLazyLoad?: boolean;
|
|
967
|
-
containerClassName?: string;
|
|
968
|
-
containerStyle?: React.CSSProperties;
|
|
969
|
-
imageClassName?: string;
|
|
970
|
-
imageStyle?: React.CSSProperties;
|
|
971
|
-
noWrapper?: boolean;
|
|
972
|
-
sizes?: string;
|
|
973
|
-
loading?: 'lazy' | 'eager';
|
|
974
|
-
renderWrapper?: RenderWrapper;
|
|
975
|
-
useNativeLazyLoading?: boolean;
|
|
976
|
-
useWebP?: boolean;
|
|
977
|
-
placeholder?: (props: PlaceholderProps) => string;
|
|
978
|
-
}
|
|
979
|
-
interface EditableImage extends SharedImageProps {
|
|
980
|
-
readonly?: false;
|
|
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;
|
|
981
974
|
propName?: string;
|
|
982
|
-
metaFieldName?: '
|
|
975
|
+
metaFieldName?: 'title' | 'description' | 'language';
|
|
983
976
|
customFieldName?: string;
|
|
984
|
-
|
|
985
|
-
maxWidth?: number;
|
|
986
|
-
}
|
|
987
|
-
interface ReadOnlyImage extends SharedImageProps {
|
|
988
|
-
readonly: true;
|
|
989
|
-
source: types.IImageSource;
|
|
977
|
+
customFieldPlainText?: boolean;
|
|
990
978
|
}
|
|
991
|
-
|
|
992
|
-
* Props for Image
|
|
993
|
-
*/
|
|
994
|
-
declare type ImageProps = EditableImage | ReadOnlyImage;
|
|
995
|
-
declare const Image$1: React.FC<ImageProps>;
|
|
979
|
+
declare const RichText: React.FC<RichTextProps>;
|
|
996
980
|
|
|
997
981
|
/**
|
|
998
|
-
*
|
|
982
|
+
* CustomElement for Slate
|
|
999
983
|
*/
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
984
|
+
declare type CustomElement = {
|
|
985
|
+
type: string;
|
|
986
|
+
element?: Element;
|
|
987
|
+
children: CustomText[];
|
|
988
|
+
[key: string]: any;
|
|
989
|
+
};
|
|
1007
990
|
/**
|
|
1008
|
-
*
|
|
991
|
+
* CustomText for Slate
|
|
1009
992
|
*/
|
|
1010
|
-
|
|
993
|
+
declare type CustomText = {
|
|
994
|
+
text?: string;
|
|
995
|
+
[key: string]: any;
|
|
996
|
+
};
|
|
997
|
+
declare module 'slate' {
|
|
998
|
+
interface CustomTypes {
|
|
999
|
+
Editor: BaseEditor & ReactEditor & HistoryEditor;
|
|
1000
|
+
Element: CustomElement;
|
|
1001
|
+
Text: CustomText;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
interface BaseTextProps {
|
|
1005
|
+
renderBlock?: (props: RenderElementProps) => JSX.Element;
|
|
1006
|
+
placeholder?: string;
|
|
1007
|
+
renderPlaceholder?: (props: {
|
|
1008
|
+
children: any;
|
|
1009
|
+
}) => JSX.Element;
|
|
1010
|
+
multiline?: boolean;
|
|
1011
|
+
softLineBreak?: boolean;
|
|
1012
|
+
}
|
|
1013
|
+
interface TextPropsWithPropName extends BaseTextProps {
|
|
1011
1014
|
propName: string;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
+
metaFieldName?: never;
|
|
1016
|
+
customFieldName?: never;
|
|
1017
|
+
}
|
|
1018
|
+
interface TextPropsWithMetaFieldName extends BaseTextProps {
|
|
1019
|
+
propName?: never;
|
|
1020
|
+
metaFieldName: 'title' | 'description' | 'language';
|
|
1021
|
+
customFieldName?: never;
|
|
1022
|
+
}
|
|
1023
|
+
interface TextPropsWithCustomFieldName extends BaseTextProps {
|
|
1024
|
+
propName?: never;
|
|
1025
|
+
metaFieldName?: never;
|
|
1026
|
+
customFieldName: string;
|
|
1015
1027
|
}
|
|
1016
|
-
declare const Repeater: React.FC<RepeaterProps>;
|
|
1017
|
-
|
|
1018
1028
|
/**
|
|
1019
|
-
* Props for
|
|
1029
|
+
* Props for Text component
|
|
1020
1030
|
*/
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
target?: string;
|
|
1024
|
-
className?: string;
|
|
1025
|
-
activeClassName?: string;
|
|
1026
|
-
simpleAnchor?: boolean;
|
|
1027
|
-
}
|
|
1028
|
-
declare type LinkPropsReal = React.PropsWithChildren<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> & LinkProps>;
|
|
1029
|
-
declare const Link: React.FC<LinkPropsReal>;
|
|
1030
|
-
|
|
1031
|
-
declare const useAdminContext: () => types.IReadAdminContext;
|
|
1031
|
+
declare type TextProps = TextPropsWithPropName | TextPropsWithMetaFieldName | TextPropsWithCustomFieldName;
|
|
1032
|
+
declare const Text: React.FC<TextProps>;
|
|
1032
1033
|
|
|
1033
1034
|
declare const usePageValues: () => [types.PageValues, (pageData: types.PartialPage) => void];
|
|
1034
1035
|
|
|
@@ -1052,6 +1053,7 @@ declare const ReactBricks: React.FC<types.ReactBricksConfig & {
|
|
|
1052
1053
|
*/
|
|
1053
1054
|
interface PageViewerProps {
|
|
1054
1055
|
page: types.Page | null | undefined;
|
|
1056
|
+
main?: boolean;
|
|
1055
1057
|
showClickToEdit?: boolean;
|
|
1056
1058
|
}
|
|
1057
1059
|
declare const PageViewer: React.FC<PageViewerProps>;
|
|
@@ -1061,10 +1063,10 @@ interface JsonLdProps {
|
|
|
1061
1063
|
}
|
|
1062
1064
|
declare const JsonLd: React__default.FC<JsonLdProps>;
|
|
1063
1065
|
|
|
1064
|
-
declare const renderJsonLd: React__default.FC<types.Page>;
|
|
1065
|
-
|
|
1066
1066
|
declare const getSchemaOrgData: (page: types.Page) => string | null;
|
|
1067
1067
|
|
|
1068
|
+
declare const renderJsonLd: React__default.FC<types.Page>;
|
|
1069
|
+
|
|
1068
1070
|
interface MetaProps {
|
|
1069
1071
|
page: types.Page;
|
|
1070
1072
|
}
|
|
@@ -1295,12 +1297,10 @@ declare namespace index {
|
|
|
1295
1297
|
};
|
|
1296
1298
|
}
|
|
1297
1299
|
|
|
1298
|
-
declare const Editor: React.FC;
|
|
1299
|
-
|
|
1300
|
-
declare const Playground: () => React.JSX.Element;
|
|
1301
|
-
|
|
1302
1300
|
declare const AppSettings: React.FC;
|
|
1303
1301
|
|
|
1302
|
+
declare const Editor: React.FC;
|
|
1303
|
+
|
|
1304
1304
|
/**
|
|
1305
1305
|
* File
|
|
1306
1306
|
*/
|
|
@@ -1350,6 +1350,8 @@ interface MediaLibraryProps {
|
|
|
1350
1350
|
}
|
|
1351
1351
|
declare const MediaLibrary: React__default.FC<MediaLibraryProps>;
|
|
1352
1352
|
|
|
1353
|
+
declare const Playground: () => React.JSX.Element;
|
|
1354
|
+
|
|
1353
1355
|
/**
|
|
1354
1356
|
* Props of Admin component
|
|
1355
1357
|
*/
|