@myko/ui-vue
Vue 3 reactive wrappers for the Myko client.
13,436
2
| Install | |
|---|---|
npm install @myko/ui-vue |
|
| Latest Version: | 6.9.0 |
| Vue: | 3 |
| Last Updated: | Oct 22, 2026 |
| Links: | GitHub · npm |
Maintainer: trevorsargent
@myko/ui-vue
Vue 3 reactive wrappers for the Myko client.
Installation
pnpm add @myko/ui-vue
Usage
Using Composables (Recommended)
<script setup>
import { useQuery, useQueryState, useReport, useConnection } from '@myko/ui-vue'
import { queries, reports } from '@your-app/entities'
// Connection management
const { status, isConnected, connect, disconnect } = useConnection()
// Query data with automatic cleanup
const { items, itemsArray, resolved } = useQuery(queries.GetAllTargets({}))
// Large keyed results can also expose lifecycle and incremental changes
const targets = useQueryState(queries.GetAllTargets({}))
// targets.status, targets.error, targets.revision, targets.changes
// Report data with automatic cleanup
const { value: count } = useReport(reports.CountAllTargets({}))
// Connect on mount
connect('ws://localhost:5155')
</script>
<template>
<div>Status: {{ status }}</div>
<div v-if="!resolved">Loading...</div>
<div v-for="target in itemsArray" :key="target.id">
{{ target.name }}
</div>
<div>Total: {{ count?.count ?? 0 }}</div>
</template>
Using the Client Directly
<script setup>
import { onUnmounted } from 'vue'
import { getMykoClient } from '@myko/ui-vue'
import { queries, commands } from '@your-app/entities'
const client = getMykoClient()
// Manual query subscription
const { items, release } = client.query(queries.GetAllTargets({}))
onUnmounted(release)
// Send commands
async function deleteTarget(id: string) {
await client.sendCommand(commands.DeleteTarget({ targetId: id }))
}
</script>
API
Composables
useQuery(queryFactory)- Watch a query with reactive Map updatesuseQueryState(queryFactory)- Add lifecycle, error, revision, and latest-diff stateuseReport(reportFactory)- Watch a report with reactive valueuseConnection()- Manage connection status
Client
getMykoClient()- Get the global singleton clientcreateMykoClient()- Create a new client instancemyko- Direct access to the global clientqueryState(queryFactory)- Ref-counted keyed query state without full-array rebuilds
Types
import type {
ReactiveQuery,
ReactiveQueryState,
ReactiveReport,
UseQueryReturn,
UseQueryStateReturn,
UseReportReturn,
UseConnectionReturn
} from '@myko/ui-vue'
Version History
| Version | Released | License |
|---|---|---|
| 6.9.0 | ||
| 6.8.2 | ||
| 6.8.1 | ||
| 6.8.0 | ||
| 6.7.0 | ||
| 6.6.2 | ||
| 6.6.1 | ||
| 6.6.0 | ||
| 6.5.15 | ||
| 6.5.14 | ||
| 6.5.13 | ||
| 6.5.4 | ||
| 6.5.3 | ||
| 6.5.1 | ||
| 6.5.0 | ||
| 6.4.1 | ||
| 6.4.0 | ||
| 6.3.0 | ||
| 6.2.0 | ||
| 6.1.0 | ||
| 6.0.0 | ||
| 5.0.6 | ||
| 5.0.5 | ||
| 5.0.4 | ||
| 5.0.3 | ||
| 5.0.2 | ||
| 5.0.1 | ||
| 5.0.0 | ||
| 4.24.4 | ||
| 4.24.3 |
Showing the latest 30 of 73. See every release on npm
Pre-releases (13)
| Version | Released | License |
|---|---|---|
| 4.4.0-canary.5 | ||
| 4.4.0-canary.4 | ||
| 4.4.0-canary.3 | ||
| 4.4.0-canary.2 | ||
| 4.4.0-canary.1 | ||
| 4.3.0-canary.2 | ||
| 4.3.0-canary.1 | ||
| 4.2.3-canary.1 | ||
| 4.2.1-canary.7 | ||
| 4.2.1-canary.6 | ||
| 4.2.0-canary.11 | ||
| 4.2.0-canary.10 | ||
| 4.2.0-canary.3 |