Skip to content

feat(vue): Vue 3 bindings - #33

Open
ivanbanov wants to merge 11 commits into
mainfrom
vue
Open

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

Conversation

@ivanbanov

Copy link
Copy Markdown
Member

🚧 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)
dunky-state-machine Building Building Preview Aug 16, 2026 12:44am
state-machine-website Ready Ready Preview Aug 16, 2026 12:44am

ivanbanov and others added 2 commits August 14, 2026 11:52
- Rename @dunky.dev/state-machine-vue -> @dunky.dev/vue-state-machine,
  matching the <substrate>-state-machine naming every other target uses.
- Version 0.3.2, in step with the fixed @dunky.dev/* group.
- Ship src alongside dist (parity with #53).
- Drop the ComponentEffects alias — react removed it; every target
  exports the ComponentEffect tuple alone.
- Kebab-case the sandbox SFC filenames and format, fixing the lint and
  format CI failures.
- Add vue to the substrate enumerations in AGENTS/ARCHITECTURE.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ivanbanov

Copy link
Copy Markdown
Member Author

Brought the branch up to date with main and fixed the red checks:

  • Merged main (0.3.2 releases, substrate-prefix naming, opentui target, src shipping).
  • Renamed the package to @dunky.dev/vue-state-machine, matching the <substrate>-state-machine convention that landed on main after this PR was opened. Version aligned to the fixed group (0.3.2), src now ships alongside dist (parity with chore: ship the src folder in every published package #53).
  • Dropped the ComponentEffects alias — react removed it on main; every target now exports the ComponentEffect tuple alone.
  • Fixed the lint + format failures: the sandbox SFCs are kebab-cased (app.vue, command-palette.vue) per the repo filename rule, and everything is oxfmt-clean.

Verified locally: 360/360 tests, typecheck, build + publint all green.

The dunky-ui Vue substrate (@dunky.dev/vue-dialog) is being built against this adapter — publishing this is its prerequisite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same code — the mechanism essays in useMachine/useSelector/normalize/
mergeProps compressed to the load-bearing constraints (props-proxy
identity, array-of-getters watch sources, Vue's event-name casing).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The tables show the common subset; the source is the exhaustive list —
same pointer the react docs carry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Semantic resolution beyond the textual conflict: normalize's maps are now
vocabulary-typed (HandlerTargets/AttrTargets + key-cast reads), the shared
conformance fixture covers the vue ledgers, workspace deps pin exact per
the versioning policy, and the never-published package starts at 0.0.0
instead of the lockstep-era 0.3.2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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