Skip to content

Commit 3c1cecd

Browse files
authored
integrate fcitx5-config-vue (#2)
1 parent 5643968 commit 3c1cecd

File tree

6 files changed

+46
-3
lines changed

6 files changed

+46
-3
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
wget -P cache https://github.com/fcitx-contrib/fcitx5-js/releases/download/latest/fcitx5-js-0.1.0.tgz
23+
wget -P cache https://github.com/fcitx-contrib/fcitx5-config-vue/releases/download/latest/fcitx5-config-vue-0.1.0.tgz
2324
npm i -g pnpm
2425
pnpm i
2526
2627
- name: Lint
2728
run: |
2829
pnpm run lint
30+
pnpm run check
2931
3032
- name: Build
3133
run: |

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@rollup/plugin-replace": "^5.0.7",
2323
"@vitejs/plugin-vue": "^5.1.2",
2424
"eslint": "^9.9.0",
25+
"fcitx5-config-vue": "file:cache/fcitx5-config-vue-0.1.0.tgz",
2526
"fcitx5-js": "file:cache/fcitx5-js-0.1.0.tgz",
2627
"naive-ui": "^2.39.0",
2728
"typescript": "^5.5.4",

src/App.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import {
33
NConfigProvider,
44
NH1,
5+
NModalProvider,
56
darkTheme,
67
useOsTheme,
78
} from 'naive-ui'
@@ -24,7 +25,9 @@ const osThemeRef = useOsTheme()
2425
<div style="cursor: pointer; text-align: center; margin-top: 16px">
2526
<NH1>{{ appName }}</NH1>
2627
</div>
27-
<MyContent />
28+
<NModalProvider>
29+
<MyContent />
30+
</NModalProvider>
2831
</template>
2932
<template #footer>
3033
<MyFooter />

src/components/GearIcon.vue

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
export default {
3+
name: 'MdiCog',
4+
}
5+
</script>
6+
7+
<template>
8+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97s-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1s.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64z" /></svg>
9+
</template>

src/components/StatusArea.vue

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<script setup lang="ts">
2-
import { computed } from 'vue'
3-
import { NSelect, NSpace } from 'naive-ui'
2+
import { computed, ref } from 'vue'
3+
import { NButton, NIcon, NModal, NSelect, NSpace } from 'naive-ui'
4+
import { InputMethodConfig } from 'fcitx5-config-vue'
45
import { inputMethod, inputMethods, loading } from '../fcitx'
6+
import GearIcon from './GearIcon.vue'
57
68
const options = computed(() => {
79
return inputMethods.value.map(({ displayName, name }) => ({
810
label: displayName,
911
value: name,
1012
}))
1113
})
14+
15+
const showModal = ref(false)
1216
</script>
1317

1418
<template>
@@ -19,5 +23,22 @@ const options = computed(() => {
1923
:loading="loading"
2024
:options="options"
2125
/>
26+
<NButton secondary @click="showModal = true">
27+
<template #icon>
28+
<NIcon>
29+
<GearIcon />
30+
</NIcon>
31+
</template>
32+
</NButton>
33+
<NModal
34+
v-model:show="showModal"
35+
preset="card"
36+
title="Input Method Config"
37+
>
38+
<InputMethodConfig
39+
:input-method="inputMethod"
40+
:input-methods="inputMethods"
41+
/>
42+
</NModal>
2243
</NSpace>
2344
</template>

src/global.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { FCITX } from 'fcitx5-js'
2+
3+
declare global {
4+
interface Window {
5+
fcitx: FCITX
6+
}
7+
}

0 commit comments

Comments
 (0)