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
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Child, Show, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { col, EmptyView, Fab, formatDate, Header, IconButton, MessageBox, router, SortList, Swipeable, t, theme, Toast, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { MenuButton } from '../shell/menu';
|
|
5
|
+
import { Note, notes } from '../shell/store';
|
|
6
|
+
|
|
7
|
+
/** the height of a row: SortList needs one height */
|
|
8
|
+
const ROW = 96;
|
|
9
|
+
|
|
10
|
+
const newNote = () => router.push('/edit');
|
|
11
|
+
|
|
12
|
+
export const confirmDelete = async (note: Note) => {
|
|
13
|
+
if (!(await MessageBox.confirm({ title: note.title, message: t('notes.confirmDelete', 'Delete this note?'), okText: t('ln.delete', 'Delete'), destructive: true }))) return false;
|
|
14
|
+
notes.remove(note.id);
|
|
15
|
+
Toast.info(t('notes.deleted', 'Note deleted'));
|
|
16
|
+
return true;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** A note: tap it to read it, push it to the left to edit or delete it, drag it by its handle to move it. */
|
|
20
|
+
const NoteRow = (p: { note: Note; handle: Child }) => {
|
|
21
|
+
const { note } = p;
|
|
22
|
+
return (
|
|
23
|
+
<View style={{ height: ROW, paddingHorizontal: 12, paddingTop: 10 }}>
|
|
24
|
+
<View style={{ flex: 1, borderRadius: 12, overflow: 'hidden', borderWidth: 1, borderColor: () => theme().c[theme().mode === 'dark' ? 'bgElevated' : 'separator'] }}>
|
|
25
|
+
<Swipeable
|
|
26
|
+
testID={`note-${note.id}`} onPress={() => router.push(`/note/${note.id}`)}
|
|
27
|
+
right={[
|
|
28
|
+
{ label: tr('notes.edit', 'Edit'), icon: icons.edit, color: '#1677ff', onPress: () => router.push('/edit', { id: note.id }), testID: `note-edit-${note.id}` },
|
|
29
|
+
{ label: tr('ln.delete', 'Delete'), icon: icons.trash, color: '#e5383b', onPress: () => void confirmDelete(note), testID: `note-delete-${note.id}` },
|
|
30
|
+
]}
|
|
31
|
+
>
|
|
32
|
+
<View style={{ height: ROW - 12, flexDirection: 'row' }}>
|
|
33
|
+
<View style={{ width: 6, backgroundColor: note.color || 'transparent' }} />
|
|
34
|
+
<View style={{ flex: 1, paddingLeft: 12, justifyContent: 'center', gap: 3 }}>
|
|
35
|
+
<Text numberOfLines={1} testID={`note-title-${note.id}`} style={{ fontSize: 16, fontWeight: '600', color: col('text') }}>{note.title}</Text>
|
|
36
|
+
<Text numberOfLines={1} style={{ fontSize: 14, color: col('textSecondary') }}>{note.content.replace(/\s+/g, ' ')}</Text>
|
|
37
|
+
<Text style={{ fontSize: 12, color: col('textTertiary') }}>{() => formatDate(new Date(note.updatedAt), 'datetime')}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
{p.handle}
|
|
40
|
+
</View>
|
|
41
|
+
</Swipeable>
|
|
42
|
+
</View>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** The first tab: the notes kept on the device. */
|
|
48
|
+
export const Notes = () => (
|
|
49
|
+
<View testID='page-notes' style={{ flex: 1, backgroundColor: col('bgSecondary') }}>
|
|
50
|
+
<Header
|
|
51
|
+
title={tr('nav.notes', 'Notes')} left={<MenuButton />}
|
|
52
|
+
right={<IconButton name={icons.search} color={col('headerText')} onPress={() => router.push('/search')} testID='notes-search' />}
|
|
53
|
+
/>
|
|
54
|
+
<Show
|
|
55
|
+
when={() => notes.list().length > 0}
|
|
56
|
+
fallback={
|
|
57
|
+
<View testID='notes-empty' style={{ flex: 1, justifyContent: 'center' }}>
|
|
58
|
+
<EmptyView icon={icons.edit} title={tr('notes.empty', 'No notes yet')} action={tr('notes.new', 'New note')} onAction={newNote} />
|
|
59
|
+
</View>
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
<View style={{ flex: 1, width: '100%', maxWidth: 760, alignSelf: 'center' }}>
|
|
63
|
+
{/* space: the last one can be scrolled above the button */}
|
|
64
|
+
<SortList items={notes.list} onChange={notes.reorder} itemHeight={ROW} space={96} style={{ flex: 1 }} testID='notes-list'>
|
|
65
|
+
{(note, handle) => <NoteRow note={note} handle={handle} />}
|
|
66
|
+
</SortList>
|
|
67
|
+
</View>
|
|
68
|
+
</Show>
|
|
69
|
+
<Fab icon={icons.plus} onPress={newNote} testID='note-add' />
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { openURL } from 'lupine.native.core';
|
|
2
|
+
import { ActionSheet, lang, languages, MessageBox, router, Row, Screen, Section, setLang, setThemePref, t, themePref, themes, Toast, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { layout, setLayout } from '../shell/layout';
|
|
5
|
+
import { clearAllData } from '../shell/store';
|
|
6
|
+
|
|
7
|
+
const themeName = (n: string) =>
|
|
8
|
+
({ system: t('ln.themeSystem', 'System'), light: t('ln.themeLight', 'Light'), dark: t('ln.themeDark', 'Dark'), ocean: t('settings.ocean', 'Ocean'), sand: t('settings.sand', 'Sand') })[n] || n;
|
|
9
|
+
const layoutName = (l: string) => (l === 'sidemenu' ? t('settings.sidemenu', 'Side menu') : t('settings.tabs', 'Tabs'));
|
|
10
|
+
|
|
11
|
+
export const Settings = () => {
|
|
12
|
+
const pickTheme = async () => {
|
|
13
|
+
const v = await ActionSheet.select({ title: t('settings.theme', 'Theme'), selected: themePref(), options: ['system', ...Object.keys(themes)].map((n) => ({ label: themeName(n), value: n })) });
|
|
14
|
+
if (v) setThemePref(v);
|
|
15
|
+
};
|
|
16
|
+
const pickLang = async () => {
|
|
17
|
+
const v = await ActionSheet.select({ title: t('settings.language', 'Language'), selected: lang(), options: languages.map((l) => ({ label: l.name, value: l.code })) });
|
|
18
|
+
if (v) setLang(v);
|
|
19
|
+
};
|
|
20
|
+
const pickLayout = async () => {
|
|
21
|
+
const v = await ActionSheet.select({ title: t('settings.layout', 'Menu'), selected: layout(), options: ['tabs', 'sidemenu'].map((l) => ({ label: layoutName(l), value: l })) });
|
|
22
|
+
if (v === 'tabs' || v === 'sidemenu') setLayout(v);
|
|
23
|
+
};
|
|
24
|
+
const clearCache = () => setTimeout(() => Toast.success(t('settings.cacheCleared', 'Cache cleared')), 300);
|
|
25
|
+
const clearAll = async () => {
|
|
26
|
+
const ok = await MessageBox.confirm({
|
|
27
|
+
title: t('settings.clearAll', 'Clear all data'),
|
|
28
|
+
message: t('settings.clearAllText', 'All notes and searches on this device are deleted. This cannot be undone.'),
|
|
29
|
+
okText: t('settings.erase', 'Erase everything'),
|
|
30
|
+
destructive: true,
|
|
31
|
+
});
|
|
32
|
+
if (!ok) return;
|
|
33
|
+
clearAllData();
|
|
34
|
+
Toast.success(t('settings.cleared', 'All data cleared'));
|
|
35
|
+
};
|
|
36
|
+
const language = () => languages.find((l) => l.code === lang())?.name || lang();
|
|
37
|
+
return (
|
|
38
|
+
<Screen title={tr('nav.settings', 'Settings')} onBack={() => void router.back()} grouped testID='page-settings'>
|
|
39
|
+
<Section title={tr('settings.appearance', 'Appearance')}>
|
|
40
|
+
<Row label={tr('settings.theme', 'Theme')} icon={icons.palette} iconColor='#5e5ce6' value={() => themeName(themePref())} onPress={pickTheme} testID='settings-theme' />
|
|
41
|
+
<Row label={tr('settings.language', 'Language')} icon={icons.language} iconColor='#34c759' value={language} onPress={pickLang} testID='settings-language' />
|
|
42
|
+
<Row label={tr('settings.layout', 'Menu')} icon={icons.menu} iconColor='#ff9f0a' value={() => layoutName(layout())} onPress={pickLayout} testID='settings-layout' />
|
|
43
|
+
</Section>
|
|
44
|
+
<Section title={tr('settings.application', 'Application')}>
|
|
45
|
+
<Row label={tr('settings.feedback', 'Feedback & support')} icon={icons.chat} iconColor='#30b0c7' onPress={() => openURL('https://github.com/uuware/lupine.js/issues')} />
|
|
46
|
+
<Row label={tr('settings.clearCache', 'Clear temporary cache')} icon={icons.refresh} iconColor='#8e8e93' onPress={clearCache} testID='settings-clear-cache' />
|
|
47
|
+
<Row label={tr('nav.about', 'About')} icon={icons.info} iconColor='#1677ff' onPress={() => router.navigate('/about')} testID='settings-about' />
|
|
48
|
+
<Row label={tr('settings.version', 'Version')} value={APP_VERSION} />
|
|
49
|
+
</Section>
|
|
50
|
+
<Section title={tr('settings.danger', 'Danger zone')}>
|
|
51
|
+
<Row label={tr('settings.clearAll', 'Clear all data')} destructive onPress={clearAll} testID='settings-clear-all' />
|
|
52
|
+
</Section>
|
|
53
|
+
</Screen>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createSignal, media, onCleanup, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { Button, Calendar, Card, col, ColorPicker, CopyButton, formatDate, Header, Icon, IconName, router, 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 back = () => void router.back();
|
|
7
|
+
|
|
8
|
+
const TOOLS: { id: string; icon: IconName; title: () => string; text: () => string }[] = [
|
|
9
|
+
{ id: 'stopwatch', icon: icons.clock, title: tr('tools.stopwatch', 'Stopwatch'), text: tr('tools.stopwatchText', 'Start, pause, reset') },
|
|
10
|
+
{ id: 'calendar', icon: icons.calendar, title: tr('tools.calendar', 'Calendar'), text: tr('tools.calendarText', 'Days from today') },
|
|
11
|
+
{ id: 'colors', icon: icons.palette, title: tr('tools.colors', 'Colors'), text: tr('tools.colorsText', 'Pick and copy a color') },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
/** Small tools, each a page of its own: add yours here. */
|
|
15
|
+
export const Tools = () => {
|
|
16
|
+
// 2 or 3 in a row, by css on the web: the page of the server is right at once
|
|
17
|
+
const width = media<`${number}%`>({ base: '47%', mobileAbove: '31%' });
|
|
18
|
+
return (
|
|
19
|
+
<Screen header={<Header title={tr('nav.tools', 'Tools')} left={<MenuButton />} />} grouped testID='page-tools'>
|
|
20
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 12, padding: 16 }}>
|
|
21
|
+
{TOOLS.map((tool) => (
|
|
22
|
+
<Card onPress={() => router.push(`/tools/${tool.id}`)} style={{ width, flexGrow: 1, gap: 8, paddingVertical: 18 }} testID={`tool-${tool.id}`}>
|
|
23
|
+
<View style={{ width: 44, height: 44, borderRadius: 12, alignItems: 'center', justifyContent: 'center', backgroundColor: col('primaryBg') }}>
|
|
24
|
+
<Icon name={tool.icon} color={col('primary')} />
|
|
25
|
+
</View>
|
|
26
|
+
<T kind='subtitle' numberOfLines={1}>{tool.title}</T>
|
|
27
|
+
<T kind='caption' numberOfLines={2}>{tool.text}</T>
|
|
28
|
+
</Card>
|
|
29
|
+
))}
|
|
30
|
+
</View>
|
|
31
|
+
</Screen>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const two = (n: number) => String(Math.floor(n)).padStart(2, '0');
|
|
36
|
+
const clock = (ms: number) => `${two(ms / 60000)}:${two((ms / 1000) % 60)}.${Math.floor((ms % 1000) / 100)}`;
|
|
37
|
+
|
|
38
|
+
export const Stopwatch = () => {
|
|
39
|
+
const [elapsed, setElapsed] = createSignal(0);
|
|
40
|
+
const [running, setRunning] = createSignal(false);
|
|
41
|
+
let since = 0;
|
|
42
|
+
let timer: ReturnType<typeof setInterval> | undefined;
|
|
43
|
+
const stop = () => {
|
|
44
|
+
if (timer !== undefined) clearInterval(timer);
|
|
45
|
+
timer = undefined;
|
|
46
|
+
};
|
|
47
|
+
const toggle = () => {
|
|
48
|
+
if (running()) {
|
|
49
|
+
stop();
|
|
50
|
+
setElapsed(Date.now() - since);
|
|
51
|
+
setRunning(false);
|
|
52
|
+
} else {
|
|
53
|
+
since = Date.now() - elapsed();
|
|
54
|
+
timer = setInterval(() => setElapsed(Date.now() - since), 100);
|
|
55
|
+
setRunning(true);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const reset = () => {
|
|
59
|
+
stop();
|
|
60
|
+
setRunning(false);
|
|
61
|
+
setElapsed(0);
|
|
62
|
+
};
|
|
63
|
+
onCleanup(stop);
|
|
64
|
+
return (
|
|
65
|
+
<Screen title={tr('tools.stopwatch', 'Stopwatch')} onBack={back} padded testID='page-stopwatch'>
|
|
66
|
+
<View style={{ alignItems: 'center', gap: 28, paddingTop: 48 }}>
|
|
67
|
+
<Text testID='stopwatch-time' style={{ fontSize: 56, fontWeight: '300', color: col('text') }}>{() => clock(elapsed())}</Text>
|
|
68
|
+
<View style={{ flexDirection: 'row', gap: 12 }}>
|
|
69
|
+
<Button title={() => (running() ? t('tools.pause', 'Pause') : t('tools.start', 'Start'))} kind='primary' size='large' onPress={toggle} style={{ minWidth: 120 }} testID='stopwatch-start' />
|
|
70
|
+
<Button title={tr('tools.reset', 'Reset')} size='large' onPress={reset} style={{ minWidth: 120 }} testID='stopwatch-reset' />
|
|
71
|
+
</View>
|
|
72
|
+
</View>
|
|
73
|
+
</Screen>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const day = 24 * 3600 * 1000;
|
|
78
|
+
const midnight = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
79
|
+
|
|
80
|
+
export const CalendarTool = () => {
|
|
81
|
+
const [date, setDate] = createSignal(new Date());
|
|
82
|
+
const from = () => Math.round((midnight(date()) - midnight(new Date())) / day);
|
|
83
|
+
return (
|
|
84
|
+
<Screen title={tr('tools.calendar', 'Calendar')} onBack={back} padded testID='page-calendar'>
|
|
85
|
+
<View style={{ gap: 16, width: '100%', maxWidth: 420, alignSelf: 'center' }}>
|
|
86
|
+
<Card>
|
|
87
|
+
<Calendar value={date} onChange={setDate} testID='calendar' />
|
|
88
|
+
</Card>
|
|
89
|
+
<T kind='subtitle' style={{ textAlign: 'center' }} testID='calendar-date'>{() => formatDate(date())}</T>
|
|
90
|
+
<T kind='secondary' style={{ textAlign: 'center' }} testID='calendar-days'>
|
|
91
|
+
{() => (from() === 0 ? t('tools.today', 'Today') : from() > 0 ? t('tools.inDays', 'In {n} days', { n: from() }) : t('tools.daysAgo', '{n} days ago', { n: -from() }))}
|
|
92
|
+
</T>
|
|
93
|
+
</View>
|
|
94
|
+
</Screen>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const ColorsTool = () => {
|
|
99
|
+
const [color, setColor] = createSignal('#1e88e5');
|
|
100
|
+
return (
|
|
101
|
+
<Screen title={tr('tools.colors', 'Colors')} onBack={back} padded testID='page-colors'>
|
|
102
|
+
<View style={{ gap: 16, width: '100%', maxWidth: 520, alignSelf: 'center' }}>
|
|
103
|
+
<View style={{ height: 96, borderRadius: 16, backgroundColor: color, borderWidth: 1, borderColor: col('border') }} />
|
|
104
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 }}>
|
|
105
|
+
<T kind='subtitle' testID='colors-value'>{color}</T>
|
|
106
|
+
<CopyButton text={color} testID='colors-copy' />
|
|
107
|
+
</View>
|
|
108
|
+
<ColorPicker value={color} onChange={setColor} testID='colors-picker' />
|
|
109
|
+
</View>
|
|
110
|
+
</Screen>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Icons that lupine.core/icons doesn't have: { name: path data }, 24 x 24, strokes. svgToPath of lupine.native.core
|
|
2
|
+
// makes the path data of an svg.
|
|
3
|
+
export const finance = { finance: 'M12 2L12 22M17 5L9.5 5C7.567 5 6 6.567 6 8.5C6 10.433 7.567 12 9.5 12L14.5 12C16.433 12 18 13.567 18 15.5C18 17.433 16.433 19 14.5 19L6 19' };
|
|
4
|
+
export const tools = {
|
|
5
|
+
tools:
|
|
6
|
+
'M14.7 6.3C14.319 6.689 14.319 7.311 14.7 7.7L16.3 9.3C16.689 9.681 17.311 9.681 17.7 9.3L21.47 5.53C22.5 7.805 22.012 10.48 20.246 12.246C18.48 14.012 15.805 14.5 13.53 13.47L6.62 20.38C5.792 21.208 4.448 21.208 3.62 20.38C2.792 19.552 2.792 18.208 3.62 17.38L10.53 10.47C9.5 8.195 9.988 5.52 11.754 3.754C13.52 1.988 16.195 1.5 18.47 2.53L14.71 6.29Z',
|
|
7
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createSignal, storage } from 'lupine.native.core';
|
|
2
|
+
|
|
3
|
+
/** tabs: a tab bar on phones, a column on wide windows. sidemenu: a menu button and a drawer on phones, a column on wide windows. */
|
|
4
|
+
export type Layout = 'tabs' | 'sidemenu';
|
|
5
|
+
|
|
6
|
+
const saved = storage.get('layout');
|
|
7
|
+
const [chosen, setChosen] = createSignal<Layout | null>(saved === 'tabs' || saved === 'sidemenu' ? saved : null);
|
|
8
|
+
let fallback: Layout = 'tabs';
|
|
9
|
+
|
|
10
|
+
/** DEFAULT_LAYOUT of app.tsx, before the app is rendered */
|
|
11
|
+
export const setDefaultLayout = (l: Layout) => void (fallback = l);
|
|
12
|
+
/** what Settings chose, else the default (the server renders the default: it is kept on the device, not in a cookie) */
|
|
13
|
+
export const layout = (): Layout => chosen() || fallback;
|
|
14
|
+
/** null: the default again */
|
|
15
|
+
export const setLayout = (l: Layout | null) => {
|
|
16
|
+
setChosen(l);
|
|
17
|
+
storage.set('layout', l);
|
|
18
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export const zhCN = {
|
|
2
|
+
app: { name: '我的笔记' },
|
|
3
|
+
nav: { notes: '笔记', finance: '财务', about: '关于', tools: '工具', mine: '我的', settings: '设置' },
|
|
4
|
+
menu: { dark: '深色模式', light: '浅色模式', footer: '基于 Lupine.js' },
|
|
5
|
+
notes: { empty: '还没有笔记', new: '新建笔记', edit: '编辑', confirmDelete: '删除这条笔记吗?', deleted: '笔记已删除' },
|
|
6
|
+
edit: {
|
|
7
|
+
new: '新建笔记',
|
|
8
|
+
edit: '编辑笔记',
|
|
9
|
+
save: '保存',
|
|
10
|
+
title: '标题',
|
|
11
|
+
titlePlaceholder: '标题…',
|
|
12
|
+
color: '颜色标记',
|
|
13
|
+
content: '内容',
|
|
14
|
+
contentPlaceholder: '写点什么…',
|
|
15
|
+
needTitle: '请输入标题',
|
|
16
|
+
added: '笔记已添加',
|
|
17
|
+
saved: '已保存',
|
|
18
|
+
},
|
|
19
|
+
detail: { title: '详情', missing: '没有这条笔记' },
|
|
20
|
+
search: { placeholder: '搜索标题和内容…', none: '没有找到笔记', hint: '搜索笔记的标题和内容', history: '最近搜索', clearHistory: '清除记录' },
|
|
21
|
+
finance: {
|
|
22
|
+
balance: '本月结余',
|
|
23
|
+
income: '收入',
|
|
24
|
+
spent: '支出',
|
|
25
|
+
entries: '本月',
|
|
26
|
+
salary: '工资',
|
|
27
|
+
rent: '房租',
|
|
28
|
+
groceries: '日用品',
|
|
29
|
+
freelance: '兼职收入',
|
|
30
|
+
power: '电费',
|
|
31
|
+
sample: '示例数据:在 app/src/pages/finance.tsx 中替换',
|
|
32
|
+
},
|
|
33
|
+
tools: {
|
|
34
|
+
stopwatch: '秒表',
|
|
35
|
+
stopwatchText: '开始、暂停、重置',
|
|
36
|
+
calendar: '日历',
|
|
37
|
+
calendarText: '距今天的天数',
|
|
38
|
+
colors: '颜色',
|
|
39
|
+
colorsText: '选择并复制颜色',
|
|
40
|
+
start: '开始',
|
|
41
|
+
pause: '暂停',
|
|
42
|
+
reset: '重置',
|
|
43
|
+
today: '今天',
|
|
44
|
+
inDays: '{n} 天后',
|
|
45
|
+
daysAgo: '{n} 天前',
|
|
46
|
+
},
|
|
47
|
+
mine: {
|
|
48
|
+
user: '演示用户',
|
|
49
|
+
tagline: '本地工作区,离线',
|
|
50
|
+
overview: '数据概览',
|
|
51
|
+
searches: '搜索',
|
|
52
|
+
premium: '升级到高级版',
|
|
53
|
+
premiumText: '解锁云同步、自定义主题和无限存储。',
|
|
54
|
+
plans: '查看方案',
|
|
55
|
+
},
|
|
56
|
+
premium: {
|
|
57
|
+
title: '高级版',
|
|
58
|
+
heading: '高级功能',
|
|
59
|
+
sub: '释放全部潜力',
|
|
60
|
+
text: '这是 Lupine.js 的演示应用。如果需要定制功能或高级功能,请在 GitHub 上提交 issue。',
|
|
61
|
+
request: '申请定制功能',
|
|
62
|
+
},
|
|
63
|
+
settings: {
|
|
64
|
+
appearance: '外观',
|
|
65
|
+
theme: '主题',
|
|
66
|
+
language: '语言',
|
|
67
|
+
layout: '菜单',
|
|
68
|
+
tabs: '底部标签',
|
|
69
|
+
sidemenu: '侧边菜单',
|
|
70
|
+
ocean: '海洋',
|
|
71
|
+
sand: '沙滩',
|
|
72
|
+
application: '应用',
|
|
73
|
+
feedback: '反馈与支持',
|
|
74
|
+
clearCache: '清除临时缓存',
|
|
75
|
+
cacheCleared: '缓存已清除',
|
|
76
|
+
version: '版本',
|
|
77
|
+
danger: '危险操作',
|
|
78
|
+
clearAll: '清除全部数据',
|
|
79
|
+
clearAllText: '这台设备上的所有笔记和搜索记录都会被删除,且无法恢复。',
|
|
80
|
+
erase: '全部清除',
|
|
81
|
+
cleared: '全部数据已清除',
|
|
82
|
+
},
|
|
83
|
+
about: {
|
|
84
|
+
version: '版本',
|
|
85
|
+
text: '全栈框架 Lupine.js 的演示应用:一套代码支持 iOS、Android、macOS、Windows 和网页。借助这个模板和 AI,可以快速构建并发布全平台应用。',
|
|
86
|
+
more: '了解更多',
|
|
87
|
+
},
|
|
88
|
+
notFound: { title: '页面不存在' },
|
|
89
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createSignal, insets, MaybeSignal, media, ScrollView, Show, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { col, Icon, IconButton, IconName, Line, router, setThemePref, SideMenu, Str, t, theme, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
import { layout } from './layout';
|
|
5
|
+
import { navItems } from './nav';
|
|
6
|
+
|
|
7
|
+
const [open, setOpen] = createSignal(false);
|
|
8
|
+
|
|
9
|
+
/** The menu button in the headers of the tabs: phones only (by css on the web, so the page of the server is right). */
|
|
10
|
+
export const MenuButton = () => (
|
|
11
|
+
<View style={{ display: media<'flex' | 'none'>({ base: 'flex', mobileAbove: 'none' }) }}>
|
|
12
|
+
<IconButton name={icons.menu} color={col('headerText')} onPress={() => setOpen(true)} testID='menu-button' />
|
|
13
|
+
</View>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
/** The name of the app at the top of the menus. */
|
|
17
|
+
export const Brand = () => (
|
|
18
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, padding: 16 }}>
|
|
19
|
+
<View style={{ width: 32, height: 32, borderRadius: 8, alignItems: 'center', justifyContent: 'center', backgroundColor: col('primary') }}>
|
|
20
|
+
<Icon name={icons.file} size={18} color={col('onPrimary')} />
|
|
21
|
+
</View>
|
|
22
|
+
<Text numberOfLines={1} style={{ flex: 1, fontSize: 17, fontWeight: '700', color: col('text') }}>{tr('app.name', 'My Note App')}</Text>
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const Item = (p: { label: Str; icon: MaybeSignal<IconName>; active?: () => boolean; onPress: () => void; testID: string }) => {
|
|
27
|
+
const on = () => !!p.active?.();
|
|
28
|
+
const color = () => theme().c[on() ? 'primary' : 'sidebarText'];
|
|
29
|
+
return (
|
|
30
|
+
<View
|
|
31
|
+
testID={p.testID} onPress={p.onPress}
|
|
32
|
+
style={{ flexDirection: 'row', alignItems: 'center', gap: 12, height: 42, marginHorizontal: 8, paddingHorizontal: 10, borderRadius: 8, backgroundColor: () => (on() ? theme().c.selected : 'transparent') }}
|
|
33
|
+
>
|
|
34
|
+
<Icon name={p.icon} size={20} color={color} />
|
|
35
|
+
<Text numberOfLines={1} style={{ flex: 1, fontSize: 15, color }}>{p.label}</Text>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The side menu: in the drawer of phones (prefix menu) and, with the layout sidemenu, the column of wide windows
|
|
42
|
+
* (prefix side). nav: with the tabs. onGo: the drawer closes first.
|
|
43
|
+
*/
|
|
44
|
+
export const MenuContent = (p: { prefix: string; nav: () => boolean; onGo?: () => void }) => {
|
|
45
|
+
const go = (path: string, push = false) => {
|
|
46
|
+
const open = () => (push ? router.push(path) : router.navigate(path));
|
|
47
|
+
if (!p.onGo) return open();
|
|
48
|
+
p.onGo();
|
|
49
|
+
setTimeout(open, 120);
|
|
50
|
+
};
|
|
51
|
+
const dark = () => theme().mode === 'dark';
|
|
52
|
+
return (
|
|
53
|
+
<View style={{ flex: 1 }}>
|
|
54
|
+
<Brand />
|
|
55
|
+
<Line />
|
|
56
|
+
<ScrollView style={{ flex: 1 }}>
|
|
57
|
+
<View style={{ paddingVertical: 8, gap: 2 }}>
|
|
58
|
+
<Show when={p.nav}>
|
|
59
|
+
{navItems.map((item) => (
|
|
60
|
+
<Item label={item.label} icon={item.icon} active={() => router.tab() === item.key} onPress={() => go(item.key)} testID={`${p.prefix}-${item.testID.slice(4)}`} />
|
|
61
|
+
))}
|
|
62
|
+
<Line style={{ marginVertical: 8, marginHorizontal: 16 }} />
|
|
63
|
+
</Show>
|
|
64
|
+
<Item
|
|
65
|
+
label={() => (dark() ? t('menu.light', 'Light mode') : t('menu.dark', 'Dark mode'))} icon={() => (dark() ? icons.sun : icons.moon)}
|
|
66
|
+
onPress={() => setThemePref(dark() ? 'light' : 'dark')} testID={`${p.prefix}-theme`}
|
|
67
|
+
/>
|
|
68
|
+
<Item label={tr('nav.settings', 'Settings')} icon={icons.settings} onPress={() => go('/settings', true)} testID={`${p.prefix}-settings`} />
|
|
69
|
+
</View>
|
|
70
|
+
</ScrollView>
|
|
71
|
+
<Text style={{ textAlign: 'center', fontSize: 12, color: col('textTertiary'), paddingTop: 12, paddingBottom: () => 12 + insets().bottom }}>{tr('menu.footer', 'Powered by Lupine.js')}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** The drawer of phones; with the layout sidemenu it has the tabs, too. */
|
|
77
|
+
export const AppMenu = () => (
|
|
78
|
+
<SideMenu visible={open} onClose={() => setOpen(false)} testID='side-menu'>
|
|
79
|
+
<MenuContent prefix='menu' nav={() => layout() === 'sidemenu'} onGo={() => setOpen(false)} />
|
|
80
|
+
</SideMenu>
|
|
81
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NavItem, tr } from 'lupine.native.components';
|
|
2
|
+
import * as icons from 'lupine.core/icons';
|
|
3
|
+
import { finance, tools } from './icons';
|
|
4
|
+
|
|
5
|
+
/** The tabs, in the tab bar and in the side menu. key: the path of the tab. */
|
|
6
|
+
export const navItems: NavItem[] = [
|
|
7
|
+
{ key: '/', label: tr('nav.notes', 'Notes'), icon: icons.file, testID: 'tab-notes' },
|
|
8
|
+
{ key: '/finance', label: tr('nav.finance', 'Finance'), icon: finance, testID: 'tab-finance' },
|
|
9
|
+
{ key: '/about', label: tr('nav.about', 'About'), icon: icons.info, raised: true, testID: 'tab-about' },
|
|
10
|
+
{ key: '/tools', label: tr('nav.tools', 'Tools'), icon: tools, testID: 'tab-tools' },
|
|
11
|
+
{ key: '/mine', label: tr('nav.mine', 'Mine'), icon: icons.user, testID: 'tab-mine' },
|
|
12
|
+
];
|