create-lupine 1.2.0 → 1.3.1
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.
- package/README.md +13 -7
- package/index.js +236 -109
- package/package.json +1 -1
- package/templates/common/.agents/skills/lupine-framework/SKILL.md +3 -3
- package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +16 -1
- package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +1 -1
- package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +17 -88
- package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +47 -24
- package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +1 -0
- package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +2 -2
- package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +3 -1
- package/templates/common/.env.development +2 -0
- package/templates/common/.env.mobile +4 -3
- package/templates/common/_env +10 -5
- package/templates/common/apps/server/README.md +10 -0
- package/templates/common/dev/cp-folder.js +9 -4
- package/templates/lupine-template-cv-starter/README.md +33 -1
- package/templates/lupine-template-cv-starter/app/package.json +20 -0
- package/templates/lupine-template-cv-starter/app/src/app.tsx +6 -0
- package/templates/lupine-template-cv-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-cv-starter/app/src/index.test.tsx +71 -0
- package/templates/lupine-template-cv-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-cv-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-cv-starter/lupine.json +8 -7
- package/templates/lupine-template-cv-starter/web/src/index.html +9 -2
- package/templates/lupine-template-cv-starter/web/src/index.tsx +9 -14
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +9 -2
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +4 -20
- package/templates/lupine-template-doc-starter/README.md +33 -1
- package/templates/lupine-template-doc-starter/app/package.json +20 -0
- package/templates/lupine-template-doc-starter/app/src/app.tsx +6 -0
- package/templates/lupine-template-doc-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-doc-starter/app/src/index.test.tsx +78 -0
- package/templates/lupine-template-doc-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-doc-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-doc-starter/lupine.json +8 -7
- package/templates/lupine-template-doc-starter/web/src/index.html +9 -2
- package/templates/lupine-template-doc-starter/web/src/index.tsx +9 -14
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +9 -2
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +4 -20
- package/templates/lupine-template-fullstack-note/README.md +83 -0
- package/templates/{lupine-template-cv-starter → lupine-template-fullstack-note}/api/package.json +2 -2
- package/templates/lupine-template-fullstack-note/api/resources/install.mysql.sql +32 -0
- package/templates/lupine-template-fullstack-note/api/resources/install.sqlite.sql +27 -0
- package/templates/lupine-template-fullstack-note/api/src/service/answer.ts +39 -0
- package/templates/lupine-template-fullstack-note/api/src/service/api.ts +52 -0
- package/templates/lupine-template-fullstack-note/api/src/service/db.ts +78 -0
- package/templates/lupine-template-fullstack-note/api/src/service/notes-api.ts +86 -0
- package/templates/lupine-template-fullstack-note/api/src/service/root-api.ts +19 -0
- package/templates/lupine-template-fullstack-note/api/src/service/user-api.ts +182 -0
- package/templates/lupine-template-fullstack-note/app/package.json +19 -0
- package/templates/lupine-template-fullstack-note/app/src/app.tsx +75 -0
- package/templates/lupine-template-fullstack-note/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-fullstack-note/app/src/index.test.tsx +373 -0
- package/templates/lupine-template-fullstack-note/app/src/index.web.tsx +20 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/components.tsx +65 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/details.tsx +38 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/discover.tsx +25 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/home.tsx +76 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/inbox.tsx +49 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/login.tsx +54 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/me.tsx +32 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/notes.tsx +128 -0
- package/templates/lupine-template-fullstack-note/app/src/pages/settings.tsx +45 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/AppMenu.tsx +44 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/api.ts +159 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/data.ts +20 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/locales/ja.ts +80 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/locales/zh-CN.ts +80 -0
- package/templates/lupine-template-fullstack-note/app/src/shell/texts.ts +14 -0
- package/templates/lupine-template-fullstack-note/app/tsconfig.json +17 -0
- package/templates/lupine-template-fullstack-note/lupine.json +25 -0
- package/templates/lupine-template-fullstack-note/web/assets/favicon.ico +0 -0
- package/templates/{lupine-template-doc-starter/api → lupine-template-fullstack-note/web}/package.json +2 -2
- package/templates/lupine-template-fullstack-note/web/src/index.html +23 -0
- package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
- package/templates/lupine-template-fullstack-starter/README.md +64 -14
- package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +2 -2
- package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +2 -2
- package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +2 -2
- package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +72 -47
- package/templates/lupine-template-fullstack-starter/app/package.json +20 -0
- package/templates/lupine-template-fullstack-starter/app/src/app.tsx +76 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.test.tsx +276 -0
- package/templates/lupine-template-fullstack-starter/app/src/index.web.tsx +28 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/about.tsx +27 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/contact.tsx +41 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/favorite.tsx +27 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/home.tsx +63 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/login.tsx +63 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/mine.tsx +44 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/profile.tsx +58 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/register.tsx +48 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/reset-password.tsx +41 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/settings.tsx +33 -0
- package/templates/lupine-template-fullstack-starter/app/src/pages/story.tsx +46 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/api.ts +127 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/parts.tsx +100 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/stories.ts +65 -0
- package/templates/lupine-template-fullstack-starter/app/src/shell/texts.ts +79 -0
- package/templates/lupine-template-fullstack-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-fullstack-starter/lupine.json +6 -7
- package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/home-search-component.tsx +18 -25
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-card.tsx +17 -8
- package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-list.tsx +1 -2
- package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.html +1 -0
- package/templates/lupine-template-fullstack-starter/web/src/{admin_dev → admin}/index.tsx +13 -28
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-cfg.tsx +23 -19
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-edit.tsx +3 -4
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-item-list.tsx +2 -3
- package/templates/lupine-template-fullstack-starter/web/src/{pages → admin/pages}/admin-user.tsx +15 -20
- package/templates/lupine-template-fullstack-starter/web/src/index.html +8 -2
- package/templates/lupine-template-fullstack-starter/web/src/index.tsx +11 -150
- package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +7 -25
- package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +0 -3
- package/templates/lupine-template-fullstack-starter/web/src/styles/theme.ts +1 -2
- package/templates/lupine-template-responsive-starter/README.md +46 -2
- package/templates/lupine-template-responsive-starter/app/package.json +19 -0
- package/templates/lupine-template-responsive-starter/app/src/app.tsx +80 -0
- package/templates/lupine-template-responsive-starter/app/src/index.native.tsx +4 -0
- package/templates/lupine-template-responsive-starter/app/src/index.test.tsx +283 -0
- package/templates/lupine-template-responsive-starter/app/src/index.web.tsx +31 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/about.tsx +23 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/finance.tsx +48 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/mine.tsx +60 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/not-found.tsx +9 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-detail.tsx +43 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-edit.tsx +45 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/note-search.tsx +62 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/notes.tsx +71 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/settings.tsx +55 -0
- package/templates/lupine-template-responsive-starter/app/src/pages/tools.tsx +112 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/icons.ts +7 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/layout.ts +18 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/locales/zh-CN.ts +89 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/menu.tsx +81 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/nav.ts +12 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/store.ts +72 -0
- package/templates/lupine-template-responsive-starter/app/src/shell/texts.ts +11 -0
- package/templates/lupine-template-responsive-starter/app/tsconfig.json +17 -0
- package/templates/lupine-template-responsive-starter/lupine.json +7 -6
- package/templates/lupine-template-responsive-starter/web/src/index.html +9 -2
- package/templates/lupine-template-responsive-starter/web/src/index.tsx +9 -25
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +12 -6
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +12 -22
- package/templates/common/apps/server/src/app-loader.ts +0 -4
- package/templates/lupine-template-cv-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-cv-starter/api/src/index.ts +0 -15
- package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +0 -5
- package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +0 -15
- package/templates/lupine-template-doc-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-doc-starter/api/src/index.ts +0 -15
- package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +0 -6
- package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +0 -5
- package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-about.tsx +0 -16
- package/templates/lupine-template-fullstack-starter/web/src/admin_dev/admin-patch.ts +0 -22
- package/templates/lupine-template-fullstack-starter/web/src/components/footer-menu.tsx +0 -52
- package/templates/lupine-template-fullstack-starter/web/src/components/footer.tsx +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/components/header.tsx +0 -75
- package/templates/lupine-template-fullstack-starter/web/src/components/login-code-zh.tsx +0 -162
- package/templates/lupine-template-fullstack-starter/web/src/components/login-code.tsx +0 -165
- package/templates/lupine-template-fullstack-starter/web/src/components/login-zh.tsx +0 -118
- package/templates/lupine-template-fullstack-starter/web/src/components/login.tsx +0 -122
- package/templates/lupine-template-fullstack-starter/web/src/components/not-found-page.tsx +0 -12
- package/templates/lupine-template-fullstack-starter/web/src/components/register-zh.tsx +0 -161
- package/templates/lupine-template-fullstack-starter/web/src/components/register.tsx +0 -163
- package/templates/lupine-template-fullstack-starter/web/src/components/reset-password-zh.tsx +0 -166
- package/templates/lupine-template-fullstack-starter/web/src/components/reset-password.tsx +0 -177
- package/templates/lupine-template-fullstack-starter/web/src/components/user-info.tsx +0 -84
- package/templates/lupine-template-fullstack-starter/web/src/frames/admin-page-frame.tsx +0 -48
- package/templates/lupine-template-fullstack-starter/web/src/frames/frame1-page-frame.tsx +0 -61
- package/templates/lupine-template-fullstack-starter/web/src/frames/frame2-page-frame.tsx +0 -61
- package/templates/lupine-template-fullstack-starter/web/src/frames/top-frame.tsx +0 -23
- package/templates/lupine-template-fullstack-starter/web/src/frames/user-page-frame.tsx +0 -90
- package/templates/lupine-template-fullstack-starter/web/src/models/index.ts +0 -15
- package/templates/lupine-template-fullstack-starter/web/src/pages/contact.tsx +0 -105
- package/templates/lupine-template-fullstack-starter/web/src/pages/page1-page.tsx +0 -38
- package/templates/lupine-template-fullstack-starter/web/src/pages/page2-page.tsx +0 -38
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-favorite-page.tsx +0 -58
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-home-page.tsx +0 -27
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-mine-page.tsx +0 -54
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page-zh.tsx +0 -112
- package/templates/lupine-template-fullstack-starter/web/src/pages/user-profile-page.tsx +0 -112
- package/templates/lupine-template-fullstack-starter/web/src/pages/user1-page.tsx +0 -57
- package/templates/lupine-template-fullstack-starter/web/src/services/shared-data.ts +0 -19
- package/templates/lupine-template-fullstack-starter/web/src/styles/app.css +0 -0
- package/templates/lupine-template-responsive-starter/api/package.json +0 -6
- package/templates/lupine-template-responsive-starter/api/resources/config_default.json +0 -6
- package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +0 -18
- package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +0 -76
- package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +0 -93
- package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +0 -87
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -81
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -211
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -107
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -110
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -144
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -188
- package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +0 -95
- package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +0 -169
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -53
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -32
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -35
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -444
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -318
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -35
- package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +0 -87
- package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +0 -45
- package/templates/lupine-template-responsive-starter/web/src/styles/app.css +0 -0
- package/templates/lupine-template-responsive-starter/web/src/styles/base-css.ts +0 -65
- package/templates/lupine-template-responsive-starter/web/src/styles/global.css +0 -2130
- package/templates/lupine-template-responsive-starter/web/src/styles/theme.ts +0 -17
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/01-experience/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/02-projects/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/03-skills/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/04-education/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/en/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/01-experience/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/02-projects/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/03-skills/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/04-education/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/markdown/zh/index.md +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/01-experience/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/02-projects/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/03-skills/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/04-education/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/en/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/01-experience/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/02-projects/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/03-skills/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/04-education/index.html +0 -0
- /package/templates/lupine-template-cv-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/essentials/list.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/install.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/guide/started.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/en/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/essentials/list.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/install.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/guide/started.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/markdown/zh/index.md +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/essentials/list.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/install.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/guide/started.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/en/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/markdown-config.ts +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/index.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/essentials/list.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/install.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/guide/started.html +0 -0
- /package/templates/lupine-template-doc-starter/{web → app}/src/markdown-built/zh/index.html +0 -0
- /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-note}/api/src/index.ts +0 -0
- /package/templates/lupine-template-fullstack-starter/{web/assets/images → app/assets}/sample.png +0 -0
- /package/templates/lupine-template-fullstack-starter/web/src/{components → admin/components}/story-props.ts +0 -0
|
@@ -1,100 +1,29 @@
|
|
|
1
|
-
# Mobile
|
|
1
|
+
# Mobile interactions on web pages
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
|
|
5
|
+
## 1. Questions and messages (instead of `alert`, `confirm`, `prompt`)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { HeaderWithBackFrame, SliderFrame, SliderFrameHookProps } from 'lupine.web.components';
|
|
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:
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const sliderHook: SliderFrameHookProps = {};
|
|
9
|
+
```typescript
|
|
10
|
+
import { ActionSheet, MessageBox, Toast } from 'lupine.native.components';
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
12
|
+
const index = await ActionSheet.select({ title: 'Delete this record?', options: ['Delete', 'Edit'], destructive: 0 }); // -1: cancelled
|
|
13
|
+
if (index === 0) { /* delete */ }
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
};
|
|
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
|
|
46
19
|
```
|
|
47
20
|
|
|
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';
|
|
21
|
+
`ActionSheet.select` with `options: [{ label, value }]` gives the value (`null` when cancelled).
|
|
57
22
|
|
|
58
|
-
|
|
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
|
-
```
|
|
23
|
+
## 2. Pages that slide in, the back button
|
|
65
24
|
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
import { ActionSheetMessagePromise } from 'lupine.web.components';
|
|
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).
|
|
69
26
|
|
|
70
|
-
|
|
71
|
-
title: 'Notification',
|
|
72
|
-
message: 'Saved successfully!',
|
|
73
|
-
confirmButtonText: 'OK',
|
|
74
|
-
});
|
|
75
|
-
```
|
|
27
|
+
## 3. In the admin of lupine.api
|
|
76
28
|
|
|
77
|
-
|
|
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.
|
|
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`.
|
|
@@ -5,22 +5,35 @@ One TSX code base for iOS, Android, macOS, Windows and the web. The UI is made o
|
|
|
5
5
|
## No DOM
|
|
6
6
|
|
|
7
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
|
|
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
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
10
|
|
|
11
11
|
## An app
|
|
12
12
|
|
|
13
|
-
Start
|
|
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
14
|
|
|
15
15
|
```text
|
|
16
16
|
apps/my-app/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
src/
|
|
21
|
-
src/index.
|
|
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)
|
|
22
33
|
```
|
|
23
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
|
+
|
|
24
37
|
```tsx
|
|
25
38
|
// src/app.tsx
|
|
26
39
|
import { createSignal, insets, Text, TextInput, View } from 'lupine.native.core';
|
|
@@ -64,23 +77,26 @@ A style is an object; each value may be a function. Nothing is inherited and the
|
|
|
64
77
|
- `margin`/`padding` with `Horizontal`, `Vertical`, `Top` etc.; `gap`; `position: 'absolute'`; `display: 'none'`.
|
|
65
78
|
- Look: `backgroundColor`, `backgroundImage: 'linear-gradient(...)'`, `borderRadius`, `borderWidth`, `borderColor`, `boxShadow`, `opacity`, `translateX`, `scale`, `rotate`.
|
|
66
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.
|
|
67
|
-
- Safe areas: `insets()`; size of the window: `windowInfo()
|
|
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()`.
|
|
68
81
|
|
|
69
82
|
## Themes, languages (lupine.native.components)
|
|
70
83
|
|
|
71
84
|
- 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: `
|
|
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.
|
|
74
89
|
|
|
75
90
|
## Pages and navigation
|
|
76
91
|
|
|
77
92
|
```tsx
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
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';
|
|
80
96
|
|
|
81
97
|
const items: NavItem[] = [
|
|
82
|
-
{ key: '/', label: 'Home', icon:
|
|
83
|
-
{ key: '/me', label: 'Me', icon:
|
|
98
|
+
{ key: '/', label: 'Home', icon: icons.home, testID: 'tab-home' },
|
|
99
|
+
{ key: '/me', label: 'Me', icon: icons.user, testID: 'tab-me' },
|
|
84
100
|
];
|
|
85
101
|
const Home = () => (
|
|
86
102
|
<Screen title='Home' grouped>
|
|
@@ -93,18 +109,14 @@ const Me = () => <Screen title='Me' padded />;
|
|
|
93
109
|
const Item = (p: { id: string }) => <Screen title={`#${p.id}`} onBack={router.back} padded />;
|
|
94
110
|
|
|
95
111
|
export const App = () => (
|
|
96
|
-
<View style={{ flex: 1,
|
|
97
|
-
<Show when={isWide}>
|
|
98
|
-
<Sidebar items={items} active={router.tab} onPress={router.navigate} />
|
|
99
|
-
</Show>
|
|
112
|
+
<View style={{ flex: 1, backgroundColor: col('bg') }}>
|
|
100
113
|
<Pages
|
|
114
|
+
side={240}
|
|
101
115
|
tabs={[{ path: '/', page: Home }, { path: '/me', page: Me }]}
|
|
102
116
|
routes={[{ path: '/item/:id', page: (p) => <Item id={p.id} /> }]}
|
|
103
117
|
notFound={() => <Screen title='404' onBack={router.back} />}
|
|
104
118
|
>
|
|
105
|
-
<
|
|
106
|
-
<BottomTabBar items={items} active={router.tab} onPress={router.navigate} />
|
|
107
|
-
</Show>
|
|
119
|
+
<NavBar items={items} active={router.tab} onPress={router.navigate} width={240} />
|
|
108
120
|
</Pages>
|
|
109
121
|
<OverlayHost />
|
|
110
122
|
</View>
|
|
@@ -113,6 +125,7 @@ export const App = () => (
|
|
|
113
125
|
|
|
114
126
|
- `router.push(path, params?)`, `router.replace`, `router.back()`, `router.navigate(tab)`, `router.path()`, `router.tab()`, `useFocused()`.
|
|
115
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.
|
|
116
129
|
- The Android back button: `onBack(() => ...)`, newest first; return `false` to pass it on.
|
|
117
130
|
|
|
118
131
|
## Messages and panels
|
|
@@ -143,11 +156,16 @@ npx lupine-native web --app=apps/my-app --watch
|
|
|
143
156
|
npx lupine-native macos --app=apps/my-app --run # ios, android, windows the same
|
|
144
157
|
npx lupine-native ios --app=apps/my-app --run --device --serial=<udid> --team=<team>
|
|
145
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
|
|
146
162
|
npx lupine-native windows --app=apps/my-app --run # on a Mac or Linux --run opens it in Wine
|
|
147
163
|
npx lupine-native docker android --app=apps/my-app # builds in Docker, nothing installed
|
|
148
164
|
```
|
|
149
165
|
|
|
150
|
-
Options: `--release`, `--variant=<name>`, `--define=NAME=value`, `--engine=quickjs` (smaller, slower).
|
|
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).
|
|
151
169
|
|
|
152
170
|
## Tests
|
|
153
171
|
|
|
@@ -162,6 +180,11 @@ The app id gets `.test`, so the data of the released app isn't touched. After a
|
|
|
162
180
|
|
|
163
181
|
## The web target
|
|
164
182
|
|
|
165
|
-
`lupine-native web` makes a static
|
|
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.
|
|
166
189
|
|
|
167
|
-
Native components in a page of lupine.web:
|
|
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.
|
package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md
CHANGED
|
@@ -23,6 +23,7 @@ bindRouter(pageRouter); // in index.tsx
|
|
|
23
23
|
- A page gets `PageProps`: `url`, `query`, `urlParameters`, `renderPageFunctions`. It may be async; `null` passes to the next route.
|
|
24
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
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.
|
|
26
27
|
- `setErrorHandler`, `setSubDir('/my-app')` for a site in a subfolder.
|
|
27
28
|
|
|
28
29
|
## Going to a page
|
|
@@ -79,7 +79,7 @@ const Search = () => {
|
|
|
79
79
|
|
|
80
80
|
```tsx
|
|
81
81
|
import { createSignal, For, onMount, Show } from 'lupine.web';
|
|
82
|
-
import { createField } from 'lupine.web
|
|
82
|
+
import { createField } from 'lupine.web';
|
|
83
83
|
|
|
84
84
|
const ItemsPage = () => {
|
|
85
85
|
const query = createField('');
|
|
@@ -105,4 +105,4 @@ const ItemsPage = () => {
|
|
|
105
105
|
|
|
106
106
|
## Forms (web)
|
|
107
107
|
|
|
108
|
-
`createField(initial)` of `lupine.web
|
|
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`.
|
|
@@ -104,7 +104,7 @@ bindAppGlobalStyle('app-shared-css', appSharedCss, false, true);
|
|
|
104
104
|
|
|
105
105
|
```tsx
|
|
106
106
|
import { bindTheme, getCurrentTheme, updateTheme } from 'lupine.web';
|
|
107
|
-
import { darkThemes, lightThemes } from 'lupine.web
|
|
107
|
+
import { darkThemes, lightThemes } from 'lupine.web';
|
|
108
108
|
|
|
109
109
|
bindTheme('light', {
|
|
110
110
|
light: { ...lightThemes, '--primary-accent-color': '#0a8f2a' },
|
|
@@ -116,4 +116,6 @@ const Toggle = () => (
|
|
|
116
116
|
);
|
|
117
117
|
```
|
|
118
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
|
+
|
|
119
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
|
-
#
|
|
2
|
-
#
|
|
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
|
package/templates/common/_env
CHANGED
|
@@ -13,13 +13,18 @@ HTTPS_PORT=11083
|
|
|
13
13
|
#'127.0.0.1' or for all ips: "::"
|
|
14
14
|
BIND_IP=0.0.0.0
|
|
15
15
|
|
|
16
|
-
NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
16
|
+
# NODE_TLS_REJECT_UNAUTHORIZED=0 (certificates not checked): in .env.development only, never here (.env.production imports
|
|
17
|
+
# this file, and lupine-build --deploy refuses to send the key without a checked certificate)
|
|
17
18
|
|
|
18
19
|
LOG_FOLDER=./dist/log
|
|
19
20
|
LOG_FILENAME=log-%index%.log
|
|
20
21
|
# size can be ?kb or ?mb
|
|
21
22
|
LOG_MAX_SIZE=1mb
|
|
22
23
|
LOG_MAX_COUNT=5
|
|
24
|
+
# WebSockets of an app (api.ws): sockets of one app, from one address; temporary values (apiStorage.setTemp) of one app
|
|
25
|
+
# WS_MAX_CONNECTIONS=200
|
|
26
|
+
# WS_MAX_PER_IP=20
|
|
27
|
+
# TEMP_MAX_ENTRIES=10000
|
|
23
28
|
LOG_OUT_TO_FILE=true
|
|
24
29
|
LOG_OUT_TO_CONSOLE=true
|
|
25
30
|
|
|
@@ -58,10 +63,10 @@ DOMAINS:{APP-NAME}=
|
|
|
58
63
|
|
|
59
64
|
# Https Keys and Crts are for domains (not apps), use following command to generate
|
|
60
65
|
# mkcert example.com "*.example.com" localhost 127.0.0.1 ::1
|
|
61
|
-
SSL_KEY_PATH=
|
|
62
|
-
SSL_CRT_PATH=
|
|
63
|
-
HTTPS_KEY_PATH:{APP-NAME}=
|
|
64
|
-
HTTPS_CRT_PATH:{APP-NAME}=
|
|
66
|
+
SSL_KEY_PATH=dist/example.com+4-key.pem
|
|
67
|
+
SSL_CRT_PATH=dist/example.com+4.pem
|
|
68
|
+
HTTPS_KEY_PATH:{APP-NAME}=dist/example.com+4-key.pem
|
|
69
|
+
HTTPS_CRT_PATH:{APP-NAME}=dist/example.com+4.pem
|
|
65
70
|
|
|
66
71
|
DB_TYPE=sqlite
|
|
67
72
|
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`.
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// never copied: files of the Finder and installed packages
|
|
5
|
+
const skipped = new Set(['.DS_Store', 'node_modules']);
|
|
6
|
+
|
|
7
|
+
function copyRecursiveSync(src, dest, skip = []) {
|
|
8
|
+
if (skipped.has(path.basename(src)) || skip.includes(path.basename(src))) return;
|
|
5
9
|
const stats = fs.statSync(src);
|
|
6
10
|
const isDirectory = stats.isDirectory();
|
|
7
11
|
if (isDirectory) {
|
|
8
12
|
fs.mkdirSync(dest, { recursive: true });
|
|
9
13
|
fs.readdirSync(src).forEach((childItemName) => {
|
|
10
|
-
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
|
|
14
|
+
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName), skip);
|
|
11
15
|
});
|
|
12
16
|
} else {
|
|
13
17
|
// Ensure parent directory exists for file copy (just in case)
|
|
@@ -17,7 +21,8 @@ function copyRecursiveSync(src, dest) {
|
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
// skip: names of files and folders that aren't copied either
|
|
25
|
+
function copyFolder(src, dest, skip = []) {
|
|
21
26
|
if (!src || !dest) {
|
|
22
27
|
console.error('Usage: node dev/cp-folder.js <source> <destination>');
|
|
23
28
|
if (require.main === module) process.exit(1);
|
|
@@ -29,7 +34,7 @@ function copyFolder(src, dest) {
|
|
|
29
34
|
|
|
30
35
|
if (fs.existsSync(srcPath)) {
|
|
31
36
|
console.log(`Copying from ${src} to ${dest}...`);
|
|
32
|
-
copyRecursiveSync(srcPath, destPath);
|
|
37
|
+
copyRecursiveSync(srcPath, destPath, skip);
|
|
33
38
|
console.log('Copy complete.');
|
|
34
39
|
} else {
|
|
35
40
|
console.log(`Source directory ${src} does not exist. Skipping copy.`);
|
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# CV Starter
|
|
2
2
|
|
|
3
|
-
A CV
|
|
3
|
+
A CV written in Markdown, one code base for the web, iOS, Android, macOS and Windows: several languages (`app/markdown/en`, `app/markdown/zh`), light and dark themes, its parts in a sidebar. The server renders each page, and the same app can be published to GitHub Pages. A template of `npx create-lupine` (`cv-starter`).
|
|
4
4
|
|
|
5
5
|
[Live demo](https://uuware.github.io/lupine-template-cv-starter/) · [Repository](https://github.com/uuware/lupine-template-cv-starter)
|
|
6
|
+
|
|
7
|
+
<!-- screenshots macos=1 windows=2 web=/ ios=1,3 android=2,4 -->
|
|
8
|
+
<table>
|
|
9
|
+
<tr><th>macOS</th><th>Windows</th><th>Web</th></tr>
|
|
10
|
+
<tr><td><a href="docs/macos-1-cv.png"><img src="docs/macos-1-cv.png" width="253" alt="macOS"></a></td><td><a href="docs/windows-2-experience.png"><img src="docs/windows-2-experience.png" width="253" alt="Windows"></a></td><td><a href="docs/web-1.png"><img src="docs/web-1.png" width="253" alt="Web"></a></td></tr>
|
|
11
|
+
</table>
|
|
12
|
+
<table>
|
|
13
|
+
<tr><th colspan="2">iOS</th><th colspan="2">Android</th></tr>
|
|
14
|
+
<tr><td><a href="docs/ios-1-cv.png"><img src="docs/ios-1-cv.png" width="183" alt="iOS"></a></td><td><a href="docs/ios-3-chinese.png"><img src="docs/ios-3-chinese.png" width="183" alt="iOS"></a></td><td><a href="docs/android-2-experience.png"><img src="docs/android-2-experience.png" width="183" alt="Android"></a></td><td><a href="docs/android-4-dark.png"><img src="docs/android-4-dark.png" width="183" alt="Android"></a></td></tr>
|
|
15
|
+
</table>
|
|
16
|
+
<!-- /screenshots -->
|
|
17
|
+
|
|
18
|
+
| Folder | |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| `app/markdown` | the CV. `index.md` lists the languages; `<lang>/index.md` is the first page and has the title and the `sidebar` of the other parts (`01-experience` ...) |
|
|
21
|
+
| `app/src` | the app: `PressApp` of `lupine.press/native` with the pages that the build makes of the markdown (`app/src/markdown-built`, don't edit) |
|
|
22
|
+
| `web/` | the page of the site, with the app in it; `web/src/lupine-template-cv-starter` is the page for GitHub Pages |
|
|
23
|
+
| `lupine.json` | what `npm run dev` builds; `"nativeApp": "app"` for the apps |
|
|
24
|
+
| no `api/` | the server is the default one of lupine-build: the web files and the pages rendered on the server. For routes of your own add `api/src/index.ts` and `"apiEntryPoint"` in `lupine.json` (as in the fullstack templates) |
|
|
25
|
+
|
|
26
|
+
In a project of create-lupine (and in the repository of this template) the same is in the scripts: `npm run run-mac`, `run-ios`, `run-android`, `run-exe`; `build-android` (the apk for the store), `bump` (the next version), `icons` (the icons of the site from the icon of the app), `release` (a folder for the server).
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run dev # the site, see the address it prints
|
|
30
|
+
npm run native -- macos --app=lupine-template-cv-starter --run
|
|
31
|
+
npm run native -- ios --app=lupine-template-cv-starter --run
|
|
32
|
+
npm run native -- android --app=lupine-template-cv-starter --run
|
|
33
|
+
npm run native -- windows --app=lupine-template-cv-starter --run
|
|
34
|
+
npm run native -- test macos --app=lupine-template-cv-starter # its tests (app/src/index.test.tsx)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
GitHub Pages: `npm run build`, then `npm run cp-docs` copies the page to `docs/`; in the settings of the repository, Pages from the `docs` folder. The folder of the page in `web/src` and the paths in its `index.tsx`, `index.html`, `404.html` and in `lupine.json` are the name of the repository: rename them to yours.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lupine-template-cv-starter-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "A CV written in Markdown, as an app: iOS, Android, macOS, Windows and the web.",
|
|
6
|
+
"lupineNative": {
|
|
7
|
+
"name": "LupineCV",
|
|
8
|
+
"id": "com.uuware.lupine.cv",
|
|
9
|
+
"entry": {
|
|
10
|
+
"native": "src/index.native.tsx",
|
|
11
|
+
"test": "src/index.test.tsx",
|
|
12
|
+
"web": "src/index.web.tsx"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"lupine.native.components": "^1.1.0",
|
|
17
|
+
"lupine.native.core": "^1.1.0",
|
|
18
|
+
"lupine.press": "^1.3.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PressApp } from 'lupine.press/native';
|
|
2
|
+
// made by lupine-build (and lupine-native) from the files of app/markdown: "markdownEntryPoints" of lupine.json
|
|
3
|
+
import { markdownConfig } from './markdown-built/markdown-config';
|
|
4
|
+
|
|
5
|
+
/** The CV: its pages in the sidebar, languages, light and dark themes. */
|
|
6
|
+
export const App = () => <PressApp data={markdownConfig} />;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/// <reference path="../../../../node_modules/lupine.native.core/src/native-globals.d.ts" />
|
|
2
|
+
// Walks through the app inside a native shell built with --test: presses the real views.
|
|
3
|
+
// npm run native -- test macos --app=lupine-template-cv-starter
|
|
4
|
+
import { Platform, windowInfo } from 'lupine.native.core';
|
|
5
|
+
import { isWide, router, setLang, setThemePref, theme } from 'lupine.native.components';
|
|
6
|
+
import { runApp } from 'lupine.native.core/native';
|
|
7
|
+
import { App } from './app';
|
|
8
|
+
|
|
9
|
+
const native = globalThis.__lupine;
|
|
10
|
+
const act = (id: string, action: string, arg?: unknown) => native.test!(id, action, arg);
|
|
11
|
+
const text = (id: string) => act(id, 'text');
|
|
12
|
+
const sleep = (ms: number) => new Promise<void>((done) => setTimeout(done, ms));
|
|
13
|
+
const exists = (id: string) => act(id, 'x') !== '<missing>';
|
|
14
|
+
|
|
15
|
+
let passed = 0;
|
|
16
|
+
let failed = 0;
|
|
17
|
+
const check = (name: string, actual: unknown, expected: unknown) => {
|
|
18
|
+
const ok = actual === expected;
|
|
19
|
+
if (ok) passed++;
|
|
20
|
+
else failed++;
|
|
21
|
+
console.log(`TEST ${ok ? 'ok ' : 'FAIL'} ${name}${ok ? '' : ` -> ${JSON.stringify(actual)}, expected ${JSON.stringify(expected)}`}`);
|
|
22
|
+
};
|
|
23
|
+
const shot = async (name: string) => {
|
|
24
|
+
await sleep(250);
|
|
25
|
+
if (Platform.OS === 'macos' || Platform.OS === 'windows') act('', 'screenshot', `shot-${name}.png`);
|
|
26
|
+
console.log(`SHOT ${name}`);
|
|
27
|
+
await sleep(Platform.OS === 'macos' || Platform.OS === 'windows' ? 50 : 2500);
|
|
28
|
+
};
|
|
29
|
+
const press = async (id: string, wait = 600) => {
|
|
30
|
+
check(`press ${id}`, exists(id) && act(id, 'click'), true);
|
|
31
|
+
await sleep(wait);
|
|
32
|
+
};
|
|
33
|
+
/** a page of the sidebar: beside the text on wide windows, in the drawer of the menu button on phones */
|
|
34
|
+
const side = async (link: string) => {
|
|
35
|
+
if (!isWide()) await press('press-menu', 500);
|
|
36
|
+
await press(`press-side-${link}`, 800);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
setThemePref('light');
|
|
40
|
+
setLang('en');
|
|
41
|
+
runApp(App);
|
|
42
|
+
console.log(`TEST window ${JSON.stringify(windowInfo())}`);
|
|
43
|
+
|
|
44
|
+
const main = async () => {
|
|
45
|
+
for (let i = 0; i < 100 && !(act('press-content', 'width') > 0); i++) await sleep(100);
|
|
46
|
+
await sleep(500);
|
|
47
|
+
check('the title of the site', text('press-title'), 'CV');
|
|
48
|
+
check('the CV', exists('press-text'), true);
|
|
49
|
+
await shot('1-cv');
|
|
50
|
+
|
|
51
|
+
await side('/en/01-experience/index');
|
|
52
|
+
check('Experience', router.path(), '/en/01-experience/index');
|
|
53
|
+
await shot('2-experience');
|
|
54
|
+
|
|
55
|
+
await press('press-lang');
|
|
56
|
+
await press('option-zh', 900);
|
|
57
|
+
check('the same page in Chinese', router.path(), '/zh/01-experience/index');
|
|
58
|
+
check('the title in Chinese', text('press-title'), '工作简历');
|
|
59
|
+
await shot('3-chinese');
|
|
60
|
+
|
|
61
|
+
await press('press-theme');
|
|
62
|
+
check('dark', theme().mode, 'dark');
|
|
63
|
+
await shot('4-dark');
|
|
64
|
+
await press('press-theme');
|
|
65
|
+
|
|
66
|
+
await press('press-title', 800);
|
|
67
|
+
check('the CV again', router.path(), '/');
|
|
68
|
+
|
|
69
|
+
console.log(`TEST RESULT ${failed ? 'FAILED' : 'PASSED'} ${passed} ok, ${failed} failed`);
|
|
70
|
+
};
|
|
71
|
+
main().catch((e) => console.log(`TEST RESULT FAILED ${e && e.stack}`));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { onCleanup, serverRequest, View } from 'lupine.native.core';
|
|
2
|
+
import { router } from 'lupine.native.components';
|
|
3
|
+
import { runApp } from 'lupine.native.core/web';
|
|
4
|
+
import { App } from './app';
|
|
5
|
+
|
|
6
|
+
/** The app follows the address: the address bar shows its page (/en/01-experience/index), the buttons of the browser go back and forward. */
|
|
7
|
+
export const followAddress = (base?: string) => router.followUrl(base ? { paths: true, base } : undefined);
|
|
8
|
+
|
|
9
|
+
/** The app as a page of the site (web/src/index.tsx: pageRouter.use('*', AppPage, { keep: true })); in the browser it follows the address. */
|
|
10
|
+
export const AppPage = () => {
|
|
11
|
+
if (!serverRequest()) onCleanup(followAddress());
|
|
12
|
+
return (
|
|
13
|
+
<View style={{ height: '100%' }}>
|
|
14
|
+
<App />
|
|
15
|
+
</View>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// A page without the site: lupine-native web starts it in document.body; the page for GitHub Pages
|
|
20
|
+
// (web/src/lupine-template-cv-starter) in its folder.
|
|
21
|
+
export const start = (container: HTMLElement, base?: string) => {
|
|
22
|
+
const stop = followAddress(base);
|
|
23
|
+
const dispose = runApp(App, container);
|
|
24
|
+
return () => {
|
|
25
|
+
dispose();
|
|
26
|
+
stop();
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"lib": ["es2020"],
|
|
5
|
+
"types": [],
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"jsxImportSource": "lupine.native.core",
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
// the web entries are the only files that may use the DOM, so they aren't checked with these settings
|
|
15
|
+
"include": ["src"],
|
|
16
|
+
"exclude": ["src/**/*.web.tsx"]
|
|
17
|
+
}
|