@developer_tribe/react-builder 0.1.32 → 1.0.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.
Files changed (218) hide show
  1. package/dist/DeviceMockFrame.d.ts +2 -17
  2. package/dist/RenderPage.d.ts +4 -11
  3. package/dist/attributes-editor/Field.d.ts +16 -0
  4. package/dist/attributes-editor/FieldInfoTooltip.d.ts +7 -0
  5. package/dist/attributes-editor/LayoutPreviewPicker.d.ts +12 -0
  6. package/dist/attributes-editor/SpecialCategorySection.d.ts +19 -0
  7. package/dist/attributes-editor/types.d.ts +14 -0
  8. package/dist/background.jpg +0 -0
  9. package/dist/build-components/Button/Button.d.ts +1 -1
  10. package/dist/build-components/Button/ButtonProps.generated.d.ts +26 -1
  11. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +27 -1
  12. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +25 -0
  13. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +25 -0
  14. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +27 -1
  15. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +27 -1
  16. package/dist/build-components/Image/ImageProps.generated.d.ts +25 -3
  17. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +27 -1
  18. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +25 -0
  19. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +25 -0
  20. package/dist/build-components/OnboardDot/OnboardDot.d.ts +1 -1
  21. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +22 -0
  22. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +4 -5
  23. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +25 -3
  24. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +24 -3
  25. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +25 -4
  26. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +4 -5
  27. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +4 -5
  28. package/dist/build-components/Text/TextProps.generated.d.ts +4 -5
  29. package/dist/build-components/View/ViewProps.generated.d.ts +3 -4
  30. package/dist/build-components/index.d.ts +1 -0
  31. package/dist/build-components/patterns.generated.d.ts +4855 -132
  32. package/dist/components/AttributesEditorPanel.d.ts +9 -0
  33. package/dist/components/Breadcrumb.d.ts +15 -0
  34. package/dist/components/Builder.d.ts +9 -0
  35. package/dist/components/Checkbox.d.ts +17 -0
  36. package/dist/components/DeviceButton.d.ts +8 -0
  37. package/dist/components/DeviceNavigationBar.d.ts +10 -0
  38. package/dist/components/DeviceStatusBar.d.ts +9 -0
  39. package/dist/components/EditorHeader.d.ts +10 -0
  40. package/dist/index.cjs.js +6 -5
  41. package/dist/index.cjs.js.map +1 -0
  42. package/dist/index.d.ts +8 -4
  43. package/dist/index.esm.js +6 -5
  44. package/dist/index.esm.js.map +1 -0
  45. package/dist/mockOS/components/MockLaunchScreenComponent.d.ts +6 -0
  46. package/dist/mockOS/components/MockOSRouter.d.ts +8 -0
  47. package/dist/mockOS/components/PermissionModal.d.ts +9 -0
  48. package/dist/mockOS/context/MockOSContext.d.ts +36 -0
  49. package/dist/mockOS/hooks/useMockNavigation.d.ts +3 -0
  50. package/dist/mockOS/hooks/useMockPermission.d.ts +3 -0
  51. package/dist/mockOS/index.d.ts +9 -0
  52. package/dist/mockOS/managers/mockPermissionManager.d.ts +10 -0
  53. package/dist/mockOS/managers/navigationManager.d.ts +17 -0
  54. package/dist/modals/AddComponentModal.d.ts +8 -0
  55. package/dist/modals/ColorModal.d.ts +9 -0
  56. package/dist/modals/DeviceSelectorModal.d.ts +9 -0
  57. package/dist/modals/LocalicationModal.d.ts +8 -0
  58. package/dist/modals/Modal.d.ts +12 -0
  59. package/dist/modals/index.d.ts +5 -0
  60. package/dist/pages/ProjectPage.d.ts +11 -0
  61. package/dist/pages/tabs/BuilderTab.d.ts +9 -0
  62. package/dist/pages/tabs/DebugTab.d.ts +7 -0
  63. package/dist/pages/tabs/PreviewTab.d.ts +3 -0
  64. package/dist/store.d.ts +15 -18
  65. package/dist/styles.css +1 -1
  66. package/dist/types/PreviewConfig.d.ts +6 -3
  67. package/dist/types/Project.d.ts +12 -2
  68. package/dist/utils/copyNode.d.ts +2 -0
  69. package/dist/utils/logger.d.ts +11 -0
  70. package/dist/utils/patterns.d.ts +24 -0
  71. package/dist/utils/useLogRender.d.ts +1 -0
  72. package/package.json +17 -9
  73. package/scripts/prebuild/utils/createBuildComponentsIndex.js +15 -1
  74. package/scripts/prebuild/utils/createGeneratedProps.js +11 -3
  75. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +45 -6
  76. package/scripts/prebuild/utils/validatePatternJson.js +13 -5
  77. package/src/AttributesEditor.tsx +434 -311
  78. package/src/DeviceMockFrame.tsx +42 -67
  79. package/src/RenderPage.tsx +8 -44
  80. package/src/assets/images/android.svg +43 -0
  81. package/src/assets/images/apple.svg +16 -0
  82. package/src/assets/images/background.jpg +0 -0
  83. package/src/assets/samples/carousel-sample.json +2 -3
  84. package/src/assets/samples/getSamples.ts +49 -12
  85. package/src/assets/samples/simple-1.json +1 -2
  86. package/src/assets/samples/simple-2.json +1 -2
  87. package/src/assets/samples/vpn-onboard-1.json +1 -2
  88. package/src/assets/samples/vpn-onboard-2.json +1 -2
  89. package/src/assets/samples/vpn-onboard-3.json +1 -2
  90. package/src/assets/samples/vpn-onboard-4.json +1 -2
  91. package/src/assets/samples/vpn-onboard-5.json +1 -2
  92. package/src/assets/samples/vpn-onboard-6.json +1 -2
  93. package/src/attributes-editor/Field.tsx +662 -0
  94. package/src/attributes-editor/FieldInfoTooltip.tsx +49 -0
  95. package/src/attributes-editor/LayoutPreviewPicker.tsx +199 -0
  96. package/src/attributes-editor/SpecialCategorySection.tsx +284 -0
  97. package/src/attributes-editor/types.ts +30 -0
  98. package/src/build-components/Button/Button.tsx +12 -2
  99. package/src/build-components/Button/ButtonProps.generated.ts +37 -1
  100. package/src/build-components/Button/pattern.json +31 -2
  101. package/src/build-components/Carousel/Carousel.tsx +17 -2
  102. package/src/build-components/Carousel/CarouselProps.generated.ts +39 -1
  103. package/src/build-components/Carousel/pattern.json +10 -0
  104. package/src/build-components/CarouselButtons/CarouselButtons.tsx +8 -2
  105. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +36 -0
  106. package/src/build-components/CarouselButtons/pattern.json +22 -0
  107. package/src/build-components/CarouselDots/CarouselDots.tsx +42 -8
  108. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +36 -0
  109. package/src/build-components/CarouselDots/pattern.json +15 -0
  110. package/src/build-components/CarouselItem/CarouselItem.tsx +7 -2
  111. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +39 -1
  112. package/src/build-components/CarouselItem/pattern.json +7 -0
  113. package/src/build-components/CarouselProvider/CarouselProvider.tsx +10 -2
  114. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +39 -1
  115. package/src/build-components/CarouselProvider/pattern.json +7 -0
  116. package/src/build-components/Image/Image.tsx +10 -2
  117. package/src/build-components/Image/ImageProps.generated.ts +36 -3
  118. package/src/build-components/Image/pattern.json +46 -3
  119. package/src/build-components/Onboard/Onboard.tsx +8 -1
  120. package/src/build-components/Onboard/OnboardProps.generated.ts +39 -1
  121. package/src/build-components/Onboard/pattern.json +11 -0
  122. package/src/build-components/OnboardButton/OnboardButton.tsx +53 -9
  123. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +36 -0
  124. package/src/build-components/OnboardButton/pattern.json +71 -5
  125. package/src/build-components/OnboardButtons/OnboardButtons.tsx +27 -17
  126. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +36 -0
  127. package/src/build-components/OnboardButtons/pattern.json +70 -4
  128. package/src/build-components/OnboardDot/OnboardDot.tsx +106 -4
  129. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +22 -0
  130. package/src/build-components/OnboardDot/pattern.json +54 -1
  131. package/src/build-components/OnboardFooter/OnboardFooter.tsx +14 -6
  132. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +4 -5
  133. package/src/build-components/OnboardFooter/pattern.json +58 -2
  134. package/src/build-components/OnboardImage/OnboardImage.tsx +29 -5
  135. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +36 -3
  136. package/src/build-components/OnboardImage/pattern.json +21 -0
  137. package/src/build-components/OnboardItem/OnboardItem.tsx +8 -1
  138. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +35 -3
  139. package/src/build-components/OnboardItem/pattern.json +38 -2
  140. package/src/build-components/OnboardProvider/OnboardProvider.tsx +22 -8
  141. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +37 -4
  142. package/src/build-components/OnboardProvider/pattern.json +51 -4
  143. package/src/build-components/OnboardSubtitle/OnboardSubtitle.tsx +2 -0
  144. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +4 -5
  145. package/src/build-components/OnboardSubtitle/pattern.json +6 -0
  146. package/src/build-components/OnboardTitle/OnboardTitle.tsx +2 -0
  147. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +4 -5
  148. package/src/build-components/OnboardTitle/pattern.json +6 -0
  149. package/src/build-components/Text/Text.tsx +12 -6
  150. package/src/build-components/Text/TextProps.generated.ts +4 -5
  151. package/src/build-components/Text/pattern.json +38 -2
  152. package/src/build-components/View/View.tsx +11 -6
  153. package/src/build-components/View/ViewProps.generated.ts +3 -4
  154. package/src/build-components/View/pattern.json +227 -19
  155. package/src/build-components/index.ts +22 -0
  156. package/src/build-components/patterns.generated.ts +4905 -139
  157. package/src/components/AttributesEditorPanel.tsx +58 -0
  158. package/src/components/Breadcrumb.tsx +80 -0
  159. package/src/components/Builder.tsx +375 -0
  160. package/src/components/Checkbox.tsx +81 -0
  161. package/src/components/DeviceButton.tsx +39 -0
  162. package/src/components/DeviceNavigationBar.tsx +201 -0
  163. package/src/components/DeviceStatusBar.tsx +85 -0
  164. package/src/components/EditorHeader.tsx +138 -0
  165. package/src/index.ts +8 -4
  166. package/src/mockOS/components/MockLaunchScreenComponent.tsx +43 -0
  167. package/src/mockOS/components/MockOSRouter.tsx +115 -0
  168. package/src/mockOS/components/PermissionModal.tsx +270 -0
  169. package/src/mockOS/context/MockOSContext.tsx +179 -0
  170. package/src/mockOS/hooks/useMockNavigation.ts +11 -0
  171. package/src/mockOS/hooks/useMockPermission.ts +11 -0
  172. package/src/mockOS/index.ts +26 -0
  173. package/src/mockOS/managers/mockPermissionManager.ts +54 -0
  174. package/src/mockOS/managers/navigationManager.ts +91 -0
  175. package/src/modals/AddComponentModal.tsx +313 -0
  176. package/src/modals/ColorModal.tsx +268 -0
  177. package/src/modals/DeviceSelectorModal.tsx +57 -0
  178. package/src/modals/LocalicationModal.tsx +54 -0
  179. package/src/modals/Modal.tsx +57 -0
  180. package/src/modals/index.ts +5 -0
  181. package/src/pages/ProjectPage.tsx +150 -0
  182. package/src/pages/tabs/BuilderTab.tsx +33 -0
  183. package/src/pages/tabs/DebugTab.tsx +64 -0
  184. package/src/pages/tabs/PreviewTab.tsx +206 -0
  185. package/src/size-matters/index.ts +25 -5
  186. package/src/store.ts +56 -38
  187. package/src/styles/base/_global.scss +253 -0
  188. package/src/styles/components/_attributes-editor.scss +261 -0
  189. package/src/styles/components/_editor-shell.scss +189 -0
  190. package/src/styles/components/_mockos-router.scss +140 -0
  191. package/src/styles/components/_ui-components.scss +183 -0
  192. package/src/styles/foundation/_colors.scss +8 -0
  193. package/src/styles/foundation/_mixins.scss +22 -0
  194. package/src/styles/{_reset.scss → foundation/_reset.scss} +5 -2
  195. package/src/styles/foundation/_sizes.scss +37 -0
  196. package/src/styles/foundation/_typography.scss +4 -0
  197. package/src/styles/foundation/_variables.scss +3 -0
  198. package/src/styles/index.scss +22 -129
  199. package/src/styles/layout/_builder.scss +68 -0
  200. package/src/styles/layout/_pages.scss +3 -0
  201. package/src/styles/modals/_add-component.scss +122 -0
  202. package/src/styles/modals/_color-modal.scss +130 -0
  203. package/src/styles/modals/_device-selector.scss +18 -0
  204. package/src/styles/modals/_localication-modal.scss +68 -0
  205. package/src/styles/modals/_modal-shell.scss +46 -0
  206. package/src/styles/utilities/_carousel.scss +125 -0
  207. package/src/types/PreviewConfig.ts +14 -5
  208. package/src/types/Project.ts +15 -2
  209. package/src/types/images.d.ts +8 -0
  210. package/src/utils/copyNode.ts +7 -0
  211. package/src/utils/extractTextStyle.ts +8 -4
  212. package/src/utils/extractViewStyle.ts +51 -7
  213. package/src/utils/getDevices.ts +1 -0
  214. package/src/utils/logger.ts +76 -0
  215. package/src/utils/patterns.ts +33 -0
  216. package/src/utils/useLogRender.ts +13 -0
  217. package/dist/build-components/OnboardDot/OnboardExpandingDotProps.generated.d.ts +0 -10
  218. package/src/build-components/OnboardDot/OnboardExpandingDotProps.generated.ts +0 -20
@@ -4,6 +4,7 @@
4
4
  "pattern": {
5
5
  "type": "OnboardDot",
6
6
  "children": "node",
7
+ "extends": "View",
7
8
  "attributes": {
8
9
  "dotType": [
9
10
  "expanding_dot",
@@ -17,7 +18,59 @@
17
18
  "expanding_dot_width": "number",
18
19
  "dot_style": "string",
19
20
  "container_style": "string",
20
- "active_dot_color": "string"
21
+ "active_dot_color": "color",
22
+ "flexDirection": "never",
23
+ "alignItems": "never",
24
+ "justifyContent": "never"
25
+ }
26
+ },
27
+ "meta": {
28
+ "desiredParent": [">OnboardProvider"],
29
+ "label": "Onboard Dot",
30
+ "description": "Renders onboarding progress dots.",
31
+ "attributes": {
32
+ "dotType": {
33
+ "label": "Dot Type",
34
+ "description": "Dot animation style.",
35
+ "category": "style",
36
+ "specialCategory": null,
37
+ "sort": 1
38
+ },
39
+ "inactive_dot_opacity": {
40
+ "label": "Inactive Dot Opacity",
41
+ "description": "Opacity for inactive dots.",
42
+ "category": "style",
43
+ "specialCategory": null,
44
+ "sort": 2
45
+ },
46
+ "expanding_dot_width": {
47
+ "label": "Expanding Dot Width",
48
+ "description": "Width used while expanding.",
49
+ "category": "style",
50
+ "specialCategory": null,
51
+ "sort": 3
52
+ },
53
+ "dot_style": {
54
+ "label": "Dot Style",
55
+ "description": "Custom style for each dot.",
56
+ "category": "style",
57
+ "specialCategory": null,
58
+ "sort": 4
59
+ },
60
+ "container_style": {
61
+ "label": "Container Style",
62
+ "description": "Style for the dot wrapper.",
63
+ "category": "style",
64
+ "specialCategory": null,
65
+ "sort": 5
66
+ },
67
+ "active_dot_color": {
68
+ "label": "Active Dot Color",
69
+ "description": "Color of the active dot.",
70
+ "category": "style",
71
+ "specialCategory": null,
72
+ "sort": 6
73
+ }
21
74
  }
22
75
  }
23
76
  }
