create-lupine 1.0.31 → 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 (126) hide show
  1. package/README.md +25 -0
  2. package/index.js +11 -9
  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 +2 -0
  13. package/templates/lupine-template-cv-starter/README.md +5 -0
  14. package/templates/lupine-template-cv-starter/web/src/index.tsx +1 -10
  15. package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +1 -10
  16. package/templates/lupine-template-doc-starter/README.md +5 -0
  17. package/templates/lupine-template-doc-starter/web/src/index.tsx +1 -10
  18. package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +1 -10
  19. package/templates/lupine-template-fullstack-starter/README.md +21 -0
  20. package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
  21. package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
  22. package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
  23. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
  24. package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
  25. package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
  26. package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
  27. package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
  28. package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
  29. package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
  30. package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
  31. package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
  32. package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1041 -0
  33. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/lupine.json +10 -1
  34. package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
  35. package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
  36. package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
  37. package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
  38. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
  39. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
  40. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
  41. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
  42. package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
  43. package/templates/lupine-template-fullstack-starter/web/assets/images/sample.png +0 -0
  44. package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
  45. package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
  46. package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
  47. package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
  48. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/package.json +1 -1
  49. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +16 -0
  50. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +22 -0
  51. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.html +22 -0
  52. package/templates/lupine-template-fullstack-starter/web/src/admin_dev/index.tsx +64 -0
  53. package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +52 -0
  54. package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +15 -0
  55. package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +75 -0
  56. package/templates/lupine-template-fullstack-starter/web/src/components/home-search-component.tsx +132 -0
  57. package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +162 -0
  58. package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +165 -0
  59. package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +118 -0
  60. package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +122 -0
  61. package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +12 -0
  62. package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +161 -0
  63. package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +163 -0
  64. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +166 -0
  65. package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +177 -0
  66. package/templates/lupine-template-fullstack-starter/web/src/components/story-card.tsx +96 -0
  67. package/templates/lupine-template-fullstack-starter/web/src/components/story-list.tsx +106 -0
  68. package/templates/lupine-template-fullstack-starter/web/src/components/story-props.ts +34 -0
  69. package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +84 -0
  70. package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +48 -0
  71. package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +61 -0
  72. package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +61 -0
  73. package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +23 -0
  74. package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +90 -0
  75. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/index.html +6 -0
  76. package/templates/lupine-template-fullstack-starter/web/src/index.tsx +155 -0
  77. package/templates/lupine-template-fullstack-starter/web/src/models/client-env-keys.ts +5 -0
  78. package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +15 -0
  79. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-cfg.tsx +140 -0
  80. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-edit.tsx +21 -0
  81. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-item-list.tsx +24 -0
  82. package/templates/lupine-template-fullstack-starter/web/src/pages/admin-user.tsx +150 -0
  83. package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +105 -0
  84. package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +38 -0
  85. package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +38 -0
  86. package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +58 -0
  87. package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +27 -0
  88. package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +54 -0
  89. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +112 -0
  90. package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +112 -0
  91. package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +57 -0
  92. package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +55 -0
  93. package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +19 -0
  94. package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +17 -0
  95. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
  96. package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +3 -1
  97. package/templates/lupine-template-responsive-starter/README.md +7 -0
  98. package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +1 -1
  99. package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +2 -1
  100. package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +2 -1
  101. package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +8 -17
  102. package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +15 -27
  103. package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +2 -8
  104. package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +26 -36
  105. package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +16 -21
  106. package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +9 -9
  107. package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +3 -16
  108. package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +3 -2
  109. package/templates/lupine-template-responsive-starter/web/src/index.tsx +2 -11
  110. package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +1 -10
  111. package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +3 -14
  112. package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +3 -14
  113. package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +7 -15
  114. package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +7 -14
  115. package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +3 -14
  116. package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +2 -1
  117. package/templates/common/AI_CONTEXT.md +0 -1002
  118. package/templates/lupine-template-hello-world/api/package.json +0 -6
  119. package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
  120. package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
  121. package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
  122. package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
  123. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
  124. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
  125. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/assets/favicon.ico +0 -0
  126. /package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/app.css +0 -0
@@ -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.components';
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.components` 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,119 @@
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.components';
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
+ 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`.
@@ -47,6 +47,8 @@ DEV_TOKEN=
47
47
  # DEV_ADMIN_SESSION_EXPIRE_DAYS=90
48
48
  # Set DEV_ENABLE_SHELL=true only when remote shell debugging is explicitly needed
