Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): hide dark mode button of vite-plugin-inspect page #737

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/applet/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-applet",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-client",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"private": true,
"author": "webfansplz",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-core",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools-api/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-api",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-kit",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-electron",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-overlay",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"private": true,
"author": "webfansplz",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/applet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typescript": "^5.7.2",
"unocss": "^0.64.1",
"vite": "^6.0.1",
"vite-plugin-inspect": "0.8.8",
"vite-plugin-inspect": "0.10.4",
"vite-plugin-vue-devtools": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion packages/playground/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"typescript": "^5.7.2",
"unocss": "^0.64.1",
"vite": "^6.0.1",
"vite-plugin-inspect": "0.8.8",
"vite-plugin-inspect": "0.10.4",
"vite-plugin-vue-devtools": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion packages/playground/multi-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"typescript": "^5.7.2",
"unocss": "^0.64.1",
"vite": "^6.0.1",
"vite-plugin-inspect": "0.8.8",
"vite-plugin-inspect": "0.10.4",
"vite-plugin-vue-devtools": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-shared",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vue/devtools-ui",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"author": "webfansplz",
"license": "MIT",
"repository": {
Expand Down
26 changes: 8 additions & 18 deletions packages/ui/src/components/DarkToggle.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { useVModel } from '@vueuse/core'
import { computed, nextTick } from 'vue'
import { useDevToolsColorMode } from '../composables'
import { useDark, useToggle } from '@vueuse/core'
import { nextTick } from 'vue'

const props = withDefaults(defineProps<{
isDark?: boolean
Expand All @@ -13,19 +12,8 @@ const props = withDefaults(defineProps<{
animationDuration: 400,
})

const isDarkModel = useVModel(props, 'isDark')

const { colorMode: mode } = useDevToolsColorMode({
initialValue: isDarkModel.value ? 'dark' : 'light',
onChanged: (value) => {
isDarkModel.value = value === 'dark'
},
})

const isDark = computed({
get: () => mode.value === 'dark',
set: v => mode.value = v ? 'dark' : 'light',
})
const isDark = useDark()
const toggleDark = useToggle(isDark)

const isAppearanceTransition = !!document.startViewTransition
&& !window.matchMedia('(prefers-reduced-motion: reduce)').matches
Expand All @@ -35,7 +23,7 @@ const isAppearanceTransition = !!document.startViewTransition
*/
function toggle(event?: MouseEvent) {
if (!isAppearanceTransition || !event || !props.animation) {
isDark.value = !isDark.value
toggleDark()
return
}
const x = event.clientX
Expand All @@ -44,10 +32,12 @@ function toggle(event?: MouseEvent) {
Math.max(x, innerWidth - x),
Math.max(y, innerHeight - y),
)

const transition = document.startViewTransition(async () => {
isDark.value = !isDark.value
await nextTick()
})

transition.ready.then(() => {
const clipPath = [
`circle(0px at ${x}px ${y}px)`,
Expand All @@ -73,6 +63,6 @@ function toggle(event?: MouseEvent) {

<template>
<span class="$ui-dark-toggle-vtr">
<slot v-bind="{ mode, isDark, toggle }" />
<slot v-bind="{ isDark, toggle }" />
</span>
</template>
4 changes: 2 additions & 2 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-plugin-vue-devtools",
"type": "module",
"version": "7.6.7",
"version": "7.6.6",
"description": "A vite plugin for Vue DevTools",
"author": "webfansplz",
"license": "MIT",
Expand Down Expand Up @@ -55,7 +55,7 @@
"@vue/devtools-shared": "workspace:^",
"execa": "^9.5.1",
"sirv": "^3.0.0",
"vite-plugin-inspect": "0.8.8",
"vite-plugin-inspect": "0.10.4",
"vite-plugin-vue-inspector": "^5.3.1"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default function VitePluginVueDevTools(options?: VitePluginVueDevToolsOpt
const vueDevtoolsPath = getVueDevtoolsPath()
const inspect = Inspect({
silent: true,
embedded: true,
})

const pluginOptions = mergeOptions(options ?? {})
Expand Down
Loading