create-lupine 1.2.0 → 1.3.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 (264) hide show
  1. package/README.md +13 -7
  2. package/index.js +232 -108
  3. package/package.json +1 -1
  4. package/templates/common/.agents/skills/lupine-framework/SKILL.md +3 -3
  5. package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +16 -1
  6. package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +1 -1
  7. package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +17 -88
  8. package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +47 -24
  9. package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +1 -0
  10. package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +2 -2
  11. package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +3 -1
  12. package/templates/common/.env.mobile +4 -3
  13. package/templates/common/_env +8 -4
  14. package/templates/common/apps/server/README.md +10 -0
  15. package/templates/common/dev/cp-folder.js +9 -4
  16. package/templates/lupine-template-cv-starter/README.md +33 -1
  17. package/templates/lupine-template-cv-starter/app/package.json +20 -0
  18. package/templates/lupine-template-cv-starter/app/src/app.tsx +6 -0
  19. package/templates/lupine-template-cv-starter/app/src/index.native.tsx +4 -0
  20. package/templates/lupine-template-cv-starter/app/src/index.test.tsx +71 -0
  21. package/templates/lupine-template-cv-starter/app/src/index.web.tsx +28 -0
  22. package/templates/lupine-template-cv-starter/app/tsconfig.json +17 -0
  23. package/templates/lupine-template-cv-starter/lupine.json +8 -7
  24. package/templates/lupine-template-cv-starter/web/src/index.html +9 -2
  25. package/templates/lupine-template-cv-starter/web/src/index.tsx +9 -14
  26. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +9 -2
  27. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +4 -20
  28. package/templates/lupine-template-doc-starter/README.md +33 -1
  29. package/templates/lupine-template-doc-starter/app/package.json +20 -0
  30. package/templates/lupine-template-doc-starter/app/src/app.tsx +6 -0
  31. package/templates/lupine-template-doc-starter/app/src/index.native.tsx +4 -0
  32. package/templates/lupine-template-doc-starter/app/src/index.test.tsx +78 -0
  33. package/templates/lupine-template-doc-starter/app/src/index.web.tsx +28 -0
  34. package/templates/lupine-template-doc-starter/app/tsconfig.json +17 -0
  35. package/templates/lupine-template-doc-starter/lupine.json +8 -7
  36. package/templates/lupine-template-doc-starter/web/src/index.html +9 -2
  37. package/templates/lupine-template-doc-starter/web/src/index.tsx +9 -14
  38. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +9 -2
  39. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +4 -20
  40. package/templates/lupine-template-fullstack-note/README.md +83 -0
  41. package/templates/{lupine-template-cv-starter → lupine-template-fullstack-note}/api/package.json +2 -2
  42. package/templates/lupine-template-fullstack-note/api/resources/install.mysql.sql +32 -0
  43. package/templates/lupine-template-fullstack-note/api/resources/install.sqlite.sql +27 -0
  44. package/templates/lupine-template-fullstack-note/api/src/service/answer.ts +39 -0
  45. package/templates/lupine-template-fullstack-note/api/src/service/api.ts +52 -0
  46. package/templates/lupine-template-fullstack-note/api/src/service/db.ts +78 -0
  47. package/templates/lupine-template-fullstack-note/api/src/service/notes-api.ts +86 -0
  48. package/templates/lupine-template-fullstack-note/api/src/service/root-api.ts +19 -0
  49. package/templates/lupine-template-fullstack-note/api/src/service/user-api.ts +182 -0
  50. package/templates/lupine-template-fullstack-note/app/package.json +19 -0
  51. package/templates/lupine-template-fullstack-note/app/src/app.tsx +75 -0
  52. package/templates/lupine-template-fullstack-note/app/src/index.native.tsx +4 -0
  53. package/templates/lupine-template-fullstack-note/app/src/index.test.tsx +373 -0
  54. package/templates/lupine-template-fullstack-note/app/src/index.web.tsx +20 -0
  55. package/templates/lupine-template-fullstack-note/app/src/pages/components.tsx +65 -0
  56. package/templates/lupine-template-fullstack-note/app/src/pages/details.tsx +38 -0
  57. package/templates/lupine-template-fullstack-note/app/src/pages/discover.tsx +25 -0
  58. package/templates/lupine-template-fullstack-note/app/src/pages/home.tsx +76 -0
  59. package/templates/lupine-template-fullstack-note/app/src/pages/inbox.tsx +49 -0
  60. package/templates/lupine-template-fullstack-note/app/src/pages/login.tsx +54 -0
  61. package/templates/lupine-template-fullstack-note/app/src/pages/me.tsx +32 -0
  62. package/templates/lupine-template-fullstack-note/app/src/pages/notes.tsx +128 -0
  63. package/templates/lupine-template-fullstack-note/app/src/pages/settings.tsx +45 -0
  64. package/templates/lupine-template-fullstack-note/app/src/shell/AppMenu.tsx +44 -0
  65. package/templates/lupine-template-fullstack-note/app/src/shell/api.ts +159 -0
  66. package/templates/lupine-template-fullstack-note/app/src/shell/data.ts +20 -0
  67. package/templates/lupine-template-fullstack-note/app/src/shell/locales/ja.ts +80 -0
  68. package/templates/lupine-template-fullstack-note/app/src/shell/locales/zh-CN.ts +80 -0
  69. package/templates/lupine-template-fullstack-note/app/src/shell/texts.ts +14 -0
  70. package/templates/lupine-template-fullstack-note/app/tsconfig.json +17 -0
  71. package/templates/lupine-template-fullstack-note/lupine.json +25 -0
  72. package/templates/lupine-template-fullstack-note/web/assets/favicon.ico +0 -0
  73. package/templates/{lupine-template-doc-starter/api → lupine-template-fullstack-note/web}/package.json +2 -2
  74. package/templates/lupine-template-fullstack-note/web/src/index.html +23 -0
  75. package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
  76. package/templates/lupine-template-fullstack-starter/README.md +63 -14
  77. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +11 -6
  78. package/templates/lupine-template-fullstack-starter/app/package.json +20 -0
  79. package/templates/lupine-template-fullstack-starter/app/src/app.tsx +76 -0
  80. package/templates/lupine-template-fullstack-starter/app/src/index.native.tsx +4 -0
  81. package/templates/lupine-template-fullstack-starter/app/src/index.test.tsx +276 -0
  82. package/templates/lupine-template-fullstack-starter/app/src/index.web.tsx +28 -0
  83. package/templates/lupine-template-fullstack-starter/app/src/pages/about.tsx +27 -0
  84. package/templates/lupine-template-fullstack-starter/app/src/pages/contact.tsx +41 -0
  85. package/templates/lupine-template-fullstack-starter/app/src/pages/favorite.tsx +27 -0
  86. package/templates/lupine-template-fullstack-starter/app/src/pages/home.tsx +63 -0
  87. package/templates/lupine-template-fullstack-starter/app/src/pages/login.tsx +63 -0
  88. package/templates/lupine-template-fullstack-starter/app/src/pages/mine.tsx +44 -0
  89. package/templates/lupine-template-fullstack-starter/app/src/pages/profile.tsx +58 -0
  90. package/templates/lupine-template-fullstack-starter/app/src/pages/register.tsx +48 -0
  91. package/templates/lupine-template-fullstack-starter/app/src/pages/reset-password.tsx +41 -0
  92. package/templates/lupine-template-fullstack-starter/app/src/pages/settings.tsx +33 -0
  93. package/templates/lupine-template-fullstack-starter/app/src/pages/story.tsx +46 -0
  94. package/templates/lupine-template-fullstack-starter/app/src/shell/api.ts +127 -0
  95. package/templates/lupine-template-fullstack-starter/app/src/shell/parts.tsx +100 -0
  96. package/templates/lupine-template-fullstack-starter/app/src/shell/stories.ts +65 -0
  97. package/templates/lupine-template-fullstack-starter/app/src/shell/texts.ts +79 -0
  98. package/templates/lupine-template-fullstack-starter/app/tsconfig.json +17 -0
  99. package/templates/lupine-template-fullstack-starter/lupine.json +6 -7
  100. package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
  101. package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/home-search-component.tsx +18 -25
  102. package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-card.tsx +17 -8
  103. package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-list.tsx +1 -2
  104. package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.html +1 -0
  105. package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.tsx +13 -28
  106. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-cfg.tsx +23 -19
  107. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-edit.tsx +3 -4
  108. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-list.tsx +2 -3
  109. package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-user.tsx +15 -20
  110. package/templates/lupine-template-fullstack-starter/web/src/index.html +8 -2
  111. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +11 -150
  112. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +7 -25
  113. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +0 -3
  114. package/templates/lupine-template-fullstack-starter/web/src/styles/theme.ts +1 -2
  115. package/templates/lupine-template-responsive-starter/README.md +46 -2
  116. package/templates/lupine-template-responsive-starter/app/package.json +19 -0
  117. package/templates/lupine-template-responsive-starter/app/src/app.tsx +80 -0
  118. package/templates/lupine-template-responsive-starter/app/src/index.native.tsx +4 -0
  119. package/templates/lupine-template-responsive-starter/app/src/index.test.tsx +283 -0
  120. package/templates/lupine-template-responsive-starter/app/src/index.web.tsx +31 -0
  121. package/templates/lupine-template-responsive-starter/app/src/pages/about.tsx +23 -0
  122. package/templates/lupine-template-responsive-starter/app/src/pages/finance.tsx +48 -0
  123. package/templates/lupine-template-responsive-starter/app/src/pages/mine.tsx +60 -0
  124. package/templates/lupine-template-responsive-starter/app/src/pages/not-found.tsx +9 -0
  125. package/templates/lupine-template-responsive-starter/app/src/pages/note-detail.tsx +43 -0
  126. package/templates/lupine-template-responsive-starter/app/src/pages/note-edit.tsx +45 -0
  127. package/templates/lupine-template-responsive-starter/app/src/pages/note-search.tsx +62 -0
  128. package/templates/lupine-template-responsive-starter/app/src/pages/notes.tsx +71 -0
  129. package/templates/lupine-template-responsive-starter/app/src/pages/settings.tsx +55 -0
  130. package/templates/lupine-template-responsive-starter/app/src/pages/tools.tsx +112 -0
  131. package/templates/lupine-template-responsive-starter/app/src/shell/icons.ts +7 -0
  132. package/templates/lupine-template-responsive-starter/app/src/shell/layout.ts +18 -0
  133. package/templates/lupine-template-responsive-starter/app/src/shell/locales/zh-CN.ts +89 -0
  134. package/templates/lupine-template-responsive-starter/app/src/shell/menu.tsx +81 -0
  135. package/templates/lupine-template-responsive-starter/app/src/shell/nav.ts +12 -0
  136. package/templates/lupine-template-responsive-starter/app/src/shell/store.ts +72 -0
  137. package/templates/lupine-template-responsive-starter/app/src/shell/texts.ts +11 -0
  138. package/templates/lupine-template-responsive-starter/app/tsconfig.json +17 -0
  139. package/templates/lupine-template-responsive-starter/lupine.json +7 -6
  140. package/templates/lupine-template-responsive-starter/web/src/index.html +9 -2
  141. package/templates/lupine-template-responsive-starter/web/src/index.tsx +9 -25
  142. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +12 -6
  143. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +12 -22
  144. package/templates/common/apps/server/src/app-loader.ts +0 -4
  145. package/templates/lupine-template-cv-starter/api/resources/config_default.json +0 -6
  146. package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +0 -4
  147. package/templates/lupine-template-cv-starter/api/src/index.ts +0 -15
  148. package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +0 -5
  149. package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +0 -15
  150. package/templates/lupine-template-doc-starter/api/resources/config_default.json +0 -6
  151. package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +0 -4
  152. package/templates/lupine-template-doc-starter/api/src/index.ts +0 -15
  153. package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +0 -6
  154. package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +0 -4
  155. package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +0 -5
  156. package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +0 -15
  157. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +0 -16
  158. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +0 -22
  159. package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +0 -52
  160. package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +0 -15
  161. package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +0 -75
  162. package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +0 -162
  163. package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +0 -165
  164. package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +0 -118
  165. package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +0 -122
  166. package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +0 -12
  167. package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +0 -161
  168. package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +0 -163
  169. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +0 -166
  170. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +0 -177
  171. package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +0 -84
  172. package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +0 -48
  173. package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +0 -61
  174. package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +0 -61
  175. package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +0 -23
  176. package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +0 -90
  177. package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +0 -15
  178. package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +0 -105
  179. package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +0 -38
  180. package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +0 -38
  181. package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +0 -58
  182. package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +0 -27
  183. package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +0 -54
  184. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +0 -112
  185. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +0 -112
  186. package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +0 -57
  187. package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +0 -19
  188. package/templates/lupine-template-fullstack-starter/web/src/styles/app.css +0 -0
  189. package/templates/lupine-template-responsive-starter/api/package.json +0 -6
  190. package/templates/lupine-template-responsive-starter/api/resources/config_default.json +0 -6
  191. package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +0 -4
  192. package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +0 -18
  193. package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +0 -76
  194. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +0 -93
  195. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +0 -87
  196. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -81
  197. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -211
  198. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -107
  199. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -110
  200. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -144
  201. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -188
  202. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +0 -95
  203. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +0 -169
  204. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -53
  205. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -32
  206. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -35
  207. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -444
  208. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -318
  209. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -35
  210. package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +0 -87
  211. package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +0 -45
  212. package/templates/lupine-template-responsive-starter/web/src/styles/app.css +0 -0
  213. package/templates/lupine-template-responsive-starter/web/src/styles/base-css.ts +0 -65
  214. package/templates/lupine-template-responsive-starter/web/src/styles/global.css +0 -2130
  215. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +0 -17
  216. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/01-experience/index.md +0 -0
  217. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/02-projects/index.md +0 -0
  218. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/03-skills/index.md +0 -0
  219. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/04-education/index.md +0 -0
  220. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/index.md +0 -0
  221. /package/templates/lupine-template-cv-starter/{web → app}/markdown/index.md +0 -0
  222. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/01-experience/index.md +0 -0
  223. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/02-projects/index.md +0 -0
  224. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/03-skills/index.md +0 -0
  225. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/04-education/index.md +0 -0
  226. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/index.md +0 -0
  227. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/01-experience/index.html +0 -0
  228. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/02-projects/index.html +0 -0
  229. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/03-skills/index.html +0 -0
  230. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/04-education/index.html +0 -0
  231. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/index.html +0 -0
  232. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/index.html +0 -0
  233. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
  234. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/01-experience/index.html +0 -0
  235. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/02-projects/index.html +0 -0
  236. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/03-skills/index.html +0 -0
  237. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/04-education/index.html +0 -0
  238. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
  239. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/index.md +0 -0
  240. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/list.md +0 -0
  241. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/install.md +0 -0
  242. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/started.md +0 -0
  243. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/index.md +0 -0
  244. /package/templates/lupine-template-doc-starter/{web → app}/markdown/index.md +0 -0
  245. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/index.md +0 -0
  246. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/list.md +0 -0
  247. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/install.md +0 -0
  248. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/started.md +0 -0
  249. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/index.md +0 -0
  250. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/index.html +0 -0
  251. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/list.html +0 -0
  252. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/install.html +0 -0
  253. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/started.html +0 -0
  254. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/index.html +0 -0
  255. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/index.html +0 -0
  256. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
  257. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/index.html +0 -0
  258. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/list.html +0 -0
  259. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/install.html +0 -0
  260. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/started.html +0 -0
  261. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
  262. /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-note}/api/src/index.ts +0 -0
  263. /package/templates/lupine-template-fullstack-starter/{web/assets/images → app/assets}/sample.png +0 -0
  264. /package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-props.ts +0 -0
