Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tanstack/form-core

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/form-core - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

88

build/stats-react.json

@@ -11,3 +11,3 @@ {

"name": "node_modules/.pnpm/@tanstack+store@0.0.1-beta.84/node_modules/@tanstack/store/build/esm/index.js",
"uid": "52cd-13"
"uid": "7ee7-13"
},

@@ -18,15 +18,15 @@ {

{
"uid": "52cd-15",
"uid": "7ee7-15",
"name": "utils.ts"
},
{
"uid": "52cd-17",
"uid": "7ee7-17",
"name": "FormApi.ts"
},
{
"uid": "52cd-21",
"uid": "7ee7-21",
"name": "FieldApi.ts"
},
{
"uid": "52cd-23",
"uid": "7ee7-23",
"name": "index.ts"

@@ -37,3 +37,3 @@ }

{
"uid": "52cd-19",
"uid": "7ee7-19",
"name": "\u0000rollupPluginBabelHelpers.js"

@@ -47,44 +47,44 @@ }

"nodeParts": {
"52cd-13": {
"7ee7-13": {
"renderedLength": 1288,
"gzipLength": 497,
"brotliLength": 0,
"mainUid": "52cd-12"
"mainUid": "7ee7-12"
},
"52cd-15": {
"7ee7-15": {
"renderedLength": 1944,
"gzipLength": 684,
"brotliLength": 0,
"mainUid": "52cd-14"
"mainUid": "7ee7-14"
},
"52cd-17": {
"7ee7-17": {
"renderedLength": 10266,
"gzipLength": 2308,
"brotliLength": 0,
"mainUid": "52cd-16"
"mainUid": "7ee7-16"
},
"52cd-19": {
"7ee7-19": {
"renderedLength": 353,
"gzipLength": 227,
"brotliLength": 0,
"mainUid": "52cd-18"
"mainUid": "7ee7-18"
},
"52cd-21": {
"7ee7-21": {
"renderedLength": 7553,
"gzipLength": 1868,
"brotliLength": 0,
"mainUid": "52cd-20"
"mainUid": "7ee7-20"
},
"52cd-23": {
"7ee7-23": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "52cd-22"
"mainUid": "7ee7-22"
}
},
"nodeMetas": {
"52cd-12": {
"7ee7-12": {
"id": "/node_modules/.pnpm/@tanstack+store@0.0.1-beta.84/node_modules/@tanstack/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "52cd-13"
"index.production.js": "7ee7-13"
},

@@ -94,13 +94,13 @@ "imported": [],

{
"uid": "52cd-16"
"uid": "7ee7-16"
},
{
"uid": "52cd-20"
"uid": "7ee7-20"
}
]
},
"52cd-14": {
"7ee7-14": {
"id": "/packages/form-core/src/utils.ts",
"moduleParts": {
"index.production.js": "52cd-15"
"index.production.js": "7ee7-15"
},

@@ -110,20 +110,20 @@ "imported": [],

{
"uid": "52cd-22"
"uid": "7ee7-22"
},
{
"uid": "52cd-16"
"uid": "7ee7-16"
}
]
},
"52cd-16": {
"7ee7-16": {
"id": "/packages/form-core/src/FormApi.ts",
"moduleParts": {
"index.production.js": "52cd-17"
"index.production.js": "7ee7-17"
},
"imported": [
{
"uid": "52cd-12"
"uid": "7ee7-12"
},
{
"uid": "52cd-14"
"uid": "7ee7-14"
}

@@ -133,10 +133,10 @@ ],

{
"uid": "52cd-22"
"uid": "7ee7-22"
}
]
},
"52cd-18": {
"7ee7-18": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "52cd-19"
"index.production.js": "7ee7-19"
},

@@ -146,17 +146,17 @@ "imported": [],

{
"uid": "52cd-20"
"uid": "7ee7-20"
}
]
},
"52cd-20": {
"7ee7-20": {
"id": "/packages/form-core/src/FieldApi.ts",
"moduleParts": {
"index.production.js": "52cd-21"
"index.production.js": "7ee7-21"
},
"imported": [
{
"uid": "52cd-18"
"uid": "7ee7-18"
},
{
"uid": "52cd-12"
"uid": "7ee7-12"
}

@@ -166,20 +166,20 @@ ],

{
"uid": "52cd-22"
"uid": "7ee7-22"
}
]
},
"52cd-22": {
"7ee7-22": {
"id": "/packages/form-core/src/index.ts",
"moduleParts": {
"index.production.js": "52cd-23"
"index.production.js": "7ee7-23"
},
"imported": [
{
"uid": "52cd-16"
"uid": "7ee7-16"
},
{
"uid": "52cd-20"
"uid": "7ee7-20"
},
{
"uid": "52cd-14"
"uid": "7ee7-14"
}

@@ -186,0 +186,0 @@ ],

@@ -1,167 +0,3 @@

/**
* form-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import { FormEvent } from 'react';
import { Store } from '@tanstack/store';
declare type UpdaterFn<TInput, TOutput = TInput> = (input: TInput) => TOutput;
declare type Updater<TInput, TOutput = TInput> = TOutput | UpdaterFn<TInput, TOutput>;
declare function functionalUpdate<TInput, TOutput = TInput>(updater: Updater<TInput, TOutput>, input: TInput): TOutput;
declare function getBy(obj: any, path: any): any;
declare function setBy(obj: any, _path: any, updater: Updater<any>): any;
declare type RequiredByKey<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
declare type ComputeRange<N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : ComputeRange<N, [...Result, Result['length']]>;
declare type Index40 = ComputeRange<40>[number];
declare type IsTuple<T> = T extends readonly any[] & {
length: infer Length;
} ? Length extends Index40 ? T : never : never;
declare type AllowedIndexes<Tuple extends ReadonlyArray<any>, Keys extends number = never> = Tuple extends readonly [] ? Keys : Tuple extends readonly [infer _, ...infer Tail] ? AllowedIndexes<Tail, Keys | Tail['length']> : Keys;
declare type DeepKeys<T> = unknown extends T ? keyof T : object extends T ? string : T extends readonly any[] & IsTuple<T> ? AllowedIndexes<T> | DeepKeysPrefix<T, AllowedIndexes<T>> : T extends any[] ? never & 'Dynamic length array indexing is not supported' : T extends Date ? never : T extends object ? (keyof T & string) | DeepKeysPrefix<T, keyof T> : never;
declare type DeepKeysPrefix<T, TPrefix> = TPrefix extends keyof T & (number | string) ? `${TPrefix}.${DeepKeys<T[TPrefix]> & string}` : never;
declare type DeepValue<T, TProp> = T extends Record<string | number, any> ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue<T[TBranch], TDeepProp> : T[TProp & string] : never;
declare type ValidateOn = 'change' | 'blur' | 'submit';
declare type FieldOptions<TData, TFormData> = {
name: unknown extends TFormData ? string : DeepKeys<TFormData>;
defaultValue?: TData;
form?: FormApi<TFormData>;
validate?: (value: TData, fieldApi: FieldApi<TData, TFormData>) => ValidationError;
validateAsync?: (value: TData, fieldApi: FieldApi<TData, TFormData>) => ValidationError | Promise<ValidationError>;
validatePristine?: boolean;
validateOn?: ValidateOn;
validateAsyncOn?: ValidateOn;
validateAsyncDebounceMs?: number;
filterValue?: (value: TData) => TData;
defaultMeta?: Partial<FieldMeta>;
change?: boolean;
blur?: boolean;
submit?: boolean;
};
declare type FieldMeta = {
isTouched: boolean;
touchedError?: ValidationError;
error?: ValidationError;
isValidating: boolean;
};
declare type ChangeProps<TData> = {
onChange?: (updater: Updater<TData>) => void;
onBlur?: (event: any) => void;
};
declare type InputProps = {
onChange?: (event: any) => void;
onBlur?: (event: any) => void;
};
declare type FieldApiOptions<TData, TFormData> = RequiredByKey<FieldOptions<TData, TFormData>, 'form'>;
declare type FieldState<TData> = {
value: TData;
meta: FieldMeta;
};
declare class FieldApi<TData, TFormData> {
#private;
uid: number;
form: FormApi<TFormData>;
name: DeepKeys<TFormData>;
store: Store<FieldState<TData>>;
state: FieldState<TData>;
options: RequiredByKey<FieldOptions<TData, TFormData>, 'validateOn' | 'validateAsyncOn'>;
constructor(opts: FieldApiOptions<TData, TFormData>);
mount: () => () => void;
update: (opts: FieldApiOptions<TData, TFormData>) => void;
getValue: () => TData;
setValue: (updater: Updater<TData>, options?: {
touch?: boolean;
notify?: boolean;
}) => void;
getMeta: () => FieldMeta;
setMeta: (updater: Updater<FieldMeta>) => void;
getInfo: () => Record<DeepKeys<TFormData>, FieldInfo<TFormData>>[DeepKeys<TFormData>];
pushValue: (value: TData) => void;
insertValue: (index: number, value: TData) => void;
removeValue: (index: number) => void;
swapValues: (aIndex: number, bIndex: number) => void;
getSubField: <TName extends DeepKeys<TData>>(name: TName) => FieldApi<DeepValue<TData, TName>, TFormData>;
validate: () => Promise<ValidationError>;
validateAsync: () => Promise<ValidationError>;
getChangeProps: <T extends ChangeProps<any>>(props?: T) => ChangeProps<TData> & Omit<T, keyof ChangeProps<TData>>;
getInputProps: <T extends InputProps>(props?: T) => InputProps & Omit<T, keyof InputProps>;
}
declare type FormOptions<TData> = {
defaultValues?: TData;
defaultState?: Partial<FormState<TData>>;
onSubmit?: (values: TData, formApi: FormApi<TData>) => Promise<any>;
onInvalidSubmit?: (values: TData, formApi: FormApi<TData>) => void;
validate?: (values: TData, formApi: FormApi<TData>) => Promise<any>;
debugForm?: boolean;
validatePristine?: boolean;
};
declare type FieldInfo<TFormData> = {
instances: Record<string, FieldApi<any, TFormData>>;
} & ValidationMeta;
declare type ValidationMeta = {
validationCount?: number;
validationPromise?: Promise<ValidationError>;
validationResolve?: (error: ValidationError) => void;
validationReject?: (error: unknown) => void;
};
declare type ValidationError = undefined | false | null | string;
declare type FormState<TData> = {
values: TData;
isFormValidating: boolean;
formValidationCount: number;
isFormValid: boolean;
formError?: ValidationError;
fieldMeta: Record<DeepKeys<TData>, FieldMeta>;
isFieldsValidating: boolean;
isFieldsValid: boolean;
isSubmitting: boolean;
isTouched: boolean;
isSubmitted: boolean;
isValidating: boolean;
isValid: boolean;
canSubmit: boolean;
submissionAttempts: number;
};
declare function getDefaultFormState<TData>(defaultState: Partial<FormState<TData>>): FormState<TData>;
declare class FormApi<TFormData> {
options: FormOptions<TFormData>;
store: Store<FormState<TFormData>>;
state: FormState<TFormData>;
fieldInfo: Record<DeepKeys<TFormData>, FieldInfo<TFormData>>;
fieldName?: string;
validationMeta: ValidationMeta;
constructor(opts?: FormOptions<TFormData>);
update: (options: FormOptions<TFormData>) => void;
reset: () => void;
validateAllFields: () => Promise<ValidationError[]>;
validateForm: () => Promise<ValidationError>;
handleSubmit: (e: FormEvent & {
__handled?: boolean;
}) => Promise<void>;
getFieldValue: <TField extends DeepKeys<TFormData>>(field: TField) => DeepValue<TFormData, TField>;
getFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField) => FieldMeta;
getFieldInfo: <TField extends DeepKeys<TFormData>>(field: TField) => Record<DeepKeys<TFormData>, FieldInfo<TFormData>>[TField];
setFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField, updater: Updater<FieldMeta>) => void;
setFieldValue: <TField extends DeepKeys<TFormData>>(field: TField, updater: Updater<DeepValue<TFormData, TField>, DeepValue<TFormData, TField>>, opts?: {
touch?: boolean;
}) => void;
pushFieldValue: <TField extends DeepKeys<TFormData>>(field: TField, value: DeepValue<TFormData, TField>, opts?: {
touch?: boolean;
}) => void;
insertFieldValue: <TField extends DeepKeys<TFormData>>(field: TField, index: number, value: DeepValue<TFormData, TField>, opts?: {
touch?: boolean;
}) => void;
spliceFieldValue: <TField extends DeepKeys<TFormData>>(field: TField, index: number, opts?: {
touch?: boolean;
}) => void;
swapFieldValues: <TField extends DeepKeys<TFormData>>(field: TField, index1: number, index2: number) => void;
}
export { ChangeProps, DeepKeys, DeepValue, FieldApi, FieldApiOptions, FieldInfo, FieldMeta, FieldOptions, FieldState, FormApi, FormOptions, FormState, InputProps, RequiredByKey, Updater, UpdaterFn, ValidationError, ValidationMeta, functionalUpdate, getBy, getDefaultFormState, setBy };
export * from './FormApi';
export * from './FieldApi';
export * from './utils';
{
"name": "@tanstack/form-core",
"version": "0.0.1",
"version": "0.0.2",
"description": "Powerful, type-safe, framework agnostic forms.",

@@ -5,0 +5,0 @@ "author": "tannerlinsley",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc