@developer_tribe/react-builder 0.1.31 → 1.0.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.
Files changed (120) 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 +8 -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 +11 -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 +17 -18
  33. package/dist/styles.css +1 -1
  34. package/dist/types/PreviewConfig.d.ts +6 -3
  35. package/dist/types/Project.d.ts +12 -2
  36. package/dist/utils/copyNode.d.ts +2 -0
  37. package/dist/utils/logger.d.ts +11 -0
  38. package/dist/utils/useLogRender.d.ts +1 -0
  39. package/package.json +17 -9
  40. package/scripts/prebuild/utils/createBuildComponentsIndex.js +15 -1
  41. package/scripts/prebuild/utils/createGeneratedProps.js +64 -5
  42. package/src/AttributesEditor.tsx +2 -0
  43. package/src/DeviceMockFrame.tsx +22 -31
  44. package/src/RenderPage.tsx +5 -42
  45. package/src/assets/images/android.svg +43 -0
  46. package/src/assets/images/apple.svg +16 -0
  47. package/src/assets/images/background.jpg +0 -0
  48. package/src/assets/samples/carousel-sample.json +2 -3
  49. package/src/assets/samples/getSamples.ts +51 -8
  50. package/src/assets/samples/simple-1.json +1 -2
  51. package/src/assets/samples/simple-2.json +1 -2
  52. package/src/assets/samples/vpn-onboard-1.json +1 -2
  53. package/src/assets/samples/vpn-onboard-2.json +1 -2
  54. package/src/assets/samples/vpn-onboard-3.json +1 -2
  55. package/src/assets/samples/vpn-onboard-4.json +1 -2
  56. package/src/assets/samples/vpn-onboard-5.json +1024 -0
  57. package/src/assets/samples/vpn-onboard-6.json +708 -0
  58. package/src/build-components/Button/Button.tsx +2 -0
  59. package/src/build-components/Button/ButtonProps.generated.ts +14 -12
  60. package/src/build-components/Carousel/Carousel.tsx +2 -0
  61. package/src/build-components/CarouselButtons/CarouselButtons.tsx +2 -0
  62. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +6 -1
  63. package/src/build-components/CarouselDots/CarouselDots.tsx +2 -0
  64. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +9 -7
  65. package/src/build-components/CarouselItem/CarouselItem.tsx +2 -0
  66. package/src/build-components/Image/Image.tsx +2 -0
  67. package/src/build-components/Image/ImageProps.generated.ts +3 -1
  68. package/src/build-components/Onboard/Onboard.tsx +2 -0
  69. package/src/build-components/OnboardButton/OnboardButton.tsx +7 -4
  70. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +14 -9
  71. package/src/build-components/OnboardButton/pattern.json +3 -2
  72. package/src/build-components/OnboardButtons/OnboardButtons.tsx +7 -7
  73. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +10 -3
  74. package/src/build-components/OnboardDot/OnboardDot.tsx +2 -0
  75. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +9 -7
  76. package/src/build-components/OnboardFooter/OnboardFooter.tsx +5 -3
  77. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +33 -22
  78. package/src/build-components/OnboardImage/OnboardImage.tsx +26 -1
  79. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +5 -1
  80. package/src/build-components/OnboardImage/pattern.json +3 -5
  81. package/src/build-components/OnboardItem/OnboardItem.tsx +2 -0
  82. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +5 -2
  83. package/src/build-components/OnboardProvider/OnboardProvider.tsx +2 -0
  84. package/src/build-components/OnboardSubtitle/OnboardSubtitle.tsx +2 -0
  85. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +33 -22
  86. package/src/build-components/OnboardTitle/OnboardTitle.tsx +2 -0
  87. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +33 -22
  88. package/src/build-components/Text/Text.tsx +5 -3
  89. package/src/build-components/Text/TextProps.generated.ts +33 -22
  90. package/src/build-components/View/View.tsx +2 -0
  91. package/src/build-components/View/ViewProps.generated.ts +18 -9
  92. package/src/build-components/index.ts +22 -0
  93. package/src/build-components/patterns.generated.ts +7 -2
  94. package/src/components/AttributesEditorPanel.tsx +112 -0
  95. package/src/components/Breadcrumb.tsx +48 -0
  96. package/src/components/Builder.tsx +272 -0
  97. package/src/components/EditorHeader.tsx +186 -0
  98. package/src/index.ts +8 -4
  99. package/src/pages/ProjectPage.tsx +152 -0
  100. package/src/pages/tabs/BuilderTab.tsx +33 -0
  101. package/src/pages/tabs/DebugTab.tsx +23 -0
  102. package/src/pages/tabs/PreviewTab.tsx +194 -0
  103. package/src/size-matters/index.ts +5 -1
  104. package/src/store.ts +60 -38
  105. package/src/styles/_mixins.scss +21 -0
  106. package/src/styles/_variables.scss +27 -0
  107. package/src/styles/builder.scss +60 -0
  108. package/src/styles/components.scss +88 -0
  109. package/src/styles/editor.scss +174 -0
  110. package/src/styles/global.scss +200 -0
  111. package/src/styles/index.scss +7 -0
  112. package/src/styles/pages.scss +2 -0
  113. package/src/types/PreviewConfig.ts +14 -5
  114. package/src/types/Project.ts +15 -2
  115. package/src/utils/copyNode.ts +7 -0
  116. package/src/utils/extractTextStyle.ts +4 -2
  117. package/src/utils/getDevices.ts +1 -0
  118. package/src/utils/logger.ts +76 -0
  119. package/src/utils/novaToJson.ts +5 -0
  120. package/src/utils/useLogRender.ts +13 -0
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ButtonComponentProps } from './ButtonProps.generated';
3
3
  import useNode from '../useNode';
4
+ import { useLogRender } from '../../utils/useLogRender';
4
5
 
5
6
  function Button({ node }: ButtonComponentProps) {
7
+ useLogRender('Button');
6
8
  node = useNode(node);
7
9
  return String(node?.type ?? 'button');
8
10
  }
@@ -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
 
@@ -3,8 +3,10 @@ import type { CarouselComponentProps } from './CarouselProps.generated';
3
3
  import RenderNode from '../RenderNode.generated';
4
4
  import { isCarouselItem } from '../../utils/isCarousel';
5
5
  import useNode from '../useNode';
6
+ import { useLogRender } from '../../utils/useLogRender';
6
7
 
7
8
  function Carousel({ node }: CarouselComponentProps) {
9
+ useLogRender('Carousel');
8
10
  node = useNode(node);
9
11
  // Ensure children are carouselItems
10
12
  const renderChildren = () => {
@@ -2,8 +2,10 @@ import React, { useContext } from 'react';
2
2
  import type { CarouselButtonsComponentProps } from './CarouselButtonsProps.generated';
3
3
  import { carouselContext } from '../CarouselProvider/CarouselProvider';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function CarouselButtons({ node }: CarouselButtonsComponentProps) {
8
+ useLogRender('CarouselButtons');
7
9
  node = useNode(node);
8
10
  const emblaApi = useContext(carouselContext);
9
11
  const buttonTypes = node.attributes?.buttonType || [
@@ -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,8 +2,10 @@ import React, { useContext, useEffect, useState } from 'react';
2
2
  import type { CarouselDotsComponentProps } from './CarouselDotsProps.generated';
3
3
  import { carouselContext } from '../CarouselProvider/CarouselProvider';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function CarouselDots({ node }: CarouselDotsComponentProps) {
8
+ useLogRender('CarouselDots');
7
9
  node = useNode(node);
8
10
  const dotType = node.attributes?.dotType || 'normal_dot';
9
11
  const emblaApi = useContext(carouselContext);
@@ -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,8 +2,10 @@ import React from 'react';
2
2
  import type { CarouselItemComponentProps } from './CarouselItemProps.generated';
3
3
  import { RenderNode } from '../..';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  export function CarouselItem({ node }: CarouselItemComponentProps) {
8
+ useLogRender('CarouselItem');
7
9
  node = useNode(node);
8
10
  return (
9
11
  <div className="embla__slide" {...node.attributes}>
@@ -2,8 +2,10 @@ import React from 'react';
2
2
  import type { ImageComponentProps } from './ImageProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { extractImageStyle } from '../../utils/extractImageStyle';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function Image({ node }: ImageComponentProps) {
8
+ useLogRender('Image');
7
9
  node = useNode(node);
8
10
  return (
9
11
  <img
@@ -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
  }
@@ -2,8 +2,10 @@ import React from 'react';
2
2
  import type { OnboardComponentProps } from './OnboardProps.generated';
3
3
  import Carousel from '../Carousel/Carousel';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function Onboard({ node }: OnboardComponentProps) {
8
+ useLogRender('Onboard');
7
9
  node = useNode(node);
8
10
  return <Carousel node={{ ...node, type: 'carousel' } as any} />;
9
11
  }
@@ -3,18 +3,21 @@ import type { OnboardButtonComponentProps } from './OnboardButtonProps.generated
3
3
  import { onboardContext } from '../OnboardProvider/OnboardProvider';
4
4
  import useNode from '../useNode';
5
5
  import { useRenderStore } from '../../store';
6
+ import { useLogRender } from '../../utils/useLogRender';
6
7
 
7
8
  function OnboardButton({ node }: OnboardButtonComponentProps) {
9
+ useLogRender('OnboardButton');
8
10
  node = useNode(node);
9
11
  const { emblaApi } = useContext(onboardContext) ?? {};
10
- const { defaultLanguage, localication } = useRenderStore((s) => ({
11
- defaultLanguage: s.defaultLanguage,
12
- localication: s.localication,
12
+ const { appConfig } = useRenderStore((s) => ({
13
+ appConfig: s.appConfig,
13
14
  }));
14
15
 
15
16
  const labelRaw = node.attributes?.labelKey ?? '';
16
17
  const label =
17
- (localication?.[defaultLanguage ?? 'en']?.[labelRaw] as string) ?? labelRaw;
18
+ (appConfig.localication?.[appConfig.defaultLanguage ?? 'en']?.[
19
+ labelRaw
20
+ ] as string) ?? labelRaw;
18
21
 
19
22
  const flex = node.attributes?.flex ?? 1;
20
23
  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
  }
@@ -5,19 +5,19 @@ import { onboardContext } from '../OnboardProvider/OnboardProvider';
5
5
  import RenderNode from '../RenderNode.generated';
6
6
  import useNode from '../useNode';
7
7
  import { useRenderStore } from '../../store';
8
+ import { useLogRender } from '../../utils/useLogRender';
8
9
 
9
10
  function OnboardButtons({ node }: OnboardButtonsComponentProps) {
11
+ useLogRender('OnboardButtons');
10
12
  node = useNode(node);
11
- const { screenStyle, theme } = useRenderStore((s) => ({
12
- screenStyle: s.screenStyle,
13
- theme: s.theme,
13
+ const { appConfig } = useRenderStore((s) => ({
14
+ appConfig: s.appConfig,
14
15
  }));
15
16
  const seperatorColorDefault =
16
- theme === 'light'
17
- ? screenStyle.light.seperatorColor
18
- : screenStyle.dark.seperatorColor;
17
+ appConfig.theme === 'light'
18
+ ? appConfig.screenStyle.light.seperatorColor
19
+ : appConfig.screenStyle.dark.seperatorColor;
19
20
  const ctx = useContext(onboardContext) ?? {};
20
- const emblaApi = ctx.emblaApi;
21
21
  const [selectedIndex, setSelectedIndex] = useState(ctx.selectedIndex ?? 0);
22
22
 
23
23
  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,8 +2,10 @@ import React from 'react';
2
2
  import type { OnboardDotComponentProps } from './OnboardExpandingDotProps.generated';
3
3
  import CarouselDots from '../CarouselDots/CarouselDots';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function OnboardDot({ node }: OnboardDotComponentProps) {
8
+ useLogRender('OnboardDot');
7
9
  node = useNode(node);
8
10
  return <CarouselDots node={{ ...node, type: 'carouselDots' } as any} />;
9
11
  }
@@ -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;
@@ -4,6 +4,7 @@ import useNode from '../useNode';
4
4
  import { useRenderStore } from '../../store';
5
5
  import { parseSize } from '../../size-matters';
6
6
  import { extractTextStyle } from '../../utils/extractTextStyle';
7
+ import { useLogRender } from '../../utils/useLogRender';
7
8
 
8
9
  type Segment =
9
10
  | { type: 'text'; value: string }
@@ -86,11 +87,12 @@ function buildSegments(
86
87
  }
87
88
 
88
89
  function OnboardFooter({ node }: OnboardFooterComponentProps) {
90
+ useLogRender('OnboardFooter');
89
91
  node = useNode(node);
90
- const { defaultLanguage, localication } = useRenderStore((s) => ({
91
- defaultLanguage: s.defaultLanguage,
92
- localication: s.localication,
92
+ const { appConfig } = useRenderStore((s) => ({
93
+ appConfig: s.appConfig,
93
94
  }));
95
+ const { localication, defaultLanguage } = appConfig;
94
96
  const t = (key?: string) =>
95
97
  key ? (localication?.[defaultLanguage ?? 'en']?.[key] ?? key) : '';
96
98
 
@@ -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,35 @@
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';
6
+ import { useLogRender } from '../../utils/useLogRender';
5
7
 
6
8
  function OnboardImage({ node }: OnboardImageComponentProps) {
9
+ useLogRender('OnboardImage');
7
10
  node = useNode(node);
11
+ const [lottie, setLottie] = useState<string | null>(null);
12
+
13
+ useEffect(() => {
14
+ if (node.attributes?.lottie) {
15
+ fetch(node.attributes?.lottie)
16
+ .then((res) => res.json())
17
+ .then((data) => setLottie(data));
18
+ }
19
+ }, [node.attributes?.lottie]);
20
+
21
+ if (node.attributes?.video_url) {
22
+ return <video autoPlay muted loop src={node.attributes?.video_url} />;
23
+ }
24
+
25
+ if (node.attributes?.lottie) {
26
+ if (lottie) {
27
+ return <Lottie animationData={lottie} />;
28
+ } else {
29
+ return <div>Loading...</div>;
30
+ }
31
+ }
32
+
8
33
  return <Image node={{ ...node, type: 'image' } as any} />;
9
34
  }
10
35
 
@@ -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
  }
@@ -3,8 +3,10 @@ import type { OnboardItemComponentProps } from './OnboardItemProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { RenderNode } from '../..';
5
5
  import { parseSize } from '../../size-matters';
6
+ import { useLogRender } from '../../utils/useLogRender';
6
7
 
7
8
  function OnboardItem({ node }: OnboardItemComponentProps) {
9
+ useLogRender('OnboardItem');
8
10
  node = useNode(node);
9
11
  const flexDirection = node.attributes?.flexDirection;
10
12
  const display = node.attributes?.display;
@@ -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
  }
@@ -11,9 +11,11 @@ import useEmblaCarousel from 'embla-carousel-react';
11
11
  import RenderNode from '../RenderNode.generated';
12
12
  import { useRenderStore } from '../../store';
13
13
  import useNode from '../useNode';
14
+ import { useLogRender } from '../../utils/useLogRender';
14
15
 
15
16
  export const onboardContext = createContext<any>(undefined);
16
17
  function OnboardProvider({ node }: OnboardProviderComponentProps) {
18
+ useLogRender('OnboardProvider');
17
19
  node = useNode(node);
18
20
  const device = useRenderStore((s) => s.device);
19
21
  const [emblaRef, emblaApi] = useEmblaCarousel(node.attributes as any);
@@ -2,8 +2,10 @@ import React from 'react';
2
2
  import type { OnboardSubtitleComponentProps } from './OnboardSubtitleProps.generated';
3
3
  import Text from '../Text/Text';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function OnboardSubtitle({ node }: OnboardSubtitleComponentProps) {
8
+ useLogRender('OnboardSubtitle');
7
9
  node = useNode(node);
8
10
  return <Text node={node} />;
9
11
  }
@@ -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,8 +2,10 @@ import React from 'react';
2
2
  import type { OnboardTitleComponentProps } from './OnboardTitleProps.generated';
3
3
  import Text from '../Text/Text';
4
4
  import useNode from '../useNode';
5
+ import { useLogRender } from '../../utils/useLogRender';
5
6
 
6
7
  function OnboardTitle({ node }: OnboardTitleComponentProps) {
8
+ useLogRender('OnboardTitle');
7
9
  node = useNode(node);
8
10
  return <Text node={node} />;
9
11
  }