File tree Expand file tree Collapse file tree
core/src/client/webcomponents/components/icons Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { isDark } from ' @vitejs/devtools-ui/composables/dark '
2+ import { usePreferredDark } from ' @vueuse/core '
33import { computed } from ' vue'
44
5+ const isDark = usePreferredDark ()
56const theme = computed (() => isDark .value ? ' white' : ' black' )
67 </script >
78
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2+ import { applyDarkClassToHtml } from ' @vitejs/devtools-ui/composables/dark'
23import { connect , connectionState } from ' ./composables/rpc'
34import ' floating-vue/dist/style.css'
45import ' ./assets/css/main.css'
5- import ' @vitejs/devtools-ui/composables/dark'
6+
7+ applyDarkClassToHtml ()
68
79connect ()
810 </script >
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2+ import { applyDarkClassToHtml } from ' @vitejs/devtools-ui/composables/dark'
23import { useSeoMeta } from ' #app/composables/head'
34
45import { connect , connectionState } from ' ./composables/rpc'
56import ' floating-vue/dist/style.css'
67import ' ./styles/cm.css'
78import ' ./styles/splitpanes.css'
89import ' ./styles/global.css'
9- import ' @vitejs/devtools-ui/composables/dark'
10+
11+ applyDarkClassToHtml ()
1012
1113useSeoMeta ({
1214 title: ' Rolldown DevTools' ,
Original file line number Diff line number Diff line change 1- import { useDark } from '@vueuse/core'
1+ import type { WritableComputedRef } from 'vue'
2+ import { usePreferredDark , useStorage } from '@vueuse/core'
3+ import { computed , watchEffect } from 'vue'
24
3- export const isDark = useDark ( {
4- storageKey : 'vite-devtools-color-scheme' ,
5- valueLight : 'light' ,
5+ export type ColorSchemePreference = 'auto' | 'dark' | 'light'
6+
7+ const preference = useStorage < ColorSchemePreference > ( 'vite-devtools-color-scheme' , 'auto' )
8+ const preferredDark = usePreferredDark ( )
9+
10+ export const isDark : WritableComputedRef < boolean > = computed ( {
11+ get : ( ) => ( preference . value === 'auto' ? preferredDark . value : preference . value === 'dark' ) ,
12+ set : ( value ) => { preference . value = value ? 'dark' : 'light' } ,
613} )
714
815export function toggleDark ( ) {
916 isDark . value = ! isDark . value
1017}
18+
19+ export function applyDarkClassToHtml ( ) {
20+ if ( typeof document === 'undefined' )
21+ return
22+ watchEffect ( ( ) => {
23+ const el = document . documentElement
24+ el . classList . toggle ( 'dark' , isDark . value )
25+ el . classList . toggle ( 'light' , ! isDark . value )
26+ } )
27+ }
Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import PanelSideNav from ' @vitejs/devtools-ui/components/Panel/PanelSideNav.vue'
3+ import { applyDarkClassToHtml } from ' @vitejs/devtools-ui/composables/dark'
34import { useSideNav } from ' @vitejs/devtools-ui/composables/nav'
45import { useSeoMeta } from ' #app/composables/head'
56import { connect , rpcConnectionState } from ' ./composables/rpc'
67import ' floating-vue/dist/style.css'
78import ' ./styles/cm.css'
89import ' ./styles/splitpanes.css'
910import ' ./styles/global.css'
10- import ' @vitejs/devtools-ui/composables/dark'
11+
12+ applyDarkClassToHtml ()
1113
1214useSeoMeta ({
1315 title: ' Vite DevTools' ,
You can’t perform that action at this time.
0 commit comments