@@ -0,0 +1,80 @@
1
+ export const zhCN = {
2
+ app: { name: 'Lupine 笔记', tagline: '一套代码:iOS、Android、网页和桌面' },
3
+ nav: { home: '首页', components: '组件', discover: '创建', inbox: '消息', me: '我的', settings: '设置', about: '关于', menu: '菜单' },
4
+ home: {
5
+ welcome: '欢迎回来',
6
+ featured: '推荐',
7
+ shortcuts: '快捷入口',
8
+ recent: '最近项目',
9
+ openPanel: '打开滑动窗口',
10
+ panelText: '这个窗口从右侧滑入,覆盖当前页面——适合不需要独立网址的详情和表单。',
11
+ seeAll: '全部',
12
+ },
13
+ discover: { title: '新建', note: '新建笔记', photo: '拍照', task: '新建任务', created: '已创建:{what}' },
14
+ inbox: { empty: '没有新消息', markRead: '全部标为已读', unread: '{n} 条未读' },
15
+ me: { guest: '游客', signIn: '登录', profile: '个人资料', favourites: '我的收藏', history: '浏览历史', help: '帮助与反馈' },
16
+ settings: {
17
+ appearance: '外观',
18
+ theme: '主题',
19
+ language: '语言',
20
+ textSize: '字体大小',
21
+ notifications: '通知',
22
+ pushEnabled: '推送通知',
23
+ sound: '声音',
24
+ storage: '存储',
25
+ clearCache: '清除缓存',
26
+ cacheCleared: '缓存已清除',
27
+ app: '应用',
28
+ server: '服务器',
29
+ thisSite: '本网站',
30
+ version: '版本',
31
+ },
32
+ item: { title: '项目 {id}', body: '详情页是普通路由(/item/[id]):支持深度链接和浏览器后退,网页服务器也可以直接渲染它。' },
33
+ auth: {
34
+ signIn: '登录',
35
+ register: '注册账号',
36
+ username: '用户名',
37
+ usernameRule: '3 到 50 个字符:字母、数字、_ . @ -',
38
+ password: '密码',
39
+ password2: '再次输入密码',
40
+ passwordsDiffer: '两次输入的密码不一致',
41
+ haveAccount: '已有账号,去登录',
42
+ noAccount: '没有账号?注册',
43
+ signOut: '退出登录',
44
+ welcome: '已登录:{name}',
45
+ registered: '欢迎,{name}:账号已创建',
46
+ server: '服务器',
47
+ thisSite: '本网站',
48
+ },
49
+ notes: {
50
+ title: '我的笔记',
51
+ placeholder: '写点什么…',
52
+ add: '添加',
53
+ empty: '还没有笔记',
54
+ signInFirst: '登录后可以把笔记保存到服务器',
55
+ signInText: '笔记跟随账号保存,在每台设备和网页上都能看到。',
56
+ deleted: '已删除',
57
+ retry: '重试',
58
+ more: '更早的笔记',
59
+ },
60
+ // the texts of the codes of the API (shell/api.ts: messageOf)
61
+ api: {
62
+ offline: '无法连接服务器',
63
+ bad_answer: '服务器返回了意外的结果({status})',
64
+ bad_request: '服务器无法理解该请求',
65
+ bad_username: '用户名:3 到 50 个字符(字母、数字、_ . @ -)',
66
+ bad_password: '密码:6 到 256 个字符',
67
+ username_taken: '该用户名已被使用',
68
+ login_failed: '用户名或密码错误',
69
+ too_many_attempts: '登录失败次数过多,请 {minutes} 分钟后再试',
70
+ not_signed_in: '请重新登录',
71
+ bad_note: '笔记需要 1 到 2000 个字符',
72
+ too_many_notes: '最多 {max} 条笔记:请先删除一些',
73
+ note_not_found: '这条笔记已不存在',
74
+ no_crypto_key: '服务器的 .env 中没有设置 CRYPTO_KEY',
75
+ forbidden_origin: '服务器拒绝了来自此页面的请求',
76
+ server_error: '服务器出错了',
77
+ failed: '出错了',
78
+ },
79
+ about: { text: '基于 lupine.native。修改 src/pages 中的页面,src/shell 中的框架。' },
80
+ };
@@ -0,0 +1,14 @@
1
+ import { addLnTexts, addTexts, lnJa, lnZhHans, setLanguages } from 'lupine.native.components';
2
+ import { ja } from './locales/ja';
3
+ import { zhCN } from './locales/zh-CN';
4
+
5
+ // English is in the code: t('home.welcome', 'Welcome back'); here the other languages
6
+ addTexts('zh-CN', zhCN);
7
+ addTexts('ja', ja);
8
+ // and those of the controls
9
+ addLnTexts({ 'zh-Hans': lnZhHans, ja: lnJa });
10
+ setLanguages([
11
+ { code: 'en', name: 'English' },
12
+ { code: 'zh-CN', name: '简体中文' },
13
+ { code: 'ja', name: '日本語' },
14
+ ]);
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2020",
4
+ "lib": ["es2020"],
5
+ "types": [],
6
+ "jsx": "react-jsx",
7
+ "jsxImportSource": "lupine.native.core",
8
+ "module": "esnext",
9
+ "moduleResolution": "bundler",
10
+ "strict": true,
11
+ "noEmit": true,
12
+ "skipLibCheck": true
13
+ },
14
+ // the web entry is the only file that may use the DOM, so it isn't checked with these settings
15
+ "include": ["src"],
16
+ "exclude": ["src/index.web.tsx"]
17
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "lupine-template-fullstack-note",
3
+ "nativeOut": "dist/native",
4
+ "nativeApp": "app",
5
+ "webEntryPoints": [
6
+ {
7
+ "index": "web/src/index.tsx",
8
+ "html": "web/src/index.html",
9
+ "outdir": "/"
10
+ }
11
+ ],
12
+ "apiEntryPoint": "api/src/index.ts",
13
+ "copyFiles": [
14
+ {
15
+ "env": "all",
16
+ "from": "web/assets",
17
+ "to": "web/assets"
18
+ },
19
+ {
20
+ "env": "all",
21
+ "from": "api/resources",
22
+ "to": "data/resources"
23
+ }
24
+ ]
25
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "lupine-template-doc-starter-api",
2
+ "name": "lupine-template-fullstack-note-web",
3
3
  "version": "1.0.0",
