create-lupine 1.0.31 → 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 (269) hide show
  1. package/README.md +31 -0
  2. package/index.js +238 -112
  3. package/package.json +1 -1
  4. package/templates/common/.agents/skills/lupine-framework/SKILL.md +63 -0
  5. package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +113 -0
  6. package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +71 -0
  7. package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +29 -0
  8. package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +190 -0
  9. package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +55 -0
  10. package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +108 -0
  11. package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +121 -0
  12. package/templates/common/.env.mobile +4 -3
  13. package/templates/common/_env +10 -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 +37 -0
  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 -23
  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 -29
  28. package/templates/lupine-template-doc-starter/README.md +37 -0
  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 -23
  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 -29
  40. package/templates/lupine-template-fullstack-note/README.md +83 -0
  41. package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/api/package.json +1 -1
  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-hello-world → lupine-template-fullstack-note}/lupine.json +4 -2
  72. package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/package.json +1 -1
  73. package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/src/index.html +10 -3
  74. package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
  75. package/templates/lupine-template-fullstack-starter/README.md +70 -0
  76. package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
  77. package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
  78. package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
  79. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
  80. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
  81. package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
  82. package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
  83. package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
  84. package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
  85. package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
  86. package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
  87. package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
  88. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1046 -0
  89. package/templates/lupine-template-fullstack-starter/app/assets/sample.png +0 -0
  90. package/templates/lupine-template-fullstack-starter/app/package.json +20 -0
  91. package/templates/lupine-template-fullstack-starter/app/src/app.tsx +76 -0
  92. package/templates/lupine-template-fullstack-starter/app/src/index.native.tsx +4 -0
  93. package/templates/lupine-template-fullstack-starter/app/src/index.test.tsx +276 -0
  94. package/templates/lupine-template-fullstack-starter/app/src/index.web.tsx +28 -0
  95. package/templates/lupine-template-fullstack-starter/app/src/pages/about.tsx +27 -0
  96. package/templates/lupine-template-fullstack-starter/app/src/pages/contact.tsx +41 -0
  97. package/templates/lupine-template-fullstack-starter/app/src/pages/favorite.tsx +27 -0
  98. package/templates/lupine-template-fullstack-starter/app/src/pages/home.tsx +63 -0
  99. package/templates/lupine-template-fullstack-starter/app/src/pages/login.tsx +63 -0
  100. package/templates/lupine-template-fullstack-starter/app/src/pages/mine.tsx +44 -0
  101. package/templates/lupine-template-fullstack-starter/app/src/pages/profile.tsx +58 -0
  102. package/templates/lupine-template-fullstack-starter/app/src/pages/register.tsx +48 -0
  103. package/templates/lupine-template-fullstack-starter/app/src/pages/reset-password.tsx +41 -0
  104. package/templates/lupine-template-fullstack-starter/app/src/pages/settings.tsx +33 -0
  105. package/templates/lupine-template-fullstack-starter/app/src/pages/story.tsx +46 -0
  106. package/templates/lupine-template-fullstack-starter/app/src/shell/api.ts +127 -0
  107. package/templates/lupine-template-fullstack-starter/app/src/shell/parts.tsx +100 -0
  108. package/templates/lupine-template-fullstack-starter/app/src/shell/stories.ts +65 -0
  109. package/templates/lupine-template-fullstack-starter/app/src/shell/texts.ts +79 -0
  110. package/templates/lupine-template-fullstack-starter/app/tsconfig.json +17 -0
  111. package/templates/lupine-template-fullstack-starter/lupine.json +31 -0
  112. package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
  113. package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
  114. package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
  115. package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
  116. package/templates/lupine-template-fullstack-starter/web/assets/favicon.ico +0 -0
  117. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
  118. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
  119. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
  120. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
  121. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
  122. package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
  123. package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
  124. package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
  125. package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
  126. package/templates/{lupine-template-responsive-starter/api → lupine-template-fullstack-starter/web}/package.json +1 -1
  127. package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
  128. package/templates/lupine-template-fullstack-starter/web/src/admin/components/home-search-component.tsx +125 -0
  129. package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-card.tsx +105 -0
  130. package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-list.tsx +105 -0
  131. package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-props.ts +34 -0
  132. package/templates/lupine-template-fullstack-starter/web/src/admin/index.html +23 -0
  133. package/templates/lupine-template-fullstack-starter/web/src/admin/index.tsx +49 -0
  134. package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-cfg.tsx +144 -0
  135. package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-item-edit.tsx +20 -0
  136. package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-item-list.tsx +23 -0
  137. package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-user.tsx +145 -0
  138. package/templates/lupine-template-fullstack-starter/web/src/index.html +28 -0
  139. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +16 -0
  140. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +37 -0
  141. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +14 -0
  142. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
  143. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +2 -1
  144. package/templates/lupine-template-responsive-starter/README.md +51 -0
  145. package/templates/lupine-template-responsive-starter/app/package.json +19 -0
  146. package/templates/lupine-template-responsive-starter/app/src/app.tsx +80 -0
  147. package/templates/lupine-template-responsive-starter/app/src/index.native.tsx +4 -0
  148. package/templates/lupine-template-responsive-starter/app/src/index.test.tsx +283 -0
  149. package/templates/lupine-template-responsive-starter/app/src/index.web.tsx +31 -0
  150. package/templates/lupine-template-responsive-starter/app/src/pages/about.tsx +23 -0
  151. package/templates/lupine-template-responsive-starter/app/src/pages/finance.tsx +48 -0
  152. package/templates/lupine-template-responsive-starter/app/src/pages/mine.tsx +60 -0
  153. package/templates/lupine-template-responsive-starter/app/src/pages/not-found.tsx +9 -0
  154. package/templates/lupine-template-responsive-starter/app/src/pages/note-detail.tsx +43 -0
  155. package/templates/lupine-template-responsive-starter/app/src/pages/note-edit.tsx +45 -0
  156. package/templates/lupine-template-responsive-starter/app/src/pages/note-search.tsx +62 -0
  157. package/templates/lupine-template-responsive-starter/app/src/pages/notes.tsx +71 -0
  158. package/templates/lupine-template-responsive-starter/app/src/pages/settings.tsx +55 -0
  159. package/templates/lupine-template-responsive-starter/app/src/pages/tools.tsx +112 -0
  160. package/templates/lupine-template-responsive-starter/app/src/shell/icons.ts +7 -0
  161. package/templates/lupine-template-responsive-starter/app/src/shell/layout.ts +18 -0
  162. package/templates/lupine-template-responsive-starter/app/src/shell/locales/zh-CN.ts +89 -0
  163. package/templates/lupine-template-responsive-starter/app/src/shell/menu.tsx +81 -0
  164. package/templates/lupine-template-responsive-starter/app/src/shell/nav.ts +12 -0
  165. package/templates/lupine-template-responsive-starter/app/src/shell/store.ts +72 -0
  166. package/templates/lupine-template-responsive-starter/app/src/shell/texts.ts +11 -0
  167. package/templates/lupine-template-responsive-starter/app/tsconfig.json +17 -0
  168. package/templates/lupine-template-responsive-starter/lupine.json +7 -6
  169. package/templates/lupine-template-responsive-starter/web/src/index.html +9 -2
  170. package/templates/lupine-template-responsive-starter/web/src/index.tsx +9 -34
  171. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +12 -6
  172. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +12 -31
  173. package/templates/common/AI_CONTEXT.md +0 -1002
  174. package/templates/common/apps/server/src/app-loader.ts +0 -4
  175. package/templates/lupine-template-cv-starter/api/package.json +0 -6
  176. package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +0 -4
  177. package/templates/lupine-template-cv-starter/api/src/index.ts +0 -15
  178. package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +0 -15
  179. package/templates/lupine-template-doc-starter/api/package.json +0 -6
  180. package/templates/lupine-template-doc-starter/api/resources/config_default.json +0 -6
  181. package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +0 -4
  182. package/templates/lupine-template-doc-starter/api/src/index.ts +0 -15
  183. package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +0 -6
  184. package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +0 -4
  185. package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +0 -5
  186. package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +0 -15
  187. package/templates/lupine-template-hello-world/api/resources/config_default.json +0 -6
  188. package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
  189. package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
  190. package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
  191. package/templates/lupine-template-hello-world/web/src/styles/app.css +0 -0
  192. package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
  193. package/templates/lupine-template-responsive-starter/api/resources/config_default.json +0 -6
  194. package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +0 -4
  195. package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +0 -18
  196. package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +0 -76
  197. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +0 -93
  198. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +0 -86
  199. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -80
  200. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -220
  201. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -119
  202. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -116
  203. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -154
  204. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -193
  205. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +0 -95
  206. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +0 -182
  207. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -52
  208. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -43
  209. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -46
  210. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -452
  211. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -325
  212. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -46
  213. package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +0 -87
  214. package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +0 -45
  215. package/templates/lupine-template-responsive-starter/web/src/styles/app.css +0 -0
  216. package/templates/lupine-template-responsive-starter/web/src/styles/base-css.ts +0 -65
  217. package/templates/lupine-template-responsive-starter/web/src/styles/global.css +0 -2130
  218. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +0 -16
  219. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/01-experience/index.md +0 -0
  220. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/02-projects/index.md +0 -0
  221. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/03-skills/index.md +0 -0
  222. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/04-education/index.md +0 -0
  223. /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/index.md +0 -0
  224. /package/templates/lupine-template-cv-starter/{web → app}/markdown/index.md +0 -0
  225. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/01-experience/index.md +0 -0
  226. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/02-projects/index.md +0 -0
  227. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/03-skills/index.md +0 -0
  228. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/04-education/index.md +0 -0
  229. /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/index.md +0 -0
  230. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/01-experience/index.html +0 -0
  231. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/02-projects/index.html +0 -0
  232. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/03-skills/index.html +0 -0
  233. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/04-education/index.html +0 -0
  234. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/index.html +0 -0
  235. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/index.html +0 -0
  236. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
  237. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/01-experience/index.html +0 -0
  238. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/02-projects/index.html +0 -0
  239. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/03-skills/index.html +0 -0
  240. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/04-education/index.html +0 -0
  241. /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
  242. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/index.md +0 -0
  243. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/list.md +0 -0
  244. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/install.md +0 -0
  245. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/started.md +0 -0
  246. /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/index.md +0 -0
  247. /package/templates/lupine-template-doc-starter/{web → app}/markdown/index.md +0 -0
  248. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/index.md +0 -0
  249. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/list.md +0 -0
  250. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/install.md +0 -0
  251. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/started.md +0 -0
  252. /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/index.md +0 -0
  253. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/index.html +0 -0
  254. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/list.html +0 -0
  255. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/install.html +0 -0
  256. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/started.html +0 -0
  257. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/index.html +0 -0
  258. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/index.html +0 -0
  259. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
  260. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/index.html +0 -0
  261. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/list.html +0 -0
  262. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/install.html +0 -0
  263. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/started.html +0 -0
  264. /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
  265. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/api/src/index.ts +0 -0
  266. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/assets/favicon.ico +0 -0
  267. /package/templates/{lupine-template-cv-starter → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
  268. /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
  269. /package/templates/{lupine-template-cv-starter/web/src → lupine-template-fullstack-starter/web/src/models}/client-env-keys.ts +0 -0
@@ -0,0 +1,20 @@
1
+ import { onCleanup, serverRequest, View } from 'lupine.native.core';
2
+ import { router } from 'lupine.native.components';
3
+ import { runApp } from 'lupine.native.core/web';
4
+ import { App } from './app';
5
+
6
+ /** The app follows the address: the address bar shows its page (/me), and the buttons of the browser go back and forward in it. */
7
+ export const followAddress = () => router.followUrl();
8
+
9
+ /** The app as a page of the site (web/src/index.tsx: pageRouter.use('*', AppPage, { keep: true })); in the browser it follows the address. */
10
+ export const AppPage = () => {
11
+ if (!serverRequest()) onCleanup(followAddress());
12
+ return (
13
+ <View style={{ height: '100%' }}>
14
+ <App />
15
+ </View>
16
+ );
17
+ };
18
+
19
+ // The web version without the site: lupine-native web starts it in document.body.
20
+ export const start = (container: HTMLElement) => runApp(AppPage, container);
@@ -0,0 +1,65 @@
1
+ import { Button as NativeButton, createSignal, Slider, Switch, TextInput, View } from 'lupine.native.core';
2
+ import { ActionSheet, Avatar, Badge, Button, Card, col, Header, Icon, MessageBox, Row, Screen, Section, T, t, TextField, Toast, tr } from 'lupine.native.components';
3
+ import * as icons from 'lupine.core/icons';
4
+
5
+ const line = { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 10 } as const;
6
+
7
+ /** What exists so far: the platform's own controls, and what is built from View, Text and Icon. */
8
+ export const Components = () => {
9
+ const [on, setOn] = createSignal(true);
10
+ const [level, setLevel] = createSignal(0.4);
11
+ const [text, setText] = createSignal('');
12
+ const [taps, setTaps] = createSignal(0);
13
+ return (
14
+ <Screen header={<Header title={tr('nav.components', 'Components')} />} testID='page-components'>
15
+ <View style={{ padding: 16, gap: 16 }}>
16
+ <T kind='subtitle'>Platform controls</T>
17
+ <Card style={{ gap: 12 }}>
18
+ <View style={line}>
19
+ <NativeButton title='Button' onPress={() => setTaps((n) => n + 1)} testID='native-button' />
20
+ <T testID='native-taps'>{() => `${taps()} taps`}</T>
21
+ </View>
22
+ <View style={line}>
23
+ <Switch value={on} onValueChange={setOn} testID='c-switch' />
24
+ <T>{() => (on() ? 'on' : 'off')}</T>
25
+ </View>
26
+ <Slider value={level} onValueChange={setLevel} testID='c-slider' />
27
+ <T testID='c-level'>{() => `${Math.round(level() * 100)}%`}</T>
28
+ <TextInput value={text} onChangeText={setText} placeholder='TextInput' />
29
+ </Card>
30
+ <T kind='subtitle'>Buttons</T>
31
+ <View style={line}>
32
+ {(['primary', 'secondary', 'outline', 'ghost', 'destructive'] as const).map((kind) => <Button title={kind} kind={kind} onPress={() => Toast.info(kind)} />)}
33
+ </View>
34
+ <View style={line}>
35
+ <Button title='small' size='small' />
36
+ <Button title='large' size='large' icon={icons.check} kind='primary' />
37
+ <Button title='disabled' disabled />
38
+ </View>
39
+ <T kind='subtitle'>Text field</T>
40
+ <TextField label='Label' value={text} onChangeText={setText} placeholder='Type here' />
41
+ <T kind='caption'>{() => `${text().length} characters`}</T>
42
+ <T kind='subtitle'>Avatar, badge, icons</T>
43
+ <View style={line}>
44
+ <Avatar name='Ada Lovelace' />
45
+ <Avatar name='Grace' size={56} />
46
+ <Badge count={3} />
47
+ <Badge count={120} />
48
+ </View>
49
+ <View style={line}>
50
+ {/* the icons themselves, not their names: a name alone is only there after another place used the icon */}
51
+ {[icons.home, icons.grid, icons.bell, icons.user, icons.settings, icons.camera, icons.image, icons.heart, icons.clock, icons.lock, icons.palette, icons.language, icons.sun, icons.moon, icons.trash, icons.search].map((icon) => (
52
+ <Icon name={icon} color={col('primary')} />
53
+ ))}
54
+ </View>
55
+ </View>
56
+ <Section title='Overlays'>
57
+ <Row label='Toast' onPress={() => Toast.success('Saved')} />
58
+ <Row label='ActionSheet' onPress={async () => Toast.info(String(await ActionSheet.select({ title: 'Choose', options: ['a', 'b', 'c'].map((v) => ({ label: v.toUpperCase(), value: v })) })))} />
59
+ <Row label='MessageBox alert' onPress={() => MessageBox.alert({ message: 'Saved to this device' })} />
60
+ <Row label='MessageBox confirm' onPress={async () => Toast.info(String(await MessageBox.confirm({ message: t('ln.ok', 'OK') + '?' })))} />
61
+ </Section>
62
+ <View style={{ height: 24 }} />
63
+ </Screen>
64
+ );
65
+ };
@@ -0,0 +1,38 @@
1
+ import { Platform, View } from 'lupine.native.core';
2
+ import { Card, col, EmptyView, Icon, router, Screen, T, t, tr } from 'lupine.native.components';
3
+ import { FEATURED, RECENT } from '../shell/data';
4
+ import * as icons from 'lupine.core/icons';
5
+
6
+ const back = () => void router.back();
7
+
8
+ export const Item = ({ id }: { id: string }) => {
9
+ const found = [...FEATURED, ...RECENT].find((x) => x.id === id);
10
+ return (
11
+ <Screen title={tr('item.title', 'Item {id}', { id })} onBack={back} padded testID='page-item'>
12
+ <View style={{ gap: 12 }}>
13
+ <T kind='title' testID='item-title'>{found ? found.title : tr('item.title', 'Item {id}', { id })}</T>
14
+ <Card><T>{tr('item.body', 'Detail pages are normal routes (/item/[id]): deep links and the browser back button work, and the web server can render them.')}</T></Card>
15
+ </View>
16
+ </Screen>
17
+ );
18
+ };
19
+
20
+ const edition = Platform.select({ ios: 'iOS (UIKit)', android: 'Android', macos: 'macOS (AppKit)', windows: 'Windows (Win32)', web: 'Web' });
21
+
22
+ export const About = () => (
23
+ <Screen title={tr('nav.about', 'About')} onBack={back} testID='page-about'>
24
+ <View style={{ alignItems: 'center', padding: 32, gap: 12 }}>
25
+ <Icon name={icons.logo} size={64} color={col('primary')} />
26
+ <T kind='title'>{tr('app.name', 'Lupine Notes')}</T>
27
+ <T kind='secondary' style={{ textAlign: 'center' }}>{tr('app.tagline', 'One code base for iOS, Android, web and desktop')}</T>
28
+ <T style={{ textAlign: 'center', marginTop: 12 }}>{tr('about.text', 'Built with lupine.native. Edit src/pages to change the pages and src/shell for the frame.')}</T>
29
+ <T kind='caption' testID='about-edition'>{edition}</T>
30
+ </View>
31
+ </Screen>
32
+ );
33
+
34
+ export const NotFound = () => (
35
+ <Screen title='404' onBack={back}>
36
+ <EmptyView icon={icons.search} title='Page not found' action={() => t('nav.home', 'Home')} onAction={() => router.navigate('/')} />
37
+ </Screen>
38
+ );
@@ -0,0 +1,25 @@
1
+ import { View } from 'lupine.native.core';
2
+ import { ActionSheet, Button, EmptyView, Header, router, Screen, t, Toast, tr } from 'lupine.native.components';
3
+ import * as icons from 'lupine.core/icons';
4
+
5
+ export const Discover = () => {
6
+ const create = async () => {
7
+ const options = [
8
+ { label: t('discover.note', 'New note'), value: 'note', icon: icons.edit },
9
+ { label: t('discover.photo', 'Take photo'), value: 'photo', icon: icons.camera },
10
+ { label: t('discover.task', 'New task'), value: 'task', icon: icons.check },
11
+ ];
12
+ const v = await ActionSheet.select({ title: t('discover.title', 'Create something'), options });
13
+ // a note: on the page of the notes (kept on the server)
14
+ if (v === 'note') return router.push('/notes');
15
+ if (v) Toast.success(t('discover.created', 'Created: {what}', { what: options.find((o) => o.value === v)!.label }));
16
+ };
17
+ return (
18
+ <Screen header={<Header title={tr('nav.discover', 'Create')} />} testID='page-discover'>
19
+ <View style={{ padding: 24, alignItems: 'center', gap: 16 }}>
20
+ <EmptyView icon={icons.plus} title={tr('discover.title', 'Create something')} />
21
+ <Button title={tr('discover.title', 'Create something')} kind='primary' icon={icons.plus} onPress={create} testID='create-button' />
22
+ </View>
23
+ </Screen>
24
+ );
25
+ };
@@ -0,0 +1,76 @@
1
+ import { createSignal, media, Text, View } from 'lupine.native.core';
2
+ import { Button, Card, col, Header, Icon, Pager, router, Screen, SlidePanel, T, tr } from 'lupine.native.components';
3
+ import { createAppMenu } from '../shell/AppMenu';
4
+ import { FEATURED, RECENT } from '../shell/data';
5
+ import * as icons from 'lupine.core/icons';
6
+
7
+ export const Home = () => {
8
+ const menu = createAppMenu();
9
+ const [panel, setPanel] = createSignal(false);
10
+ // 2, 3 or 4 in a row, by css on the web: the page of the server is right at once
11
+ const width = media<`${number}%`>({ base: '48%', mobileAbove: '31%', tabletAbove: '23%' });
12
+ const shortcuts = [
13
+ { id: 'notes', icon: icons.edit, label: tr('notes.title', 'My notes'), onPress: () => router.push('/notes') },
14
+ { id: 'settings', icon: icons.settings, label: tr('nav.settings', 'Settings'), onPress: () => router.push('/settings') },
15
+ { id: 'layers', icon: icons.layers, label: tr('home.openPanel', 'Open slide window'), onPress: () => setPanel(true) },
16
+ { id: 'info', icon: icons.info, label: tr('nav.about', 'About'), onPress: () => router.push('/about') },
17
+ ];
18
+ return (
19
+ <Screen header={<Header title={tr('nav.home', 'Home')} left={menu.button} />} testID='page-home'>
20
+ <View style={{ padding: 16, gap: 18 }}>
21
+ <View>
22
+ <T kind='secondary'>{tr('home.welcome', 'Welcome back')}</T>
23
+ <T kind='title' style={{ fontSize: 26 }} testID='app-name'>{tr('app.name', 'Lupine Notes')}</T>
24
+ </View>
25
+
26
+ <View style={{ gap: 8 }}>
27
+ <T kind='subtitle'>{tr('home.featured', 'Featured')}</T>
28
+ <Pager
29
+ height={150} testID='pager'
30
+ pages={FEATURED.map((f) => (
31
+ <View onPress={() => router.push(`/item/${f.id}`)} style={{ flex: 1, marginHorizontal: 2, borderRadius: 16, backgroundColor: f.color, padding: 18, justifyContent: 'flex-end' }}>
32
+ <Text style={{ color: '#ffffff', fontSize: 22, fontWeight: '700' }}>{f.title}</Text>
33
+ <Text style={{ color: '#ffffff', fontSize: 14 }}>{f.subtitle}</Text>
34
+ </View>
35
+ ))}
36
+ />
37
+ </View>
38
+
39
+ <View style={{ gap: 8 }}>
40
+ <T kind='subtitle'>{tr('home.shortcuts', 'Shortcuts')}</T>
41
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 10 }}>
42
+ {shortcuts.map((s) => (
43
+ <Card onPress={s.onPress} style={{ width, flexGrow: 1, alignItems: 'center', gap: 8, paddingVertical: 18 }} testID={`shortcut-${s.id}`}>
44
+ <View style={{ width: 44, height: 44, borderRadius: 12, alignItems: 'center', justifyContent: 'center', backgroundColor: col('primaryBg') }}>
45
+ <Icon name={s.icon} color={col('primary')} />
46
+ </View>
47
+ <T style={{ textAlign: 'center' }} numberOfLines={2}>{s.label}</T>
48
+ </Card>
49
+ ))}
50
+ </View>
51
+ </View>
52
+
53
+ <View style={{ gap: 8 }}>
54
+ <T kind='subtitle'>{tr('home.recent', 'Recent items')}</T>
55
+ {RECENT.map((r) => (
56
+ <Card onPress={() => router.push(`/item/${r.id}`)} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }} testID={`recent-${r.id}`}>
57
+ <Icon name={r.icon} color={col('textSecondary')} />
58
+ <View style={{ flex: 1 }}>
59
+ <T>{r.title}</T>
60
+ <T kind='caption'>{r.when}</T>
61
+ </View>
62
+ <Icon name={icons.chevronRight} size={16} color={col('textTertiary')} />
63
+ </Card>
64
+ ))}
65
+ </View>
66
+ </View>
67
+ {menu.menu}
68
+ <SlidePanel visible={panel} onClose={() => setPanel(false)} title={tr('home.openPanel', 'Open slide window')} testID='home-panel'>
69
+ <View style={{ padding: 20, gap: 16 }}>
70
+ <T>{tr('home.panelText', 'This window slides in over the current page — use it for details and forms that do not need their own URL.')}</T>
71
+ <Button title={tr('ln.close', 'Close')} kind='primary' onPress={() => setPanel(false)} testID='panel-close' />
72
+ </View>
73
+ </SlidePanel>
74
+ </Screen>
75
+ );
76
+ };
@@ -0,0 +1,49 @@
1
+ import { createMemo, createSignal, For, insets, ScrollView, Show, Text, View } from 'lupine.native.core';
2
+ import { Avatar, col, EmptyView, Header, IconButton, Line, t, Toast, tr } from 'lupine.native.components';
3
+ import { MESSAGES } from '../shell/data';
4
+ import * as icons from 'lupine.core/icons';
5
+
6
+ const [items, setItems] = createSignal(MESSAGES);
7
+ export const unread = createMemo(() => items().filter((m) => m.unread).length);
8
+
9
+ export const Inbox = () => {
10
+ const [refreshing, setRefreshing] = createSignal(false);
11
+ const refresh = () => {
12
+ setRefreshing(true);
13
+ setTimeout(() => setRefreshing(false), 800);
14
+ };
15
+ const markRead = () => {
16
+ setItems((l) => l.map((m) => (m.unread ? { ...m, unread: false } : m)));
17
+ Toast.success(t('inbox.markRead', 'Mark all as read'));
18
+ };
19
+ return (
20
+ <View testID='page-inbox' style={{ flex: 1, backgroundColor: col('bg') }}>
21
+ <Header title={tr('nav.inbox', 'Inbox')} right={<IconButton name={icons.check} onPress={markRead} testID='mark-read' />} />
22
+ <Show when={() => unread() > 0}>
23
+ <Text testID='unread' style={{ paddingHorizontal: 16, paddingTop: 10, color: col('textSecondary') }}>{() => t('inbox.unread', '{n} unread', { n: unread() })}</Text>
24
+ </Show>
25
+ <ScrollView style={{ flex: 1 }} refreshing={refreshing} onRefresh={refresh}>
26
+ <View style={{ paddingBottom: () => insets().bottom }}>
27
+ <For each={items} fallback={<EmptyView title={tr('inbox.empty', 'You are all caught up')} />}>
28
+ {(m) => (
29
+ <View>
30
+ <View style={{ flexDirection: 'row', gap: 12, paddingHorizontal: 16, paddingVertical: 12 }}>
31
+ <Avatar name={m.from} />
32
+ <View style={{ flex: 1 }}>
33
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
34
+ <Text style={{ fontSize: 16, fontWeight: m.unread ? '700' : 'normal', color: col('text') }}>{m.from}</Text>
35
+ <Text style={{ fontSize: 12, color: col('textTertiary') }}>{m.when}</Text>
36
+ </View>
37
+ <Text numberOfLines={2} style={{ fontSize: 14, color: col('textSecondary') }}>{m.text}</Text>
38
+ </View>
39
+ {m.unread && <View style={{ width: 8, height: 8, borderRadius: 4, marginTop: 8, backgroundColor: col('primary') }} />}
40
+ </View>
41
+ <Line />
42
+ </View>
43
+ )}
44
+ </For>
45
+ </View>
46
+ </ScrollView>
47
+ </View>
48
+ );
49
+ };
@@ -0,0 +1,54 @@
1
+ import { createSignal, Show, View } from 'lupine.native.core';
2
+ import { Button, createForm, PasswordField, router, rules, Screen, T, t, TextField, Toast, tr } from 'lupine.native.components';
3
+ import * as icons from 'lupine.core/icons';
4
+ import { api, messageOf, serverAddress } from '../shell/api';
5
+
6
+ type Mode = 'login' | 'register';
7
+ // the rules of the API (api/src/service/user-api.ts); it checks them again
8
+ const NAME_RE = /^[A-Za-z0-9_.@-]{3,50}$/;
9
+
10
+ /** Sign in, or create an account (signed in at once). The account and the notes are on the server. */
11
+ export const Login = () => {
12
+ const [mode, setMode] = createSignal<Mode>('login');
13
+ const [busy, setBusy] = createSignal(false);
14
+ const registering = () => mode() === 'register';
15
+ const required = rules.required();
16
+ let password = () => '';
17
+ const form = createForm(
18
+ { username: '', password: '', password2: '' },
19
+ {
20
+ username: [required, (v) => registering() && !NAME_RE.test(v.trim()) && t('auth.usernameRule', '3 to 50 characters: letters, digits, _ . @ -')],
21
+ password: [required, (v) => registering() && (rules.min(6)(v) || rules.max(256)(v))],
22
+ password2: (v) => registering() && (required(v) || (v !== password() && t('auth.passwordsDiffer', 'The two passwords differ'))),
23
+ }
24
+ );
25
+ password = () => form.value('password');
26
+ const submit = async () => {
27
+ if (busy() || !form.validate()) return;
28
+ setBusy(true);
29
+ const { username, password } = form.values();
30
+ const answer = registering() ? await api.register(username.trim(), password) : await api.login(username.trim(), password);
31
+ setBusy(false);
32
+ if (answer.status !== 'ok') return Toast.error(messageOf(answer));
33
+ const name = api.user()?.username || username.trim();
34
+ Toast.success(registering() ? t('auth.registered', 'Welcome, {name}: your account is ready', { name }) : t('auth.welcome', 'Signed in as {name}', { name }));
35
+ router.back();
36
+ };
37
+ return (
38
+ <Screen title={() => (registering() ? t('auth.register', 'Create account') : t('auth.signIn', 'Sign in'))} onBack={() => void router.back()} testID='page-login'>
39
+ <View style={{ padding: 20, gap: 14, width: '100%', maxWidth: 420, alignSelf: 'center' }}>
40
+ <TextField label={tr('auth.username', 'User name')} icon={icons.user} {...form.text('username')} testID='login-username' />
41
+ <PasswordField label={tr('auth.password', 'Password')} {...form.text('password')} onSubmit={() => void (registering() || submit())} testID='login-password' />
42
+ <Show when={registering}>
43
+ <PasswordField label={tr('auth.password2', 'Password again')} {...form.text('password2')} onSubmit={submit} testID='login-password2' />
44
+ </Show>
45
+ <Button title={() => (registering() ? t('auth.register', 'Create account') : t('auth.signIn', 'Sign in'))} kind='primary' block loading={busy} onPress={submit} testID='login-submit' />
46
+ <Button
47
+ title={() => (registering() ? t('auth.haveAccount', 'I already have an account') : t('auth.noAccount', 'Create a new account'))} kind='ghost' block
48
+ onPress={() => setMode(registering() ? 'login' : 'register')} testID='login-switch'
49
+ />
50
+ <T kind='caption' style={{ textAlign: 'center' }} testID='login-server'>{() => `${t('auth.server', 'Server')}: ${serverAddress() || t('auth.thisSite', 'this site')}`}</T>
51
+ </View>
52
+ </Screen>
53
+ );
54
+ };
@@ -0,0 +1,32 @@
1
+ import { Show, View } from 'lupine.native.core';
2
+ import { Avatar, Button, Header, router, Row, Screen, Section, T, t, Toast, tr } from 'lupine.native.components';
3
+ import { api } from '../shell/api';
4
+ import * as icons from 'lupine.core/icons';
5
+
6
+ export const Me = () => {
7
+ const name = () => api.user()?.username || t('me.guest', 'Guest');
8
+ return (
9
+ <Screen header={<Header title={tr('nav.me', 'Me')} />} grouped testID='page-me'>
10
+ <View style={{ alignItems: 'center', gap: 8, paddingTop: 24 }}>
11
+ <Avatar name={name} size={72} />
12
+ <T kind='subtitle' testID='me-name'>{name}</T>
13
+ <Show
14
+ when={api.user}
15
+ fallback={<Button title={tr('me.signIn', 'Sign in')} kind='primary' size='small' onPress={() => router.push('/login')} testID='me-signin' />}
16
+ >
17
+ <Button title={tr('auth.signOut', 'Sign out')} size='small' onPress={() => void api.logout()} testID='me-signout' />
18
+ </Show>
19
+ </View>
20
+ <Section>
21
+ <Row label={tr('notes.title', 'My notes')} icon={icons.edit} iconColor='#34c759' onPress={() => router.push('/notes')} testID='me-notes' />
22
+ <Row label={tr('me.profile', 'Profile')} icon={icons.user} iconColor='#1677ff' onPress={() => Toast.info(t('me.profile', 'Profile'))} />
23
+ <Row label={tr('me.favourites', 'Favourites')} icon={icons.heart} iconColor='#ff375f' onPress={() => Toast.info(t('me.favourites', 'Favourites'))} />
24
+ <Row label={tr('me.history', 'History')} icon={icons.clock} iconColor='#ff9f0a' onPress={() => Toast.info(t('me.history', 'History'))} />
25
+ </Section>
26
+ <Section>
27
+ <Row label={tr('nav.settings', 'Settings')} icon={icons.settings} iconColor='#8e8e93' onPress={() => router.push('/settings')} testID='me-settings' />
28
+ <Row label={tr('me.help', 'Help & feedback')} icon={icons.help} iconColor='#30b0c7' onPress={() => router.push('/about')} />
29
+ </Section>
30
+ </Screen>
31
+ );
32
+ };
@@ -0,0 +1,128 @@
1
+ import { createEffect, createMemo, createSignal, For, Show, untrack, View } from 'lupine.native.core';
2
+ import { Button, Card, col, EmptyView, Icon, IconButton, router, Screen, T, t, TextField, Toast, tr } from 'lupine.native.components';
3
+ import * as icons from 'lupine.core/icons';
4
+ import { api, messageOf, Note } from '../shell/api';
5
+
6
+ /** the time of a note (ISO, UTC) in the time zone of the device */
7
+ const when = (iso: string) => {
8
+ const d = new Date(iso);
9
+ if (Number.isNaN(d.getTime())) return iso;
10
+ const two = (n: number) => (n < 10 ? '0' : '') + n;
11
+ return `${d.getFullYear()}-${two(d.getMonth() + 1)}-${two(d.getDate())} ${two(d.getHours())}:${two(d.getMinutes())}`;
12
+ };
13
+
14
+ /** The notes of the signed-in user, on the server: newest first, pull down (or the button) to load them again. */
15
+ export const Notes = () => {
16
+ const [notes, setNotes] = createSignal<Note[]>([]);
17
+ const [more, setMore] = createSignal(false);
18
+ const [loading, setLoading] = createSignal(false);
19
+ const [loaded, setLoaded] = createSignal(false);
20
+ // the message of the last load that failed (offline, an error of the server); the notes of before stay
21
+ const [error, setError] = createSignal('');
22
+ const [text, setText] = createSignal('');
23
+ const [adding, setAdding] = createSignal(false);
24
+
25
+ const load = async (older = false): Promise<void> => {
26
+ const uid = api.user()?.id;
27
+ if (!uid || loading()) return;
28
+ setLoading(true);
29
+ const list = notes();
30
+ const answer = await api.notes(older && list.length ? list[list.length - 1].id : undefined);
31
+ setLoading(false);
32
+ // the session is over: signed out already (shell/api.ts), the page asks to sign in again
33
+ if (answer.code === 'not_signed_in') {
34
+ Toast.info(messageOf(answer));
35
+ return;
36
+ }
37
+ // signed out meanwhile, or in as someone else: not these notes
38
+ if (api.user()?.id !== uid) return api.user() ? load() : undefined;
39
+ if (answer.status !== 'ok') {
40
+ setError(messageOf(answer));
41
+ return;
42
+ }
43
+ setNotes(older ? [...list, ...(answer.notes || [])] : answer.notes || []);
44
+ setMore(!!answer.more);
45
+ setLoaded(true);
46
+ setError('');
47
+ };
48
+ // when someone signs in (and again for another user); signed out: nothing is left on the page
49
+ const userId = createMemo(() => api.user()?.id ?? null);
50
+ createEffect(() => {
51
+ if (userId() !== null) return untrack(() => void load());
52
+ setNotes([]);
53
+ setMore(false);
54
+ setLoaded(false);
55
+ setError('');
56
+ });
57
+
58
+ const add = async () => {
59
+ const value = text().trim();
60
+ if (!value || adding()) return;
61
+ setAdding(true);
62
+ const answer = await api.addNote(value);
63
+ setAdding(false);
64
+ if (answer.status === 'ok' && answer.note) {
65
+ setNotes([answer.note, ...notes()]);
66
+ setText('');
67
+ } else Toast.error(messageOf(answer));
68
+ };
69
+ const remove = async (n: Note) => {
70
+ const answer = await api.deleteNote(n.id);
71
+ // gone already: gone here, too
72
+ if (answer.status === 'ok' || answer.code === 'note_not_found') {
73
+ setNotes(notes().filter((x) => x.id !== n.id));
74
+ Toast.info(t('notes.deleted', 'Note deleted'));
75
+ } else Toast.error(messageOf(answer));
76
+ };
77
+
78
+ return (
79
+ <Screen
80
+ title={tr('notes.title', 'My notes')} onBack={() => void router.back()} testID='page-notes'
81
+ right={<Show when={api.user}><IconButton name={icons.refresh} onPress={() => void load()} testID='notes-refresh' /></Show>}
82
+ refreshing={loading} onRefresh={() => void load()}
83
+ >
84
+ <View style={{ padding: 16, gap: 12, width: '100%', maxWidth: 720, alignSelf: 'center' }}>
85
+ <Show
86
+ when={api.user}
87
+ fallback={
88
+ <View style={{ alignItems: 'center', padding: 32, gap: 12 }}>
89
+ <Icon name={icons.lock} size={42} color={col('textTertiary')} />
90
+ <T kind='subtitle' style={{ textAlign: 'center' }} testID='notes-signed-out'>{tr('notes.signInFirst', 'Sign in to keep notes on the server')}</T>
91
+ <T kind='secondary' style={{ textAlign: 'center' }}>{tr('notes.signInText', 'They are kept with your account, so you have them on every device and on the web.')}</T>
92
+ <Button title={tr('auth.signIn', 'Sign in')} kind='primary' onPress={() => router.push('/login')} testID='notes-signin' />
93
+ </View>
94
+ }
95
+ >
96
+ <View style={{ flexDirection: 'row', gap: 8, alignItems: 'flex-end' }}>
97
+ <TextField containerStyle={{ flex: 1 }} value={text} onChangeText={setText} placeholder={tr('notes.placeholder', 'Write a note…')} maxLength={2000} onSubmit={add} testID='note-input' />
98
+ <Button title={tr('notes.add', 'Add')} kind='primary' onPress={add} loading={adding} disabled={() => !text().trim()} testID='note-add' />
99
+ </View>
100
+ <Show when={error}>
101
+ <Card style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
102
+ <Icon name={icons.warning} color={col('error')} />
103
+ <T style={{ flex: 1 }} testID='notes-error'>{error}</T>
104
+ <Button title={tr('notes.retry', 'Try again')} size='small' onPress={() => void load()} testID='notes-retry' />
105
+ </Card>
106
+ </Show>
107
+ <Show when={() => loaded() && !notes().length && !error()}>
108
+ <EmptyView icon={icons.edit} title={tr('notes.empty', 'No notes yet')} />
109
+ </Show>
110
+ <For each={notes}>
111
+ {(n) => (
112
+ <Card style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
113
+ <View style={{ flex: 1 }}>
114
+ <T testID={`note-${n.id}`}>{n.text}</T>
115
+ <T kind='caption'>{when(n.created_at)}</T>
116
+ </View>
117
+ <IconButton name={icons.trash} testID={`note-delete-${n.id}`} onPress={() => void remove(n)} />
118
+ </Card>
119
+ )}
120
+ </For>
121
+ <Show when={more}>
122
+ <Button title={tr('notes.more', 'Older notes')} kind='ghost' block loading={loading} onPress={() => void load(true)} testID='notes-more' />
123
+ </Show>
124
+ </Show>
125
+ </View>
126
+ </Screen>
127
+ );
128
+ };
@@ -0,0 +1,45 @@
1
+ import { createSignal, Slider, Switch } from 'lupine.native.core';
2
+ import { ActionSheet, lang, languages, MessageBox, router, Row, Screen, Section, setLang, setThemePref, t, themePref, themes, Toast, tr } from 'lupine.native.components';
3
+ import * as icons from 'lupine.core/icons';
4
+ import { serverAddress } from '../shell/api';
5
+
6
+ export const Settings = () => {
7
+ const [push, setPush] = createSignal(true);
8
+ const [sound, setSound] = createSignal(false);
9
+ const [size, setSize] = createSignal(1);
10
+ const label = (n: string) => (n === 'system' ? t('ln.themeSystem', 'System') : n === 'light' ? t('ln.themeLight', 'Light') : n === 'dark' ? t('ln.themeDark', 'Dark') : n);
11
+ const pickTheme = async () => {
12
+ const v = await ActionSheet.select({ title: t('settings.theme', 'Theme'), selected: themePref(), options: ['system', ...Object.keys(themes)].map((n) => ({ label: label(n), value: n })) });
13
+ if (v) setThemePref(v);
14
+ };
15
+ const pickLang = async () => {
16
+ const v = await ActionSheet.select({ title: t('settings.language', 'Language'), selected: lang(), options: languages.map((l) => ({ label: l.name, value: l.code })) });
17
+ if (v) setLang(v);
18
+ };
19
+ const clear = async () => {
20
+ if (await MessageBox.confirm({ message: t('settings.clearCache', 'Clear cache') + '?', okText: t('ln.delete', 'Delete'), destructive: true })) Toast.success(t('settings.cacheCleared', 'Cache cleared'));
21
+ };
22
+ return (
23
+ <Screen title={tr('nav.settings', 'Settings')} onBack={() => void router.back()} grouped testID='page-settings'>
24
+ <Section title={tr('settings.appearance', 'Appearance')}>
25
+ <Row label={tr('settings.theme', 'Theme')} icon={icons.palette} iconColor='#5e5ce6' value={() => label(themePref())} onPress={pickTheme} testID='settings-theme' />
26
+ <Row label={tr('settings.language', 'Language')} icon={icons.language} iconColor='#34c759' value={() => languages.find((l) => l.code === lang())!.name} onPress={pickLang} testID='settings-language' />
27
+ <Row label={tr('settings.textSize', 'Text size')} icon={icons.edit} iconColor='#ff9f0a' value={() => `${Math.round(size() * 100)}%`} testID='settings-size'>
28
+ <Slider value={size} min={0.8} max={1.4} step={0.1} onValueChange={setSize} testID='size-slider' />
29
+ </Row>
30
+ </Section>
31
+ <Section title={tr('settings.notifications', 'Notifications')}>
32
+ <Row label={tr('settings.pushEnabled', 'Push notifications')} icon={icons.bell} iconColor='#ff3b30' right={<Switch value={push} onValueChange={setPush} testID='settings-push' />} />
33
+ <Row label={tr('settings.sound', 'Sound')} icon={icons.volume} iconColor='#ff2d55' right={<Switch value={sound} onValueChange={setSound} />} />
34
+ </Section>
35
+ <Section title={tr('settings.storage', 'Storage')}>
36
+ <Row label={tr('settings.clearCache', 'Clear cache')} destructive onPress={clear} testID='settings-clear' />
37
+ </Section>
38
+ <Section title={tr('settings.app', 'App')}>
39
+ {/* the API: WEB.API_BASE_URL of the env file of the build; the web version uses the site it comes from */}
40
+ <Row label={tr('settings.server', 'Server')} value={() => serverAddress() || t('settings.thisSite', 'This site')} testID='settings-server' />
41
+ <Row label={tr('settings.version', 'Version')} value='0.1.0' />
42
+ </Section>
43
+ </Screen>
44
+ );
45
+ };
@@ -0,0 +1,44 @@
1
+ import { createSignal, media, Text, View } from 'lupine.native.core';
2
+ import { col, Icon, IconButton, router, Row, Section, setThemePref, SideMenu, t, theme, tr } from 'lupine.native.components';
3
+ import * as icons from 'lupine.core/icons';
4
+
5
+ /** The menu button of the header (phones only) and the drawer it opens. */
6
+ export const createAppMenu = () => {
7
+ const [open, setOpen] = createSignal(false);
8
+ const go = (path: string) => {
9
+ setOpen(false);
10
+ setTimeout(() => router.push(path), 120);
11
+ };
12
+ // phones only (css on the web)
13
+ const button = (
14
+ <View style={{ display: media<'flex' | 'none'>({ base: 'flex', mobileAbove: 'none' }) }}>
15
+ <IconButton name={icons.menu} onPress={() => setOpen(true)} testID='menu-button' />
16
+ </View>
17
+ );
18
+ const menu = (
19
+ <SideMenu visible={open} onClose={() => setOpen(false)} testID='side-menu'>
20
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, padding: 18 }}>
21
+ <Icon name={icons.logo} size={28} color={col('primary')} />
22
+ <View style={{ flex: 1 }}>
23
+ <Text numberOfLines={1} style={{ fontSize: 17, fontWeight: '700', color: col('text') }}>{tr('app.name', 'Lupine Notes')}</Text>
24
+ <Text numberOfLines={2} style={{ fontSize: 12, color: col('textSecondary') }}>{tr('app.tagline', 'One code base for iOS, Android, web and desktop')}</Text>
25
+ </View>
26
+ </View>
27
+ <Section>
28
+ <Row label={tr('nav.settings', 'Settings')} icon={icons.settings} iconColor='#8e8e93' onPress={() => go('/settings')} testID='menu-settings' />
29
+ <Row label={tr('nav.about', 'About')} icon={icons.info} iconColor='#1677ff' onPress={() => go('/about')} />
30
+ </Section>
31
+ <Section title={tr('settings.theme', 'Theme')}>
32
+ <Row
33
+ label={() => (theme().mode === 'dark' ? t('ln.themeLight', 'Light') : t('ln.themeDark', 'Dark'))}
34
+ icon={() => (theme().mode === 'dark' ? icons.sun : icons.moon)}
35
+ iconColor='#5e5ce6'
36
+ onPress={() => setThemePref(theme().mode === 'dark' ? 'light' : 'dark')}
37
+ chevron={false}
38
+ testID='menu-theme'
39
+ />
40
+ </Section>
41
+ </SideMenu>
42
+ );
43
+ return { button, menu };
44
+ };