@huberyyang/create-todo-vue 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/dist/index.js +49 -63
- package/package.json +21 -24
- package/template-vitesse-base/.dockerignore +0 -2
- package/template-vitesse-base/.editorconfig +0 -9
- package/template-vitesse-base/.github/FUNDING.yml +0 -2
- package/template-vitesse-base/.github/workflows/ci.yml +0 -96
- package/template-vitesse-base/.vscode/extensions.json +0 -13
- package/template-vitesse-base/.vscode/settings.json +0 -48
- package/template-vitesse-base/Dockerfile +0 -18
- package/template-vitesse-base/LICENSE +0 -21
- package/template-vitesse-base/README.md +0 -216
- package/template-vitesse-base/README.zh-CN.md +0 -185
- package/template-vitesse-base/_gitignore +0 -11
- package/template-vitesse-base/cypress/e2e/basic.spec.ts +0 -36
- package/template-vitesse-base/cypress/tsconfig.json +0 -12
- package/template-vitesse-base/cypress.config.ts +0 -14
- package/template-vitesse-base/eslint.config.js +0 -10
- package/template-vitesse-base/index.html +0 -23
- package/template-vitesse-base/locales/README.md +0 -7
- package/template-vitesse-base/locales/ar.yml +0 -14
- package/template-vitesse-base/locales/de.yml +0 -14
- package/template-vitesse-base/locales/en.yml +0 -14
- package/template-vitesse-base/locales/es.yml +0 -14
- package/template-vitesse-base/locales/fr.yml +0 -14
- package/template-vitesse-base/locales/id.yml +0 -14
- package/template-vitesse-base/locales/it.yml +0 -13
- package/template-vitesse-base/locales/ja.yml +0 -13
- package/template-vitesse-base/locales/ka.yml +0 -14
- package/template-vitesse-base/locales/ko.yml +0 -13
- package/template-vitesse-base/locales/pl.yml +0 -14
- package/template-vitesse-base/locales/pt-BR.yml +0 -14
- package/template-vitesse-base/locales/ru.yml +0 -13
- package/template-vitesse-base/locales/tr.yml +0 -14
- package/template-vitesse-base/locales/uk.yml +0 -13
- package/template-vitesse-base/locales/uz.yml +0 -14
- package/template-vitesse-base/locales/vi.yml +0 -13
- package/template-vitesse-base/locales/zh-CN.yml +0 -14
- package/template-vitesse-base/netlify.toml +0 -17
- package/template-vitesse-base/package.json +0 -81
- package/template-vitesse-base/public/_headers +0 -3
- package/template-vitesse-base/public/favicon-dark.svg +0 -3
- package/template-vitesse-base/public/favicon.svg +0 -3
- package/template-vitesse-base/public/pwa-192x192.png +0 -0
- package/template-vitesse-base/public/pwa-512x512.png +0 -0
- package/template-vitesse-base/public/safari-pinned-tab.svg +0 -41
- package/template-vitesse-base/src/App.vue +0 -29
- package/template-vitesse-base/src/auto-imports.d.ts +0 -624
- package/template-vitesse-base/src/components/README.md +0 -9
- package/template-vitesse-base/src/components/TheCounter.vue +0 -19
- package/template-vitesse-base/src/components/TheFooter.vue +0 -37
- package/template-vitesse-base/src/components/TheInput.vue +0 -20
- package/template-vitesse-base/src/components.d.ts +0 -17
- package/template-vitesse-base/src/composables/dark.ts +0 -4
- package/template-vitesse-base/src/layouts/404.vue +0 -21
- package/template-vitesse-base/src/layouts/README.md +0 -14
- package/template-vitesse-base/src/layouts/default.vue +0 -12
- package/template-vitesse-base/src/layouts/home.vue +0 -12
- package/template-vitesse-base/src/main.ts +0 -25
- package/template-vitesse-base/src/modules/README.md +0 -11
- package/template-vitesse-base/src/modules/i18n.ts +0 -50
- package/template-vitesse-base/src/modules/nprogress.ts +0 -14
- package/template-vitesse-base/src/modules/pinia.ts +0 -17
- package/template-vitesse-base/src/modules/pwa.ts +0 -14
- package/template-vitesse-base/src/pages/README.md +0 -20
- package/template-vitesse-base/src/pages/[...all].vue +0 -14
- package/template-vitesse-base/src/pages/about.md +0 -26
- package/template-vitesse-base/src/pages/hi/[name].vue +0 -50
- package/template-vitesse-base/src/pages/index.vue +0 -59
- package/template-vitesse-base/src/shims.d.ts +0 -18
- package/template-vitesse-base/src/stores/user.ts +0 -34
- package/template-vitesse-base/src/styles/main.css +0 -29
- package/template-vitesse-base/src/styles/markdown.css +0 -25
- package/template-vitesse-base/src/typed-router.d.ts +0 -27
- package/template-vitesse-base/src/types.ts +0 -3
- package/template-vitesse-base/test/__snapshots__/component.test.ts.snap +0 -3
- package/template-vitesse-base/test/basic.test.ts +0 -7
- package/template-vitesse-base/test/component.test.ts +0 -28
- package/template-vitesse-base/tsconfig.json +0 -38
- package/template-vitesse-base/uno.config.ts +0 -41
- package/template-vitesse-base/vite.config.ts +0 -167
- package/template-vitesse-lite/.editorconfig +0 -9
- package/template-vitesse-lite/.github/FUNDING.yml +0 -2
- package/template-vitesse-lite/.github/workflows/test.yml +0 -47
- package/template-vitesse-lite/.vscode/extensions.json +0 -11
- package/template-vitesse-lite/.vscode/settings.json +0 -48
- package/template-vitesse-lite/LICENSE +0 -21
- package/template-vitesse-lite/README.md +0 -86
- package/template-vitesse-lite/README.zh-CN.md +0 -87
- package/template-vitesse-lite/_gitignore +0 -9
- package/template-vitesse-lite/auto-imports.d.ts +0 -603
- package/template-vitesse-lite/components.d.ts +0 -17
- package/template-vitesse-lite/eslint.config.js +0 -9
- package/template-vitesse-lite/index.html +0 -25
- package/template-vitesse-lite/netlify.toml +0 -11
- package/template-vitesse-lite/package.json +0 -53
- package/template-vitesse-lite/public/favicon.svg +0 -9
- package/template-vitesse-lite/shims.d.ts +0 -6
- package/template-vitesse-lite/src/App.vue +0 -6
- package/template-vitesse-lite/src/components/README.md +0 -9
- package/template-vitesse-lite/src/components/TheCounter.vue +0 -19
- package/template-vitesse-lite/src/components/TheFooter.vue +0 -15
- package/template-vitesse-lite/src/components/TheInput.vue +0 -18
- package/template-vitesse-lite/src/composables/dark.ts +0 -2
- package/template-vitesse-lite/src/composables/index.ts +0 -1
- package/template-vitesse-lite/src/main.ts +0 -15
- package/template-vitesse-lite/src/pages/README.md +0 -20
- package/template-vitesse-lite/src/pages/[...all].vue +0 -5
- package/template-vitesse-lite/src/pages/hi/[name].vue +0 -22
- package/template-vitesse-lite/src/pages/index.vue +0 -46
- package/template-vitesse-lite/src/styles/main.css +0 -11
- package/template-vitesse-lite/test/__snapshots__/component.test.ts.snap +0 -3
- package/template-vitesse-lite/test/basic.test.ts +0 -7
- package/template-vitesse-lite/test/component.test.ts +0 -22
- package/template-vitesse-lite/tsconfig.json +0 -32
- package/template-vitesse-lite/typed-router.d.ts +0 -25
- package/template-vitesse-lite/uno.config.ts +0 -29
- package/template-vitesse-lite/vite.config.ts +0 -68
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
## Components
|
|
2
|
-
|
|
3
|
-
Components in this dir will be auto-registered and on-demand, powered by [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components).
|
|
4
|
-
|
|
5
|
-
### Icons
|
|
6
|
-
|
|
7
|
-
You can use icons from almost any icon sets by the power of [Iconify](https://iconify.design/).
|
|
8
|
-
|
|
9
|
-
It will only bundle the icons you use. Check out [`unplugin-icons`](https://github.com/antfu/unplugin-icons) for more details.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const props = defineProps<{
|
|
3
|
-
initial: number
|
|
4
|
-
}>()
|
|
5
|
-
|
|
6
|
-
const { count, inc, dec } = useCounter(props.initial)
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<div>
|
|
11
|
-
{{ count }}
|
|
12
|
-
<button class="inc" @click="inc()">
|
|
13
|
-
+
|
|
14
|
-
</button>
|
|
15
|
-
<button class="dec" @click="dec()">
|
|
16
|
-
-
|
|
17
|
-
</button>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { availableLocales, loadLanguageAsync } from '~/modules/i18n'
|
|
3
|
-
|
|
4
|
-
const { t, locale } = useI18n()
|
|
5
|
-
|
|
6
|
-
async function toggleLocales() {
|
|
7
|
-
// change to some real logic
|
|
8
|
-
const locales = availableLocales
|
|
9
|
-
const newLocale = locales[(locales.indexOf(locale.value) + 1) % locales.length]
|
|
10
|
-
await loadLanguageAsync(newLocale)
|
|
11
|
-
locale.value = newLocale
|
|
12
|
-
}
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<nav flex="~ gap-4" mt-6 justify-center text-xl>
|
|
17
|
-
<RouterLink icon-btn to="/" :title="t('button.home')">
|
|
18
|
-
<div i-carbon-campsite />
|
|
19
|
-
</RouterLink>
|
|
20
|
-
|
|
21
|
-
<button icon-btn :title="t('button.toggle_dark')" @click="toggleDark()">
|
|
22
|
-
<div i="carbon-sun dark:carbon-moon" />
|
|
23
|
-
</button>
|
|
24
|
-
|
|
25
|
-
<a icon-btn :title="t('button.toggle_langs')" @click="toggleLocales()">
|
|
26
|
-
<div i-carbon-language />
|
|
27
|
-
</a>
|
|
28
|
-
|
|
29
|
-
<RouterLink icon-btn to="/about" :title="t('button.about')" data-test-id="about">
|
|
30
|
-
<div i-carbon-dicom-overlay />
|
|
31
|
-
</RouterLink>
|
|
32
|
-
|
|
33
|
-
<a icon-btn rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank" title="GitHub">
|
|
34
|
-
<div i-carbon-logo-github />
|
|
35
|
-
</a>
|
|
36
|
-
</nav>
|
|
37
|
-
</template>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const { modelValue } = defineModels<{
|
|
3
|
-
modelValue: string
|
|
4
|
-
}>()
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<template>
|
|
8
|
-
<input
|
|
9
|
-
id="input"
|
|
10
|
-
v-model="modelValue"
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
type="text"
|
|
13
|
-
p="x-4 y-2"
|
|
14
|
-
w="250px"
|
|
15
|
-
text="center"
|
|
16
|
-
bg="transparent"
|
|
17
|
-
border="~ rounded gray-200 dark:gray-700"
|
|
18
|
-
outline="none active:none"
|
|
19
|
-
>
|
|
20
|
-
</template>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
// Generated by unplugin-vue-components
|
|
4
|
-
// Read more: https://github.com/vuejs/core/pull/3399
|
|
5
|
-
export {}
|
|
6
|
-
|
|
7
|
-
/* prettier-ignore */
|
|
8
|
-
declare module 'vue' {
|
|
9
|
-
export interface GlobalComponents {
|
|
10
|
-
README: typeof import('./components/README.md')['default']
|
|
11
|
-
RouterLink: typeof import('vue-router')['RouterLink']
|
|
12
|
-
RouterView: typeof import('vue-router')['RouterView']
|
|
13
|
-
TheCounter: typeof import('./components/TheCounter.vue')['default']
|
|
14
|
-
TheFooter: typeof import('./components/TheFooter.vue')['default']
|
|
15
|
-
TheInput: typeof import('./components/TheInput.vue')['default']
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const router = useRouter()
|
|
3
|
-
const { t } = useI18n()
|
|
4
|
-
useHead({
|
|
5
|
-
title: () => t('not-found'),
|
|
6
|
-
})
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<main p="x4 y10" text="center teal-700 dark:gray-200">
|
|
11
|
-
<div text-4xl>
|
|
12
|
-
<div i-carbon-warning inline-block />
|
|
13
|
-
</div>
|
|
14
|
-
<RouterView />
|
|
15
|
-
<div>
|
|
16
|
-
<button text-sm btn m="3 t8" @click="router.back()">
|
|
17
|
-
{{ t('button.back') }}
|
|
18
|
-
</button>
|
|
19
|
-
</div>
|
|
20
|
-
</main>
|
|
21
|
-
</template>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
## Layouts
|
|
2
|
-
|
|
3
|
-
Vue components in this dir are used as layouts.
|
|
4
|
-
|
|
5
|
-
By default, `default.vue` will be used unless an alternative is specified in the route meta.
|
|
6
|
-
|
|
7
|
-
With [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) and [`vite-plugin-vue-layouts`](https://github.com/JohnCampionJr/vite-plugin-vue-layouts), you can specify the layout in the page's SFCs like this:
|
|
8
|
-
|
|
9
|
-
```vue
|
|
10
|
-
<route lang="yaml">
|
|
11
|
-
meta:
|
|
12
|
-
layout: home
|
|
13
|
-
</route>
|
|
14
|
-
```
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { UserModule } from './types'
|
|
2
|
-
|
|
3
|
-
import { setupLayouts } from 'virtual:generated-layouts'
|
|
4
|
-
import { ViteSSG } from 'vite-ssg'
|
|
5
|
-
import { routes } from 'vue-router/auto-routes'
|
|
6
|
-
import App from './App.vue'
|
|
7
|
-
|
|
8
|
-
import '@unocss/reset/tailwind.css'
|
|
9
|
-
import './styles/main.css'
|
|
10
|
-
import 'uno.css'
|
|
11
|
-
|
|
12
|
-
// https://github.com/antfu/vite-ssg
|
|
13
|
-
export const createApp = ViteSSG(
|
|
14
|
-
App,
|
|
15
|
-
{
|
|
16
|
-
routes: setupLayouts(routes),
|
|
17
|
-
base: import.meta.env.BASE_URL,
|
|
18
|
-
},
|
|
19
|
-
(ctx) => {
|
|
20
|
-
// install all modules under `modules/`
|
|
21
|
-
Object.values(import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }))
|
|
22
|
-
.forEach(i => i.install?.(ctx))
|
|
23
|
-
// ctx.app.use(Previewer)
|
|
24
|
-
},
|
|
25
|
-
)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
## Modules
|
|
2
|
-
|
|
3
|
-
A custom user module system. Place a `.ts` file with the following template, it will be installed automatically.
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
import type { UserModule } from '~/types'
|
|
7
|
-
|
|
8
|
-
export const install: UserModule = ({ app, router, isClient }) => {
|
|
9
|
-
// do something
|
|
10
|
-
}
|
|
11
|
-
```
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Locale } from 'vue-i18n'
|
|
2
|
-
import type { UserModule } from '~/types'
|
|
3
|
-
import { createI18n } from 'vue-i18n'
|
|
4
|
-
|
|
5
|
-
// Import i18n resources
|
|
6
|
-
// https://vitejs.dev/guide/features.html#glob-import
|
|
7
|
-
//
|
|
8
|
-
// Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
|
|
9
|
-
const i18n = createI18n({
|
|
10
|
-
legacy: false,
|
|
11
|
-
locale: '',
|
|
12
|
-
messages: {},
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const localesMap = Object.fromEntries(
|
|
16
|
-
Object.entries(import.meta.glob('../../locales/*.yml'))
|
|
17
|
-
.map(([path, loadLocale]) => [path.match(/([\w-]*)\.yml$/)?.[1], loadLocale]),
|
|
18
|
-
) as Record<Locale, () => Promise<{ default: Record<string, string> }>>
|
|
19
|
-
|
|
20
|
-
export const availableLocales = Object.keys(localesMap)
|
|
21
|
-
|
|
22
|
-
const loadedLanguages: string[] = []
|
|
23
|
-
|
|
24
|
-
function setI18nLanguage(lang: Locale) {
|
|
25
|
-
i18n.global.locale.value = lang as any
|
|
26
|
-
if (typeof document !== 'undefined')
|
|
27
|
-
document.querySelector('html')?.setAttribute('lang', lang)
|
|
28
|
-
return lang
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function loadLanguageAsync(lang: string): Promise<Locale> {
|
|
32
|
-
// If the same language
|
|
33
|
-
if (i18n.global.locale.value === lang)
|
|
34
|
-
return setI18nLanguage(lang)
|
|
35
|
-
|
|
36
|
-
// If the language was already loaded
|
|
37
|
-
if (loadedLanguages.includes(lang))
|
|
38
|
-
return setI18nLanguage(lang)
|
|
39
|
-
|
|
40
|
-
// If the language hasn't been loaded yet
|
|
41
|
-
const messages = await localesMap[lang]()
|
|
42
|
-
i18n.global.setLocaleMessage(lang, messages.default)
|
|
43
|
-
loadedLanguages.push(lang)
|
|
44
|
-
return setI18nLanguage(lang)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const install: UserModule = ({ app }) => {
|
|
48
|
-
app.use(i18n)
|
|
49
|
-
loadLanguageAsync('en')
|
|
50
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { UserModule } from '~/types'
|
|
2
|
-
import NProgress from 'nprogress'
|
|
3
|
-
|
|
4
|
-
export const install: UserModule = ({ isClient, router }) => {
|
|
5
|
-
if (isClient) {
|
|
6
|
-
router.beforeEach((to, from) => {
|
|
7
|
-
if (to.path !== from.path)
|
|
8
|
-
NProgress.start()
|
|
9
|
-
})
|
|
10
|
-
router.afterEach(() => {
|
|
11
|
-
NProgress.done()
|
|
12
|
-
})
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { UserModule } from '~/types'
|
|
2
|
-
import { createPinia } from 'pinia'
|
|
3
|
-
|
|
4
|
-
// Setup Pinia
|
|
5
|
-
// https://pinia.vuejs.org/
|
|
6
|
-
export const install: UserModule = ({ isClient, initialState, app }) => {
|
|
7
|
-
const pinia = createPinia()
|
|
8
|
-
app.use(pinia)
|
|
9
|
-
// Refer to
|
|
10
|
-
// https://github.com/antfu/vite-ssg/blob/main/README.md#state-serialization
|
|
11
|
-
// for other serialization strategies.
|
|
12
|
-
if (isClient)
|
|
13
|
-
pinia.state.value = (initialState.pinia) || {}
|
|
14
|
-
|
|
15
|
-
else
|
|
16
|
-
initialState.pinia = pinia.state.value
|
|
17
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { UserModule } from '~/types'
|
|
2
|
-
|
|
3
|
-
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
|
|
4
|
-
export const install: UserModule = ({ isClient, router }) => {
|
|
5
|
-
if (!isClient)
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
router.isReady()
|
|
9
|
-
.then(async () => {
|
|
10
|
-
const { registerSW } = await import('virtual:pwa-register')
|
|
11
|
-
registerSW({ immediate: true })
|
|
12
|
-
})
|
|
13
|
-
.catch(() => {})
|
|
14
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
## File-based Routing
|
|
2
|
-
|
|
3
|
-
Routes will be auto-generated for Vue files in this dir with the same file structure.
|
|
4
|
-
Check out [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) for more details.
|
|
5
|
-
|
|
6
|
-
### Path Aliasing
|
|
7
|
-
|
|
8
|
-
`~/` is aliased to `./src/` folder.
|
|
9
|
-
|
|
10
|
-
For example, instead of having
|
|
11
|
-
|
|
12
|
-
```ts
|
|
13
|
-
import { isDark } from '../../../../composables'
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
now, you can use
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
import { isDark } from '~/composables'
|
|
20
|
-
```
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: About
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<script setup>
|
|
6
|
-
const { t } = useI18n()
|
|
7
|
-
useHead({ title: () => t('button.about') })
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<div class="text-center">
|
|
11
|
-
<!-- You can use Vue components inside markdown -->
|
|
12
|
-
<div i-carbon-dicom-overlay class="text-4xl -mb-6 m-auto" />
|
|
13
|
-
<h3>{{ t('button.about') }}</h3>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
[Vitesse](https://github.com/antfu/vitesse) is an opinionated [Vite](https://github.com/vitejs/vite) starter template made by [@antfu](https://github.com/antfu) for mocking apps swiftly. With **file-based routing**, **components auto importing**, **markdown support**, I18n, PWA and uses **UnoCSS** for styling and icons.
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
// syntax highlighting example
|
|
20
|
-
function vitesse() {
|
|
21
|
-
const foo = 'bar'
|
|
22
|
-
console.log(foo)
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Check out the [GitHub repo](https://github.com/antfu/vitesse) for more details.
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const router = useRouter()
|
|
3
|
-
const route = useRoute('/hi/[name]')
|
|
4
|
-
const user = useUserStore()
|
|
5
|
-
const { t } = useI18n()
|
|
6
|
-
|
|
7
|
-
watchEffect(() => {
|
|
8
|
-
user.setNewName(route.params.name)
|
|
9
|
-
})
|
|
10
|
-
useHead({
|
|
11
|
-
title: () => t('intro.hi', { name: user.savedName }),
|
|
12
|
-
})
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<div>
|
|
17
|
-
<div text-4xl>
|
|
18
|
-
<div i-carbon-pedestrian inline-block />
|
|
19
|
-
</div>
|
|
20
|
-
<p>
|
|
21
|
-
{{ t('intro.hi', { name: user.savedName }) }}
|
|
22
|
-
</p>
|
|
23
|
-
|
|
24
|
-
<p text-sm opacity-75>
|
|
25
|
-
<em>{{ t('intro.dynamic-route') }}</em>
|
|
26
|
-
</p>
|
|
27
|
-
|
|
28
|
-
<template v-if="user.otherNames.length">
|
|
29
|
-
<div mt-4 text-sm>
|
|
30
|
-
<span opacity-75>{{ t('intro.aka') }}:</span>
|
|
31
|
-
<ul>
|
|
32
|
-
<li v-for="otherName in user.otherNames" :key="otherName">
|
|
33
|
-
<RouterLink :to="`/hi/${otherName}`" replace>
|
|
34
|
-
{{ otherName }}
|
|
35
|
-
</RouterLink>
|
|
36
|
-
</li>
|
|
37
|
-
</ul>
|
|
38
|
-
</div>
|
|
39
|
-
</template>
|
|
40
|
-
|
|
41
|
-
<div>
|
|
42
|
-
<button
|
|
43
|
-
m="3 t6" text-sm btn
|
|
44
|
-
@click="router.back()"
|
|
45
|
-
>
|
|
46
|
-
{{ t('button.back') }}
|
|
47
|
-
</button>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineOptions({
|
|
3
|
-
name: 'IndexPage',
|
|
4
|
-
})
|
|
5
|
-
const user = useUserStore()
|
|
6
|
-
const name = ref(user.savedName)
|
|
7
|
-
|
|
8
|
-
const router = useRouter()
|
|
9
|
-
function go() {
|
|
10
|
-
if (name.value)
|
|
11
|
-
router.push(`/hi/${encodeURIComponent(name.value)}`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { t } = useI18n()
|
|
15
|
-
useHead({
|
|
16
|
-
title: () => t('button.home'),
|
|
17
|
-
})
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<template>
|
|
21
|
-
<div>
|
|
22
|
-
<div text-4xl>
|
|
23
|
-
<div i-carbon-campsite inline-block />
|
|
24
|
-
</div>
|
|
25
|
-
<p>
|
|
26
|
-
<a rel="noreferrer" href="https://github.com/antfu/vitesse" target="_blank">
|
|
27
|
-
Vitesse
|
|
28
|
-
</a>
|
|
29
|
-
</p>
|
|
30
|
-
<p>
|
|
31
|
-
<em text-sm opacity-75>{{ t('intro.desc') }}</em>
|
|
32
|
-
</p>
|
|
33
|
-
|
|
34
|
-
<div py-4 />
|
|
35
|
-
|
|
36
|
-
<TheInput
|
|
37
|
-
v-model="name"
|
|
38
|
-
:placeholder="t('intro.whats-your-name')"
|
|
39
|
-
autocomplete="false"
|
|
40
|
-
@keydown.enter="go"
|
|
41
|
-
/>
|
|
42
|
-
<label class="hidden" for="input">{{ t('intro.whats-your-name') }}</label>
|
|
43
|
-
|
|
44
|
-
<div>
|
|
45
|
-
<button
|
|
46
|
-
m-3 text-sm btn
|
|
47
|
-
:disabled="!name"
|
|
48
|
-
@click="go"
|
|
49
|
-
>
|
|
50
|
-
{{ t('button.go') }}
|
|
51
|
-
</button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
|
|
56
|
-
<route lang="yaml">
|
|
57
|
-
meta:
|
|
58
|
-
layout: home
|
|
59
|
-
</route>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare interface Window {
|
|
2
|
-
// extend the window
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
// with unplugin-vue-markdown, markdown files can be treated as Vue components
|
|
6
|
-
declare module '*.md' {
|
|
7
|
-
import type { DefineComponent } from 'vue'
|
|
8
|
-
|
|
9
|
-
const component: DefineComponent<object, object, any>
|
|
10
|
-
export default component
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module '*.vue' {
|
|
14
|
-
import type { DefineComponent } from 'vue'
|
|
15
|
-
|
|
16
|
-
const component: DefineComponent<object, object, any>
|
|
17
|
-
export default component
|
|
18
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
2
|
-
|
|
3
|
-
export const useUserStore = defineStore('user', () => {
|
|
4
|
-
/**
|
|
5
|
-
* Current name of the user.
|
|
6
|
-
*/
|
|
7
|
-
const savedName = ref('')
|
|
8
|
-
const previousNames = ref(new Set<string>())
|
|
9
|
-
|
|
10
|
-
const usedNames = computed(() => Array.from(previousNames.value))
|
|
11
|
-
const otherNames = computed(() => usedNames.value.filter(name => name !== savedName.value))
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Changes the current name of the user and saves the one that was used
|
|
15
|
-
* before.
|
|
16
|
-
*
|
|
17
|
-
* @param name - new name to set
|
|
18
|
-
*/
|
|
19
|
-
function setNewName(name: string) {
|
|
20
|
-
if (savedName.value)
|
|
21
|
-
previousNames.value.add(savedName.value)
|
|
22
|
-
|
|
23
|
-
savedName.value = name
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
setNewName,
|
|
28
|
-
otherNames,
|
|
29
|
-
savedName,
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
if (import.meta.hot)
|
|
34
|
-
import.meta.hot.accept(acceptHMRUpdate(useUserStore as any, import.meta.hot))
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
@import './markdown.css';
|
|
2
|
-
|
|
3
|
-
html,
|
|
4
|
-
body,
|
|
5
|
-
#app {
|
|
6
|
-
height: 100%;
|
|
7
|
-
margin: 0;
|
|
8
|
-
padding: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
html.dark {
|
|
12
|
-
background: #121212;
|
|
13
|
-
color-scheme: dark;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#nprogress {
|
|
17
|
-
pointer-events: none;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#nprogress .bar {
|
|
21
|
-
background: rgb(13, 148, 136);
|
|
22
|
-
opacity: 0.75;
|
|
23
|
-
position: fixed;
|
|
24
|
-
z-index: 1031;
|
|
25
|
-
top: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: 2px;
|
|
29
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.prose pre:not(.shiki) {
|
|
2
|
-
padding: 0;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.prose .shiki {
|
|
6
|
-
font-family: 'DM Mono', monospace;
|
|
7
|
-
font-size: 1.2em;
|
|
8
|
-
line-height: 1.4;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.prose img {
|
|
12
|
-
width: 100%;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.shiki,
|
|
16
|
-
.shiki span {
|
|
17
|
-
color: var(--shiki-light);
|
|
18
|
-
background: var(--shiki-light-bg);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
html.dark .shiki,
|
|
22
|
-
html.dark .shiki span {
|
|
23
|
-
color: var(--shiki-dark);
|
|
24
|
-
background: var(--shiki-dark-bg);
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
// Generated by unplugin-vue-router. ‼️ DO NOT MODIFY THIS FILE ‼️
|
|
5
|
-
// It's recommended to commit this file.
|
|
6
|
-
// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.
|
|
7
|
-
|
|
8
|
-
declare module 'vue-router/auto-routes' {
|
|
9
|
-
import type {
|
|
10
|
-
RouteRecordInfo,
|
|
11
|
-
ParamValue,
|
|
12
|
-
ParamValueOneOrMore,
|
|
13
|
-
ParamValueZeroOrMore,
|
|
14
|
-
ParamValueZeroOrOne,
|
|
15
|
-
} from 'vue-router'
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Route name map generated by unplugin-vue-router
|
|
19
|
-
*/
|
|
20
|
-
export interface RouteNamedMap {
|
|
21
|
-
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
|
|
22
|
-
'/[...all]': RouteRecordInfo<'/[...all]', '/:all(.*)', { all: ParamValue<true> }, { all: ParamValue<false> }>,
|
|
23
|
-
'/about': RouteRecordInfo<'/about', '/about', Record<never, never>, Record<never, never>>,
|
|
24
|
-
'/hi/[name]': RouteRecordInfo<'/hi/[name]', '/hi/:name', { name: ParamValue<true> }, { name: ParamValue<false> }>,
|
|
25
|
-
'/README': RouteRecordInfo<'/README', '/README', Record<never, never>, Record<never, never>>,
|
|
26
|
-
}
|
|
27
|
-
}
|