Skip to content

feat(vue): Vue 3 bindings#33

Open
ivanbanov wants to merge 2 commits into
mainfrom
vue
Open

feat(vue): Vue 3 bindings#33
ivanbanov wants to merge 2 commits into
mainfrom
vue

Conversation

@ivanbanov

Copy link
Copy Markdown
Contributor

🚧 WIP — opening early for visibility; the integration is complete and verified, but holding for review before merge.

What

Adds @dunky.dev/state-machine-vue — Vue 3 bindings for the renderer-agnostic core, mirroring the React package's API one-for-one.

Package (packages/vue)

  • useMachine(createConfig, connect, effects, props) — builds machine + connector once in setup(), drives a shallowRef off the connector snapshot (exposed as a ComputedRef), pushes prop changes via watch → setProps, runs start/stop on the mount lifecycle, and runs each ComponentEffect as its own dep-keyed watch. Returns { api, machine }.
  • useSelector(machine, selector, isEqual?) — value-deduped readonly ref, disposed on scope teardown.
  • normalize(bindings) — agnostic bindings → Vue DOM/ARIA props (onPressonClick, onValueChangeonInput, focusabletabindex, payload adapters).
  • mergeProps(consumer, library) — handler chaining + Vue class/style conventions.

Wiring & docs

  • Registered in tsdown.config.ts, tsconfig.json paths, the docs sidebar; new website/.../libs/vue.mdx; changeset added.
  • sandbox/vue — SFC sandbox driving the shared @sandbox/cmdk-core machine (needs @vitejs/plugin-vue@^6 for Vite 8).
  • Docs/README examples use idiomatic SFC <script setup> + <template> (v-bind), not h().

Verification

  • vitest run packages/vue48/48 pass
  • pnpm test:ci (full repo) — 355/355 pass
  • pnpm typecheck (repo) + vue-tsc (sandbox) — clean
  • pnpm build — vue package builds with isolated-declarations + publint clean
  • Live in-browser test of the sandbox: open → filter → select → close all work, with correct ARIA wiring.

ivanbanov and others added 2 commits June 23, 2026 21:53
Add @dunky.dev/state-machine-vue, mirroring the React package's API
one-for-one (useMachine, useSelector, normalize, mergeProps,
ComponentEffect/ComponentEffects) implemented with Vue reactivity:

- useMachine builds machine+connector once in setup(), drives a
  shallowRef off the connector snapshot (exposed as a ComputedRef),
  pushes props via watch->setProps, runs start/stop on the mount
  lifecycle, and runs each ComponentEffect as its own dep-keyed watch.
- useSelector returns a value-deduped readonly ref.
- normalize translates agnostic bindings to Vue DOM/ARIA props
  (onPress->onClick, onValueChange->onInput, focusable->tabindex, ...).
- mergeProps merges consumer + component props with Vue's class/style
  conventions.

Wire the package into tsdown, tsconfig paths, the docs sidebar, and a
new libs/vue.mdx; add a changeset. Add sandbox/vue (SFCs) driving the
shared cmdk core through the new bindings.

Co-authored-by: Claude <noreply@anthropic.com>
Rewrite the useMachine / useSelector / normalize / mergeProps examples
in the Vue README and docs page to lead with SFC <script setup> +
<template> (v-bind) syntax instead of h() render functions — matching
how the sandbox is written and what Vue developers expect. Keep a short
note that the same api/normalize output works in JSX or a manual h()
render function.

Co-authored-by: Claude <noreply@anthropic.com>
@ivanbanov ivanbanov added the 🚧 WIP This will not be worked on label Jun 23, 2026
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
state-machine-website Ready Ready Preview, Comment Jun 23, 2026 8:46pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚧 WIP This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant