@tanstack/solid-form 0.29.2 → 0.32.0
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createForm.cjs","sources":["../../src/createForm.tsx"],"sourcesContent":["import { FormApi, functionalUpdate } from '@tanstack/form-core'\nimport {
|
1
|
+
{"version":3,"file":"createForm.cjs","sources":["../../src/createForm.tsx"],"sourcesContent":["import { FormApi, functionalUpdate } from '@tanstack/form-core'\nimport { createComputed, onMount } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { Field, createField } from './createField'\nimport type { JSXElement } from 'solid-js'\nimport type { CreateField, FieldComponent } from './createField'\nimport type { FormOptions, FormState, Validator } from '@tanstack/form-core'\n\ntype NoInfer<T> = [T][T extends any ? 0 : never]\n\nexport interface SolidFormApi<\n TFormData,\n TFormValidator extends Validator<TFormData, unknown> | undefined = undefined,\n> {\n Field: FieldComponent<TFormData, TFormValidator>\n createField: CreateField<TFormData, TFormValidator>\n useStore: <TSelected = NoInfer<FormState<TFormData>>>(\n selector?: (state: NoInfer<FormState<TFormData>>) => TSelected,\n ) => () => TSelected\n Subscribe: <TSelected = NoInfer<FormState<TFormData>>>(props: {\n selector?: (state: NoInfer<FormState<TFormData>>) => TSelected\n children: ((state: () => NoInfer<TSelected>) => JSXElement) | JSXElement\n }) => JSXElement\n}\n\nexport function createForm<\n TParentData,\n TFormValidator extends\n | Validator<TParentData, unknown>\n | undefined = undefined,\n>(opts?: () => FormOptions<TParentData, TFormValidator>) {\n const options = opts?.()\n const api = new FormApi<TParentData, TFormValidator>(options)\n const extendedApi: typeof api & SolidFormApi<TParentData, TFormValidator> =\n api as never\n\n extendedApi.Field = (props) => <Field {...props} form={api} />\n extendedApi.createField = (props) =>\n createField(() => {\n return { ...props(), form: api }\n })\n extendedApi.useStore = (selector) => useStore(api.store, selector)\n extendedApi.Subscribe = (props) =>\n functionalUpdate(props.children, useStore(api.store, props.selector))\n\n onMount(api.mount)\n\n /**\n * formApi.update should not have any side effects. Think of it like a `useRef`\n * that we need to keep updated every render with the most up-to-date information.\n */\n createComputed(() => api.update(opts?.()))\n\n return extendedApi\n}\n"],"names":["createForm","opts","options","api","FormApi","extendedApi","Field","props","_$createComponent","_$mergeProps","form","createField","useStore","selector","store","Subscribe","functionalUpdate","children","onMount","mount","createComputed","update"],"mappings":";;;;;;;AAyBO,SAASA,WAKdC,MAAuD;AACvD,QAAMC,UAAUD;AACVE,QAAAA,MAAM,IAAIC,iBAAqCF,OAAO;AAC5D,QAAMG,cACJF;AAEFE,cAAYC,QAASC,CAAAA,UAAKC,IAAMF,gBAAAA,YAAAA,OAAKG,eAAKF,OAAK;AAAA,IAAEG,MAAMP;AAAAA,EAAO,CAAA,CAAA;AAClDQ,cAAAA,cAAeJ,CACzBI,UAAAA,YAAAA,YAAY,MAAM;AACT,WAAA;AAAA,MAAE,GAAGJ,MAAM;AAAA,MAAGG,MAAMP;AAAAA,IAAAA;AAAAA,EAAI,CAChC;AACHE,cAAYO,WAAYC,CAAAA,aAAaD,WAAST,SAAAA,IAAIW,OAAOD,QAAQ;AACrDE,cAAAA,YAAaR,CACvBS,UAAAA,SAAAA,iBAAiBT,MAAMU,UAAUL,oBAAST,IAAIW,OAAOP,MAAMM,QAAQ,CAAC;AAEtEK,kBAAQf,IAAIgB,KAAK;AAMjBC,UAAAA,eAAe,MAAMjB,IAAIkB,OAAOpB,8BAAQ,CAAC;AAElCI,SAAAA;AACT;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createForm.js","sources":["../../src/createForm.tsx"],"sourcesContent":["import { FormApi, functionalUpdate } from '@tanstack/form-core'\nimport {
|
1
|
+
{"version":3,"file":"createForm.js","sources":["../../src/createForm.tsx"],"sourcesContent":["import { FormApi, functionalUpdate } from '@tanstack/form-core'\nimport { createComputed, onMount } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { Field, createField } from './createField'\nimport type { JSXElement } from 'solid-js'\nimport type { CreateField, FieldComponent } from './createField'\nimport type { FormOptions, FormState, Validator } from '@tanstack/form-core'\n\ntype NoInfer<T> = [T][T extends any ? 0 : never]\n\nexport interface SolidFormApi<\n TFormData,\n TFormValidator extends Validator<TFormData, unknown> | undefined = undefined,\n> {\n Field: FieldComponent<TFormData, TFormValidator>\n createField: CreateField<TFormData, TFormValidator>\n useStore: <TSelected = NoInfer<FormState<TFormData>>>(\n selector?: (state: NoInfer<FormState<TFormData>>) => TSelected,\n ) => () => TSelected\n Subscribe: <TSelected = NoInfer<FormState<TFormData>>>(props: {\n selector?: (state: NoInfer<FormState<TFormData>>) => TSelected\n children: ((state: () => NoInfer<TSelected>) => JSXElement) | JSXElement\n }) => JSXElement\n}\n\nexport function createForm<\n TParentData,\n TFormValidator extends\n | Validator<TParentData, unknown>\n | undefined = undefined,\n>(opts?: () => FormOptions<TParentData, TFormValidator>) {\n const options = opts?.()\n const api = new FormApi<TParentData, TFormValidator>(options)\n const extendedApi: typeof api & SolidFormApi<TParentData, TFormValidator> =\n api as never\n\n extendedApi.Field = (props) => <Field {...props} form={api} />\n extendedApi.createField = (props) =>\n createField(() => {\n return { ...props(), form: api }\n })\n extendedApi.useStore = (selector) => useStore(api.store, selector)\n extendedApi.Subscribe = (props) =>\n functionalUpdate(props.children, useStore(api.store, props.selector))\n\n onMount(api.mount)\n\n /**\n * formApi.update should not have any side effects. Think of it like a `useRef`\n * that we need to keep updated every render with the most up-to-date information.\n */\n createComputed(() => api.update(opts?.()))\n\n return extendedApi\n}\n"],"names":["createForm","opts","options","api","FormApi","extendedApi","Field","props","_$createComponent","_$mergeProps","form","createField","useStore","selector","store","Subscribe","functionalUpdate","children","onMount","mount","createComputed","update"],"mappings":";;;;;AAyBO,SAASA,WAKdC,MAAuD;AACvD,QAAMC,UAAUD;AACVE,QAAAA,MAAM,IAAIC,QAAqCF,OAAO;AAC5D,QAAMG,cACJF;AAEFE,cAAYC,QAASC,CAAAA,UAAKC,gBAAMF,OAAKG,WAAKF,OAAK;AAAA,IAAEG,MAAMP;AAAAA,EAAO,CAAA,CAAA;AAClDQ,cAAAA,cAAeJ,CACzBI,UAAAA,YAAY,MAAM;AACT,WAAA;AAAA,MAAE,GAAGJ,MAAM;AAAA,MAAGG,MAAMP;AAAAA,IAAAA;AAAAA,EAAI,CAChC;AACHE,cAAYO,WAAYC,CAAAA,aAAaD,SAAST,IAAIW,OAAOD,QAAQ;AACrDE,cAAAA,YAAaR,CACvBS,UAAAA,iBAAiBT,MAAMU,UAAUL,SAAST,IAAIW,OAAOP,MAAMM,QAAQ,CAAC;AAEtEK,UAAQf,IAAIgB,KAAK;AAMjBC,iBAAe,MAAMjB,IAAIkB,OAAOpB,8BAAQ,CAAC;AAElCI,SAAAA;AACT;"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FormApi } from '@tanstack/form-core';
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import type { JSXElement } from 'solid-js';
|
3
|
+
import type { CreateField, FieldComponent } from './createField';
|
4
4
|
import type { FormOptions, FormState, Validator } from '@tanstack/form-core';
|
5
5
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
6
6
|
export interface SolidFormApi<TFormData, TFormValidator extends Validator<TFormData, unknown> | undefined = undefined> {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { FormApi, functionalUpdate } from '@tanstack/form-core';
|
2
2
|
import { createComputed, onMount } from 'solid-js';
|
3
3
|
import { useStore } from '@tanstack/solid-store';
|
4
|
-
import { Field, createField
|
4
|
+
import { Field, createField } from './createField';
|
5
5
|
export function createForm(opts) {
|
6
6
|
const options = opts?.();
|
7
7
|
const api = new FormApi(options);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createForm.jsx","sourceRoot":"","sources":["../../src/createForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,
|
1
|
+
{"version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I,EAAE,EAAE,CAAC,CAAC,CAAA;IAE1C,OAAO,WAAW,CAAA;AACpB,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tanstack/solid-form",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.32.0",
|
4
4
|
"description": "Powerful, type-safe forms for Solid.",
|
5
5
|
"author": "tannerlinsley",
|
6
6
|
"license": "MIT",
|
@@ -42,11 +42,11 @@
|
|
42
42
|
],
|
43
43
|
"dependencies": {
|
44
44
|
"@tanstack/solid-store": "^0.5.5",
|
45
|
-
"@tanstack/form-core": "0.
|
45
|
+
"@tanstack/form-core": "0.32.0"
|
46
46
|
},
|
47
47
|
"devDependencies": {
|
48
|
-
"solid-js": "^1.8.
|
49
|
-
"vite": "^5.4.
|
48
|
+
"solid-js": "^1.8.22",
|
49
|
+
"vite": "^5.4.2",
|
50
50
|
"vite-plugin-solid": "^2.10.2"
|
51
51
|
},
|
52
52
|
"peerDependencies": {
|
package/src/createForm.tsx
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import { FormApi, functionalUpdate } from '@tanstack/form-core'
|
2
|
-
import {
|
2
|
+
import { createComputed, onMount } from 'solid-js'
|
3
3
|
import { useStore } from '@tanstack/solid-store'
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
type FieldComponent,
|
8
|
-
createField,
|
9
|
-
} from './createField'
|
4
|
+
import { Field, createField } from './createField'
|
5
|
+
import type { JSXElement } from 'solid-js'
|
6
|
+
import type { CreateField, FieldComponent } from './createField'
|
10
7
|
import type { FormOptions, FormState, Validator } from '@tanstack/form-core'
|
11
8
|
|
12
9
|
type NoInfer<T> = [T][T extends any ? 0 : never]
|