49
49
  # DEV_ENABLE_SHELL=false
50
+ # Set DEV_ENABLE_FILES=true to let Files of the dev admin also show the built server and the project folder with .env files
51
+ # DEV_ENABLE_FILES=false
50
52
 
51
53
  # define apps on the same port with different domains (locally or on a real server)
52
54
  # in local, the domains should be added to the /etc/hosts (or C:\Windows\System32\drivers\etc\hosts) file
@@ -0,0 +1,5 @@
1
+ # CV Starter
2
+
3
+ A CV as a web site, written in Markdown (`web/markdown`), with lupine.press: several languages, light and dark themes, and it can be published to GitHub Pages. A template of `npx create-lupine` (`cv-starter`).
4
+
5
+ [Live demo](https://uuware.github.io/lupine-template-cv-starter/) · [Repository](https://github.com/uuware/lupine-template-cv-starter)
@@ -1,13 +1,4 @@
1
- import {
2
- bindRouter,
3
- PageRouter,
4
- bindTheme,
5
- setDefaultPageTitle,
6
- isFrontEnd,
7
- debugWatch,
8
- webEnv,
9
- bindAppGlobalStyle,
10
- } from 'lupine.components';
1
+ import { bindRouter, PageRouter, bindTheme, setDefaultPageTitle, isFrontEnd, debugWatch, webEnv, bindAppGlobalStyle } from 'lupine.web';
11
2
  import { bindPressData, PressPage, pressThemes } from 'lupine.press';
12
3
  import { markdownConfig } from './markdown-built/markdown-config';
13
4
  import { ClientEnvKeys } from './client-env-keys';
@@ -1,13 +1,4 @@
1
- import {
2
- bindRouter,
3
- PageRouter,
4
- bindTheme,
5
- setDefaultPageTitle,
6
- isFrontEnd,
7
- debugWatch,
8
- webEnv,
9
- bindAppGlobalStyle,
10
- } from 'lupine.components';
1
+ import { bindRouter, PageRouter, bindTheme, setDefaultPageTitle, isFrontEnd, debugWatch, webEnv, bindAppGlobalStyle } from 'lupine.web';
11
2
  import { bindPressData, PressPage, pressThemes, setPressSubDir } from 'lupine.press';
12
3
  import { ClientEnvKeys } from '../client-env-keys';
13
4
  import { baseCss } from '../styles/base-css';
@@ -0,0 +1,5 @@
1
+ # Doc Starter
2
+
3
+ A documentation site from Markdown files with lupine.press: a sidebar from the folders, several languages (`web/markdown/en`, `web/markdown/zh`), light and dark themes, search engines see the pages (SSR), and it can be published to GitHub Pages. A template of `npx create-lupine` (`doc-starter`).
4
+
5
+ [Live demo](https://uuware.github.io/lupine-template-doc-starter/) · [Repository](https://github.com/uuware/lupine-template-doc-starter)
@@ -1,13 +1,4 @@
1
- import {
2
- bindRouter,
3
- PageRouter,
4
- bindTheme,
5
- setDefaultPageTitle,
6
- isFrontEnd,
7
- debugWatch,
8
- webEnv,
9
- bindAppGlobalStyle,
10
- } from 'lupine.components';
1
+ import { bindRouter, PageRouter, bindTheme, setDefaultPageTitle, isFrontEnd, debugWatch, webEnv, bindAppGlobalStyle } from 'lupine.web';
11
2
  import { bindPressData, PressPage, pressThemes } from 'lupine.press';
12
3
  import { markdownConfig } from './markdown-built/markdown-config';
13
4
  import { ClientEnvKeys } from './client-env-keys';
@@ -1,13 +1,4 @@
1
- import {
2
- bindRouter,
3
- PageRouter,
4
- bindTheme,
5
- setDefaultPageTitle,
6
- isFrontEnd,
7
- debugWatch,
8
- webEnv,
9
- bindAppGlobalStyle,
10
- } from 'lupine.components';
1
+ import { bindRouter, PageRouter, bindTheme, setDefaultPageTitle, isFrontEnd, debugWatch, webEnv, bindAppGlobalStyle } from 'lupine.web';
11
2
  import { bindPressData, PressPage, pressThemes, setPressSubDir } from 'lupine.press';
12
3
  import { ClientEnvKeys } from '../client-env-keys';
13
4
  import { baseCss } from '../styles/base-css';
@@ -0,0 +1,21 @@
1
+ # Full-stack Web Starter
2
+
3
+ A web site with lupine.web and lupine.api: pages rendered on the server (SSR) and updated in the browser, nested page frames, sign-in, an admin area and an API with a database. For an app that looks like a phone app see `lupine-template-responsive-starter`; for native apps `apps/native-starter`.
4
+
5
+ | Part | Where |
6
+ | --- | --- |
7
+ | pages, frames, the router | `web/src/index.tsx`, `web/src/pages`, `web/src/frames` |
8
+ | sign-in, registration, codes by email, new password | `web/src/components/login*.tsx`, `register.tsx`, `reset-password.tsx`; `api/src/service/user-api.ts` |
9
+ | users' pages (need a sign-in) | `/user/mine`, `/user/favorite`, `/user/profile`, `/user/contact` |
10
+ | admin area (admins only) | `/admin`: users, settings, items; `api/src/service/admin-api.ts` |
11
+ | tools of the developer | `/admin_dev` (database, logs, settings; `DEV_ADMIN_USER` / `DEV_ADMIN_PASS`) |
12
+ | the components of lupine.web.components | `/demo` |
13
+ | API routes | `api/src/service/api.ts` |
14
+
15
+ ## First start
16
+
17
+ 1. In `.env`: `CRYPTO_KEY`, `ADMIN_USER` / `ADMIN_PASS`, `DEV_ADMIN_USER` / `DEV_ADMIN_PASS` (create-lupine fills in random ones), and for mail `SEND_EMAIL_USER` / `SEND_EMAIL_PASS`.
18
+ 2. `npm run dev`, then open `/admin_dev` and create the tables from `api/resources/install.sqlite.sql` (or `install.mysql.sql`).
19
+ 3. The contact form sends to the address `siteEmail` of the settings (`/admin`, settings).
20
+
21
+ Writing routes are POST only and check the session; uploads check the type and the size; codes by email can be asked for once a minute and don't tell whether an address has an account; the contact form takes five messages an hour from an address (per worker process: limit it in front of the server, too).
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "lupine-template-fullstack-starter-api",
3
+ "version": "1.0.0",
4
+ "dependencies": {
5
+ "nodemailer": "^6.9.16"
6
+ },
7
+ "devDependencies": {
8
+ "@types/nodemailer": "^6.4.17"
9
+ }
10
+ }
@@ -0,0 +1,107 @@
1
+ #-- Auto Created for MySQL / MariaDB
2
+ #-- Never name a table with plural (such as "users")
3
+ #-- Never name a table using a reserved keyword (such as "user")
4
+ #-- Never prefix your table name with "tbl" or some other object type prefix
5
+
6
+ CREATE TABLE IF NOT EXISTS $__s_page (
7
+ pageid VARCHAR(50) NOT NULL,
8
+ name VARCHAR(100) NOT NULL DEFAULT '',
9
+ is_component INTEGER NOT NULL DEFAULT 0,
10
+ remark VARCHAR(250) NOT NULL DEFAULT '',
11
+ package VARCHAR(20) NOT NULL DEFAULT '',
12
+ accesslevel CHAR(1) NOT NULL DEFAULT '0',
13
+ json TEXT NOT NULL,
14
+ updateduserid INTEGER,
15
+ updatetime BIGINT NOT NULL DEFAULT 0,
16
+ PRIMARY KEY (pageid)
17
+ );
18
+
19
+ CREATE TABLE IF NOT EXISTS $__s_menu (
20
+ menuid VARCHAR(50) NOT NULL,
21
+ name VARCHAR(100) NOT NULL DEFAULT '',
22
+ remark VARCHAR(250) NOT NULL DEFAULT '',
23
+ package VARCHAR(20) NOT NULL DEFAULT '',
24
+ accesslevel CHAR(1) NOT NULL DEFAULT '0',
25
+ json TEXT NOT NULL,
26
+ updateduserid INTEGER,
27
+ updatetime BIGINT NOT NULL DEFAULT 0,
28
+ PRIMARY KEY (menuid)
29
+ );
30
+
31
+ CREATE TABLE IF NOT EXISTS $__s_process (
32
+ processid VARCHAR(50) NOT NULL,
33
+ name VARCHAR(100) NOT NULL DEFAULT '',
34
+ accesslevel CHAR(1) NOT NULL DEFAULT '0',
35
+ json TEXT NOT NULL,
36
+ package VARCHAR(20) NOT NULL DEFAULT '',
37
+ remark VARCHAR(250) NOT NULL DEFAULT '',
38
+ updatetime BIGINT NOT NULL DEFAULT 0,
39
+ PRIMARY KEY (processid)
40
+ );
41
+
42
+ CREATE TABLE IF NOT EXISTS $__s_user (
43
+ id INTEGER NOT NULL AUTO_INCREMENT,
44
+ gid INTEGER NOT NULL DEFAULT 1,
45
+ level INTEGER NOT NULL DEFAULT 0,
46
+ nickname VARCHAR(200) NOT NULL DEFAULT '',
47
+ username VARCHAR(150) NOT NULL DEFAULT '',
48
+ email VARCHAR(100) NOT NULL DEFAULT '',
49
+ password VARCHAR(100) NOT NULL DEFAULT '',
50
+ usertype VARCHAR(25) NOT NULL DEFAULT '',
51
+ block CHAR(1) NOT NULL DEFAULT '0',
52
+ sendemail CHAR(1) DEFAULT '0',
53
+ gender VARCHAR(10) DEFAULT '0',
54
+ age INTEGER NOT NULL DEFAULT 0,
55
+ training INTEGER NOT NULL DEFAULT 0,
56
+ preference VARCHAR(100) NOT NULL DEFAULT '',
57
+ registerdate VARCHAR(20) NOT NULL DEFAULT '',
58
+ lastvisitdate VARCHAR(20) NOT NULL DEFAULT '',
59
+ activated CHAR(1) NOT NULL DEFAULT '0',
60
+ activation VARCHAR(10) NOT NULL DEFAULT '',
61
+ points INTEGER NOT NULL DEFAULT 0,
62
+ pwtips VARCHAR(100) DEFAULT '',
63
+ pwretry INTEGER NOT NULL DEFAULT 0,
64
+ pwquestion VARCHAR(100) DEFAULT '',
65
+ pwanswer VARCHAR(100) DEFAULT '',
66
+ PRIMARY KEY (id)
67
+ );
68
+
69
+ #-- TABLE:$__st_calendar
70
+ CREATE TABLE IF NOT EXISTS $__s_calendar (
71
+ calendarid VARCHAR(50) NOT NULL,
72
+ title VARCHAR(250) NOT NULL DEFAULT '',
73
+ published CHAR(1) NOT NULL DEFAULT '0',
74
+ remark VARCHAR(250),
75
+ monthfrom VARCHAR(6),
76
+ monthto VARCHAR(6),
77
+ bkcolor VARCHAR(7),
78
+ cidstring VARCHAR(50) NOT NULL DEFAULT '',
79
+ PRIMARY KEY (calendarid)
80
+ );
81
+
82
+ CREATE TABLE IF NOT EXISTS $__s_user_right (
83
+ username VARCHAR(150) NOT NULL,
84
+ rightsid VARCHAR(50) NOT NULL,
85
+ rightsgroup VARCHAR(10) NOT NULL DEFAULT '',
86
+ value TEXT NOT NULL,
87
+ PRIMARY KEY (username, rightsid)
88
+ );
89
+
90
+ CREATE TABLE IF NOT EXISTS $__image_folder (
91
+ id INTEGER NOT NULL AUTO_INCREMENT,
92
+ folder_id VARCHAR(10) NOT NULL DEFAULT '',
93
+ display_name VARCHAR(50) NOT NULL DEFAULT '',
94
+ parent_full_path VARCHAR(255) NOT NULL DEFAULT '',
95
+ full_path VARCHAR(255) NOT NULL DEFAULT '',
96
+ PRIMARY KEY (id)
97
+ );
98
+
99
+ CREATE TABLE IF NOT EXISTS $__image (
100
+ id INTEGER NOT NULL AUTO_INCREMENT,
101
+ file_id VARCHAR(20) NOT NULL DEFAULT '',
102
+ display_name VARCHAR(50) NOT NULL DEFAULT '',
103
+ parent_full_path VARCHAR(255) NOT NULL DEFAULT '',
104
+ version INTEGER NOT NULL DEFAULT 0,
105
+ updatetime BIGINT NOT NULL DEFAULT 0,
106
+ PRIMARY KEY (id)
107
+ );
@@ -0,0 +1,75 @@
1
+ #-- Auto Created By WebNoCoding at:2015-06-03 16:51:43
2
+ #-- Never name a table with plural (such as "users")
3
+ #-- Never name a table using a reserved keyword (such as "user")
4
+ #-- Never prefix your table name with "tbl" or some other object type prefix
5
+
6
+ CREATE TABLE $__s_page (
7
+ pageid VARCHAR(50) NOT NULL,
8
+ title VARCHAR(100) NOT NULL DEFAULT '',
9
+ note VARCHAR(250) NOT NULL DEFAULT '',
10
+ package VARCHAR(20) NOT NULL DEFAULT '',
11
+ items TEXT NOT NULL DEFAULT '',
12
+ updateduserid INTEGER,
13
+ updatedstamp VARCHAR(20),
14
+ PRIMARY KEY (pageid)
15
+ );
16
+
17
+ CREATE TABLE $__s_menu (
18
+ menuid VARCHAR(50) NOT NULL,
19
+ title VARCHAR(100) NOT NULL DEFAULT '',
20
+ note VARCHAR(250) NOT NULL DEFAULT '',
21
+ package VARCHAR(20) NOT NULL DEFAULT '',
22
+ items TEXT NOT NULL DEFAULT '',
23
+ updateduserid INTEGER,
24
+ updatedstamp VARCHAR(20),
25
+ PRIMARY KEY (menuid)
26
+ );
27
+
28
+ CREATE TABLE $__s_user (
29
+ id INTEGER NOT NULL DEFAULT '0',
30
+ gid INTEGER NOT NULL DEFAULT '1',
31
+ level INTEGER NOT NULL DEFAULT '0',
32
+ nickname VARCHAR(200) NOT NULL DEFAULT '',
33
+ username VARCHAR(150) NOT NULL DEFAULT '',
34
+ email VARCHAR(100) NOT NULL DEFAULT '',
35
+ password VARCHAR(100) NOT NULL DEFAULT '',
36
+ usertype VARCHAR(25) NOT NULL DEFAULT '',
37
+ block CHAR(1) NOT NULL DEFAULT '0',
38
+ sendemail CHAR(1) DEFAULT '0',
39
+ gender VARCHAR(10) DEFAULT '0',
40
+ age INTEGER NOT NULL DEFAULT '0',
41
+ training INTEGER NOT NULL DEFAULT '0',
42
+ preference VARCHAR(100) NOT NULL DEFAULT '',
43
+ registerdate VARCHAR(20) NOT NULL DEFAULT '',
44
+ lastvisitdate VARCHAR(20) NOT NULL DEFAULT '',
45
+ activated CHAR(1) NOT NULL DEFAULT '0',
46
+ activation VARCHAR(10) NOT NULL DEFAULT '',
47
+ points INTEGER NOT NULL DEFAULT '0',
48
+ pwtips VARCHAR(100) DEFAULT '',
49
+ pwretry INTEGER NOT NULL DEFAULT '0',
50
+ pwquestion VARCHAR(100) DEFAULT '',
51
+ pwanswer VARCHAR(100) DEFAULT '',
52
+ PRIMARY KEY (id)
53
+ );
54
+
55
+ #-- TABLE:$__st_calendar
56
+ CREATE TABLE $__s_calendar (
57
+ calendarid VARCHAR(50) NOT NULL,
58
+ title VARCHAR(250) NOT NULL DEFAULT '',
59
+ published CHAR(1) NOT NULL DEFAULT '0',
60
+ remark VARCHAR(250),
61
+ monthfrom VARCHAR(6),
62
+ monthto VARCHAR(6),
63
+ bkcolor VARCHAR(7),
64
+ cidstring VARCHAR(50) NOT NULL DEFAULT '',
65
+ PRIMARY KEY (calendarid)
66
+ );
67
+
68
+ CREATE TABLE $__s_user_right (
69
+ username VARCHAR(150) NOT NULL,
70
+ rightsid VARCHAR(50) NOT NULL,
71
+ rightsgroup VARCHAR(10) NOT NULL DEFAULT '',
72
+ value TEXT NOT NULL,
73
+ PRIMARY KEY (username, rightsid)
74
+ );
75
+
@@ -0,0 +1,39 @@
1
+ import { OneLangProps } from 'lupine.api';
2
+
3
+ export const apiLangEn: OneLangProps = {
4
+ langName: 'en',
5
+ langs: {
6
+ 'shared:process_completed': 'Process completed',
7
+ 'shared:process_failed': 'Process failed',
8
+ 'shared:wrong_parameters': 'Wrong parameters.',
9
+ 'shared:record_not_found': 'Record not found.',
10
+ 'shared:record_not_updated': 'Record not updated.',
11
+ 'shared:record_updated': 'Record updated.',
12
+ 'shared:record_creation_failed': 'Record creation failed.',
13
+ 'shared:record_loaded': 'Record loaded.',
14
+ 'shared:record_deleted': 'Record deleted.',
15
+ 'shared:file_too_large': 'File is too large.',
16
+ 'shared:file_uploaded': 'You have uploaded a file.',
17
+ 'shared:file_not_found': 'File not found.',
18
+ 'shared:wrong_file_extension': 'Wrong file extension.',
19
+ 'shared:file_part_updated': 'Part file is uploaded.',
20
+ 'shared:file_update_failed': 'Failed to upload.',
21
+ 'shared:configuration_updated': 'Configuration updated.',
22
+ 'shared:user_not_activated': 'Account not activated.',
23
+ 'shared:wrong_email_format': 'Wrong email format.',
24
+ 'shared:register_failed': 'Register failed, please contact administrator.',
25
+ 'shared:register_success': 'You have successfully registered. Please login to your account.',
26
+ 'shared:send_email_notification': 'Email notification sent.',
27
+ 'shared:updated_profile': 'Profile updated.',
28
+ 'shared:password_length_wrong': 'Password length is wrong, must be at least {len} characters.',
29
+ 'shared:no_update_for_special_user': 'This is a special user, cannot update profile.',
30
+ 'shared:login_failed_too_many_times': 'Login failed too many times, please wait {minutes} minutes to retry.',
31
+ 'shared:register_username_exists':
32
+ 'This username already exists, please input a new email or reset your current account password.',
33
+ // 'shared:send_email_activation': 'Activation code sent to your email.',
34
+ 'shared:send_and_copy_activation':
35
+ 'An Email has been sent to you with the authentication code. Please copy that authentication code to login or reset your password.',
36
+ 'shared:wrong_activation': 'Wrong activation code.',
37
+ 'shared:password_reset_success': 'Password reset successfully, please login.',
38
+ },
39
+ };
@@ -0,0 +1,37 @@
1
+ import { OneLangProps } from 'lupine.api';
2
+
3
+ export const apiLangZhCn: OneLangProps = {
4
+ langName: 'zh-cn',
5
+ langs: {
6
+ 'shared:process_completed': '处理完成',
7
+ 'shared:process_failed': '处理失败',
8
+ 'shared:wrong_parameters': '错误的参数',
9
+ 'shared:record_not_found': '记录未找到',
10
+ 'shared:record_not_updated': '记录未更新',
11
+ 'shared:record_updated': '记录更新成功',
12
+ 'shared:record_creation_failed': '记录创建失败',
13
+ 'shared:record_loaded': '记录加载成功',
14
+ 'shared:record_deleted': '记录删除成功',
15
+ 'shared:file_too_large': '文件太大',
16
+ 'shared:file_uploaded': '您已上传文件',
17
+ 'shared:file_not_found': '文件未找到',
18
+ 'shared:wrong_file_extension': '错误的文件扩展名',
19
+ 'shared:file_part_updated': '部分文件已上传',
20
+ 'shared:file_update_failed': '上传失败',
21
+ 'shared:configuration_updated': '配置更新成功',
22
+ 'shared:user_not_activated': '账号未激活',
23
+ 'shared:wrong_email_format': '错误的邮箱格式',
24
+ 'shared:register_failed': '注册失败,请联系管理员。',
25
+ 'shared:register_success': '您已成功注册。请登录您的账号。',
26
+ 'shared:send_email_notification': '已发送邮件通知。',
27
+ 'shared:updated_profile': '更新了个人资料。',
28
+ 'shared:password_length_wrong': '密码长度错误,必须至少 {len} 个字符。',
29
+ 'shared:no_update_for_special_user': '这是特殊用户,不能更新个人资料。',
30
+ 'shared:login_failed_too_many_times': '登录失败次数太多,请 {minutes} 分钟后重试。',
31
+ 'shared:register_username_exists': '这个账号已经存在,请输入新的email或重新设置您的当前账号的密码。',
32
+ // 'shared:send_email_activation': '激活码已发送到您的邮箱。',
33
+ 'shared:send_and_copy_activation': '激活码已发送到您的邮箱,请复制激活码来重置密码或使用无密码登陆。',
34
+ 'shared:wrong_activation': '错误的激活码。',
35
+ 'shared:password_reset_success': '密码重置成功,请登录。',
36
+ },
37
+ };