@developer_tribe/react-builder 1.2.1 → 1.2.2
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/hooks/useExtractTextStyle.d.ts +9 -0
- package/dist/hooks/useExtractViewStyle.d.ts +9 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +1 -1
- package/dist/index.native.cjs.js.map +1 -1
- package/dist/index.native.d.ts +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.esm.js.map +1 -1
- package/dist/utils/extractTextStyle/extractTextStyle.d.ts +9 -0
- package/dist/utils/extractTextStyle.d.ts +2 -10
- package/dist/utils/extractViewStyle/extractViewStyle.d.ts +9 -0
- package/dist/utils/extractViewStyle.d.ts +2 -9
- package/package.json +1 -1
- package/src/build-components/BIcon/BIcon.tsx +5 -6
- package/src/build-components/BackgroundImage/BackgroundImage.tsx +2 -5
- package/src/build-components/Button/Button.tsx +20 -15
- package/src/build-components/Carousel/Carousel.tsx +5 -5
- package/src/build-components/CarouselButtons/CarouselButtons.tsx +3 -6
- package/src/build-components/CarouselDots/CarouselDots.tsx +3 -5
- package/src/build-components/CarouselItem/CarouselItem.tsx +3 -6
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +2 -5
- package/src/build-components/Main/Main.tsx +5 -9
- package/src/build-components/OnboardButton/OnboardButton.tsx +5 -5
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +6 -6
- package/src/build-components/OnboardDot/OnboardDot.tsx +8 -4
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +10 -10
- package/src/build-components/OnboardImage/OnboardImage.tsx +6 -6
- package/src/build-components/OnboardItem/OnboardItem.tsx +5 -6
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +13 -10
- package/src/build-components/PaywallBackground/PaywallBackground.tsx +2 -5
- package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +5 -5
- package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +2 -5
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +5 -5
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +5 -5
- package/src/build-components/RadioButton/RadioButton.tsx +5 -5
- package/src/build-components/Text/Text.tsx +2 -5
- package/src/build-components/View/View.tsx +3 -6
- package/src/hooks/useExtractTextStyle.ts +30 -0
- package/src/hooks/useExtractViewStyle.ts +28 -0
- package/src/index.native.ts +3 -0
- package/src/index.ts +2 -0
- package/src/utils/extractTextStyle/extractTextStyle.ts +160 -0
- package/src/utils/extractTextStyle.ts +2 -160
- package/src/utils/extractViewStyle/extractViewStyle.ts +145 -0
- package/src/utils/extractViewStyle.ts +2 -145
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeData } from '../../types/Node';
|
|
2
|
+
import type { TextPropsGenerated } from '../../build-components/Text/TextProps.generated';
|
|
3
|
+
import type { AppConfig } from '../../types/PreviewConfig';
|
|
4
|
+
import type { ProjectColors } from '../../types/Project';
|
|
5
|
+
export type ExtractTextStyleOptions = {
|
|
6
|
+
appConfig?: AppConfig;
|
|
7
|
+
projectColors?: ProjectColors;
|
|
8
|
+
};
|
|
9
|
+
export declare function extractTextStyle<T extends TextPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractTextStyleOptions): import("react").CSSProperties;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { AppConfig } from '../types/PreviewConfig';
|
|
4
|
-
import type { ProjectColors } from '../types/Project';
|
|
5
|
-
type ExtractTextStyleOptions = {
|
|
6
|
-
appConfig?: AppConfig;
|
|
7
|
-
projectColors?: ProjectColors;
|
|
8
|
-
};
|
|
9
|
-
export declare function extractTextStyle<T extends TextPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractTextStyleOptions): import("react").CSSProperties;
|
|
10
|
-
export {};
|
|
1
|
+
export type { ExtractTextStyleOptions } from './extractTextStyle/extractTextStyle';
|
|
2
|
+
export { extractTextStyle } from './extractTextStyle/extractTextStyle';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ViewPropsGenerated } from '../../build-components/View/ViewProps.generated';
|
|
2
|
+
import type { NodeData } from '../../types/Node';
|
|
3
|
+
import type { AppConfig } from '../../types/PreviewConfig';
|
|
4
|
+
import type { ProjectColors } from '../../types/Project';
|
|
5
|
+
export type ExtractViewStyleOptions = {
|
|
6
|
+
appConfig?: AppConfig;
|
|
7
|
+
projectColors?: ProjectColors;
|
|
8
|
+
};
|
|
9
|
+
export declare function extractViewStyle<T extends ViewPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleOptions): import("react").CSSProperties;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { AppConfig } from '../types/PreviewConfig';
|
|
4
|
-
import type { ProjectColors } from '../types/Project';
|
|
5
|
-
export type ExtractViewStyleOptions = {
|
|
6
|
-
appConfig?: AppConfig;
|
|
7
|
-
projectColors?: ProjectColors;
|
|
8
|
-
};
|
|
9
|
-
export declare function extractViewStyle<T extends ViewPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleOptions): import("react").CSSProperties;
|
|
1
|
+
export type { ExtractViewStyleOptions } from './extractViewStyle/extractViewStyle';
|
|
2
|
+
export { extractViewStyle } from './extractViewStyle/extractViewStyle';
|
package/package.json
CHANGED
|
@@ -2,13 +2,12 @@ import React, { useId, useMemo } from 'react';
|
|
|
2
2
|
import type { BIconComponentProps } from './BIconProps.generated';
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useRenderStore } from '../../store';
|
|
5
|
-
import { extractViewStyle } from '../../utils/extractViewStyle';
|
|
6
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
7
6
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
8
7
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
9
8
|
import { Icon } from '../../components/Icon.generated';
|
|
10
9
|
import { IconsType } from '../../types/Icons';
|
|
11
|
-
import {
|
|
10
|
+
import { useExtractTextStyle } from '../../hooks/useExtractTextStyle';
|
|
12
11
|
|
|
13
12
|
function BIcon({ node }: BIconComponentProps) {
|
|
14
13
|
useLogRender('BIcon');
|
|
@@ -26,10 +25,10 @@ function BIcon({ node }: BIconComponentProps) {
|
|
|
26
25
|
}),
|
|
27
26
|
);
|
|
28
27
|
|
|
29
|
-
const baseStyle =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
);
|
|
28
|
+
const baseStyle = useExtractTextStyle(node as any, {
|
|
29
|
+
appConfig,
|
|
30
|
+
projectColors,
|
|
31
|
+
});
|
|
33
32
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
34
33
|
const style = useMergedStyle(
|
|
35
34
|
baseStyle,
|
|
@@ -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 { useRenderStore } from '../../store';
|
|
5
|
-
import {
|
|
5
|
+
import { useExtractViewStyle } from '../../hooks/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';
|
|
@@ -25,10 +25,7 @@ function BackgroundImage({ node }: BackgroundImageComponentProps) {
|
|
|
25
25
|
}),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
const baseStyle =
|
|
29
|
-
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
30
|
-
[node, appConfig, projectColors],
|
|
31
|
-
);
|
|
28
|
+
const baseStyle = useExtractViewStyle(node, { appConfig, projectColors });
|
|
32
29
|
const backgroundStyle = useMemo(() => {
|
|
33
30
|
const attrs = node.attributes;
|
|
34
31
|
const style: React.CSSProperties = {
|
|
@@ -3,8 +3,8 @@ import type { ButtonComponentProps } from './ButtonProps.generated';
|
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useRenderStore } from '../../store';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
7
|
+
import { useExtractTextStyle } from '../../hooks/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';
|
|
@@ -24,22 +24,27 @@ function Button({ node }: ButtonComponentProps) {
|
|
|
24
24
|
}),
|
|
25
25
|
);
|
|
26
26
|
const localize = useLocalize();
|
|
27
|
-
const baseStyle =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
27
|
+
const baseStyle = useExtractViewStyle(node as any, {
|
|
28
|
+
appConfig,
|
|
29
|
+
projectColors,
|
|
30
|
+
});
|
|
31
|
+
const combinedTextStyle = useExtractTextStyle(node as any, {
|
|
32
|
+
appConfig,
|
|
33
|
+
projectColors,
|
|
34
|
+
});
|
|
31
35
|
const textStyle = useMemo(() => {
|
|
32
|
-
const combined = extractTextStyle(node as any, {
|
|
33
|
-
appConfig,
|
|
34
|
-
projectColors,
|
|
35
|
-
});
|
|
36
36
|
return {
|
|
37
|
-
color:
|
|
38
|
-
fontSize:
|
|
39
|
-
fontWeight:
|
|
40
|
-
textAlign:
|
|
37
|
+
color: combinedTextStyle.color,
|
|
38
|
+
fontSize: combinedTextStyle.fontSize,
|
|
39
|
+
fontWeight: combinedTextStyle.fontWeight,
|
|
40
|
+
textAlign: combinedTextStyle.textAlign,
|
|
41
41
|
} as React.CSSProperties;
|
|
42
|
-
}, [
|
|
42
|
+
}, [
|
|
43
|
+
combinedTextStyle.color,
|
|
44
|
+
combinedTextStyle.fontSize,
|
|
45
|
+
combinedTextStyle.fontWeight,
|
|
46
|
+
combinedTextStyle.textAlign,
|
|
47
|
+
]);
|
|
43
48
|
const buttonDefaults = useMemo(() => {
|
|
44
49
|
const hasExplicitBackground =
|
|
45
50
|
node?.attributes?.backgroundColor !== undefined &&
|
|
@@ -5,7 +5,7 @@ import { isCarouselItem } from '../../utils/isCarousel';
|
|
|
5
5
|
import useNode from '../useNode';
|
|
6
6
|
import { useRenderStore } from '../../store';
|
|
7
7
|
import { useLogRender } from '../../utils/useLogRender';
|
|
8
|
-
import {
|
|
8
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
9
9
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
10
10
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
11
11
|
|
|
@@ -23,10 +23,10 @@ function Carousel({ node }: CarouselComponentProps) {
|
|
|
23
23
|
projectColors: s.projectColors,
|
|
24
24
|
}),
|
|
25
25
|
);
|
|
26
|
-
const baseStyle =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
26
|
+
const baseStyle = useExtractViewStyle(node as any, {
|
|
27
|
+
appConfig,
|
|
28
|
+
projectColors,
|
|
29
|
+
});
|
|
30
30
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
31
31
|
const style = useMergedStyle(
|
|
32
32
|
baseStyle,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useContext, useId
|
|
1
|
+
import React, { useContext, useId } from 'react';
|
|
2
2
|
import type { CarouselButtonsComponentProps } from './CarouselButtonsProps.generated';
|
|
3
3
|
import { carouselContext } from '../CarouselProvider/CarouselProvider';
|
|
4
4
|
import useNode from '../useNode';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import {
|
|
6
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
7
7
|
import { useRenderStore } from '../../store';
|
|
8
8
|
|
|
9
9
|
function CarouselButtons({ node }: CarouselButtonsComponentProps) {
|
|
@@ -17,10 +17,7 @@ function CarouselButtons({ node }: CarouselButtonsComponentProps) {
|
|
|
17
17
|
appConfig: s.appConfig,
|
|
18
18
|
projectColors: s.projectColors,
|
|
19
19
|
}));
|
|
20
|
-
const style =
|
|
21
|
-
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
22
|
-
[node, appConfig, projectColors],
|
|
23
|
-
);
|
|
20
|
+
const style = useExtractViewStyle(node as any, { appConfig, projectColors });
|
|
24
21
|
const emblaApi = useContext(carouselContext);
|
|
25
22
|
const buttonTypes = node.attributes?.buttonType || [
|
|
26
23
|
'previous_button',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useId,
|
|
1
|
+
import React, { useContext, useEffect, useId, useState } from 'react';
|
|
2
2
|
import type { CarouselDotsComponentProps } from './CarouselDotsProps.generated';
|
|
3
3
|
import { carouselContext } from '../CarouselProvider/CarouselProvider';
|
|
4
4
|
import { onboardContext } from '../OnboardProvider/OnboardProvider';
|
|
5
5
|
import useNode from '../useNode';
|
|
6
6
|
import { useLogRender } from '../../utils/useLogRender';
|
|
7
|
-
import {
|
|
7
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
8
8
|
import { useRenderStore } from '../../store';
|
|
9
9
|
|
|
10
10
|
function CarouselDots({ node }: CarouselDotsComponentProps) {
|
|
@@ -23,9 +23,7 @@ function CarouselDots({ node }: CarouselDotsComponentProps) {
|
|
|
23
23
|
projectColors: s.projectColors,
|
|
24
24
|
}));
|
|
25
25
|
|
|
26
|
-
const style =
|
|
27
|
-
return extractViewStyle(node, { appConfig, projectColors });
|
|
28
|
-
}, [node, appConfig, projectColors]);
|
|
26
|
+
const style = useExtractViewStyle(node as any, { appConfig, projectColors });
|
|
29
27
|
|
|
30
28
|
// Use the appropriate context based on sourceType
|
|
31
29
|
const isOnboard = (node as any)?.sourceType === 'OnboardDot';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useId
|
|
1
|
+
import React, { useId } from 'react';
|
|
2
2
|
import type { CarouselItemComponentProps } from './CarouselItemProps.generated';
|
|
3
3
|
import RenderNode from '../RenderNode.generated';
|
|
4
4
|
import useNode from '../useNode';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import {
|
|
6
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
7
7
|
import { useRenderStore } from '../../store';
|
|
8
8
|
|
|
9
9
|
export function CarouselItem({ node }: CarouselItemComponentProps) {
|
|
@@ -17,10 +17,7 @@ export function CarouselItem({ node }: CarouselItemComponentProps) {
|
|
|
17
17
|
appConfig: s.appConfig,
|
|
18
18
|
projectColors: s.projectColors,
|
|
19
19
|
}));
|
|
20
|
-
const style =
|
|
21
|
-
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
22
|
-
[node, appConfig, projectColors],
|
|
23
|
-
);
|
|
20
|
+
const style = useExtractViewStyle(node as any, { appConfig, projectColors });
|
|
24
21
|
return (
|
|
25
22
|
<div
|
|
26
23
|
className="embla__slide"
|
|
@@ -3,7 +3,7 @@ import type { CarouselProviderComponentProps } from './CarouselProviderProps.gen
|
|
|
3
3
|
import RenderNode from '../RenderNode.generated';
|
|
4
4
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
5
5
|
import useNode from '../useNode';
|
|
6
|
-
import {
|
|
6
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
7
7
|
import { useRenderStore } from '../../store';
|
|
8
8
|
import { isCarousel } from '../../utils/isCarousel';
|
|
9
9
|
import type { Node, NodeData } from '../../types/Node';
|
|
@@ -20,10 +20,7 @@ function CarouselProvider({ node }: CarouselProviderComponentProps) {
|
|
|
20
20
|
appConfig: s.appConfig,
|
|
21
21
|
projectColors: s.projectColors,
|
|
22
22
|
}));
|
|
23
|
-
const viewStyle =
|
|
24
|
-
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
25
|
-
[node, appConfig, projectColors],
|
|
26
|
-
);
|
|
23
|
+
const viewStyle = useExtractViewStyle(node, { appConfig, projectColors });
|
|
27
24
|
|
|
28
25
|
const { carouselChild, otherChildren } = useMemo(() => {
|
|
29
26
|
const children = node.children as Node;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useId
|
|
1
|
+
import React, { useId } from 'react';
|
|
2
2
|
import type { MainComponentProps } from './MainProps.generated';
|
|
3
3
|
import RenderNode from '../RenderNode.generated';
|
|
4
4
|
import type { Node } from '../../types/Node';
|
|
5
5
|
import useNode from '../useNode';
|
|
6
6
|
import { useRenderStore } from '../../store';
|
|
7
|
-
import {
|
|
7
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
8
8
|
import { useLogRender } from '../../utils/useLogRender';
|
|
9
9
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
10
10
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -29,13 +29,9 @@ function Main({ node }: MainComponentProps) {
|
|
|
29
29
|
}),
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
const baseStyle =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
appConfig,
|
|
36
|
-
projectColors,
|
|
37
|
-
}),
|
|
38
|
-
[node, appConfig, projectColors],
|
|
32
|
+
const baseStyle = useExtractViewStyle(
|
|
33
|
+
node as NodeData<ViewPropsGenerated['attributes']>,
|
|
34
|
+
{ appConfig, projectColors },
|
|
39
35
|
);
|
|
40
36
|
|
|
41
37
|
const useSafeAreaView = (node.attributes as any)?.useSafeAreaView ?? true;
|
|
@@ -7,7 +7,7 @@ import { onboardContext } from '../OnboardProvider/OnboardProvider';
|
|
|
7
7
|
import useNode from '../useNode';
|
|
8
8
|
import { useRenderStore } from '../../store';
|
|
9
9
|
import { useLogRender } from '../../utils/useLogRender';
|
|
10
|
-
import {
|
|
10
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
11
11
|
import { useMockOSContext, useMockPermission } from '../../mockOS';
|
|
12
12
|
|
|
13
13
|
function OnboardButton({ node }: OnboardButtonComponentProps) {
|
|
@@ -36,10 +36,10 @@ function OnboardButton({ node }: OnboardButtonComponentProps) {
|
|
|
36
36
|
const flex = node.attributes?.flex ?? 1;
|
|
37
37
|
const textColor = node.attributes?.button_text_color ?? '#FFFFFF';
|
|
38
38
|
const backgroundColor = node.attributes?.button_background_color ?? '#0066FF';
|
|
39
|
-
const viewStyle =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
39
|
+
const viewStyle = useExtractViewStyle(node as any, {
|
|
40
|
+
appConfig,
|
|
41
|
+
projectColors,
|
|
42
|
+
});
|
|
43
43
|
|
|
44
44
|
const handleClick = () => {
|
|
45
45
|
//TODO: any ??
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useId,
|
|
1
|
+
import React, { useContext, useEffect, useId, useState } from 'react';
|
|
2
2
|
import type { Node } from '../../types/Node';
|
|
3
3
|
import type { OnboardButtonsComponentProps } from './OnboardButtonsProps.generated';
|
|
4
4
|
import { onboardContext } from '../OnboardProvider/OnboardProvider';
|
|
@@ -6,7 +6,7 @@ import RenderNode from '../RenderNode.generated';
|
|
|
6
6
|
import useNode from '../useNode';
|
|
7
7
|
import { useRenderStore } from '../../store';
|
|
8
8
|
import { useLogRender } from '../../utils/useLogRender';
|
|
9
|
-
import {
|
|
9
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
10
10
|
|
|
11
11
|
function OnboardButtons({ node }: OnboardButtonsComponentProps) {
|
|
12
12
|
useLogRender('OnboardButtons');
|
|
@@ -44,10 +44,10 @@ function OnboardButtons({ node }: OnboardButtonsComponentProps) {
|
|
|
44
44
|
return <RenderNode node={node.children as Node} />;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const viewStyle =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
47
|
+
const viewStyle = useExtractViewStyle(node as any, {
|
|
48
|
+
appConfig,
|
|
49
|
+
projectColors,
|
|
50
|
+
});
|
|
51
51
|
|
|
52
52
|
// NOTE: Hooks must not be called conditionally.
|
|
53
53
|
// Generate the id before any early returns so the hook order stays stable.
|
|
@@ -3,7 +3,7 @@ import type { OnboardDotComponentProps } from './OnboardDotProps.generated';
|
|
|
3
3
|
import { onboardContext } from '../OnboardProvider/OnboardProvider';
|
|
4
4
|
import useNode from '../useNode';
|
|
5
5
|
import { useLogRender } from '../../utils/useLogRender';
|
|
6
|
-
import {
|
|
6
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
7
7
|
import { useRenderStore } from '../../store';
|
|
8
8
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
9
9
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -42,11 +42,15 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
|
42
42
|
[activeDotColor, appConfig, projectColors],
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
+
const extractedStyle = useExtractViewStyle(node as any, {
|
|
46
|
+
appConfig,
|
|
47
|
+
projectColors,
|
|
48
|
+
});
|
|
45
49
|
const baseStyle = useMemo(() => {
|
|
46
|
-
|
|
47
|
-
delete innerStyle.flexDirection;
|
|
50
|
+
const innerStyle = { ...extractedStyle };
|
|
51
|
+
delete (innerStyle as any).flexDirection;
|
|
48
52
|
return innerStyle;
|
|
49
|
-
}, [
|
|
53
|
+
}, [extractedStyle]);
|
|
50
54
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
51
55
|
const style = useMergedStyle(
|
|
52
56
|
baseStyle,
|
|
@@ -3,8 +3,8 @@ import type { OnboardFooterComponentProps } from './OnboardFooterProps.generated
|
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useRenderStore } from '../../store';
|
|
5
5
|
import { parseSize } from '../../size-matters';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useExtractTextStyle } from '../../hooks/useExtractTextStyle';
|
|
7
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
8
8
|
import { useLogRender } from '../../utils/useLogRender';
|
|
9
9
|
import { isNodeSelected } from '../../utils/selection';
|
|
10
10
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -107,14 +107,14 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
|
|
|
107
107
|
key ? (localication?.[defaultLanguage ?? 'en']?.[key] ?? key) : '';
|
|
108
108
|
|
|
109
109
|
const text = t(node?.attributes?.textLocalizationKey);
|
|
110
|
-
const textStyle =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
);
|
|
114
|
-
const viewStyle =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
);
|
|
110
|
+
const textStyle = useExtractTextStyle(node as any, {
|
|
111
|
+
appConfig,
|
|
112
|
+
projectColors,
|
|
113
|
+
});
|
|
114
|
+
const viewStyle = useExtractViewStyle(node as any, {
|
|
115
|
+
appConfig,
|
|
116
|
+
projectColors,
|
|
117
|
+
});
|
|
118
118
|
|
|
119
119
|
const linkStyle = (color?: string): React.CSSProperties => ({
|
|
120
120
|
color,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useId,
|
|
1
|
+
import React, { useEffect, useId, useState } from 'react';
|
|
2
2
|
import type { OnboardImageComponentProps } from './OnboardImageProps.generated';
|
|
3
3
|
import Image from '../Image/Image';
|
|
4
4
|
import useNode from '../useNode';
|
|
5
5
|
import Lottie from 'lottie-react';
|
|
6
6
|
import { useLogRender } from '../../utils/useLogRender';
|
|
7
|
-
import {
|
|
7
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
8
8
|
import { useRenderStore } from '../../store';
|
|
9
9
|
|
|
10
10
|
function OnboardImage({ node }: OnboardImageComponentProps) {
|
|
@@ -19,10 +19,10 @@ function OnboardImage({ node }: OnboardImageComponentProps) {
|
|
|
19
19
|
appConfig: s.appConfig,
|
|
20
20
|
projectColors: s.projectColors,
|
|
21
21
|
}));
|
|
22
|
-
const viewStyle =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
);
|
|
22
|
+
const viewStyle = useExtractViewStyle(node as any, {
|
|
23
|
+
appConfig,
|
|
24
|
+
projectColors,
|
|
25
|
+
});
|
|
26
26
|
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (node.attributes?.lottie) {
|
|
@@ -3,9 +3,8 @@ import type { OnboardItemComponentProps } from './OnboardItemProps.generated';
|
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import RenderNode from '../RenderNode.generated';
|
|
5
5
|
import { useRenderStore } from '../../store';
|
|
6
|
-
import { parseSize } from '../../size-matters';
|
|
7
6
|
import { useLogRender } from '../../utils/useLogRender';
|
|
8
|
-
import {
|
|
7
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
9
8
|
|
|
10
9
|
function OnboardItem({ node }: OnboardItemComponentProps) {
|
|
11
10
|
useLogRender('OnboardItem');
|
|
@@ -17,10 +16,10 @@ function OnboardItem({ node }: OnboardItemComponentProps) {
|
|
|
17
16
|
appConfig: s.appConfig,
|
|
18
17
|
projectColors: s.projectColors,
|
|
19
18
|
}));
|
|
20
|
-
const viewStyle =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
19
|
+
const viewStyle = useExtractViewStyle(node as any, {
|
|
20
|
+
appConfig,
|
|
21
|
+
projectColors,
|
|
22
|
+
});
|
|
24
23
|
return (
|
|
25
24
|
<div
|
|
26
25
|
attribute-name={attributeName}
|
|
@@ -13,7 +13,7 @@ import RenderNode from '../RenderNode.generated';
|
|
|
13
13
|
import { useRenderStore } from '../../store';
|
|
14
14
|
import useNode from '../useNode';
|
|
15
15
|
import { useLogRender } from '../../utils/useLogRender';
|
|
16
|
-
import {
|
|
16
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
17
17
|
import { ViewPropsGenerated } from '../View/ViewProps.generated';
|
|
18
18
|
|
|
19
19
|
export const onboardContext = createContext<any>(undefined);
|
|
@@ -75,15 +75,18 @@ function OnboardProvider({ node }: OnboardProviderComponentProps) {
|
|
|
75
75
|
}, [theme]);*/
|
|
76
76
|
|
|
77
77
|
//TODO: pattern içinde direk gömmek yerine orada da inhertince eklenebilir
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
const baseStyle = useExtractViewStyle(
|
|
79
|
+
node as NodeData<ViewPropsGenerated['attributes']>,
|
|
80
|
+
{ appConfig, projectColors },
|
|
81
|
+
);
|
|
82
|
+
const viewStyle = useMemo(
|
|
83
|
+
() => ({
|
|
84
|
+
...baseStyle,
|
|
85
|
+
// NOTE: Embla for web expects block layout here.
|
|
86
|
+
display: 'block',
|
|
87
|
+
}),
|
|
88
|
+
[baseStyle],
|
|
89
|
+
);
|
|
87
90
|
|
|
88
91
|
return (
|
|
89
92
|
<onboardContext.Provider value={{ emblaApi, selectedIndex }}>
|
|
@@ -2,7 +2,7 @@ import React, { useId, useMemo } from 'react';
|
|
|
2
2
|
import type { PaywallBackgroundComponentProps } from './PaywallBackgroundProps.generated';
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useRenderStore } from '../../store';
|
|
5
|
-
import {
|
|
5
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
6
6
|
import { useLogRender } from '../../utils/useLogRender';
|
|
7
7
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
8
8
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -24,10 +24,7 @@ function PaywallBackground({ node }: PaywallBackgroundComponentProps) {
|
|
|
24
24
|
}),
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
const baseStyle =
|
|
28
|
-
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
29
|
-
[node, appConfig, projectColors],
|
|
30
|
-
);
|
|
27
|
+
const baseStyle = useExtractViewStyle(node, { appConfig, projectColors });
|
|
31
28
|
|
|
32
29
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
33
30
|
const style = useMergedStyle(
|
|
@@ -2,7 +2,7 @@ import React, { useId, useMemo } from 'react';
|
|
|
2
2
|
import type { PaywallCloseButtonComponentProps } from './PaywallCloseButtonProps.generated';
|
|
3
3
|
import useNode from '../useNode';
|
|
4
4
|
import { useRenderStore } from '../../store';
|
|
5
|
-
import {
|
|
5
|
+
import { useExtractTextStyle } from '../../hooks/useExtractTextStyle';
|
|
6
6
|
import { useLogRender } from '../../utils/useLogRender';
|
|
7
7
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
8
8
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -29,10 +29,10 @@ function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
|
|
|
29
29
|
}),
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
const baseStyle =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
32
|
+
const baseStyle = useExtractTextStyle(node as any, {
|
|
33
|
+
appConfig,
|
|
34
|
+
projectColors,
|
|
35
|
+
});
|
|
36
36
|
|
|
37
37
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
38
38
|
const style = useMergedStyle(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useId, useMemo } from 'react';
|
|
2
2
|
import type { Product } from '../../paywall/types/paywall-types';
|
|
3
|
-
import {
|
|
3
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
4
4
|
import type { NodeData } from '../../types/Node';
|
|
5
5
|
import { useRenderStore } from '../../store';
|
|
6
6
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
@@ -32,10 +32,7 @@ export function PaywallOptionButton({
|
|
|
32
32
|
}),
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
const baseStyle =
|
|
36
|
-
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
37
|
-
[node, appConfig, projectColors],
|
|
38
|
-
);
|
|
35
|
+
const baseStyle = useExtractViewStyle(node, { appConfig, projectColors });
|
|
39
36
|
|
|
40
37
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
41
38
|
|
|
@@ -4,7 +4,7 @@ import RenderNode from '../RenderNode.generated';
|
|
|
4
4
|
import type { Node } from '../../types/Node';
|
|
5
5
|
import useNode from '../useNode';
|
|
6
6
|
import { useRenderStore } from '../../store';
|
|
7
|
-
import {
|
|
7
|
+
import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
|
|
8
8
|
import { useLogRender } from '../../utils/useLogRender';
|
|
9
9
|
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
10
10
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
@@ -55,10 +55,10 @@ function PaywallProvider({ node }: PaywallProviderComponentProps) {
|
|
|
55
55
|
return params;
|
|
56
56
|
}, [benefits]);
|
|
57
57
|
|
|
58
|
-
const baseStyle =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
58
|
+
const baseStyle = useExtractViewStyle(node as any, {
|
|
59
|
+
appConfig,
|
|
60
|
+
projectColors,
|
|
61
|
+
});
|
|
62
62
|
|
|
63
63
|
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
64
64
|
const style = useMergedStyle(
|