4
4
  "dependencies": {},
5
5
  "devDependencies": {}
6
- }
6
+ }
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html data-theme="<!--META-THEME-->">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title><!--META-TITLE--></title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
+ <!--META-ENV-START-->
8
+ <!--META-ENV-END-->
9
+ <link rel="shortcut icon" href="/assets/favicon.ico?t={hash}" type="image/x-icon" />
10
+ <style>
11
+ html,
12
+ body,
13
+ .lupine-root {
14
+ height: 100%;
15
+ margin: 0;
16
+ }
17
+ </style>
18
+ <script defer src="{SUBDIR}/index.js?t={hash}"></script>
19
+ </head>
20
+ <body>
21
+ <div class="lupine-root"></div>
22
+ </body>
23
+ </html>
@@ -0,0 +1,15 @@
1
+ import { bindRouter, PageRouter, setDefaultPageTitle } from 'lupine.web';
2
+ import { AppPage } from '../../app/src/index.web';
3
+ // the primitives of the app in the page that the server renders
4
+ import 'lupine.native.core/web/server';
5
+
6
+ // The page of the site is the app (apps/lupine-template-fullstack-note/app), in the same bundle. Pages of the site itself
7
+ // go into pageRouter before it, such as pageRouter.use('/note/:id', NotePage). keep: the app is made once and stays; when
8
+ // the address changes (its own pages, the back button) it follows the address itself.
9
+ // The app calls the API of this site (/api, api/src/service) with the cookie of the session.
10
+
11
+ setDefaultPageTitle('Lupine Notes');
12
+
13
+ const pageRouter = new PageRouter();
14
+ pageRouter.use('*', AppPage, { keep: true });
15
+ bindRouter(pageRouter);
@@ -1,21 +1,70 @@
1
- # Full-stack Web Starter
1
+ # Full-stack Starter
2
2
 
