Skip to content

Commit babb7c7

Browse files
ci: apply automated fixes and generate docs
1 parent 29843ad commit babb7c7

File tree

8 files changed

+164
-155
lines changed

8 files changed

+164
-155
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const fieldContextKey = "__tanstack_field_context_key"
2-
export const formContextKey = "__tanstack_form_context_key"
1+
export const fieldContextKey = '__tanstack_field_context_key'
2+
export const formContextKey = '__tanstack_form_context_key'

packages/svelte-form/src/createForm.svelte.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ export interface SvelteFormApi<
179179
WithoutFunction<Component>
180180
}
181181

182-
183182
/**
184183
* An extended version of the `FormApi` class that includes Svelte-specific functionalities from `SvelteFormApi`
185184
*/
@@ -225,7 +224,6 @@ export type SvelteFormExtendedApi<
225224
TSubmitMeta
226225
>
227226

228-
229227
export function createForm<
230228
TParentData,
231229
TFormOnMount extends undefined | FormValidateOrFn<TParentData>,

packages/svelte-form/src/createFormRune.svelte.ts

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ import { fieldContextKey, formContextKey } from './context-keys.js'
4747
type UnwrapOrAny<T> = [unknown] extends [T] ? any : T
4848
type UnwrapDefaultOrAny<DefaultT, T> = [DefaultT] extends [T]
4949
? [T] extends [DefaultT]
50-
? any
51-
: T
50+
? any
51+
: T
5252
: T
5353

5454
export function createFormRuneContexts() {
5555
function useFieldContext<TData>() {
56-
const field = getContext(fieldContextKey) as AnyFieldApi;
56+
const field = getContext(fieldContextKey) as AnyFieldApi
5757

5858
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
5959
if (!field) {
@@ -195,42 +195,41 @@ export interface WithFormProps<
195195
TFormComponents extends Record<string, Component<any, any>>,
196196
TRenderProps extends object = Record<string, never>,
197197
> extends FormOptions<
198-
TFormData,
199-
TOnMount,
200-
TOnChange,
201-
TOnChangeAsync,
202-
TOnBlur,
203-
TOnBlurAsync,
204-
TOnSubmit,
205-
TOnSubmitAsync,
206-
TOnDynamic,
207-
TOnDynamicAsync,
208-
TOnServer,
209-
TSubmitMeta
210-
> {
198+
TFormData,
199+
TOnMount,
200+
TOnChange,
201+
TOnChangeAsync,
202+
TOnBlur,
203+
TOnBlurAsync,
204+
TOnSubmit,
205+
TOnSubmitAsync,
206+
TOnDynamic,
207+
TOnDynamicAsync,
208+
TOnServer,
209+
TSubmitMeta
210+
> {
211211
// Optional, but adds props to the `render` function outside of `form`
212212
props?: TRenderProps
213213
render: (
214-
props:
215-
NoInfer<TRenderProps> & {
216-
form: AppFieldExtendedReactFormApi<
217-
TFormData,
218-
TOnMount,
219-
TOnChange,
220-
TOnChangeAsync,
221-
TOnBlur,
222-
TOnBlurAsync,
223-
TOnSubmit,
224-
TOnSubmitAsync,
225-
TOnDynamic,
226-
TOnDynamicAsync,
227-
TOnServer,
228-
TSubmitMeta,
229-
TFieldComponents,
230-
TFormComponents
231-
>,
232-
children: Snippet
233-
}
214+
props: NoInfer<TRenderProps> & {
215+
form: AppFieldExtendedReactFormApi<
216+
TFormData,
217+
TOnMount,
218+
TOnChange,
219+
TOnChangeAsync,
220+
TOnBlur,
221+
TOnBlurAsync,
222+
TOnSubmit,
223+
TOnSubmitAsync,
224+
TOnDynamic,
225+
TOnDynamicAsync,
226+
TOnServer,
227+
TSubmitMeta,
228+
TFieldComponents,
229+
TFormComponents
230+
>
231+
children: Snippet
232+
},
234233
) => SvelteComponent
235234
}
236235

@@ -291,7 +290,13 @@ export function createFormRune<
291290
return AppFormSvelte(internal, { ...props, form })
292291
}) as Component<{ children: Snippet }>
293292

294-
const AppField = ((internal, {children, ...fieldProps}) => AppFieldSvelte(internal, { fieldProps, form, fieldComponents, children } as never)) as FieldComponent<
293+
const AppField = ((internal, { children, ...fieldProps }) =>
294+
AppFieldSvelte(internal, {
295+
fieldProps,
296+
form,
297+
fieldComponents,
298+
children,
299+
} as never)) as FieldComponent<
295300
TFormData,
296301
TOnMount,
297302
TOnChange,

packages/svelte-form/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ export { default as Field, createField } from './Field.svelte'
88

99
export type { CreateField, FieldComponent } from './types.js'
1010

11-
export { createFormRune, createFormRuneContexts } from "./createFormRune.svelte.js"
11+
export {
12+
createFormRune,
13+
createFormRuneContexts,
14+
} from './createFormRune.svelte.js'

0 commit comments

Comments
 (0)