flexium 0.8.15 → 0.9.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 (123) hide show
  1. package/dist/{DrawText-CeXBL8Ev.d.ts → DrawText-Bvzl40Vi.d.ts} +1 -1
  2. package/dist/{DrawText-JB58mpQT.d.cts → DrawText-CJikXQjL.d.cts} +1 -1
  3. package/dist/advanced.d.cts +3 -1
  4. package/dist/advanced.d.ts +3 -1
  5. package/dist/advanced.js +1 -1
  6. package/dist/advanced.mjs +1 -1
  7. package/dist/advanced.mjs.map +1 -1
  8. package/dist/canvas.d.cts +5 -3
  9. package/dist/canvas.d.ts +5 -3
  10. package/dist/canvas.js +1 -1
  11. package/dist/canvas.mjs +1 -1
  12. package/dist/chunk-6RV7ARJT.mjs +3 -0
  13. package/dist/chunk-6RV7ARJT.mjs.map +1 -0
  14. package/dist/{chunk-CNY6FPKJ.js → chunk-CBO2X74Q.js} +2 -2
  15. package/dist/{chunk-CZYIK6FD.mjs.map → chunk-CBO2X74Q.js.map} +1 -1
  16. package/dist/chunk-GFL4VRAO.mjs +3 -0
  17. package/dist/chunk-GFL4VRAO.mjs.map +1 -0
  18. package/dist/{chunk-MLZTCKTH.mjs → chunk-GQKN4NPW.mjs} +2 -2
  19. package/dist/{chunk-MLZTCKTH.mjs.map → chunk-GQKN4NPW.mjs.map} +1 -1
  20. package/dist/{chunk-CZYIK6FD.mjs → chunk-JDTJFAXO.mjs} +2 -2
  21. package/dist/chunk-JDTJFAXO.mjs.map +1 -0
  22. package/dist/{chunk-ZNPYN2TZ.mjs → chunk-LXXN76HJ.mjs} +2 -2
  23. package/dist/{chunk-ZNPYN2TZ.mjs.map → chunk-LXXN76HJ.mjs.map} +1 -1
  24. package/dist/chunk-MKE3KA43.js +3 -0
  25. package/dist/chunk-MKE3KA43.js.map +1 -0
  26. package/dist/{chunk-DOGIWSDA.js → chunk-PDOEMOWN.js} +2 -2
  27. package/dist/{chunk-DOGIWSDA.js.map → chunk-PDOEMOWN.js.map} +1 -1
  28. package/dist/{chunk-GDBJ322I.js → chunk-RIVNKTUR.js} +2 -2
  29. package/dist/{chunk-GDBJ322I.js.map → chunk-RIVNKTUR.js.map} +1 -1
  30. package/dist/chunk-TQLZ7UZX.js +2 -0
  31. package/dist/chunk-TQLZ7UZX.js.map +1 -0
  32. package/dist/chunk-WEYAKKNF.js +3 -0
  33. package/dist/chunk-WEYAKKNF.js.map +1 -0
  34. package/dist/chunk-WO6NQ3KR.mjs +3 -0
  35. package/dist/chunk-WO6NQ3KR.mjs.map +1 -0
  36. package/dist/chunk-Y4DUMNIW.mjs +2 -0
  37. package/dist/chunk-Y4DUMNIW.mjs.map +1 -0
  38. package/dist/chunk-ZG3LULLU.js +3 -0
  39. package/dist/chunk-ZG3LULLU.js.map +1 -0
  40. package/dist/components-D4WeooPi.d.ts +126 -0
  41. package/dist/components-DZy2r6m5.d.cts +126 -0
  42. package/dist/core.d.cts +159 -15
  43. package/dist/core.d.ts +159 -15
  44. package/dist/core.js +1 -1
  45. package/dist/core.mjs +1 -1
  46. package/dist/dom.d.cts +2 -3
  47. package/dist/dom.d.ts +2 -3
  48. package/dist/dom.js +1 -1
  49. package/dist/dom.js.map +1 -1
  50. package/dist/dom.mjs +1 -1
  51. package/dist/dom.mjs.map +1 -1
  52. package/dist/effect-BlnnM1t5.d.cts +20 -0
  53. package/dist/effect-BlnnM1t5.d.ts +20 -0
  54. package/dist/index.d.cts +2 -2
  55. package/dist/index.d.ts +2 -2
  56. package/dist/index.js +1 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/index.mjs +1 -1
  59. package/dist/index.mjs.map +1 -1
  60. package/dist/interactive.d.cts +1 -1
  61. package/dist/interactive.d.ts +1 -1
  62. package/dist/interactive.js +1 -1
  63. package/dist/interactive.mjs +1 -1
  64. package/dist/interactive.mjs.map +1 -1
  65. package/dist/metafile-cjs.json +1 -1
  66. package/dist/metafile-esm.json +1 -1
  67. package/dist/owner-Ce7KCWzi.d.cts +34 -0
  68. package/dist/owner-Ce7KCWzi.d.ts +34 -0
  69. package/dist/{portal-DBwz7gD0.d.ts → portal-C3ESJhlv.d.ts} +1 -1
  70. package/dist/{portal-BpcIlK9y.d.cts → portal-CAEbiMUZ.d.cts} +1 -1
  71. package/dist/primitives/motion.js +1 -1
  72. package/dist/primitives/motion.mjs +1 -1
  73. package/dist/primitives/ui.d.cts +1 -1
  74. package/dist/primitives/ui.d.ts +1 -1
  75. package/dist/primitives/ui.js +1 -1
  76. package/dist/primitives/ui.mjs +1 -1
  77. package/dist/primitives/ui.mjs.map +1 -1
  78. package/dist/primitives.d.cts +6 -4
  79. package/dist/primitives.d.ts +6 -4
  80. package/dist/primitives.js +1 -1
  81. package/dist/primitives.mjs +1 -1
  82. package/dist/router.d.cts +11 -120
  83. package/dist/router.d.ts +11 -120
  84. package/dist/router.js +1 -1
  85. package/dist/router.mjs +1 -1
  86. package/dist/scheduler-Z4QqUDjF.d.cts +25 -0
  87. package/dist/scheduler-Z4QqUDjF.d.ts +25 -0
  88. package/dist/server.js +1 -1
  89. package/dist/server.mjs +1 -1
  90. package/dist/signal-AXKUQJVA.js +2 -0
  91. package/dist/{signal-XZXQ4VYQ.js.map → signal-AXKUQJVA.js.map} +1 -1
  92. package/dist/signal-Dxh9PsKr.d.cts +69 -0
  93. package/dist/signal-Dxh9PsKr.d.ts +69 -0
  94. package/dist/signal-HM2LG5YL.mjs +2 -0
  95. package/dist/{signal-PWBIM6JV.mjs.map → signal-HM2LG5YL.mjs.map} +1 -1
  96. package/dist/test-exports.d.cts +29 -8
  97. package/dist/test-exports.d.ts +29 -8
  98. package/dist/test-exports.js +1 -1
  99. package/dist/test-exports.mjs +1 -1
  100. package/package.json +1 -1
  101. package/dist/chunk-2MVKTSFR.mjs +0 -3
  102. package/dist/chunk-2MVKTSFR.mjs.map +0 -1
  103. package/dist/chunk-2U4DW375.mjs +0 -2
  104. package/dist/chunk-2U4DW375.mjs.map +0 -1
  105. package/dist/chunk-5S3ZQ2LB.mjs +0 -3
  106. package/dist/chunk-5S3ZQ2LB.mjs.map +0 -1
  107. package/dist/chunk-CNY6FPKJ.js.map +0 -1
  108. package/dist/chunk-EX2GURH5.mjs +0 -3
  109. package/dist/chunk-EX2GURH5.mjs.map +0 -1
  110. package/dist/chunk-I7UCVARB.js +0 -2
  111. package/dist/chunk-I7UCVARB.js.map +0 -1
  112. package/dist/chunk-REETNY2Z.js +0 -3
  113. package/dist/chunk-REETNY2Z.js.map +0 -1
  114. package/dist/chunk-ROYFUJN5.js +0 -3
  115. package/dist/chunk-ROYFUJN5.js.map +0 -1
  116. package/dist/chunk-V4K6WOXN.js +0 -3
  117. package/dist/chunk-V4K6WOXN.js.map +0 -1
  118. package/dist/signal-PWBIM6JV.mjs +0 -2
  119. package/dist/signal-XZXQ4VYQ.js +0 -2
  120. package/dist/signal-mNtlF8-v.d.cts +0 -158
  121. package/dist/signal-mNtlF8-v.d.ts +0 -158
  122. package/dist/state-kK9sQh9s.d.cts +0 -73
  123. package/dist/state-kK9sQh9s.d.ts +0 -73
@@ -1,158 +0,0 @@
1
- /**
2
- * Runs a function once when the component mounts.
3
- * Unlike effect(), onMount does not track dependencies - it runs exactly once.
4
- *
5
- * @param fn - Function to run on mount. Can return a cleanup function.
6
- *
7
- * @example
8
- * ```tsx
9
- * function MyComponent() {
10
- * onMount(() => {
11
- * console.log('Mounted!');
12
- * return () => console.log('Unmounted!');
13
- * });
14
- * return <div>Hello</div>;
15
- * }
16
- * ```
17
- */
18
- declare function onMount(fn: () => void | (() => void)): void;
19
- /**
20
- * Base interface for reactive signals
21
- * @internal
22
- */
23
- interface Signal<T> {
24
- value: T;
25
- (): T;
26
- set(value: T): void;
27
- peek(): T;
28
- }
29
- /**
30
- * Computed signal interface (read-only)
31
- * @internal
32
- */
33
- interface Computed<T> {
34
- readonly value: T;
35
- (): T;
36
- peek(): T;
37
- }
38
- /**
39
- * Creates a reactive signal
40
- *
41
- * @param initialValue - The initial value of the signal
42
- * @returns A signal object with value getter/setter
43
- *
44
- * @example
45
- * const count = signal(0);
46
- * count.value++; // triggers subscribers
47
- * console.log(count()); // alternative getter syntax
48
- */
49
- declare function signal<T>(initialValue: T): Signal<T>;
50
- /**
51
- * Creates a computed signal (derived value)
52
- * @internal Use `state(() => ...)` instead
53
- */
54
- declare function computed<T>(fn: () => T): Computed<T>;
55
- /**
56
- * Creates a side effect that runs when dependencies change
57
- *
58
- * @param fn - Effect function, can return a cleanup function
59
- * @param options - Optional error handler
60
- * @returns Dispose function to stop the effect
61
- *
62
- * @example
63
- * const count = signal(0);
64
- * const dispose = effect(() => {
65
- * console.log('Count:', count.value);
66
- * return () => console.log('Cleanup');
67
- * });
68
- */
69
- declare function effect(fn: () => void | (() => void), options?: {
70
- onError?: (error: Error) => void;
71
- name?: string;
72
- }): () => void;
73
- /**
74
- * Execute a function without tracking signal dependencies.
75
- * Useful when you need to read signals inside an effect without creating dependencies.
76
- *
77
- * @param fn - Function to execute without tracking
78
- * @returns The return value of fn
79
- *
80
- * @example
81
- * ```tsx
82
- * const count = signal(0);
83
- * const name = signal('Alice');
84
- *
85
- * effect(() => {
86
- * // Only re-runs when count changes, not name
87
- * console.log(count(), untrack(() => name()));
88
- * });
89
- * ```
90
- */
91
- declare function untrack<T>(fn: () => T): T;
92
- /**
93
- * Batches multiple signal updates together.
94
- * Effects will only run once after all updates complete.
95
- *
96
- * @param fn - Function containing signal updates to batch
97
- * @returns The return value of fn
98
- *
99
- * @example
100
- * ```tsx
101
- * const count = signal(0);
102
- * const name = signal('Alice');
103
- *
104
- * effect(() => console.log(count(), name())); // runs once
105
- *
106
- * batch(() => {
107
- * count.value = 1;
108
- * name.value = 'Bob';
109
- * }); // effect runs only once after batch completes
110
- * ```
111
- */
112
- declare function batch<T>(fn: () => T): T;
113
- /**
114
- * Creates a root scope for effects
115
- * All effects created within the scope can be disposed together
116
- *
117
- * @param fn - Function that creates effects
118
- * @returns Dispose function for all effects in the scope
119
- */
120
- declare function root<T>(fn: (dispose: () => void) => T): T;
121
- /**
122
- * Check if a value is a signal
123
- * @internal Use state() which handles all reactive patterns
124
- */
125
- declare function isSignal(value: unknown): value is Signal<any> | Computed<any>;
126
- /**
127
- * Registers a cleanup function that runs before the current effect re-runs or is disposed
128
- *
129
- * @param fn - Cleanup function
130
- */
131
- declare function onCleanup(fn: () => void): void;
132
- /**
133
- * Resource interface for async data
134
- */
135
- interface Resource<T> extends Signal<T | undefined> {
136
- loading: boolean;
137
- error: any;
138
- state: 'unresolved' | 'pending' | 'ready' | 'refreshing' | 'errored';
139
- latest: T | undefined;
140
- /**
141
- * Read value, throwing Promise if pending or Error if failed.
142
- * Used by Suspense.
143
- */
144
- read: () => T | undefined;
145
- }
146
- /**
147
- * Creates a resource for handling async data
148
- * @internal Use state(async () => ...) instead which returns [data, refetch, status, error]
149
- */
150
- declare function createResource<T, S = any>(source: S | Signal<S> | (() => S), fetcher: (source: S, { value, refetching }: {
151
- value: T | undefined;
152
- refetching: any;
153
- }) => Promise<T>): [Resource<T>, {
154
- mutate: (v: T | undefined) => void;
155
- refetch: () => void;
156
- }];
157
-
158
- export { type Computed as C, type Signal as S, createResource as a, onMount as b, computed as c, batch as d, effect as e, isSignal as i, onCleanup as o, root as r, signal as s, untrack as u };
@@ -1,158 +0,0 @@
1
- /**
2
- * Runs a function once when the component mounts.
3
- * Unlike effect(), onMount does not track dependencies - it runs exactly once.
4
- *
5
- * @param fn - Function to run on mount. Can return a cleanup function.
6
- *
7
- * @example
8
- * ```tsx
9
- * function MyComponent() {
10
- * onMount(() => {
11
- * console.log('Mounted!');
12
- * return () => console.log('Unmounted!');
13
- * });
14
- * return <div>Hello</div>;
15
- * }
16
- * ```
17
- */
18
- declare function onMount(fn: () => void | (() => void)): void;
19
- /**
20
- * Base interface for reactive signals
21
- * @internal
22
- */
23
- interface Signal<T> {
24
- value: T;
25
- (): T;
26
- set(value: T): void;
27
- peek(): T;
28
- }
29
- /**
30
- * Computed signal interface (read-only)
31
- * @internal
32
- */
33
- interface Computed<T> {
34
- readonly value: T;
35
- (): T;
36
- peek(): T;
37
- }
38
- /**
39
- * Creates a reactive signal
40
- *
41
- * @param initialValue - The initial value of the signal
42
- * @returns A signal object with value getter/setter
43
- *
44
- * @example
45
- * const count = signal(0);
46
- * count.value++; // triggers subscribers
47
- * console.log(count()); // alternative getter syntax
48
- */
49
- declare function signal<T>(initialValue: T): Signal<T>;
50
- /**
51
- * Creates a computed signal (derived value)
52
- * @internal Use `state(() => ...)` instead
53
- */
54
- declare function computed<T>(fn: () => T): Computed<T>;
55
- /**
56
- * Creates a side effect that runs when dependencies change
57
- *
58
- * @param fn - Effect function, can return a cleanup function
59
- * @param options - Optional error handler
60
- * @returns Dispose function to stop the effect
61
- *
62
- * @example
63
- * const count = signal(0);
64
- * const dispose = effect(() => {
65
- * console.log('Count:', count.value);
66
- * return () => console.log('Cleanup');
67
- * });
68
- */
69
- declare function effect(fn: () => void | (() => void), options?: {
70
- onError?: (error: Error) => void;
71
- name?: string;
72
- }): () => void;
73
- /**
74
- * Execute a function without tracking signal dependencies.
75
- * Useful when you need to read signals inside an effect without creating dependencies.
76
- *
77
- * @param fn - Function to execute without tracking
78
- * @returns The return value of fn
79
- *
80
- * @example
81
- * ```tsx
82
- * const count = signal(0);
83
- * const name = signal('Alice');
84
- *
85
- * effect(() => {
86
- * // Only re-runs when count changes, not name
87
- * console.log(count(), untrack(() => name()));
88
- * });
89
- * ```
90
- */
91
- declare function untrack<T>(fn: () => T): T;
92
- /**
93
- * Batches multiple signal updates together.
94
- * Effects will only run once after all updates complete.
95
- *
96
- * @param fn - Function containing signal updates to batch
97
- * @returns The return value of fn
98
- *
99
- * @example
100
- * ```tsx
101
- * const count = signal(0);
102
- * const name = signal('Alice');
103
- *
104
- * effect(() => console.log(count(), name())); // runs once
105
- *
106
- * batch(() => {
107
- * count.value = 1;
108
- * name.value = 'Bob';
109
- * }); // effect runs only once after batch completes
110
- * ```
111
- */
112
- declare function batch<T>(fn: () => T): T;
113
- /**
114
- * Creates a root scope for effects
115
- * All effects created within the scope can be disposed together
116
- *
117
- * @param fn - Function that creates effects
118
- * @returns Dispose function for all effects in the scope
119
- */
120
- declare function root<T>(fn: (dispose: () => void) => T): T;
121
- /**
122
- * Check if a value is a signal
123
- * @internal Use state() which handles all reactive patterns
124
- */
125
- declare function isSignal(value: unknown): value is Signal<any> | Computed<any>;
126
- /**
127
- * Registers a cleanup function that runs before the current effect re-runs or is disposed
128
- *
129
- * @param fn - Cleanup function
130
- */
131
- declare function onCleanup(fn: () => void): void;
132
- /**
133
- * Resource interface for async data
134
- */
135
- interface Resource<T> extends Signal<T | undefined> {
136
- loading: boolean;
137
- error: any;
138
- state: 'unresolved' | 'pending' | 'ready' | 'refreshing' | 'errored';
139
- latest: T | undefined;
140
- /**
141
- * Read value, throwing Promise if pending or Error if failed.
142
- * Used by Suspense.
143
- */
144
- read: () => T | undefined;
145
- }
146
- /**
147
- * Creates a resource for handling async data
148
- * @internal Use state(async () => ...) instead which returns [data, refetch, status, error]
149
- */
150
- declare function createResource<T, S = any>(source: S | Signal<S> | (() => S), fetcher: (source: S, { value, refetching }: {
151
- value: T | undefined;
152
- refetching: any;
153
- }) => Promise<T>): [Resource<T>, {
154
- mutate: (v: T | undefined) => void;
155
- refetch: () => void;
156
- }];
157
-
158
- export { type Computed as C, type Signal as S, createResource as a, onMount as b, computed as c, batch as d, effect as e, isSignal as i, onCleanup as o, root as r, signal as s, untrack as u };
@@ -1,73 +0,0 @@
1
- /** Key type - string or array of serializable values */
2
- type StateKey = string | readonly (string | number | boolean | null | undefined | object)[];
3
- /** Action function type for state mutation */
4
- type StateAction<T> = (newValue: T | ((prev: T) => T)) => void;
5
- /**
6
- * StateValue type - a value-like proxy that behaves like T.
7
- * Can be used directly in expressions and JSX.
8
- */
9
- type StateValue<T> = T & (() => T);
10
- /** Async state status */
11
- type AsyncStatus = 'idle' | 'loading' | 'success' | 'error';
12
- /** Options for state() */
13
- interface StateOptions<P = unknown> {
14
- /**
15
- * Key for global state sharing. Can be a string or array.
16
- * Array keys are useful for hierarchical namespacing.
17
- * @example
18
- * state('light', { key: 'theme' })
19
- * state(null, { key: ['user', 'profile', userId] })
20
- */
21
- key?: StateKey;
22
- /**
23
- * Parameters to pass to the function (for computed/async state).
24
- * Improves DX by making dependencies explicit.
25
- * @example
26
- * state(
27
- * async ({ userId }) => fetch(`/api/users/${userId}`),
28
- * { key: ['user', userId], params: { userId } }
29
- * )
30
- */
31
- params?: P;
32
- }
33
- /**
34
- * Unified State API
35
- *
36
- * One function for all reactive state needs - always returns an array for consistency:
37
- * 1. Simple state: const [count, setCount] = state(0)
38
- * 2. Derived state: const [doubled] = state(() => count * 2)
39
- * 3. Async state: const [data, refetch, status, error] = state(async () => fetch(...))
40
- * 4. Global state: const [theme, setTheme] = state('light', { key: 'theme' })
41
- * 5. With params: const [user] = state(async (p) => fetch(`/api/${p.id}`), { params: { id } })
42
- *
43
- * @example
44
- * ```tsx
45
- * function Counter() {
46
- * const [count, setCount] = state(0)
47
- * const [doubled] = state(() => count * 2)
48
- * return <Button onPress={() => setCount(count + 1)}>{doubled}</Button>
49
- * }
50
- * ```
51
- */
52
- interface StateFunction {
53
- <T>(initialValue: T, options?: StateOptions): [StateValue<T>, StateAction<T>];
54
- <T, P>(computeFn: (params: P) => T, options: StateOptions<P> & {
55
- params: P;
56
- }): [StateValue<T>];
57
- <T>(computeFn: () => T, options?: StateOptions): [StateValue<T>];
58
- <T, P>(fetcher: (params: P) => Promise<T>, options: StateOptions<P> & {
59
- params: P;
60
- }): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>];
61
- <T>(fetcher: () => Promise<T>, options?: StateOptions): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>];
62
- /** Delete a specific global state by key */
63
- delete: (key: StateKey) => boolean;
64
- /** Clear all global states */
65
- clear: () => void;
66
- /** Check if a global state exists */
67
- has: (key: StateKey) => boolean;
68
- /** Current number of global states */
69
- readonly size: number;
70
- }
71
- declare const _state: StateFunction;
72
-
73
- export { type AsyncStatus as A, type StateAction as S, _state as _, type StateValue as a, type StateKey as b, type StateOptions as c };
@@ -1,73 +0,0 @@
1
- /** Key type - string or array of serializable values */
2
- type StateKey = string | readonly (string | number | boolean | null | undefined | object)[];
3
- /** Action function type for state mutation */
4
- type StateAction<T> = (newValue: T | ((prev: T) => T)) => void;
5
- /**
6
- * StateValue type - a value-like proxy that behaves like T.
7
- * Can be used directly in expressions and JSX.
8
- */
9
- type StateValue<T> = T & (() => T);
10
- /** Async state status */
11
- type AsyncStatus = 'idle' | 'loading' | 'success' | 'error';
12
- /** Options for state() */
13
- interface StateOptions<P = unknown> {
14
- /**
15
- * Key for global state sharing. Can be a string or array.
16
- * Array keys are useful for hierarchical namespacing.
17
- * @example
18
- * state('light', { key: 'theme' })
19
- * state(null, { key: ['user', 'profile', userId] })
20
- */
21
- key?: StateKey;
22
- /**
23
- * Parameters to pass to the function (for computed/async state).
24
- * Improves DX by making dependencies explicit.
25
- * @example
26
- * state(
27
- * async ({ userId }) => fetch(`/api/users/${userId}`),
28
- * { key: ['user', userId], params: { userId } }
29
- * )
30
- */
31
- params?: P;
32
- }
33
- /**
34
- * Unified State API
35
- *
36
- * One function for all reactive state needs - always returns an array for consistency:
37
- * 1. Simple state: const [count, setCount] = state(0)
38
- * 2. Derived state: const [doubled] = state(() => count * 2)
39
- * 3. Async state: const [data, refetch, status, error] = state(async () => fetch(...))
40
- * 4. Global state: const [theme, setTheme] = state('light', { key: 'theme' })
41
- * 5. With params: const [user] = state(async (p) => fetch(`/api/${p.id}`), { params: { id } })
42
- *
43
- * @example
44
- * ```tsx
45
- * function Counter() {
46
- * const [count, setCount] = state(0)
47
- * const [doubled] = state(() => count * 2)
48
- * return <Button onPress={() => setCount(count + 1)}>{doubled}</Button>
49
- * }
50
- * ```
51
- */
52
- interface StateFunction {
53
- <T>(initialValue: T, options?: StateOptions): [StateValue<T>, StateAction<T>];
54
- <T, P>(computeFn: (params: P) => T, options: StateOptions<P> & {
55
- params: P;
56
- }): [StateValue<T>];
57
- <T>(computeFn: () => T, options?: StateOptions): [StateValue<T>];
58
- <T, P>(fetcher: (params: P) => Promise<T>, options: StateOptions<P> & {
59
- params: P;
60
- }): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>];
61
- <T>(fetcher: () => Promise<T>, options?: StateOptions): [StateValue<T | undefined>, () => void, StateValue<AsyncStatus>, StateValue<unknown>];
62
- /** Delete a specific global state by key */
63
- delete: (key: StateKey) => boolean;
64
- /** Clear all global states */
65
- clear: () => void;
66
- /** Check if a global state exists */
67
- has: (key: StateKey) => boolean;
68
- /** Current number of global states */
69
- readonly size: number;
70
- }
71
- declare const _state: StateFunction;
72
-
73
- export { type AsyncStatus as A, type StateAction as S, _state as _, type StateValue as a, type StateKey as b, type StateOptions as c };