3
- A web site with lupine.web and lupine.api: pages rendered on the server (SSR) and updated in the browser, nested page frames, sign-in, an admin area and an API with a database. For an app that looks like a phone app see `lupine-template-responsive-starter`; for native apps `apps/native-starter`.
3
+ One app for iOS, Android, macOS, Windows and the web (lupine.native), a web site that serves the web version of it with admin pages (lupine.web), and an API with a database (lupine.api).
4
4
 
5
- | Part | Where |
5
+ <!-- screenshots macos=1 windows=13 web=/ ios=1,11 android=11,13 -->
6
+ <table>
7
+ <tr><th>macOS</th><th>Windows</th><th>Web</th></tr>
8
+ <tr><td><a href="docs/macos-1-home.png"><img src="docs/macos-1-home.png" width="253" alt="macOS"></a></td><td><a href="docs/windows-13-signed-in.png"><img src="docs/windows-13-signed-in.png" width="253" alt="Windows"></a></td><td><a href="docs/web-1.png"><img src="docs/web-1.png" width="253" alt="Web"></a></td></tr>
9
+ </table>
10
+ <table>
11
+ <tr><th colspan="2">iOS</th><th colspan="2">Android</th></tr>
12
+ <tr><td><a href="docs/ios-1-home.png"><img src="docs/ios-1-home.png" width="183" alt="iOS"></a></td><td><a href="docs/ios-11-dark.png"><img src="docs/ios-11-dark.png" width="183" alt="iOS"></a></td><td><a href="docs/android-11-dark.png"><img src="docs/android-11-dark.png" width="183" alt="Android"></a></td><td><a href="docs/android-13-signed-in.png"><img src="docs/android-13-signed-in.png" width="183" alt="Android"></a></td></tr>
13
+ </table>
14
+ <!-- /screenshots -->
15
+
16
+ | Part | |
6
17
  | --- | --- |
