what-framework 0.6.6 → 0.6.8
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.
- package/README.md +1 -1
- package/hooks.d.ts +15 -14
- package/package.json +5 -5
package/README.md
CHANGED
package/hooks.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
// What Framework - Hooks Type Definitions
|
|
2
2
|
|
|
3
|
-
import { Signal } from './index.js';
|
|
3
|
+
import { Signal, Computed, Updater, VNodeChild } from './index.js';
|
|
4
4
|
|
|
5
|
-
export function useState<T>(initial: T | (() => T)): [Signal<T>, (value: T
|
|
6
|
-
export function useSignal<T>(initial: T): Signal<T>;
|
|
7
|
-
export function useComputed<T>(fn: () => T):
|
|
5
|
+
export function useState<T>(initial: T | (() => T)): [Signal<T>, (value: Updater<T>) => void];
|
|
6
|
+
export function useSignal<T>(initial: T | (() => T)): Signal<T>;
|
|
7
|
+
export function useComputed<T>(fn: () => T): Computed<T>;
|
|
8
8
|
export function useEffect(fn: () => void | (() => void), deps?: any[]): void;
|
|
9
|
-
export function useMemo<T>(fn: () => T, deps?: any[]): T
|
|
9
|
+
export function useMemo<T>(fn: () => T, deps?: any[]): Computed<T>;
|
|
10
10
|
export function useCallback<T extends (...args: any[]) => any>(fn: T, deps?: any[]): T;
|
|
11
|
-
export function useRef<T>(initial?: T): { current: T };
|
|
11
|
+
export function useRef<T>(initial?: T): { current: T | undefined };
|
|
12
12
|
export function useContext<T>(context: { _defaultValue: T }): T;
|
|
13
|
-
export function createContext<T>(defaultValue?: T): { _defaultValue: T; Provider: (props: { value: T; children:
|
|
13
|
+
export function createContext<T>(defaultValue?: T): { _defaultValue: T; Provider: (props: { value: T; children?: VNodeChild }) => VNodeChild; Consumer: (props: { children: (value: T) => VNodeChild }) => VNodeChild };
|
|
14
14
|
export function useReducer<S, A>(reducer: (state: S, action: A) => S, initialState: S, init?: (s: S) => S): [Signal<S>, (action: A) => void];
|
|
15
15
|
export function onMount(fn: () => void | (() => void)): void;
|
|
16
16
|
export function onCleanup(fn: () => void): void;
|
|
17
17
|
|
|
18
|
-
export
|
|
19
|
-
(
|
|
18
|
+
export function createResource<T = any, S = any>(
|
|
19
|
+
fetcher: (source?: S, ctx?: { signal: AbortSignal }) => Promise<T> | T,
|
|
20
|
+
options?: { initialValue?: T; source?: S },
|
|
21
|
+
): [Signal<T | null>, {
|
|
20
22
|
loading: Signal<boolean>;
|
|
21
|
-
error: Signal<
|
|
22
|
-
refetch: () =>
|
|
23
|
-
mutate: (value: T) => void;
|
|
24
|
-
}
|
|
25
|
-
export function createResource<T>(fetcher: () => Promise<T>, options?: { initialValue?: T }): Resource<T>;
|
|
23
|
+
error: Signal<any>;
|
|
24
|
+
refetch: (source?: S) => Promise<any>;
|
|
25
|
+
mutate: (value: Updater<T | null>) => void;
|
|
26
|
+
}];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "what-framework",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "The closest framework to vanilla JS
|
|
3
|
+
"version": "0.6.8",
|
|
4
|
+
"description": "The closest framework to vanilla JS — signals, components, islands, SSR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
},
|
|
93
93
|
"homepage": "https://whatfw.com",
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"what-core": "^0.6.
|
|
96
|
-
"what-router": "^0.6.
|
|
97
|
-
"what-server": "^0.6.
|
|
95
|
+
"what-core": "^0.6.8",
|
|
96
|
+
"what-router": "^0.6.7",
|
|
97
|
+
"what-server": "^0.6.7",
|
|
98
98
|
"what-compiler": "^0.6.5"
|
|
99
99
|
}
|
|
100
100
|
}
|