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,373 @@
|
|
|
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
|
+
// There is no server: first the API is an address where nobody answers (the app shows that, it doesn't break), then
|
|
4
|
+
// fetch is a small fake of the API (api/src/service): accounts, the session, notes, errors of the server.
|
|
5
|
+
import { Platform, storage, windowInfo } from 'lupine.native.core';
|
|
6
|
+
import { isWide, setLang, setThemePref } from 'lupine.native.components';
|
|
7
|
+
import { runApp } from 'lupine.native.core/native';
|
|
8
|
+
import { App } from './app';
|
|
9
|
+
import { api, setServerAddress } from './shell/api';
|
|
10
|
+
|
|
11
|
+
const native = globalThis.__lupine;
|
|
12
|
+
const act = (id: string, action: string, arg?: unknown) => native.test!(id, action, arg);
|
|
13
|
+
const text = (id: string) => act(id, 'text');
|
|
14
|
+
const sleep = (ms: number) => new Promise<void>((done) => setTimeout(done, ms));
|
|
15
|
+
const exists = (id: string) => act(id, 'x') !== '<missing>';
|
|
16
|
+
|
|
17
|
+
let passed = 0;
|
|
18
|
+
let failed = 0;
|
|
19
|
+
const check = (name: string, actual: unknown, expected: unknown) => {
|
|
20
|
+
const ok = actual === expected;
|
|
21
|
+
if (ok) passed++;
|
|
22
|
+
else failed++;
|
|
23
|
+
console.log(`TEST ${ok ? 'ok ' : 'FAIL'} ${name}${ok ? '' : ` -> ${JSON.stringify(actual)}, expected ${JSON.stringify(expected)}`}`);
|
|
24
|
+
};
|
|
25
|
+
/** The script that runs the test takes a picture; desktops do it themselves. */
|
|
26
|
+
const shot = async (name: string) => {
|
|
27
|
+
await sleep(250);
|
|
28
|
+
if (Platform.OS === 'macos' || Platform.OS === 'windows') act('', 'screenshot', `shot-${name}.png`);
|
|
29
|
+
console.log(`SHOT ${name}`);
|
|
30
|
+
await sleep(Platform.OS === 'macos' || Platform.OS === 'windows' ? 50 : 2500);
|
|
31
|
+
};
|
|
32
|
+
const press = async (id: string, wait = 600) => {
|
|
33
|
+
check(`press ${id}`, exists(id) && act(id, 'click'), true);
|
|
34
|
+
await sleep(wait);
|
|
35
|
+
};
|
|
36
|
+
const type = async (id: string, value: string) => {
|
|
37
|
+
act(id, 'focus');
|
|
38
|
+
await sleep(200);
|
|
39
|
+
act(id, 'type', value);
|
|
40
|
+
await sleep(200);
|
|
41
|
+
};
|
|
42
|
+
const toast = () => (exists('toast-text') ? text('toast-text') : '');
|
|
43
|
+
/** the toast, when it comes (on Windows an address where nobody answers takes about 2 s to fail) */
|
|
44
|
+
const toastSoon = async (ms = 6000) => {
|
|
45
|
+
for (let t = 0; t < ms && !toast(); t += 100) await sleep(100);
|
|
46
|
+
return toast();
|
|
47
|
+
};
|
|
48
|
+
const at = (id: string) => Math.round(act(id, 'screenX'));
|
|
49
|
+
|
|
50
|
+
// ---- the fake API: what the app sends, and the answers of api/src/service (user-api.ts, notes-api.ts)
|
|
51
|
+
const realFetch = globalThis.fetch;
|
|
52
|
+
type Sent = { method: string; path: string; query: string; cookie: string; type: string; body: any };
|
|
53
|
+
const sent: Sent[] = [];
|
|
54
|
+
const last = () => sent[sent.length - 1] || ({} as Sent);
|
|
55
|
+
/** ok; 500: a page of an error instead of JSON; offline: nobody answers; expired: the session is over; nokey: no CRYPTO_KEY */
|
|
56
|
+
let mode: 'ok' | '500' | 'offline' | 'expired' | 'nokey' = 'ok';
|
|
57
|
+
const accounts = new Map<string, { id: number; password: string }>();
|
|
58
|
+
const notes: { id: number; owner: string; text: string; created_at: string; updated_at: string }[] = [];
|
|
59
|
+
const PAGE = 3; // the API: 100
|
|
60
|
+
let ids = 0;
|
|
61
|
+
const fakeFetch = async (url: string, init: { method?: string; headers?: { [name: string]: string }; body?: string } = {}) => {
|
|
62
|
+
const [path, query = ''] = url.replace(/^\w+:\/\/[^/]+/, '').split('?');
|
|
63
|
+
const cookie = init.headers?.Cookie || '';
|
|
64
|
+
const body = init.body ? JSON.parse(init.body) : undefined;
|
|
65
|
+
sent.push({ method: init.method || 'GET', path, query, cookie, type: init.headers?.['Content-Type'] || '', body });
|
|
66
|
+
if (mode === 'offline') throw new TypeError('Network request failed');
|
|
67
|
+
const reply = (status: number, value: object | string) => {
|
|
68
|
+
const t = typeof value === 'string' ? value : JSON.stringify(value);
|
|
69
|
+
return { ok: status < 300, status, statusText: '', url, headers: new Headers(), text: async () => t, json: async () => JSON.parse(t), arrayBuffer: async () => new ArrayBuffer(0) };
|
|
70
|
+
};
|
|
71
|
+
if (mode === '500') return reply(500, '<html><body>Internal Server Error</body></html>');
|
|
72
|
+
if (mode === 'nokey') return reply(500, { status: 'error', code: 'no_crypto_key', message: 'server: no_crypto_key' });
|
|
73
|
+
const answer = (code: string, data: object = {}) => reply(200, { status: 'ok', code, message: `server: ${code}`, ...data });
|
|
74
|
+
const error = (status: number, code: string, data: object = {}) => reply(status, { status: 'error', code, message: `server: ${code}`, ...data });
|
|
75
|
+
const token = decodeURIComponent((/(?:^|; )_token=([^;]*)/.exec(cookie) || [])[1] || '');
|
|
76
|
+
const owner = mode === 'expired' ? '' : (/^tok\+(\w+)\/=$/.exec(token) || [])[1] || '';
|
|
77
|
+
const session = (name: string) => ({ user: { id: accounts.get(name)!.id, username: name }, token: `tok+${name}/=` }); // base64, as CryptoUtils.encrypt
|
|
78
|
+
const name = String(body?.username || '').trim().toLowerCase();
|
|
79
|
+
if (path === '/api/register') {
|
|
80
|
+
if (!/^[a-z0-9_.@-]{3,50}$/.test(name)) return error(400, 'bad_username');
|
|
81
|
+
if (accounts.has(name)) return error(409, 'username_taken');
|
|
82
|
+
accounts.set(name, { id: ++ids, password: body.password });
|
|
83
|
+
return answer('registered', session(name));
|
|
84
|
+
}
|
|
85
|
+
if (path === '/api/login') return accounts.get(name)?.password === body.password ? answer('signed_in', session(name)) : error(401, 'login_failed');
|
|
86
|
+
if (path === '/api/logout') return answer('signed_out');
|
|
87
|
+
if (!owner) return error(401, 'not_signed_in');
|
|
88
|
+
if (path === '/api/me') return answer('ok', { user: session(owner).user });
|
|
89
|
+
const mine = notes.filter((n) => n.owner === owner).sort((a, b) => b.id - a.id);
|
|
90
|
+
const plain = ({ owner: _, ...n }: (typeof notes)[0]) => n;
|
|
91
|
+
if (path === '/api/notes') {
|
|
92
|
+
const before = Number(new URLSearchParams(query).get('before') || 0);
|
|
93
|
+
const list = mine.filter((n) => !before || n.id < before);
|
|
94
|
+
return answer('ok', { notes: list.slice(0, PAGE).map(plain), more: list.length > PAGE });
|
|
95
|
+
}
|
|
96
|
+
if (path === '/api/notes/add') {
|
|
97
|
+
const value = String(body.text || '').trim();
|
|
98
|
+
if (!value) return error(400, 'bad_note');
|
|
99
|
+
const n = { id: ++ids, owner, text: value, created_at: '2026-12-04T09:30:00.000Z', updated_at: '2026-12-04T09:30:00.000Z' };
|
|
100
|
+
notes.push(n);
|
|
101
|
+
return answer('note_added', { note: plain(n) });
|
|
102
|
+
}
|
|
103
|
+
const i = notes.findIndex((n) => n.id === body.id && n.owner === owner);
|
|
104
|
+
if (path === '/api/notes/update') return i < 0 ? error(404, 'note_not_found') : ((notes[i].text = body.text), answer('note_updated', { note: plain(notes[i]) }));
|
|
105
|
+
if (path === '/api/notes/delete') return i < 0 ? error(404, 'note_not_found') : (notes.splice(i, 1), answer('note_deleted', { id: body.id }));
|
|
106
|
+
return error(404, 'not_found');
|
|
107
|
+
};
|
|
108
|
+
const useFake = (on: boolean) => ((globalThis as any).fetch = on ? fakeFetch : realFetch);
|
|
109
|
+
|
|
110
|
+
// a known start: signed out, and nobody answers at port 9
|
|
111
|
+
setThemePref('light');
|
|
112
|
+
setLang('en');
|
|
113
|
+
api.forget();
|
|
114
|
+
setServerAddress('http://127.0.0.1:9');
|
|
115
|
+
|
|
116
|
+
const started = Date.now();
|
|
117
|
+
runApp(App);
|
|
118
|
+
console.log(`TEST mounted in ${Date.now() - started} ms, window ${JSON.stringify(windowInfo())}`);
|
|
119
|
+
|
|
120
|
+
const main = async () => {
|
|
121
|
+
for (let i = 0; i < 100 && !(act('page-home', 'width') > 0); i++) await sleep(100);
|
|
122
|
+
await sleep(500);
|
|
123
|
+
const left = isWide() ? 240 : 0;
|
|
124
|
+
check('home', text('app-name'), 'Lupine Notes');
|
|
125
|
+
check('home fills the window', Math.round(act('page-home', 'width')), Math.round(windowInfo().width - left));
|
|
126
|
+
await shot('1-home');
|
|
127
|
+
|
|
128
|
+
// settings: push, sheet, theme, language, slider, switch, the server
|
|
129
|
+
await press('shortcut-settings', 800);
|
|
130
|
+
check('the page slid in', at('page-settings'), left);
|
|
131
|
+
check('theme row', text('settings-theme-value'), 'Light');
|
|
132
|
+
check('the server of the app', text('settings-server-value'), 'http://127.0.0.1:9');
|
|
133
|
+
await press('settings-theme');
|
|
134
|
+
await shot('2-sheet');
|
|
135
|
+
await press('option-dark');
|
|
136
|
+
check('sheet closed', exists('sheet'), false);
|
|
137
|
+
check('theme changed', text('settings-theme-value'), 'Dark');
|
|
138
|
+
await shot('3-dark');
|
|
139
|
+
check('switch', act('settings-push', 'value'), true);
|
|
140
|
+
act('settings-push', 'toggle');
|
|
141
|
+
await sleep(100);
|
|
142
|
+
check('switch toggled', act('settings-push', 'value'), false);
|
|
143
|
+
check('slider', Math.abs(act('size-slider', 'value') - 1) < 0.05, true);
|
|
144
|
+
await press('settings-language');
|
|
145
|
+
await press('option-zh-CN');
|
|
146
|
+
check('language', text('settings-language-value'), '简体中文');
|
|
147
|
+
check('Chinese: the server row', text('settings-server-value'), 'http://127.0.0.1:9');
|
|
148
|
+
await shot('4-chinese');
|
|
149
|
+
await press('settings-language');
|
|
150
|
+
await press('option-en');
|
|
151
|
+
await press('settings-theme');
|
|
152
|
+
await press('option-light');
|
|
153
|
+
await press('settings-clear');
|
|
154
|
+
await shot('5-dialog');
|
|
155
|
+
await press('dialog-ok');
|
|
156
|
+
check('toast', toast(), 'Cache cleared');
|
|
157
|
+
await press('header-back', 800);
|
|
158
|
+
check('page removed', exists('page-settings'), false);
|
|
159
|
+
|
|
160
|
+
// slide panel, pager
|
|
161
|
+
await press('shortcut-layers');
|
|
162
|
+
await shot('6-panel');
|
|
163
|
+
await press('panel-close');
|
|
164
|
+
check('panel removed', exists('home-panel'), false);
|
|
165
|
+
await press('pager-dot-1');
|
|
166
|
+
await shot('7-pager');
|
|
167
|
+
|
|
168
|
+
// tabs
|
|
169
|
+
const tab = (name: string) => press(`tab-${name}`);
|
|
170
|
+
await tab('components');
|
|
171
|
+
await press('native-button', 100);
|
|
172
|
+
check('native button', text('native-taps'), '1 taps');
|
|
173
|
+
await shot('8-components');
|
|
174
|
+
await tab('inbox');
|
|
175
|
+
check('unread', text('unread'), '3 unread');
|
|
176
|
+
await shot('9-inbox');
|
|
177
|
+
await press('mark-read');
|
|
178
|
+
check('all read', exists('unread'), false);
|
|
179
|
+
await tab('discover');
|
|
180
|
+
await press('create-button');
|
|
181
|
+
await press('option-task');
|
|
182
|
+
check('created', toast(), 'Created: New task');
|
|
183
|
+
|
|
184
|
+
// signed out: the notes invite to sign in
|
|
185
|
+
await tab('me');
|
|
186
|
+
check('guest', text('me-name'), 'Guest');
|
|
187
|
+
await shot('10-me');
|
|
188
|
+
await press('me-notes', 800);
|
|
189
|
+
check('notes: sign in first', exists('notes-signed-out') && exists('notes-signin'), true);
|
|
190
|
+
check('notes: no field', exists('note-input'), false);
|
|
191
|
+
await shot('11-notes-signed-out');
|
|
192
|
+
await press('notes-signin', 800);
|
|
193
|
+
check('notes: to the sign-in', exists('page-login'), true);
|
|
194
|
+
await press('header-back', 800);
|
|
195
|
+
await press('header-back', 800);
|
|
196
|
+
|
|
197
|
+
// the sign-in page: the checks of the form (a new page for each round: each field is typed into once)
|
|
198
|
+
await press('me-signin', 800);
|
|
199
|
+
check('the server on the page', text('login-server'), 'Server: http://127.0.0.1:9');
|
|
200
|
+
await press('login-submit', 300);
|
|
201
|
+
check('user name required', text('login-username-error'), 'Required');
|
|
202
|
+
check('password required', text('login-password-error'), 'Required');
|
|
203
|
+
await press('login-switch', 300);
|
|
204
|
+
check('register: a second password', exists('login-password2'), true);
|
|
205
|
+
await type('login-username', 'ab');
|
|
206
|
+
check('register: the rule of user names', text('login-username-error'), '3 to 50 characters: letters, digits, _ . @ -');
|
|
207
|
+
await type('login-password', '12345');
|
|
208
|
+
check('register: password length', text('login-password-error'), 'At least 6 characters');
|
|
209
|
+
await type('login-password2', '1');
|
|
210
|
+
check('register: passwords differ', text('login-password2-error'), 'The two passwords differ');
|
|
211
|
+
await shot('12-register-checks');
|
|
212
|
+
await press('login-switch', 300);
|
|
213
|
+
check('sign in again: no second password', exists('login-password2'), false);
|
|
214
|
+
check('sign in: no rule for the name', exists('login-username-error'), false);
|
|
215
|
+
await press('header-back', 800);
|
|
216
|
+
|
|
217
|
+
// no server: a message, nothing breaks
|
|
218
|
+
await press('me-signin', 800);
|
|
219
|
+
await type('login-username', 'ada');
|
|
220
|
+
await type('login-password', 'secret1');
|
|
221
|
+
await press('login-submit', 300);
|
|
222
|
+
check('no server: a message', await toastSoon(), 'The server cannot be reached');
|
|
223
|
+
check('still on the page', exists('page-login'), true);
|
|
224
|
+
check('not signed in', api.user(), null);
|
|
225
|
+
await shot('13-login-offline');
|
|
226
|
+
await press('header-back', 800);
|
|
227
|
+
|
|
228
|
+
// a server (the fake)
|
|
229
|
+
useFake(true);
|
|
230
|
+
await press('me-signin', 800);
|
|
231
|
+
await type('login-username', 'Ada');
|
|
232
|
+
await type('login-password', 'wrong!!');
|
|
233
|
+
await press('login-submit', 800);
|
|
234
|
+
check('the text of the app for the code', toast(), 'Wrong user name or password');
|
|
235
|
+
check('a POST with JSON', `${last().method} ${last().path} ${last().type}`, 'POST /api/login application/json');
|
|
236
|
+
check('the user name and the password', JSON.stringify(last().body), JSON.stringify({ username: 'Ada', password: 'wrong!!' }));
|
|
237
|
+
check('the language goes along, no token yet', last().cookie, 'lang=en');
|
|
238
|
+
setLang('zh-CN');
|
|
239
|
+
await sleep(300);
|
|
240
|
+
await press('login-submit', 800);
|
|
241
|
+
check('the text of the code in Chinese', toast(), '用户名或密码错误');
|
|
242
|
+
check('the language of the request', last().cookie, 'lang=zh-CN');
|
|
243
|
+
await shot('14-login-chinese');
|
|
244
|
+
setLang('en');
|
|
245
|
+
await sleep(300);
|
|
246
|
+
mode = 'nokey';
|
|
247
|
+
await press('login-submit', 800);
|
|
248
|
+
check('no CRYPTO_KEY on the server: said so', toast(), 'The server has no CRYPTO_KEY in its .env');
|
|
249
|
+
mode = 'ok';
|
|
250
|
+
await press('header-back', 800);
|
|
251
|
+
|
|
252
|
+
// a new account: signed in at once
|
|
253
|
+
await press('me-signin', 800);
|
|
254
|
+
await press('login-switch', 300);
|
|
255
|
+
await type('login-username', 'Ada');
|
|
256
|
+
await type('login-password', 'secret1');
|
|
257
|
+
await type('login-password2', 'secret1');
|
|
258
|
+
await shot('15-register');
|
|
259
|
+
await press('login-submit', 1200);
|
|
260
|
+
check('registered', last().path, '/api/register');
|
|
261
|
+
check('welcome', toast(), 'Welcome, ada: your account is ready');
|
|
262
|
+
check('signed in', text('me-name'), 'ada');
|
|
263
|
+
check('the token is kept', storage.get('session'), 'tok+ada/=');
|
|
264
|
+
await shot('16-signed-in');
|
|
265
|
+
|
|
266
|
+
// the notes on the server
|
|
267
|
+
await press('me-notes', 800);
|
|
268
|
+
check('notes: loaded with the token', `${last().method} ${last().path} ${last().cookie}`, `GET /api/notes lang=en; _token=${encodeURIComponent('tok+ada/=')}`);
|
|
269
|
+
check('notes: none yet, no error', exists('notes-error') || exists('notes-more'), false);
|
|
270
|
+
await type('note-input', 'first note 你好 😀');
|
|
271
|
+
await press('note-add', 500);
|
|
272
|
+
check('add: sent', JSON.stringify(last().body), JSON.stringify({ text: 'first note 你好 😀' }));
|
|
273
|
+
check('add: shown', text('note-2'), 'first note 你好 😀');
|
|
274
|
+
check('add: the field is cleared', text('note-input'), '');
|
|
275
|
+
for (const value of ['second', 'third', 'fourth']) {
|
|
276
|
+
await type('note-input', value);
|
|
277
|
+
await press('note-add', 400);
|
|
278
|
+
}
|
|
279
|
+
check('four notes', ['note-2', 'note-3', 'note-4', 'note-5'].every(exists), true);
|
|
280
|
+
await shot('17-notes');
|
|
281
|
+
await press('notes-refresh', 800);
|
|
282
|
+
check('refresh: a page of three', exists('note-5') && exists('note-3') && !exists('note-2'), true);
|
|
283
|
+
check('refresh: older ones', exists('notes-more'), true);
|
|
284
|
+
await press('notes-more', 800);
|
|
285
|
+
check('older notes: before the last one', `${last().path}?${last().query}`, '/api/notes?before=3');
|
|
286
|
+
check('older notes: all four', exists('note-2') && !exists('notes-more'), true);
|
|
287
|
+
check('update (the client)', (await api.updateNote(3, 'second, changed')).code, 'note_updated');
|
|
288
|
+
|
|
289
|
+
// the server answers with an error page, then not at all: the notes stay, a message and a button
|
|
290
|
+
mode = '500';
|
|
291
|
+
await press('notes-refresh', 800);
|
|
292
|
+
check('server error: a message', text('notes-error'), 'Unexpected answer of the server (500)');
|
|
293
|
+
check('server error: the notes stay', exists('note-5'), true);
|
|
294
|
+
await shot('18-server-error');
|
|
295
|
+
mode = 'offline';
|
|
296
|
+
await press('notes-retry', 800);
|
|
297
|
+
check('offline: a message', text('notes-error'), 'The server cannot be reached');
|
|
298
|
+
await type('note-input', 'written offline');
|
|
299
|
+
await press('note-add', 800);
|
|
300
|
+
check('offline: add fails with a message', toast(), 'The server cannot be reached');
|
|
301
|
+
check('offline: the text stays', text('note-input'), 'written offline');
|
|
302
|
+
check('offline: still signed in', api.user()?.username, 'ada');
|
|
303
|
+
await shot('19-offline');
|
|
304
|
+
mode = 'ok';
|
|
305
|
+
await press('notes-retry', 800);
|
|
306
|
+
check('online again: no message', exists('notes-error'), false);
|
|
307
|
+
check('online again: the change of the update', text('note-3'), 'second, changed');
|
|
308
|
+
await press('note-add', 600);
|
|
309
|
+
check('online again: added', text('note-6'), 'written offline');
|
|
310
|
+
await press('note-delete-4', 600);
|
|
311
|
+
check('delete: sent', `${last().path} ${JSON.stringify(last().body)}`, '/api/notes/delete {"id":4}');
|
|
312
|
+
check('delete: a message', toast(), 'Note deleted');
|
|
313
|
+
check('delete: gone', exists('note-4'), false);
|
|
314
|
+
|
|
315
|
+
// the session is over (a new password ...): signed out, and asked to sign in again
|
|
316
|
+
mode = 'expired';
|
|
317
|
+
await press('notes-refresh', 800);
|
|
318
|
+
check('session over: signed out', api.user(), null);
|
|
319
|
+
check('session over: a message', toast(), 'Please sign in again');
|
|
320
|
+
check('session over: the token is gone', storage.get('session'), null);
|
|
321
|
+
check('session over: sign in again', exists('notes-signed-out'), true);
|
|
322
|
+
check('session over: no notes of before', exists('note-5'), false);
|
|
323
|
+
await shot('20-session-over');
|
|
324
|
+
mode = 'ok';
|
|
325
|
+
await press('notes-signin', 800);
|
|
326
|
+
await type('login-username', 'ada');
|
|
327
|
+
await type('login-password', 'secret1');
|
|
328
|
+
await press('login-submit', 1200);
|
|
329
|
+
check('signed in again: back on the notes', exists('page-notes') && !exists('page-login'), true);
|
|
330
|
+
check('signed in again: the notes', exists('note-6') && exists('note-5') && !exists('note-4'), true);
|
|
331
|
+
await press('header-back', 800);
|
|
332
|
+
|
|
333
|
+
// sign out
|
|
334
|
+
check('me', text('me-name'), 'ada');
|
|
335
|
+
await press('me-signout', 800);
|
|
336
|
+
check('signed out', text('me-name'), 'Guest');
|
|
337
|
+
check('told the API', last().path, '/api/logout');
|
|
338
|
+
check('the token is gone', storage.get('session'), null);
|
|
339
|
+
// the name is taken
|
|
340
|
+
await press('me-signin', 800);
|
|
341
|
+
await press('login-switch', 300);
|
|
342
|
+
await type('login-username', 'ADA');
|
|
343
|
+
await type('login-password', 'another1');
|
|
344
|
+
await type('login-password2', 'another1');
|
|
345
|
+
await press('login-submit', 800);
|
|
346
|
+
check('register: the name is taken', toast(), 'This user name is taken');
|
|
347
|
+
check('register: not signed in', api.user(), null);
|
|
348
|
+
await press('header-back', 800);
|
|
349
|
+
useFake(false);
|
|
350
|
+
|
|
351
|
+
// a note from the Create tab: the page of the notes
|
|
352
|
+
await tab('discover');
|
|
353
|
+
await press('create-button');
|
|
354
|
+
await press('option-note', 800);
|
|
355
|
+
check('create a note: the notes', exists('page-notes'), true);
|
|
356
|
+
await press('header-back', 800);
|
|
357
|
+
await tab('home');
|
|
358
|
+
await press('recent-12', 800);
|
|
359
|
+
check('route parameter', text('item-title'), 'Team photos');
|
|
360
|
+
await press('header-back', 800);
|
|
361
|
+
if (!isWide()) {
|
|
362
|
+
await press('menu-button');
|
|
363
|
+
await shot('21-menu');
|
|
364
|
+
await press('menu-theme');
|
|
365
|
+
await press('side-menu-mask');
|
|
366
|
+
check('menu closed', exists('side-menu'), false);
|
|
367
|
+
check('the pager is where it was', act('pager-page-1', 'screenX') < 60, true);
|
|
368
|
+
await shot('22-home-dark');
|
|
369
|
+
}
|
|
370
|
+
console.log(`TEST RESULT ${failed ? 'FAILED' : 'PASSED'} ${passed} ok, ${failed} failed`);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
main().catch((e) => console.log(`TEST RESULT FAILED ${e && e.stack}`));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { onCleanup, serverRequest, View } from 'lupine.native.core';
|
|
2
|
+
import { router } from 'lupine.native.components';
|
|
3
|
+
import { runApp } from 'lupine.native.core/web';
|
|
4
|
+
import { App } from './app';
|
|
5
|
+
|
|
6
|
+
/** The app follows the address: the address bar shows its page (/me), and the buttons of the browser go back and forward in it. */
|
|
7
|
+
export const followAddress = () => router.followUrl();
|
|
8
|
+
|
|
9
|
+
/** The app as a page of the site (web/src/index.tsx: pageRouter.use('*', AppPage, { keep: true })); in the browser it follows the address. */
|
|
10
|
+
export const AppPage = () => {
|
|
11
|
+
if (!serverRequest()) onCleanup(followAddress());
|
|
12
|
+
return (
|
|
13
|
+
<View style={{ height: '100%' }}>
|
|
14
|
+
<App />
|
|
15
|
+
</View>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// The web version without the site: lupine-native web starts it in document.body.
|
|
20
|
+
export const start = (container: HTMLElement) => runApp(AppPage, container);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Button as NativeButton, createSignal, Slider, Switch, TextInput, View } from 'lupine.native.core';
|
|
2
|
+
import { ActionSheet, Avatar, Badge, Button, Card, col, Header, Icon, MessageBox, Row, Screen, Section, T, t, TextField, Toast, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
|
|
5
|
+
const line = { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 10 } as const;
|
|
6
|
+
|
|
7
|
+
/** What exists so far: the platform's own controls, and what is built from View, Text and Icon. */
|
|
8
|
+
export const Components = () => {
|
|
9
|
+
const [on, setOn] = createSignal(true);
|
|
10
|
+
const [level, setLevel] = createSignal(0.4);
|
|
11
|
+
const [text, setText] = createSignal('');
|
|
12
|
+
const [taps, setTaps] = createSignal(0);
|
|
13
|
+
return (
|
|
14
|
+
<Screen header={<Header title={tr('nav.components', 'Components')} />} testID='page-components'>
|
|
15
|
+
<View style={{ padding: 16, gap: 16 }}>
|
|
16
|
+
<T kind='subtitle'>Platform controls</T>
|
|
17
|
+
<Card style={{ gap: 12 }}>
|
|
18
|
+
<View style={line}>
|
|
19
|
+
<NativeButton title='Button' onPress={() => setTaps((n) => n + 1)} testID='native-button' />
|
|
20
|
+
<T testID='native-taps'>{() => `${taps()} taps`}</T>
|
|
21
|
+
</View>
|
|
22
|
+
<View style={line}>
|
|
23
|
+
<Switch value={on} onValueChange={setOn} testID='c-switch' />
|
|
24
|
+
<T>{() => (on() ? 'on' : 'off')}</T>
|
|
25
|
+
</View>
|
|
26
|
+
<Slider value={level} onValueChange={setLevel} testID='c-slider' />
|
|
27
|
+
<T testID='c-level'>{() => `${Math.round(level() * 100)}%`}</T>
|
|
28
|
+
<TextInput value={text} onChangeText={setText} placeholder='TextInput' />
|
|
29
|
+
</Card>
|
|
30
|
+
<T kind='subtitle'>Buttons</T>
|
|
31
|
+
<View style={line}>
|
|
32
|
+
{(['primary', 'secondary', 'outline', 'ghost', 'destructive'] as const).map((kind) => <Button title={kind} kind={kind} onPress={() => Toast.info(kind)} />)}
|
|
33
|
+
</View>
|
|
34
|
+
<View style={line}>
|
|
35
|
+
<Button title='small' size='small' />
|
|
36
|
+
<Button title='large' size='large' icon={icons.check} kind='primary' />
|
|
37
|
+
<Button title='disabled' disabled />
|
|
38
|
+
</View>
|
|
39
|
+
<T kind='subtitle'>Text field</T>
|
|
40
|
+
<TextField label='Label' value={text} onChangeText={setText} placeholder='Type here' />
|
|
41
|
+
<T kind='caption'>{() => `${text().length} characters`}</T>
|
|
42
|
+
<T kind='subtitle'>Avatar, badge, icons</T>
|
|
43
|
+
<View style={line}>
|
|
44
|
+
<Avatar name='Ada Lovelace' />
|
|
45
|
+
<Avatar name='Grace' size={56} />
|
|
46
|
+
<Badge count={3} />
|
|
47
|
+
<Badge count={120} />
|
|
48
|
+
</View>
|
|
49
|
+
<View style={line}>
|
|
50
|
+
{/* the icons themselves, not their names: a name alone is only there after another place used the icon */}
|
|
51
|
+
{[icons.home, icons.grid, icons.bell, icons.user, icons.settings, icons.camera, icons.image, icons.heart, icons.clock, icons.lock, icons.palette, icons.language, icons.sun, icons.moon, icons.trash, icons.search].map((icon) => (
|
|
52
|
+
<Icon name={icon} color={col('primary')} />
|
|
53
|
+
))}
|
|
54
|
+
</View>
|
|
55
|
+
</View>
|
|
56
|
+
<Section title='Overlays'>
|
|
57
|
+
<Row label='Toast' onPress={() => Toast.success('Saved')} />
|
|
58
|
+
<Row label='ActionSheet' onPress={async () => Toast.info(String(await ActionSheet.select({ title: 'Choose', options: ['a', 'b', 'c'].map((v) => ({ label: v.toUpperCase(), value: v })) })))} />
|
|
59
|
+
<Row label='MessageBox alert' onPress={() => MessageBox.alert({ message: 'Saved to this device' })} />
|
|
60
|
+
<Row label='MessageBox confirm' onPress={async () => Toast.info(String(await MessageBox.confirm({ message: t('ln.ok', 'OK') + '?' })))} />
|
|
61
|
+
</Section>
|
|
62
|
+
<View style={{ height: 24 }} />
|
|
63
|
+
</Screen>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Platform, View } from 'lupine.native.core';
|
|
2
|
+
import { Card, col, EmptyView, Icon, router, Screen, T, t, tr } from 'lupine.native.components';
|
|
3
|
+
import { FEATURED, RECENT } from '../shell/data';
|
|
4
|
+
import * as icons from 'lupine.core/icons';
|
|
5
|
+
|
|
6
|
+
const back = () => void router.back();
|
|
7
|
+
|
|
8
|
+
export const Item = ({ id }: { id: string }) => {
|
|
9
|
+
const found = [...FEATURED, ...RECENT].find((x) => x.id === id);
|
|
10
|
+
return (
|
|
11
|
+
<Screen title={tr('item.title', 'Item {id}', { id })} onBack={back} padded testID='page-item'>
|
|
12
|
+
<View style={{ gap: 12 }}>
|
|
13
|
+
<T kind='title' testID='item-title'>{found ? found.title : tr('item.title', 'Item {id}', { id })}</T>
|
|
14
|
+
<Card><T>{tr('item.body', 'Detail pages are normal routes (/item/[id]): deep links and the browser back button work, and the web server can render them.')}</T></Card>
|
|
15
|
+
</View>
|
|
16
|
+
</Screen>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const edition = Platform.select({ ios: 'iOS (UIKit)', android: 'Android', macos: 'macOS (AppKit)', windows: 'Windows (Win32)', web: 'Web' });
|
|
21
|
+
|
|
22
|
+
export const About = () => (
|
|
23
|
+
<Screen title={tr('nav.about', 'About')} onBack={back} testID='page-about'>
|
|
24
|
+
<View style={{ alignItems: 'center', padding: 32, gap: 12 }}>
|
|
25
|
+
<Icon name={icons.logo} size={64} color={col('primary')} />
|
|
26
|
+
<T kind='title'>{tr('app.name', 'Lupine Notes')}</T>
|
|
27
|
+
<T kind='secondary' style={{ textAlign: 'center' }}>{tr('app.tagline', 'One code base for iOS, Android, web and desktop')}</T>
|
|
28
|
+
<T style={{ textAlign: 'center', marginTop: 12 }}>{tr('about.text', 'Built with lupine.native. Edit src/pages to change the pages and src/shell for the frame.')}</T>
|
|
29
|
+
<T kind='caption' testID='about-edition'>{edition}</T>
|
|
30
|
+
</View>
|
|
31
|
+
</Screen>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const NotFound = () => (
|
|
35
|
+
<Screen title='404' onBack={back}>
|
|
36
|
+
<EmptyView icon={icons.search} title='Page not found' action={() => t('nav.home', 'Home')} onAction={() => router.navigate('/')} />
|
|
37
|
+
</Screen>
|
|
38
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { View } from 'lupine.native.core';
|
|
2
|
+
import { ActionSheet, Button, EmptyView, Header, router, Screen, t, Toast, tr } from 'lupine.native.components';
|
|
3
|
+
import * as icons from 'lupine.core/icons';
|
|
4
|
+
|
|
5
|
+
export const Discover = () => {
|
|
6
|
+
const create = async () => {
|
|
7
|
+
const options = [
|
|
8
|
+
{ label: t('discover.note', 'New note'), value: 'note', icon: icons.edit },
|
|
9
|
+
{ label: t('discover.photo', 'Take photo'), value: 'photo', icon: icons.camera },
|
|
10
|
+
{ label: t('discover.task', 'New task'), value: 'task', icon: icons.check },
|
|
11
|
+
];
|
|
12
|
+
const v = await ActionSheet.select({ title: t('discover.title', 'Create something'), options });
|
|
13
|
+
// a note: on the page of the notes (kept on the server)
|
|
14
|
+
if (v === 'note') return router.push('/notes');
|
|
15
|
+
if (v) Toast.success(t('discover.created', 'Created: {what}', { what: options.find((o) => o.value === v)!.label }));
|
|
16
|
+
};
|
|
17
|
+
return (
|
|
18
|
+
<Screen header={<Header title={tr('nav.discover', 'Create')} />} testID='page-discover'>
|
|
19
|
+
<View style={{ padding: 24, alignItems: 'center', gap: 16 }}>
|
|
20
|
+
<EmptyView icon={icons.plus} title={tr('discover.title', 'Create something')} />
|
|
21
|
+
<Button title={tr('discover.title', 'Create something')} kind='primary' icon={icons.plus} onPress={create} testID='create-button' />
|
|
22
|
+
</View>
|
|
23
|
+
</Screen>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createSignal, media, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { Button, Card, col, Header, Icon, Pager, router, Screen, SlidePanel, T, tr } from 'lupine.native.components';
|
|
3
|
+
import { createAppMenu } from '../shell/AppMenu';
|
|
4
|
+
import { FEATURED, RECENT } from '../shell/data';
|
|
5
|
+
import * as icons from 'lupine.core/icons';
|
|
6
|
+
|
|
7
|
+
export const Home = () => {
|
|
8
|
+
const menu = createAppMenu();
|
|
9
|
+
const [panel, setPanel] = createSignal(false);
|
|
10
|
+
// 2, 3 or 4 in a row, by css on the web: the page of the server is right at once
|
|
11
|
+
const width = media<`${number}%`>({ base: '48%', mobileAbove: '31%', tabletAbove: '23%' });
|
|
12
|
+
const shortcuts = [
|
|
13
|
+
{ id: 'notes', icon: icons.edit, label: tr('notes.title', 'My notes'), onPress: () => router.push('/notes') },
|
|
14
|
+
{ id: 'settings', icon: icons.settings, label: tr('nav.settings', 'Settings'), onPress: () => router.push('/settings') },
|
|
15
|
+
{ id: 'layers', icon: icons.layers, label: tr('home.openPanel', 'Open slide window'), onPress: () => setPanel(true) },
|
|
16
|
+
{ id: 'info', icon: icons.info, label: tr('nav.about', 'About'), onPress: () => router.push('/about') },
|
|
17
|
+
];
|
|
18
|
+
return (
|
|
19
|
+
<Screen header={<Header title={tr('nav.home', 'Home')} left={menu.button} />} testID='page-home'>
|
|
20
|
+
<View style={{ padding: 16, gap: 18 }}>
|
|
21
|
+
<View>
|
|
22
|
+
<T kind='secondary'>{tr('home.welcome', 'Welcome back')}</T>
|
|
23
|
+
<T kind='title' style={{ fontSize: 26 }} testID='app-name'>{tr('app.name', 'Lupine Notes')}</T>
|
|
24
|
+
</View>
|
|
25
|
+
|
|
26
|
+
<View style={{ gap: 8 }}>
|
|
27
|
+
<T kind='subtitle'>{tr('home.featured', 'Featured')}</T>
|
|
28
|
+
<Pager
|
|
29
|
+
height={150} testID='pager'
|
|
30
|
+
pages={FEATURED.map((f) => (
|
|
31
|
+
<View onPress={() => router.push(`/item/${f.id}`)} style={{ flex: 1, marginHorizontal: 2, borderRadius: 16, backgroundColor: f.color, padding: 18, justifyContent: 'flex-end' }}>
|
|
32
|
+
<Text style={{ color: '#ffffff', fontSize: 22, fontWeight: '700' }}>{f.title}</Text>
|
|
33
|
+
<Text style={{ color: '#ffffff', fontSize: 14 }}>{f.subtitle}</Text>
|
|
34
|
+
</View>
|
|
35
|
+
))}
|
|
36
|
+
/>
|
|
37
|
+
</View>
|
|
38
|
+
|
|
39
|
+
<View style={{ gap: 8 }}>
|
|
40
|
+
<T kind='subtitle'>{tr('home.shortcuts', 'Shortcuts')}</T>
|
|
41
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 10 }}>
|
|
42
|
+
{shortcuts.map((s) => (
|
|
43
|
+
<Card onPress={s.onPress} style={{ width, flexGrow: 1, alignItems: 'center', gap: 8, paddingVertical: 18 }} testID={`shortcut-${s.id}`}>
|
|
44
|
+
<View style={{ width: 44, height: 44, borderRadius: 12, alignItems: 'center', justifyContent: 'center', backgroundColor: col('primaryBg') }}>
|
|
45
|
+
<Icon name={s.icon} color={col('primary')} />
|
|
46
|
+
</View>
|
|
47
|
+
<T style={{ textAlign: 'center' }} numberOfLines={2}>{s.label}</T>
|
|
48
|
+
</Card>
|
|
49
|
+
))}
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
|
|
53
|
+
<View style={{ gap: 8 }}>
|
|
54
|
+
<T kind='subtitle'>{tr('home.recent', 'Recent items')}</T>
|
|
55
|
+
{RECENT.map((r) => (
|
|
56
|
+
<Card onPress={() => router.push(`/item/${r.id}`)} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }} testID={`recent-${r.id}`}>
|
|
57
|
+
<Icon name={r.icon} color={col('textSecondary')} />
|
|
58
|
+
<View style={{ flex: 1 }}>
|
|
59
|
+
<T>{r.title}</T>
|
|
60
|
+
<T kind='caption'>{r.when}</T>
|
|
61
|
+
</View>
|
|
62
|
+
<Icon name={icons.chevronRight} size={16} color={col('textTertiary')} />
|
|
63
|
+
</Card>
|
|
64
|
+
))}
|
|
65
|
+
</View>
|
|
66
|
+
</View>
|
|
67
|
+
{menu.menu}
|
|
68
|
+
<SlidePanel visible={panel} onClose={() => setPanel(false)} title={tr('home.openPanel', 'Open slide window')} testID='home-panel'>
|
|
69
|
+
<View style={{ padding: 20, gap: 16 }}>
|
|
70
|
+
<T>{tr('home.panelText', 'This window slides in over the current page — use it for details and forms that do not need their own URL.')}</T>
|
|
71
|
+
<Button title={tr('ln.close', 'Close')} kind='primary' onPress={() => setPanel(false)} testID='panel-close' />
|
|
72
|
+
</View>
|
|
73
|
+
</SlidePanel>
|
|
74
|
+
</Screen>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createMemo, createSignal, For, insets, ScrollView, Show, Text, View } from 'lupine.native.core';
|
|
2
|
+
import { Avatar, col, EmptyView, Header, IconButton, Line, t, Toast, tr } from 'lupine.native.components';
|
|
3
|
+
import { MESSAGES } from '../shell/data';
|
|
4
|
+
import * as icons from 'lupine.core/icons';
|
|
5
|
+
|
|
6
|
+
const [items, setItems] = createSignal(MESSAGES);
|
|
7
|
+
export const unread = createMemo(() => items().filter((m) => m.unread).length);
|
|
8
|
+
|
|
9
|
+
export const Inbox = () => {
|
|
10
|
+
const [refreshing, setRefreshing] = createSignal(false);
|
|
11
|
+
const refresh = () => {
|
|
12
|
+
setRefreshing(true);
|
|
13
|
+
setTimeout(() => setRefreshing(false), 800);
|
|
14
|
+
};
|
|
15
|
+
const markRead = () => {
|
|
16
|
+
setItems((l) => l.map((m) => (m.unread ? { ...m, unread: false } : m)));
|
|
17
|
+
Toast.success(t('inbox.markRead', 'Mark all as read'));
|
|
18
|
+
};
|
|
19
|
+
return (
|
|
20
|
+
<View testID='page-inbox' style={{ flex: 1, backgroundColor: col('bg') }}>
|
|
21
|
+
<Header title={tr('nav.inbox', 'Inbox')} right={<IconButton name={icons.check} onPress={markRead} testID='mark-read' />} />
|
|
22
|
+
<Show when={() => unread() > 0}>
|
|
23
|
+
<Text testID='unread' style={{ paddingHorizontal: 16, paddingTop: 10, color: col('textSecondary') }}>{() => t('inbox.unread', '{n} unread', { n: unread() })}</Text>
|
|
24
|
+
</Show>
|
|
25
|
+
<ScrollView style={{ flex: 1 }} refreshing={refreshing} onRefresh={refresh}>
|
|
26
|
+
<View style={{ paddingBottom: () => insets().bottom }}>
|
|
27
|
+
<For each={items} fallback={<EmptyView title={tr('inbox.empty', 'You are all caught up')} />}>
|
|
28
|
+
{(m) => (
|
|
29
|
+
<View>
|
|
30
|
+
<View style={{ flexDirection: 'row', gap: 12, paddingHorizontal: 16, paddingVertical: 12 }}>
|
|
31
|
+
<Avatar name={m.from} />
|
|
32
|
+
<View style={{ flex: 1 }}>
|
|
33
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
34
|
+
<Text style={{ fontSize: 16, fontWeight: m.unread ? '700' : 'normal', color: col('text') }}>{m.from}</Text>
|
|
35
|
+
<Text style={{ fontSize: 12, color: col('textTertiary') }}>{m.when}</Text>
|
|
36
|
+
</View>
|
|
37
|
+
<Text numberOfLines={2} style={{ fontSize: 14, color: col('textSecondary') }}>{m.text}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
{m.unread && <View style={{ width: 8, height: 8, borderRadius: 4, marginTop: 8, backgroundColor: col('primary') }} />}
|
|
40
|
+
</View>
|
|
41
|
+
<Line />
|
|
42
|
+
</View>
|
|
43
|
+
)}
|
|
44
|
+
</For>
|
|
45
|
+
</View>
|
|
46
|
+
</ScrollView>
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
};
|