7
- | pages, frames, the router | `web/src/index.tsx`, `web/src/pages`, `web/src/frames` |
8
- | sign-in, registration, codes by email, new password | `web/src/components/login*.tsx`, `register.tsx`, `reset-password.tsx`; `api/src/service/user-api.ts` |
9
- | users' pages (need a sign-in) | `/user/mine`, `/user/favorite`, `/user/profile`, `/user/contact` |
10
- | admin area (admins only) | `/admin`: users, settings, items; `api/src/service/admin-api.ts` |
11
- | tools of the developer | `/admin_dev` (database, logs, settings; `DEV_ADMIN_USER` / `DEV_ADMIN_PASS`) |
12
- | the components of lupine.web.components | `/demo` |
13
- | API routes | `api/src/service/api.ts` |
18
+ | `app/` | the app: stories (list, search, story page), sign-in with a password or a code by e-mail, registration, new password, the user's pages (mine, favorites, profile, contact), settings (theme, English / Chinese), about. Its settings: `lupineNative` in `app/package.json`; the Chinese texts: `app/src/shell/texts.ts` |
19
+ | `web/` | the site: every address is the web version of the app, rendered on the server (`web/src/index.tsx`) |
20
+ | `/admin` | the admin pages, an entry of their own in `lupine.json` (`web/src/admin`): an admin of the app sees Site (stories, users, the website); the developer (`DEV_ADMIN_USER` / `DEV_ADMIN_PASS`) sees the tools too (database, logs, settings) |
21
+ | `api/` | the API: routes in `api/src/service/api.ts`; sign-in, codes and profile in `user-api.ts`; `admin-api.ts`, `contact-api.ts` |
22
+ | `lupine.json` | what `npm run dev` builds; `"nativeApp": "app"` and `"nativeOut": "dist/native"` for `lupine-native` |
23
+
24
+ The stories are sample data (`app/src/shell/stories.ts`), and the favorites are kept on the device for each user; a real app gets both from its API.
14
25
 
