Web framework adapters
Available in 0.1.0-rc.13 (Beta): React DOM, Angular, Svelte and Solid adapters over the existing Web runtime. Install the matching npm version; native framework entries retain their existing meaning.
Package peer ranges describe installation, not every binding/runtime pair. See framework version compatibility for Solid 2 imperative consumers, Svelte 4 native actions, supported bindings and temporary override ownership.
Bindings start after client rendering; server rendering does not create a runtime. Equivalent declarations do not restart motion. A new value replaces motion from the current pose. A detached element keeps the latest declaration for reconnection; destruction stops owned animations and removes feedback listeners. Manual pause survives detachment. Use one binding per property owner; press feedback composes on its own layer.
The default bindings share a runtime per document while mounted. An explicit runtime is borrowed: bindings never configure, release or dispose it. The application disposes its runtime after its components. React accepts { runtime }; Angular uses [joltRuntime] or runtime: in *joltIf; Svelte uses createActions({ runtime }); Solid uses createDirectives({ runtime }).
Use Web keyframes and transitions: translations are CSS pixels, rotation is degrees, opacity and scale are unitless, durations are milliseconds. Reduced Motion follows the runtime policy; the controls retain normal DOM keyboard/focus behavior. Browser execution and threading differ from NativeScript. Dynamic definitions must be plain objects/arrays; invalid mounted replacements preserve active motion. Replay explicitly through the React return function; Svelte/Solid/Angular update declaratively.
React DOM
import { useRef } from 'react'
import { useAnimate, usePress } from '@rafaelaugusto/jolt/web/react'
function Card({ x }: { x: number }) {
const ref = useRef<HTMLButtonElement>(null)
const replay = useAnimate(ref, [{ x }, { duration: 500 }])
usePress(ref, { scale: 0.94 })
return (
<button ref={ref} onClick={() => replay('popIn')}>
Jolt
</button>
)
}Angular DOM
import {
JoltAnimateDirective,
JoltPressDirective,
JoltIfDirective,
} from '@rafaelaugusto/jolt/web/angular'
// @Component({ imports: [JoltAnimateDirective, JoltPressDirective, JoltIfDirective], ... })<button [joltAnimate]="{ x: position() }" [joltPress]="{ scale: 0.94 }">Jolt</button>
<div *joltIf="visible(); enter: 'fadeIn'; leave: 'fadeOut'">Jolt</div>Angular attaches after rendering. joltIf retains exactly one HTML root until its leave animation finishes; reentry cancels pending removal. Wrap sibling roots. Interrupted custom presets must use explicit keyframes; built-in preset names work directly. Angular owns structural views on the server and during hydration.
Svelte
<script>
import { animate, press } from '@rafaelaugusto/jolt/web/svelte'
let x = $state(0)
</script>
<button use:animate={{ x }} use:press={{ scale: 0.94 }} onclick={() => x = x ? 0 : 80}>Jolt</button>Solid
import { createSignal } from 'solid-js'
import {
animate,
press,
type AnimateValue,
type PressValue,
} from '@rafaelaugusto/jolt/web/solid'
declare module 'solid-js' {
namespace JSX {
interface Directives {
animate: AnimateValue
press: PressValue
}
}
}
function Card() {
const [x, setX] = createSignal(0)
return (
<button
use:animate={{ x: x() }}
use:press={{ scale: 0.94 }}
onClick={() => setX(x() ? 0 : 80)}
>
Jolt
</button>
)
}Validated packed consumers: React 19.3.1 (Strict Mode), Angular 22.2.4 (partial library compilation and actual hydration), Svelte 5.57.3 and Solid 1.9.18 (compiled client/server JSX). TypeScript NodeNext/Bundler and Chromium/Firefox/WebKit exercise imports, hydration, updates, replacement, Reduced Motion and teardown. This does not establish Next, every older framework version or every Angular rendering mode.
Owned resources and retained presence
Use a stable synchronous setup: useMotion(ref, setup) in React, [joltMotion]="setup" with JoltMotionDirective in Angular, use:motion={setup} in Svelte and use:motion={setup} in Solid. It receives (scope, element, runtime). Adopt resources through scope methods or return a disposable resource; register listener cleanup with scope.add(). Detachment destroys the graph; reconnection rebuilds it from the latest setup. Memoize React setup with useCallback. Borrowed runtimes remain application-owned.
React usePresence(ref, present, options) returns the retained render flag. Svelte createPresence(initial, options) returns a readable store with set() and a presence action; create during component initialization and use {#if $owner}. Solid createPresence(accessor, options) returns show and presence; use Show and its directive. Angular uses the existing joltIf; Vue keeps its existing transition support. Preserve one root and identity during exit; never condition rendering directly on the requested presence when using retention. Exiting roots become inert and aria-hidden, restored on reentry/cleanup. Server rendering follows initial presence without clocks. Options accept enter/leave recipes, with explicit keyframes for interrupted custom presets.