2024-09-09 17:53:07 +08:00
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
import { computed, reactive } from 'vue'
|
|
|
|
|
|
|
|
export type VisibleState = 'show' | 'auto' | ''
|
2024-11-11 11:53:26 +08:00
|
|
|
export type TimeUnit = 'date' | 'week' | '12hour' | 'lunal' | 'second'
|
2024-11-11 17:22:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
export const SimpleShowStringType = [{
|
|
|
|
label: "侧边栏",
|
|
|
|
value: 'showSider',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "底部栏",
|
|
|
|
value: 'showDock',
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "时间",
|
|
|
|
value: 'showTime',
|
|
|
|
|
|
|
|
}, {
|
|
|
|
label: "日期",
|
|
|
|
value: 'showDate',
|
|
|
|
|
|
|
|
}, {
|
|
|
|
label: "AI助手",
|
|
|
|
value: 'showPet',
|
|
|
|
}
|
|
|
|
]
|
|
|
|
type SimpleValueType = typeof SimpleShowStringType[number]['value'];
|
|
|
|
|
2024-09-09 17:53:07 +08:00
|
|
|
export default defineStore(
|
|
|
|
'settings',
|
|
|
|
() => {
|
|
|
|
const state = reactive({
|
2024-10-10 16:15:59 +08:00
|
|
|
// 是否用过
|
|
|
|
used: false,
|
2024-09-13 18:27:39 +08:00
|
|
|
maskOpacity: 0,
|
|
|
|
maskFilter: 0,
|
2024-09-09 17:53:07 +08:00
|
|
|
// 显示隐藏
|
|
|
|
showSider: 'show' as VisibleState,
|
|
|
|
showDock: 'show' as VisibleState,
|
2024-11-20 15:09:54 +08:00
|
|
|
showPet: true,
|
|
|
|
showPetOnTab: true,
|
|
|
|
autoUseAi: 'show' as VisibleState,
|
2024-11-08 20:22:37 +08:00
|
|
|
showTop: 'show' as VisibleState,
|
2024-09-09 17:53:07 +08:00
|
|
|
showTime: true,
|
2024-10-29 18:47:37 +08:00
|
|
|
timeOptions: ['date', 'week', '12hour', 'lunal', 'second'] as TimeUnit[],
|
2024-10-10 16:04:00 +08:00
|
|
|
showAdder: true,
|
2024-10-25 18:53:08 +08:00
|
|
|
showHistory: true,
|
2024-09-09 17:53:07 +08:00
|
|
|
// 尺寸
|
2024-10-15 16:25:01 +08:00
|
|
|
blockSize: 6.7,
|
2024-09-09 17:53:07 +08:00
|
|
|
blockPadding: 1,
|
|
|
|
mainWidth: 70,
|
2024-09-11 16:03:17 +08:00
|
|
|
blockRadius: 0.2,
|
2024-10-10 16:04:00 +08:00
|
|
|
showBlockLabel: true,
|
2024-09-09 17:53:07 +08:00
|
|
|
// 搜索
|
|
|
|
searchWidth: 30,
|
2024-10-29 18:47:37 +08:00
|
|
|
searchRadius: 12,
|
2024-10-30 19:07:10 +08:00
|
|
|
searchOpacity: 0.75,
|
|
|
|
// 侧边栏
|
|
|
|
siderDirection: 'left' as 'left' | 'right',
|
2024-11-11 11:53:26 +08:00
|
|
|
// 禁用快捷键
|
2024-11-11 17:22:56 +08:00
|
|
|
disabledShortcut: false,
|
|
|
|
// 极简模式显式
|
|
|
|
simpleModeShowString: ['showTime', 'showDate'] as SimpleValueType[]
|
2024-09-09 17:53:07 +08:00
|
|
|
})
|
|
|
|
return { state, blockInner: computed(() => state.blockSize - 2 * state.blockPadding) }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
persist: true
|
|
|
|
}
|
|
|
|
)
|