@octanejs/tanstack-form 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dominic Gannaway
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # @octanejs/tanstack-form
2
+
3
+ [TanStack Form](https://tanstack.com/form) bindings for the
4
+ [Octane](https://github.com/octanejs/octane) UI framework.
5
+
6
+ This package ports `@tanstack/react-form@1.33.2` onto Octane while reusing
7
+ `@tanstack/form-core@1.33.2` unchanged. The runtime export surface matches the
8
+ React adapter, so migration starts by changing the package import:
9
+
10
+ ```ts
11
+ // before
12
+ import { useForm } from '@tanstack/react-form'
13
+
14
+ // after
15
+ import { useForm } from '@octanejs/tanstack-form'
16
+ ```
17
+
18
+ The renderer-bearing adapter modules are authored as `.tsrx` and compiled by
19
+ Octane. Matching `.tsrx.d.ts` companions are checked declaration emits of those
20
+ implementations, preserving the complete generic surface for TypeScript
21
+ consumers. Recursive contracts such as `extendForm` are named in the TSRX source
22
+ rather than manually unrolled in declarations.
23
+
24
+ Renderer-specific public types use Octane names, including `OctaneFormApi`,
25
+ `OctaneFormExtendedApi`, `AppFieldExtendedOctaneFormApi`, and
26
+ `AppFieldExtendedOctaneFieldGroupApi`.
27
+
28
+ ```tsx
29
+ import { useForm } from '@octanejs/tanstack-form'
30
+
31
+ export function ProfileForm() @{
32
+ const form = useForm({
33
+ defaultValues: { name: '' },
34
+ onSubmit: ({ value }) => console.log(value),
35
+ })
36
+
37
+ <form
38
+ onSubmit={(event) => {
39
+ event.preventDefault()
40
+ void form.handleSubmit()
41
+ }}
42
+ >
43
+ <form.Field
44
+ name="name"
45
+ validators={{
46
+ onChange: ({ value }) =>
47
+ value.length === 0 ? 'Name is required' : undefined,
48
+ }}
49
+ >
50
+ {(field) => (
51
+ <label>
52
+ Name
53
+ <input
54
+ value={field.state.value}
55
+ onBlur={field.handleBlur}
56
+ onInput={(event) => field.handleChange(event.target.value)}
57
+ />
58
+ @if (field.state.meta.errors.length > 0) {
59
+ <span>{field.state.meta.errors.join(', ')}</span>
60
+ }
61
+ </label>
62
+ )}
63
+ </form.Field>
64
+ <form.Subscribe selector={(state) => state.canSubmit}>
65
+ {(canSubmit) => <button disabled={!canSubmit}>Submit</button>}
66
+ </form.Subscribe>
67
+ </form>
68
+ }
69
+ ```
70
+
71
+ ## API
72
+
73
+ The adapter includes `useForm`, `useField`, `useFormGroup`, `useFieldGroup`,
74
+ `createFormHook`, `createFormHookContexts`, and
75
+ `useIsomorphicLayoutEffect`. It also re-exports `@tanstack/form-core` and the
76
+ `useSelector`/`useStore` helpers from `@octanejs/tanstack-store`.
77
+
78
+ Octane uses native DOM events. Text controls should call
79
+ `field.handleChange()` from `onInput`; native `change` fires only on
80
+ blur/commit. TanStack Form option names such as `onChange`, validators, and
81
+ listener keys retain their upstream spelling.
82
+
83
+ Server rendering through `octane/server` is supported. Field and form
84
+ subscriptions render their initial snapshots without browser-only setup.
85
+
86
+ ## Verification
87
+
88
+ The port runs TanStack Form's React adapter tests against Octane, including
89
+ validation, async validation and debounce, linked fields, arrays, form groups,
90
+ component contexts, submission, reset, and subscription behavior. A
91
+ differential test compiles the same `.tsrx` form for Octane and React and
92
+ compares its DOM after value, validation, array, and reset interactions. The
93
+ upstream compile-time suite and an SSR fixture are also included.
94
+
95
+ Current scope and verification status are tracked in the generated
96
+ [bindings status table](../../docs/bindings-status.md), sourced from this
97
+ package's [`status.json`](./status.json).
98
+
99
+ ## License
100
+
101
+ MIT — contains source derived from
102
+ [TanStack Form](https://github.com/TanStack/form) (MIT), adapted for Octane.
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@octanejs/tanstack-form",
3
+ "version": "0.0.1",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=22"
8
+ },
9
+ "description": "TanStack Form bindings for Octane — reuses @tanstack/form-core and ports the React adapter's hooks, components, and contexts.",
10
+ "author": {
11
+ "name": "Dominic Gannaway",
12
+ "email": "dg@domgan.com"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/octanejs/octane.git",
20
+ "directory": "packages/tanstack-form"
21
+ },
22
+ "main": "src/index.ts",
23
+ "module": "src/index.ts",
24
+ "types": "src/index.ts",
25
+ "files": [
26
+ "src",
27
+ "README.md"
28
+ ],
29
+ "exports": {
30
+ ".": "./src/index.ts"
31
+ },
32
+ "dependencies": {
33
+ "@tanstack/form-core": "1.33.2",
34
+ "@octanejs/tanstack-store": "0.0.1"
35
+ },
36
+ "peerDependencies": {
37
+ "octane": "0.1.7"
38
+ },
39
+ "devDependencies": {
40
+ "@tanstack/react-form": "1.33.2",
41
+ "@testing-library/jest-dom": "^6.9.1",
42
+ "@testing-library/user-event": "^14.6.1",
43
+ "@tsrx/react": "^0.2.37",
44
+ "esbuild": "^0.28.1",
45
+ "react": "^19.2.0",
46
+ "react-dom": "^19.2.0",
47
+ "vitest": "^4.1.9",
48
+ "@octanejs/testing-library": "0.1.4",
49
+ "octane": "0.1.7"
50
+ },
51
+ "scripts": {
52
+ "test": "vitest run"
53
+ }
54
+ }