Skip to content

Commit e89f69c

Browse files
committed
add API and fix reference generation
1 parent 54835d0 commit e89f69c

18 files changed

Lines changed: 679 additions & 224 deletions

File tree

docs/config.json

Lines changed: 53 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -255,288 +255,126 @@
255255
]
256256
},
257257
{
258+
"label": "Recommended Types",
258259
"collapsible": true,
259-
"defaultCollapsed": true,
260-
"label": "API Reference",
260+
"defaultCollapsed": false,
261261
"children": [
262262
{
263-
"label": "Core API Reference",
264-
"to": "reference/index"
265-
},
266-
{
267-
"label": "Interfaces / FieldApi",
268-
"to": "reference/interfaces/FieldApi"
269-
},
270-
{
271-
"label": "Interfaces / FormApi",
272-
"to": "reference/interfaces/FormApi"
273-
},
274-
{
275-
"label": "Variables / formOptions",
276-
"to": "reference/variables/formOptions"
277-
},
278-
{
279-
"label": "Functions / createValidator",
280-
"to": "reference/functions/createValidator"
281-
},
282-
{
283-
"label": "Functions / createValidators",
284-
"to": "reference/functions/createValidators"
285-
},
286-
{
287-
"label": "Interfaces / FieldApiOptions",
288-
"to": "reference/interfaces/FieldApiOptions"
289-
},
290-
{
291-
"label": "Interfaces / FormOptions",
292-
"to": "reference/interfaces/FormOptions"
293-
},
294-
{
295-
"label": "Types / FieldValidators",
296-
"to": "reference/type-aliases/FieldValidators"
297-
},
298-
{
299-
"label": "Types / FormValidators",
300-
"to": "reference/type-aliases/FormValidators"
301-
},
302-
{
303-
"label": "Types / DeepKeys",
304-
"to": "reference/type-aliases/DeepKeys"
305-
},
306-
{
307-
"label": "Types / DeepValue",
308-
"to": "reference/type-aliases/DeepValue"
309-
},
310-
{
311-
"label": "Types / AnyFieldMeta",
312-
"to": "reference/type-aliases/AnyFieldMeta"
313-
},
314-
{
315-
"label": "Interfaces / FormState",
316-
"to": "reference/interfaces/FormState"
263+
"label": "AnyFieldApi",
264+
"to": "reference/type-aliases/AnyFieldApi"
317265
},
318266
{
319-
"label": "Types / Updater",
320-
"to": "reference/type-aliases/Updater"
267+
"label": "FieldWithValue<TFieldValue>",
268+
"to": "reference/type-aliases/FieldWithValue"
321269
},
322270
{
323-
"label": "Types / UpdateFn",
324-
"to": "reference/type-aliases/UpdateFn"
325-
},
326-
{
327-
"label": "Types / ValidationError",
328-
"to": "reference/type-aliases/ValidationError"
329-
},
330-
{
331-
"label": "Interfaces / ValidationIssue",
332-
"to": "reference/interfaces/ValidationIssue"
271+
"label": "AnyFormApi",
272+
"to": "reference/type-aliases/AnyFormApi"
333273
}
334274
],
335275
"frameworks": [
336276
{
337277
"label": "react",
338278
"children": [
339279
{
340-
"label": "React Reference",
341-
"to": "framework/react/reference/index"
342-
},
343-
{
344-
"label": "Variables / useForm",
345-
"to": "framework/react/reference/variables/useForm"
346-
},
347-
{
348-
"label": "Functions / createFormHook",
349-
"to": "framework/react/reference/functions/createFormHook"
350-
},
351-
{
352-
"label": "Functions / Subscribe",
353-
"to": "framework/react/reference/functions/Subscribe"
354-
},
355-
{
356-
"label": "Interfaces / FieldGroupApi",
357-
"to": "framework/react/reference/interfaces/FieldGroupApi"
358-
},
359-
{
360-
"label": "Types / ReactFieldApi",
361-
"to": "framework/react/reference/type-aliases/ReactFieldApi"
280+
"label": "AnyReactFormApi",
281+
"to": "framework/react/reference/type-aliases/AnyReactFormApi"
362282
},
363283
{
364-
"label": "Types / ReactFormApi",
365-
"to": "framework/react/reference/type-aliases/ReactFormApi"
366-
},
367-
{
368-
"label": "Types / ReactAppFormApi",
369-
"to": "framework/react/reference/type-aliases/ReactAppFormApi"
284+
"label": "ReactFormType<TOptions>",
285+
"to": "framework/react/reference/type-aliases/ReactFormType"
370286
}
371287
]
372288
},
373289
{
374290
"label": "preact",
375291
"children": [
376292
{
377-
"label": "Preact Reference",
378-
"to": "framework/preact/reference/index"
379-
},
380-
{
381-
"label": "Variables / useForm",
382-
"to": "framework/preact/reference/variables/useForm"
293+
"label": "AnyPreactFormApi",
294+
"to": "framework/preact/reference/type-aliases/AnyPreactFormApi"
383295
},
384296
{
385-
"label": "Functions / createFormHook",
386-
"to": "framework/preact/reference/functions/createFormHook"
387-
},
388-
{
389-
"label": "Functions / Subscribe",
390-
"to": "framework/preact/reference/functions/Subscribe"
391-
},
392-
{
393-
"label": "Interfaces / FieldGroupApi",
394-
"to": "framework/preact/reference/interfaces/FieldGroupApi"
395-
},
396-
{
397-
"label": "Types / PreactFieldApi",
398-
"to": "framework/preact/reference/type-aliases/PreactFieldApi"
399-
},
400-
{
401-
"label": "Types / PreactFormApi",
402-
"to": "framework/preact/reference/type-aliases/PreactFormApi"
403-
},
404-
{
405-
"label": "Types / PreactAppFormApi",
406-
"to": "framework/preact/reference/type-aliases/PreactAppFormApi"
297+
"label": "PreactFormType<TOptions>",
298+
"to": "framework/preact/reference/type-aliases/PreactFormType"
407299
}
408300
]
409301
},
410302
{
411303
"label": "vue",
412304
"children": [
413305
{
414-
"label": "Vue Reference",
415-
"to": "framework/vue/reference/index"
416-
},
417-
{
418-
"label": "Variables / useForm",
419-
"to": "framework/vue/reference/variables/useForm"
420-
},
421-
{
422-
"label": "Variables / Subscribe",
423-
"to": "framework/vue/reference/variables/Subscribe"
424-
},
425-
{
426-
"label": "Functions / createFormHook",
427-
"to": "framework/vue/reference/functions/createFormHook"
306+
"label": "AnyVueFormApi",
307+
"to": "framework/vue/reference/type-aliases/AnyVueFormApi"
428308
},
429309
{
430-
"label": "Interfaces / FieldGroupApi",
431-
"to": "framework/vue/reference/interfaces/FieldGroupApi"
432-
},
433-
{
434-
"label": "Types / VueFieldApi",
435-
"to": "framework/vue/reference/type-aliases/VueFieldApi"
436-
},
437-
{
438-
"label": "Types / VueFormApi",
439-
"to": "framework/vue/reference/type-aliases/VueFormApi"
440-
},
441-
{
442-
"label": "Types / VueAppFormApi",
443-
"to": "framework/vue/reference/type-aliases/VueAppFormApi"
310+
"label": "VueFormType<TOptions>",
311+
"to": "framework/vue/reference/type-aliases/VueFormType"
444312
}
445313
]
446314
},
447315
{
448316
"label": "angular",
449317
"children": [
450318
{
451-
"label": "Angular Reference",
452-
"to": "framework/angular/reference/index"
319+
"label": "AnyAngularFormApi",
320+
"to": "framework/angular/reference/type-aliases/AnyAngularFormApi"
453321
},
454322
{
455-
"label": "Classes / TanStackField",
456-
"to": "framework/angular/reference/classes/TanStackField"
457-
},
458-
{
459-
"label": "Classes / TanStackFormGroup",
460-
"to": "framework/angular/reference/classes/TanStackFormGroup"
461-
},
462-
{
463-
"label": "Functions / injectField",
464-
"to": "framework/angular/reference/functions/injectField"
465-
},
466-
{
467-
"label": "Functions / injectForm",
468-
"to": "framework/angular/reference/functions/injectForm"
469-
},
470-
{
471-
"label": "Functions / injectSelector",
472-
"to": "framework/angular/reference/functions/injectSelector"
323+
"label": "AngularFormType<TOptions>",
324+
"to": "framework/angular/reference/type-aliases/AngularFormType"
473325
}
474326
]
475327
},
476328
{
477329
"label": "solid",
478330
"children": [
479331
{
480-
"label": "Solid Reference",
481-
"to": "framework/solid/reference/index"
482-
},
483-
{
484-
"label": "Variables / createForm",
485-
"to": "framework/solid/reference/variables/createForm"
486-
},
487-
{
488-
"label": "Functions / createFormHook",
489-
"to": "framework/solid/reference/functions/createFormHook"
490-
},
491-
{
492-
"label": "Functions / Subscribe",
493-
"to": "framework/solid/reference/functions/Subscribe"
332+
"label": "AnySolidFormApi",
333+
"to": "framework/solid/reference/type-aliases/AnySolidFormApi"
494334
},
495335
{
496-
"label": "Interfaces / FieldGroupApi",
497-
"to": "framework/solid/reference/interfaces/FieldGroupApi"
498-
},
499-
{
500-
"label": "Types / SolidFieldApi",
501-
"to": "framework/solid/reference/type-aliases/SolidFieldApi"
502-
},
503-
{
504-
"label": "Types / SolidFormApi",
505-
"to": "framework/solid/reference/type-aliases/SolidFormApi"
506-
},
507-
{
508-
"label": "Types / SolidAppFormApi",
509-
"to": "framework/solid/reference/type-aliases/SolidAppFormApi"
336+
"label": "SolidFormType<TOptions>",
337+
"to": "framework/solid/reference/type-aliases/SolidFormType"
510338
}
511339
]
512340
},
513341
{
514342
"label": "lit",
515343
"children": [
516344
{
517-
"label": "Lit Reference",
518-
"to": "framework/lit/reference/index"
345+
"label": "AnyLitFormApi",
346+
"to": "framework/lit/reference/type-aliases/AnyLitFormApi"
519347
},
520348
{
521-
"label": "Classes / TanStackFormController",
522-
"to": "framework/lit/reference/classes/TanStackFormController"
523-
},
524-
{
525-
"label": "Functions / getFormType",
526-
"to": "framework/lit/reference/functions/getFormType"
527-
},
528-
{
529-
"label": "Variables / defineFieldGroup",
530-
"to": "framework/lit/reference/variables/defineFieldGroup"
531-
},
349+
"label": "LitFormType<TOptions>",
350+
"to": "framework/lit/reference/type-aliases/LitFormType"
351+
}
352+
]
353+
},
354+
{
355+
"label": "svelte",
356+
"children": [
532357
{
533-
"label": "Types / LitFormGroupApi",
534-
"to": "framework/lit/reference/type-aliases/LitFormGroupApi"
358+
"label": "AnySvelteFormApi",
359+
"to": "framework/svelte/reference/type-aliases/AnySvelteFormApi"
535360
}
536361
]
537362
}
538363
]
539364
},
365+
{
366+
"label": "API Reference",
367+
"children": [
368+
{
369+
"label": "Form Listeners",
370+
"to": "reference/type-aliases/FormListeners"
371+
},
372+
{
373+
"label": "Field Listeners",
374+
"to": "reference/type-aliases/FieldListeners"
375+
}
376+
]
377+
},
540378
{
541379
"label": "Examples",
542380
"children": [],

examples/lit/basic-splitting-form/src/form-submit-button.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { html } from 'lit'
2-
import type { LitFormType } from '@tanstack/lit-form'
3-
import type { sharedFormOptions } from './shared-form'
2+
import type { AnyLitFormApi } from '@tanstack/lit-form'
43

5-
export function formSubmitButton(form: LitFormType<typeof sharedFormOptions>) {
4+
export function formSubmitButton(form: AnyLitFormApi) {
65
return form.subscribe(
76
(state) => [state.canSubmit, state.isSubmitting] as const,
87
([canSubmit, isSubmitting]) => html`

0 commit comments

Comments
 (0)