15
26
  ## First start
16
27
 
17
- 1. In `.env`: `CRYPTO_KEY`, `ADMIN_USER` / `ADMIN_PASS`, `DEV_ADMIN_USER` / `DEV_ADMIN_PASS` (create-lupine fills in random ones), and for mail `SEND_EMAIL_USER` / `SEND_EMAIL_PASS`.
18
- 2. `npm run dev`, then open `/admin_dev` and create the tables from `api/resources/install.sqlite.sql` (or `install.mysql.sql`).
19
- 3. The contact form sends to the address `siteEmail` of the settings (`/admin`, settings).
28
+ 1. In `.env`: `CRYPTO_KEY`, `ADMIN_USER` / `ADMIN_PASS`, `DEV_ADMIN_USER` / `DEV_ADMIN_PASS`, and for mail `SEND_EMAIL_USER` / `SEND_EMAIL_PASS`. The two passwords are hashes: create-lupine fills in hashes of random passwords that nobody knows, so make hashes of yours with the command in the comment above them.
29
+ 2. `npm run dev` with `lupine-template-fullstack-starter` in `APPS` and a `DOMAINS:lupine-template-fullstack-starter=...` line, then open `/admin`, sign in as `DEV_ADMIN_USER` and create the tables from `api/resources/install.sqlite.sql` (or `install.mysql.sql`).
30
+ 3. Sign in at `/login` as `ADMIN_USER`: Mine then shows "Admin pages" (`/admin`). The contact form sends to `siteEmail` of the settings (`/admin`, Site > Website).
31
+
32
+ ## The apps
33
+
34
+ In a project of create-lupine (and in the repository of this template) the same is in the scripts: `npm run run-mac`, `run-ios`, `run-android`, `run-exe`; `build-android` (the apk for the store), `bump` (the next version), `icons` (the icons of the site from the icon of the app), `release` (a folder for the server).
35
+
36
+ ```bash
37
+ npm run native -- macos --app=apps/lupine-template-fullstack-starter --run
38
+ npm run native -- ios --app=apps/lupine-template-fullstack-starter --run
39
+ npm run native -- android --app=apps/lupine-template-fullstack-starter --run
40
+ npm run native -- windows --app=apps/lupine-template-fullstack-starter --run
41
+ npm run native -- web --app=apps/lupine-template-fullstack-starter --watch # the app alone, as a static page
42
+ npm run native -- test macos --app=apps/lupine-template-fullstack-starter # app/src/index.test.tsx
43
+ # the apps for the stores, which call your server (WEB.API_BASE_URL of .env.mobile)
44
+ npm run native -- android --app=apps/lupine-template-fullstack-starter --release --env=.env.mobile
45
+ ```
46
+
47
+ The builds are in `dist/native/lupine-template-fullstack-starter-app/<platform>`.
48
+
49
+ ## The address of the API
50
+
51
+ The native apps call `WEB.API_BASE_URL` of the env file they are built with (`--env=`; `.env.development` by default, `.env.production` with `--release`), or `lupine-template-fullstack-starter.WEB.API_BASE_URL` for this app alone. Put the address of your server (`https://example.com/`) into `.env.mobile` and build the apps for the stores with `--release --env=.env.mobile`: it imports `.env`, and the site, built with `.env.production`, doesn't get the address. The key goes into the bundle, so it is public.
52
+
53
+ Without it the app calls `http://lupine-template-fullstack-starter.app.localhost:<WEB.API_PORT>`: the server of `npm run dev` on the same computer. The Android emulator uses `http://10.0.2.2:<WEB.API_PORT>` instead. The server finds the app by the host name, so add `lupine-template-fullstack-starter.app.localhost` and `10.0.2.2` to its `DOMAINS:` line, unless that line is empty (as in a new project: the app gets every host) or `*`. A phone needs an address of the computer in the network. Settings shows the address the app uses. Release builds for Android refuse plain `http://`.
54
+
55
+ In the browser the app always calls the site it comes from, and `WEB.API_BASE_URL` is not used.
56
+
57
+ ## Sessions and security
58
+
59
+ - In the browser the API sets the httpOnly cookie `_token` when you sign in, so the scripts of the page never hold the token.
60
+ - A native app has no cookie store. It keeps the token from the sign-in answer in `storage` and sends it as `Cookie: _token=...`. The API puts the token in the answer only for requests without `Origin`, which browsers always send with a POST, so a script in a page can't get it from there either. Signing out removes it and calls `/api/logout`.
61
+ - The admin pages are web only. On a phone "Admin pages" opens the site in the browser, where you sign in again.
62
+ - Writing routes are POST only and check the session. Uploads check the type and the size. A code by e-mail can be asked for once a minute, and the answer doesn't tell whether the address has an account. The contact form takes five messages an hour from an address (per worker process, so limit it in front of the server too).
63
+ - Requests from native apps have no `Origin` header, so the CSRF check of the API lets them through. It still checks browsers.
64
+
65
+ ## Dropped from the web-only version
20
66
 
