@effijs/templates 0.0.0-stage → 1.0.0-alpha.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 (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,224 @@
1
+ import { writeSummary } from '../../../../lib/journal.js';
2
+ import { projectRoot } from '../../../../lib/project.js';
3
+ import { ALL_SCREENS, featurePrompts, prepareFeature } from './render.js';
4
+
5
+ function screenPascal(screen) {
6
+ return screen.charAt(0).toUpperCase() + screen.slice(1);
7
+ }
8
+
9
+ function skipScreen(screen, existsKey) {
10
+ return (data) => !data.screens.includes(screen) || (Boolean(data.dryRun) && existsKey && !data[existsKey]);
11
+ }
12
+
13
+ function screenActions(screen) {
14
+ const pascal = screenPascal(screen);
15
+ const props = screen === 'detail'
16
+ ? '{{feature.pascal}}DetailScreenProps'
17
+ : screen === 'form'
18
+ ? '{{feature.pascal}}FormScreenProps'
19
+ : 'Record<string, never>';
20
+ const style = screen === 'filter' ? 'overlay' : 'modal';
21
+ return [
22
+ {
23
+ type: 'add',
24
+ path: `feature/{{feature.kebab}}/${screen}/{{feature.kebab}}.${screen}.service.ts`,
25
+ templateFile: `feature/templates/${screen}.service.ts.hbs`,
26
+ skip: skipScreen(screen),
27
+ },
28
+ {
29
+ type: 'add',
30
+ path: `feature/{{feature.kebab}}/${screen}/{{feature.pascal}}.${pascal}.Screen.tsx`,
31
+ templateFile: `feature/templates/${screen}.screen.tsx.hbs`,
32
+ skip: skipScreen(screen),
33
+ },
34
+ {
35
+ type: 'append',
36
+ path: 'feature/{{feature.kebab}}/{{feature.kebab}}.feature.ts',
37
+ pattern: /\/\/ forge:feature-services-import$/m,
38
+ before: true,
39
+ unique: true,
40
+ template: `import { {{feature.pascal}}${pascal}Service } from './${screen}/{{feature.kebab}}.${screen}.service';\n`,
41
+ skip: skipScreen(screen, 'featureExists'),
42
+ },
43
+ {
44
+ type: 'append',
45
+ path: 'feature/{{feature.kebab}}/{{feature.kebab}}.feature.ts',
46
+ pattern: / \/\/ forge:feature-ctor$/m,
47
+ before: true,
48
+ unique: true,
49
+ template: ` readonly ${screen}: {{feature.pascal}}${pascal}Service,\n`,
50
+ skip: skipScreen(screen, 'featureExists'),
51
+ },
52
+ {
53
+ type: 'append',
54
+ path: 'feature/{{feature.kebab}}/index.ts',
55
+ pattern: /\/\/ forge:feature-screens$/m,
56
+ before: true,
57
+ unique: true,
58
+ template: `import './${screen}/{{feature.kebab}}.${screen}.service';\n`,
59
+ skip: skipScreen(screen, 'featureIndexExists'),
60
+ },
61
+ {
62
+ type: 'append',
63
+ path: 'navigation/navigation.{{feature.kebab}}.ts',
64
+ pattern: /\/\/ forge:navigation-screen-import$/m,
65
+ before: true,
66
+ unique: true,
67
+ template: `import {{feature.pascal}}${pascal}Screen from '@feature/{{feature.kebab}}/${screen}/{{feature.pascal}}.${pascal}.Screen';\n`,
68
+ skip: skipScreen(screen, 'navExists'),
69
+ },
70
+ {
71
+ type: 'append',
72
+ path: 'navigation/navigation.{{feature.kebab}}.ts',
73
+ pattern: / \/\/ forge:navigation-methods$/m,
74
+ before: true,
75
+ unique: true,
76
+ template: ` @Decorators.Register('${pascal}', {{feature.pascal}}${pascal}Screen)
77
+ ${screen}(props: ${props} = {} as ${props}, componentId?: string) {
78
+ return super.navigate('${pascal}', componentId).${style}(props);
79
+ }
80
+
81
+ `,
82
+ skip: skipScreen(screen, 'navExists'),
83
+ },
84
+ ];
85
+ }
86
+
87
+ export default {
88
+ description: 'Add a feature slice and the screens you select',
89
+ prompts: featurePrompts,
90
+ actions: [
91
+ {
92
+ type: 'custom',
93
+ action: (data, forge) => prepareFeature(data, forge),
94
+ },
95
+ {
96
+ type: 'add',
97
+ path: 'feature/{{feature.kebab}}/{{feature.kebab}}.feature.ts',
98
+ templateFile: 'feature/templates/feature.ts.hbs',
99
+ },
100
+ {
101
+ type: 'add',
102
+ path: 'feature/{{feature.kebab}}/{{feature.kebab}}.hooks.ts',
103
+ templateFile: 'feature/templates/hooks.ts.hbs',
104
+ },
105
+ {
106
+ type: 'add',
107
+ path: 'feature/{{feature.kebab}}/index.ts',
108
+ templateFile: 'feature/templates/index.ts.hbs',
109
+ },
110
+ {
111
+ type: 'add',
112
+ path: 'navigation/navigation.{{feature.kebab}}.ts',
113
+ templateFile: 'feature/templates/navigation.ts.hbs',
114
+ },
115
+ ...ALL_SCREENS.flatMap((screen) => screenActions(screen)),
116
+ {
117
+ type: 'add',
118
+ path: 'feature/{{feature.kebab}}/list/{{feature.pascal}}.List.Item.tsx',
119
+ templateFile: 'feature/templates/list.item.tsx.hbs',
120
+ skip: (data) => !data.screens.includes('list') && !data.screens.includes('search'),
121
+ },
122
+ {
123
+ type: 'add',
124
+ path: 'app/tabs/{{feature.kebab}}/{{feature.pascal}}.tab.tsx',
125
+ templateFile: 'feature/templates/tab.tsx.hbs',
126
+ skip: (data) => !data.tab,
127
+ },
128
+ {
129
+ type: 'append',
130
+ path: 'feature/index.ts',
131
+ pattern: /\/\/ forge:feature$/m,
132
+ before: true,
133
+ unique: true,
134
+ template: "import './{{feature.kebab}}';\n",
135
+ },
136
+ {
137
+ type: 'append',
138
+ path: 'navigation/navigation.features.ts',
139
+ pattern: /\/\/ forge:navigation-features-import$/m,
140
+ before: true,
141
+ unique: true,
142
+ template: "import { Navigation{{feature.pascal}} } from './navigation.{{feature.kebab}}';\n",
143
+ },
144
+ {
145
+ type: 'append',
146
+ path: 'navigation/navigation.features.ts',
147
+ pattern: / \/\/ forge:navigation-features$/m,
148
+ before: true,
149
+ unique: true,
150
+ template: ' public {{feature.camel}}: Navigation{{feature.pascal}},\n',
151
+ },
152
+ {
153
+ type: 'append',
154
+ path: 'navigation/navigation.tabs.ts',
155
+ pattern: / \/\/ forge:navigation-tabs$/m,
156
+ before: true,
157
+ unique: true,
158
+ template: ` {
159
+ stack: {
160
+ children: [{ component: { name: 'Tabs.{{feature.pascal}}', id: 'Tabs.{{feature.pascal}}' } }],
161
+ options: { bottomTab: { text: '{{feature.pascal}}' } },
162
+ },
163
+ },
164
+ `,
165
+ skip: (data) => !data.tab || !data.wixTabs,
166
+ },
167
+ {
168
+ type: 'append',
169
+ path: 'navigation/navigation.tabs.ts',
170
+ pattern: / \/\/ forge:navigation-tabs-register$/m,
171
+ before: true,
172
+ unique: true,
173
+ template: " @Decorators.Register('{{feature.pascal}}', require('@app/tabs/{{feature.kebab}}/{{feature.pascal}}.tab').default)\n {{feature.camel}}Tab() {}\n",
174
+ skip: (data) => !data.tab || !data.wixTabs,
175
+ },
176
+ {
177
+ type: 'append',
178
+ path: 'navigation/navigation.tabs.ts',
179
+ pattern: / \/\/ forge:navigation-tabs-register$/m,
180
+ before: true,
181
+ unique: true,
182
+ template: ' // TODO: show the {{feature.pascal}} tab in {{tabNavigatorLabel}}\n open{{feature.pascal}}() {}\n',
183
+ skip: (data) => !data.tab || data.wixTabs,
184
+ },
185
+ {
186
+ type: 'custom',
187
+ action: async (data, forge) => {
188
+ const feature = data.feature;
189
+ const lines = [...(data.screenNotes ?? [])];
190
+ lines.push(`Registered navigation.features.${feature.camel}`);
191
+ if (data.tab && !data.wixTabs) lines.push(`${data.navigatorName} tab is a TODO in navigation.tabs.ts`);
192
+ if (data.tab) lines.push(`Tab: ${feature.pascal}`);
193
+ lines.push(
194
+ `Screens: ${data.screens.join(', ') || 'none'}`,
195
+ `Hook: use${feature.pascal}Feature()`,
196
+ `Navigation: navigation.features.${feature.camel}`,
197
+ );
198
+ const files = [
199
+ `feature/${feature.kebab}/${feature.kebab}.feature.ts`,
200
+ `feature/${feature.kebab}/${feature.kebab}.hooks.ts`,
201
+ `feature/${feature.kebab}/index.ts`,
202
+ ];
203
+ for (const screen of data.screens) {
204
+ const pascal = screenPascal(screen);
205
+ files.push(`feature/${feature.kebab}/${screen}/${feature.kebab}.${screen}.service.ts`);
206
+ files.push(`feature/${feature.kebab}/${screen}/${feature.pascal}.${pascal}.Screen.tsx`);
207
+ }
208
+ if (data.screens.includes('list') || data.screens.includes('search')) {
209
+ files.push(`feature/${feature.kebab}/list/${feature.pascal}.List.Item.tsx`);
210
+ }
211
+ files.push(`navigation/navigation.${feature.kebab}.ts`);
212
+ if (data.tab) files.push(`app/tabs/${feature.kebab}/${feature.pascal}.tab.tsx`);
213
+ lines.push(...files.map((file) => `File: ${file}`), 'Open the feature from a tab or from an existing screen.');
214
+ await writeSummary(projectRoot(forge), {
215
+ generator: 'feature',
216
+ name: feature.kebab,
217
+ lines,
218
+ dryRun: data.dryRun,
219
+ });
220
+ return { success: true };
221
+ },
222
+ },
223
+ ],
224
+ };
@@ -0,0 +1,163 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+
4
+ import { namesOf } from '../../../../lib/names.js';
5
+ import { listDirs } from '../../../../lib/project.js';
6
+
7
+ export const ALL_SCREENS = ['list', 'detail', 'form', 'filter', 'search'];
8
+
9
+ export function parseScreens(value) {
10
+ if (!value || value === 'all') return [...ALL_SCREENS];
11
+ const list = Array.isArray(value) ? value : String(value).split(',');
12
+ return [...new Set(list.map((item) => String(item).trim()).filter(Boolean))];
13
+ }
14
+
15
+ export function normalizeScreens(screens) {
16
+ const next = [...screens];
17
+ const notes = [];
18
+ if (next.includes('filter') && !next.includes('list')) {
19
+ next.push('list');
20
+ notes.push('filter applies to a list, so list was added');
21
+ }
22
+ return { screens: ALL_SCREENS.filter((screen) => next.includes(screen)), notes };
23
+ }
24
+
25
+ export function featurePrompts(forge) {
26
+ const outputDir = forge.resolveOutputDir('rn-fsd:feature');
27
+ const entities = listDirs(path.join(outputDir, 'entity'));
28
+ return [
29
+ {
30
+ type: 'input',
31
+ name: 'name',
32
+ message: 'Feature name:',
33
+ validate: (input) => (input?.trim() ? true : 'Feature name is required'),
34
+ },
35
+ {
36
+ type: 'list',
37
+ name: 'entity',
38
+ message: 'Entity:',
39
+ choices: [...entities.map((name) => ({ name, value: name })), { name: 'Create a new entity', value: '__new__' }],
40
+ default: entities[0] ?? '__new__',
41
+ },
42
+ {
43
+ type: 'list',
44
+ name: 'variant',
45
+ message: 'New entity variant:',
46
+ when: (answers) => answers.entity === '__new__',
47
+ choices: ['crud', 'simple'],
48
+ default: 'crud',
49
+ },
50
+ {
51
+ type: 'input',
52
+ name: 'apiUrl',
53
+ message: 'API resource path:',
54
+ when: (answers) => answers.entity === '__new__',
55
+ default: (answers) => namesOf(answers.name).plural,
56
+ },
57
+ {
58
+ type: 'input',
59
+ name: 'fields',
60
+ message: 'Entity fields:',
61
+ when: (answers) => answers.entity === '__new__',
62
+ default: '',
63
+ },
64
+ {
65
+ type: 'checkbox',
66
+ name: 'screens',
67
+ message: 'Screens:',
68
+ choices: ALL_SCREENS.map((screen) => ({ name: screen, value: screen, checked: ['list', 'detail', 'form'].includes(screen) })),
69
+ default: ['list', 'detail', 'form'],
70
+ },
71
+ {
72
+ type: 'confirm',
73
+ name: 'tab',
74
+ message: 'Add a bottom tab?',
75
+ default: false,
76
+ },
77
+ ];
78
+ }
79
+
80
+ function listCalls(data) {
81
+ const feature = data.feature.camel;
82
+ const calls = [];
83
+ if (data.screens.includes('detail')) calls.push(` openDetail(id: string) { this.navigation.features.${feature}.detail({ id }); }`);
84
+ if (data.screens.includes('form')) calls.push(` openCreate() { this.navigation.features.${feature}.form({ mode: 'create', data: {} }); }`);
85
+ if (data.screens.includes('search')) calls.push(` openSearch() { this.navigation.features.${feature}.search({}); }`);
86
+ if (data.screens.includes('filter')) calls.push(` openFilter() { this.navigation.features.${feature}.filter({}); }`);
87
+ return calls.join('\n\n');
88
+ }
89
+
90
+ function failure(result, fallback) {
91
+ if (result?.error) return result.error;
92
+ const failed = result?.results?.find((item) => item && item.success === false);
93
+ return failed?.error || fallback;
94
+ }
95
+
96
+ export async function prepareFeature(data, forge) {
97
+ if (data.tab === 'true') data.tab = true;
98
+ if (data.tab === 'false') data.tab = false;
99
+ if (!data.name || !String(data.name).trim()) {
100
+ return { success: false, error: 'Feature name is required. Pass --name.' };
101
+ }
102
+
103
+ const parsed = parseScreens(data.screens);
104
+ const unknown = parsed.filter((screen) => !ALL_SCREENS.includes(screen));
105
+ if (unknown.length) return { success: false, error: `Unknown screens: ${unknown.join(', ')}` };
106
+ const normalized = normalizeScreens(parsed);
107
+ data.screens = normalized.screens;
108
+ data.screenNotes = [...normalized.notes];
109
+
110
+ const feature = namesOf(data.name);
111
+ data.feature = feature;
112
+ data.dryRun = Boolean(data.dryRun || forge.runOptions?.dryRun);
113
+ data.force = Boolean(data.force || forge.runOptions?.force);
114
+
115
+ const outputDir = forge.resolveOutputDir('rn-fsd:feature');
116
+ const featureIndex = path.join(outputDir, 'feature/index.ts');
117
+ const featuresFile = path.join(outputDir, 'navigation/navigation.features.ts');
118
+ if (!fs.existsSync(featureIndex) || !fs.existsSync(featuresFile)) {
119
+ return { success: false, error: 'Run forge g init before forge g feature.' };
120
+ }
121
+ const tabsFile = path.join(outputDir, 'navigation/navigation.tabs.ts');
122
+ if (data.tab && !fs.existsSync(tabsFile)) {
123
+ return { success: false, error: 'navigation.tabs.ts is missing.' };
124
+ }
125
+
126
+ if (!data.entity || data.entity === '__new__') {
127
+ const created = await forge.run('rn-fsd:entity', {
128
+ yes: true,
129
+ name: feature.pascal,
130
+ apiUrl: data.apiUrl || feature.plural,
131
+ variant: data.variant || 'crud',
132
+ fields: data.fields ?? '',
133
+ dryRun: data.dryRun,
134
+ force: data.force,
135
+ });
136
+ if (!created.success) {
137
+ return { success: false, error: failure(created, 'Failed to create entity') };
138
+ }
139
+ data.entity = feature.kebab;
140
+ data.screenNotes.push(`Created entity ${feature.kebab}`);
141
+ }
142
+
143
+ data.entityNames = namesOf(data.entity);
144
+ data.listCalls = listCalls(data);
145
+ data.detailEdit = data.screens.includes('form')
146
+ ? ` openEdit(entity: ${data.entityNames.pascal}Data) { return this.navigation.features.${feature.camel}.form({ mode: 'edit', data: entity }); }`
147
+ : '';
148
+
149
+ const featureDir = path.join(outputDir, 'feature', feature.kebab);
150
+ data.featureExists = fs.existsSync(path.join(featureDir, `${feature.kebab}.feature.ts`));
151
+ data.featureIndexExists = fs.existsSync(path.join(featureDir, 'index.ts'));
152
+ data.navExists = fs.existsSync(path.join(outputDir, 'navigation', `navigation.${feature.kebab}.ts`));
153
+ if (data.featureExists) {
154
+ data.screenNotes.push(`Feature ${feature.kebab} already exists. Adding only the new screens.`);
155
+ }
156
+
157
+ const tabs = fs.existsSync(tabsFile) ? fs.readFileSync(tabsFile, 'utf8') : '';
158
+ const navigator = forge.config.navigator;
159
+ data.navigatorName = navigator;
160
+ data.tabNavigatorLabel = navigator ?? 'the stub navigator';
161
+ data.wixTabs = navigator === 'react-native-navigation' && /\/\/ forge:navigation-tabs$/m.test(tabs);
162
+ return null;
163
+ }
@@ -0,0 +1,25 @@
1
+ import React, { useEffect } from 'react';
2
+
3
+ import { Button, Grid, Screen, Text, useStore } from '@components';
4
+ import { use{{feature.pascal}}Feature } from '@feature/{{feature.kebab}}/{{feature.kebab}}.hooks';
5
+
6
+ export default function {{feature.pascal}}DetailScreen({ id }: { id: string }) {
7
+ const feature = use{{feature.pascal}}Feature();
8
+ const item = useStore(feature.store, `{{entityNames.kebab}}.${id}`);
9
+
10
+ useEffect(() => {
11
+ feature.detail.load(id).id('{{feature.kebab}}-detail').run();
12
+ }, [id]);
13
+
14
+ return (
15
+ <Screen>
16
+ <Screen.Header title="{{feature.pascal}}" />
17
+ <Screen.Content sa-b>
18
+ <Grid mh-s mt-l>
19
+ <Text display-s color="outline">{item?.title ?? item?.name ?? id}</Text>
20
+ {{#if (includes screens "form")}}<Button type="filled" mt-l onPress={() => item && feature.detail.openEdit(item)}>Edit</Button>{{/if}}
21
+ </Grid>
22
+ </Screen.Content>
23
+ </Screen>
24
+ );
25
+ }
@@ -0,0 +1,14 @@
1
+ import { Entity, ProcessBuilder as PB } from '@effijs/common';
2
+
3
+ import { {{entityNames.pascal}}Data } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.dto';
4
+ import { {{entityNames.pascal}}Service } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.service';
5
+ import { Navigation } from '@navigation';
6
+
7
+ @Entity.Decorators.Service()
8
+ export class {{feature.pascal}}DetailService {
9
+ constructor(private navigation: Navigation, private {{entityNames.camel}}Service: {{entityNames.pascal}}Service) {}
10
+
11
+ {{{detailEdit}}}
12
+
13
+ load = (id: string) => PB.process.flow(PB.step(async (_, { signal }) => { await this.{{entityNames.camel}}Service.fetchById(id, { force: true, signal }); })).concurrent('abort');
14
+ }
@@ -0,0 +1,18 @@
1
+ import { Entity, EffiJS } from '@effijs/common';
2
+
3
+ import { {{entityNames.pascal}}Service } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.service';
4
+ import { {{entityNames.pascal}}Store } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.store';
5
+ import { Navigation } from '@navigation';
6
+ // forge:feature-services-import
7
+
8
+ @Entity.Decorators.Feature()
9
+ export class {{feature.pascal}}Feature {
10
+ constructor(
11
+ private navigation: Navigation,
12
+ readonly store: {{entityNames.pascal}}Store,
13
+ readonly service: {{entityNames.pascal}}Service,
14
+ // forge:feature-ctor
15
+ ) {}
16
+ }
17
+
18
+ EffiJS.createFeature({{feature.pascal}}Feature, '{{feature.pascal}}Feature');
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+
3
+ import { Button, Form, Grid, Text } from '@components';
4
+ import { use{{feature.pascal}}Feature } from '@feature/{{feature.kebab}}/{{feature.kebab}}.hooks';
5
+
6
+ export default function {{feature.pascal}}FilterScreen() {
7
+ const feature = use{{feature.pascal}}Feature();
8
+ return (
9
+ <Grid mh-s mt-l>
10
+ <Text title-l color="outline">Filter</Text>
11
+ <Form service={feature.service}>
12
+ <Form.Item name="title"><Form.Element.Input label="Title" /></Form.Item>
13
+ </Form>
14
+ <Button type="filled" mt-l onPress={() => feature.filter.apply({})}>Apply</Button>
15
+ </Grid>
16
+ );
17
+ }
@@ -0,0 +1,14 @@
1
+ import { Entity } from '@effijs/common';
2
+
3
+ import { {{entityNames.pascal}}Service } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.service';
4
+ import { Navigation } from '@navigation';
5
+
6
+ @Entity.Decorators.Service()
7
+ export class {{feature.pascal}}FilterService {
8
+ constructor(private navigation: Navigation, private {{entityNames.camel}}Service: {{entityNames.pascal}}Service) {}
9
+
10
+ apply(query: Record<string, unknown>) {
11
+ this.{{entityNames.camel}}Service.setQuery('list', query);
12
+ this.navigation.features.{{feature.camel}}.list?.({} as never);
13
+ }
14
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+
3
+ import { Button, Form, Grid, Screen } from '@components';
4
+ import { {{feature.pascal}}FormService } from './{{feature.kebab}}.form.service';
5
+
6
+ export default function {{feature.pascal}}FormScreen({ mode, data }: { mode: 'create' | 'edit'; data?: Record<string, unknown> }) {
7
+ const service = Form.useFormService({{feature.pascal}}FormService, { mode, ...(data ?? {}) });
8
+ return (
9
+ <Screen>
10
+ <Screen.Header title={mode === 'edit' ? 'Edit' : 'Create'} />
11
+ <Screen.Content sa-b>
12
+ <Grid mh-s mt-l>
13
+ <Form service={service}>
14
+ <Form.Item name="title"><Form.Element.Input label="Title" /></Form.Item>
15
+ <Button type="filled" mt-l onPress={() => service.submit().id('{{feature.kebab}}-form').run()}>Save</Button>
16
+ </Form>
17
+ </Grid>
18
+ </Screen.Content>
19
+ </Screen>
20
+ );
21
+ }
@@ -0,0 +1,37 @@
1
+ import { Entity, FormStore, ProcessBuilder as PB, Validator } from '@effijs/common';
2
+
3
+ import { {{entityNames.pascal}}CreatePayload, {{entityNames.pascal}}UpdatePayload } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.dto';
4
+ import { {{entityNames.pascal}}Service } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.service';
5
+ import { Navigation } from '@navigation';
6
+
7
+ class {{feature.pascal}}FormData extends Validator.WithValidator {
8
+ @Validator.Decorators.IsDefined('Title is required')
9
+ title!: string;
10
+ id?: number;
11
+ }
12
+
13
+ @Entity.Decorators.Service()
14
+ export class {{feature.pascal}}FormService extends FormStore.FormStoreService<{{feature.pascal}}FormData> {
15
+ mode: 'create' | 'edit' = 'create';
16
+
17
+ constructor(private {{entityNames.camel}}Service: {{entityNames.pascal}}Service, private navigation: Navigation) { super(); }
18
+
19
+ init(initial?: Partial<{{feature.pascal}}FormData> & { mode?: 'create' | 'edit' }) {
20
+ this.mode = initial?.mode ?? 'create';
21
+ super.init({ title: '', ...(initial || {}) });
22
+ return this;
23
+ }
24
+
25
+ submit = () => PB.process.flow(
26
+ PB.step(() => {
27
+ const { error, data } = this.validate((raw, options) => {{feature.pascal}}FormData.validate(raw, options));
28
+ if (error) throw error;
29
+ return { formData: data };
30
+ }),
31
+ PB.step(async ({ formData }) => {
32
+ if (this.mode === 'create') await this.{{entityNames.camel}}Service.create({{entityNames.pascal}}CreatePayload.transform(formData));
33
+ else await this.{{entityNames.camel}}Service.update({{entityNames.pascal}}UpdatePayload.transform(formData));
34
+ this.navigation.widgets.showToast({ type: 'message', title: 'Saved' });
35
+ }),
36
+ );
37
+ }
@@ -0,0 +1,7 @@
1
+ import { useFeature } from '@feature/feature.hooks';
2
+
3
+ import type { {{feature.pascal}}Feature } from './{{feature.kebab}}.feature';
4
+
5
+ export function use{{feature.pascal}}Feature() {
6
+ return useFeature<{{feature.pascal}}Feature>('{{feature.pascal}}Feature');
7
+ }
@@ -0,0 +1,2 @@
1
+ // forge:feature-screens
2
+ import './{{feature.kebab}}.feature';
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { Pressable } from 'react-native';
3
+
4
+ import { Text, useStore } from '@components';
5
+ import { use{{feature.pascal}}Feature } from '@feature/{{feature.kebab}}/{{feature.kebab}}.hooks';
6
+
7
+ export default function {{feature.pascal}}ListItem({ id, onPress }: { id: string; onPress?: () => void }) {
8
+ const feature = use{{feature.pascal}}Feature();
9
+ const item = useStore(feature.store, `{{entityNames.kebab}}.${id}`);
10
+ if (!item) return null;
11
+ return (
12
+ <Pressable onPress={onPress}>
13
+ <Text body-l color="outline">{item.title ?? item.name ?? id}</Text>
14
+ </Pressable>
15
+ );
16
+ }
@@ -0,0 +1,34 @@
1
+ import React, { useEffect } from 'react';
2
+ import { FlatList } from 'react-native';
3
+
4
+ import { Button, Grid, Screen, Text, useStore } from '@components';
5
+ import { use{{feature.pascal}}Feature } from '@feature/{{feature.kebab}}/{{feature.kebab}}.hooks';
6
+
7
+ import {{feature.pascal}}ListItem from './{{feature.pascal}}.List.Item';
8
+
9
+ export default function {{feature.pascal}}ListScreen() {
10
+ const feature = use{{feature.pascal}}Feature();
11
+ const ids = useStore(feature.store, 'ids.list') ?? [];
12
+
13
+ useEffect(() => {
14
+ feature.list.load().id('{{feature.kebab}}-list').run();
15
+ }, []);
16
+
17
+ return (
18
+ <Screen>
19
+ <Screen.HeaderTab>
20
+ <Grid mh-s row align-center space-between>
21
+ <Text title-l color="outline" weight={600}>{{feature.pascal}}</Text>
22
+ <Grid row gap-s>
23
+ {{#if (includes screens "search")}}<Button type="text" leadingIcon="search" size={40} withoutLoadingIndicator onPress={() => feature.list.openSearch()} />{{/if}}
24
+ {{#if (includes screens "filter")}}<Button type="text" leadingIcon="settings" size={40} withoutLoadingIndicator onPress={() => feature.list.openFilter()} />{{/if}}
25
+ {{#if (includes screens "form")}}<Button type="filled" leadingIcon="plus" size={40} withoutLoadingIndicator onPress={() => feature.list.openCreate()} />{{/if}}
26
+ </Grid>
27
+ </Grid>
28
+ </Screen.HeaderTab>
29
+ <Screen.Content sa-b scrollable={false}>
30
+ <FlatList data={ids} keyExtractor={id => id} renderItem={({ item }) => <{{feature.pascal}}ListItem id={item} {{#if (includes screens "detail")}}onPress={() => feature.list.openDetail(item)}{{/if}} />} />
31
+ </Screen.Content>
32
+ </Screen>
33
+ );
34
+ }
@@ -0,0 +1,15 @@
1
+ import { Entity, ProcessBuilder as PB } from '@effijs/common';
2
+
3
+ import { {{entityNames.pascal}}Service } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.service';
4
+ import { Navigation } from '@navigation';
5
+
6
+ @Entity.Decorators.Service()
7
+ export class {{feature.pascal}}ListService {
8
+ constructor(private navigation: Navigation, private {{entityNames.camel}}Service: {{entityNames.pascal}}Service) {}
9
+
10
+ load = () => PB.process.flow(PB.step(async (_, { signal }) => { await this.{{entityNames.camel}}Service.fetchList('list', { signal, mode: 'replace' }); })).concurrent('abort');
11
+
12
+ loadMore = () => PB.process.flow(PB.step(async (_, { signal }) => { await this.{{entityNames.camel}}Service.fetchList('list', { signal, mode: 'append' }); })).concurrent('abort');
13
+
14
+ {{{listCalls}}}
15
+ }
@@ -0,0 +1,12 @@
1
+ import { Decorators, Navigation } from '@effijs/navigation-react-native';
2
+
3
+ import { {{entityNames.pascal}}Data } from '@entity/{{entityNames.kebab}}/{{entityNames.kebab}}.dto';
4
+ // forge:navigation-screen-import
5
+
6
+ export type {{feature.pascal}}DetailScreenProps = { id: string };
7
+ export type {{feature.pascal}}FormScreenProps = { mode: 'create'; data?: Record<string, unknown> } | { mode: 'edit'; data: {{entityNames.pascal}}Data };
8
+
9
+ @Decorators.Navigation('{{feature.pascal}}')
10
+ export class Navigation{{feature.pascal}} extends Navigation {
11
+ // forge:navigation-methods
12
+ }
@@ -0,0 +1,24 @@
1
+ import React, { useState } from 'react';
2
+ import { FlatList } from 'react-native';
3
+
4
+ import { Grid, Screen, TextInput, useStore } from '@components';
5
+ import { use{{feature.pascal}}Feature } from '@feature/{{feature.kebab}}/{{feature.kebab}}.hooks';
6
+
7
+ import {{feature.pascal}}ListItem from '../list/{{feature.pascal}}.List.Item';
8
+
9
+ export default function {{feature.pascal}}SearchScreen() {
10
+ const feature = use{{feature.pascal}}Feature();
11
+ const ids = useStore(feature.store, 'ids.search') ?? [];
12
+ const [title, setTitle] = useState('');
13
+ return (
14
+ <Screen>
15
+ <Screen.Header title="Search" />
16
+ <Screen.Content sa-b scrollable={false}>
17
+ <Grid mh-s mt-s>
18
+ <TextInput value={title} onChangeText={value => { setTitle(value); feature.search.search(value).id('{{feature.kebab}}-search').run(); }} />
19
+ </Grid>
20
+ <FlatList data={ids} keyExtractor={id => id} renderItem={({ item }) => <{{feature.pascal}}ListItem id={item} />} />
21
+ </Screen.Content>
22
+ </Screen>
23
+ );
24
+ }