create-lupine 1.0.30 → 1.2.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 (127) hide show
  1. package/README.md +25 -0
  2. package/index.js +35 -13
  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 +98 -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 +100 -0
  8. package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +167 -0
  9. package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +54 -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 +119 -0
  12. package/templates/common/_env +12 -2
  13. package/templates/common/apps/server/src/index.ts +2 -1
  14. package/templates/lupine-template-cv-starter/README.md +5 -0
  15. package/templates/lupine-template-cv-starter/web/src/index.tsx +1 -10
  16. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +1 -10
  17. package/templates/lupine-template-doc-starter/README.md +5 -0
  18. package/templates/lupine-template-doc-starter/web/src/index.tsx +1 -10
  19. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +1 -10
  20. package/templates/lupine-template-fullstack-starter/README.md +21 -0
  21. package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
  22. package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
  23. package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
  24. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
  25. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
  26. package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
  27. package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
  28. package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
  29. package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
  30. package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
  31. package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
  32. package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
  33. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1041 -0
  34. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/lupine.json +10 -1
  35. package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
  36. package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
  37. package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
  38. package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
  39. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
  40. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
  41. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
  42. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
  43. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
  44. package/templates/lupine-template-fullstack-starter/web/assets/images/sample.png +0 -0
  45. package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
  46. package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
  47. package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
  48. package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
  49. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/package.json +1 -1
  50. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +16 -0
  51. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +22 -0
  52. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.html +22 -0
  53. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.tsx +64 -0
  54. package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +52 -0
  55. package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +15 -0
  56. package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +75 -0
  57. package/templates/lupine-template-fullstack-starter/web/src/components/home-search-component.tsx +132 -0
  58. package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +162 -0
  59. package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +165 -0
  60. package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +118 -0
  61. package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +122 -0
  62. package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +12 -0
  63. package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +161 -0
  64. package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +163 -0
  65. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +166 -0
  66. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +177 -0
  67. package/templates/lupine-template-fullstack-starter/web/src/components/story-card.tsx +96 -0
  68. package/templates/lupine-template-fullstack-starter/web/src/components/story-list.tsx +106 -0
  69. package/templates/lupine-template-fullstack-starter/web/src/components/story-props.ts +34 -0
  70. package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +84 -0
  71. package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +48 -0
  72. package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +61 -0
  73. package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +61 -0
  74. package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +23 -0
  75. package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +90 -0
  76. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/index.html +6 -0
  77. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +155 -0
  78. package/templates/lupine-template-fullstack-starter/web/src/models/client-env-keys.ts +5 -0
  79. package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +15 -0
  80. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-cfg.tsx +140 -0
  81. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-edit.tsx +21 -0
  82. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-list.tsx +24 -0
  83. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-user.tsx +150 -0
  84. package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +105 -0
  85. package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +38 -0
  86. package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +38 -0
  87. package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +58 -0
  88. package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +27 -0
  89. package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +54 -0
  90. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +112 -0
  91. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +112 -0
  92. package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +57 -0
  93. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +55 -0
  94. package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +19 -0
  95. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +17 -0
  96. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
  97. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +3 -1
  98. package/templates/lupine-template-responsive-starter/README.md +7 -0
  99. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +1 -1
  100. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +2 -1
  101. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +2 -1
  102. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +8 -17
  103. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +15 -27
  104. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +2 -8
  105. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +26 -36
  106. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +16 -21
  107. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +9 -9
  108. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +3 -16
  109. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +3 -2
  110. package/templates/lupine-template-responsive-starter/web/src/index.tsx +2 -11
  111. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +1 -10
  112. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +3 -14
  113. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +3 -14
  114. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +7 -15
  115. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +7 -14
  116. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +3 -14
  117. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +2 -1
  118. package/templates/common/AI_CONTEXT.md +0 -1002
  119. package/templates/lupine-template-hello-world/api/package.json +0 -6
  120. package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
  121. package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
  122. package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
  123. package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
  124. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
  125. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
  126. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/assets/favicon.ico +0 -0
  127. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/app.css +0 -0
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # create-lupine
2
+
3
+ Creates a new [lupine.js](https://github.com/uuware/lupine.js) project: a web site or app with lupine.web (front end, SSR) and lupine.api (Node back end).
4
+
5
+ ```bash
6
+ npx create-lupine@latest my-app
7
+ cd my-app
8
+ npm install
9
+ npm run dev # http://localhost:11080
10
+ ```
11
+
12
+ Templates to choose from:
13
+
14
+ | Template | |
15
+ | --- | --- |
16
+ | `responsive-starter` (tabs or side menu) | an app for phones that runs on the web, too: notes, pages, settings |
17
+ | `fullstack-starter` | a web site: pages, frames, sign-in and registration, an admin area, an API with a database |
18
+ | `doc-starter` | documentation from Markdown, for GitHub Pages too |
19
+ | `cv-starter` | a CV from Markdown |
20
+
21
+ `npx create-lupine --update-version` brings the lupine packages of an existing project up to date.
22
+
23
+ Native apps (iOS, Android, macOS, Windows): start from `apps/native-starter` of the repository, see [Getting started](https://uuware.github.io/lupine.js/en/native/started).
24
+
25
+ MIT.
package/index.js CHANGED
@@ -29,6 +29,20 @@ function generateRandomString(length) {
29
29
  return [...crypto.randomBytes(length)].map((x) => chars[x % chars.length]).join('');
30
30
  }
31
31
 
32
+ function generateLayeredPasswordHash(password) {
33
+ const saltHex = crypto.randomBytes(16).toString('hex');
34
+ const keyHex = crypto
35
+ .scryptSync(password, Buffer.from(saltHex, 'hex'), 32, {
36
+ N: 16384,
37
+ r: 8,
38
+ p: 1,
39
+ maxmem: 64 * 1024 * 1024,
40
+ })
41
+ .toString('hex');
42
+ const verifierHex = crypto.createHash('sha256').update(keyHex).digest('hex');
43
+ return `scrypt2$${saltHex}$${verifierHex}`;
44
+ }
45
+
32
46
  const red = (str) => `\x1b[31m${str}\x1b[0m`;
33
47
  const green = (str) => `\x1b[32m${str}\x1b[0m`;
34
48
  const bold = (str) => `\x1b[1m${str}\x1b[0m`;
@@ -57,13 +71,6 @@ for (let i = 0; i < args.length; i++) {
57
71
  const cwd = process.cwd();
58
72
 
59
73
  const TEMPLATES = [
60
- {
61
- name: 'hello-world',
62
- dir: 'lupine-template-hello-world',
63
- display: 'Hello World',
64
- itemType: 'frontend',
65
- color: green,
66
- },
67
74
  {
68
75
  name: 'doc-starter',
69
76
  dir: 'lupine-template-doc-starter',
@@ -96,6 +103,13 @@ const TEMPLATES = [
96
103
  itemType: 'frontend',
97
104
  color: green,
98
105
  },
106
+ {
107
+ name: 'fullstack-starter',
108
+ dir: 'lupine-template-fullstack-starter',
109
+ display: 'Full-stack Web Starter (pages, accounts, admin, API)',
110
+ itemType: 'frontend',
111
+ color: green,
112
+ },
99
113
  ];
100
114
 
101
115
  async function init() {
@@ -103,7 +117,8 @@ async function init() {
103
117
  const versions = {
104
118
  'lupine.api': getLatestVersion('lupine.api', '^1.0.1'),
105
119
  'lupine.web': getLatestVersion('lupine.web', '^1.0.1'),
106
- 'lupine.components': getLatestVersion('lupine.components', '^1.0.1'),
120
+ 'lupine.core': getLatestVersion('lupine.core', '^0.1.0'),
121
+ 'lupine.web.components': getLatestVersion('lupine.web.components', '^1.2.0'),
107
122
  'lupine.press': getLatestVersion('lupine.press', '^1.0.1')
108
123
  };
109
124
 
@@ -312,7 +327,8 @@ async function init() {
312
327
 
313
328
  pkg.dependencies = {
314
329
  'lupine.api': versions['lupine.api'],
315
- 'lupine.components': versions['lupine.components'],
330
+ 'lupine.core': versions['lupine.core'],
331
+ 'lupine.web.components': versions['lupine.web.components'],
316
332
  'lupine.web': versions['lupine.web'],
317
333
  };
318
334
 
@@ -328,12 +344,18 @@ async function init() {
328
344
  if (fs.existsSync(path.join(root, '.env'))) {
329
345
  let envContent = fs.readFileSync(path.join(root, '.env'), 'utf-8');
330
346
 
331
- // Auto-generate passwords
332
- const keysToUpdate = ['ADMIN_PASS=', 'CRYPTO_KEY=', 'DEV_ADMIN_PASS=', 'DEV_CRYPTO_KEY=', 'DEV_TOKEN='];
333
- keysToUpdate.forEach((key) => {
334
- // Replace line starting with key=
347
+ // Auto-generate keys & random layered scrypt password placeholders
348
+ const secretKeys = ['CRYPTO_KEY=', 'DEV_CRYPTO_KEY=', 'DEV_TOKEN='];
349
+ secretKeys.forEach((key) => {
335
350
  envContent = envContent.replace(new RegExp(`^${key}.*`, 'gm'), `${key}${generateRandomString(32)}`);
336
351
  });
352
+ const passwordKeys = ['ADMIN_PASS=', 'DEV_ADMIN_PASS='];
353
+ passwordKeys.forEach((key) => {
354
+ envContent = envContent.replace(
355
+ new RegExp(`^${key}.*`, 'gm'),
356
+ `${key}${generateLayeredPasswordHash(generateRandomString(32))}`
357
+ );
358
+ });
337
359
 
338
360
  envContent = envContent.replace(/{APP-NAME}/g, appName);
339
361
  fs.writeFileSync(path.join(root, '.env'), envContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lupine",
3
- "version": "1.0.30",
3
+ "version": "1.2.0",
4
4
  "description": "Scaffolding tool for Lupine.js projects",
5
5
  "bin": {
6
6
  "create-lupine": "index.js"
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: lupine-framework
3
+ description: >-
4
+ How to write code for Lupine.js: web sites with lupine.web (TSX, signals, router, CSS-in-JS, SSR), Node back ends
5
+ with lupine.api, and native apps for iOS, Android, macOS, Windows and the web with lupine.native. Use it when writing,
6
+ changing or reviewing pages, components, routes, styles, API handlers or native screens of a Lupine.js project, or
7
+ when building, testing or running native apps with the lupine-native tool.
8
+ ---
9
+
10
+ # Lupine.js
11
+
12
+ One TypeScript code base for web sites, Node.js back ends and native apps. State is **signals**; a component function runs **once**; there is no virtual DOM, no compiler of its own and no React hooks.
13
+
14
+ ## Which package
15
+
16
+ | Writing | Import from | Never in that code |
17
+ | --- | --- | --- |
18
+ | a web page or web component | `lupine.web` (signals, `CssProps`, router, SSR), `lupine.web.components` (components, `createField`) | `lupine.native.*` (except as in references/native-apps.md, "native components in a web page") |
19
+ | a native screen (iOS, Android, macOS, Windows, web) | `lupine.native.core` (signals, View, Text, platform functions), `lupine.native.components` (themes, router, forms, overlays) | `document`, `window`, `localStorage`, `lupine.web`, `lupine.web.components`: there is no DOM. Only `src/index.web.tsx` may use the DOM |
20
+ | a back end | `lupine.api` | DOM, browser APIs |
21
+
22
+ Signals come from the framework package (`lupine.web` or `lupine.native.core`); both pass on all of `lupine.core`. Don't add `lupine.core` to an app.
23
+
24
+ ## The rules that matter most
25
+
26
+ 1. **State is a signal**: `const [count, setCount] = createSignal(0)`. Plain variables don't update the page.
27
+ 2. **Pass a function, not its result**: `{count}` or `{() => count() + 1}` is updated; `{count()}` is read once and never again. The same for props and styles: `class={() => (on() ? 'a' : 'b')}`, `style={{ opacity: () => (on() ? 1 : 0.5) }}`.
28
+ 3. **A component runs once**: no re-rendering, no dependency arrays. Derived values: `createMemo`. Side effects: `createEffect` (not on the server). Once, when shown: `onMount`. When removed: `onCleanup`. In an async component call them before the first `await`.
29
+ 4. **Lists and conditions**: `<For each={items}>{(item) => ...}</For>` keeps rows by identity; `<Show when={on} fallback={...}>`.
30
+ 5. **Look before you change**: read the file and the code around it first; change the smallest part that does the job; don't rewrite what you weren't asked to touch.
31
+
32
+ ## Web specifics (lupine.web)
33
+
34
+ - Styles: `css={...}` with `&` for the component's own class names (`class='&-title'`), theme variables instead of fixed colors. → references/styling-and-themes.md
35
+ - Pages: `PageRouter`, parameters `/:id`, optional `/?opt`, frames; links are `<a href>`, from code `initializePage(path)`. → references/navigation-and-routing.md
36
+ - **SSR**: pages are rendered on the server first. At the top of a module use `bindAppGlobalStyle`, not `bindGlobalStyle`; while rendering don't touch `window`, `document` or `localStorage` (check `isFrontEnd()` or do it in `onMount`).
37
+ - Phones in the browser: `SliderFrame`, `ActionSheet...Promise` instead of `alert`/`confirm`. → references/mobile-interactions.md
38
+ - Icons: references/icon-handling.md
39
+
40
+ ## Native specifics (lupine.native)
41
+
42
+ - Components: `View`, `Text`, `TextInput`, `ScrollView`, `List`, `Image`, `Canvas`, `GL`; styles are objects (flexbox, top to bottom), each value may be a function; `onPress`, `gesture(...)`.
43
+ - Colors from the theme: `col('text')`; pages: `router` with `Pages`, `Screen`; messages: `Toast`, `ActionSheet`; put `<OverlayHost />` last.
44
+ - Build, run, test: `npx lupine-native <ios|android|macos|windows|web> --app=<dir> --run`, `npx lupine-native test <platform> --app=<dir>`, `npx lupine-native doctor`.
45
+ → references/native-apps.md
46
+
47
+ ## Back end (lupine.api)
48
+
49
+ API modules and routers, databases, SSR of the web pages, the admin console; writing routes are POST and check the session. → references/backend-api.md
50
+
51
+ ## References
52
+
53
+ | Topic | File |
54
+ | --- | --- |
55
+ | Signals, lifecycle, lists, forms, refs (web and native) | [reactivity-and-state.md](./references/reactivity-and-state.md) |
56
+ | CSS-in-JS, `&` classes, themes and dark mode (web) | [styling-and-themes.md](./references/styling-and-themes.md) |
57
+ | Router, parameters, SSR, environment and settings (web) | [navigation-and-routing.md](./references/navigation-and-routing.md) |
58
+ | SliderFrame, action sheets, the back button (web on phones) | [mobile-interactions.md](./references/mobile-interactions.md) |
59
+ | Icons (web, admin) | [icon-handling.md](./references/icon-handling.md) |
60
+ | Native apps: components, styles, navigation, platform functions, tests, the CLI | [native-apps.md](./references/native-apps.md) |
61
+ | Back end: apps, API routers, databases, security | [backend-api.md](./references/backend-api.md) |
62
+
63
+ Documentation: https://uuware.github.io/lupine.js/ (its Markdown is in `apps/doc/web/markdown/en` of the lupine.js repository).
@@ -0,0 +1,98 @@
1
+ # Back end (lupine.api)
2
+
3
+ A Node.js server for several apps: the domain chooses the app with its API module, web files and data. It also renders the web pages (SSR) and has an admin console. Documentation: https://uuware.github.io/lupine.js/en/lupine.api/index and https://uuware.github.io/lupine.js/en/essentials/ssr.
4
+
5
+ ## A project
6
+
7
+ ```text
8
+ .env, .env.development, .env.production APPS, DOMAINS:<app>, ports, DB_TYPE, WEB.* for the front end
9
+ apps/server/ starts the server (from the template, usually unchanged)
10
+ apps/my-app/lupine.json webEntryPoints, apiEntryPoint, copyFiles
11
+ apps/my-app/web/src/index.tsx front end (lupine.web)
12
+ apps/my-app/api/src/index.ts export const apiModule = new ApiModule(new RootApi())
13
+ ```
14
+
15
+ ```bash
16
+ npm run dev # lupine-build --dev=1, then the server: http://localhost:11080, rebuilds on change
17
+ npm run build # production build into dist/server_root: <app>_web, <app>_api, <app>_data (data isn't touched)
18
+ ```
19
+
20
+ A new app needs its name in `APPS` and a `DOMAINS:<name>=...` line of `.env`.
21
+
22
+ ## The API module
23
+
24
+ ```ts
25
+ import { ApiHelper, ApiModule, ApiRouter, IApiBase, StaticServer } from 'lupine.api';
26
+
27
+ class RootApi implements IApiBase {
28
+ private router = new ApiRouter();
29
+ constructor() {
30
+ this.router.use('/api', new Api().getRouter());
31
+ // last: static files, otherwise the page is rendered by SSR
32
+ const staticServer = new StaticServer();
33
+ this.router.use('*', staticServer.processRequest.bind(staticServer));
34
+ }
35
+ getRouter() {
36
+ return this.router;
37
+ }
38
+ }
39
+ export const apiModule = new ApiModule(new RootApi());
40
+ ```
41
+
42
+ - `router.get`, `router.post`, `router.use` (all methods); paths like the page router: `/:id` required, `/?id` optional.
43
+ - A handler returns `true` when it has answered; `false` asks the next one. A handler may be another router; several handlers run in order (`use('/orders', checkUser, orders)`), so a check can stop the request.
44
+ - `setFilter(fn)` runs before all routes of a router.
45
+
46
+ ## Requests and answers
47
+
48
+ | | |
49
+ | --- | --- |
50
+ | `req.locals.json()` `text()` `formData()` | the body |
51
+ | `req.locals.query` | `URLSearchParams` |
52
+ | `req.locals.urlParameters.get('id', '')` | parameters of the path |
53
+ | `req.locals.cookies().get(name, '')`, `setCookie`, `clearCookie` | cookies |
54
+ | `ApiHelper.sendJson(req, res, data, status?)` | JSON; also `sendHtml`, `sendFile` |
55
+
56
+ Answers of the templates are `{ status: 'ok' | 'error', message, ... }`; texts for users come from `langHelper.getLang('shared:...')`.
57
+
58
+ ## Rules for handlers
59
+
60
+ - **What changes data is POST** and checks the user on the server first (in the templates `getUserFromCookie(req, res, ...)`, and its role for admin functions). Checks in the front end only decide what is shown.
61
+ - Check what was sent: types, lengths, and that an object isn't an array; skip keys like `__proto__` before copying keys into an object.
62
+ - SQL only with parameters (`?`), never with typed text in the string.
63
+ - File names from users: `isSafeFilename`, `resolveSafePath` (files stay inside the app's data folder). URLs the server fetches for users: `validateTargetUrl`.
64
+ - No secrets in the front end: only `.env` variables that start with `WEB.` reach it.
65
+
66
+ ## Databases
67
+
68
+ SQLite, MySQL, SQL Server and Oracle, chosen by `DB_TYPE` (also per app: `DB_TYPE:<app>`). `$__` becomes the table prefix.
69
+
70
+ ```ts
71
+ import { apiCache, ApiHelper, ApiRouter } from 'lupine.api';
72
+
73
+ const notes = new ApiRouter();
74
+ notes.get('/list', async (req, res) => {
75
+ const rows = await apiCache.getDb().select('SELECT id, title FROM $__note WHERE title LIKE ? ORDER BY id DESC', ['%a%']);
76
+ ApiHelper.sendJson(req, res, rows);
77
+ return true;
78
+ });
79
+ notes.post('/add', async (req, res) => {
80
+ const { title } = req.locals.json() as { title: string };
81
+ await apiCache.getDb().transaction(async (trx) => {
82
+ await trx.insertObject('$__note', { title });
83
+ });
84
+ ApiHelper.sendJson(req, res, { status: 'ok' });
85
+ return true;
86
+ });
87
+ ```
88
+
89
+ New tables go into the install scripts of the app (`api/resources/install.sqlite.sql`, `install.mysql.sql`, ...).
90
+
91
+ ## SSR and settings
92
+
93
+ - Every URL that no API and no file answers is rendered by the front end's `PageRouter` on the server (references/navigation-and-routing.md). Async page components load their data with `props.renderPageFunctions.fetchData(url)`, which on the server calls the API inside the process with the request's cookies.
94
+ - `apiStorage.setWeb(key, value)` + `apiStorage.save()` store settings that the front end reads with `WebConfig.get(key, default)`, without a new release.
95
+
96
+ ## Helpers
97
+
98
+ `lupine.api` passes on the helpers of `lupine.core` (`Logger`, dates, `formatBytes`, `SimpleStorage`, ...). Others: `langHelper`, `apiCache`, `apiStorage`, `ApiHelper`, `CryptoUtils`, `resolveSafePath`, `isSafeFilename`, `isSafeSqlIdentifier`, `validateTargetUrl` (no requests to private addresses), CSV and form data parsers; look in `packages/lupine.api/src` before writing one of your own.
@@ -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. 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,100 @@
1
+ # Mobile Layout & Interactions
2
+
3
+ ## 1. Mobile Drill-Down Navigation (`SliderFrame`)
4
+
5
+ Lupine.js uses a slide-over model for multi-level navigation drill-down. **Important: Every child page capable of opening a deeper level must define its own independent `childSliderHook` and mount `<SliderFrame hook={childSliderHook} />` in JSX**. Do not reuse the parent hook, as doing so will replace the current view and destroy the back navigation stack.
6
+
7
+ ```tsx
8
+ import { HeaderWithBackFrame, SliderFrame, SliderFrameHookProps } from 'lupine.web.components';
9
+
10
+ // 1. Parent Component (Level 1, e.g., Home page)
11
+ const Parent = () => {
12
+ const sliderHook: SliderFrameHookProps = {};
13
+
14
+ const openDetail = (id: number) => {
15
+ sliderHook.load!(<DetailComponent id={id} parentSliderFrameHook={sliderHook} />);
16
+ };
17
+
18
+ return (
19
+ <div>
20
+ <SliderFrame hook={sliderHook} />
21
+ <button onClick={() => openDetail(1)}>Open Details (Level 2)</button>
22
+ </div>
23
+ );
24
+ };
25
+
26
+ // 2. Child Component (Level 2, e.g., Settings page)
27
+ const DetailComponent = (props: { id: number; parentSliderFrameHook: SliderFrameHookProps }) => {
28
+ // ⭐️ Must define a brand new independent drill-down hook for this component:
29
+ const childSliderHook: SliderFrameHookProps = {};
30
+
31
+ const openDeeper = (id: number) => {
32
+ // ⭐️ Must use childSliderHook to load level 3 pages:
33
+ childSliderHook.load!(<DetailComponent id={id} parentSliderFrameHook={childSliderHook} />);
34
+ };
35
+
36
+ return (
37
+ <HeaderWithBackFrame title='Detail Page' onBack={(e) => props.parentSliderFrameHook.close!(e)}>
38
+ <div>
39
+ {/* ⭐️ Must mount a new SliderFrame placeholder for level 3 display */}
40
+ <SliderFrame hook={childSliderHook} />
41
+ <button onClick={() => openDeeper(props.id + 1)}>Go to Next Level (Level 3)</button>
42
+ </div>
43
+ </HeaderWithBackFrame>
44
+ );
45
+ };
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 2. Mobile Dialogs & Interactive Prompts (Replacing Native Alert/Confirm)
51
+
52
+ **Strictly avoid browser-native `alert()`, `confirm()`, and `prompt()`**. Always use the Promise-based API from `lupine.web.components`:
53
+
54
+ 1. **Option Selection / Confirmation (`ActionSheetSelectPromise`)**:
55
+ ```typescript
56
+ import { ActionSheetSelectPromise } from 'lupine.web.components';
57
+
58
+ const index = await ActionSheetSelectPromise({
59
+ title: 'Are you sure you want to delete this record?',
60
+ options: ['Delete', 'Edit'],
61
+ cancelButtonText: 'Cancel',
62
+ });
63
+ if (index === 0) { /* User clicked Delete */ }
64
+ ```
65
+
66
+ 2. **Informational Message (`ActionSheetMessagePromise`)**:
67
+ ```typescript
68
+ import { ActionSheetMessagePromise } from 'lupine.web.components';
69
+
70
+ await ActionSheetMessagePromise({
71
+ title: 'Notification',
72
+ message: 'Saved successfully!',
73
+ confirmButtonText: 'OK',
74
+ });
75
+ ```
76
+
77
+ 3. **User Text Input (`ActionSheetInputPromise`)**:
78
+ ```typescript
79
+ import { ActionSheetInputPromise } from 'lupine.web.components';
80
+
81
+ const value = await ActionSheetInputPromise({
82
+ title: 'Enter nickname',
83
+ confirmButtonText: 'OK',
84
+ cancelButtonText: 'Cancel',
85
+ });
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 3. Hardware Back Button & Close Gestures (`data-back-action`)
91
+
92
+ All close buttons, back chevrons, and overlay backdrop dismissals must bind:
93
+ ```tsx
94
+ import { backActionHelper } from 'lupine.web.components';
95
+
96
+ const CloseButton = (props: { onClose: () => void }) => (
97
+ <i class='ifc-icon ma-close' data-back-action={backActionHelper.genBackActionId()} onClick={props.onClose}></i>
98
+ );
99
+ ```
100
+ The framework automatically triggers a click event on the top-most active element when the user presses the hardware back button or performs an edge-swipe back gesture.
@@ -0,0 +1,167 @@
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`, and `web.entries`) 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 by copying `apps/native-starter` (tabs, pages, themes, languages, sign-in); `apps/native-demo` shows everything else.
14
+
15
+ ```text
16
+ apps/my-app/
17
+ package.json name, version, "lupineNative": { name, title, id, entry, permissions, plugins, ... }
18
+ src/app.tsx the app
19
+ src/index.native.tsx runApp(App) from 'lupine.native.core/native'
20
+ src/index.web.tsx runApp(App) from 'lupine.native.core/web'
21
+ src/index.test.tsx runApp(App) and the tests
22
+ ```
23
+
24
+ ```tsx
25
+ // src/app.tsx
26
+ import { createSignal, insets, Text, TextInput, View } from 'lupine.native.core';
27
+ import { Button, col, OverlayHost, Toast } from 'lupine.native.components';
28
+
29
+ export const App = () => {
30
+ const [name, setName] = createSignal('');
31
+ return (
32
+ <View style={{ flex: 1, padding: 16, gap: 12, paddingTop: () => insets().top + 16, backgroundColor: col('bg') }}>
33
+ <TextInput testID='name' value={name} onChangeText={setName} placeholder='Name' />
34
+ <Button title='Greet' kind='primary' disabled={() => !name()} onPress={() => Toast.success(`Hello ${name()}`)} />
35
+ <Text style={{ color: col('text') }}>{() => `${name().length} letters`}</Text>
36
+ <OverlayHost />
37
+ </View>
38
+ );
39
+ };
40
+ ```
41
+
42
+ Signals, `For`, `Show`, `onMount`, `onCleanup` work as on the web (references/reactivity-and-state.md) and come from `lupine.native.core`.
43
+
44
+ ## Components (lupine.native.core)
45
+
46
+ | | |
47
+ | --- | --- |
48
+ | `View` | box; `onPress`, `onLongPress`, `onTouch={gesture({...})}`, `onLayout`, `pointerEvents` |
49
+ | `Text` | all text is inside `Text`; `numberOfLines`, `selectable` |
50
+ | `TextInput` | `value` (signal), `onChangeText`, `onSubmit`, `keyboardType`, `returnKey`, `secureTextEntry`, `multiline` |
51
+ | `ScrollView` | `horizontal`, `onScroll`, `refreshing`/`onRefresh` |
52
+ | `List` | many rows of one height (`items`, `itemHeight`); `VirtualList`, `SectionList`, `InfiniteList` in lupine.native.components |
53
+ | `Image`, `Icon`, `Svg`, `Canvas`, `GL` | pictures, icons, 2D drawing, WebGL 2 and three.js |
54
+ | `Video`, `WebView`, `Camera` | media |
55
+ | `Button`, `Switch`, `Slider` | the system's own controls; for one look on all platforms use those of lupine.native.components |
56
+
57
+ All of them: `style`, `ref` (`focus()`, `measure()`, `scrollTo()`), `testID`, `transition` (milliseconds).
58
+
59
+ ## Styles
60
+
61
+ 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]}`).
62
+
63
+ - Flexbox, **top to bottom** by default; numbers are density independent pixels; `flex: 1` takes what is left.
64
+ - `margin`/`padding` with `Horizontal`, `Vertical`, `Top` etc.; `gap`; `position: 'absolute'`; `display: 'none'`.
65
+ - Look: `backgroundColor`, `backgroundImage: 'linear-gradient(...)'`, `borderRadius`, `borderWidth`, `borderColor`, `boxShadow`, `opacity`, `translateX`, `scale`, `rotate`.
66
+ - 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.
67
+ - Safe areas: `insets()`; size of the window: `windowInfo()`; wide or narrow: `isWide()`, `Grid`, `Columns`, `ShowWhen`.
68
+
69
+ ## Themes, languages (lupine.native.components)
70
+
71
+ - Colors: `col('bg')`, `col('bgElevated')`, `col('text')`, `col('primary')`, ... (functions, so they follow the theme). No fixed colors in components.
72
+ - `theme()`, `setThemePref('dark' | 'light' | 'system')`, `addThemes`, `deriveTheme`; `syncAppearance` lets the system's controls follow.
73
+ - Texts: `t('key')`, `setLanguages`, `setLang`; `<T>` is a `Text` with the theme's text color.
74
+
75
+ ## Pages and navigation
76
+
77
+ ```tsx
78
+ import { Show, View } from 'lupine.native.core';
79
+ import { BottomTabBar, col, isWide, NavItem, OverlayHost, Pages, router, Row, Screen, Section, Sidebar } from 'lupine.native.components';
80
+
81
+ const items: NavItem[] = [
82
+ { key: '/', label: 'Home', icon: 'home', testID: 'tab-home' },
83
+ { key: '/me', label: 'Me', icon: 'user', testID: 'tab-me' },
84
+ ];
85
+ const Home = () => (
86
+ <Screen title='Home' grouped>
87
+ <Section>
88
+ <Row label='First' onPress={() => router.push('/item/1')} />
89
+ </Section>
90
+ </Screen>
91
+ );
92
+ const Me = () => <Screen title='Me' padded />;
93
+ const Item = (p: { id: string }) => <Screen title={`#${p.id}`} onBack={router.back} padded />;
94
+
95
+ export const App = () => (
96
+ <View style={{ flex: 1, flexDirection: 'row', backgroundColor: col('bg') }}>
97
+ <Show when={isWide}>
98
+ <Sidebar items={items} active={router.tab} onPress={router.navigate} />
99
+ </Show>
100
+ <Pages
101
+ tabs={[{ path: '/', page: Home }, { path: '/me', page: Me }]}
102
+ routes={[{ path: '/item/:id', page: (p) => <Item id={p.id} /> }]}
103
+ notFound={() => <Screen title='404' onBack={router.back} />}
104
+ >
105
+ <Show when={() => !isWide()}>
106
+ <BottomTabBar items={items} active={router.tab} onPress={router.navigate} />
107
+ </Show>
108
+ </Pages>
109
+ <OverlayHost />
110
+ </View>
111
+ );
112
+ ```
113
+
114
+ - `router.push(path, params?)`, `router.replace`, `router.back()`, `router.navigate(tab)`, `router.path()`, `router.tab()`, `useFocused()`.
115
+ - Tabs are kept; a stacked page is removed when one goes back and its `onCleanup` runs.
116
+ - The Android back button: `onBack(() => ...)`, newest first; return `false` to pass it on.
117
+
118
+ ## Messages and panels
119
+
120
+ - `Toast.success('Saved')`, `await MessageBox.confirm({...})`, `await ActionSheet.select({...})`, `Loading.during(promise)`. Questions to the user are bottom action sheets, not alerts.
121
+ - `BottomSheet`, `Dialog`, `SlidePanel`, `DrawerLayout`: opened and closed by a signal (`visible={() => open()}`).
122
+ - They need `<OverlayHost />`, as the last child of the root.
123
+
124
+ ## Forms
125
+
126
+ `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}`.
127
+
128
+ ## Platform functions (lupine.native.core)
129
+
130
+ `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.
131
+
132
+ Files for one platform: `name.ios.tsx` before `name.native.tsx` before `name.tsx`; the web takes `name.web.tsx`.
133
+
134
+ Plugins (sign-in, payments, ads, ...): `lupine.native.plugins/<name>`, switched on in `lupineNative.plugins`, often only in a variant (`--variant=...`).
135
+
136
+ ## The command line
137
+
138
+ In the repository `npm run native -- ...`, in a project `npx lupine-native ...`:
139
+
140
+ ```bash
141
+ npx lupine-native doctor # what is missing for which platform
142
+ npx lupine-native web --app=apps/my-app --watch
143
+ npx lupine-native macos --app=apps/my-app --run # ios, android, windows the same
144
+ npx lupine-native ios --app=apps/my-app --run --device --serial=<udid> --team=<team>
145
+ npx lupine-native android --app=apps/my-app --run --serial=<adb device>
146
+ npx lupine-native windows --app=apps/my-app --run # on a Mac or Linux --run opens it in Wine
147
+ npx lupine-native docker android --app=apps/my-app # builds in Docker, nothing installed
148
+ ```
149
+
150
+ Options: `--release`, `--variant=<name>`, `--define=NAME=value`, `--engine=quickjs` (smaller, slower). The result is in `dist/native/<app>/<platform>`.
151
+
152
+ ## Tests
153
+
154
+ `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`.
155
+
156
+ ```bash
157
+ npx lupine-native test macos --app=apps/my-app
158
+ npx lupine-native test android --app=apps/my-app --serial=<adb device>
159
+ ```
160
+
161
+ 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.
162
+
163
+ ## The web target
164
+
165
+ `lupine-native web` makes a static site (DOM, CSS flexbox). `renderToString` of `lupine.native.core/web/server` renders it on a server, with limits: effects don't run, async components are left out (load the data first and pass it as props), and the browser replaces that HTML (no hydration).
166
+
167
+ Native components in a page of lupine.web: both share the same signals, so a web component can host one with `onMount(() => onCleanup(runApp(Chart, box)))`, `runApp` from `lupine.native.core/web`.