Skip to content

Commit 4ef9a08

Browse files
committed
chore: update visualizer
1 parent f2d59f9 commit 4ef9a08

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

examples/nuxt-ts/components/StateVisualizer.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
<script setup lang="ts">
22
import { highlightState } from "@zag-js/stringify-state"
3-
import { isRef } from "vue"
3+
import type { Service } from "@zag-js/core"
44
55
const props = defineProps<{
6-
state: any
6+
state: Service<any>
77
label?: string
88
omit?: string[]
99
}>()
1010
11-
const state = isRef(props.state) ? props.state.value : props.state
11+
const obj = computed(() => {
12+
const service = props.state
13+
return {
14+
state: service.state.get(),
15+
event: service.event.current(),
16+
}
17+
})
1218
</script>
1319

1420
<template>
1521
<div class="viz">
1622
<pre>
1723
<details open>
1824
<summary> {{props.label || "Visualizer"}} </summary>
19-
<div v-html="highlightState(state, props.omit)"></div>
25+
<div v-html="highlightState(obj, props.omit)"></div>
2026
</details>
2127
</pre>
2228
</div>

0 commit comments

Comments
 (0)