@developer_tribe/react-builder 0.1.31 → 1.1.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.
Files changed (102) hide show
  1. package/dist/DeviceMockFrame.d.ts +1 -17
  2. package/dist/RenderPage.d.ts +1 -9
  3. package/dist/build-components/Button/ButtonProps.generated.d.ts +2 -1
  4. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +2 -1
  5. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +2 -1
  6. package/dist/build-components/Image/ImageProps.generated.d.ts +2 -1
  7. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +8 -4
  8. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +6 -3
  9. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +2 -1
  10. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +10 -5
  11. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +4 -1
  12. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +4 -2
  13. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +10 -5
  14. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +10 -5
  15. package/dist/build-components/Text/TextProps.generated.d.ts +10 -5
  16. package/dist/build-components/View/ViewProps.generated.d.ts +6 -3
  17. package/dist/build-components/index.d.ts +1 -0
  18. package/dist/build-components/patterns.generated.d.ts +7 -2
  19. package/dist/components/AttributesEditorPanel.d.ts +9 -0
  20. package/dist/components/Breadcrumb.d.ts +13 -0
  21. package/dist/components/Builder.d.ts +9 -0
  22. package/dist/components/EditorHeader.d.ts +15 -0
  23. package/dist/index.cjs.js +7 -4
  24. package/dist/index.cjs.js.map +1 -0
  25. package/dist/index.d.ts +5 -4
  26. package/dist/index.esm.js +7 -4
  27. package/dist/index.esm.js.map +1 -0
  28. package/dist/pages/ProjectPage.d.ts +9 -0
  29. package/dist/pages/tabs/BuilderTab.d.ts +9 -0
  30. package/dist/pages/tabs/DebugTab.d.ts +7 -0
  31. package/dist/pages/tabs/PreviewTab.d.ts +3 -0
  32. package/dist/store.d.ts +8 -18
  33. package/dist/styles.css +1 -1
  34. package/dist/types/PreviewConfig.d.ts +6 -3
  35. package/dist/types/Project.d.ts +2 -2
  36. package/dist/utils/copyNode.d.ts +2 -0
  37. package/package.json +17 -9
  38. package/scripts/prebuild/utils/createBuildComponentsIndex.js +15 -1
  39. package/scripts/prebuild/utils/createGeneratedProps.js +64 -5
  40. package/src/DeviceMockFrame.tsx +20 -31
  41. package/src/RenderPage.tsx +3 -38
  42. package/src/assets/images/android.svg +43 -0
  43. package/src/assets/images/apple.svg +16 -0
  44. package/src/assets/images/background.jpg +0 -0
  45. package/src/assets/samples/carousel-sample.json +2 -3
  46. package/src/assets/samples/getSamples.ts +51 -8
  47. package/src/assets/samples/simple-1.json +1 -2
  48. package/src/assets/samples/simple-2.json +1 -2
  49. package/src/assets/samples/vpn-onboard-1.json +1 -2
  50. package/src/assets/samples/vpn-onboard-2.json +1 -2
  51. package/src/assets/samples/vpn-onboard-3.json +1 -2
  52. package/src/assets/samples/vpn-onboard-4.json +1 -2
  53. package/src/assets/samples/vpn-onboard-5.json +1024 -0
  54. package/src/assets/samples/vpn-onboard-6.json +708 -0
  55. package/src/build-components/Button/ButtonProps.generated.ts +14 -12
  56. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +6 -1
  57. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +9 -7
  58. package/src/build-components/Image/ImageProps.generated.ts +3 -1
  59. package/src/build-components/OnboardButton/OnboardButton.tsx +5 -4
  60. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +14 -9
  61. package/src/build-components/OnboardButton/pattern.json +3 -2
  62. package/src/build-components/OnboardButtons/OnboardButtons.tsx +5 -7
  63. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +10 -3
  64. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +9 -7
  65. package/src/build-components/OnboardFooter/OnboardFooter.tsx +3 -3
  66. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +33 -22
  67. package/src/build-components/OnboardImage/OnboardImage.tsx +24 -1
  68. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +5 -1
  69. package/src/build-components/OnboardImage/pattern.json +3 -5
  70. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +5 -2
  71. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +33 -22
  72. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +33 -22
  73. package/src/build-components/Text/Text.tsx +3 -3
  74. package/src/build-components/Text/TextProps.generated.ts +33 -22
  75. package/src/build-components/View/ViewProps.generated.ts +18 -9
  76. package/src/build-components/index.ts +22 -0
  77. package/src/build-components/patterns.generated.ts +7 -2
  78. package/src/components/AttributesEditorPanel.tsx +110 -0
  79. package/src/components/Breadcrumb.tsx +46 -0
  80. package/src/components/Builder.tsx +270 -0
  81. package/src/components/EditorHeader.tsx +184 -0
  82. package/src/index.ts +5 -4
  83. package/src/pages/ProjectPage.tsx +112 -0
  84. package/src/pages/tabs/BuilderTab.tsx +31 -0
  85. package/src/pages/tabs/DebugTab.tsx +21 -0
  86. package/src/pages/tabs/PreviewTab.tsx +192 -0
  87. package/src/size-matters/index.ts +5 -1
  88. package/src/store.ts +26 -38
  89. package/src/styles/_mixins.scss +21 -0
  90. package/src/styles/_variables.scss +27 -0
  91. package/src/styles/builder.scss +60 -0
  92. package/src/styles/components.scss +88 -0
  93. package/src/styles/editor.scss +174 -0
  94. package/src/styles/global.scss +200 -0
  95. package/src/styles/index.scss +7 -0
  96. package/src/styles/pages.scss +2 -0
  97. package/src/types/PreviewConfig.ts +14 -5
  98. package/src/types/Project.ts +2 -2
  99. package/src/utils/copyNode.ts +7 -0
  100. package/src/utils/extractTextStyle.ts +4 -2
  101. package/src/utils/getDevices.ts +1 -0
  102. package/src/utils/novaToJson.ts +5 -0