21
- Writing routes are POST only and check the session; uploads check the type and the size; codes by email can be asked for once a minute and don't tell whether an address has an account; the contact form takes five messages an hour from an address (per worker process: limit it in front of the server, too).
67
+ - `/demo`: the demos of lupine.web.components are still at `/admin/demo`.
68
+ - The demo pages of nested frames (`/frame1`, `/frame2`, `/page1`, `/page2`, `/user1`).
69
+ - The lupine.web user pages (`/user/...`, `/login-code`, `/reset-pw`) and the copies in Chinese (`login-zh.tsx` and the others). The app has these pages now, with the Chinese texts in `app/src/shell/texts.ts`.
70
+ - The icon font in the site's own pages: they use `lupine.core/icons` (`<Icon name={icons.x} />`). The font (`web/icons-font.config.js`, `web/assets/icons-font`) stays for the pages of lupine.api in `/admin`.
@@ -39,6 +39,11 @@ export type LoginJsonProps = {
39
39
  const ADMIN_SESSION_INVALID_BEFORE_KEY_NAME = 'ADMIN_SESSION_INVALID_BEFORE';
40
40
  const ADMIN_SESSION_EXPIRE_DAYS_KEY_NAME = 'ADMIN_SESSION_EXPIRE_DAYS';
41
41
 
42
+ // The token of a sign-in is in the answer only for the apps (iOS, Android, macOS, Windows): they have no cookies and
43
+ // send it back in a Cookie header. A browser keeps it in its httpOnly cookie alone, where the scripts of a page can't
44
+ // read it. Browsers send Origin with every POST, the apps don't.
45
+ const tokenForApps = (req: ServerRequest, token: string) => (req.headers.origin ? undefined : token);
46
+
42
47
  export const appAdminHookSetCookie: AppAdminHookSetCookieProps = async (
43
48
  req: ServerRequest,
44
49
  res: ServerResponse,
@@ -65,8 +70,7 @@ export const appAdminHookSetCookie: AppAdminHookSetCookieProps = async (
65
70
  const response = {
66
71
  status: 'ok',
67
72
  message: langHelper.getLang('shared:login_success'),
68
- appLogin: tokenCookie,
69
- result: tokenCookie,
73
+ appLogin: 1,
70
74
  user: {
71
75
  nickname: loginJson.u,
72
76
  admin: loginJson.t === 'admin' ? '1' : '0',
@@ -169,7 +173,8 @@ export const getUserFromCookie = async (
169
173
  const cookies = req.locals.cookies();
170
174
  const token = cookies.get('_token', '');
171
175
  if (token) {
172
- const json = adminApiHelper.decryptJson(token) as LoginJsonProps;
176
+ // encrypted with CRYPTO_KEY by the sign-in (decryptJson takes DEV_CRYPTO_KEY without a key)
177
+ const json = adminApiHelper.decryptJson(token, process.env['CRYPTO_KEY']) as LoginJsonProps;
173
178
  if (!json || !json.u) {
174
179
  if (sendResponseWhenError) {
175
180
  const response = {
@@ -384,7 +389,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
384
389
  const response = {
385
390
  status: 'ok',
386
391
  message: langHelper.getLang('shared:login_success'),
387
- result: token,
392
+ result: tokenForApps(req, token),
388
393
  user: {
389
394
  nickname: loginJson.u,
390
395
  admin: loginJson.t === 'admin' ? '1' : '0',
@@ -429,7 +434,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
429
434
  const response = {
430
435
  status: 'ok',
431
436
  message: langHelper.getLang('shared:login_success'),
432
- result: tokenCookie,
437
+ result: tokenForApps(req, tokenCookie),
433
438
  user: {
434
439
  nickname: loginJson.u,
435
440
  admin: loginJson.t === 'admin' ? '1' : '0',
@@ -590,7 +595,7 @@ export const userLogin = async (req: ServerRequest, res: ServerResponse) => {
590
595
  const response = {
591
596
  status: 'ok',
592
597
  message: langHelper.getLang('shared:login_success'),
593
- result: tokenCookie,
598
+ result: tokenForApps(req, tokenCookie),
594
599
  user: {
595
600
  nickname: loginJson.u,
596
601
  admin: loginJson.t === 'admin' ? '1' : '0',
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "lupine-template-fullstack-starter-app",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "description": "The app of the full-stack starter: stories, sign-in, the user's pages, settings. One code base for iOS, Android, macOS, Windows and the web.",
6
+ "lupineNative": {
7
+ "name": "LupineFullstack",
8
+ "title": "Lupine Full-stack",
9
+ "id": "com.uuware.lupine.fullstack",
10
+ "entry": {
11
+ "native": "src/index.native.tsx",
12
+ "test": "src/index.test.tsx",
13
+ "web": "src/index.web.tsx"
14
+ }
15
+ },
16
+ "dependencies": {
17
+ "lupine.native.components": "^1.1.0",
18
+ "lupine.native.core": "^1.1.0"
19
+ }
20
+ }
@@ -0,0 +1,76 @@
1
+ import './shell/texts';
2
+ import { createEffect, onBack, onMount, Text, untrack, View } from 'lupine.native.core';
3
+ import { col, Icon, NavBar, NavItem, OverlayHost, Pages, router, syncAppearance, t, Toast, tr, val } from 'lupine.native.components';
4
+ import * as icons from 'lupine.core/icons';
5
+ import { api } from './shell/api';
6
+ import { About, NotFound } from './pages/about';
7
+ import { Contact } from './pages/contact';
8
+ import { Favorite } from './pages/favorite';
9
+ import { Home } from './pages/home';
10
+ import { Login } from './pages/login';
11
+ import { Mine } from './pages/mine';
12
+ import { Profile } from './pages/profile';
13
+ import { Register } from './pages/register';
14
+ import { ResetPassword } from './pages/reset-password';
15
+ import { Settings } from './pages/settings';
16
+ import { StoryPage } from './pages/story';
17
+
18
+ const items: NavItem[] = [
19
+ { key: '/', label: tr('nav.home', 'Stories'), icon: icons.home, testID: 'tab-home' },
20
+ { key: '/favorite', label: tr('nav.favorite', 'Favorites'), icon: icons.heart, testID: 'tab-favorite' },
21
+ { key: '/mine', label: tr('nav.mine', 'Mine'), icon: icons.user, testID: 'tab-mine' },
22
+ ];
23
+
24
+ // the title of the browser's tab (the window on desktops) while a tab is shown; pages over the tabs: the name of the app
25
+ const appName = () => t('app.name', 'Lupine Full-stack');
26
+ const tabTitle = (key: string) => () => (key === '/' ? appName() : `${val(items.find((i) => i.key === key)?.label ?? '')} | ${appName()}`);
27
+
28
+ /** Phones: a tab bar at the bottom, pushed pages cover it. Wide windows: the menu stays on the left. */
29
+ export const App = () => {
30
+ untrack(syncAppearance); // before the first control is created
31
+ createEffect(syncAppearance);
32
+ // who is signed in; not while a server renders the page
33
+ onMount(() => void api.refresh());
34
+ let last = 0;
35
+ onBack(() => {
36
+ if (Date.now() - last < 2000) return false;
37
+ last = Date.now();
38
+ Toast.info(t('ln.pressAgainToExit', 'Press back again to exit'));
39
+ });
40
+ return (
41
+ <View style={{ flex: 1, backgroundColor: col('bg') }}>
42
+ <Pages
43
+ side={240}
44
+ title={appName}
45
+ tabs={[
46
+ { path: '/', page: Home, title: tabTitle('/') },
47
+ { path: '/favorite', page: Favorite, title: tabTitle('/favorite') },
48
+ { path: '/mine', page: Mine, title: tabTitle('/mine') },
49
+ ]}
50
+ routes={[
51
+ { path: '/story/:id', page: ({ id }) => <StoryPage id={id} /> },
52
+ { path: '/login', page: ({ email, mode }) => <Login email={email} mode={mode} /> },
53
+ { path: '/register', page: () => <Register /> },
54
+ { path: '/reset-password', page: ({ email }) => <ResetPassword email={email} /> },
55
+ { path: '/profile', page: () => <Profile /> },
56
+ { path: '/contact', page: () => <Contact /> },
57
+ { path: '/settings', page: () => <Settings /> },
58
+ { path: '/about', page: () => <About /> },
59
+ ]}
60
+ notFound={() => <NotFound />}
61
+ >
62
+ {/* one menu: a tab bar at the bottom on phones, a column on the left on wide windows (css, also on the server) */}
63
+ <NavBar
64
+ items={items} active={router.tab} onPress={router.navigate} width={240}
65
+ header={
66
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, padding: 18 }}>
67
+ <Icon name={icons.logo} size={26} color={col('primary')} />
68
+ <Text style={{ fontSize: 17, fontWeight: '700', color: col('text') }}>{tr('app.name', 'Lupine Full-stack')}</Text>
69
+ </View>
70
+ }
71
+ />
72
+ </Pages>
73
+ <OverlayHost />
74
+ </View>
75
+ );
76
+ };
@@ -0,0 +1,4 @@
1
+ import { runApp } from 'lupine.native.core/native';
2
+ import { App } from './app';
3
+
4
+ runApp(App);