@effijs/templates 0.0.0-stage → 1.0.0-alpha.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 (367) hide show
  1. package/CONTRIBUTING.md +27 -0
  2. package/LICENSE +22 -0
  3. package/README.md +32 -2
  4. package/ai/SETUP.md +5 -0
  5. package/docs/catalog.md +85 -0
  6. package/forge.manifest.js +75 -0
  7. package/lib/compat.js +40 -0
  8. package/lib/docs/build.js +146 -0
  9. package/lib/install.js +51 -0
  10. package/lib/journal.js +40 -0
  11. package/lib/jsonConfig.js +33 -0
  12. package/lib/migration.js +35 -0
  13. package/lib/names.js +42 -0
  14. package/lib/patch.js +62 -0
  15. package/lib/paths.js +12 -0
  16. package/lib/project.js +48 -0
  17. package/lib/registry.js +99 -0
  18. package/package.json +46 -4
  19. package/platforms/react-native/CATALOG.md +391 -0
  20. package/platforms/react-native/ORIGIN.md +42 -0
  21. package/platforms/react-native/README.md +78 -0
  22. package/platforms/react-native/ai/AGENTS.md.hbs +36 -0
  23. package/platforms/react-native/ai/SETUP.md +89 -0
  24. package/platforms/react-native/compat/matrix.js +150 -0
  25. package/platforms/react-native/configs/babel.js +63 -0
  26. package/platforms/react-native/configs/forgeConfig.js +35 -0
  27. package/platforms/react-native/configs/jsConfigs.js +96 -0
  28. package/platforms/react-native/configs/metro.js +86 -0
  29. package/platforms/react-native/generators/add/generator.js +12 -0
  30. package/platforms/react-native/generators/add/run.js +64 -0
  31. package/platforms/react-native/generators/component/generator.js +75 -0
  32. package/platforms/react-native/generators/component/render.js +69 -0
  33. package/platforms/react-native/generators/component/templates/Common.tsx.hbs +13 -0
  34. package/platforms/react-native/generators/component/templates/index.ts.hbs +13 -0
  35. package/platforms/react-native/generators/component/templates/pm.ts.hbs +7 -0
  36. package/platforms/react-native/generators/component/templates/types.ts.hbs +3 -0
  37. package/platforms/react-native/generators/demo/files/api/app.http +8 -0
  38. package/platforms/react-native/generators/demo/files/api/environment/http-client.env.json +5 -0
  39. package/platforms/react-native/generators/demo/files/entity/category/category.api.ts +18 -0
  40. package/platforms/react-native/generators/demo/files/entity/category/category.dto.ts +15 -0
  41. package/platforms/react-native/generators/demo/files/entity/category/category.service.ts +42 -0
  42. package/platforms/react-native/generators/demo/files/entity/category/category.store.ts +26 -0
  43. package/platforms/react-native/generators/demo/files/entity/category/index.ts +2 -0
  44. package/platforms/react-native/generators/demo/files/entity/product/index.ts +2 -0
  45. package/platforms/react-native/generators/demo/files/entity/product/product.api.ts +49 -0
  46. package/platforms/react-native/generators/demo/files/entity/product/product.dto.ts +120 -0
  47. package/platforms/react-native/generators/demo/files/entity/product/product.service.ts +139 -0
  48. package/platforms/react-native/generators/demo/files/entity/product/product.store.ts +37 -0
  49. package/platforms/react-native/generators/demo/files/feature/product/components/Product.CategorySelect.tsx +36 -0
  50. package/platforms/react-native/generators/demo/files/feature/product/detail/Product.Detail.Screen.tsx +100 -0
  51. package/platforms/react-native/generators/demo/files/feature/product/detail/product.detail.service.ts +33 -0
  52. package/platforms/react-native/generators/demo/files/feature/product/filter/Product.Filter.Screen.tsx +59 -0
  53. package/platforms/react-native/generators/demo/files/feature/product/filter/product.filter.service.ts +78 -0
  54. package/platforms/react-native/generators/demo/files/feature/product/form/Product.Form.Screen.tsx +71 -0
  55. package/platforms/react-native/generators/demo/files/feature/product/form/product.form.service.ts +142 -0
  56. package/platforms/react-native/generators/demo/files/feature/product/index.ts +7 -0
  57. package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Item.tsx +34 -0
  58. package/platforms/react-native/generators/demo/files/feature/product/list/Product.List.Screen.tsx +106 -0
  59. package/platforms/react-native/generators/demo/files/feature/product/list/product.list.service.ts +47 -0
  60. package/platforms/react-native/generators/demo/files/feature/product/product.feature.ts +29 -0
  61. package/platforms/react-native/generators/demo/files/feature/product/product.hooks.ts +7 -0
  62. package/platforms/react-native/generators/demo/files/feature/product/search/Product.Search.Screen.tsx +82 -0
  63. package/platforms/react-native/generators/demo/files/feature/product/search/product.search.service.ts +97 -0
  64. package/platforms/react-native/generators/demo/files/navigation/navigation.product.ts +46 -0
  65. package/platforms/react-native/generators/demo/generator.js +93 -0
  66. package/platforms/react-native/generators/entity/generator.js +68 -0
  67. package/platforms/react-native/generators/feature/generator.js +224 -0
  68. package/platforms/react-native/generators/feature/render.js +163 -0
  69. package/platforms/react-native/generators/feature/templates/detail.screen.tsx.hbs +25 -0
  70. package/platforms/react-native/generators/feature/templates/detail.service.ts.hbs +14 -0
  71. package/platforms/react-native/generators/feature/templates/feature.ts.hbs +18 -0
  72. package/platforms/react-native/generators/feature/templates/filter.screen.tsx.hbs +17 -0
  73. package/platforms/react-native/generators/feature/templates/filter.service.ts.hbs +14 -0
  74. package/platforms/react-native/generators/feature/templates/form.screen.tsx.hbs +21 -0
  75. package/platforms/react-native/generators/feature/templates/form.service.ts.hbs +37 -0
  76. package/platforms/react-native/generators/feature/templates/hooks.ts.hbs +7 -0
  77. package/platforms/react-native/generators/feature/templates/index.ts.hbs +2 -0
  78. package/platforms/react-native/generators/feature/templates/list.item.tsx.hbs +16 -0
  79. package/platforms/react-native/generators/feature/templates/list.screen.tsx.hbs +34 -0
  80. package/platforms/react-native/generators/feature/templates/list.service.ts.hbs +15 -0
  81. package/platforms/react-native/generators/feature/templates/navigation.ts.hbs +12 -0
  82. package/platforms/react-native/generators/feature/templates/search.screen.tsx.hbs +24 -0
  83. package/platforms/react-native/generators/feature/templates/search.service.ts.hbs +13 -0
  84. package/platforms/react-native/generators/feature/templates/tab.tsx.hbs +8 -0
  85. package/platforms/react-native/generators/init/files/app/app.controller.ts +41 -0
  86. package/platforms/react-native/generators/init/files/app/app.error.ts +1 -0
  87. package/platforms/react-native/generators/init/files/app/app.store.ts +12 -0
  88. package/platforms/react-native/generators/init/files/app/index.ts +19 -0
  89. package/platforms/react-native/generators/init/files/app/splash/Onboarding.Screen.tsx +31 -0
  90. package/platforms/react-native/generators/init/files/app/splash/Splash.Screen.tsx +14 -0
  91. package/platforms/react-native/generators/init/files/app/tabs/home/Home.tab.tsx +24 -0
  92. package/platforms/react-native/generators/init/files/app/tabs/profile/Profile.tab.tsx +1 -0
  93. package/platforms/react-native/generators/init/files/configs/dev.ts.hbs +5 -0
  94. package/platforms/react-native/generators/init/files/configs/index.ts +4 -0
  95. package/platforms/react-native/generators/init/files/configs/prod.ts.hbs +5 -0
  96. package/platforms/react-native/generators/init/files/entity/auth/auth.api.ts +36 -0
  97. package/platforms/react-native/generators/init/files/entity/auth/auth.dto.ts +26 -0
  98. package/platforms/react-native/generators/init/files/entity/auth/auth.service.ts +94 -0
  99. package/platforms/react-native/generators/init/files/entity/auth/auth.session.store.ts +14 -0
  100. package/platforms/react-native/generators/init/files/entity/auth/auth.store.ts +20 -0
  101. package/platforms/react-native/generators/init/files/entity/auth/index.ts +2 -0
  102. package/platforms/react-native/generators/init/files/entity/index.ts +2 -0
  103. package/platforms/react-native/generators/init/files/feature/auth/auth.feature.ts +10 -0
  104. package/platforms/react-native/generators/init/files/feature/auth/auth.hooks.ts +7 -0
  105. package/platforms/react-native/generators/init/files/feature/auth/index.ts +1 -0
  106. package/platforms/react-native/generators/init/files/feature/auth/sign-in/SignIn.Screen.tsx +39 -0
  107. package/platforms/react-native/generators/init/files/feature/auth/sign-in/signIn.service.ts +54 -0
  108. package/platforms/react-native/generators/init/files/feature/auth/sign-up/SignUp.Screen.tsx +64 -0
  109. package/platforms/react-native/generators/init/files/feature/auth/sign-up/signUp.service.ts +73 -0
  110. package/platforms/react-native/generators/init/files/feature/feature.hooks.ts +15 -0
  111. package/platforms/react-native/generators/init/files/feature/index.ts +3 -0
  112. package/platforms/react-native/generators/init/files/feature/profile/Profile.Screen.tsx +52 -0
  113. package/platforms/react-native/generators/init/files/feature/profile/index.ts +1 -0
  114. package/platforms/react-native/generators/init/files/feature/profile/profile.feature.ts +18 -0
  115. package/platforms/react-native/generators/init/files/feature/profile/profile.hooks.ts +7 -0
  116. package/platforms/react-native/generators/init/files/index.ts +16 -0
  117. package/platforms/react-native/generators/init/files/navigation/index.ts +18 -0
  118. package/platforms/react-native/generators/init/files/navigation/navigation.app.ts +58 -0
  119. package/platforms/react-native/generators/init/files/navigation/navigation.features.ts +9 -0
  120. package/platforms/react-native/generators/init/files/navigation/navigation.hooks.ts +5 -0
  121. package/platforms/react-native/generators/init/files/navigation/navigation.tabs.ts +55 -0
  122. package/platforms/react-native/generators/init/files/navigation/navigation.widgets.ts +23 -0
  123. package/platforms/react-native/generators/init/files/services/http/http.base.ts +69 -0
  124. package/platforms/react-native/generators/init/files/services/http/http.error.ts +10 -0
  125. package/platforms/react-native/generators/init/files/services/http/http.service.ts +24 -0
  126. package/platforms/react-native/generators/init/files/services/http/middleware/index.ts +12 -0
  127. package/platforms/react-native/generators/init/files/services/http/middleware/middleware.error.ts +36 -0
  128. package/platforms/react-native/generators/init/files/services/http/middleware/middleware.registry.ts +3 -0
  129. package/platforms/react-native/generators/init/files/services/http/middleware/middleware.token.ts +97 -0
  130. package/platforms/react-native/generators/init/files/services/index.ts +15 -0
  131. package/platforms/react-native/generators/init/files/ui/components/Box/Common.tsx +19 -0
  132. package/platforms/react-native/generators/init/files/ui/components/Box/box.pm.ts +111 -0
  133. package/platforms/react-native/generators/init/files/ui/components/Box/box.types.ts +8 -0
  134. package/platforms/react-native/generators/init/files/ui/components/Box/index.ts +13 -0
  135. package/platforms/react-native/generators/init/files/ui/components/Button/Common.tsx +50 -0
  136. package/platforms/react-native/generators/init/files/ui/components/Button/Touchable.tsx +19 -0
  137. package/platforms/react-native/generators/init/files/ui/components/Button/button.pm.ts +197 -0
  138. package/platforms/react-native/generators/init/files/ui/components/Button/button.types.ts +22 -0
  139. package/platforms/react-native/generators/init/files/ui/components/Button/button.utils.ts +16 -0
  140. package/platforms/react-native/generators/init/files/ui/components/Button/index.ts +19 -0
  141. package/platforms/react-native/generators/init/files/ui/components/Form/Colours.tsx +50 -0
  142. package/platforms/react-native/generators/init/files/ui/components/Form/Common.tsx +38 -0
  143. package/platforms/react-native/generators/init/files/ui/components/Form/ErrorText.tsx +11 -0
  144. package/platforms/react-native/generators/init/files/ui/components/Form/Input.tsx +115 -0
  145. package/platforms/react-native/generators/init/files/ui/components/Form/InputArea.tsx +70 -0
  146. package/platforms/react-native/generators/init/files/ui/components/Form/Label.tsx +18 -0
  147. package/platforms/react-native/generators/init/files/ui/components/Form/Select.tsx +86 -0
  148. package/platforms/react-native/generators/init/files/ui/components/Form/components/SecureTextEntry.tsx +19 -0
  149. package/platforms/react-native/generators/init/files/ui/components/Form/form.error.ts +18 -0
  150. package/platforms/react-native/generators/init/files/ui/components/Form/form.pm.ts +134 -0
  151. package/platforms/react-native/generators/init/files/ui/components/Form/form.types.ts +59 -0
  152. package/platforms/react-native/generators/init/files/ui/components/Form/index.ts +67 -0
  153. package/platforms/react-native/generators/init/files/ui/components/Grid/Common.tsx +11 -0
  154. package/platforms/react-native/generators/init/files/ui/components/Grid/grid.pm.ts +93 -0
  155. package/platforms/react-native/generators/init/files/ui/components/Grid/grid.types.ts +79 -0
  156. package/platforms/react-native/generators/init/files/ui/components/Grid/index.ts +13 -0
  157. package/platforms/react-native/generators/init/files/ui/components/Icon/Common.tsx +19 -0
  158. package/platforms/react-native/generators/init/files/ui/components/Icon/icons.pm.ts +74 -0
  159. package/platforms/react-native/generators/init/files/ui/components/Icon/icons.types.ts +19 -0
  160. package/platforms/react-native/generators/init/files/ui/components/Icon/index.ts +3 -0
  161. package/platforms/react-native/generators/init/files/ui/components/Loading/Loading.tsx +10 -0
  162. package/platforms/react-native/generators/init/files/ui/components/Loading/loading.hook.ts +5 -0
  163. package/platforms/react-native/generators/init/files/ui/components/Loading/loading.service.ts +22 -0
  164. package/platforms/react-native/generators/init/files/ui/components/Loading/loading.store.ts +8 -0
  165. package/platforms/react-native/generators/init/files/ui/components/Screen/Common.tsx +87 -0
  166. package/platforms/react-native/generators/init/files/ui/components/Screen/Content.tsx +77 -0
  167. package/platforms/react-native/generators/init/files/ui/components/Screen/Header.tsx +80 -0
  168. package/platforms/react-native/generators/init/files/ui/components/Screen/HeaderTab.tsx +17 -0
  169. package/platforms/react-native/generators/init/files/ui/components/Screen/SafeAreaHOC.tsx +9 -0
  170. package/platforms/react-native/generators/init/files/ui/components/Screen/index.ts +22 -0
  171. package/platforms/react-native/generators/init/files/ui/components/Text/Common.tsx +20 -0
  172. package/platforms/react-native/generators/init/files/ui/components/Text/index.ts +13 -0
  173. package/platforms/react-native/generators/init/files/ui/components/Text/text.pm.ts +55 -0
  174. package/platforms/react-native/generators/init/files/ui/components/Text/text.types.ts +27 -0
  175. package/platforms/react-native/generators/init/files/ui/components/TextInput/Common.tsx +19 -0
  176. package/platforms/react-native/generators/init/files/ui/components/TextInput/index.ts +15 -0
  177. package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.pm.ts +65 -0
  178. package/platforms/react-native/generators/init/files/ui/components/TextInput/textInput.types.ts +16 -0
  179. package/platforms/react-native/generators/init/files/ui/components/ThemePicker/ThemePicker.tsx +92 -0
  180. package/platforms/react-native/generators/init/files/ui/components/ThemePicker/index.ts +1 -0
  181. package/platforms/react-native/generators/init/files/ui/components/index.ts +27 -0
  182. package/platforms/react-native/generators/init/files/ui/components/utils/color.ts +19 -0
  183. package/platforms/react-native/generators/init/files/ui/components/utils/index.ts +3 -0
  184. package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.spec.tsx +202 -0
  185. package/platforms/react-native/generators/init/files/ui/components/utils/useLoading.hook.ts +172 -0
  186. package/platforms/react-native/generators/init/files/ui/components/utils/useStore.ts +34 -0
  187. package/platforms/react-native/generators/init/files/ui/fonts/font-icons.ttf +0 -0
  188. package/platforms/react-native/generators/init/files/ui/icons/font-icons.json +53 -0
  189. package/platforms/react-native/generators/init/files/ui/icons/logo.png +0 -0
  190. package/platforms/react-native/generators/init/files/ui/icons/logo.svg +304 -0
  191. package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-1.png +0 -0
  192. package/platforms/react-native/generators/init/files/ui/icons/tabs/icon-2.png +0 -0
  193. package/platforms/react-native/generators/init/files/ui/theme/black/black.color.ts +8 -0
  194. package/platforms/react-native/generators/init/files/ui/theme/black/index.ts +10 -0
  195. package/platforms/react-native/generators/init/files/ui/theme/blue/blue.color.ts +8 -0
  196. package/platforms/react-native/generators/init/files/ui/theme/blue/index.ts +10 -0
  197. package/platforms/react-native/generators/init/files/ui/theme/green/green.color.ts +8 -0
  198. package/platforms/react-native/generators/init/files/ui/theme/green/index.ts +10 -0
  199. package/platforms/react-native/generators/init/files/ui/theme/index.ts +11 -0
  200. package/platforms/react-native/generators/init/files/ui/theme/pink/index.ts +10 -0
  201. package/platforms/react-native/generators/init/files/ui/theme/pink/pink.color.ts +8 -0
  202. package/platforms/react-native/generators/init/files/ui/theme/scheme/index.ts +23 -0
  203. package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.color.ts +139 -0
  204. package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.radius.ts +21 -0
  205. package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.spacing.ts +24 -0
  206. package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.ts +25 -0
  207. package/platforms/react-native/generators/init/files/ui/theme/scheme/theme.scheme.typography.ts +98 -0
  208. package/platforms/react-native/generators/init/files/ui/theme/shared/index.ts +4 -0
  209. package/platforms/react-native/generators/init/files/ui/theme/shared/shared.color.base.ts +79 -0
  210. package/platforms/react-native/generators/init/files/ui/theme/shared/shared.radius.ts +8 -0
  211. package/platforms/react-native/generators/init/files/ui/theme/shared/shared.spacing.ts +9 -0
  212. package/platforms/react-native/generators/init/files/ui/theme/shared/shared.typography.ts +105 -0
  213. package/platforms/react-native/generators/init/files/ui/theme/theme.hooks.ts +7 -0
  214. package/platforms/react-native/generators/init/files/ui/theme/theme.meta.ts +10 -0
  215. package/platforms/react-native/generators/init/files/ui/theme/theme.provider.tsx +19 -0
  216. package/platforms/react-native/generators/init/files/ui/theme/theme.service.ts +36 -0
  217. package/platforms/react-native/generators/init/files/ui/theme/theme.ts +27 -0
  218. package/platforms/react-native/generators/init/files/ui/widgets/index.ts +1 -0
  219. package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Item.tsx +175 -0
  220. package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Overlay.tsx +46 -0
  221. package/platforms/react-native/generators/init/files/ui/widgets/toast/Toast.Stack.tsx +75 -0
  222. package/platforms/react-native/generators/init/files/ui/widgets/toast/index.ts +7 -0
  223. package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.hooks.ts +18 -0
  224. package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.service.ts +39 -0
  225. package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.store.ts +59 -0
  226. package/platforms/react-native/generators/init/files/ui/widgets/toast/toast.types.ts +18 -0
  227. package/platforms/react-native/generators/init/files/ui/widgets/widgets.feature.ts +14 -0
  228. package/platforms/react-native/generators/init/files/utils/date.ts +11 -0
  229. package/platforms/react-native/generators/init/files/utils/index.ts +12 -0
  230. package/platforms/react-native/generators/init/files/utils/store.persistent.ts +103 -0
  231. package/platforms/react-native/generators/init/files/utils/store.registry.ts +14 -0
  232. package/platforms/react-native/generators/init/files/utils/string.ts +100 -0
  233. package/platforms/react-native/generators/init/generator.js +86 -0
  234. package/platforms/react-native/generators/init/kit.js +23 -0
  235. package/platforms/react-native/generators/init/navigators/expo-router/index.ts +18 -0
  236. package/platforms/react-native/generators/init/navigators/expo-router/navigation.app.ts +8 -0
  237. package/platforms/react-native/generators/init/navigators/expo-router/navigation.features.ts +9 -0
  238. package/platforms/react-native/generators/init/navigators/expo-router/navigation.hooks.ts +5 -0
  239. package/platforms/react-native/generators/init/navigators/expo-router/navigation.tabs.ts +7 -0
  240. package/platforms/react-native/generators/init/navigators/expo-router/navigation.widgets.ts +5 -0
  241. package/platforms/react-native/generators/init/navigators/react-navigation/index.ts +18 -0
  242. package/platforms/react-native/generators/init/navigators/react-navigation/navigation.app.ts +8 -0
  243. package/platforms/react-native/generators/init/navigators/react-navigation/navigation.features.ts +9 -0
  244. package/platforms/react-native/generators/init/navigators/react-navigation/navigation.hooks.ts +5 -0
  245. package/platforms/react-native/generators/init/navigators/react-navigation/navigation.tabs.ts +7 -0
  246. package/platforms/react-native/generators/init/navigators/react-navigation/navigation.widgets.ts +5 -0
  247. package/platforms/react-native/generators/setup/generator.js +225 -0
  248. package/platforms/react-native/generators/util/generator.js +12 -0
  249. package/platforms/react-native/platform.js +32 -0
  250. package/platforms/react-native/runtime.js +57 -0
  251. package/platforms/react-native/solutions/components/BottomSheet/README.md +29 -0
  252. package/platforms/react-native/solutions/components/BottomSheet/files/Common.tsx +120 -0
  253. package/platforms/react-native/solutions/components/BottomSheet/files/Content.tsx +57 -0
  254. package/platforms/react-native/solutions/components/BottomSheet/files/Context.tsx +22 -0
  255. package/platforms/react-native/solutions/components/BottomSheet/files/FlatList.tsx +50 -0
  256. package/platforms/react-native/solutions/components/BottomSheet/files/Header.tsx +57 -0
  257. package/platforms/react-native/solutions/components/BottomSheet/files/Search.tsx +24 -0
  258. package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.constants.ts +13 -0
  259. package/platforms/react-native/solutions/components/BottomSheet/files/bottomSheet.types.ts +31 -0
  260. package/platforms/react-native/solutions/components/BottomSheet/files/index.ts +33 -0
  261. package/platforms/react-native/solutions/components/BottomSheet/solution.js +38 -0
  262. package/platforms/react-native/solutions/components/BottomSheetWidgets/README.md +29 -0
  263. package/platforms/react-native/solutions/components/BottomSheetWidgets/files/SelectPicker.tsx +47 -0
  264. package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/Content.BottomSheet.tsx +22 -0
  265. package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/DateTimePicker.BottomSheet.tsx +74 -0
  266. package/platforms/react-native/solutions/components/BottomSheetWidgets/files/bottomSheet/List.BottomSheet.tsx +62 -0
  267. package/platforms/react-native/solutions/components/BottomSheetWidgets/solution.js +49 -0
  268. package/platforms/react-native/solutions/components/Calendar/README.md +29 -0
  269. package/platforms/react-native/solutions/components/Calendar/files/Common.tsx +16 -0
  270. package/platforms/react-native/solutions/components/Calendar/files/Context.tsx +466 -0
  271. package/platforms/react-native/solutions/components/Calendar/files/DayCell.tsx +89 -0
  272. package/platforms/react-native/solutions/components/Calendar/files/MonthView.tsx +41 -0
  273. package/platforms/react-native/solutions/components/Calendar/files/MonthYearOverlay.tsx +51 -0
  274. package/platforms/react-native/solutions/components/Calendar/files/SwipeablePeriod.tsx +44 -0
  275. package/platforms/react-native/solutions/components/Calendar/files/WeekDayTitles.tsx +31 -0
  276. package/platforms/react-native/solutions/components/Calendar/files/WeekView.tsx +40 -0
  277. package/platforms/react-native/solutions/components/Calendar/files/calendar.styles.ts +142 -0
  278. package/platforms/react-native/solutions/components/Calendar/files/calendar.types.ts +126 -0
  279. package/platforms/react-native/solutions/components/Calendar/files/calendar.utils.ts +143 -0
  280. package/platforms/react-native/solutions/components/Calendar/files/index.ts +40 -0
  281. package/platforms/react-native/solutions/components/Calendar/solution.js +38 -0
  282. package/platforms/react-native/solutions/components/Chart/README.md +29 -0
  283. package/platforms/react-native/solutions/components/Chart/files/Cilcular.tsx +140 -0
  284. package/platforms/react-native/solutions/components/Chart/files/index.ts +3 -0
  285. package/platforms/react-native/solutions/components/Chart/solution.js +38 -0
  286. package/platforms/react-native/solutions/components/CheckBox/README.md +29 -0
  287. package/platforms/react-native/solutions/components/CheckBox/files/Common.tsx +55 -0
  288. package/platforms/react-native/solutions/components/CheckBox/files/checkbox.pm.ts +71 -0
  289. package/platforms/react-native/solutions/components/CheckBox/files/index.ts +9 -0
  290. package/platforms/react-native/solutions/components/CheckBox/form/Checkbox.tsx +22 -0
  291. package/platforms/react-native/solutions/components/CheckBox/solution.js +57 -0
  292. package/platforms/react-native/solutions/components/DateTimePicker/README.md +29 -0
  293. package/platforms/react-native/solutions/components/DateTimePicker/files/DateTimePicker.tsx +44 -0
  294. package/platforms/react-native/solutions/components/DateTimePicker/solution.js +45 -0
  295. package/platforms/react-native/solutions/components/Image/README.md +29 -0
  296. package/platforms/react-native/solutions/components/Image/files/SVG.tsx +74 -0
  297. package/platforms/react-native/solutions/components/Image/files/image.pm.ts +25 -0
  298. package/platforms/react-native/solutions/components/Image/files/image.utils.ts +35 -0
  299. package/platforms/react-native/solutions/components/Image/files/index.ts +5 -0
  300. package/platforms/react-native/solutions/components/Image/solution.js +40 -0
  301. package/platforms/react-native/solutions/components/InputSecurity/README.md +29 -0
  302. package/platforms/react-native/solutions/components/InputSecurity/files/InputSecurity.ts +142 -0
  303. package/platforms/react-native/solutions/components/InputSecurity/solution.js +28 -0
  304. package/platforms/react-native/solutions/components/OTP/README.md +29 -0
  305. package/platforms/react-native/solutions/components/OTP/files/Item.tsx +16 -0
  306. package/platforms/react-native/solutions/components/OTP/files/Items.tsx +33 -0
  307. package/platforms/react-native/solutions/components/OTP/files/index.tsx +120 -0
  308. package/platforms/react-native/solutions/components/OTP/files/otp.pm.ts +30 -0
  309. package/platforms/react-native/solutions/components/OTP/solution.js +38 -0
  310. package/platforms/react-native/solutions/components/ProgressIndicator/README.md +29 -0
  311. package/platforms/react-native/solutions/components/ProgressIndicator/files/Circular.tsx +154 -0
  312. package/platforms/react-native/solutions/components/ProgressIndicator/files/Linear.tsx +133 -0
  313. package/platforms/react-native/solutions/components/ProgressIndicator/files/circular.pm.ts +34 -0
  314. package/platforms/react-native/solutions/components/ProgressIndicator/files/index.ts +16 -0
  315. package/platforms/react-native/solutions/components/ProgressIndicator/solution.js +39 -0
  316. package/platforms/react-native/solutions/components/Ruler/README.md +29 -0
  317. package/platforms/react-native/solutions/components/Ruler/files/Common.tsx +44 -0
  318. package/platforms/react-native/solutions/components/Ruler/files/Context.tsx +210 -0
  319. package/platforms/react-native/solutions/components/Ruler/files/Track.tsx +686 -0
  320. package/platforms/react-native/solutions/components/Ruler/files/Value.tsx +60 -0
  321. package/platforms/react-native/solutions/components/Ruler/files/index.ts +23 -0
  322. package/platforms/react-native/solutions/components/Ruler/files/ruler.constants.ts +70 -0
  323. package/platforms/react-native/solutions/components/Ruler/files/ruler.types.ts +98 -0
  324. package/platforms/react-native/solutions/components/Ruler/files/ruler.utils.ts +332 -0
  325. package/platforms/react-native/solutions/components/Ruler/solution.js +38 -0
  326. package/platforms/react-native/solutions/components/Section/README.md +29 -0
  327. package/platforms/react-native/solutions/components/Section/files/Common.tsx +144 -0
  328. package/platforms/react-native/solutions/components/Section/solution.js +37 -0
  329. package/platforms/react-native/solutions/components/Slider/README.md +29 -0
  330. package/platforms/react-native/solutions/components/Slider/files/Container.tsx +5 -0
  331. package/platforms/react-native/solutions/components/Slider/files/Content.tsx +44 -0
  332. package/platforms/react-native/solutions/components/Slider/files/Context.tsx +30 -0
  333. package/platforms/react-native/solutions/components/Slider/files/Pagination.Dot.tsx +61 -0
  334. package/platforms/react-native/solutions/components/Slider/files/index.ts +22 -0
  335. package/platforms/react-native/solutions/components/Slider/solution.js +38 -0
  336. package/platforms/react-native/solutions/components/Switch/README.md +29 -0
  337. package/platforms/react-native/solutions/components/Switch/files/Common.tsx +38 -0
  338. package/platforms/react-native/solutions/components/Switch/files/index.ts +9 -0
  339. package/platforms/react-native/solutions/components/Switch/files/switch.pm.ts +53 -0
  340. package/platforms/react-native/solutions/components/Switch/solution.js +38 -0
  341. package/platforms/react-native/solutions/install.js +97 -0
  342. package/platforms/react-native/solutions/services/firebase-core/README.md +31 -0
  343. package/platforms/react-native/solutions/services/firebase-core/files/index.ts +5 -0
  344. package/platforms/react-native/solutions/services/firebase-core/solution.js +39 -0
  345. package/platforms/react-native/solutions/services/firebase-messaging/README.md +31 -0
  346. package/platforms/react-native/solutions/services/firebase-messaging/files/index.ts +20 -0
  347. package/platforms/react-native/solutions/services/firebase-messaging/solution.js +42 -0
  348. package/platforms/react-native/solutions/utils/permissions/README.md +29 -0
  349. package/platforms/react-native/solutions/utils/permissions/files/permissions.ts +10 -0
  350. package/platforms/react-native/solutions/utils/permissions/solution.js +32 -0
  351. package/presets/react-native-fsd/index.js +25 -0
  352. package/shared/generators/entity/render.js +88 -0
  353. package/shared/generators/entity/templates/crud/api.ts.hbs +36 -0
  354. package/shared/generators/entity/templates/crud/dto.ts.hbs +36 -0
  355. package/shared/generators/entity/templates/crud/service.ts.hbs +73 -0
  356. package/shared/generators/entity/templates/crud/store.ts.hbs +27 -0
  357. package/shared/generators/entity/templates/index.ts.hbs +2 -0
  358. package/shared/generators/entity/templates/simple/api.ts.hbs +16 -0
  359. package/shared/generators/entity/templates/simple/dto.ts.hbs +5 -0
  360. package/shared/generators/entity/templates/simple/service.ts.hbs +26 -0
  361. package/shared/generators/entity/templates/simple/store.ts.hbs +18 -0
  362. package/shared/solutions/utils/date/README.md +29 -0
  363. package/shared/solutions/utils/date/files/date.ts +11 -0
  364. package/shared/solutions/utils/date/solution.js +27 -0
  365. package/shared/solutions/utils/string/README.md +29 -0
  366. package/shared/solutions/utils/string/files/string.ts +100 -0
  367. package/shared/solutions/utils/string/solution.js +27 -0
