Skip to content

feat: Svelte action + Solid directive (v0.5) - #15

Merged
jlc488 merged 1 commit into
mainfrom
feature/v0.5-svelte-solid
Aug 8, 2026
Merged

feat: Svelte action + Solid directive (v0.5)#15
jlc488 merged 1 commit into
mainfrom
feature/v0.5-svelte-solid

Conversation

@jlc488

@jlc488 jlc488 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

numkey shipped Vue and React adapters only; its sibling kokey now covers four frameworks, so this closes the gap in the "-key family".

Svelte (@devslab/numkey/svelte)

use:numkey action — options object, decimals shorthand (use:numkey={2}), or nothing (data-numkey* attributes). Imports nothing from svelte, so there is no peer dependency at all.

bind:value works via the new bind() resync option: Svelte registers its binding listener before the action runs, so a reformat re-dispatches input and the second (idempotent) pass lets the binding read the formatted value. That means bind:value holds the display value — onValue reports the canonical one, mirroring React's onValueChange. It dedupes, since the resynced event re-enters the listener.

Solid (@devslab/numkey/solid)

use:numkey directive reactive to a signal (createRenderEffect + onCleanup), plus a useNumkey ref factory. No resync needed — Solid delegates input at the document level, so the element-level formatting listener runs first and onInput already reads the formatted value. solid-js is an optional peer.

Docs

Svelte/Solid sections in both READMEs, a framework entry-point table, and a proper Roadmap section — numkey only had a stray "Roadmap: Indian lakh grouping" note line, so v0.2–v0.5 are now recorded as shipped with lakh grouping left demand-gated.

Verification

  • 10 new tests (100 passing), typecheck + build green (new dist/svelte.*, dist/solid.*).
  • vitest.config.ts aliases solid-js to its browser dev build — vitest otherwise resolves the node/SSR build, which has no reactivity. Solid also batches updates inside createRoot, so the reactive test drives the signal from outside the root.
  • One test expectation was corrected during the run rather than the code: on an integer field . is not a decimal mark, so 1234567.89123,456,789 — the documented parse('1.5') === '15' contract.

- @devslab/numkey/svelte: use:numkey action taking an options object, a
  decimals shorthand, or nothing (data-numkey* attributes). bind:value
  works via the new bind() resync option — Svelte registers its binding
  listener before the action runs, so a reformat re-dispatches input and
  the second (idempotent) pass lets the binding read the formatted value.
  bind:value therefore holds the DISPLAY value; onValue reports the
  CANONICAL one, mirroring React's onValueChange. Zero svelte imports, so
  no peer dependency.
- @devslab/numkey/solid: use:numkey directive reactive to a signal
  (createRenderEffect + onCleanup) plus a useNumkey ref factory. No resync
  needed — Solid delegates input at the document level, so the
  element-level formatting listener runs first.
- onValue dedupes: the resynced input event re-enters the listener, so it
  reports only when the canonical value actually changed.
- vitest.config.ts aliases solid-js to its browser dev build; vitest
  otherwise resolves the node/SSR build, which has no reactivity. Solid
  also batches updates inside createRoot, so the reactive test drives the
  signal from outside the root.
- Docs: Svelte/Solid sections in both READMEs, a framework entry-point
  table, and a proper Roadmap section (numkey had only a stray note line)
  recording v0.2-v0.5 as shipped with Indian lakh grouping left
  demand-gated. CHANGELOG 0.5.0, version bumped.
@jlc488
jlc488 merged commit f7984b4 into main Aug 8, 2026
1 check passed
@jlc488
jlc488 deleted the feature/v0.5-svelte-solid branch August 8, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant