@tanstack/preact-form 1.29.7 → 1.30.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.
Files changed (49) hide show
  1. package/dist/cjs/createFormHook.cjs.map +1 -1
  2. package/dist/cjs/createFormHook.d.cts +9 -9
  3. package/dist/cjs/index.cjs +8 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +2 -1
  6. package/dist/cjs/useField.cjs +8 -9
  7. package/dist/cjs/useField.cjs.map +1 -1
  8. package/dist/cjs/useField.d.cts +1 -7
  9. package/dist/cjs/useFieldGroup.cjs +2 -2
  10. package/dist/cjs/useFieldGroup.cjs.map +1 -1
  11. package/dist/cjs/useFieldGroup.d.cts +4 -4
  12. package/dist/cjs/useForm.cjs +6 -2
  13. package/dist/cjs/useForm.cjs.map +1 -1
  14. package/dist/cjs/useForm.d.cts +7 -6
  15. package/dist/cjs/useFormGroup.cjs +163 -0
  16. package/dist/cjs/useFormGroup.cjs.map +1 -0
  17. package/dist/cjs/useFormGroup.d.cts +13 -0
  18. package/dist/esm/createFormHook.d.ts +9 -9
  19. package/dist/esm/createFormHook.js +1 -1
  20. package/dist/esm/createFormHook.js.map +1 -1
  21. package/dist/esm/index.d.ts +2 -1
  22. package/dist/esm/index.js +4 -1
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/useField.d.ts +1 -7
  25. package/dist/esm/useField.js +3 -4
  26. package/dist/esm/useField.js.map +1 -1
  27. package/dist/esm/useFieldGroup.d.ts +4 -4
  28. package/dist/esm/useFieldGroup.js +1 -1
  29. package/dist/esm/useFieldGroup.js.map +1 -1
  30. package/dist/esm/useForm.d.ts +7 -6
  31. package/dist/esm/useForm.js +5 -1
  32. package/dist/esm/useForm.js.map +1 -1
  33. package/dist/esm/useFormGroup.d.ts +13 -0
  34. package/dist/esm/useFormGroup.js +163 -0
  35. package/dist/esm/useFormGroup.js.map +1 -0
  36. package/package.json +5 -4
  37. package/src/createFormHook.tsx +11 -11
  38. package/src/index.ts +2 -1
  39. package/src/useField.tsx +2 -51
  40. package/src/useFieldGroup.tsx +9 -9
  41. package/src/useForm.tsx +27 -8
  42. package/src/useFormGroup.tsx +741 -0
  43. package/dist/cjs/useStore.cjs +0 -24
  44. package/dist/cjs/useStore.cjs.map +0 -1
  45. package/dist/cjs/useStore.d.cts +0 -13
  46. package/dist/esm/useStore.d.ts +0 -13
  47. package/dist/esm/useStore.js +0 -24
  48. package/dist/esm/useStore.js.map +0 -1
  49. package/src/useStore.ts +0 -44
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const preactStore = require("@tanstack/preact-store");
4
- function bridgeStore(store) {
5
- return {
6
- get state() {
7
- return store.state;
8
- },
9
- // @tanstack/preact-store currently calls subscribe unbound.
10
- subscribe: (listener) => {
11
- const subscription = store.subscribe(listener);
12
- return typeof subscription === "function" ? subscription : () => subscription.unsubscribe();
13
- }
14
- };
15
- }
16
- function useStore(store, selector, options) {
17
- return preactStore.useStore(
18
- bridgeStore(store),
19
- selector,
20
- options
21
- );
22
- }
23
- exports.useStore = useStore;
24
- //# sourceMappingURL=useStore.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStore.cjs","sources":["../../src/useStore.ts"],"sourcesContent":["import { useStore as usePreactStore } from '@tanstack/preact-store'\n\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\n\ntype EqualityFn<T> = (objA: T, objB: T) => boolean\n\ninterface UseStoreOptions<T> {\n equal?: EqualityFn<T>\n}\n\ntype StoreLike<TState> = {\n subscribe: (\n listener: (...args: Array<unknown>) => void,\n ) => { unsubscribe: () => void } | (() => void)\n readonly state: TState\n}\n\nfunction bridgeStore<TState>(store: StoreLike<TState>) {\n return {\n get state() {\n return store.state\n },\n // @tanstack/preact-store currently calls subscribe unbound.\n subscribe: (listener: () => void) => {\n const subscription = store.subscribe(listener)\n\n return typeof subscription === 'function'\n ? subscription\n : () => subscription.unsubscribe()\n },\n }\n}\n\nexport function useStore<TState, TSelected = NoInfer<TState>>(\n store: StoreLike<TState>,\n selector?: (state: NoInfer<TState>) => TSelected,\n options?: UseStoreOptions<TSelected>,\n): TSelected {\n return usePreactStore(\n bridgeStore(store) as never,\n selector as never,\n options as never,\n ) as TSelected\n}\n"],"names":["usePreactStore"],"mappings":";;;AAiBA,SAAS,YAAoB,OAA0B;AACrD,SAAO;AAAA,IACL,IAAI,QAAQ;AACV,aAAO,MAAM;AAAA,IACf;AAAA;AAAA,IAEA,WAAW,CAAC,aAAyB;AACnC,YAAM,eAAe,MAAM,UAAU,QAAQ;AAE7C,aAAO,OAAO,iBAAiB,aAC3B,eACA,MAAM,aAAa,YAAA;AAAA,IACzB;AAAA,EAAA;AAEJ;AAEO,SAAS,SACd,OACA,UACA,SACW;AACX,SAAOA,YAAAA;AAAAA,IACL,YAAY,KAAK;AAAA,IACjB;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
@@ -1,13 +0,0 @@
1
- export type NoInfer<T> = [T][T extends any ? 0 : never];
2
- type EqualityFn<T> = (objA: T, objB: T) => boolean;
3
- interface UseStoreOptions<T> {
4
- equal?: EqualityFn<T>;
5
- }
6
- type StoreLike<TState> = {
7
- subscribe: (listener: (...args: Array<unknown>) => void) => {
8
- unsubscribe: () => void;
9
- } | (() => void);
10
- readonly state: TState;
11
- };
12
- export declare function useStore<TState, TSelected = NoInfer<TState>>(store: StoreLike<TState>, selector?: (state: NoInfer<TState>) => TSelected, options?: UseStoreOptions<TSelected>): TSelected;
13
- export {};
@@ -1,13 +0,0 @@
1
- export type NoInfer<T> = [T][T extends any ? 0 : never];
2
- type EqualityFn<T> = (objA: T, objB: T) => boolean;
3
- interface UseStoreOptions<T> {
4
- equal?: EqualityFn<T>;
5
- }
6
- type StoreLike<TState> = {
7
- subscribe: (listener: (...args: Array<unknown>) => void) => {
8
- unsubscribe: () => void;
9
- } | (() => void);
10
- readonly state: TState;
11
- };
12
- export declare function useStore<TState, TSelected = NoInfer<TState>>(store: StoreLike<TState>, selector?: (state: NoInfer<TState>) => TSelected, options?: UseStoreOptions<TSelected>): TSelected;
13
- export {};
@@ -1,24 +0,0 @@
1
- import { useStore as useStore$1 } from "@tanstack/preact-store";
2
- function bridgeStore(store) {
3
- return {
4
- get state() {
5
- return store.state;
6
- },
7
- // @tanstack/preact-store currently calls subscribe unbound.
8
- subscribe: (listener) => {
9
- const subscription = store.subscribe(listener);
10
- return typeof subscription === "function" ? subscription : () => subscription.unsubscribe();
11
- }
12
- };
13
- }
14
- function useStore(store, selector, options) {
15
- return useStore$1(
16
- bridgeStore(store),
17
- selector,
18
- options
19
- );
20
- }
21
- export {
22
- useStore
23
- };
24
- //# sourceMappingURL=useStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStore.js","sources":["../../src/useStore.ts"],"sourcesContent":["import { useStore as usePreactStore } from '@tanstack/preact-store'\n\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\n\ntype EqualityFn<T> = (objA: T, objB: T) => boolean\n\ninterface UseStoreOptions<T> {\n equal?: EqualityFn<T>\n}\n\ntype StoreLike<TState> = {\n subscribe: (\n listener: (...args: Array<unknown>) => void,\n ) => { unsubscribe: () => void } | (() => void)\n readonly state: TState\n}\n\nfunction bridgeStore<TState>(store: StoreLike<TState>) {\n return {\n get state() {\n return store.state\n },\n // @tanstack/preact-store currently calls subscribe unbound.\n subscribe: (listener: () => void) => {\n const subscription = store.subscribe(listener)\n\n return typeof subscription === 'function'\n ? subscription\n : () => subscription.unsubscribe()\n },\n }\n}\n\nexport function useStore<TState, TSelected = NoInfer<TState>>(\n store: StoreLike<TState>,\n selector?: (state: NoInfer<TState>) => TSelected,\n options?: UseStoreOptions<TSelected>,\n): TSelected {\n return usePreactStore(\n bridgeStore(store) as never,\n selector as never,\n options as never,\n ) as TSelected\n}\n"],"names":["usePreactStore"],"mappings":";AAiBA,SAAS,YAAoB,OAA0B;AACrD,SAAO;AAAA,IACL,IAAI,QAAQ;AACV,aAAO,MAAM;AAAA,IACf;AAAA;AAAA,IAEA,WAAW,CAAC,aAAyB;AACnC,YAAM,eAAe,MAAM,UAAU,QAAQ;AAE7C,aAAO,OAAO,iBAAiB,aAC3B,eACA,MAAM,aAAa,YAAA;AAAA,IACzB;AAAA,EAAA;AAEJ;AAEO,SAAS,SACd,OACA,UACA,SACW;AACX,SAAOA;AAAAA,IACL,YAAY,KAAK;AAAA,IACjB;AAAA,IACA;AAAA,EAAA;AAEJ;"}
package/src/useStore.ts DELETED
@@ -1,44 +0,0 @@
1
- import { useStore as usePreactStore } from '@tanstack/preact-store'
2
-
3
- export type NoInfer<T> = [T][T extends any ? 0 : never]
4
-
5
- type EqualityFn<T> = (objA: T, objB: T) => boolean
6
-
7
- interface UseStoreOptions<T> {
8
- equal?: EqualityFn<T>
9
- }
10
-
11
- type StoreLike<TState> = {
12
- subscribe: (
13
- listener: (...args: Array<unknown>) => void,
14
- ) => { unsubscribe: () => void } | (() => void)
15
- readonly state: TState
16
- }
17
-
18
- function bridgeStore<TState>(store: StoreLike<TState>) {
19
- return {
20
- get state() {
21
- return store.state
22
- },
23
- // @tanstack/preact-store currently calls subscribe unbound.
24
- subscribe: (listener: () => void) => {
25
- const subscription = store.subscribe(listener)
26
-
27
- return typeof subscription === 'function'
28
- ? subscription
29
- : () => subscription.unsubscribe()
30
- },
31
- }
32
- }
33
-
34
- export function useStore<TState, TSelected = NoInfer<TState>>(
35
- store: StoreLike<TState>,
36
- selector?: (state: NoInfer<TState>) => TSelected,
37
- options?: UseStoreOptions<TSelected>,
38
- ): TSelected {
39
- return usePreactStore(
40
- bridgeStore(store) as never,
41
- selector as never,
42
- options as never,
43
- ) as TSelected
44
- }