@@ -2,23 +2,25 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type FontWeightOptionType =
6
+ | 'normal'
7
+ | 'bold'
8
+ | '100'
9
+ | '200'
10
+ | '300'
11
+ | '400'
12
+ | '500'
13
+ | '600'
14
+ | '700'
15
+ | '800'
16
+ | '900';
17
+
5
18
  export interface ButtonPropsGenerated {
6
19
  child: string;
7
20
  attributes: {
8
21
  color?: string;
9
22
  fontSize?: number;
10
- fontWeight?:
11
- | 'normal'
12
- | 'bold'
13
- | '100'
14
- | '200'
15
- | '300'
16
- | '400'
17
- | '500'
18
- | '600'
19
- | '700'
20
- | '800'
21
- | '900';
23
+ fontWeight?: FontWeightOptionType;
22
24
  };
23
25
  }
24
26
 
@@ -2,10 +2,15 @@
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';
9
+
5
10
  export interface CarouselButtonsPropsGenerated {
6
11
  child: string;
7
12
  attributes: {
8
- buttonType?: 'previous_button' | 'next_button' | 'skip_button';
13
+ buttonType?: ButtonTypeOptionType;
9
14
  skipNumber?: number;
10
15
  };
11
16
  }
@@ -2,16 +2,18 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type DotTypeOptionType =
6
+ | 'expanding_dot'
7
+ | 'normal_dot'
8
+ | 'scaling_dot'
9
+ | 'sliding_border'
10
+ | 'sliding_dot'
11
+ | 'liquid_like';
12
+
5
13
  export interface CarouselDotsPropsGenerated {
6
14
  child: string;
7
15
  attributes: {
8
- dotType?:
9
- | 'expanding_dot'
10
- | 'normal_dot'
11
- | 'scaling_dot'
12
- | 'sliding_border'
13
- | 'sliding_dot'
14
- | 'liquid_like';
16
+ dotType?: DotTypeOptionType;
15
17
  };
16
18
  }
17
19
 
@@ -2,13 +2,15 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type ResizeModeOptionType = 'cover' | 'contain' | 'stretch' | 'center';
6
+
5
7
  export interface ImagePropsGenerated {
6
8
  child: string;
7
9
  attributes: {
8
10
  src?: string;
9
11
  width?: number;
10
12
  height?: number;
11
- resizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
13
+ resizeMode?: ResizeModeOptionType;
12
14
  borderRadius?: number;
13
15
  };
14
16
  }
