Skip to content

Commit

Permalink
plugin manager
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Dec 17, 2024
1 parent c148739 commit 1c98887
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DS_Store
node_modules
pnpm-lock.yaml
dist
*.tgz
*.zip
5 changes: 4 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
darkTheme,
NConfigProvider,
NH1,
NMessageProvider,
NModalProvider,
useOsTheme,
} from 'naive-ui'
Expand All @@ -26,7 +27,9 @@ const osThemeRef = useOsTheme()
<NH1>{{ appName }}</NH1>
</div>
<NModalProvider>
<MyContent />
<NMessageProvider>
<MyContent />
</NMessageProvider>
</NModalProvider>
</template>
<template #footer>
Expand Down
9 changes: 9 additions & 0 deletions src/components/PlugIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script lang="ts">
export default {
name: 'MaterialSymbolsPowerPlugOutlineRounded',
}
</script>

<template>
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M11.5 19h1v-1.85l3.5-3.5V9H8v4.65l3.5 3.5zm-2 1v-2l-2.925-2.925q-.275-.275-.425-.637T6 13.675V9q0-.825.588-1.412T8 7h1L8 8V4q0-.425.288-.712T9 3t.713.288T10 4v3h4V4q0-.425.288-.712T15 3t.713.288T16 4v4l-1-1h1q.825 0 1.413.588T18 9v4.675q0 .4-.15.763t-.425.637L14.5 18v2q0 .425-.288.713T13.5 21h-3q-.425 0-.712-.288T9.5 20m2.5-6" /></svg>
</template>
16 changes: 16 additions & 0 deletions src/components/PluginButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { NButton, NIcon } from 'naive-ui'
import PlugIcon from './PlugIcon.vue'
</script>

<template>
<NButton
secondary
>
<template #icon>
<NIcon>
<PlugIcon />
</NIcon>
</template>
</NButton>
</template>
17 changes: 15 additions & 2 deletions src/components/StatusArea.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import { AdvancedConfig, GearButton, GlobalConfig, InputMethodConfig, ThemeConfig } from 'fcitx5-config-vue'
import { AdvancedConfig, GearButton, GlobalConfig, InputMethodConfig, PluginManager, ThemeConfig } from 'fcitx5-config-vue'
import { NModal, NSelect, NSpace, NTooltip } from 'naive-ui'
import { computed, ref } from 'vue'
import { inputMethod, inputMethods, loading } from '../fcitx'
import AdvancedButton from './AdvancedButton.vue'
import GlobalButton from './GlobalButton.vue'
import MenuButton from './MenuButton.vue'
import PluginButton from './PluginButton.vue'
import ThemeButton from './ThemeButton.vue'
const options = computed(() => {
Expand All @@ -16,12 +17,13 @@ const options = computed(() => {
})
const showModal = ref(false)
const modalType = ref<'im' | 'global' | 'theme' | 'advanced'>('im')
const modalType = ref<'im' | 'global' | 'theme' | 'plugin' | 'advanced'>('im')
const titleMap = {
im: 'Input Method',
global: 'Global Config',
theme: 'Theme Editor',
plugin: 'Plugin Manager',
advanced: 'Advanced',
}
</script>
Expand Down Expand Up @@ -53,6 +55,12 @@ const titleMap = {
</template>
{{ titleMap.theme }}
</NTooltip>
<NTooltip>
<template #trigger>
<PluginButton @click="modalType = 'plugin'; showModal = true" />
</template>
{{ titleMap.plugin }}
</NTooltip>
<NTooltip>
<template #trigger>
<AdvancedButton @click="modalType = 'advanced'; showModal = true" />
Expand All @@ -61,6 +69,7 @@ const titleMap = {
</NTooltip>
<NModal
v-model:show="showModal"
:style="modalType === 'plugin' ? 'width: auto' : 'max-width: 1024px'"
preset="card"
:title="titleMap[modalType]"
>
Expand All @@ -78,6 +87,10 @@ const titleMap = {
v-else-if="modalType === 'theme'"
@close="showModal = false"
/>
<PluginManager
v-else-if="modalType === 'plugin'"
@close="showModal = false"
/>
<AdvancedConfig
v-else
@close="showModal = false"
Expand Down

0 comments on commit 1c98887

Please sign in to comment.