diff --git a/src/components/AgentAssistantWidget.vue b/src/components/AgentAssistantWidget.vue new file mode 100644 index 00000000..361007ca --- /dev/null +++ b/src/components/AgentAssistantWidget.vue @@ -0,0 +1,1035 @@ + + + + + + + + + + + diff --git a/src/components/ThemeCustomizer.vue b/src/components/ThemeCustomizer.vue index 4c1e8d63..fff625df 100644 --- a/src/components/ThemeCustomizer.vue +++ b/src/components/ThemeCustomizer.vue @@ -12,20 +12,9 @@ import { import { usePWA } from '@/composables/usePWA' import { useI18n } from 'vue-i18n' import { useTheme } from 'vuetify' -import { VDialog, VNavigationDrawer } from 'vuetify/components' -import { useDisplay } from 'vuetify' - -const props = withDefaults( - defineProps<{ - modelValue?: boolean - }>(), - { - modelValue: false, - }, -) const emit = defineEmits<{ - 'update:modelValue': [value: boolean] + 'close': [] }>() const customColorInput = ref(null) @@ -45,15 +34,9 @@ const { const { appMode } = usePWA() const { t } = useI18n() const { global: globalTheme } = useTheme() -const display = useDisplay() const defaultPrimaryColor = themeCustomizerPrimaryColors[0].value const customizerViewportHeight = ref('100dvh') -const drawer = computed({ - get: () => props.modelValue, - set: value => emit('update:modelValue', value), -}) - function getVisibleViewportHeight() { if (typeof window === 'undefined') return '100dvh' @@ -87,13 +70,14 @@ function clearThemeCustomizerOpenState() { syncThemeCustomizerOpenState(false) } -watch(drawer, syncThemeCustomizerOpenState, { immediate: true }) -watch(drawer, isOpen => { - if (isOpen) nextTick(syncCustomizerViewportHeight) -}) +function handleGlobalKeydown(event: KeyboardEvent) { + // 固定侧栏不再依赖 Vuetify overlay,手动补上常见的 Esc 关闭行为。 + if (event.key === 'Escape') emit('close') +} onMounted(() => { syncCustomizerViewportHeight() + window.addEventListener('keydown', handleGlobalKeydown) window.addEventListener('resize', syncCustomizerViewportHeight) window.addEventListener('orientationchange', syncCustomizerViewportHeight) window.visualViewport?.addEventListener('resize', syncCustomizerViewportHeight) @@ -104,41 +88,16 @@ onScopeDispose(clearThemeCustomizerOpenState) onScopeDispose(() => { if (typeof window === 'undefined') return + window.removeEventListener('keydown', handleGlobalKeydown) window.removeEventListener('resize', syncCustomizerViewportHeight) window.removeEventListener('orientationchange', syncCustomizerViewportHeight) window.visualViewport?.removeEventListener('resize', syncCustomizerViewportHeight) window.visualViewport?.removeEventListener('scroll', syncCustomizerViewportHeight) }) -const customizerContainer = computed(() => (appMode.value ? VDialog : VNavigationDrawer)) - -const customizerContainerStyle = computed(() => { - if (!appMode.value) return {} - - return { - '--theme-customizer-viewport-height': customizerViewportHeight.value, - } -}) - -const customizerContainerProps = computed(() => { - if (appMode.value && display.mdAndDown.value) { - return { - class: 'theme-customizer-dialog-overlay', - scrim: true, - fullscreen: !display.mdAndUp.value, - scrollable: true, - } - } - - return { - class: 'theme-customizer-drawer', - location: 'right' as const, - scrim: false, - temporary: true, - width: 420, - persistent: false, - } -}) +const customizerContainerStyle = computed(() => ({ + '--theme-customizer-viewport-height': customizerViewportHeight.value, +})) const themeOptions = computed>(() => [ { title: t('theme.light'), value: 'light', icon: 'mdi-white-balance-sunny' }, @@ -273,255 +232,224 @@ async function handleResetSettings() { - - - - - - - - - - {{ t('theme.customizer.title') }} - - - - - - - - - - - +