-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devtools): can dev devtools hmr with demo
- Loading branch information
Showing
57 changed files
with
1,045 additions
and
3,920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_VALAXY_DEVTOOLS_DEV=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,3 @@ | ||
<script lang="ts" setup> | ||
import { onMounted } from 'vue' | ||
import VDHeader from './components/VDHeader.vue' | ||
import { initDevtoolsClient } from './utils' | ||
onMounted(() => { | ||
initDevtoolsClient() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<main class="h-full" flex="~ col" text="gray-700 dark:gray-200"> | ||
<VDHeader /> | ||
<!-- <RouterLink to="/about">About</RouterLink> --> | ||
|
||
<div style="height: calc(100% - 32px)" overflow="auto"> | ||
<RouterView /> | ||
</div> | ||
</main> | ||
<ValaxyDevtools /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
tag?: string | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<component | ||
:is="tag || 'button'" | ||
class="bg-white dark:bg-gray-900 inline-flex justify-center items-center size-8 hover:bg-gray-200 dark:hover:bg-gray-800" | ||
> | ||
<slot /> | ||
</component> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script setup lang="ts"> | ||
import { useI18n } from 'vue-i18n' | ||
import { toggleDark } from '../composables/dark' | ||
const { t } = useI18n() | ||
</script> | ||
|
||
<template> | ||
<MenuBarBtn :title="t('button.toggle_dark')" @click="toggleDark()"> | ||
<div i="carbon-sun dark:carbon-moon" /> | ||
</MenuBarBtn> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/devtools/src/client/components/ValaxyDevtools.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts" setup> | ||
import { onMounted } from 'vue' | ||
import { initDevtoolsClient } from '../utils' | ||
import 'splitpanes/dist/splitpanes.css' | ||
import '../styles/index.scss' | ||
onMounted(() => { | ||
initDevtoolsClient() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<main class="h-full" flex="~ col" text="gray-700 dark:gray-200"> | ||
<VDHeader /> | ||
<!-- <RouterLink to="/about">About</RouterLink> --> | ||
<div style="height: calc(100% - 32px)" overflow="auto"> | ||
<PageIndex /> | ||
</div> | ||
</main>> | ||
</template> |
57 changes: 57 additions & 0 deletions
57
packages/devtools/src/client/components/ValaxyDevtoolsEntry.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script setup lang="ts"> | ||
import { useDraggable } from '@vueuse/core' | ||
import { ref } from 'vue' | ||
import { useAppStore } from '../stores/app' | ||
const entryRef = ref() | ||
const { style } = useDraggable(entryRef, { | ||
initialValue: { | ||
x: 12, | ||
y: window.innerHeight - 60, | ||
}, | ||
}) | ||
const app = useAppStore() | ||
</script> | ||
|
||
<template> | ||
<div ref="entryRef" :style="style" class="fixed z-9999999999 valaxy-devtools-entry"> | ||
<button | ||
class="bg-white size-10 rounded-full shadow hover:shadow-lg transition p-1 z-1 cursor-pointer" | ||
@click="app.isDevtoolsVisible = !app.isDevtoolsVisible" | ||
> | ||
<ValaxySvgLogo /> | ||
</button> | ||
</div> | ||
|
||
<template v-if="app.isDevtoolsVisible"> | ||
<ValaxyOverlay | ||
class="z-9999999998! op-50" | ||
:show="app.isDevtoolsVisible" | ||
@click="app.isDevtoolsVisible = !app.isDevtoolsVisible" | ||
/> | ||
<div | ||
v-if="app.isDevtoolsVisible" | ||
class="valaxy-devtools-container fixed left-0 right-0 bottom-1 z-9999999999 shadow-xl rounded overflow-hidden m-auto" | ||
bg-white dark:bg-dark-800 | ||
> | ||
<ValaxyDevtools /> | ||
</div> | ||
</template> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@use 'sass:map'; | ||
@use 'valaxy-theme-yun/styles/vars.scss' as *; | ||
.valaxy-devtools-entry { | ||
position: fixed; | ||
} | ||
.valaxy-devtools-container { | ||
animation-timing-function: map.get($cubic-bezier, "ease-in"); | ||
width: min(80vw, -48px + 100vw); | ||
height: min(60vh, -48px + 100vh); | ||
transform: translate(0, 0); | ||
} | ||
</style> |
11 changes: 11 additions & 0 deletions
11
packages/devtools/src/client/components/controls/SelectRootDir.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { useAppStore } from '../../stores/app' | ||
const app = useAppStore() | ||
</script> | ||
|
||
<template> | ||
<MenuBarBtn @click="app.getDir"> | ||
<div i-vscode-icons:default-root-folder-opened /> | ||
</MenuBarBtn> | ||
</template> |
9 changes: 7 additions & 2 deletions
9
packages/devtools/src/client/pages/index.vue → ...src/client/components/pages/PageIndex.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { useDark, usePreferredDark, useToggle } from '@vueuse/core' | ||
// these APIs are auto-imported from @vueuse/core | ||
export const isDark = useDark() | ||
export const toggleDark = useToggle(isDark) | ||
export const preferredDark = usePreferredDark() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
button: | ||
about: About | ||
back: Back | ||
go: GO | ||
home: Home | ||
toggle_dark: Toggle dark mode | ||
toggle_langs: Change languages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
button: | ||
about: 关于 | ||
back: 返回 | ||
go: 确定 | ||
home: 首页 | ||
toggle_dark: 切换深色模式 | ||
toggle_langs: 切换语言 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.