@@ -1,9 +1,11 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  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
6
  import { extractTextStyle } from '../../utils/extractTextStyle';
7
+ import { extractViewStyle } from '../../utils/extractViewStyle';
8
+ import { useLogRender } from '../../utils/useLogRender';
7
9
 
8
10
  type Segment =
9
11
  | { type: 'text'; value: string }
@@ -86,16 +88,20 @@ function buildSegments(
86
88
  }
87
89
 
88
90
  function OnboardFooter({ node }: OnboardFooterComponentProps) {
91
+ useLogRender('OnboardFooter');
89
92
  node = useNode(node);
90
- const { defaultLanguage, localication } = useRenderStore((s) => ({
91
- defaultLanguage: s.defaultLanguage,
92
- localication: s.localication,
93
+ const attributeKey =
94
+ (node as any)?.sourceType ?? node.type ?? 'OnboardFooter';
95
+ const { appConfig } = useRenderStore((s) => ({
96
+ appConfig: s.appConfig,
93
97
  }));
98
+ const { localication, defaultLanguage } = appConfig;
94
99
  const t = (key?: string) =>
95
100
  key ? (localication?.[defaultLanguage ?? 'en']?.[key] ?? key) : '';
96
101
 
97
102
  const text = t(node?.attributes?.textLocalizationKey);
98
- const style: React.CSSProperties = extractTextStyle(node);
103
+ const textStyle: React.CSSProperties = extractTextStyle(node);
104
+ const viewStyle = useMemo(() => extractViewStyle(node), [node]);
99
105
 
100
106
  const linkStyle = (color?: string): React.CSSProperties => ({
101
107
  color,
@@ -105,8 +111,10 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
105
111
  const paddingHorizontal = parseSize(node?.attributes?.paddingHorizontal);
106
112
  return (
107
113
  <div
114
+ attribute-key={attributeKey}
108
115
  style={{
109
- ...style,
116
+ ...viewStyle,
117
+ ...textStyle,
110
118
  paddingLeft: paddingHorizontal,
111
119
  paddingRight: paddingHorizontal,
112
120
  textAlign: 'center',
@@ -34,7 +34,7 @@ export interface OnboardFooterPropsGenerated {
34
34
  child: string;
35
35
  attributes: {
36
36
  color?: string;
37
- fontSize?: number;
37
+ fontSize?: string;
38
38
  fontWeight?: FontWeightOptionType;
39
39
  textAlign?: TextAlignOptionType;
40
40
  scrollable?: boolean;
@@ -42,7 +42,7 @@ export interface OnboardFooterPropsGenerated {
42
42
  alignItems?: AlignItemsOptionType;
43
43
  justifyContent?: JustifyContentOptionType;
44
44
  gap?: string;
45
- padding?: number;
45
+ padding?: string;
46
46
  paddingHorizontal?: string;
47
47
  paddingVertical?: string;
48
48
  paddingTop?: string;
@@ -50,7 +50,6 @@ export interface OnboardFooterPropsGenerated {
50
50
  paddingLeft?: string;
51
51
  paddingRight?: string;
52
52
  margin?: string;
53
- marginHorizontal?: string;
54
53
  marginVertical?: string;
55
54
  marginTop?: string;
56
55
  marginBottom?: string;
@@ -58,8 +57,8 @@ export interface OnboardFooterPropsGenerated {
58
57
  marginRight?: string;
59
58
  backgroundColor?: string;
60
59
  borderRadius?: string;
61
- width?: number;
62
- height?: number;
60
+ width?: string;
61
+ height?: string;
63
62
  textLocalizationKey?: string;
64
63
  linkedWordFirstLocalizationKey?: string;
65
64
  linkedWordFirstColor?: string;
@@ -8,14 +8,70 @@
8
8
  "attributes": {
9
9
  "textLocalizationKey": "string",
10
10
  "linkedWordFirstLocalizationKey": "string",
11
- "linkedWordFirstColor": "string",
11
+ "linkedWordFirstColor": "color",
12
12
  "linkedWordFirstPage": "string",
13
13
  "linkedWordSecondLocalizationKey": "string",
14
- "linkedWordSecondColor": "string",
14
+ "linkedWordSecondColor": "color",
15
15
  "linkedWordSecondPage": "string"
16
16
  }
17
17
  },
18
18
  "defaults": {
19
19
  "paddingHorizontal": "24@s"
20
+ },
21
+ "meta": {
22
+ "desiredParent": [">OnboardItem"],
23
+ "label": "Onboard Footer",
24
+ "description": "Footer text with optional links.",
25
+ "attributes": {
26
+ "textLocalizationKey": {
27
+ "label": "Text Localization Key",
28
+ "description": "Localization key for the footer text.",
29
+ "category": "other",
30
+ "specialCategory": null,
31
+ "sort": 1
32
+ },
33
+ "linkedWordFirstLocalizationKey": {
34
+ "label": "Linked Word First Localization Key",
35
+ "description": "Key for the first linked word.",
36
+ "category": "other",
37
+ "specialCategory": null,
38
+ "sort": 2
39
+ },
40
+ "linkedWordFirstColor": {
41
+ "label": "Linked Word First Color",
42
+ "description": "Color of the first linked word.",
43
+ "category": "style",
44
+ "specialCategory": null,
45
+ "sort": 3
46
+ },
47
+ "linkedWordFirstPage": {
48
+ "label": "Linked Word First Page",
49
+ "description": "Page opened by the first link.",
50
+ "category": "other",
51
+ "specialCategory": null,
52
+ "sort": 4
53
+ },
54
+ "linkedWordSecondLocalizationKey": {
55
+ "label": "Linked Word Second Localization Key",
56
+ "description": "Key for the second linked word.",
57
+ "category": "other",
58
+ "specialCategory": null,
59
+ "sort": 5
60
+ },
61
+ "linkedWordSecondColor": {
62
+ "label": "Linked Word Second Color",
63
+ "description": "Color of the second linked word.",
64
+ "category": "style",
65
+ "specialCategory": null,
66
+ "sort": 6
67
+ },
68
+ "linkedWordSecondPage": {
69
+ "label": "Linked Word Second Page",
70
+ "description": "Page opened by the second link.",
71
+ "category": "other",
72
+ "specialCategory": null,
73
+ "sort": 7
74
+ }
75
+ }
20
76
  }
21
77
  }
@@ -1,12 +1,17 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useMemo, 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
+ import { useLogRender } from '../../utils/useLogRender';
7
+ import { extractViewStyle } from '../../utils/extractViewStyle';
6
8
 
7
9
  function OnboardImage({ node }: OnboardImageComponentProps) {
10
+ useLogRender('OnboardImage');
8
11
  node = useNode(node);
12
+ const attributeKey = (node as any)?.sourceType ?? node.type ?? 'OnboardImage';
9
13
  const [lottie, setLottie] = useState<string | null>(null);
14
+ const viewStyle = useMemo(() => extractViewStyle(node), [node]);
10
15
 
11
16
  useEffect(() => {
12
17
  if (node.attributes?.lottie) {
@@ -17,18 +22,37 @@ function OnboardImage({ node }: OnboardImageComponentProps) {
17
22
  }, [node.attributes?.lottie]);
18
23
 
19
24
  if (node.attributes?.video_url) {
20
- return <video autoPlay muted loop src={node.attributes?.video_url} />;
25
+ return (
26
+ <video
27
+ attribute-key={attributeKey}
28
+ autoPlay
29
+ muted
30
+ loop
31
+ src={node.attributes?.video_url}
32
+ style={viewStyle}
33
+ />
34
+ );
21
35
  }
22
36
 
23
37
  if (node.attributes?.lottie) {
24
38
  if (lottie) {
25
- return <Lottie animationData={lottie} />;
39
+ return (
40
+ <div attribute-key={attributeKey} style={viewStyle}>
41
+ <Lottie animationData={lottie} />
42
+ </div>
43
+ );
26
44
  } else {
27
- return <div>Loading...</div>;
45
+ return (
46
+ <div attribute-key={attributeKey} style={viewStyle}>
47
+ Loading...
48
+ </div>
49
+ );
28
50
  }
29
51
  }
30
52
 
31
- return <Image node={{ ...node, type: 'image' } as any} />;
53
+ return (
54
+ <Image node={{ ...node, type: 'image', sourceType: attributeKey } as any} />
55
+ );
32
56
  }
33
57
 
34
58
  export default React.memo(OnboardImage);
@@ -3,15 +3,48 @@
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
5
  export type ResizeModeOptionType = 'cover' | 'contain' | 'stretch' | 'center';
6
+ export type FlexDirectionOptionType = 'row' | 'column';
7
+ export type AlignItemsOptionType =
8
+ | 'flex-start'
9
+ | 'center'
10
+ | 'flex-end'
11
+ | 'stretch'
12
+ | 'baseline';
13
+ export type JustifyContentOptionType =
14
+ | 'flex-start'
15
+ | 'center'
16
+ | 'flex-end'
17
+ | 'space-between'
18
+ | 'space-around'
19
+ | 'space-evenly';
6
20
 
7
21
  export interface OnboardImagePropsGenerated {
8
22
  child: string;
9
23
  attributes: {
10
24
  src?: string;
11
- width?: number;
12
- height?: number;
25
+ width?: string;
26
+ height?: string;
13
27
  resizeMode?: ResizeModeOptionType;
14
- borderRadius?: number;
28
+ borderRadius?: string;
29
+ 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;
15
48
  video_url?: string;
16
49
  lottie?: string;
17
50
  };
@@ -9,5 +9,26 @@
9
9
  "video_url": "string",
10
10
  "lottie": "string"
11
11
  }
12
+ },
13
+ "meta": {
14
+ "desiredParent": [">OnboardProvider", ">OnboardItem", "!=Onboard"],
15
+ "label": "Onboard Image",
16
+ "description": "Onboarding hero image with media.",
17
+ "attributes": {
18
+ "video_url": {
19
+ "label": "Video Url",
20
+ "description": "URL for the onboarding video.",
21
+ "category": "other",
22
+ "specialCategory": null,
23
+ "sort": 1
24
+ },
25
+ "lottie": {
26
+ "label": "Lottie",
27
+ "description": "Path to the lottie animation.",
28
+ "category": "other",
29
+ "specialCategory": null,
30
+ "sort": 2
31
+ }
32
+ }
12
33
  }
13
34
  }
@@ -1,18 +1,25 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  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';
7
+ import { extractViewStyle } from '../../utils/extractViewStyle';
6
8
 
7
9
  function OnboardItem({ node }: OnboardItemComponentProps) {
10
+ useLogRender('OnboardItem');
8
11
  node = useNode(node);
12
+ const attributeKey = (node as any)?.sourceType ?? node.type ?? 'OnboardItem';
9
13
  const flexDirection = node.attributes?.flexDirection;
10
14
  const display = node.attributes?.display;
11
15
  const paddingHorizontal = parseSize(node.attributes?.paddingHorizontal);
16
+ const viewStyle = useMemo(() => extractViewStyle(node), [node]);
12
17
  return (
13
18
  <div
19
+ attribute-key={attributeKey}
14
20
  className="embla__slide"
15
21
  style={{
22
+ ...viewStyle,
16
23
  gap: parseSize(node.attributes?.gap),
17
24
  flexDirection,
18
25
  display,
@@ -2,16 +2,48 @@
2
2
 
3
3
  import type { NodeData } from '../../types/Node';
4
4
 
5
- export type DisplayOptionType = 'flex' | 'block';
6
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 DisplayOptionType = 'flex' | 'block';
7
20
 
8
21
  export interface OnboardItemPropsGenerated {
9
22
  child: string;
10
23
  attributes: {
11
- display?: DisplayOptionType;
12
- gap?: string;
24
+ scrollable?: boolean;
13
25
  flexDirection?: FlexDirectionOptionType;
26
+ alignItems?: AlignItemsOptionType;
27
+ justifyContent?: JustifyContentOptionType;
28
+ gap?: string;
29
+ padding?: string;
14
30
  paddingHorizontal?: string;
31
+ paddingVertical?: string;
32
+ paddingTop?: string;
33
+ paddingBottom?: string;
34
+ paddingLeft?: string;
35
+ paddingRight?: string;
36
+ margin?: string;
37
+ marginVertical?: string;
38
+ marginTop?: string;
39
+ marginBottom?: string;
40
+ marginLeft?: string;
41
+ marginRight?: string;
42
+ backgroundColor?: string;
43
+ borderRadius?: string;
44
+ width?: string;
45
+ height?: string;
46
+ display?: DisplayOptionType;
15
47
  };
16
48
  }
17
49
 
@@ -4,11 +4,12 @@
4
4
  "pattern": {
5
5
  "type": "OnboardItem",
6
6
  "children": "node",
7
+ "extends": "View",
7
8
  "attributes": {
8
9
  "display": ["flex", "block"],
9
- "gap": "string",
10
+ "gap": "size",
10
11
  "flexDirection": ["row", "column"],
11
- "paddingHorizontal": "string"
12
+ "paddingHorizontal": "size"
12
13
  }
13
14
  },
14
15
  "defaults": {
@@ -16,5 +17,40 @@
16
17
  "display": "flex",
17
18
  "flexDirection": "column",
18
19
  "paddingHorizontal": "24@s"
20
+ },
21
+ "meta": {
22
+ "desiredParent": ["=Onboard"],
23
+ "label": "Onboard Item",
24
+ "description": "Single onboarding screen section.",
25
+ "attributes": {
26
+ "display": {
27
+ "label": "Display",
28
+ "description": "Controls layout display mode.",
29
+ "category": "container",
30
+ "specialCategory": null,
31
+ "sort": 1
32
+ },
33
+ "gap": {
34
+ "label": "Gap",
35
+ "description": "Space between child blocks.",
36
+ "category": "container",
37
+ "specialCategory": null,
38
+ "sort": 2
39
+ },
40
+ "flexDirection": {
41
+ "label": "Flex Direction",
42
+ "description": "Order of child stacking.",
43
+ "category": "container",
44
+ "specialCategory": null,
45
+ "sort": 3
46
+ },
47
+ "paddingHorizontal": {
48
+ "label": "Padding Horizontal",
49
+ "description": "Left and right padding.",
50
+ "category": "container",
51
+ "specialCategory": "padding",
52
+ "sort": 4
53
+ }
54
+ }
19
55
  }
20
56
  }
@@ -11,10 +11,16 @@ 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';
15
+ import { extractViewStyle } from '../../utils/extractViewStyle';
16
+ import { ViewPropsGenerated } from '../View/ViewProps.generated';
14
17
 
15
18
  export const onboardContext = createContext<any>(undefined);
16
19
  function OnboardProvider({ node }: OnboardProviderComponentProps) {
20
+ useLogRender('OnboardProvider');
17
21
  node = useNode(node);
22
+ const attributeKey =
23
+ (node as any)?.sourceType ?? node.type ?? 'OnboardProvider';
18
24
  const device = useRenderStore((s) => s.device);
19
25
  const [emblaRef, emblaApi] = useEmblaCarousel(node.attributes as any);
20
26
  const [selectedIndex, setSelectedIndex] = useState(0);
@@ -49,19 +55,27 @@ function OnboardProvider({ node }: OnboardProviderComponentProps) {
49
55
  }
50
56
  }, [theme]);*/
51
57
 
58
+ //TODO: pattern içinde direk gömmek yerine orada da inhertince eklenebilir
59
+ const viewStyle = useMemo(() => {
60
+ const style = extractViewStyle(
61
+ node as NodeData<ViewPropsGenerated['attributes']>,
62
+ );
63
+ //NOTE: Embla için istisna
64
+ style.display = 'block';
65
+ return style;
66
+ }, [node]);
67
+
52
68
  return (
53
69
  <onboardContext.Provider value={{ emblaApi, selectedIndex }}>
54
70
  <div
71
+ attribute-key={attributeKey}
55
72
  className="carousel-provider"
56
73
  style={{
57
- paddingTop:
58
- device?.insets?.[0] + (node.attributes as any)?.paddingTop,
59
- paddingRight:
60
- device?.insets?.[1] + (node.attributes as any)?.paddingRight,
61
- paddingBottom:
62
- device?.insets?.[2] + (node.attributes as any)?.paddingBottom,
63
- paddingLeft:
64
- device?.insets?.[3] + (node.attributes as any)?.paddingLeft,
74
+ ...viewStyle,
75
+ paddingTop: node.attributes?.paddingTop,
76
+ paddingRight: node.attributes?.paddingRight,
77
+ paddingBottom: node.attributes?.paddingBottom,
78
+ paddingLeft: node.attributes?.paddingLeft,
65
79
  }}
66
80
  >
67
81
  <div className="embla">
@@ -2,15 +2,48 @@
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
+
5
20
  export interface OnboardProviderPropsGenerated {
6
21
  child: string;
7
22
  attributes: {
23
+ scrollable?: boolean;
24
+ flexDirection?: FlexDirectionOptionType;
25
+ alignItems?: AlignItemsOptionType;
26
+ justifyContent?: JustifyContentOptionType;
27
+ gap?: string;
28
+ padding?: string;
29
+ paddingHorizontal?: string;
30
+ paddingVertical?: string;
31
+ paddingTop?: string;
32
+ paddingBottom?: string;
33
+ paddingLeft?: string;
34
+ paddingRight?: string;
35
+ margin?: string;
36
+ marginVertical?: string;
37
+ marginTop?: string;
38
+ marginBottom?: string;
39
+ marginLeft?: string;
40
+ marginRight?: string;
41
+ backgroundColor?: string;
42
+ borderRadius?: never;
43
+ width?: string;
44
+ height?: string;
8
45
  theme?: string;
9
46
  use_safe_area_inset?: boolean;
10
- paddingTop?: number;
11
- paddingRight?: number;
12
- paddingBottom?: number;
13
- paddingLeft?: number;
14
47
  };
15
48
  }
16
49
 
@@ -4,13 +4,11 @@
4
4
  "pattern": {
5
5
  "type": "OnboardProvider",
6
6
  "children": "node",
7
+ "extends": "View",
7
8
  "attributes": {
8
9
  "theme": "string",
9
10
  "use_safe_area_inset": "boolean",
10
- "paddingTop": "number",
11
- "paddingRight": "number",
12
- "paddingBottom": "number",
13
- "paddingLeft": "number"
11
+ "borderRadius": "never"
14
12
  }
15
13
  },
16
14
  "defaults": {
@@ -18,5 +16,54 @@
18
16
  "paddingRight": 0,
19
17
  "paddingBottom": 8,
20
18
  "paddingLeft": 0
19
+ },
20
+ "meta": {
21
+ "desiredParent": ["root"],
22
+ "label": "Onboard Provider",
23
+ "description": "Provides shared settings for onboarding.",
24
+ "attributes": {
25
+ "theme": {
26
+ "label": "Theme",
27
+ "description": "Theme key for onboarding screens.",
28
+ "category": "other",
29
+ "specialCategory": null,
30
+ "sort": 1
31
+ },
32
+ "use_safe_area_inset": {
33
+ "label": "Use Safe Area Inset",
34
+ "description": "Adds safe area padding.",
35
+ "category": "container",
36
+ "specialCategory": null,
37
+ "sort": 2
38
+ },
39
+ "paddingTop": {
40
+ "label": "Padding Top",
41
+ "description": "Top padding for the provider.",
42
+ "category": "container",
43
+ "specialCategory": "padding",
44
+ "sort": 3
45
+ },
46
+ "paddingRight": {
47
+ "label": "Padding Right",
48
+ "description": "Right padding for the provider.",
49
+ "category": "container",
50
+ "specialCategory": "padding",
51
+ "sort": 4
52
+ },
53
+ "paddingBottom": {
54
+ "label": "Padding Bottom",
55
+ "description": "Bottom padding for the provider.",
56
+ "category": "container",
57
+ "specialCategory": "padding",
58
+ "sort": 5
59
+ },
60
+ "paddingLeft": {
61
+ "label": "Padding Left",
62
+ "description": "Left padding for the provider.",
63
+ "category": "container",
64
+ "specialCategory": "padding",
65
+ "sort": 6
66
+ }
67
+ }
21
68
  }
22
69
  }