Skip to content

Commit

Permalink
feat: add wip devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 7, 2025
1 parent da5b00c commit 8f98773
Show file tree
Hide file tree
Showing 4 changed files with 326 additions and 26 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
"peerDependencies": {
"pinia": "^2.2.6"
},
"dependencies": {
"@vue/devtools-api": "^7.7.1"
},
"devDependencies": {
"@antfu/eslint-config": "^3.12.0",
"@pinia/colada": "workspace:*",
Expand Down
36 changes: 10 additions & 26 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/devtools/DevtoolsPane.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
const count = ref(0)
onMounted(async () => {
console.log('WEWEWE FROM_DEVTOOLS')
const id = 'pinia-colada-devtools'
window.top?.postMessage({ id, type: 'FROM_DEVTOOLS', payload: 'Hello from devtools' })
})
</script>

<template>
<div class="h-full w-full flex flex-col items-center justify-center">
<pre>{{ $route.fullPath }}</pre>
<div>HELLO {{ count }}</div>
<button class="btn" @click="count++">increment</button>

Check warning on line 17 in src/devtools/DevtoolsPane.vue

View workflow job for this annotation

GitHub Actions / build

Expected 1 line break after opening tag (`<button>`), but no line breaks found

Check warning on line 17 in src/devtools/DevtoolsPane.vue

View workflow job for this annotation

GitHub Actions / build

Expected 1 line break before closing tag (`</button>`), but no line breaks found
</div>
</template>

<style scoped>
.btn {
background-color: #4c51bf;
color: #fff;
padding: 0.5rem 1rem;
border-radius: 0.25rem;
border: none;
cursor: pointer;
}
</style>
Loading

0 comments on commit 8f98773

Please sign in to comment.