-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
11,259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: YunYouJun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: pnpm | ||
|
||
- name: Install | ||
run: pnpm install | ||
|
||
- name: Lint | ||
run: pnpm run lint | ||
|
||
typecheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: pnpm | ||
|
||
- name: Install | ||
run: pnpm install | ||
|
||
- name: Typecheck | ||
run: pnpm run typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
*.log | ||
dist | ||
.output | ||
.nuxt | ||
.env | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
shamefully-hoist=true | ||
strict-peer-dependencies=false | ||
shell-emulator=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"installDependencies": true, | ||
"startCommand": "npm run dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"recommendations": [ | ||
"antfu.iconify", | ||
"antfu.unocss", | ||
"antfu.goto-alias", | ||
"csstools.postcss", | ||
"dbaeumer.vscode-eslint", | ||
"vue.volar" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"files.associations": { | ||
"*.css": "postcss" | ||
}, | ||
|
||
// Enable the ESlint flat config support | ||
"eslint.experimental.useFlatConfig": true, | ||
|
||
// Disable the default formatter, use eslint instead | ||
"prettier.enable": false, | ||
"editor.formatOnSave": false, | ||
|
||
// Auto fix | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "never" | ||
}, | ||
|
||
// Silent the stylistic rules in you IDE, but still auto fix them | ||
"eslint.rules.customizations": [ | ||
{ "rule": "style/*", "severity": "off" }, | ||
{ "rule": "*-indent", "severity": "off" }, | ||
{ "rule": "*-spacing", "severity": "off" }, | ||
{ "rule": "*-spaces", "severity": "off" }, | ||
{ "rule": "*-order", "severity": "off" }, | ||
{ "rule": "*-dangle", "severity": "off" }, | ||
{ "rule": "*-newline", "severity": "off" }, | ||
{ "rule": "*quotes", "severity": "off" }, | ||
{ "rule": "*semi", "severity": "off" } | ||
], | ||
|
||
// Enable eslint for all supported languages | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"html", | ||
"markdown", | ||
"json", | ||
"jsonc", | ||
"yaml" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# AI Couplets - AI 对联/春联 | ||
|
||
## Dev | ||
|
||
```bash | ||
pnpm i | ||
pnpm dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup lang="ts"> | ||
import { appName } from '~/constants' | ||
useHead({ | ||
title: appName, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<VitePwaManifest /> | ||
<NuxtLayout> | ||
<NuxtPage /> | ||
</NuxtLayout> | ||
</template> | ||
|
||
<style> | ||
html, | ||
body, | ||
#__nuxt { | ||
height: 100vh; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
html.dark { | ||
background: #222; | ||
color: white; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang='ts'> | ||
const { count, inc, dec } = useCount() | ||
</script> | ||
|
||
<template> | ||
<div inline-flex m="y-3"> | ||
<button rounded-full p-2 btn @click="dec()"> | ||
<div i-carbon-subtract /> | ||
</button> | ||
<div font="mono" w="15" m-auto inline-block> | ||
{{ count }} | ||
</div> | ||
<button rounded-full p-2 btn @click="inc()"> | ||
<div i-carbon-add /> | ||
</button> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup lang="ts"> | ||
const color = useColorMode() | ||
useHead({ | ||
meta: [{ | ||
id: 'theme-color', | ||
name: 'theme-color', | ||
content: () => color.value === 'dark' ? '#222222' : '#ffffff', | ||
}], | ||
}) | ||
function toggleDark() { | ||
color.preference = color.value === 'dark' ? 'light' : 'dark' | ||
} | ||
</script> | ||
|
||
<template> | ||
<button class="!outline-none" @click="toggleDark"> | ||
<div class="i-carbon-sun dark:i-carbon-moon" /> | ||
</button> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<div text="xl gray4" m-5 flex="~ gap3" justify-center> | ||
<NuxtLink i-carbon-campsite to="/" /> | ||
<a i-carbon-logo-github href="https://github.com/YunYouJun/ai-couplets" target="_blank" /> | ||
<DarkToggle /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
const name = ref('') | ||
const router = useRouter() | ||
function go() { | ||
if (name.value) | ||
router.push(`/hi/${encodeURIComponent(name.value)}`) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<input | ||
id="input" | ||
v-model="name" | ||
placeholder="What's your name?" | ||
type="text" autocomplete="off" | ||
p="x-4 y-2" m="t-5" w="250px" | ||
text="center" bg="transparent" | ||
border="~ rounded gray-200 dark:gray-700" | ||
outline="none active:none" | ||
@keydown.enter="go" | ||
> | ||
<div> | ||
<button | ||
m-3 text-sm btn | ||
:disabled="!name" | ||
@click="go" | ||
> | ||
GO | ||
</button> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<div inline-flex cursor-default text-2xl font-300> | ||
<div flex flex-col children:mx-auto> | ||
<img inline-block h-18 w-18 src="/nuxt.svg"> | ||
<span mt--2 text-green5>Nuxt 3</span> | ||
</div> | ||
<div | ||
text="3xl gray4" | ||
m="x-4 y-auto" | ||
i-carbon-add transform transition-all-500 hover:rotate-135 | ||
/> | ||
<div flex flex-col children:mx-auto> | ||
<img inline-block h-18 w-18 src="/vite.png"> | ||
<span mt--2 text-purple5>Vitesse</span> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script setup lang="ts"> | ||
const { data } = await useFetch('/api/pageview') | ||
const time = useTimeAgo(() => data.value?.startAt || 0) | ||
</script> | ||
|
||
<template> | ||
<div text-gray:80> | ||
<span text-gray font-500>{{ data?.pageview }}</span> | ||
page views since | ||
<span text-gray>{{ time }}</span> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export function useCount() { | ||
const count = useState('count', () => Math.round(Math.random() * 20)) | ||
|
||
function inc() { | ||
count.value += 1 | ||
} | ||
function dec() { | ||
count.value -= 1 | ||
} | ||
|
||
return { | ||
count, | ||
inc, | ||
dec, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { acceptHMRUpdate, defineStore } from 'pinia' | ||
|
||
export const useUserStore = defineStore('user', () => { | ||
/** | ||
* Current named of the user. | ||
*/ | ||
const savedName = ref('') | ||
const previousNames = ref(new Set<string>()) | ||
|
||
const usedNames = computed(() => Array.from(previousNames.value)) | ||
const otherNames = computed(() => usedNames.value.filter(name => name !== savedName.value)) | ||
|
||
/** | ||
* Changes the current name of the user and saves the one that was used | ||
* before. | ||
* | ||
* @param name - new name to set | ||
*/ | ||
function setNewName(name: string) { | ||
if (savedName.value) | ||
previousNames.value.add(savedName.value) | ||
|
||
savedName.value = name | ||
} | ||
|
||
return { | ||
setNewName, | ||
otherNames, | ||
savedName, | ||
} | ||
}) | ||
|
||
if (import.meta.hot) | ||
import.meta.hot.accept(acceptHMRUpdate(useUserStore, import.meta.hot)) |
Oops, something went wrong.