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,71 @@
1
+ # Icon Handling in Lupine.api and Target Apps
2
+
3
+ `lupine.api` UI code commonly uses icon classes such as:
4
+
5
+ ```tsx
6
+ <i class='ifc-icon ma-pencil-outline mr-m' onClick={onEditLocal} title='Edit'></i>
7
+ ```
8
+
9
+ The package expects the final app to provide the actual icon implementation. There are two supported patterns.
10
+
11
+ ---
12
+
13
+ ## Pattern A: Generated Icon Font
14
+
15
+ The full-stack template uses `apps/lupine-template-fullstack-starter/web/icons-font.config.js` to generate a font icon bundle for the pages of `lupine.api` in `/admin` (its own pages and the app use `<Icon name={icons.x} />` of `lupine.core/icons`). This config defines icon names and source SVG files, then the generated CSS/font makes classes such as `ifc-icon ma-pencil-outline` render correctly.
16
+
17
+ When using this pattern:
18
+
19
+ - Prefer existing icon names already provided by the target app.
20
+ - If a new icon is required, add it to the app-level icon font config, not to `lupine.api` package code.
21
+ - Keep using the existing markup contract: `<i class='ifc-icon icon-name'></i>`.
22
+ - Remember that `lupine.api` is a package; it should not assume a specific app's generated font file exists unless the target app includes it.
23
+
24
+ ---
25
+
26
+ ## Pattern B: Embedded SVG Mask Icons
27
+
28
+ Some target apps do not generate an icon font. For convenience, they can provide CSS mask-based embedded SVG icons instead. The CMS app uses `apps/cms/web/src/styles/app-icons.ts` for this.
29
+
30
+ The pattern is:
31
+
32
+ ```typescript
33
+ export const appIconsCss: CssProps = {
34
+ '.ifc-icon': {
35
+ display: 'inline-block',
36
+ width: '24px',
37
+ height: '24px',
38
+ maskRepeat: 'no-repeat',
39
+ maskPosition: 'center',
40
+ maskSize: 'contain',
41
+ '-webkit-mask-repeat': 'no-repeat',
42
+ '-webkit-mask-position': 'center',
43
+ '-webkit-mask-size': 'contain',
44
+ WebkitMaskRepeat: 'no-repeat',
45
+ WebkitMaskPosition: 'center',
46
+ WebkitMaskSize: 'contain',
47
+ backgroundColor: 'currentColor',
48
+ },
49
+ ...Object.entries(appIcons).reduce((acc: any, [key, svg]) => {
50
+ acc['.ifc-icon.' + key] = {
51
+ '-webkit-mask-image': 'url("' + svg + '")',
52
+ maskImage: 'url("' + svg + '")',
53
+ };
54
+ return acc;
55
+ }, {} as any),
56
+ };
57
+ ```
58
+
59
+ With this approach, the same `ifc-icon` markup works even without a font file because each icon class points to an embedded SVG data URL.
60
+
61
+ ---
62
+
63
+ ## Agent Rules for Adding Icons
64
+
65
+ - First try to reuse an existing icon class. Search app icon config files before inventing a new name.
66
+ - If adding package UI in `lupine.api`, keep the markup generic: `<i class='ifc-icon existing-icon-name'></i>`.
67
+ - If the target app uses generated fonts, add the source SVG to its `icons-font.config.js` and regenerate icons according to that app's process.
68
+ - If the target app uses embedded SVG masks, find its `app-icons.ts` file and add the new SVG entry to the `appIcons` map.
69
+ - Do not hardcode raw inline SVG in every package component unless there is a strong reason. Prefer the app-level icon provider so theming via `currentColor`, sizing, and consistency keep working.
70
+ - Do not assume all apps use the same icon backend. The contract is the CSS class interface (`ifc-icon` plus icon name), while the app decides whether that class is backed by a font or SVG masks.
71
+ - When reviewing missing icons, check whether the icon CSS was loaded by the target app before changing package code.
@@ -0,0 +1,29 @@
1
+ # Mobile interactions on web pages
2
+
3
+ The components for phones (and every other platform) are in `lupine.native.components`; a page of lupine.web shows them as they are (one renderer). The old web-only versions (`SliderFrame`, `HeaderWithBackFrame`, `ActionSheet...Promise`, `NotificationMessage`, `backActionHelper`) are gone from `lupine.web.components`.
4
+
5
+ ## 1. Questions and messages (instead of `alert`, `confirm`, `prompt`)
6
+
7
+ **Never use the browser's `alert()`, `confirm()` or `prompt()`.** Use the Promise style of `lupine.native.components`; in a page of lupine.web without an `OverlayHost` they make one of their own over the page:
8
+
9
+ ```typescript
10
+ import { ActionSheet, MessageBox, Toast } from 'lupine.native.components';
11
+
12
+ const index = await ActionSheet.select({ title: 'Delete this record?', options: ['Delete', 'Edit'], destructive: 0 }); // -1: cancelled
13
+ if (index === 0) { /* delete */ }
14
+
15
+ const ok = await MessageBox.confirm({ title: 'Delete', message: 'This can’t be undone', destructive: true });
16
+ await MessageBox.alert({ message: 'Saved' });
17
+ const name = await MessageBox.prompt({ title: 'Nickname', value: '', required: true }); // null: cancelled
18
+ Toast.success('Saved'); // Toast.error / warning / info
19
+ ```
20
+
21
+ `ActionSheet.select` with `options: [{ label, value }]` gives the value (`null` when cancelled).
22
+
23
+ ## 2. Pages that slide in, the back button
24
+
25
+ For app-like pages use `Screen`, `Header`, `Pages` (a stack of pages: `router.push('/item/1')`, `router.back()`), `SlidePanel`, `BottomSheet`, `SideMenu` and `BottomTabBar` of `lupine.native.components`. `onBack(fn)` of `lupine.native.core` handles the hardware back button and the back gesture (the open sheet or panel first).
26
+
27
+ ## 3. In the admin of lupine.api
28
+
29
+ `adminUi` of `lupine.api/admin` has helpers in the style of the admin: `confirmSheet(text)`, `promptSheet(text, value)`, `openDialog({ title, content, footer })`, `buttonDialog({ title, buttons, handleClicked, children })`, `Pager`, `SearchBox`, `SelectBox`, `ActionMenu`, `Meter`.
@@ -0,0 +1,190 @@
1
+ # Native apps (lupine.native)
2
+
3
+ One TSX code base for iOS, Android, macOS, Windows and the web. The UI is made of the controls of each platform (Windows paints its own), the layout is flexbox (Yoga), JS runs in Hermes on the UI thread. Documentation: https://uuware.github.io/lupine.js/en/native/overview and https://uuware.github.io/lupine.js/en/native-components/overview.
4
+
5
+ ## No DOM
6
+
7
+ - App code imports from `lupine.native.core` and `lupine.native.components` only. `document`, `window`, `localStorage`, `HTMLElement`, `lupine.web` and `lupine.web.components` are errors in a native bundle.
8
+ - Only the entry for the web (`src/index.web.tsx`) may use the DOM; `tsconfig.json` has no `dom` and excludes that file.
9
+ - `fetch`, `Headers`, `FormData`, `AbortController`, `URL`, `WebSocket`, `TextEncoder` and timers are there on all platforms. Packages of npm work if they need no DOM, `Blob` or `XMLHttpRequest`.
10
+
11
+ ## An app
12
+
13
+ Start a project with `npx create-lupine@latest my-app`: every template is a native app with its site. In this repository copy a template: `apps/lupine-template-fullstack-note` (tabs, pages, themes, languages, sign-in, notes on the server) or `apps/lupine-template-responsive-starter` (no backend); `apps/native-demo` shows everything else, with `/admin`.
14
+
15
+ ```text
16
+ apps/my-app/
17
+ lupine.json for lupine-build (npm run dev): "name", "nativeOut", "nativeApp": "app" (the build takes .web.tsx
18
+ first, the file loaders and the constants from lupine.native.core), the page, the API
19
+ app/package.json name, version, "lupineNative": { name, title, id, entry, permissions, plugins }
20
+ app/src/app.tsx the app
21
+ app/src/index.native.tsx runApp(App) from 'lupine.native.core/native'
22
+ app/src/index.web.tsx followAddress = () => router.followUrl(); AppPage (the app, following the address in the
23
+ browser); start(container) for lupine-native web
24
+ app/src/index.test.tsx runApp(App) and the tests
25
+ web/src/index.tsx lupine.web page of the site (one bundle, one renderer; import 'lupine.native.core/web/server'
26
+ for SSR): pageRouter.use('*', AppPage, { keep: true }), made once, it follows the address;
27
+ own pages before it (the app is hidden while they are shown; a link of the site or the
28
+ back button shows it again: lupine.web sends 'lupine-kept', router.followUrl() opens the
29
+ page of the address)
30
+ web/src/admin/ the admin pages, an entry of its own (/admin): lupine.api/admin, menus of the app for its
31
+ admins, the tools for the developer (DEV_ADMIN_USER)
32
+ api/src/index.ts lupine.api: routes under /api, then StaticServer (without "apiEntryPoint" a default one)
33
+ ```
34
+
35
+ `--app=my-app`, `--app=apps/my-app` and `--app=apps/my-app/app` are the same app. The site: `npm run dev` with `my-app` in `APPS` of `.env` and `DOMAINS:my-app=my-app.app.localhost`; the address bar shows the pages of the app (`/me`, `router.followUrl()`; not on a static page of `lupine-native web`).
36
+
37
+ ```tsx
38
+ // src/app.tsx
39
+ import { createSignal, insets, Text, TextInput, View } from 'lupine.native.core';
40
+ import { Button, col, OverlayHost, Toast } from 'lupine.native.components';
41
+
42
+ export const App = () => {
43
+ const [name, setName] = createSignal('');
44
+ return (
45
+ <View style={{ flex: 1, padding: 16, gap: 12, paddingTop: () => insets().top + 16, backgroundColor: col('bg') }}>
46
+ <TextInput testID='name' value={name} onChangeText={setName} placeholder='Name' />
47
+ <Button title='Greet' kind='primary' disabled={() => !name()} onPress={() => Toast.success(`Hello ${name()}`)} />
48
+ <Text style={{ color: col('text') }}>{() => `${name().length} letters`}</Text>
49
+ <OverlayHost />
50
+ </View>
51
+ );
52
+ };
53
+ ```
54
+
55
+ Signals, `For`, `Show`, `onMount`, `onCleanup` work as on the web (references/reactivity-and-state.md) and come from `lupine.native.core`.
56
+
57
+ ## Components (lupine.native.core)
58
+
59
+ | | |
60
+ | --- | --- |
61
+ | `View` | box; `onPress`, `onLongPress`, `onTouch={gesture({...})}`, `onLayout`, `pointerEvents` |
62
+ | `Text` | all text is inside `Text`; `numberOfLines`, `selectable` |
63
+ | `TextInput` | `value` (signal), `onChangeText`, `onSubmit`, `keyboardType`, `returnKey`, `secureTextEntry`, `multiline` |
64
+ | `ScrollView` | `horizontal`, `onScroll`, `refreshing`/`onRefresh` |
65
+ | `List` | many rows of one height (`items`, `itemHeight`); `VirtualList`, `SectionList`, `InfiniteList` in lupine.native.components |
66
+ | `Image`, `Icon`, `Svg`, `Canvas`, `GL` | pictures, icons, 2D drawing, WebGL 2 and three.js |
67
+ | `Video`, `WebView`, `Camera` | media |
68
+ | `Button`, `Switch`, `Slider` | the system's own controls; for one look on all platforms use those of lupine.native.components |
69
+
70
+ All of them: `style`, `ref` (`focus()`, `measure()`, `scrollTo()`), `testID`, `transition` (milliseconds).
71
+
72
+ ## Styles
73
+
74
+ A style is an object; each value may be a function. Nothing is inherited and there are no style sheets: share constants and merge them (`{ ...card, opacity: () => ... }` or `style={[a, b]}`).
75
+
76
+ - Flexbox, **top to bottom** by default; numbers are density independent pixels; `flex: 1` takes what is left.
77
+ - `margin`/`padding` with `Horizontal`, `Vertical`, `Top` etc.; `gap`; `position: 'absolute'`; `display: 'none'`.
78
+ - Look: `backgroundColor`, `backgroundImage: 'linear-gradient(...)'`, `borderRadius`, `borderWidth`, `borderColor`, `boxShadow`, `opacity`, `translateX`, `scale`, `rotate`.
79
+ - What isn't supported is a TypeScript error (no `borderStyle: dashed`, no 3D transforms). Text widths differ a little between platforms: don't rely on where lines break.
80
+ - Safe areas: `insets()`; size of the window: `windowInfo()`. Wide or narrow: prefer `media({ base: 'column', mobileAbove: 'row' })` (a style value with the breakpoints of the web pages, `MediaQueryMaxWidth` of lupine.core; on the web the server renders it as `@media` css, so the page doesn't change when the app starts); `isWide()`, `screenSize()`, `Grid`, `ShowWhen` use the width in JS, which the server only guesses; `Columns` uses `media()`.
81
+
82
+ ## Themes, languages (lupine.native.components)
83
+
84
+ - Colors: `col('bg')`, `col('bgElevated')`, `col('text')`, `col('primary')`, ... (functions, so they follow the theme). No fixed colors in components.
85
+ - `theme()`, `setThemePref('dark' | 'light' | 'system')`, `addThemes`, `deriveTheme(name, { bg, text?, primary? })`; `syncAppearance` lets the system's controls follow. The colors and `deriveTheme` are in lupine.core (lupine.web.components makes CSS variables of them).
86
+ - Texts (lupine.core, the same for lupine.web): `addTexts('zh-Hans', { group: { name: '...' } })`, `setLanguages(['en', 'zh-Hans'])` (first = fallback, names from `languageNames`), `t('group.name', 'English text', params)` (English is required: it is in the code, other languages are added; no en file), `tr` (same arguments) for JSX, `setLang`. `zh-CN` = `zh-Hans`. The controls' texts (group `ln`): English in the controls; zh-Hans and ja when the app turns them on: `addLnTexts({ 'zh-Hans': lnZhHans, ja: lnJa })`. `<T>` is a `Text` with the theme's text color.
87
+
88
+ - Icons: `import * as icons from 'lupine.core/icons'`, one export each (a page has only those it uses): `<Icon name={icons.home} />`, `icon={icons.home}` (use this, not names). The app's own: `const mine = { mine: 'M...' }` (path data; `svgToPath` makes it from svg). `addIcons({ check: 'M...' })` only to put another icon in place of a name (also in the controls); a bare name (`icon='home'`) is one of addIcons, unknown ones show nothing and warn once.
89
+
90
+ ## Pages and navigation
91
+
92
+ ```tsx
93
+ import { View } from 'lupine.native.core';
94
+ import { col, NavBar, NavItem, OverlayHost, Pages, router, Row, Screen, Section } from 'lupine.native.components';
95
+ import * as icons from 'lupine.core/icons';
96
+
97
+ const items: NavItem[] = [
98
+ { key: '/', label: 'Home', icon: icons.home, testID: 'tab-home' },
99
+ { key: '/me', label: 'Me', icon: icons.user, testID: 'tab-me' },
100
+ ];
101
+ const Home = () => (
102
+ <Screen title='Home' grouped>
103
+ <Section>
104
+ <Row label='First' onPress={() => router.push('/item/1')} />
105
+ </Section>
106
+ </Screen>
107
+ );
108
+ const Me = () => <Screen title='Me' padded />;
109
+ const Item = (p: { id: string }) => <Screen title={`#${p.id}`} onBack={router.back} padded />;
110
+
111
+ export const App = () => (
112
+ <View style={{ flex: 1, backgroundColor: col('bg') }}>
113
+ <Pages
114
+ side={240}
115
+ tabs={[{ path: '/', page: Home }, { path: '/me', page: Me }]}
116
+ routes={[{ path: '/item/:id', page: (p) => <Item id={p.id} /> }]}
117
+ notFound={() => <Screen title='404' onBack={router.back} />}
118
+ >
119
+ <NavBar items={items} active={router.tab} onPress={router.navigate} width={240} />
120
+ </Pages>
121
+ <OverlayHost />
122
+ </View>
123
+ );
124
+ ```
125
+
126
+ - `router.push(path, params?)`, `router.replace`, `router.back()`, `router.navigate(tab)`, `router.path()`, `router.tab()`, `useFocused()`.
127
+ - Tabs are kept; a stacked page is removed when one goes back and its `onCleanup` runs.
128
+ - `NavBar`: one menu, each item made once: a tab bar at the bottom on phones, a column on the left on wide windows (css by `media()`). `Pages side={240}` puts the children of `Pages` beside the pages on wide windows. Don't render `Sidebar` and `BottomTabBar` both with `Show when={isWide}`: the server's page would show the wrong one.
129
+ - The Android back button: `onBack(() => ...)`, newest first; return `false` to pass it on.
130
+
131
+ ## Messages and panels
132
+
133
+ - `Toast.success('Saved')`, `await MessageBox.confirm({...})`, `await ActionSheet.select({...})`, `Loading.during(promise)`. Questions to the user are bottom action sheets, not alerts.
134
+ - `BottomSheet`, `Dialog`, `SlidePanel`, `DrawerLayout`: opened and closed by a signal (`visible={() => open()}`).
135
+ - They need `<OverlayHost />`, as the last child of the root.
136
+
137
+ ## Forms
138
+
139
+ `createForm`, `Field`, `TextField`, `Select`, `DatePicker` and other pickers of lupine.native.components (`apps/doc/.../native-components/forms.md`). A single value is a signal with `TextInput value={v} onChangeText={setV}`.
140
+
141
+ ## Platform functions (lupine.native.core)
142
+
143
+ `Platform.OS` (`'ios' | 'android' | 'macos' | 'windows' | 'web'`), `Platform.select({...})`; `storage` (synchronous key/value), `secureStorage`, `files`, `clipboard`, `share`, `pickFiles`, `pickImages`, `Camera`, `geolocation`, `notifications`, `haptics`, `createAudioContext`, `requestPermission`, `deviceInfo`, `appState`, `openURL`, `onURL`, `desktop` and `startProcess` (desktops only). Look up the exact names in the docs before using one.
144
+
145
+ Files for one platform: `name.ios.tsx` before `name.native.tsx` before `name.tsx`; the web takes `name.web.tsx`.
146
+
147
+ Plugins (sign-in, payments, ads, ...): `lupine.native.plugins/<name>`, switched on in `lupineNative.plugins`, often only in a variant (`--variant=...`).
148
+
149
+ ## The command line
150
+
151
+ In the repository `npm run native -- ...`, in a project `npx lupine-native ...`:
152
+
153
+ ```bash
154
+ npx lupine-native doctor # what is missing for which platform
155
+ npx lupine-native web --app=apps/my-app --watch
156
+ npx lupine-native macos --app=apps/my-app --run # ios, android, windows the same
157
+ npx lupine-native ios --app=apps/my-app --run --device --serial=<udid> --team=<team>
158
+ npx lupine-native android --app=apps/my-app --run --serial=<adb device>
159
+ npx lupine-native android --app=apps/my-app --release --install # onto a connected phone: uses a build that is there or builds; asks for the device if several
160
+ npx lupine-native devices # connected phones (Android, iOS)
161
+ npx lupine-native bump --app=my-app # store release: version x.y.z -> x.y.(z+1), build + 1; the code reads APP_VERSION
162
+ npx lupine-native windows --app=apps/my-app --run # on a Mac or Linux --run opens it in Wine
163
+ npx lupine-native docker android --app=apps/my-app # builds in Docker, nothing installed
164
+ ```
165
+
166
+ Options: `--release`, `--variant=<name>`, `--env=<file>`, `--define=NAME=value`, `--engine=quickjs` (smaller, slower).
167
+
168
+ Constants in the code (also in pages of lupine-build): `process.env.NODE_ENV` (`NODE_ENV` of the env file: `.env.development`, `.env.production` with `--release`), `APP_VARIANT`, `APP_VERSION`, `APP_BUILD`. `webEnv('API_BASE_URL', '')` of lupine.native.core: the public `WEB.*` keys of the env file, as in lupine.web. An app that calls the server gets its address from `.env.mobile` (imports `.env`, sets `WEB.API_BASE_URL`; the site doesn't use it): build store releases with `--release --env=.env.mobile`. Don't delete `.env.mobile` from a project with an API. The result is in `dist/native/<app>/<platform>[-<variant>]` (`nativeOut` of the project's `lupine.json` changes `dist/native`; `--out` changes all).
169
+
170
+ ## Tests
171
+
172
+ `src/index.test.tsx` drives real controls through `__lupine.test(testID, action, argument)` and prints `TEST ok name`, `TEST FAIL name`, then `TEST RESULT PASSED n ok`.
173
+
174
+ ```bash
175
+ npx lupine-native test macos --app=apps/my-app
176
+ npx lupine-native test android --app=apps/my-app --serial=<adb device>
177
+ ```
178
+
179
+ The app id gets `.test`, so the data of the released app isn't touched. After a change, run the tests of the platforms it affects; `tsc --noEmit -p apps/my-app` finds DOM use and wrong styles.
180
+
181
+ ## The web target
182
+
183
+ The web version of an app is the site of `npm run dev` (the app in the page's bundle). `lupine-native web` only makes a static page without a server (it writes `index.html` itself; no `app/web` folder), for sites that are only files and for measurements. Large libraries (three.js) are loaded when needed: a `webEntryPoints` entry with `"format": "esm"` or files copied with `copyFiles` (`{node_modules}/...`), then `import(url)` (`apps/native-demo/README.md`). SSR: in the site the page has `<App />` as a component (`<div class='ln-root'><App /></div>`; one renderer for the page and the app) and imports `lupine.native.core/web/server`; the server renders it with the page (the css of the primitives first), the browser renders it again (no hydration) (`apps/lupine-template-fullstack-note/web/src/index.tsx`). Without a site: `renderToString(App)` of `lupine.native.core/web/server`. On the server the router, the theme and the language are those of the request (address; cookies `theme`, `lang`, `color-scheme`: `AppKeys` of lupine.core; `Accept-Language`); an unknown path gets `notFound` and status 404. Rules for the app's code:
184
+ - **No user data in variables of modules**: the server renders all requests with the same modules. Per request: `serverRequest()` (`url`, `cookie()`, `languages`, `data`).
185
+ - **Side effects** (timers, subscriptions, DOM, storage) only in `onMount` and effects; they don't run on the server.
186
+ - **Data**: in `onMount` (the server's page is without it), or in an async component with `await fetchData('/api/...')` (lupine.native.core; on the server it calls the API directly), which the server waits for.
187
+ - **Widths** by `media()`, not `isWide()` (see Styles).
188
+ - `setTitle`, `setMeta('og:title', ...)`: the page's title and meta tags (server and browser); `setTitle` is the window's title on macOS and Windows.
189
+
190
+ Native components in a page of lupine.web: lupine.web and lupine.native have one renderer (`lupine.core/render`), so they are ordinary components of the page (`<View><Chart /></View>`), with html elements around and inside them; `import 'lupine.native.core/web'` and `import 'lupine.native.core/web/server'` (SSR) bring the hosts of the primitives (the console says which is missing). The ref of a primitive is its handle, of an html element the element. Text directly in a View works only on the web.
@@ -0,0 +1,55 @@
1
+ # Router, SSR and settings (web)
2
+
3
+ Documentation: https://uuware.github.io/lupine.js/en/essentials/page-route, https://uuware.github.io/lupine.js/en/essentials/ssr.
4
+
5
+ ## PageRouter
6
+
7
+ ```tsx
8
+ import { bindRouter, PageProps, PageRouter } from 'lupine.web';
9
+
10
+ const HomePage = async () => <h1>Home</h1>;
11
+ const PlayPage = async (props: PageProps) => <p>{props.urlParameters['id']} {props.query['tab']}</p>;
12
+ const NotFoundPage = async () => <h1>404</h1>;
13
+
14
+ const pageRouter = new PageRouter();
15
+ pageRouter.use('/', HomePage);
16
+ pageRouter.use('/play/:id', PlayPage);
17
+ pageRouter.use('*', NotFoundPage); // last
18
+ bindRouter(pageRouter); // in index.tsx
19
+ ```
20
+
21
+ - Routes are tried in order; `/about` also matches `/about/...`, so specific paths come first.
22
+ - `/:id` required, `/?id` optional (and everything after it); the first parameter of a path is a `/:` one; fixed segments may follow (`/page/:id/detail`).
23
+ - A page gets `PageProps`: `url`, `query`, `urlParameters`, `renderPageFunctions`. It may be async; `null` passes to the next route.
24
+ - Nested routers: `pageRouter.use('/user', userRouter)`. Filters: `userRouter.setFilter(checkAuth)` or `use(path, checkAuth, Page)`; a filter returns a node to show instead, or `null`. They only decide what is shown: the API checks access to data.
25
+ - Layout: `pageRouter.setFramePage({ component: MainFrame, placeholderClassname: 'app-content' })`; only the placeholder is replaced, the frame keeps its state.
26
+ - A page that stays: `pageRouter.use('*', AppPage, { keep: true })` (options last) is made once; its route shows it again as it was, other pages hide it. For a page that follows the address itself (an app; web only): each time it is shown again `window` gets `lupine-kept` (`detail.pushed`: by a link); `router.followUrl()` listens to it.
27
+ - `setErrorHandler`, `setSubDir('/my-app')` for a site in a subfolder.
28
+
29
+ ## Going to a page
30
+
31
+ Links inside the site are `<a href='/play/1'>` and don't reload the page. From code:
32
+
33
+ ```tsx
34
+ import { initializePage } from 'lupine.web';
35
+
36
+ const Next = () => <button onClick={() => initializePage('/play/2')}>Next</button>;
37
+ ```
38
+
39
+ Not `location.href = ...` (that reloads everything).
40
+
41
+ ## SSR
42
+
43
+ For every URL that isn't an API or a file the server runs the router and sends complete HTML (with theme, styles, title and meta tags). The browser then renders the same route again and **replaces** the content; there is no hydration.
44
+
45
+ - Data that belongs in the HTML: load it in the async page with `props.renderPageFunctions.fetchData(url)` (on the server it calls the API inside the process, with the request's cookies). Title and meta: `PageTitle`, `MetaData` of `lupine.web.components`.
46
+ - Only the browser: `localStorage`, window sizes, `document`, data of the signed-in user. Put it in `onMount`, or check `isFrontEnd()`. Code that runs while rendering must not touch them.
47
+ - `createEffect` and `onMount` don't run on the server; signals are read once.
48
+ - Module variables and signals are shared by all users on the server.
49
+ - Styles at the top of a module: `bindAppGlobalStyle`; `bindGlobalStyle` belongs inside a component (references/styling-and-themes.md).
50
+ - Where there are no props: `getRenderPageProps()` gives `url` and `query`.
51
+
52
+ ## Settings
53
+
54
+ - `.env` variables that start with `WEB.` reach the front end: `webEnv('API_BASE_URL', '')` (synchronous; the type follows the default). All others stay on the server.
55
+ - Settings that change without a release: `await WebConfig.get('siteLogo', '')`. The server puts them into the first page; written by the back end (`apiStorage.setWeb`).
@@ -0,0 +1,108 @@
1
+ # Signals and state
2
+
3
+ The same signals on the web and in native apps. Import them from `lupine.web` (web) or `lupine.native.core` (native); both pass on `lupine.core`. Documentation: https://uuware.github.io/lupine.js/en/essentials/signals, https://uuware.github.io/lupine.js/en/essentials/list, https://uuware.github.io/lupine.js/en/essentials/forms.
4
+
5
+ ## A component
6
+
7
+ ```tsx
8
+ import { createEffect, createMemo, createSignal, CssProps, onCleanup } from 'lupine.web';
9
+
10
+ export const Score = () => {
11
+ const [score, setScore] = createSignal(0);
12
+ const label = createMemo(() => (score() > 9 ? 'high' : 'low'));
13
+
14
+ createEffect(() => {
15
+ // after the component is in the page, and whenever score changes
16
+ const timer = setTimeout(() => setScore(0), 5000);
17
+ onCleanup(() => clearTimeout(timer));
18
+ });
19
+
20
+ const css: CssProps = {
21
+ '.&-score': { fontSize: '18px', fontWeight: 'bold' },
22
+ '.&-score.high': { color: 'var(--primary-accent-color)' },
23
+ };
24
+
25
+ return (
26
+ <div css={css}>
27
+ <div class={() => `&-score ${label()}`}>Score: {score}</div>
28
+ <button onClick={() => setScore((s) => s + 1)}>Add</button>
29
+ <button disabled={() => score() === 0} onClick={() => setScore(0)}>Reset</button>
30
+ {() => (score() > 20 ? <p>Well done</p> : null)}
31
+ </div>
32
+ );
33
+ };
34
+ ```
35
+
36
+ - The function runs **once**. Only the places that read a signal are updated; focus, caret, scroll position and the state of children are kept.
37
+ - Pass a function: `{score}` and `{() => score() + 1}` are updated, `{score()}` is read once. The same for attributes, props and style values.
38
+ - A write is visible to reads at once; the page follows in the next microtask. `flush()` updates it now (tests, measuring).
39
+ - `untrack(fn)` reads without subscribing. `batch` isn't needed: writes of one event are one update.
40
+
41
+ ## Lifecycle
42
+
43
+ | | |
44
+ | --- | --- |
45
+ | `createMemo(fn)` | a derived value, computed when its signals change |
46
+ | `createEffect(fn)` | runs after mounting and again when what it read changes; not on the server |
47
+ | `onMount(fn)` | once, when the component is shown; not on the server |
48
+ | `onCleanup(fn)` | when the component (or the effect) is removed |
49
+
50
+ In an **async component** call them before the first `await`; after it there is no owner.
51
+
52
+ ## Global state
53
+
54
+ A signal at the top of a module is shared by everything that imports it:
55
+
56
+ ```ts
57
+ import { createSignal } from 'lupine.web';
58
+
59
+ export const [cartCount, setCartCount] = createSignal(0);
60
+ ```
61
+
62
+ On a web server such a module is shared by **all users**: nothing of one user goes there (load it in the browser, in `onMount`).
63
+
64
+ ## Elements (web)
65
+
66
+ ```tsx
67
+ import { onMount } from 'lupine.web';
68
+
69
+ const Search = () => {
70
+ let input: HTMLInputElement;
71
+ onMount(() => input.focus());
72
+ return <input ref={(el) => (input = el)} />;
73
+ };
74
+ ```
75
+
76
+ `ref` is called before `onMount`. Use it for focus, measuring, canvases and libraries; never `document.querySelector` to find your own elements (class names with `&` are generated). In native apps `ref` gives a handle with `focus()`, `measure()`, `scrollTo()`.
77
+
78
+ ## Lists and conditions
79
+
80
+ ```tsx
81
+ import { createSignal, For, onMount, Show } from 'lupine.web';
82
+ import { createField } from 'lupine.web';
83
+
84
+ const ItemsPage = () => {
85
+ const query = createField('');
86
+ const [items, setItems] = createSignal<Item[] | null>(null);
87
+ const load = async () => setItems(await fetchItems(query()));
88
+ onMount(() => void load());
89
+
90
+ return (
91
+ <div>
92
+ <input {...query.input} />
93
+ <button onClick={load}>Search</button>
94
+ <Show when={() => items() !== null} fallback={<div>Loading...</div>}>
95
+ <For each={() => items()!}>{(item) => <ItemRow item={item} />}</For>
96
+ </Show>
97
+ </div>
98
+ );
99
+ };
100
+ ```
101
+
102
+ - `For` keeps a row as long as its item (the same object) is in the array. Update with a new array that keeps the unchanged objects: `setItems(items().map((x) => (x.id === id ? { ...x, done: true } : x)))`.
103
+ - What changes inside a row is best a signal of its own, or that one object is replaced.
104
+ - Hundreds of rows on the web: page them; in native apps use `List` / `VirtualList`.
105
+
106
+ ## Forms (web)
107
+
108
+ `createField(initial)` of `lupine.web` is a signal for a form element: `<input {...title.input} />`, `<input type='checkbox' {...on.check} />`, read `title()`, write `title.set('x')`. Native apps: `TextInput value={v} onChangeText={setV}` or `createForm` of `lupine.native.components`.
@@ -0,0 +1,121 @@
1
+ # Styling & Themes
2
+
3
+ ## 1. Style Binding & Ampersand (`&`) Namespace Pattern
4
+
5
+ Lupine.js uses CSS-in-JS and achieves component style isolation by dynamically generating unique class name prefixes (e.g. `l1234`) and replacing the `&` symbol.
6
+
7
+ ```tsx
8
+ import { createSignal, CssProps } from 'lupine.web';
9
+
10
+ export const MyComponent = () => {
11
+ const [active, setActive] = createSignal(false);
12
+ const css: CssProps = {
13
+ // Top-level rules apply directly to the bound root container itself
14
+ width: '100%',
15
+ padding: '1rem',
16
+
17
+ // Rules targeting descendant elements
18
+ '.&-title': { fontWeight: 'bold' },
19
+ '.&-btn': {
20
+ '&:hover': { background: 'var(--secondary-bg-color)' },
21
+ '&.active': { color: 'var(--primary-accent-color)' },
22
+ },
23
+ };
24
+
25
+ return (
26
+ <aside css={css}>
27
+ <div class='&-title'>Hello</div>
28
+ <button class={() => (active() ? '&-btn active' : '&-btn')} onClick={() => setActive(!active())}>
29
+ Click Me
30
+ </button>
31
+ </aside>
32
+ );
33
+ };
34
+ ```
35
+
36
+ ### Key Rules
37
+ 1. **Top-Level Properties Apply to Root Element**: Do not wrap root styles in an unnecessary outer `.&-container` in `CssProps`.
38
+ 2. **JSX Class Names**: Use `class="&-item"` or `class="row-box &-item"` (never write `className`).
39
+ 3. **No DOM Queries**: `querySelector('.&-item')` finds nothing. What changes is a signal; an element you need has a `ref={(el) => ...}`.
40
+
41
+ ---
42
+
43
+ ## 2. Dark Mode & Color Variable Conventions (Dark Mode Semantics)
44
+
45
+ **Never hardcode color values (such as `#000`, `#fff`, `#f0f0f0`)**. Always use standardized CSS variables:
46
+
47
+ 1. **Background Colors**:
48
+ - `var(--primary-bg-color)`: Deepest background (white in light mode, **pure black** in dark mode).
49
+ - `var(--secondary-bg-color)`: Elevated cards/panels/modal backgrounds (light gray in light mode, **dark gray** in dark mode to prevent blending into pure black backgrounds).
50
+ 2. **Text Colors**:
51
+ - `var(--primary-color)`: Primary text color (dark gray/black in light mode, **white** in dark mode).
52
+ - ⚠️ **Dark Mode Trap**: Never use `--primary-color` as the background color for a blue primary button; otherwise, the button background turns white in dark mode.
53
+ 3. **Brand & Action Highlights**:
54
+ - `var(--primary-accent-color)`: Primary brand color (e.g. Lupine blue), used for primary button backgrounds, active tabs, etc.
55
+ - Pair primary button text with `var(--primary-bg-color)` to ensure high contrast.
56
+ 4. **Borders & Spacing**:
57
+ - Borders: `var(--primary-border)`, `var(--secondary-border-color)`
58
+ - Spacing: `var(--space-m)` (8px), `var(--space-l)` (16px)
59
+
60
+ ---
61
+
62
+ ## 3. CSS Scope Reuse
63
+
64
+ ### Sharing Styles Across Component Instances (Module Level)
65
+ When rendering many identical components (such as list items), avoid injecting duplicate `<style>` tags by using `bindGlobalStyle`:
66
+
67
+ ```tsx
68
+ import { bindGlobalStyle, CssProps, getGlobalStylesId } from 'lupine.web';
69
+
70
+ const cssShared: CssProps = {
71
+ display: 'flex',
72
+ '.&-content': { color: 'red' },
73
+ };
74
+
75
+ export const ListItem = () => {
76
+ const globalCssId = getGlobalStylesId(cssShared);
77
+ bindGlobalStyle(globalCssId, cssShared);
78
+
79
+ return (
80
+ <div css={globalCssId}>
81
+ <div class='&-content'>Shared CSS</div>
82
+ </div>
83
+ );
84
+ };
85
+ ```
86
+
87
+ The element gets the id as a class, and `&` in class names here and below stands for it. `css={[globalCssId, props.style]}` adds styles of this element, which win.
88
+
89
+ ### Application-Level Global Styles
90
+ At the top of a module, or once in `index.tsx`, use `bindAppGlobalStyle`. It is shared by all pages and, on the server, by all requests; `bindGlobalStyle` belongs inside a component (it is per request in SSR). The 4th parameter `noTopClassName = true` writes the rules without a class in front (for `body`, `html`, `[data-theme]`):
91
+ ```tsx
92
+ import { bindAppGlobalStyle, CssProps } from 'lupine.web';
93
+
94
+ const appSharedCss: CssProps = {
95
+ body: { margin: 0, fontFamily: 'var(--font-family-base)' },
96
+ '.app-card': { padding: 'var(--space-l)', borderRadius: '8px' },
97
+ };
98
+ bindAppGlobalStyle('app-shared-css', appSharedCss, false, true);
99
+ ```
100
+
101
+ ---
102
+
103
+ ## 4. Themes
104
+
105
+ ```tsx
106
+ import { bindTheme, getCurrentTheme, updateTheme } from 'lupine.web';
107
+ import { darkThemes, lightThemes } from 'lupine.web';
108
+
109
+ bindTheme('light', {
110
+ light: { ...lightThemes, '--primary-accent-color': '#0a8f2a' },
111
+ dark: { ...darkThemes, '--primary-accent-color': '#0ac92a' },
112
+ }); // index.tsx
113
+
114
+ const Toggle = () => (
115
+ <button onClick={() => updateTheme(getCurrentTheme().themeName === 'dark' ? 'light' : 'dark')}>Theme</button>
116
+ );
117
+ ```
118
+
119
+ The variables of `lightThemes`/`darkThemes` come from the colors of lupine.core (the same as native apps). Another theme from a background and its text: `deriveWebTheme('sepia', { bg: '#f4ecd8', text: '#5b4636' })`, or `webThemeVars(deriveTheme(...))` for a theme that a native app has, too. Color helpers (`blendColor`, `withAlpha`, `contrastText`, `isDark`) are in lupine.core.
120
+
121
+ A theme is a set of CSS variables; components that use variables only need no change when it switches. The name is kept in a cookie, so the server renders the right theme from the first byte. Code that draws (canvas) listens to `updateThemeEventName` on `window`, in `onMount`.
@@ -1,5 +1,6 @@
1
- # production is used when run prod
2
- # starting with WEB. will be exposed to the FrontEnd
1
+ # for the apps (iOS, Android, macOS, Windows) that call the API of the server:
2
+ # npm run native -- android --app=<name> --release --env=.env.mobile
3
+ # starting with WEB. goes into the bundle of the app (public); the web site doesn't use this file
3
4
 
4
5
  #!import .env
5
6
  WEB.NODE_ENV=production
@@ -7,4 +8,4 @@ NODE_ENV=production
7
8
  LOG_LEVEL=info
8
9
 
9
10
  WEB.API_BASE_URL=https://your-server/
10
- WEB.API_PORT=80
11
+ WEB.API_PORT=80
@@ -20,6 +20,10 @@ LOG_FILENAME=log-%index%.log
20
20
  # size can be ?kb or ?mb
21
21
  LOG_MAX_SIZE=1mb
22
22
  LOG_MAX_COUNT=5
23
+ # WebSockets of an app (api.ws): sockets of one app, from one address; temporary values (apiStorage.setTemp) of one app
24
+ # WS_MAX_CONNECTIONS=200
25
+ # WS_MAX_PER_IP=20
26
+ # TEMP_MAX_ENTRIES=10000
23
27
  LOG_OUT_TO_FILE=true
24
28
  LOG_OUT_TO_CONSOLE=true
25
29
 
@@ -47,6 +51,8 @@ DEV_TOKEN=
47
51
  # DEV_ADMIN_SESSION_EXPIRE_DAYS=90
48
52
  # Set DEV_ENABLE_SHELL=true only when remote shell debugging is explicitly needed
49
53
  # DEV_ENABLE_SHELL=false
54
+ # Set DEV_ENABLE_FILES=true to let Files of the dev admin also show the built server and the project folder with .env files
55
+ # DEV_ENABLE_FILES=false
50
56
 
51
57
  # define apps on the same port with different domains (locally or on a real server)
52
58
  # in local, the domains should be added to the /etc/hosts (or C:\Windows\System32\drivers\etc\hosts) file
@@ -56,10 +62,10 @@ DOMAINS:{APP-NAME}=
56
62
 
57
63
  # Https Keys and Crts are for domains (not apps), use following command to generate
58
64
  # mkcert example.com "*.example.com" localhost 127.0.0.1 ::1
59
- SSL_KEY_PATH=dev/example.com+4-key.pem
60
- SSL_CRT_PATH=dev/example.com+4.pem
61
- HTTPS_KEY_PATH:{APP-NAME}=dev/example.com+4-key.pem
62
- HTTPS_CRT_PATH:{APP-NAME}=dev/example.com+4.pem
65
+ SSL_KEY_PATH=dist/example.com+4-key.pem
66
+ SSL_CRT_PATH=dist/example.com+4.pem
67
+ HTTPS_KEY_PATH:{APP-NAME}=dist/example.com+4-key.pem
68
+ HTTPS_CRT_PATH:{APP-NAME}=dist/example.com+4.pem
63
69
 
64
70
  DB_TYPE=sqlite
65
71
  SQLITE_FILENAME=sqlite3.db
@@ -0,0 +1,10 @@
1
+ # server
2
+
3
+ The server that runs the web apps of this repository (and of a project made with create-lupine): `src/index.ts` reads `.env`, finds the apps of `APPS` with their domains (`DOMAINS:<app>`) and databases, and starts lupine.api with a process per CPU core. `src/server-loader.ts` restarts it when it is rebuilt in development.
4
+
5
+ ```bash
6
+ npm run dev # build in watch mode and run with .env.development
7
+ npm run build && npm run start-production
8
+ ```
9
+
10
+ What can be set: `.env.sample`.