@developer_tribe/react-builder 1.2.7 → 1.2.9
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/dist/AttributesEditor.d.ts +2 -11
- package/dist/attribute-analyser/style/native/useExtractImageStyle.d.ts +10 -0
- package/dist/attribute-analyser/style/native/useExtractTextStyle.d.ts +9 -0
- package/dist/attribute-analyser/style/native/useExtractViewStyle.d.ts +8 -0
- package/dist/attribute-analyser/style/web/useExtractImageStyle.d.ts +4 -0
- package/dist/attribute-analyser/style/web/useExtractTextStyle.d.ts +4 -0
- package/dist/attribute-analyser/style/web/useExtractViewStyle.d.ts +4 -0
- package/dist/attributes-editor/AttributesEditorFields.d.ts +18 -0
- package/dist/attributes-editor/AttributesEditorView.d.ts +4 -0
- package/dist/attributes-editor/attributesEditorModelTypes.d.ts +67 -0
- package/dist/attributes-editor/attributesEditorUtils.d.ts +19 -0
- package/dist/attributes-editor/useAttributesEditorModel.d.ts +2 -0
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +41 -38
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +37 -34
- package/dist/build-components/Button/ButtonProps.generated.d.ts +39 -36
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +37 -34
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +37 -34
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +37 -34
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +36 -33
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +36 -33
- package/dist/build-components/Image/ImageProps.generated.d.ts +38 -33
- package/dist/build-components/Main/MainProps.generated.d.ts +36 -33
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +36 -33
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +38 -34
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +39 -36
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +43 -34
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +41 -38
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +36 -31
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +39 -33
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +38 -34
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +41 -38
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +41 -38
- package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +36 -33
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +41 -38
- package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +36 -33
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +36 -33
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +39 -36
- package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +36 -33
- package/dist/build-components/Text/TextProps.generated.d.ts +41 -38
- package/dist/build-components/View/ViewProps.generated.d.ts +36 -33
- package/dist/build-components/patterns.generated.d.ts +2673 -5787
- package/dist/components/BuilderProvider.d.ts +6 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -26
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +6 -4
- package/dist/index.native.cjs.js.map +1 -1
- package/dist/index.native.d.ts +6 -3
- package/dist/index.native.esm.js +6 -4
- package/dist/index.native.esm.js.map +1 -1
- package/dist/migrations/migratePipe.d.ts +1 -1
- package/dist/migrations/migrations/1.1.2_extract_component_attributes_from_style.d.ts +2 -0
- package/dist/mockOS/components/PermissionModal.d.ts +1 -2
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +1 -5
- package/dist/utils/extractImageStyle.d.ts +3 -0
- package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +17 -0
- package/dist/utils/extractTextStyle.d.ts +2 -0
- package/dist/utils/extractViewStyle/extractViewStyleNative.d.ts +12 -0
- package/dist/utils/extractViewStyle.d.ts +2 -0
- package/dist/utils/getMeta.d.ts +5 -0
- package/dist/utils/patterns.d.ts +14 -1
- package/package.json +2 -1
- package/scripts/prebuild/prebuild.js +14 -0
- package/scripts/prebuild/utils/createGeneratedProps.js +51 -3
- package/scripts/prebuild/utils/index.js +1 -0
- package/scripts/prebuild/utils/updateMetaJson.js +66 -0
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +37 -3
- package/scripts/prebuild/utils/validatePatternJson.js +27 -2
- package/scripts/public/scripts/build/index.js +20 -3
- package/scripts/public/scripts/build/info.json +6 -0
- package/scripts/public/scripts/build/utils/createComponentsIndex.js +9 -3
- package/scripts/public/scripts/build/utils/createRenderNodeGenerated.js +66 -8
- package/src/AttributesEditor.tsx +8 -944
- package/src/assets/meta.json +4 -0
- package/src/assets/samples/carousel-sample.json +1 -1
- package/src/assets/samples/getSamples.ts +2 -0
- package/src/assets/samples/paywall-1.json +11 -7
- package/src/assets/samples/simple-1.json +3 -3
- package/src/assets/samples/simple-2.json +3 -3
- package/src/assets/samples/unmigrated-builder-1.1.1.json +87 -0
- package/src/assets/samples/unmigrated-builder1.json +1 -1
- package/src/assets/samples/unvalidated-builder1.json +3 -3
- package/src/assets/samples/unvalidated-crash1.json +1 -1
- package/src/assets/samples/unvalidated-crashcomponent1.json +1 -1
- package/src/assets/samples/vpn-onboard-1.json +1 -1
- package/src/assets/samples/vpn-onboard-2.json +1 -1
- package/src/assets/samples/vpn-onboard-3.json +1 -1
- package/src/assets/samples/vpn-onboard-4.json +1 -1
- package/src/assets/samples/vpn-onboard-5.json +1 -1
- package/src/assets/samples/vpn-onboard-6.json +1 -1
- package/src/attribute-analyser/style/native/useExtractImageStyle.ts +46 -0
- package/src/attribute-analyser/style/native/useExtractTextStyle.ts +50 -0
- package/src/attribute-analyser/style/native/useExtractViewStyle.ts +32 -0
- package/src/attribute-analyser/style/web/useExtractImageStyle.ts +20 -0
- package/src/{hooks → attribute-analyser/style/web}/useExtractTextStyle.ts +7 -6
- package/src/{hooks → attribute-analyser/style/web}/useExtractViewStyle.ts +7 -6
- package/src/attributes-editor/AttributesEditorFields.tsx +248 -0
- package/src/attributes-editor/AttributesEditorView.tsx +360 -0
- package/src/attributes-editor/LayoutPreviewPicker.tsx +4 -3
- package/src/attributes-editor/attributesEditorModelTypes.ts +86 -0
- package/src/attributes-editor/attributesEditorUtils.ts +102 -0
- package/src/attributes-editor/useAttributesEditorModel.ts +477 -0
- package/src/build-components/BIcon/BIcon.tsx +4 -3
- package/src/build-components/BIcon/BIconProps.generated.ts +42 -38
- package/src/build-components/BIcon/pattern.json +5 -6
- package/src/build-components/BackgroundImage/BackgroundImage.tsx +7 -4
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +38 -34
- package/src/build-components/BackgroundImage/pattern.json +9 -17
- package/src/build-components/Button/Button.tsx +7 -6
- package/src/build-components/Button/ButtonProps.generated.ts +40 -36
- package/src/build-components/Button/pattern.json +17 -15
- package/src/build-components/Carousel/Carousel.tsx +1 -1
- package/src/build-components/Carousel/CarouselProps.generated.ts +38 -34
- package/src/build-components/CarouselButtons/CarouselButtons.tsx +4 -6
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +41 -37
- package/src/build-components/CarouselButtons/pattern.json +2 -1
- package/src/build-components/CarouselDots/CarouselDots.tsx +2 -2
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +44 -40
- package/src/build-components/CarouselItem/CarouselItem.tsx +1 -1
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +37 -33
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +37 -33
- package/src/build-components/Image/Image.tsx +4 -3
- package/src/build-components/Image/ImageProps.generated.ts +39 -33
- package/src/build-components/Image/pattern.json +5 -11
- package/src/build-components/Main/Main.tsx +1 -1
- package/src/build-components/Main/MainProps.generated.ts +37 -33
- package/src/build-components/Main/pattern.json +2 -1
- package/src/build-components/Onboard/OnboardProps.generated.ts +37 -33
- package/src/build-components/OnboardButton/OnboardButton.tsx +8 -6
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +44 -39
- package/src/build-components/OnboardButton/pattern.json +9 -7
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +31 -31
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +43 -39
- package/src/build-components/OnboardButtons/pattern.json +9 -7
- package/src/build-components/OnboardDot/OnboardDot.tsx +7 -5
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +55 -34
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +19 -23
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +42 -38
- package/src/build-components/OnboardFooter/pattern.json +16 -14
- package/src/build-components/OnboardImage/OnboardImage.tsx +8 -7
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +37 -31
- package/src/build-components/OnboardImage/pattern.json +2 -1
- package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +40 -33
- package/src/build-components/OnboardItem/pattern.json +2 -1
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +1 -1
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +39 -34
- package/src/build-components/OnboardProvider/pattern.json +2 -1
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +42 -38
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +42 -38
- package/src/build-components/PaywallBackground/PaywallBackground.tsx +1 -1
- package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +37 -33
- package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +6 -5
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +42 -38
- package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -1
- package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +37 -33
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +1 -1
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +37 -33
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +40 -36
- package/src/build-components/RadioButton/RadioButton.tsx +5 -4
- package/src/build-components/RadioButton/RadioButtonProps.generated.ts +37 -33
- package/src/build-components/RadioButton/pattern.json +9 -7
- package/src/build-components/Text/Text.tsx +6 -8
- package/src/build-components/Text/TextProps.generated.ts +42 -38
- package/src/build-components/Text/pattern.json +15 -11
- package/src/build-components/View/View.tsx +1 -1
- package/src/build-components/View/ViewProps.generated.ts +37 -33
- package/src/build-components/View/pattern.json +71 -66
- package/src/build-components/patterns.generated.ts +3022 -5971
- package/src/components/AttributesEditorPanel.tsx +2 -2
- package/src/components/BuilderProvider.tsx +15 -1
- package/src/index.native.ts +7 -4
- package/src/index.ts +6 -77
- package/src/migrations/migratePipe.ts +7 -3
- package/src/migrations/migrations/1.1.2_extract_component_attributes_from_style.ts +211 -0
- package/src/mockOS/components/MockOSRouter.tsx +3 -1
- package/src/mockOS/components/PermissionModal.tsx +20 -160
- package/src/mockOS/components/SubscriptionModal.tsx +41 -278
- package/src/pages/ProjectPage.tsx +12 -6
- package/src/styles/components/_attributes-editor.scss +122 -0
- package/src/styles/components/_mockos-router.scss +388 -0
- package/src/styles/components/_onboard.scss +23 -0
- package/src/styles/index.scss +1 -0
- package/src/types/PreviewConfig.ts +1 -5
- package/src/utils/analyseNodeByPatterns.ts +39 -4
- package/src/utils/extractImageStyle.ts +34 -5
- package/src/utils/extractTextStyle/extractTextStyle.ts +7 -6
- package/src/utils/extractTextStyle/extractTextStyleNative.ts +106 -0
- package/src/utils/extractTextStyle.ts +2 -0
- package/src/utils/extractViewStyle/extractViewStyle.ts +2 -4
- package/src/utils/extractViewStyle/extractViewStyleNative.ts +111 -0
- package/src/utils/extractViewStyle.ts +2 -0
- package/src/utils/getMeta.ts +15 -0
- package/src/utils/patterns.ts +100 -3
- package/dist/hooks/useExtractImageStyle.d.ts +0 -3
- package/dist/hooks/useExtractTextStyle.d.ts +0 -3
- package/dist/hooks/useExtractViewStyle.d.ts +0 -3
- package/src/hooks/useExtractImageStyle.ts +0 -19
- package/src/migrations/migrations/1.1.0_normalize_style_attributes.ts +0 -80
|
@@ -19,50 +19,54 @@ export type JustifyContentOptionType =
|
|
|
19
19
|
| 'space-evenly';
|
|
20
20
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
21
21
|
|
|
22
|
+
export interface BIconStyleGenerated {
|
|
23
|
+
color?: string;
|
|
24
|
+
fontSize?: string;
|
|
25
|
+
fontFamily?: string;
|
|
26
|
+
fontWeight?: string;
|
|
27
|
+
textAlign?: TextAlignOptionType;
|
|
28
|
+
flexDirection?: FlexDirectionOptionType;
|
|
29
|
+
alignItems?: AlignItemsOptionType;
|
|
30
|
+
justifyContent?: JustifyContentOptionType;
|
|
31
|
+
gap?: string;
|
|
32
|
+
padding?: string;
|
|
33
|
+
paddingHorizontal?: string;
|
|
34
|
+
paddingVertical?: string;
|
|
35
|
+
paddingTop?: string;
|
|
36
|
+
paddingBottom?: string;
|
|
37
|
+
paddingLeft?: string;
|
|
38
|
+
paddingRight?: string;
|
|
39
|
+
margin?: string;
|
|
40
|
+
marginHorizontal?: string;
|
|
41
|
+
marginVertical?: string;
|
|
42
|
+
marginTop?: string;
|
|
43
|
+
marginBottom?: string;
|
|
44
|
+
marginLeft?: string;
|
|
45
|
+
marginRight?: string;
|
|
46
|
+
backgroundColor?: string;
|
|
47
|
+
borderRadius?: string;
|
|
48
|
+
width?: string;
|
|
49
|
+
minWidth?: string;
|
|
50
|
+
maxWidth?: string;
|
|
51
|
+
height?: string;
|
|
52
|
+
minHeight?: string;
|
|
53
|
+
maxHeight?: string;
|
|
54
|
+
flex?: number;
|
|
55
|
+
position?: PositionOptionType;
|
|
56
|
+
top?: string;
|
|
57
|
+
bottom?: string;
|
|
58
|
+
left?: string;
|
|
59
|
+
right?: string;
|
|
60
|
+
zIndex?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
22
63
|
export interface BIconPropsGenerated {
|
|
23
64
|
child: string;
|
|
24
65
|
attributes: {
|
|
25
|
-
style?:
|
|
26
|
-
color?: string;
|
|
27
|
-
fontSize?: string;
|
|
28
|
-
fontFamily?: string;
|
|
29
|
-
fontWeight?: string;
|
|
30
|
-
textAlign?: TextAlignOptionType;
|
|
66
|
+
style?: BIconStyleGenerated;
|
|
31
67
|
adjustsFontSizeToFit?: boolean;
|
|
32
68
|
showEllipsis?: boolean;
|
|
33
69
|
scrollable?: boolean;
|
|
34
|
-
flexDirection?: FlexDirectionOptionType;
|
|
35
|
-
alignItems?: AlignItemsOptionType;
|
|
36
|
-
justifyContent?: JustifyContentOptionType;
|
|
37
|
-
gap?: string;
|
|
38
|
-
padding?: string;
|
|
39
|
-
paddingHorizontal?: string;
|
|
40
|
-
paddingVertical?: string;
|
|
41
|
-
paddingTop?: string;
|
|
42
|
-
paddingBottom?: string;
|
|
43
|
-
paddingLeft?: string;
|
|
44
|
-
paddingRight?: string;
|
|
45
|
-
margin?: string;
|
|
46
|
-
marginVertical?: string;
|
|
47
|
-
marginTop?: string;
|
|
48
|
-
marginBottom?: string;
|
|
49
|
-
marginLeft?: string;
|
|
50
|
-
marginRight?: string;
|
|
51
|
-
backgroundColor?: string;
|
|
52
|
-
borderRadius?: string;
|
|
53
|
-
width?: string;
|
|
54
|
-
minWidth?: string;
|
|
55
|
-
maxWidth?: string;
|
|
56
|
-
height?: string;
|
|
57
|
-
minHeight?: string;
|
|
58
|
-
maxHeight?: string;
|
|
59
|
-
flex?: number;
|
|
60
|
-
position?: PositionOptionType;
|
|
61
|
-
top?: string;
|
|
62
|
-
bottom?: string;
|
|
63
|
-
left?: string;
|
|
64
|
-
right?: string;
|
|
65
|
-
zIndex?: number;
|
|
66
70
|
iconType?: string;
|
|
67
71
|
size?: number;
|
|
68
72
|
strokeWidth?: number;
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"meta": {
|
|
14
|
-
"desiredParent": [
|
|
15
|
-
"all"
|
|
16
|
-
],
|
|
14
|
+
"desiredParent": ["all"],
|
|
17
15
|
"label": "BIcon",
|
|
18
16
|
"description": "Renders an icon from the icon set.",
|
|
19
|
-
"styles": {
|
|
17
|
+
"styles": {},
|
|
18
|
+
"attributes": {
|
|
20
19
|
"iconType": {
|
|
21
20
|
"label": "Icon",
|
|
22
21
|
"description": "Which icon to render.",
|
|
@@ -27,14 +26,14 @@
|
|
|
27
26
|
"size": {
|
|
28
27
|
"label": "Size",
|
|
29
28
|
"description": "Icon size (px).",
|
|
30
|
-
"category": "
|
|
29
|
+
"category": "other",
|
|
31
30
|
"specialCategory": null,
|
|
32
31
|
"sort": 2
|
|
33
32
|
},
|
|
34
33
|
"strokeWidth": {
|
|
35
34
|
"label": "Stroke Width",
|
|
36
35
|
"description": "SVG stroke width override (applied to the icon paths).",
|
|
37
|
-
"category": "
|
|
36
|
+
"category": "other",
|
|
38
37
|
"specialCategory": null,
|
|
39
38
|
"sort": 3
|
|
40
39
|
}
|
|
@@ -2,7 +2,7 @@ import React, { useId, useMemo } from 'react';
|
|
|
2
2
|
import type { BackgroundImageComponentProps } from './BackgroundImageProps.generated';
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
5
|
-
import { useExtractViewStyle } from '../../
|
|
5
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
6
6
|
import { resolveImageSrc } from '../../utils/getImage';
|
|
7
7
|
import { useLogRender } from '../../utils/useLogRender';
|
|
8
8
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
@@ -20,17 +20,20 @@ function BackgroundImage({ node }: BackgroundImageComponentProps) {
|
|
|
20
20
|
const baseStyle = useExtractViewStyle(node);
|
|
21
21
|
const backgroundStyle = useMemo(() => {
|
|
22
22
|
const attrs = node.attributes;
|
|
23
|
+
const styleBag = attrs?.style;
|
|
23
24
|
const style: React.CSSProperties = {
|
|
24
25
|
backgroundRepeat: 'no-repeat',
|
|
25
26
|
backgroundPosition: 'center',
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const src = attrs?.src;
|
|
30
|
+
if (src) {
|
|
31
|
+
const resolved = resolveImageSrc(src);
|
|
30
32
|
if (resolved) style.backgroundImage = `url(${resolved})`;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
const resizeMode = attrs?.resizeMode ?? (styleBag as any)?.resizeMode;
|
|
36
|
+
switch (resizeMode) {
|
|
34
37
|
case 'cover':
|
|
35
38
|
style.backgroundSize = 'cover';
|
|
36
39
|
break;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
+
export type ResizeModeOptionType = 'cover' | 'contain' | 'stretch' | 'center';
|
|
5
6
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
6
7
|
export type AlignItemsOptionType =
|
|
7
8
|
| 'flex-start'
|
|
@@ -17,45 +18,48 @@ export type JustifyContentOptionType =
|
|
|
17
18
|
| 'space-around'
|
|
18
19
|
| 'space-evenly';
|
|
19
20
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
export interface BackgroundImageStyleGenerated {
|
|
23
|
+
flexDirection?: FlexDirectionOptionType;
|
|
24
|
+
alignItems?: AlignItemsOptionType;
|
|
25
|
+
justifyContent?: JustifyContentOptionType;
|
|
26
|
+
gap?: string;
|
|
27
|
+
padding?: string;
|
|
28
|
+
paddingHorizontal?: string;
|
|
29
|
+
paddingVertical?: string;
|
|
30
|
+
paddingTop?: string;
|
|
31
|
+
paddingBottom?: string;
|
|
32
|
+
paddingLeft?: string;
|
|
33
|
+
paddingRight?: string;
|
|
34
|
+
margin?: string;
|
|
35
|
+
marginHorizontal?: string;
|
|
36
|
+
marginVertical?: string;
|
|
37
|
+
marginTop?: string;
|
|
38
|
+
marginBottom?: string;
|
|
39
|
+
marginLeft?: string;
|
|
40
|
+
marginRight?: string;
|
|
41
|
+
backgroundColor?: string;
|
|
42
|
+
borderRadius?: string;
|
|
43
|
+
width?: string;
|
|
44
|
+
minWidth?: string;
|
|
45
|
+
maxWidth?: string;
|
|
46
|
+
height?: string;
|
|
47
|
+
minHeight?: string;
|
|
48
|
+
maxHeight?: string;
|
|
49
|
+
flex?: number;
|
|
50
|
+
position?: PositionOptionType;
|
|
51
|
+
top?: string;
|
|
52
|
+
bottom?: string;
|
|
53
|
+
left?: string;
|
|
54
|
+
right?: string;
|
|
55
|
+
zIndex?: number;
|
|
56
|
+
}
|
|
21
57
|
|
|
22
58
|
export interface BackgroundImagePropsGenerated {
|
|
23
59
|
child: string;
|
|
24
60
|
attributes: {
|
|
25
|
-
style?:
|
|
61
|
+
style?: BackgroundImageStyleGenerated;
|
|
26
62
|
scrollable?: boolean;
|
|
27
|
-
flexDirection?: FlexDirectionOptionType;
|
|
28
|
-
alignItems?: AlignItemsOptionType;
|
|
29
|
-
justifyContent?: JustifyContentOptionType;
|
|
30
|
-
gap?: string;
|
|
31
|
-
padding?: string;
|
|
32
|
-
paddingHorizontal?: string;
|
|
33
|
-
paddingVertical?: string;
|
|
34
|
-
paddingTop?: string;
|
|
35
|
-
paddingBottom?: string;
|
|
36
|
-
paddingLeft?: string;
|
|
37
|
-
paddingRight?: string;
|
|
38
|
-
margin?: string;
|
|
39
|
-
marginVertical?: string;
|
|
40
|
-
marginTop?: string;
|
|
41
|
-
marginBottom?: string;
|
|
42
|
-
marginLeft?: string;
|
|
43
|
-
marginRight?: string;
|
|
44
|
-
backgroundColor?: string;
|
|
45
|
-
borderRadius?: string;
|
|
46
|
-
width?: string;
|
|
47
|
-
minWidth?: string;
|
|
48
|
-
maxWidth?: string;
|
|
49
|
-
height?: string;
|
|
50
|
-
minHeight?: string;
|
|
51
|
-
maxHeight?: string;
|
|
52
|
-
flex?: number;
|
|
53
|
-
position?: PositionOptionType;
|
|
54
|
-
top?: string;
|
|
55
|
-
bottom?: string;
|
|
56
|
-
left?: string;
|
|
57
|
-
right?: string;
|
|
58
|
-
zIndex?: number;
|
|
59
63
|
src?: string;
|
|
60
64
|
resizeMode?: ResizeModeOptionType;
|
|
61
65
|
};
|
|
@@ -6,29 +6,21 @@
|
|
|
6
6
|
"extends": "View",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"src": "string",
|
|
9
|
-
"resizeMode": [
|
|
10
|
-
"cover",
|
|
11
|
-
"contain",
|
|
12
|
-
"stretch",
|
|
13
|
-
"center"
|
|
14
|
-
]
|
|
9
|
+
"resizeMode": ["cover", "contain", "stretch", "center"]
|
|
15
10
|
}
|
|
16
11
|
},
|
|
17
12
|
"meta": {
|
|
18
|
-
"desiredParent": [
|
|
19
|
-
"all",
|
|
20
|
-
"background"
|
|
21
|
-
],
|
|
13
|
+
"desiredParent": ["all", "background"],
|
|
22
14
|
"label": "Background Image",
|
|
23
15
|
"description": "Background image.",
|
|
16
|
+
"src": {
|
|
17
|
+
"label": "Src",
|
|
18
|
+
"description": "Image source URL.",
|
|
19
|
+
"category": "other",
|
|
20
|
+
"specialCategory": null,
|
|
21
|
+
"sort": 1
|
|
22
|
+
},
|
|
24
23
|
"styles": {
|
|
25
|
-
"src": {
|
|
26
|
-
"label": "Src",
|
|
27
|
-
"description": "Image source URL.",
|
|
28
|
-
"category": "other",
|
|
29
|
-
"specialCategory": null,
|
|
30
|
-
"sort": 1
|
|
31
|
-
},
|
|
32
24
|
"resizeMode": {
|
|
33
25
|
"label": "Resize Mode",
|
|
34
26
|
"description": "How the image fits its container.",
|
|
@@ -3,8 +3,8 @@ import type { ButtonComponentProps } from './ButtonProps.generated';
|
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import { useExtractViewStyle } from '../../
|
|
7
|
-
import { useExtractTextStyle } from '../../
|
|
6
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
7
|
+
import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
|
|
8
8
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
9
9
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
10
10
|
import { useLocalize } from '../../hooks/useLocalize';
|
|
@@ -33,10 +33,11 @@ function Button({ node }: ButtonComponentProps) {
|
|
|
33
33
|
combinedTextStyle.textAlign,
|
|
34
34
|
]);
|
|
35
35
|
const buttonDefaults = useMemo(() => {
|
|
36
|
+
const styleBag = node?.attributes?.style;
|
|
36
37
|
const hasExplicitBackground =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
String(
|
|
38
|
+
styleBag?.backgroundColor !== undefined &&
|
|
39
|
+
styleBag?.backgroundColor !== null &&
|
|
40
|
+
String(styleBag?.backgroundColor).trim() !== '';
|
|
40
41
|
return {
|
|
41
42
|
cursor: 'pointer',
|
|
42
43
|
textDecoration: 'none',
|
|
@@ -44,7 +45,7 @@ function Button({ node }: ButtonComponentProps) {
|
|
|
44
45
|
? undefined
|
|
45
46
|
: { backgroundColor: 'transparent' }),
|
|
46
47
|
} as React.CSSProperties;
|
|
47
|
-
}, [node?.attributes?.
|
|
48
|
+
}, [node?.attributes?.style]);
|
|
48
49
|
const isSelected = isNodeSelected({
|
|
49
50
|
previewMode: !!previewMode,
|
|
50
51
|
current: selectedKey ? { key: selectedKey } : undefined,
|
|
@@ -30,46 +30,50 @@ export type FontWeightOptionType =
|
|
|
30
30
|
| '800'
|
|
31
31
|
| '900';
|
|
32
32
|
|
|
33
|
+
export interface ButtonStyleGenerated {
|
|
34
|
+
flexDirection?: FlexDirectionOptionType;
|
|
35
|
+
alignItems?: AlignItemsOptionType;
|
|
36
|
+
justifyContent?: JustifyContentOptionType;
|
|
37
|
+
gap?: string;
|
|
38
|
+
padding?: string;
|
|
39
|
+
paddingHorizontal?: string;
|
|
40
|
+
paddingVertical?: string;
|
|
41
|
+
paddingTop?: string;
|
|
42
|
+
paddingBottom?: string;
|
|
43
|
+
paddingLeft?: string;
|
|
44
|
+
paddingRight?: string;
|
|
45
|
+
margin?: string;
|
|
46
|
+
marginHorizontal?: string;
|
|
47
|
+
marginVertical?: string;
|
|
48
|
+
marginTop?: string;
|
|
49
|
+
marginBottom?: string;
|
|
50
|
+
marginLeft?: string;
|
|
51
|
+
marginRight?: string;
|
|
52
|
+
backgroundColor?: string;
|
|
53
|
+
borderRadius?: string;
|
|
54
|
+
width?: string;
|
|
55
|
+
minWidth?: string;
|
|
56
|
+
maxWidth?: string;
|
|
57
|
+
height?: string;
|
|
58
|
+
minHeight?: string;
|
|
59
|
+
maxHeight?: string;
|
|
60
|
+
flex?: number;
|
|
61
|
+
position?: PositionOptionType;
|
|
62
|
+
top?: string;
|
|
63
|
+
bottom?: string;
|
|
64
|
+
left?: string;
|
|
65
|
+
right?: string;
|
|
66
|
+
zIndex?: number;
|
|
67
|
+
color?: string;
|
|
68
|
+
fontSize?: string;
|
|
69
|
+
fontWeight?: FontWeightOptionType;
|
|
70
|
+
}
|
|
71
|
+
|
|
33
72
|
export interface ButtonPropsGenerated {
|
|
34
73
|
child: string;
|
|
35
74
|
attributes: {
|
|
36
|
-
style?:
|
|
75
|
+
style?: ButtonStyleGenerated;
|
|
37
76
|
scrollable?: boolean;
|
|
38
|
-
flexDirection?: FlexDirectionOptionType;
|
|
39
|
-
alignItems?: AlignItemsOptionType;
|
|
40
|
-
justifyContent?: JustifyContentOptionType;
|
|
41
|
-
gap?: string;
|
|
42
|
-
padding?: string;
|
|
43
|
-
paddingHorizontal?: string;
|
|
44
|
-
paddingVertical?: string;
|
|
45
|
-
paddingTop?: string;
|
|
46
|
-
paddingBottom?: string;
|
|
47
|
-
paddingLeft?: string;
|
|
48
|
-
paddingRight?: string;
|
|
49
|
-
margin?: string;
|
|
50
|
-
marginVertical?: string;
|
|
51
|
-
marginTop?: string;
|
|
52
|
-
marginBottom?: string;
|
|
53
|
-
marginLeft?: string;
|
|
54
|
-
marginRight?: string;
|
|
55
|
-
backgroundColor?: string;
|
|
56
|
-
borderRadius?: string;
|
|
57
|
-
width?: string;
|
|
58
|
-
minWidth?: string;
|
|
59
|
-
maxWidth?: string;
|
|
60
|
-
height?: string;
|
|
61
|
-
minHeight?: string;
|
|
62
|
-
maxHeight?: string;
|
|
63
|
-
flex?: number;
|
|
64
|
-
position?: PositionOptionType;
|
|
65
|
-
top?: string;
|
|
66
|
-
bottom?: string;
|
|
67
|
-
left?: string;
|
|
68
|
-
right?: string;
|
|
69
|
-
zIndex?: number;
|
|
70
|
-
color?: string;
|
|
71
|
-
fontSize?: string;
|
|
72
|
-
fontWeight?: FontWeightOptionType;
|
|
73
77
|
};
|
|
74
78
|
}
|
|
75
79
|
|
|
@@ -5,21 +5,23 @@
|
|
|
5
5
|
"children": "string",
|
|
6
6
|
"extends": "View",
|
|
7
7
|
"attributes": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
"style": {
|
|
9
|
+
"color": "color",
|
|
10
|
+
"fontSize": "size",
|
|
11
|
+
"fontWeight": [
|
|
12
|
+
"normal",
|
|
13
|
+
"bold",
|
|
14
|
+
"100",
|
|
15
|
+
"200",
|
|
16
|
+
"300",
|
|
17
|
+
"400",
|
|
18
|
+
"500",
|
|
19
|
+
"600",
|
|
20
|
+
"700",
|
|
21
|
+
"800",
|
|
22
|
+
"900"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
},
|
|
25
27
|
"meta": {
|
|
@@ -5,7 +5,7 @@ import { isCarouselItem } from '../../utils/isCarousel';
|
|
|
5
5
|
import useNode from '../useNode';
|
|
6
6
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
7
7
|
import { useLogRender } from '../../utils/useLogRender';
|
|
8
|
-
import { useExtractViewStyle } from '../../
|
|
8
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
9
9
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
10
10
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
11
11
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
+
export type AlignOptionType = 'start' | 'center' | 'end';
|
|
5
6
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
6
7
|
export type AlignItemsOptionType =
|
|
7
8
|
| 'flex-start'
|
|
@@ -17,45 +18,48 @@ export type JustifyContentOptionType =
|
|
|
17
18
|
| 'space-around'
|
|
18
19
|
| 'space-evenly';
|
|
19
20
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
export interface CarouselStyleGenerated {
|
|
23
|
+
flexDirection?: FlexDirectionOptionType;
|
|
24
|
+
alignItems?: AlignItemsOptionType;
|
|
25
|
+
justifyContent?: JustifyContentOptionType;
|
|
26
|
+
gap?: string;
|
|
27
|
+
padding?: string;
|
|
28
|
+
paddingHorizontal?: string;
|
|
29
|
+
paddingVertical?: string;
|
|
30
|
+
paddingTop?: string;
|
|
31
|
+
paddingBottom?: string;
|
|
32
|
+
paddingLeft?: string;
|
|
33
|
+
paddingRight?: string;
|
|
34
|
+
margin?: string;
|
|
35
|
+
marginHorizontal?: string;
|
|
36
|
+
marginVertical?: string;
|
|
37
|
+
marginTop?: string;
|
|
38
|
+
marginBottom?: string;
|
|
39
|
+
marginLeft?: string;
|
|
40
|
+
marginRight?: string;
|
|
41
|
+
backgroundColor?: string;
|
|
42
|
+
borderRadius?: string;
|
|
43
|
+
width?: string;
|
|
44
|
+
minWidth?: string;
|
|
45
|
+
maxWidth?: string;
|
|
46
|
+
height?: string;
|
|
47
|
+
minHeight?: string;
|
|
48
|
+
maxHeight?: string;
|
|
49
|
+
flex?: number;
|
|
50
|
+
position?: PositionOptionType;
|
|
51
|
+
top?: string;
|
|
52
|
+
bottom?: string;
|
|
53
|
+
left?: string;
|
|
54
|
+
right?: string;
|
|
55
|
+
zIndex?: number;
|
|
56
|
+
}
|
|
21
57
|
|
|
22
58
|
export interface CarouselPropsGenerated {
|
|
23
59
|
child: string;
|
|
24
60
|
attributes: {
|
|
25
|
-
style?:
|
|
61
|
+
style?: CarouselStyleGenerated;
|
|
26
62
|
scrollable?: boolean;
|
|
27
|
-
flexDirection?: FlexDirectionOptionType;
|
|
28
|
-
alignItems?: AlignItemsOptionType;
|
|
29
|
-
justifyContent?: JustifyContentOptionType;
|
|
30
|
-
gap?: string;
|
|
31
|
-
padding?: string;
|
|
32
|
-
paddingHorizontal?: string;
|
|
33
|
-
paddingVertical?: string;
|
|
34
|
-
paddingTop?: string;
|
|
35
|
-
paddingBottom?: string;
|
|
36
|
-
paddingLeft?: string;
|
|
37
|
-
paddingRight?: string;
|
|
38
|
-
margin?: string;
|
|
39
|
-
marginVertical?: string;
|
|
40
|
-
marginTop?: string;
|
|
41
|
-
marginBottom?: string;
|
|
42
|
-
marginLeft?: string;
|
|
43
|
-
marginRight?: string;
|
|
44
|
-
backgroundColor?: string;
|
|
45
|
-
borderRadius?: string;
|
|
46
|
-
width?: string;
|
|
47
|
-
minWidth?: string;
|
|
48
|
-
maxWidth?: string;
|
|
49
|
-
height?: string;
|
|
50
|
-
minHeight?: string;
|
|
51
|
-
maxHeight?: string;
|
|
52
|
-
flex?: number;
|
|
53
|
-
position?: PositionOptionType;
|
|
54
|
-
top?: string;
|
|
55
|
-
bottom?: string;
|
|
56
|
-
left?: string;
|
|
57
|
-
right?: string;
|
|
58
|
-
zIndex?: number;
|
|
59
63
|
loop?: boolean;
|
|
60
64
|
dragFree?: boolean;
|
|
61
65
|
align?: AlignOptionType;
|
|
@@ -3,7 +3,7 @@ import type { CarouselButtonsComponentProps } from './CarouselButtonsProps.gener
|
|
|
3
3
|
import { carouselContext } from '../CarouselProvider/CarouselProvider';
|
|
4
4
|
import useNode from '../useNode';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import { useExtractViewStyle } from '../../
|
|
6
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
7
7
|
|
|
8
8
|
function CarouselButtons({ node }: CarouselButtonsComponentProps) {
|
|
9
9
|
useLogRender('CarouselButtons');
|
|
@@ -13,10 +13,8 @@ function CarouselButtons({ node }: CarouselButtonsComponentProps) {
|
|
|
13
13
|
const attributeKey = node.key ?? generatedId;
|
|
14
14
|
const style = useExtractViewStyle(node);
|
|
15
15
|
const emblaApi = useContext(carouselContext);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
'next_button',
|
|
19
|
-
];
|
|
16
|
+
const attrs = node.attributes;
|
|
17
|
+
const buttonTypes = attrs?.buttonType || ['previous_button', 'next_button'];
|
|
20
18
|
|
|
21
19
|
return (
|
|
22
20
|
<div
|
|
@@ -43,7 +41,7 @@ function CarouselButtons({ node }: CarouselButtonsComponentProps) {
|
|
|
43
41
|
)}
|
|
44
42
|
{buttonTypes.includes('skip_button') && (
|
|
45
43
|
<button
|
|
46
|
-
onClick={() => emblaApi?.scrollTo(
|
|
44
|
+
onClick={() => emblaApi?.scrollTo(attrs?.skipNumber)}
|
|
47
45
|
className="embla__button embla__button--skip"
|
|
48
46
|
>
|
|
49
47
|
Skip
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
+
export type ButtonTypeOptionType =
|
|
6
|
+
| 'previous_button'
|
|
7
|
+
| 'next_button'
|
|
8
|
+
| 'skip_button';
|
|
5
9
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
6
10
|
export type AlignItemsOptionType =
|
|
7
11
|
| 'flex-start'
|
|
@@ -17,48 +21,48 @@ export type JustifyContentOptionType =
|
|
|
17
21
|
| 'space-around'
|
|
18
22
|
| 'space-evenly';
|
|
19
23
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
export interface CarouselButtonsStyleGenerated {
|
|
26
|
+
flexDirection?: FlexDirectionOptionType;
|
|
27
|
+
alignItems?: AlignItemsOptionType;
|
|
28
|
+
justifyContent?: JustifyContentOptionType;
|
|
29
|
+
gap?: string;
|
|
30
|
+
padding?: string;
|
|
31
|
+
paddingHorizontal?: string;
|
|
32
|
+
paddingVertical?: string;
|
|
33
|
+
paddingTop?: string;
|
|
34
|
+
paddingBottom?: string;
|
|
35
|
+
paddingLeft?: string;
|
|
36
|
+
paddingRight?: string;
|
|
37
|
+
margin?: string;
|
|
38
|
+
marginHorizontal?: string;
|
|
39
|
+
marginVertical?: string;
|
|
40
|
+
marginTop?: string;
|
|
41
|
+
marginBottom?: string;
|
|
42
|
+
marginLeft?: string;
|
|
43
|
+
marginRight?: string;
|
|
44
|
+
backgroundColor?: string;
|
|
45
|
+
borderRadius?: string;
|
|
46
|
+
width?: string;
|
|
47
|
+
minWidth?: string;
|
|
48
|
+
maxWidth?: string;
|
|
49
|
+
height?: string;
|
|
50
|
+
minHeight?: string;
|
|
51
|
+
maxHeight?: string;
|
|
52
|
+
flex?: number;
|
|
53
|
+
position?: PositionOptionType;
|
|
54
|
+
top?: string;
|
|
55
|
+
bottom?: string;
|
|
56
|
+
left?: string;
|
|
57
|
+
right?: string;
|
|
58
|
+
zIndex?: number;
|
|
59
|
+
}
|
|
24
60
|
|
|
25
61
|
export interface CarouselButtonsPropsGenerated {
|
|
26
62
|
child: string;
|
|
27
63
|
attributes: {
|
|
28
|
-
style?:
|
|
64
|
+
style?: CarouselButtonsStyleGenerated;
|
|
29
65
|
scrollable?: boolean;
|
|
30
|
-
flexDirection?: FlexDirectionOptionType;
|
|
31
|
-
alignItems?: AlignItemsOptionType;
|
|
32
|
-
justifyContent?: JustifyContentOptionType;
|
|
33
|
-
gap?: string;
|
|
34
|
-
padding?: string;
|
|
35
|
-
paddingHorizontal?: string;
|
|
36
|
-
paddingVertical?: string;
|
|
37
|
-
paddingTop?: string;
|
|
38
|
-
paddingBottom?: string;
|
|
39
|
-
paddingLeft?: string;
|
|
40
|
-
paddingRight?: string;
|
|
41
|
-
margin?: string;
|
|
42
|
-
marginVertical?: string;
|
|
43
|
-
marginTop?: string;
|
|
44
|
-
marginBottom?: string;
|
|
45
|
-
marginLeft?: string;
|
|
46
|
-
marginRight?: string;
|
|
47
|
-
backgroundColor?: string;
|
|
48
|
-
borderRadius?: string;
|
|
49
|
-
width?: string;
|
|
50
|
-
minWidth?: string;
|
|
51
|
-
maxWidth?: string;
|
|
52
|
-
height?: string;
|
|
53
|
-
minHeight?: string;
|
|
54
|
-
maxHeight?: string;
|
|
55
|
-
flex?: number;
|
|
56
|
-
position?: PositionOptionType;
|
|
57
|
-
top?: string;
|
|
58
|
-
bottom?: string;
|
|
59
|
-
left?: string;
|
|
60
|
-
right?: string;
|
|
61
|
-
zIndex?: number;
|
|
62
66
|
buttonType?: ButtonTypeOptionType;
|
|
63
67
|
skipNumber?: number;
|
|
64
68
|
};
|