@@ -7,14 +7,15 @@ import { useRenderStore } from '../../store';
7
7
  function OnboardButton({ node }: OnboardButtonComponentProps) {
8
8
  node = useNode(node);
9
9
  const { emblaApi } = useContext(onboardContext) ?? {};
10
- const { defaultLanguage, localication } = useRenderStore((s) => ({
11
- defaultLanguage: s.defaultLanguage,
12
- localication: s.localication,
10
+ const { appConfig } = useRenderStore((s) => ({
11
+ appConfig: s.appConfig,
13
12
  }));
14
13
 
15
14
  const labelRaw = node.attributes?.labelKey ?? '';
16
15
  const label =
17
- (localication?.[defaultLanguage ?? 'en']?.[labelRaw] as string) ?? labelRaw;
16
+ (appConfig.localication?.[appConfig.defaultLanguage ?? 'en']?.[
17
+ labelRaw
18
+ ] as string) ?? labelRaw;
18
19
 
19
20
  const flex = node.attributes?.flex ?? 1;
20
21
  const textColor = node.attributes?.button_text_color ?? '#FFFFFF';
@@ -2,10 +2,20 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type TypeOptionType = 'Permission' | 'Navigate';
6
+ export type PermissionOptionType = 'att' | 'notification' | 'rating' | 'GDPR';
7
+ export type AnimationOptionType =
8
+ | 'simple-animation'
9
+ | 'line-animation'
10
+ | 'blur'
11
+ | 'blur-animation'
12
+ | 'blur-line-animation';
13
+
5
14
  export interface EventObjectGenerated {
6
- type?: 'Permission' | 'Navigate';
7
- permission?: 'att' | 'notification' | 'rating' | 'null';
8
- navigate_to?: 'string' | 'null';
15
+ type?: TypeOptionType;
16
+ permission?: PermissionOptionType | null;
17
+ navigate_to?: string;
18
+ targetIndex?: number;
9
19
  }
10
20
 
11
21
  export interface OnboardButtonPropsGenerated {
@@ -13,12 +23,7 @@ export interface OnboardButtonPropsGenerated {
13
23
  attributes: {
14
24
  labelKey?: string;
15
25
  button_text_color?: string;
16
- animation?:
17
- | 'simple-animation'
18
- | 'line-animation'
19
- | 'blur'
20
- | 'blur-animation'
21
- | 'blur-line-animation';
26
+ animation?: AnimationOptionType;
22
27
  animation_color?: string;
23
28
  button_background_color?: string;
24
29
  flex?: number;
@@ -23,8 +23,9 @@
23
23
  "types": {
24
24
  "EventObject": {
25
25
  "type": ["Permission", "Navigate"],
26
- "permission": ["att", "notification", "rating", "null"],
27
- "navigate_to": ["string", "null"]
26
+ "permission": ["att", "notification", "rating", "GDPR", "null"],
27
+ "navigate_to": "string",
28
+ "targetIndex": "number"
28
29
  }
29
30
  }
30
31
  }
@@ -8,16 +8,14 @@ import { useRenderStore } from '../../store';
8
8
 
9
9
  function OnboardButtons({ node }: OnboardButtonsComponentProps) {
10
10
  node = useNode(node);
11
- const { screenStyle, theme } = useRenderStore((s) => ({
12
- screenStyle: s.screenStyle,
13
- theme: s.theme,
11
+ const { appConfig } = useRenderStore((s) => ({
12
+ appConfig: s.appConfig,
14
13
  }));
15
14
  const seperatorColorDefault =
16
- theme === 'light'
17
- ? screenStyle.light.seperatorColor
18
- : screenStyle.dark.seperatorColor;
15
+ appConfig.theme === 'light'
16
+ ? appConfig.screenStyle.light.seperatorColor
17
+ : appConfig.screenStyle.dark.seperatorColor;
19
18
  const ctx = useContext(onboardContext) ?? {};
20
- const emblaApi = ctx.emblaApi;
21
19
  const [selectedIndex, setSelectedIndex] = useState(ctx.selectedIndex ?? 0);
22
20
 
23
21
  useEffect(() => {
@@ -2,15 +2,22 @@
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';
9
+ export type ButtonsDirectionOptionType = 'row' | 'column';
10
+ export type ConditionOptionType = 'carousel-index';
11
+
5
12
  export interface OnboardButtonsPropsGenerated {
6
13
  child: string;
7
14
  attributes: {
8
- buttonType?: 'previous_button' | 'next_button' | 'skip_button';
15
+ buttonType?: ButtonTypeOptionType;
9
16
  skipNumber?: number;
10
- buttons_direction?: 'row' | 'column';
17
+ buttons_direction?: ButtonsDirectionOptionType;
11
18
  forIndex?: number;
12
19
  seperatorColor?: string;
13
- condition?: 'carousel-index';
20
+ condition?: ConditionOptionType;
14
21
  conditionVariable?: number;
15
22
  };
16
23
  }
@@ -2,16 +2,18 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type DotTypeOptionType =
6
+ | 'expanding_dot'
7
+ | 'normal_dot'
8
+ | 'scaling_dot'
9
+ | 'sliding_border'
10
+ | 'sliding_dot'
11
+ | 'liquid_like';
12
+
5
13
  export interface OnboardDotPropsGenerated {
6
14
  child: string;
7
15
  attributes: {
8
- dotType?:
9
- | 'expanding_dot'
10
- | 'normal_dot'
11
- | 'scaling_dot'
12
- | 'sliding_border'
13
- | 'sliding_dot'
14
- | 'liquid_like';
16
+ dotType?: DotTypeOptionType;
15
17
  inactive_dot_opacity?: number;
16
18
  expanding_dot_width?: number;
17
19
  dot_style?: string;
@@ -87,10 +87,10 @@ function buildSegments(
87
87
 
88
88
  function OnboardFooter({ node }: OnboardFooterComponentProps) {
89
89
  node = useNode(node);
90
- const { defaultLanguage, localication } = useRenderStore((s) => ({
91
- defaultLanguage: s.defaultLanguage,
92
- localication: s.localication,
90
+ const { appConfig } = useRenderStore((s) => ({
91
+ appConfig: s.appConfig,
93
92
  }));
93
+ const { localication, defaultLanguage } = appConfig;
94
94
  const t = (key?: string) =>
95
95
  key ? (localication?.[defaultLanguage ?? 'en']?.[key] ?? key) : '';
96
96
 
@@ -2,34 +2,45 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type FontWeightOptionType =
6
+ | 'normal'
7
+ | 'bold'
8
+ | '100'
9
+ | '200'
10
+ | '300'
11
+ | '400'
12
+ | '500'
13
+ | '600'
14
+ | '700'
15
+ | '800'
16
+ | '900';
17
+ export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
18
+ export type FlexDirectionOptionType = 'row' | 'column';
19
+ export type AlignItemsOptionType =
20
+ | 'flex-start'
21
+ | 'center'
22
+ | 'flex-end'
23
+ | 'stretch'
24
+ | 'baseline';
25
+ export type JustifyContentOptionType =
26
+ | 'flex-start'
27
+ | 'center'
28
+ | 'flex-end'
29
+ | 'space-between'
30
+ | 'space-around'
31
+ | 'space-evenly';
32
+
5
33
  export interface OnboardFooterPropsGenerated {
6
34
  child: string;
7
35
  attributes: {
8
36
  color?: string;
9
37
  fontSize?: number;
10
- fontWeight?:
11
- | 'normal'
12
- | 'bold'
13
- | '100'
14
- | '200'
15
- | '300'
16
- | '400'
17
- | '500'
18
- | '600'
19
- | '700'
20
- | '800'
21
- | '900';
22
- textAlign?: 'left' | 'center' | 'right' | 'justify';
38
+ fontWeight?: FontWeightOptionType;
39
+ textAlign?: TextAlignOptionType;
23
40
  scrollable?: boolean;
24
- flexDirection?: 'row' | 'column';
25
- alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
26
- justifyContent?:
27
- | 'flex-start'
28
- | 'center'
29
- | 'flex-end'
30
- | 'space-between'
31
- | 'space-around'
32
- | 'space-evenly';
41
+ flexDirection?: FlexDirectionOptionType;
42
+ alignItems?: AlignItemsOptionType;
43
+ justifyContent?: JustifyContentOptionType;
33
44
  gap?: string;
34
45
  padding?: number;
35
46
  paddingHorizontal?: string;
@@ -1,10 +1,33 @@
1
- import React from 'react';
1
+ import React, { useEffect, 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
+ import Lottie from 'lottie-react';
5
6
 
6
7
  function OnboardImage({ node }: OnboardImageComponentProps) {
7
8
  node = useNode(node);
9
+ const [lottie, setLottie] = useState<string | null>(null);
10
+
11
+ useEffect(() => {
12
+ if (node.attributes?.lottie) {
13
+ fetch(node.attributes?.lottie)
14
+ .then((res) => res.json())
15
+ .then((data) => setLottie(data));
16
+ }
17
+ }, [node.attributes?.lottie]);
18
+
19
+ if (node.attributes?.video_url) {
20
+ return <video autoPlay muted loop src={node.attributes?.video_url} />;
21
+ }
22
+
23
+ if (node.attributes?.lottie) {
24
+ if (lottie) {
25
+ return <Lottie animationData={lottie} />;
26
+ } else {
27
+ return <div>Loading...</div>;
28
+ }
29
+ }
30
+
8
31
  return <Image node={{ ...node, type: 'image' } as any} />;
9
32
  }
10
33
 
@@ -2,14 +2,18 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type ResizeModeOptionType = 'cover' | 'contain' | 'stretch' | 'center';
6
+
5
7
  export interface OnboardImagePropsGenerated {
6
8
  child: string;
7
9
  attributes: {
8
10
  src?: string;
9
11
  width?: number;
10
12
  height?: number;
11
- resizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
13
+ resizeMode?: ResizeModeOptionType;
12
14
  borderRadius?: number;
15
+ video_url?: string;
16
+ lottie?: string;
13
17
  };
14
18
  }
15
19
 
@@ -4,12 +4,10 @@
4
4
  "pattern": {
5
5
  "type": "OnboardImage",
6
6
  "children": "node",
7
+ "extends": "Image",
7
8
  "attributes": {
8
- "src": "string",
9
- "width": "number",
10
- "height": "number",
11
- "resizeMode": ["cover", "contain", "stretch", "center"],
12
- "borderRadius": "number"
9
+ "video_url": "string",
10
+ "lottie": "string"
13
11
  }
14
12
  }
15
13
  }
@@ -2,12 +2,15 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type DisplayOptionType = 'flex' | 'block';
6
+ export type FlexDirectionOptionType = 'row' | 'column';
7
+
5
8
  export interface OnboardItemPropsGenerated {
6
9
  child: string;
7
10
  attributes: {
8
- display?: 'flex' | 'block';
11
+ display?: DisplayOptionType;
9
12
  gap?: string;
10
- flexDirection?: 'row' | 'column';
13
+ flexDirection?: FlexDirectionOptionType;
11
14
  paddingHorizontal?: string;
12
15
  };
13
16
  }
@@ -2,34 +2,45 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type FontWeightOptionType =
6
+ | 'normal'
7
+ | 'bold'
8
+ | '100'
9
+ | '200'
10
+ | '300'
11
+ | '400'
12
+ | '500'
13
+ | '600'
14
+ | '700'
15
+ | '800'
16
+ | '900';
17
+ export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
18
+ export type FlexDirectionOptionType = 'row' | 'column';
19
+ export type AlignItemsOptionType =
20
+ | 'flex-start'
21
+ | 'center'
22
+ | 'flex-end'
23
+ | 'stretch'
24
+ | 'baseline';
25
+ export type JustifyContentOptionType =
26
+ | 'flex-start'
27
+ | 'center'
28
+ | 'flex-end'
29
+ | 'space-between'
30
+ | 'space-around'
31
+ | 'space-evenly';
32
+
5
33
  export interface OnboardSubtitlePropsGenerated {
6
34
  child: string;
7
35
  attributes: {
8
36
  color?: string;
9
37
  fontSize?: number;
10
- fontWeight?:
11
- | 'normal'
12
- | 'bold'
13
- | '100'
14
- | '200'
15
- | '300'
16
- | '400'
17
- | '500'
18
- | '600'
19
- | '700'
20
- | '800'
21
- | '900';
22
- textAlign?: 'left' | 'center' | 'right' | 'justify';
38
+ fontWeight?: FontWeightOptionType;
39
+ textAlign?: TextAlignOptionType;
23
40
  scrollable?: boolean;
24
- flexDirection?: 'row' | 'column';
25
- alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
26
- justifyContent?:
27
- | 'flex-start'
28
- | 'center'
29
- | 'flex-end'
30
- | 'space-between'
31
- | 'space-around'
32
- | 'space-evenly';
41
+ flexDirection?: FlexDirectionOptionType;
42
+ alignItems?: AlignItemsOptionType;
43
+ justifyContent?: JustifyContentOptionType;
33
44
  gap?: string;
34
45
  padding?: number;
35
46
  paddingHorizontal?: string;
@@ -2,34 +2,45 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type FontWeightOptionType =
6
+ | 'normal'
7
+ | 'bold'
8
+ | '100'
9
+ | '200'
10
+ | '300'
11
+ | '400'
12
+ | '500'
13
+ | '600'
14
+ | '700'
15
+ | '800'
16
+ | '900';
17
+ export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
18
+ export type FlexDirectionOptionType = 'row' | 'column';
19
+ export type AlignItemsOptionType =
20
+ | 'flex-start'
21
+ | 'center'
22
+ | 'flex-end'
23
+ | 'stretch'
24
+ | 'baseline';
25
+ export type JustifyContentOptionType =
26
+ | 'flex-start'
27
+ | 'center'
28
+ | 'flex-end'
29
+ | 'space-between'
30
+ | 'space-around'
31
+ | 'space-evenly';
32
+
5
33
  export interface OnboardTitlePropsGenerated {
6
34
  child: string;
7
35
  attributes: {
8
36
  color?: string;
9
37
  fontSize?: number;
10
- fontWeight?:
11
- | 'normal'
12
- | 'bold'
13
- | '100'
14
- | '200'
15
- | '300'
16
- | '400'
17
- | '500'
18
- | '600'
19
- | '700'
20
- | '800'
21
- | '900';
22
- textAlign?: 'left' | 'center' | 'right' | 'justify';
38
+ fontWeight?: FontWeightOptionType;
39
+ textAlign?: TextAlignOptionType;
23
40
  scrollable?: boolean;
24
- flexDirection?: 'row' | 'column';
25
- alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
26
- justifyContent?:
27
- | 'flex-start'
28
- | 'center'
29
- | 'flex-end'
30
- | 'space-between'
31
- | 'space-around'
32
- | 'space-evenly';
41
+ flexDirection?: FlexDirectionOptionType;
42
+ alignItems?: AlignItemsOptionType;
43
+ justifyContent?: JustifyContentOptionType;
33
44
  gap?: string;
34
45
  padding?: number;
35
46
  paddingHorizontal?: string;
@@ -6,10 +6,10 @@ import { extractTextStyle } from '../../utils/extractTextStyle';
6
6
 
7
7
  function Text({ node }: TextComponentProps) {
8
8
  node = useNode(node);
9
- const { defaultLanguage, localication } = useRenderStore((s) => ({
10
- defaultLanguage: s.defaultLanguage,
11
- localication: s.localication,
9
+ const { appConfig } = useRenderStore((s) => ({
10
+ appConfig: s.appConfig,
12
11
  }));
12
+ const { defaultLanguage, localication } = appConfig;
13
13
  const keyOrText: string = node.children as string;
14
14
  const style = extractTextStyle(node);
15
15
 
@@ -2,19 +2,41 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
+ export type FlexDirectionOptionType = 'row' | 'column';
6
+ export type AlignItemsOptionType =
7
+ | 'flex-start'
8
+ | 'center'
9
+ | 'flex-end'
10
+ | 'stretch'
11
+ | 'baseline';
12
+ export type JustifyContentOptionType =
13
+ | 'flex-start'
14
+ | 'center'
15
+ | 'flex-end'
16
+ | 'space-between'
17
+ | 'space-around'
18
+ | 'space-evenly';
19
+ export type FontWeightOptionType =
20
+ | 'normal'
21
+ | 'bold'
22
+ | '100'
23
+ | '200'
24
+ | '300'
25
+ | '400'
26
+ | '500'
27
+ | '600'
28
+ | '700'
29
+ | '800'
30
+ | '900';
31
+ export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
32
+
5
33
  export interface TextPropsGenerated {
6
34
  child: string;
7
35
  attributes: {
8
36
  scrollable?: boolean;
9
- flexDirection?: 'row' | 'column';
10
- alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
11
- justifyContent?:
12
- | 'flex-start'
13
- | 'center'
14
- | 'flex-end'
15
- | 'space-between'
16
- | 'space-around'
17
- | 'space-evenly';
37
+ flexDirection?: FlexDirectionOptionType;
38
+ alignItems?: AlignItemsOptionType;
39
+ justifyContent?: JustifyContentOptionType;
18
40
  gap?: string;
19
41
  padding?: number;
20
42
  paddingHorizontal?: string;
@@ -36,19 +58,8 @@ export interface TextPropsGenerated {
36
58
  height?: number;
37
59
  color?: string;
38
60
  fontSize?: number;
39
- fontWeight?:
40
- | 'normal'
41
- | 'bold'
42
- | '100'
43
- | '200'
44
- | '300'
45
- | '400'
46
- | '500'
47
- | '600'
48
- | '700'
49
- | '800'
50
- | '900';
51
- textAlign?: 'left' | 'center' | 'right' | 'justify';
61
+ fontWeight?: FontWeightOptionType;
62
+ textAlign?: TextAlignOptionType;
52
63
  };
53
64
  }
54
65