-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8886a73
commit 3df27b9
Showing
21 changed files
with
394 additions
and
1 deletion.
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
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,92 @@ | ||
<script setup lang="ts"> | ||
import { useDevToolsBridgeRpc } from '@vue/devtools-core' | ||
// eslint-disable-next-line ts/no-import-type-side-effects | ||
import { type InspectorNodeTag, type InspectorState } from '@vue/devtools-kit' | ||
import { Pane, Splitpanes } from 'splitpanes' | ||
const bridgeRpc = useDevToolsBridgeRpc() | ||
const INSPECTOR_ID = 'vue-i18n-resource-inspector' | ||
const selected = ref('') | ||
const tree = ref<{ id: string, label: string, tags: InspectorNodeTag[] }[]>([]) | ||
const state = ref<{ | ||
inspectorId?: string | ||
state?: InspectorState[] | ||
getters?: InspectorState[] | ||
}>({}) | ||
function getI18nState(nodeId: string) { | ||
bridgeRpc.getInspectorState({ inspectorId: INSPECTOR_ID, nodeId }).then(({ data }) => { | ||
state.value = data | ||
}) | ||
} | ||
function clearI18nState() { | ||
state.value = {} | ||
} | ||
watch(selected, () => { | ||
clearI18nState() | ||
getI18nState(selected.value) | ||
}) | ||
createCollapseContext('inspector-state') | ||
onDevToolsClientConnected(() => { | ||
bridgeRpc.getInspectorTree({ inspectorId: INSPECTOR_ID, filter: '' }).then(({ data }) => { | ||
tree.value = data | ||
if (!selected.value && data.length) { | ||
selected.value = data[0].id | ||
getI18nState(data[0].id) | ||
} | ||
}) | ||
bridgeRpc.on.inspectorTreeUpdated((data) => { | ||
if (!data?.data.length) | ||
return | ||
tree.value = data.data | ||
if (!selected.value && data.data.length) { | ||
selected.value = data.data[0].id | ||
getI18nState(data.data[0].id) | ||
} | ||
}, { | ||
inspectorId: INSPECTOR_ID, | ||
}) | ||
bridgeRpc.on.inspectorStateUpdated((data) => { | ||
if (!data || !data.state.length) | ||
return | ||
state.value = data | ||
}, { | ||
inspectorId: INSPECTOR_ID, | ||
}) | ||
}) | ||
onUnmounted(() => { | ||
bridgeRpc.unhighlightElement() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<PanelGrids h-screen> | ||
<Splitpanes> | ||
<Pane flex flex-col border="r base"> | ||
<div h-screen select-none overflow-scroll p-2 class="no-scrollbar"> | ||
<InspectorTree v-model="selected" :data="tree" /> | ||
</div> | ||
</Pane> | ||
<Pane flex flex-col> | ||
<div :key="selected" h-0 grow overflow-auto p-2 class="no-scrollbar"> | ||
<InspectorState | ||
v-for="(item, key) in state" :id="key" | ||
:key="key" | ||
:inspector-id="INSPECTOR_ID" | ||
:node-id="selected" :data="item" :name="`${key}`" | ||
/> | ||
</div> | ||
</Pane> | ||
</Splitpanes> | ||
</PanelGrids> | ||
</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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
button: | ||
about: About | ||
back: Back | ||
go: GO | ||
home: Home | ||
toggle_dark: Toggle dark mode | ||
toggle_langs: Change languages | ||
intro: | ||
desc: Opinionated Vite Starter Template | ||
dynamic-route: Demo of dynamic route | ||
hi: Hi, {name}! | ||
aka: Also known as | ||
whats-your-name: What's your name? | ||
not-found: Not found |
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 @@ | ||
button: | ||
about: Acerca de | ||
back: Atrás | ||
go: Ir | ||
home: Inicio | ||
toggle_dark: Alternar modo oscuro | ||
toggle_langs: Cambiar idiomas | ||
intro: | ||
desc: Plantilla de Inicio de Vite Dogmática | ||
dynamic-route: Demo de ruta dinámica | ||
hi: ¡Hola, {name}! | ||
aka: También conocido como | ||
whats-your-name: ¿Cómo te llamas? | ||
not-found: No se ha encontrado |
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 @@ | ||
button: | ||
about: À propos | ||
back: Retour | ||
go: Essayer | ||
home: Accueil | ||
toggle_dark: Basculer en mode sombre | ||
toggle_langs: Changer de langue | ||
intro: | ||
desc: Exemple d'application Vite | ||
dynamic-route: Démo de route dynamique | ||
hi: Salut, {name}! | ||
aka: Aussi connu sous le nom de | ||
whats-your-name: Comment t'appelles-tu ? | ||
not-found: Page non trouvée |
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,13 @@ | ||
button: | ||
about: これは? | ||
back: 戻る | ||
go: 進む | ||
home: ホーム | ||
toggle_dark: ダークモード切り替え | ||
toggle_langs: 言語切り替え | ||
intro: | ||
desc: 固執された Vite スターターテンプレート | ||
dynamic-route: 動的ルートのデモ | ||
hi: こんにちは、{name}! | ||
whats-your-name: 君の名は。 | ||
not-found: 見つかりませんでした |
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 @@ | ||
button: | ||
about: 关于 | ||
back: 返回 | ||
go: 确定 | ||
home: 首页 | ||
toggle_dark: 切换深色模式 | ||
toggle_langs: 切换语言 | ||
intro: | ||
desc: 固执己见的 Vite 项目模板 | ||
dynamic-route: 动态路由演示 | ||
hi: 你好,{name} | ||
aka: 也叫 | ||
whats-your-name: 输入你的名字 | ||
not-found: 未找到页面 |
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
Oops, something went wrong.