@@ -0,0 +1,74 @@
1
+ import { Prop, PropertyManager, Node, Static } from '@effijs/props-manager';
2
+
3
+ import iconCodes from '@icons/font-icons.json';
4
+
5
+ function getIconType(icon: string) {
6
+ if (isFontBasedIcon(icon)) {
7
+ return 'font';
8
+ } else if (typeof icon === 'string') {
9
+ return 'text';
10
+ }
11
+ return 'component';
12
+ }
13
+
14
+ function isFontBasedIcon(icon: string) {
15
+ return Object.prototype.hasOwnProperty.call(iconCodes, icon);
16
+ }
17
+
18
+ type TObject = Record<string, any>;
19
+
20
+ export const IconsPM = PropertyManager.create('Icons').node(
21
+ Node('container')
22
+ .extends('Grid')
23
+ .keys(
24
+ Static({
25
+ allowFontScaling: false,
26
+ }),
27
+ Prop('icon', ({ icon }: { icon: keyof typeof iconCodes | string }) => {
28
+ const type = getIconType(icon);
29
+ const res = {
30
+ type,
31
+ } as TObject;
32
+ if (type === 'font') {
33
+ res.children = String.fromCharCode(iconCodes[icon as keyof typeof iconCodes]);
34
+ }
35
+ return res;
36
+ }),
37
+ )
38
+ .keys(
39
+ 'style',
40
+ Prop('style', ({ style }) => style),
41
+ Prop(
42
+ ['color', 'icon', 'theme'],
43
+ ({ color, icon, theme: themeName }, { theme }) => {
44
+ const res = {} as TObject;
45
+ if (isFontBasedIcon(icon)) {
46
+ res.color = theme.get(`color.${color}`, themeName) ?? color;
47
+ }
48
+ return res;
49
+ },
50
+ { providers: ['theme'] },
51
+ ),
52
+ Prop(['icon', 'size'], (props: { icon: string; size: number | undefined } | TObject) => {
53
+ const type = getIconType(props.icon);
54
+
55
+ const baseSize = props.size || 24;
56
+ const scale = Math.min(1, 1);
57
+ const size = Math.round(baseSize * scale);
58
+
59
+ const res = {
60
+ width: size,
61
+ height: size,
62
+ } as TObject;
63
+ if (type === 'font') {
64
+ res.fontFamily = 'font-icons';
65
+ res.fontWeight = 'normal';
66
+ res.fontStyle = 'normal';
67
+ res.fontSize = size;
68
+ res.textAlign = 'center';
69
+ res.textAlignVertical = 'center';
70
+ }
71
+ return res;
72
+ }),
73
+ ),
74
+ );
@@ -0,0 +1,19 @@
1
+ import iconCodes from '@icons/font-icons.json';
2
+
3
+ export type TIconNames = keyof typeof iconCodes;
4
+
5
+ export interface IIconProps extends Record<string, unknown> {
6
+ icon: TIconNames;
7
+ size?: number;
8
+ color?: string;
9
+ /**
10
+ * Accessibility label for the icon. If not provided, the icon will be hidden from screen readers.
11
+ * Only provide this if the icon conveys important information not available elsewhere.
12
+ */
13
+ accessibilityLabel?: string;
14
+ /**
15
+ * Marks the icon as decorative. Decorative icons are hidden from screen readers.
16
+ * Defaults to true when no accessibilityLabel is provided.
17
+ */
18
+ isDecorative?: boolean;
19
+ }
@@ -0,0 +1,3 @@
1
+ import Icon from './Common';
2
+
3
+ export default Icon;
@@ -0,0 +1,10 @@
1
+ import { ProgressIndicator } from '@components';
2
+ import { loadingService } from '@components/Loading/loading.service.ts';
3
+
4
+ export default function Loading({ key }: { key: string }) {
5
+ const loading = loadingService.isLoading(key);
6
+
7
+ if (!loading) return null;
8
+
9
+ return <ProgressIndicator.Circular />;
10
+ }
@@ -0,0 +1,5 @@
1
+ import { loadingService } from '@components/Loading/loading.service.ts';
2
+
3
+ export const useLoading = ({ key }: { key: string }) => {
4
+ return loadingService.isLoading(key);
5
+ };
@@ -0,0 +1,22 @@
1
+ import { LoadingStore } from '@components/Loading/loading.store';
2
+
3
+ class LoadingService {
4
+ private readonly store = new LoadingStore();
5
+
6
+ async withLoading(handler: (...args: any[]) => Promise<any>, key: string) {
7
+ this.store.set(`loading.${key}`, true);
8
+ try {
9
+ await handler();
10
+ } catch (e) {
11
+ this.store.set(`error.${key}`, e?.message || '');
12
+ } finally {
13
+ this.store.set(`loading.${key}`, false);
14
+ }
15
+ }
16
+
17
+ isLoading(key: string) {
18
+ return this.store.getByPath(`loading.${key}`);
19
+ }
20
+ }
21
+
22
+ export const loadingService = new LoadingService();
@@ -0,0 +1,8 @@
1
+ import { Store } from '@effijs/common';
2
+
3
+ export type LoadingStoreState = {
4
+ loading?: Record<any, boolean>;
5
+ error?: Record<any, any>;
6
+ };
7
+
8
+ export class LoadingStore extends Store.Common<LoadingStoreState> {}
@@ -0,0 +1,87 @@
1
+ import { useNavigation } from '@effijs/navigation-react-native';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { Keyboard } from 'react-native';
4
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
5
+ import { KeyboardProvider } from 'react-native-keyboard-controller';
6
+ import { Navigation } from 'react-native-navigation';
7
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
8
+
9
+ import { Box, Grid, Text } from '@components';
10
+ import configs from '@configs';
11
+ import { Theme } from '@theme';
12
+
13
+ interface ICommonScreenProps {
14
+ label?: string;
15
+ children?: React.ReactNode;
16
+ withVisibility?: boolean;
17
+ }
18
+
19
+ export default function CommonScreen({ label, withVisibility, children }: ICommonScreenProps) {
20
+ const [isVisible, setIsVisible] = useState(true);
21
+
22
+ const { componentId } = useNavigation();
23
+
24
+ useEffect(() => {
25
+ if (!componentId) return;
26
+
27
+ const listener = {
28
+ componentDidAppear: () => {
29
+ console.log('RNN', `componentDidAppear`);
30
+ setIsVisible(true);
31
+ },
32
+ componentDidDisappear: () => {
33
+ console.log('RNN', `componentDidDisappear`);
34
+ setIsVisible(false);
35
+ },
36
+ };
37
+ const unsubscribe = Navigation.events().registerComponentListener(listener, componentId);
38
+ return () => {
39
+ unsubscribe.remove();
40
+ };
41
+ }, [componentId]);
42
+
43
+ if (withVisibility && !isVisible) return null;
44
+
45
+ const handleStartShouldSetResponder = () => {
46
+ Keyboard.dismiss();
47
+ return false;
48
+ };
49
+
50
+ return (
51
+ <SafeAreaProvider>
52
+ <KeyboardProvider>
53
+ <GestureHandlerRootView>
54
+ <Theme>
55
+ <Grid flex={1} row>
56
+ {label ? <ScreenLabel title={label} /> : null}
57
+ <Box flex={1} color="background" onStartShouldSetResponder={handleStartShouldSetResponder}>
58
+ {children}
59
+ </Box>
60
+ </Grid>
61
+ </Theme>
62
+ </GestureHandlerRootView>
63
+ </KeyboardProvider>
64
+ </SafeAreaProvider>
65
+ );
66
+ }
67
+
68
+ function ScreenLabel({ title }: { title: string }) {
69
+ return (
70
+ <Box width={48} row align-start color="primary">
71
+ <Text
72
+ family="Athena"
73
+ weight={300}
74
+ fontSize={24}
75
+ color="onPrimary"
76
+ mb-l
77
+ style={{
78
+ position: 'absolute',
79
+ top: 0,
80
+ left: -24,
81
+ transform: [{ rotate: '-90deg' }, { translateX: -100 }],
82
+ }}>
83
+ {title}
84
+ </Text>
85
+ </Box>
86
+ );
87
+ }
@@ -0,0 +1,77 @@
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
+ import { type LayoutChangeEvent, Platform } from 'react-native';
3
+ import { useAnimatedKeyboard } from 'react-native-keyboard-controller';
4
+ import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
+
7
+ import { Grid } from '@components';
8
+ import { GridPM } from '@components/Grid/grid.pm.ts';
9
+
10
+ export default function ScreenContent({
11
+ children,
12
+ scrollable,
13
+ 'sa-t': safeAreaTop,
14
+ 'sa-b': safeAreaBottom,
15
+ ...screenProps
16
+ }: {
17
+ children?: React.ReactNode;
18
+ scrollable?: boolean;
19
+ 'sa-t'?: boolean;
20
+ 'sa-b'?: boolean;
21
+ 'mh-s'?: boolean;
22
+ }) {
23
+ const props = GridPM.get({ flexGrow: 1, ...screenProps });
24
+ const [containerHeight, setContainerHeight] = useState(0);
25
+ const [contentHeight, setContentHeight] = useState(0);
26
+ const animatedKeyboard = useAnimatedKeyboard();
27
+ const { top, bottom } = useSafeAreaInsets();
28
+
29
+ const onContainerLayout = useCallback(
30
+ ({
31
+ nativeEvent: {
32
+ layout: { height },
33
+ },
34
+ }: LayoutChangeEvent) => {
35
+ setContainerHeight(height);
36
+ },
37
+ [],
38
+ );
39
+
40
+ const autoScrollable = useMemo(() => contentHeight > containerHeight, [contentHeight, containerHeight]);
41
+ const isScrollable = scrollable ?? autoScrollable;
42
+
43
+ const keyboardHeight = useAnimatedStyle(
44
+ () => ({
45
+ height:
46
+ (Platform.OS === 'ios' ? animatedKeyboard.height.value : 0) ||
47
+ (safeAreaBottom ? bottom : 0) ||
48
+ (Platform.OS === 'android' ? 24 : 0) ||
49
+ 0,
50
+ }),
51
+ [safeAreaBottom, bottom],
52
+ );
53
+
54
+ if (scrollable === false) {
55
+ return (
56
+ <Grid flex={1} onLayout={onContainerLayout} pt={safeAreaTop ? top : 0} style={props.container?.style}>
57
+ {children}
58
+ <Animated.View style={keyboardHeight} />
59
+ </Grid>
60
+ );
61
+ }
62
+
63
+ return (
64
+ <Grid flex={1} onLayout={onContainerLayout} pt={safeAreaTop ? top : 0}>
65
+ <Animated.ScrollView
66
+ scrollEnabled={isScrollable}
67
+ showsVerticalScrollIndicator={false}
68
+ showsHorizontalScrollIndicator={false}
69
+ keyboardShouldPersistTaps="handled"
70
+ contentContainerStyle={props.container?.style}
71
+ onContentSizeChange={(_, height) => setContentHeight(height)}>
72
+ {children}
73
+ <Animated.View style={keyboardHeight} />
74
+ </Animated.ScrollView>
75
+ </Grid>
76
+ );
77
+ }
@@ -0,0 +1,80 @@
1
+ import { useNavigation } from '@effijs/navigation-react-native';
2
+ import { Platform } from 'react-native';
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
+
5
+ import { Button, Grid, Text } from '@components';
6
+ import { theme, useTheme } from '@theme';
7
+
8
+ export default function Header({
9
+ type = 'modal',
10
+ title,
11
+ logo,
12
+ onBack,
13
+ }: {
14
+ type?: 'modal' | 'tab' | 'push';
15
+ title?: string;
16
+ logo?: boolean;
17
+ onBack?: () => boolean | Promise<boolean>;
18
+ }) {
19
+ const { top } = useSafeAreaInsets();
20
+ const { close } = useNavigation();
21
+ const themeName = useTheme();
22
+
23
+ return (
24
+ <Grid row>
25
+ <Grid min-height={60} flex={1} width="100%" mt={top} pt-s={Platform.OS === 'android'} center mb-l={!!logo}>
26
+ <Grid absolute center pt-s={Platform.OS === 'android'}>
27
+ <Text fontSize={22} color="outline">
28
+ {title}
29
+ </Text>
30
+ </Grid>
31
+ <Grid absolute center pt-s={Platform.OS === 'android'}>
32
+ <Grid>
33
+ {logo
34
+ ? null
35
+ : /*<Image.Native
36
+ source={require('@images/logo.png')}
37
+ tintColor={theme.color.primary}
38
+ style={{ width: 60, height: 60 }}
39
+ width={60}
40
+ height={60}
41
+ />*/
42
+ null}
43
+ {/*{logo ? <Image.SVG image={require('@icons/logo.svg')} width={60} height={60} color="primary" /> : null}*/}
44
+ </Grid>
45
+ </Grid>
46
+
47
+ <Grid row space-between ph-s>
48
+ <Grid>
49
+ {type === 'push' ? (
50
+ <Button
51
+ type="text"
52
+ leadingIcon="back"
53
+ withoutLoadingIndicator
54
+ size={40}
55
+ onPress={async () => {
56
+ if ((onBack && (await onBack?.())) || !onBack) {
57
+ close?.();
58
+ }
59
+ }}
60
+ />
61
+ ) : null}
62
+ </Grid>
63
+ <Grid flex={1} />
64
+ <Grid>
65
+ {type === 'modal' ? (
66
+ <Button
67
+ type="filled"
68
+ leadingIcon="close"
69
+ withoutLoadingIndicator
70
+ round="xxl"
71
+ size={40}
72
+ onPress={() => close?.()}
73
+ />
74
+ ) : null}
75
+ </Grid>
76
+ </Grid>
77
+ </Grid>
78
+ </Grid>
79
+ );
80
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Platform } from 'react-native';
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
+
5
+ import { Box, Grid } from '@components';
6
+
7
+ export default function HeaderTab({ children }: { children: React.ReactNode }) {
8
+ const { top } = useSafeAreaInsets();
9
+
10
+ return (
11
+ <Box shadow-s width="100%" color="onBackgroundSecondVariant" style={{ zIndex: 100 }}>
12
+ <Grid min-height={60} mt={top} pt-s={Platform.OS === 'android'} pb-s>
13
+ {children}
14
+ </Grid>
15
+ </Box>
16
+ );
17
+ }
@@ -0,0 +1,9 @@
1
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
2
+
3
+ export default function SafeAreaHOC(Component: any) {
4
+ return (props: any) => (
5
+ <SafeAreaProvider pointerEvents="box-none">
6
+ <Component {...props} />
7
+ </SafeAreaProvider>
8
+ );
9
+ }
@@ -0,0 +1,22 @@
1
+ import Common from './Common';
2
+ import Content from './Content';
3
+ import Header from './Header';
4
+ import HeaderTab from './HeaderTab';
5
+
6
+ type TCommon = typeof Common;
7
+ type THeader = typeof Header;
8
+ type THeaderTab = typeof HeaderTab;
9
+ type TContent = typeof Content;
10
+
11
+ interface IScreen extends TCommon {
12
+ Content: TContent;
13
+ Header: THeader;
14
+ HeaderTab: THeaderTab;
15
+ }
16
+
17
+ const Screen = Common as IScreen;
18
+ Screen.Content = Content;
19
+ Screen.Header = Header;
20
+ Screen.HeaderTab = HeaderTab;
21
+
22
+ export default Screen;
@@ -0,0 +1,20 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Text, TextProps } from 'react-native';
3
+
4
+ import { useTheme, TThemeColor } from '@theme';
5
+
6
+ import { TGridProps } from '../Grid/grid.types';
7
+
8
+ import { TextPM } from './text.pm';
9
+ import { TTextProps } from './text.types';
10
+
11
+ const TextCommon = forwardRef<Text, TTextProps<TThemeColor> & TGridProps & TextProps>(
12
+ ({ children, ...commonProps }, ref) => {
13
+ const theme = useTheme();
14
+ const { container } = TextPM.get({ theme, ...commonProps });
15
+
16
+ return <Text ref={ref} {...container} children={children} />;
17
+ },
18
+ );
19
+
20
+ export default TextCommon;
@@ -0,0 +1,13 @@
1
+ import Common from './Common';
2
+ import { TextPM } from './text.pm';
3
+
4
+ type TCommon = typeof Common;
5
+
6
+ interface IText extends TCommon {
7
+ PM: typeof TextPM;
8
+ }
9
+
10
+ const Text = Common as IText;
11
+ Text.PM = TextPM;
12
+
13
+ export default Text;
@@ -0,0 +1,55 @@
1
+ import { Pattern, Prop, Node, PropertyManager, Static } from '@effijs/props-manager';
2
+ import { Platform } from 'react-native';
3
+
4
+ export const TextPM = PropertyManager.create('Text').node(
5
+ Node('container')
6
+ .extends('Grid')
7
+ .keys(
8
+ 'style',
9
+ Prop('style', ({ style }) => style),
10
+ Pattern('{n}', ({ theme }) => theme?.typography, { providers: ['theme'] }).key(
11
+ '{n}',
12
+ v => v as Record<string, unknown>,
13
+ ),
14
+ Prop(
15
+ ['color', 'theme'],
16
+ ({ color, theme: themeName }, { theme }) => ({
17
+ color: theme.get(`color.${color}`, themeName) ?? color,
18
+ }),
19
+ { providers: ['theme'] },
20
+ ),
21
+ Prop('center', { textAlign: 'center', textAlignVertical: 'center' }),
22
+ // Prop('flex', { flex: 1 }),
23
+ Prop('weight', ({ weight }: { weight: number | 'bold' | 'normal' }) => ({
24
+ fontWeight: weight,
25
+ })),
26
+ Prop('fontSize', 'fontSize'),
27
+ Prop('lineHeight', 'lineHeight'),
28
+ Prop('underline', {
29
+ textDecorationLine: 'underline',
30
+ textDecorationStyle: 'solid',
31
+ }),
32
+ Prop(
33
+ 'family',
34
+ ({ family }) => {
35
+ const fontFamily =
36
+ family === 'Athena'
37
+ ? Platform.OS === 'ios'
38
+ ? 'Athena'
39
+ : 'Athena-Light'
40
+ : Platform.OS === 'ios'
41
+ ? 'SF Pro Display'
42
+ : undefined;
43
+
44
+ return fontFamily ? { fontFamily } : {};
45
+ },
46
+ { nullWhenFirstKeyNull: false },
47
+ ),
48
+ )
49
+ .keys(
50
+ Static({
51
+ allowFontScaling: false,
52
+ }),
53
+ Prop('onPress', 'onPress'),
54
+ ),
55
+ );
@@ -0,0 +1,27 @@
1
+ type TTextSizes = 's' | 'm' | 'l';
2
+ type TFontWeight = 'bold' | 'normal' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
3
+
4
+ type TSpacingProps<Prefix extends string> = {
5
+ [Size in TTextSizes as `${Prefix}-${Size}`]?: boolean;
6
+ };
7
+
8
+ type TFontFamily = 'SF Pro Display' | 'Athena';
9
+
10
+ export interface TTextProps<TThemeColor>
11
+ extends
12
+ TSpacingProps<'title'>,
13
+ TSpacingProps<'label'>,
14
+ TSpacingProps<'body'>,
15
+ TSpacingProps<'display'>,
16
+ TSpacingProps<'headline'> {
17
+ color?: TThemeColor;
18
+ weight?: TFontWeight;
19
+ disabled?: boolean;
20
+ error?: boolean;
21
+ center?: boolean;
22
+ family?: TFontFamily;
23
+
24
+ fontSize?: number;
25
+ lineHeight?: number;
26
+ underline?: boolean;
27
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { TextInput, TextInputProps } from 'react-native';
3
+
4
+ import { useTheme } from '@theme';
5
+
6
+ import { TextInputPM } from './textInput.pm';
7
+ import type { TTextProps } from './textInput.types';
8
+
9
+ export default function TextInputCommon<TThemeColor>({
10
+ onChangeText,
11
+ ...textInputProps
12
+ }: TextInputProps & TTextProps<TThemeColor>) {
13
+ const theme = useTheme();
14
+ const { container } = TextInputPM.get({ theme, ...textInputProps });
15
+
16
+ delete container.style.lineHeight;
17
+
18
+ return <TextInput numberOfLines={1} multiline={false} {...container} onChangeText={onChangeText} />;
19
+ }
@@ -0,0 +1,15 @@
1
+ import Common from './Common';
2
+ import { TextInputPM } from './textInput.pm';
3
+ // forge:text-input-import
4
+
5
+ type TCommon = typeof Common;
6
+
7
+ interface ITextInput extends TCommon {
8
+ PM: typeof TextInputPM;
9
+ }
10
+
11
+ const TextInput = Common as ITextInput;
12
+ TextInput.PM = TextInputPM;
13
+ // forge:text-input-slots
14
+
15
+ export default TextInput;
@@ -0,0 +1,65 @@
1
+ import { PropertyManager, Static, Node, Prop } from '@effijs/props-manager';
2
+
3
+ export const TextInputPM = PropertyManager.create('TextInput').node(
4
+ Node('container')
5
+ .extends('Text')
6
+ .keys(
7
+ 'style',
8
+ Prop('style', ({ style }) => style),
9
+ Static({
10
+ textDecorationLine: 'none',
11
+ textAlignVertical: 'center',
12
+ // lineHeight: 32,
13
+ color: '#363636',
14
+ // cursor: 'none',
15
+ }),
16
+ )
17
+ .keys(
18
+ Static({
19
+ flex: 1,
20
+ allowFontScaling: false,
21
+ placeholderTextColor: '#8A8A8A',
22
+ family: 'SF Pro Display',
23
+ underlineColorAndroid: 'transparent',
24
+ }),
25
+ Prop(
26
+ ['placeholderColor', 'theme'],
27
+ ({ placeholderColor, theme: themeName }, { theme }) => ({
28
+ placeholderTextColor: theme.get(`color.${placeholderColor || 'onSurfaceVariant'}`, themeName) ?? undefined,
29
+ }),
30
+ { nullWhenFirstKeyNull: false, providers: ['theme'] },
31
+ ),
32
+ Prop(
33
+ 'theme',
34
+ ({ theme: themeName }, { theme }) => {
35
+ const color = theme.get(`color.outline`, themeName) ?? undefined;
36
+ if (color) {
37
+ return {
38
+ cursorColor: color,
39
+ // selectionColor: `${color}80`,
40
+ color: 'outline',
41
+ };
42
+ }
43
+ return {
44
+ color: 'outline',
45
+ };
46
+ },
47
+ { providers: ['theme'], nullWhenFirstKeyNull: false },
48
+ ),
49
+ ),
50
+ );
51
+ /*.styles(
52
+ Provider('theme', theme =>
53
+ Pattern('{n}', theme.typography).key(
54
+ '{n}',
55
+ v => v as Record<string, unknown>,
56
+ ),
57
+ ),
58
+ Provider('theme', theme =>
59
+ Prop('color', ({ color }: TObject) => ({
60
+ color: theme.color.hasKey(color) ? theme.color[color] : color,
61
+ })),
62
+ ),
63
+ Prop('center', { textAlign: 'center', textAlignVertical: 'center' }),
64
+ Prop('flex', { flex: 1 }),
65
+ )*/