create-lupine 1.0.31 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/index.js +238 -112
- package/package.json +1 -1
- package/templates/common/.agents/skills/lupine-framework/SKILL.md +63 -0
- package/templates/common/.agents/skills/lupine-framework/references/backend-api.md +113 -0
- package/templates/common/.agents/skills/lupine-framework/references/icon-handling.md +71 -0
- package/templates/common/.agents/skills/lupine-framework/references/mobile-interactions.md +29 -0
- package/templates/common/.agents/skills/lupine-framework/references/native-apps.md +190 -0
- package/templates/common/.agents/skills/lupine-framework/references/navigation-and-routing.md +55 -0
- package/templates/common/.agents/skills/lupine-framework/references/reactivity-and-state.md +108 -0
- package/templates/common/.agents/skills/lupine-framework/references/styling-and-themes.md +121 -0
- package/templates/common/.env.mobile +4 -3
- package/templates/common/_env +10 -4
- 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 +37 -0
- 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 -23
- 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 -29
- package/templates/lupine-template-doc-starter/README.md +37 -0
- 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 -23
- 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 -29
- package/templates/lupine-template-fullstack-note/README.md +83 -0
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/api/package.json +1 -1
- 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-hello-world → lupine-template-fullstack-note}/lupine.json +4 -2
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/package.json +1 -1
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/src/index.html +10 -3
- package/templates/lupine-template-fullstack-note/web/src/index.tsx +15 -0
- package/templates/lupine-template-fullstack-starter/README.md +70 -0
- package/templates/lupine-template-fullstack-starter/api/package.json +10 -0
- package/templates/lupine-template-fullstack-starter/api/resources/install.mysql.sql +107 -0
- package/templates/lupine-template-fullstack-starter/api/resources/install.sqlite.sql +75 -0
- package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-en.ts +39 -0
- package/templates/lupine-template-fullstack-starter/api/src/lang/api-lang-zh-cn.ts +37 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/admin-api.ts +139 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/api.ts +111 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/contact-api.ts +50 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/file-api-base.ts +30 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/root-api.ts +28 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/send-email.ts +47 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/setting-api.ts +60 -0
- package/templates/lupine-template-fullstack-starter/api/src/service/user-api.ts +1046 -0
- package/templates/lupine-template-fullstack-starter/app/assets/sample.png +0 -0
- 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 +31 -0
- package/templates/lupine-template-fullstack-starter/web/assets/android-chrome-192x192.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/apple-touch-icon.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/favicon-16x16.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/favicon-32x32.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/favicon.ico +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-carbon-icons.txt +71 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/License-material-design.txt +20 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/i-font.woff2 +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/sample.html +124 -0
- package/templates/lupine-template-fullstack-starter/web/assets/icons-font/style.css +103 -0
- package/templates/lupine-template-fullstack-starter/web/assets/lupine-flower.png +0 -0
- package/templates/lupine-template-fullstack-starter/web/assets/lupine.svg +71 -0
- package/templates/lupine-template-fullstack-starter/web/assets/site.webmanifest +14 -0
- package/templates/lupine-template-fullstack-starter/web/icons-font.config.js +129 -0
- package/templates/{lupine-template-responsive-starter/api → lupine-template-fullstack-starter/web}/package.json +1 -1
- package/templates/lupine-template-fullstack-starter/web/src/admin/admin-patch.tsx +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/home-search-component.tsx +125 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-card.tsx +105 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-list.tsx +105 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/components/story-props.ts +34 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/index.html +23 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/index.tsx +49 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-cfg.tsx +144 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-item-edit.tsx +20 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-item-list.tsx +23 -0
- package/templates/lupine-template-fullstack-starter/web/src/admin/pages/admin-user.tsx +145 -0
- package/templates/lupine-template-fullstack-starter/web/src/index.html +28 -0
- package/templates/lupine-template-fullstack-starter/web/src/index.tsx +16 -0
- package/templates/lupine-template-fullstack-starter/web/src/services/fetch-data.ts +37 -0
- package/templates/lupine-template-fullstack-starter/web/src/styles/base-css.ts +14 -0
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/global.css +10 -57
- package/templates/{lupine-template-hello-world → lupine-template-fullstack-starter}/web/src/styles/theme.ts +2 -1
- package/templates/lupine-template-responsive-starter/README.md +51 -0
- 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 -34
- 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 -31
- package/templates/common/AI_CONTEXT.md +0 -1002
- package/templates/common/apps/server/src/app-loader.ts +0 -4
- package/templates/lupine-template-cv-starter/api/package.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/styles/base-css.ts +0 -15
- package/templates/lupine-template-doc-starter/api/package.json +0 -6
- 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-hello-world/api/resources/config_default.json +0 -6
- package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +0 -4
- package/templates/lupine-template-hello-world/api/src/service/root-api.ts +0 -18
- package/templates/lupine-template-hello-world/web/src/index.tsx +0 -73
- package/templates/lupine-template-hello-world/web/src/styles/app.css +0 -0
- package/templates/lupine-template-hello-world/web/src/styles/base-css.ts +0 -1
- 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 -86
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +0 -80
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +0 -220
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +0 -119
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +0 -116
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +0 -154
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +0 -193
- 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 -182
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +0 -52
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +0 -43
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +0 -46
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +0 -452
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +0 -325
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +0 -46
- 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 -16
- /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-hello-world → lupine-template-fullstack-note}/api/src/index.ts +0 -0
- /package/templates/{lupine-template-hello-world → lupine-template-fullstack-note}/web/assets/favicon.ico +0 -0
- /package/templates/{lupine-template-cv-starter → lupine-template-fullstack-starter}/api/resources/config_default.json +0 -0
- /package/templates/{lupine-template-responsive-starter → lupine-template-fullstack-starter}/api/src/index.ts +0 -0
- /package/templates/{lupine-template-cv-starter/web/src → lupine-template-fullstack-starter/web/src/models}/client-env-keys.ts +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
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, types into the real fields.
|
|
3
|
+
// The app is started twice (TEST RESTART): the second start checks what the first one kept on the device.
|
|
4
|
+
// first: it installs the storage of the device, which the controls and the app read when they start
|
|
5
|
+
import { runApp } from 'lupine.native.core/native';
|
|
6
|
+
import { Platform, storage, windowInfo } from 'lupine.native.core';
|
|
7
|
+
import { isWide, setLang, setThemePref, theme, themePref } from 'lupine.native.components';
|
|
8
|
+
import { App } from './app';
|
|
9
|
+
import { layout, setLayout } from './shell/layout';
|
|
10
|
+
import { clearAllData, notes } from './shell/store';
|
|
11
|
+
|
|
12
|
+
// the shell built with --test drives its views: __lupine.test(testID, action, argument)
|
|
13
|
+
const act = (id: string, action: string, arg?: unknown) => __lupine.test!(id, action, arg);
|
|
14
|
+
const text = (id: string) => act(id, 'text');
|
|
15
|
+
const sleep = (ms: number) => new Promise<void>((done) => setTimeout(done, ms));
|
|
16
|
+
const exists = (id: string) => act(id, 'x') !== '<missing>';
|
|
17
|
+
const until = async (ok: () => boolean, ms = 3000) => {
|
|
18
|
+
for (let i = 0; i < ms / 50 && !ok(); i++) await sleep(50);
|
|
19
|
+
return ok();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
let passed = 0;
|
|
23
|
+
let failed = 0;
|
|
24
|
+
const check = (name: string, actual: unknown, expected: unknown) => {
|
|
25
|
+
const ok = actual === expected;
|
|
26
|
+
if (ok) passed++;
|
|
27
|
+
else failed++;
|
|
28
|
+
console.log(`TEST ${ok ? 'ok ' : 'FAIL'} ${name}${ok ? '' : ` -> ${JSON.stringify(actual)}, expected ${JSON.stringify(expected)}`}`);
|
|
29
|
+
};
|
|
30
|
+
/** The script that runs the test takes a picture; desktops do it themselves. */
|
|
31
|
+
const shot = async (name: string) => {
|
|
32
|
+
await sleep(250);
|
|
33
|
+
if (Platform.OS === 'macos' || Platform.OS === 'windows') act('', 'screenshot', `shot-${name}.png`);
|
|
34
|
+
console.log(`SHOT ${name}`);
|
|
35
|
+
await sleep(Platform.OS === 'macos' || Platform.OS === 'windows' ? 50 : 2500);
|
|
36
|
+
};
|
|
37
|
+
const press = async (id: string, wait = 600) => {
|
|
38
|
+
check(`press ${id}`, exists(id) && act(id, 'click'), true);
|
|
39
|
+
await sleep(wait);
|
|
40
|
+
};
|
|
41
|
+
const type = async (id: string, value: string, atEnd = false) => {
|
|
42
|
+
act(id, 'focus');
|
|
43
|
+
await sleep(250);
|
|
44
|
+
if (atEnd) act(id, 'caret', String(text(id)).length);
|
|
45
|
+
act(id, 'type', value);
|
|
46
|
+
await sleep(150);
|
|
47
|
+
};
|
|
48
|
+
// a finger on a view: rows that can be pushed aside (Swipeable) take touches, not presses
|
|
49
|
+
const touch = (id: string, kind: string, x: number) => act(id, 'touch', `${kind},${Date.now()},0|1,${x},30,${x},30`);
|
|
50
|
+
const tap = async (id: string, wait = 800) => {
|
|
51
|
+
check(`tap ${id}`, touch(id, 'start', 60), true);
|
|
52
|
+
await sleep(60);
|
|
53
|
+
touch(id, 'end', 60);
|
|
54
|
+
await sleep(wait);
|
|
55
|
+
};
|
|
56
|
+
const swipeLeft = async (id: string) => {
|
|
57
|
+
touch(id, 'start', 320);
|
|
58
|
+
for (let x = 300; x >= 120; x -= 20) {
|
|
59
|
+
touch(id, 'move', x);
|
|
60
|
+
await sleep(16);
|
|
61
|
+
}
|
|
62
|
+
touch(id, 'end', 120);
|
|
63
|
+
await sleep(500);
|
|
64
|
+
};
|
|
65
|
+
const shown = (id: string) => exists(id) && act(id, 'width') > 0;
|
|
66
|
+
/** to a tab: the tab bar, or the side menu (a drawer on phones) */
|
|
67
|
+
const go = async (name: string) => {
|
|
68
|
+
if (layout() === 'tabs') return press(`tab-${name}`);
|
|
69
|
+
if (isWide()) return press(`side-${name}`);
|
|
70
|
+
await press('menu-button');
|
|
71
|
+
await press(`menu-${name}`, 900);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const second = storage.get('test-phase') === 'restart';
|
|
75
|
+
// the checks of the first start count, too
|
|
76
|
+
const before = second ? Number(storage.get('test-passed')) || 0 : 0;
|
|
77
|
+
storage.set('test-phase', null);
|
|
78
|
+
storage.set('test-passed', null);
|
|
79
|
+
if (!second) {
|
|
80
|
+
// a known start
|
|
81
|
+
setThemePref('light');
|
|
82
|
+
setLang('en');
|
|
83
|
+
setLayout('tabs');
|
|
84
|
+
clearAllData();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const started = Date.now();
|
|
88
|
+
runApp(App);
|
|
89
|
+
console.log(`TEST ${second ? 'second start' : 'mounted'} in ${Date.now() - started} ms, window ${JSON.stringify(windowInfo())}`);
|
|
90
|
+
|
|
91
|
+
const first = async () => {
|
|
92
|
+
await until(() => shown('page-notes'), 10000);
|
|
93
|
+
await sleep(500);
|
|
94
|
+
const left = isWide() ? 240 : 0;
|
|
95
|
+
check('notes fill the window', Math.round(act('page-notes', 'width')), Math.round(windowInfo().width - left));
|
|
96
|
+
check('no notes', exists('notes-empty'), true);
|
|
97
|
+
check('tabs', exists('tab-notes'), true);
|
|
98
|
+
await shot('1-empty');
|
|
99
|
+
if (!isWide()) {
|
|
100
|
+
// the drawer of the tabs layout: settings and the theme, not the tabs
|
|
101
|
+
await press('menu-button');
|
|
102
|
+
check('drawer without the tabs', `${exists('menu-settings')} ${exists('menu-notes')}`, 'true false');
|
|
103
|
+
await press('side-menu-mask');
|
|
104
|
+
check('drawer closed', exists('side-menu'), false);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// add: a title is needed
|
|
108
|
+
await press('note-add', 800);
|
|
109
|
+
check('edit page', shown('page-edit'), true);
|
|
110
|
+
await press('edit-save', 300);
|
|
111
|
+
check('needs a title', text('toast-text'), 'Please enter a title');
|
|
112
|
+
await type('edit-title', 'Shopping list');
|
|
113
|
+
await press('edit-color-e53935', 200);
|
|
114
|
+
await type('edit-content', 'Milk, eggs, bread 你好 😀');
|
|
115
|
+
await shot('2-edit');
|
|
116
|
+
await press('edit-save', 900);
|
|
117
|
+
check('added', text('toast-text'), 'Note added');
|
|
118
|
+
check('edit page closed', exists('page-edit'), false);
|
|
119
|
+
await press('note-add', 800);
|
|
120
|
+
await type('edit-title', 'Meeting notes');
|
|
121
|
+
await press('edit-color-1e88e5', 200);
|
|
122
|
+
await type('edit-content', 'Project kickoff at 10:00, room 3');
|
|
123
|
+
await press('edit-save', 900);
|
|
124
|
+
const [meet, shop] = notes.list();
|
|
125
|
+
check('two notes, the newest first', `${notes.list().length} ${meet?.title} ${shop?.title}`, '2 Meeting notes Shopping list');
|
|
126
|
+
check('row', text(`note-title-${shop.id}`), 'Shopping list');
|
|
127
|
+
await shot('3-notes');
|
|
128
|
+
|
|
129
|
+
// read, edit, delete
|
|
130
|
+
await tap(`note-${shop.id}`);
|
|
131
|
+
check('detail', text('detail-title'), 'Shopping list');
|
|
132
|
+
check('detail text', text('detail-content'), 'Milk, eggs, bread 你好 😀');
|
|
133
|
+
await shot('4-detail');
|
|
134
|
+
await press('detail-edit', 800);
|
|
135
|
+
check('edit has the note', text('edit-title'), 'Shopping list');
|
|
136
|
+
await type('edit-title', ' for Sunday', true);
|
|
137
|
+
await press('edit-save', 900);
|
|
138
|
+
check('saved', text('toast-text'), 'Saved');
|
|
139
|
+
check('detail follows', text('detail-title'), 'Shopping list for Sunday');
|
|
140
|
+
check('row follows', text(`note-title-${shop.id}`), 'Shopping list for Sunday');
|
|
141
|
+
await press('detail-delete');
|
|
142
|
+
check('asks', text('dialog-text'), 'Delete this note?');
|
|
143
|
+
await shot('5-confirm');
|
|
144
|
+
await press('dialog-ok', 900);
|
|
145
|
+
check('deleted', `${exists('page-detail')} ${exists(`note-${shop.id}`)} ${notes.list().length}`, 'false false 1');
|
|
146
|
+
|
|
147
|
+
// push a row aside: edit and delete
|
|
148
|
+
const x = act(`note-${meet.id}`, 'screenX');
|
|
149
|
+
await swipeLeft(`note-${meet.id}`);
|
|
150
|
+
check('the row moved aside', x - act(`note-${meet.id}`, 'screenX') > 100, true);
|
|
151
|
+
await shot('6-swipe');
|
|
152
|
+
await press(`note-delete-${meet.id}`);
|
|
153
|
+
await press('dialog-cancel', 500);
|
|
154
|
+
check('kept', exists(`note-${meet.id}`), true);
|
|
155
|
+
check('the row closed', Math.round(act(`note-${meet.id}`, 'screenX')), Math.round(x));
|
|
156
|
+
|
|
157
|
+
// search, and what was searched for
|
|
158
|
+
await press('notes-search', 800);
|
|
159
|
+
check('search page', shown('page-search'), true);
|
|
160
|
+
await type('search-input', 'zzz');
|
|
161
|
+
check('nothing found', exists('search-empty'), true);
|
|
162
|
+
act('search-input-clear', 'click');
|
|
163
|
+
await sleep(200);
|
|
164
|
+
await type('search-input', 'kickoff');
|
|
165
|
+
await sleep(200);
|
|
166
|
+
check('found', exists(`search-result-${meet.id}`), true);
|
|
167
|
+
await shot('7-search');
|
|
168
|
+
await press(`search-result-${meet.id}`, 800);
|
|
169
|
+
check('found note', text('detail-title'), 'Meeting notes');
|
|
170
|
+
await press('header-back', 800);
|
|
171
|
+
await press('search-input-clear', 300);
|
|
172
|
+
check('history', exists('search-history-0'), true);
|
|
173
|
+
await press('search-history-0', 300);
|
|
174
|
+
check('from the history', text('search-input'), 'kickoff');
|
|
175
|
+
await press('search-input-clear', 300);
|
|
176
|
+
await press('search-clear-history', 300);
|
|
177
|
+
check('history cleared', exists('search-history-0'), false);
|
|
178
|
+
await press('header-back', 800);
|
|
179
|
+
check('search closed', exists('page-search'), false);
|
|
180
|
+
|
|
181
|
+
// the other tabs
|
|
182
|
+
await go('finance');
|
|
183
|
+
check('finance', shown('page-finance'), true);
|
|
184
|
+
check('balance', text('finance-balance-value'), '$4,184.50');
|
|
185
|
+
await shot('8-finance');
|
|
186
|
+
await go('tools');
|
|
187
|
+
await press('tool-stopwatch', 800);
|
|
188
|
+
check('stopwatch', text('stopwatch-time'), '00:00.0');
|
|
189
|
+
await press('stopwatch-start', 1300);
|
|
190
|
+
await press('stopwatch-start', 300);
|
|
191
|
+
check('it ran', /^00:0[1-3]\.\d$/.test(text('stopwatch-time')), true);
|
|
192
|
+
await shot('9-stopwatch');
|
|
193
|
+
await press('stopwatch-reset', 200);
|
|
194
|
+
check('reset', text('stopwatch-time'), '00:00.0');
|
|
195
|
+
await press('header-back', 800);
|
|
196
|
+
await press('tool-calendar', 800);
|
|
197
|
+
check('calendar', text('calendar-days'), 'Today');
|
|
198
|
+
await press('header-back', 800);
|
|
199
|
+
await go('about');
|
|
200
|
+
check('about', text('about-title'), 'My Note App');
|
|
201
|
+
await shot('10-about');
|
|
202
|
+
await go('mine');
|
|
203
|
+
check('notes counted', text('mine-notes-value'), '1');
|
|
204
|
+
await press('mine-premium', 800);
|
|
205
|
+
check('premium', shown('page-premium'), true);
|
|
206
|
+
await press('header-back', 800);
|
|
207
|
+
|
|
208
|
+
// settings: theme, language, layout
|
|
209
|
+
await press('mine-settings', 800);
|
|
210
|
+
check('theme', text('settings-theme-value'), 'Light');
|
|
211
|
+
await press('settings-theme');
|
|
212
|
+
await press('option-dark');
|
|
213
|
+
check('dark', `${text('settings-theme-value')} ${theme().mode}`, 'Dark dark');
|
|
214
|
+
await shot('11-dark');
|
|
215
|
+
await press('settings-language');
|
|
216
|
+
await press('option-zh-CN');
|
|
217
|
+
check('Chinese', `${text('settings-language-value')} ${text('settings-theme-value')}`, '简体中文 深色');
|
|
218
|
+
await shot('12-chinese');
|
|
219
|
+
await press('settings-language');
|
|
220
|
+
await press('option-en');
|
|
221
|
+
check('layout', text('settings-layout-value'), 'Tabs');
|
|
222
|
+
await press('settings-layout');
|
|
223
|
+
await press('option-sidemenu', 800);
|
|
224
|
+
check('side menu', `${text('settings-layout-value')} ${layout()}`, 'Side menu sidemenu');
|
|
225
|
+
check('no tab bar', exists('frame-nav'), false);
|
|
226
|
+
check('still on the settings', shown('page-settings'), true);
|
|
227
|
+
await shot('13-sidemenu-settings');
|
|
228
|
+
await press('header-back', 800);
|
|
229
|
+
if (isWide()) {
|
|
230
|
+
check('menu column', exists('frame-side'), true);
|
|
231
|
+
} else {
|
|
232
|
+
await press('menu-button');
|
|
233
|
+
await shot('14-drawer');
|
|
234
|
+
}
|
|
235
|
+
await go('notes');
|
|
236
|
+
check('notes again', shown('page-notes'), true);
|
|
237
|
+
check('drawer closed', exists('side-menu'), false);
|
|
238
|
+
if (!isWide()) {
|
|
239
|
+
await press('menu-button');
|
|
240
|
+
await press('menu-theme');
|
|
241
|
+
check('light from the menu', theme().mode, 'light');
|
|
242
|
+
await press('menu-theme');
|
|
243
|
+
check('dark from the menu', theme().mode, 'dark');
|
|
244
|
+
await press('side-menu-mask');
|
|
245
|
+
}
|
|
246
|
+
await shot('15-sidemenu-notes');
|
|
247
|
+
|
|
248
|
+
storage.set('test-phase', 'restart');
|
|
249
|
+
storage.set('test-passed', String(passed));
|
|
250
|
+
console.log(failed ? `TEST RESULT FAILED ${passed} ok, ${failed} failed` : 'TEST RESTART');
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const again = async () => {
|
|
254
|
+
await until(() => shown('page-notes'), 10000);
|
|
255
|
+
await sleep(500);
|
|
256
|
+
const [meet] = notes.list();
|
|
257
|
+
check('the layout was kept', `${layout()} ${exists('frame-nav')}`, 'sidemenu false');
|
|
258
|
+
check('the theme was kept', `${themePref()} ${theme().mode}`, 'dark dark');
|
|
259
|
+
check('the note was kept', `${notes.list().length} ${meet && text(`note-title-${meet.id}`)}`, '1 Meeting notes');
|
|
260
|
+
await shot('16-restart');
|
|
261
|
+
if (isWide()) await press('side-settings', 800);
|
|
262
|
+
else {
|
|
263
|
+
await press('menu-button');
|
|
264
|
+
await press('menu-settings', 900);
|
|
265
|
+
}
|
|
266
|
+
await press('settings-clear-all');
|
|
267
|
+
await shot('17-clear-all');
|
|
268
|
+
await press('dialog-ok', 500);
|
|
269
|
+
check('cleared', `${text('toast-text')} ${notes.list().length}`, 'All data cleared 0');
|
|
270
|
+
await press('header-back', 800);
|
|
271
|
+
check('no notes', exists('notes-empty'), true);
|
|
272
|
+
// tabs again, then the default
|
|
273
|
+
setLayout('tabs');
|
|
274
|
+
await sleep(500);
|
|
275
|
+
check('tabs again', `${exists('frame-nav')} ${exists('tab-notes')} ${exists('frame-side')}`, 'true true false');
|
|
276
|
+
setLayout(null);
|
|
277
|
+
setThemePref('light');
|
|
278
|
+
await sleep(300);
|
|
279
|
+
await shot('18-default');
|
|
280
|
+
console.log(`TEST RESULT ${failed ? 'FAILED' : 'PASSED'} ${before + passed} ok, ${failed} failed`);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
(second ? again() : first()).catch((e) => console.log(`TEST RESULT FAILED ${e && e.stack}`));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// first: it installs what the browser offers (storage), which the controls (the theme) and the app read when they start
|
|
2
|
+
import { runApp } from 'lupine.native.core/web';
|
|
3
|
+
import { onCleanup, serverRequest, View } from 'lupine.native.core';
|
|
4
|
+
import { router } from 'lupine.native.components';
|
|
5
|
+
import { App } from './app';
|
|
6
|
+
|
|
7
|
+
// the copy for GitHub Pages (web/src/lupine-template-responsive-starter) has it as a component
|
|
8
|
+
export { App };
|
|
9
|
+
|
|
10
|
+
/** The app follows the address: the address bar shows its page (/mine), and the buttons of the browser go back and forward in it. */
|
|
11
|
+
export const followAddress = () => router.followUrl();
|
|
12
|
+
|
|
13
|
+
/** The app as a page of the site (web/src/index.tsx: pageRouter.use('*', AppPage, { keep: true })); in the browser it follows the address. */
|
|
14
|
+
export const AppPage = () => {
|
|
15
|
+
if (!serverRequest()) onCleanup(followAddress());
|
|
16
|
+
return (
|
|
17
|
+
<View style={{ height: '100%' }}>
|
|
18
|
+
<App />
|
|
19
|
+
</View>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// The web version without the site: lupine-native web starts it in document.body.
|
|
24
|
+
export const start = (container: HTMLElement) => {
|
|
25
|
+
const stop = followAddress();
|
|
26
|
+
const dispose = runApp(App, container);
|
|
27
|
+
return () => {
|
|
28
|
+
dispose();
|
|
29
|
+
stop();
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { openURL, Platform, View } from 'lupine.native.core';
|
|
2
|
+
import { Button, col, Header, Icon, Screen, T, t, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { MenuButton } from '../shell/menu';
|
|
5
|
+
|
|
6
|
+
const edition = Platform.select({ ios: 'iOS', android: 'Android', macos: 'macOS', windows: 'Windows', web: 'Web' });
|
|
7
|
+
|
|
8
|
+
/** The raised tab in the middle. */
|
|
9
|
+
export const About = () => (
|
|
10
|
+
<Screen header={<Header title={tr('nav.about', 'About')} left={<MenuButton />} />} padded grouped testID='page-about'>
|
|
11
|
+
<View style={{ alignItems: 'center', gap: 12, paddingTop: 24, width: '100%', maxWidth: 520, alignSelf: 'center' }}>
|
|
12
|
+
<View style={{ width: 80, height: 80, borderRadius: 20, alignItems: 'center', justifyContent: 'center', backgroundColor: col('primary') }}>
|
|
13
|
+
<Icon name={icons.file} size={44} color={col('onPrimary')} />
|
|
14
|
+
</View>
|
|
15
|
+
<T kind='title' style={{ fontSize: 24 }} testID='about-title'>{tr('app.name', 'My Note App')}</T>
|
|
16
|
+
<T kind='secondary' testID='about-version'>{() => `${t('about.version', 'Version')} ${APP_VERSION} · ${edition}`}</T>
|
|
17
|
+
<T style={{ textAlign: 'center', lineHeight: 24, marginVertical: 16 }}>
|
|
18
|
+
{tr('about.text', 'A demo application of the full-stack framework Lupine.js: one code base for iOS, Android, macOS, Windows and the web. With this template and AI you can build and release apps for all of them quickly.')}
|
|
19
|
+
</T>
|
|
20
|
+
<Button title={tr('about.more', 'Learn more')} kind='outline' icon={icons.external} onPress={() => openURL('https://github.com/uuware/lupine.js')} testID='about-more' />
|
|
21
|
+
</View>
|
|
22
|
+
</Screen>
|
|
23
|
+
);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Text, View } from 'lupine.native.core';
|
|
2
|
+
import { Card, col, Header, Row, Screen, Section, Statistic, T, theme, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { MenuButton } from '../shell/menu';
|
|
5
|
+
|
|
6
|
+
// sample entries: replace them with your own data (kept on the device as the notes, or from a server)
|
|
7
|
+
const ENTRIES = [
|
|
8
|
+
{ id: 'salary', title: tr('finance.salary', 'Salary'), day: '12-01', amount: 5200, icon: icons.download, color: '#34c759' },
|
|
9
|
+
{ id: 'rent', title: tr('finance.rent', 'Rent'), day: '12-01', amount: -1600, icon: icons.home, color: '#ff9f0a' },
|
|
10
|
+
{ id: 'groceries', title: tr('finance.groceries', 'Groceries'), day: '12-02', amount: -230.5, icon: icons.tag, color: '#ff375f' },
|
|
11
|
+
{ id: 'freelance', title: tr('finance.freelance', 'Freelance work'), day: '12-03', amount: 900, icon: icons.edit, color: '#30b0c7' },
|
|
12
|
+
{ id: 'power', title: tr('finance.power', 'Electricity'), day: '12-03', amount: -85, icon: icons.hint, color: '#5e5ce6' },
|
|
13
|
+
];
|
|
14
|
+
const income = ENTRIES.filter((e) => e.amount > 0).reduce((sum, e) => sum + e.amount, 0);
|
|
15
|
+
const spent = -ENTRIES.filter((e) => e.amount < 0).reduce((sum, e) => sum + e.amount, 0);
|
|
16
|
+
const money = (v: number) => (v < 0 ? '-' : '+') + Math.abs(v).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
17
|
+
|
|
18
|
+
export const Finance = () => (
|
|
19
|
+
<Screen header={<Header title={tr('nav.finance', 'Finance')} left={<MenuButton />} />} grouped testID='page-finance'>
|
|
20
|
+
<View style={{ padding: 16, gap: 12 }}>
|
|
21
|
+
<Card>
|
|
22
|
+
<Statistic title={tr('finance.balance', 'Balance this month')} value={income - spent} decimals={2} prefix='$' icon={icons.check} color={col('primary')} testID='finance-balance' />
|
|
23
|
+
</Card>
|
|
24
|
+
<View style={{ flexDirection: 'row', gap: 12 }}>
|
|
25
|
+
<Card style={{ flex: 1 }}>
|
|
26
|
+
<Statistic title={tr('finance.income', 'Income')} value={income} decimals={2} prefix='$' color={col('success')} testID='finance-income' />
|
|
27
|
+
</Card>
|
|
28
|
+
<Card style={{ flex: 1 }}>
|
|
29
|
+
<Statistic title={tr('finance.spent', 'Expenses')} value={spent} decimals={2} prefix='$' color={col('error')} testID='finance-spent' />
|
|
30
|
+
</Card>
|
|
31
|
+
</View>
|
|
32
|
+
</View>
|
|
33
|
+
<Section title={tr('finance.entries', 'This month')}>
|
|
34
|
+
{ENTRIES.map((e) => (
|
|
35
|
+
<Row
|
|
36
|
+
label={e.title} icon={e.icon} iconColor={e.color} testID={`finance-${e.id}`}
|
|
37
|
+
right={
|
|
38
|
+
<View style={{ alignItems: 'flex-end' }}>
|
|
39
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: () => theme().c[e.amount < 0 ? 'text' : 'success'] }}>{money(e.amount)}</Text>
|
|
40
|
+
<Text style={{ fontSize: 12, color: col('textTertiary') }}>{e.day}</Text>
|
|
41
|
+
</View>
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</Section>
|
|
46
|
+
<T kind='caption' style={{ textAlign: 'center', padding: 16 }}>{tr('finance.sample', 'Sample data: replace it in app/src/pages/finance.tsx')}</T>
|
|
47
|
+
</Screen>
|
|
48
|
+
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { openURL, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { Avatar, Button, Card, col, Header, Icon, router, Row, Screen, Section, Statistic, T, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { MenuButton } from '../shell/menu';
|
|
5
|
+
import { notes, searchHistory } from '../shell/store';
|
|
6
|
+
|
|
7
|
+
const banner = 'linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%)';
|
|
8
|
+
|
|
9
|
+
/** The user, what is kept on the device, and the way to the settings. */
|
|
10
|
+
export const Mine = () => (
|
|
11
|
+
<Screen header={<Header title={tr('nav.mine', 'Mine')} left={<MenuButton />} />} grouped testID='page-mine'>
|
|
12
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 16, padding: 20 }}>
|
|
13
|
+
<Avatar name='Demo User' size={64} />
|
|
14
|
+
<View style={{ flex: 1, gap: 4 }}>
|
|
15
|
+
<T kind='title' testID='mine-name'>{tr('mine.user', 'Demo User')}</T>
|
|
16
|
+
<T kind='secondary'>{tr('mine.tagline', 'Local workspace, offline')}</T>
|
|
17
|
+
</View>
|
|
18
|
+
</View>
|
|
19
|
+
<View style={{ paddingHorizontal: 16, gap: 12 }}>
|
|
20
|
+
<T kind='subtitle'>{tr('mine.overview', 'Data overview')}</T>
|
|
21
|
+
<View style={{ flexDirection: 'row', gap: 12 }}>
|
|
22
|
+
<Card style={{ flex: 1 }}>
|
|
23
|
+
<Statistic title={tr('nav.notes', 'Notes')} value={() => notes.list().length} icon={icons.file} color={col('primary')} testID='mine-notes' />
|
|
24
|
+
</Card>
|
|
25
|
+
<Card style={{ flex: 1 }}>
|
|
26
|
+
<Statistic title={tr('mine.searches', 'Searches')} value={() => searchHistory.list().length} icon={icons.search} testID='mine-searches' />
|
|
27
|
+
</Card>
|
|
28
|
+
</View>
|
|
29
|
+
<View style={{ borderRadius: 16, padding: 20, gap: 12, backgroundImage: banner }}>
|
|
30
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
|
|
31
|
+
<Icon name={icons.star} size={20} fill color='#f2a600' />
|
|
32
|
+
<Text style={{ fontSize: 18, fontWeight: '700', color: '#333333' }}>{tr('mine.premium', 'Upgrade to Premium')}</Text>
|
|
33
|
+
</View>
|
|
34
|
+
<Text style={{ fontSize: 14, lineHeight: 20, color: '#444444' }}>{tr('mine.premiumText', 'Unlock cloud sync, custom themes and unlimited storage.')}</Text>
|
|
35
|
+
<Button title={tr('mine.plans', 'View plans')} size='small' style={{ alignSelf: 'flex-start', backgroundColor: '#ffffff', borderColor: '#ffffff' }} onPress={() => router.push('/premium')} testID='mine-premium' />
|
|
36
|
+
</View>
|
|
37
|
+
</View>
|
|
38
|
+
<Section>
|
|
39
|
+
<Row label={tr('nav.settings', 'Settings')} icon={icons.settings} iconColor='#8e8e93' onPress={() => router.push('/settings')} testID='mine-settings' />
|
|
40
|
+
<Row label={tr('nav.about', 'About')} icon={icons.info} iconColor='#1677ff' onPress={() => router.navigate('/about')} testID='mine-about' />
|
|
41
|
+
</Section>
|
|
42
|
+
</Screen>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
/** A page to sell more: here a link to ask for features. */
|
|
46
|
+
export const Premium = () => (
|
|
47
|
+
<Screen title={tr('premium.title', 'Premium')} onBack={() => void router.back()} padded testID='page-premium'>
|
|
48
|
+
<View style={{ alignItems: 'center', gap: 12, paddingTop: 24, width: '100%', maxWidth: 520, alignSelf: 'center' }}>
|
|
49
|
+
<View style={{ width: 80, height: 80, borderRadius: 20, alignItems: 'center', justifyContent: 'center', backgroundImage: banner }}>
|
|
50
|
+
<Icon name={icons.star} size={44} fill color='#f2a600' />
|
|
51
|
+
</View>
|
|
52
|
+
<T kind='title' style={{ fontSize: 24 }}>{tr('premium.heading', 'Premium features')}</T>
|
|
53
|
+
<T kind='secondary'>{tr('premium.sub', 'Unlock the full potential')}</T>
|
|
54
|
+
<T style={{ textAlign: 'center', lineHeight: 24, marginVertical: 16 }}>
|
|
55
|
+
{tr('premium.text', 'This is a demo application of Lupine.js. If you need special functions or premium features, open an issue on GitHub.')}
|
|
56
|
+
</T>
|
|
57
|
+
<Button title={tr('premium.request', 'Request custom features')} kind='outline' icon={icons.external} onPress={() => openURL('https://github.com/uuware/lupine.js/issues/new')} testID='premium-request' />
|
|
58
|
+
</View>
|
|
59
|
+
</Screen>
|
|
60
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EmptyView, router, Screen, t, tr } from 'lupine.native.components';
|
|
2
|
+
import * as icons from 'lupine.core/icons';
|
|
3
|
+
|
|
4
|
+
/** An address that the app doesn't know (on the web the server answers 404). */
|
|
5
|
+
export const NotFound = () => (
|
|
6
|
+
<Screen title='404' onBack={() => void router.back()} testID='page-not-found'>
|
|
7
|
+
<EmptyView icon={icons.search} title={tr('notFound.title', 'Page not found')} action={() => t('nav.notes', 'Notes')} onAction={() => router.navigate('/')} />
|
|
8
|
+
</Screen>
|
|
9
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Show, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { col, EmptyView, formatDate, IconButton, router, Screen, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { notes } from '../shell/store';
|
|
5
|
+
import { confirmDelete } from './notes';
|
|
6
|
+
|
|
7
|
+
/** A note to read (/note/1), with buttons to edit and delete it. */
|
|
8
|
+
export const NoteDetail = (p: { id: string }) => {
|
|
9
|
+
const note = () => notes.get(Number(p.id));
|
|
10
|
+
const remove = async () => {
|
|
11
|
+
const n = note();
|
|
12
|
+
if (n && (await confirmDelete(n))) router.back();
|
|
13
|
+
};
|
|
14
|
+
return (
|
|
15
|
+
<Screen
|
|
16
|
+
title={tr('detail.title', 'Details')} onBack={() => void router.back()} padded testID='page-detail'
|
|
17
|
+
right={
|
|
18
|
+
<Show when={note}>
|
|
19
|
+
<View style={{ flexDirection: 'row' }}>
|
|
20
|
+
<IconButton name={icons.edit} color={col('headerText')} onPress={() => router.push('/edit', { id: p.id })} testID='detail-edit' />
|
|
21
|
+
<IconButton name={icons.trash} color={col('error')} onPress={remove} testID='detail-delete' />
|
|
22
|
+
</View>
|
|
23
|
+
</Show>
|
|
24
|
+
}
|
|
25
|
+
>
|
|
26
|
+
<Show when={note} fallback={<EmptyView icon={icons.search} title={tr('detail.missing', 'This note is not there')} />}>
|
|
27
|
+
{() => {
|
|
28
|
+
const n = note()!;
|
|
29
|
+
return (
|
|
30
|
+
<View style={{ gap: 12, width: '100%', maxWidth: 720, alignSelf: 'center' }}>
|
|
31
|
+
<Text testID='detail-title' selectable style={{ fontSize: 24, fontWeight: '700', color: col('text') }}>{n.title}</Text>
|
|
32
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, paddingBottom: 14, borderBottomWidth: 1, borderBottomColor: col('separator') }}>
|
|
33
|
+
{n.color && <View style={{ width: 14, height: 14, borderRadius: 4, backgroundColor: n.color }} />}
|
|
34
|
+
<Text style={{ fontSize: 13, color: col('textSecondary') }}>{() => formatDate(new Date(n.updatedAt), 'datetime')}</Text>
|
|
35
|
+
</View>
|
|
36
|
+
<Text testID='detail-content' selectable style={{ fontSize: 16, lineHeight: 26, color: col('text') }}>{n.content}</Text>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
}}
|
|
40
|
+
</Show>
|
|
41
|
+
</Screen>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createSignal, View } from 'lupine.native.core';
|
|
2
|
+
import { Button, ColorGrid, EmptyView, Field, router, Screen, t, TextField, Toast, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { notes } from '../shell/store';
|
|
5
|
+
|
|
6
|
+
/** the colors a note can be marked with; pressed again: none */
|
|
7
|
+
const COLORS = ['#e53935', '#fb8c00', '#fdd835', '#43a047', '#1e88e5', '#8e24aa', '#546e7a'];
|
|
8
|
+
|
|
9
|
+
/** A new note (/edit), or one to change (/edit?id=1). */
|
|
10
|
+
export const NoteEdit = (p: { id?: string }) => {
|
|
11
|
+
const old = p.id ? notes.get(Number(p.id)) : undefined;
|
|
12
|
+
const [title, setTitle] = createSignal(old?.title ?? '');
|
|
13
|
+
const [content, setContent] = createSignal(old?.content ?? '');
|
|
14
|
+
const [color, setColor] = createSignal(old?.color ?? '');
|
|
15
|
+
const back = () => void router.back();
|
|
16
|
+
const save = () => {
|
|
17
|
+
if (!title().trim()) return Toast.error(t('edit.needTitle', 'Please enter a title'));
|
|
18
|
+
notes.save({ id: old?.id, title: title().trim(), content: content().trim(), color: color() });
|
|
19
|
+
Toast.success(old ? t('edit.saved', 'Saved') : t('edit.added', 'Note added'));
|
|
20
|
+
back();
|
|
21
|
+
};
|
|
22
|
+
if (p.id && !old)
|
|
23
|
+
return (
|
|
24
|
+
<Screen title={tr('edit.edit', 'Edit note')} onBack={back} testID='page-edit'>
|
|
25
|
+
<EmptyView icon={icons.search} title={tr('detail.missing', 'This note is not there')} />
|
|
26
|
+
</Screen>
|
|
27
|
+
);
|
|
28
|
+
return (
|
|
29
|
+
<Screen
|
|
30
|
+
title={old ? tr('edit.edit', 'Edit note') : tr('edit.new', 'New note')} onBack={back} padded testID='page-edit'
|
|
31
|
+
right={<Button title={tr('edit.save', 'Save')} kind='ghost' size='small' onPress={save} testID='edit-save' />}
|
|
32
|
+
>
|
|
33
|
+
<View style={{ gap: 16, width: '100%', maxWidth: 720, alignSelf: 'center' }}>
|
|
34
|
+
<TextField label={tr('edit.title', 'Title')} value={title} onChangeText={setTitle} placeholder={tr('edit.titlePlaceholder', 'Title…')} maxLength={80} autoFocus={!old} testID='edit-title' />
|
|
35
|
+
<Field label={tr('edit.color', 'Color tag')}>
|
|
36
|
+
<ColorGrid value={color} onChange={(c) => setColor(c === color() ? '' : c)} colors={COLORS} size={32} testID='edit-color' />
|
|
37
|
+
</Field>
|
|
38
|
+
<TextField
|
|
39
|
+
label={tr('edit.content', 'Note')} value={content} onChangeText={setContent} placeholder={tr('edit.contentPlaceholder', 'Write your note…')} multiline
|
|
40
|
+
style={{ minHeight: 220, paddingVertical: 8 }} testID='edit-content'
|
|
41
|
+
/>
|
|
42
|
+
</View>
|
|
43
|
+
</Screen>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createMemo, createSignal, For, insets, Show, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { Button, Card, col, EmptyView, formatDate, IconButton, Line, router, Row, Screen, SearchInput, T, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { Note, notes, searchHistory } from '../shell/store';
|
|
5
|
+
|
|
6
|
+
/** Search the titles and texts of the notes; what was searched for is kept. */
|
|
7
|
+
export const NoteSearch = () => {
|
|
8
|
+
const [query, setQuery] = createSignal('');
|
|
9
|
+
const results = createMemo(() => notes.search(query()));
|
|
10
|
+
const open = (n: Note) => {
|
|
11
|
+
searchHistory.add(query());
|
|
12
|
+
router.push(`/note/${n.id}`);
|
|
13
|
+
};
|
|
14
|
+
const header = (
|
|
15
|
+
<View style={{ backgroundColor: col('header'), paddingTop: () => insets().top }}>
|
|
16
|
+
<View style={{ height: 56, flexDirection: 'row', alignItems: 'center', gap: 4, paddingLeft: 8, paddingRight: 12 }}>
|
|
17
|
+
<IconButton name={icons.back} size={24} color={col('headerText')} onPress={() => void router.back()} testID='header-back' />
|
|
18
|
+
<SearchInput
|
|
19
|
+
containerStyle={{ flex: 1 }} value={query} onChangeText={setQuery} onSubmit={(q) => searchHistory.add(q)} autoFocus
|
|
20
|
+
placeholder={tr('search.placeholder', 'Search titles and notes…')} testID='search-input'
|
|
21
|
+
/>
|
|
22
|
+
</View>
|
|
23
|
+
<Line />
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
return (
|
|
27
|
+
<Screen header={header} grouped testID='page-search'>
|
|
28
|
+
<Show
|
|
29
|
+
when={() => !query().trim()}
|
|
30
|
+
fallback={
|
|
31
|
+
<View style={{ padding: 16, gap: 10, width: '100%', maxWidth: 720, alignSelf: 'center' }}>
|
|
32
|
+
<For each={results} fallback={<View testID='search-empty'><EmptyView icon={icons.search} title={tr('search.none', 'No notes found')} /></View>}>
|
|
33
|
+
{(n) => (
|
|
34
|
+
<Card onPress={() => open(n)} style={{ gap: 4, overflow: 'hidden', borderLeftWidth: n.color ? 6 : 0, borderLeftColor: n.color }} testID={`search-result-${n.id}`}>
|
|
35
|
+
<Text numberOfLines={1} style={{ fontSize: 16, fontWeight: '600', color: col('text') }}>{n.title}</Text>
|
|
36
|
+
<Text numberOfLines={2} style={{ fontSize: 14, color: col('textSecondary') }}>{n.content}</Text>
|
|
37
|
+
<Text style={{ fontSize: 12, color: col('textTertiary') }}>{() => formatDate(new Date(n.updatedAt), 'datetime')}</Text>
|
|
38
|
+
</Card>
|
|
39
|
+
)}
|
|
40
|
+
</For>
|
|
41
|
+
</View>
|
|
42
|
+
}
|
|
43
|
+
>
|
|
44
|
+
<Show when={() => searchHistory.list().length > 0} fallback={<T kind='secondary' style={{ padding: 24, textAlign: 'center' }}>{tr('search.hint', 'Search the titles and the texts of your notes')}</T>}>
|
|
45
|
+
<T kind='secondary' style={{ marginTop: 18, marginLeft: 32, marginBottom: 6, fontSize: 13 }}>{tr('search.history', 'Recent searches')}</T>
|
|
46
|
+
<View style={{ marginHorizontal: 16, borderRadius: 12, overflow: 'hidden', backgroundColor: col('bgElevated') }}>
|
|
47
|
+
{/* a few: made again when they change */}
|
|
48
|
+
{() =>
|
|
49
|
+
searchHistory.list().map((item, i) => [
|
|
50
|
+
i > 0 && <Line style={{ marginLeft: 16 }} />,
|
|
51
|
+
<Row label={item} icon={icons.clock} iconColor='#8e8e93' onPress={() => setQuery(item)} testID={`search-history-${i}`} />,
|
|
52
|
+
])
|
|
53
|
+
}
|
|
54
|
+
</View>
|
|
55
|
+
<View style={{ alignItems: 'center', padding: 12 }}>
|
|
56
|
+
<Button title={tr('search.clearHistory', 'Clear history')} kind='ghost' size='small' onPress={searchHistory.clear} testID='search-clear-history' />
|
|
57
|
+
</View>
|
|
58
|
+
</Show>
|
|
59
|
+
</Show>
|
|
60
|
+
</Screen>
|
|
61
|
+
);
|
|
62
|
+
};
|