~repos /atoms-element
git clone https://pyrossh.dev/repos/atoms-element.git
A simple web component library for defining your custom elements. It works on both client and server.
d64c5c44
—
Peter John 4 years ago
fix typings
- element.d.ts +19 -29
- page.d.ts +28 -0
element.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Config } from './page';
|
|
2
|
+
|
|
1
3
|
export declare type Destructor = () => void | undefined;
|
|
2
4
|
export declare type EffectCallback = () => (void | Destructor);
|
|
3
5
|
export declare type SetStateAction<S> = S | ((prevState: S) => S);
|
|
@@ -12,19 +14,6 @@ export declare type ReducerStateWithoutAction<R extends ReducerWithoutAction<any
|
|
|
12
14
|
export declare interface MutableRefObject<T> {
|
|
13
15
|
current: T | null | undefined;
|
|
14
16
|
}
|
|
15
|
-
export declare type Config = {
|
|
16
|
-
version: string
|
|
17
|
-
url: string
|
|
18
|
-
image: string
|
|
19
|
-
author: string
|
|
20
|
-
languages: Array<string>
|
|
21
|
-
title: string
|
|
22
|
-
description: string
|
|
23
|
-
keywords: string
|
|
24
|
-
categories: Array<string>
|
|
25
|
-
tags: Array<string>
|
|
26
|
-
strings: {[key: string]: string}
|
|
27
|
-
}
|
|
28
17
|
export declare type Location = {
|
|
29
18
|
readonly ancestorOrigins: DOMStringList;
|
|
30
19
|
hash: string;
|
|
@@ -42,19 +31,20 @@ export declare type Location = {
|
|
|
42
31
|
toString: () => string;
|
|
43
32
|
}
|
|
44
33
|
|
|
34
|
+
export default class AtomsElement {
|
|
35
|
+
config: Config;
|
|
36
|
+
location: Location;
|
|
37
|
+
styles(): string
|
|
38
|
+
getAttrs(): {[key: string]: any};
|
|
45
|
-
|
|
39
|
+
useState: <S>(initialState: S | (() => S)) => [S, Dispatch<SetStateAction<S>>];
|
|
40
|
+
useEffect: (effect: EffectCallback, deps?: DependencyList) => void;
|
|
46
|
-
|
|
41
|
+
useLayoutEffect: (effect: EffectCallback, deps?: DependencyList) => void;
|
|
47
|
-
export declare const useLayoutEffect: (effect: EffectCallback, deps?: DependencyList) => void;
|
|
48
|
-
|
|
42
|
+
useReducer: <R extends ReducerWithoutAction<any>, I>(
|
|
49
|
-
|
|
43
|
+
reducer: R,
|
|
50
|
-
|
|
44
|
+
initializerArg: I,
|
|
51
|
-
|
|
45
|
+
initializer: (arg: I) => ReducerStateWithoutAction<R>
|
|
52
|
-
) => [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
|
46
|
+
) => [ReducerStateWithoutAction<R>, DispatchWithoutAction];
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
useCallback: <T extends (...args: any[]) => any>(callback: T, deps: DependencyList) => T;
|
|
55
|
-
|
|
48
|
+
useMemo: <T>(factory: () => T, deps: DependencyList | undefined) => T;
|
|
56
|
-
// function useImperativeHandle<T, R extends T>(ref: Ref<T>|undefined, init: () => R, deps?: DependencyList): void;
|
|
57
|
-
|
|
49
|
+
useRef: <T>(initialValue: T | null | undefined) => MutableRefObject<T>;
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
}
|
|
60
|
-
export declare const useLocation: () => Location;
|
page.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare type Config = {
|
|
2
|
+
version: string
|
|
3
|
+
url: string
|
|
4
|
+
image: string
|
|
5
|
+
author: string
|
|
6
|
+
languages: Array<string>
|
|
7
|
+
title: string
|
|
8
|
+
description: string
|
|
9
|
+
keywords: string
|
|
10
|
+
categories: Array<any>
|
|
11
|
+
tags: Array<any>
|
|
12
|
+
strings: {[key: string]: any}
|
|
13
|
+
themes: {[key: string]: any}
|
|
14
|
+
}
|
|
15
|
+
export declare type Data = any;
|
|
16
|
+
export declare type Iteam = any;
|
|
17
|
+
|
|
18
|
+
export type Props = {
|
|
19
|
+
config: Config;
|
|
20
|
+
data: Data;
|
|
21
|
+
item: Data;
|
|
22
|
+
}
|
|
23
|
+
export class Page {
|
|
24
|
+
route: (props: Props) => string;
|
|
25
|
+
styles: (props: Props) => string;
|
|
26
|
+
head: (props: Props) => string;
|
|
27
|
+
body: (props: Props) => string;
|
|
28
|
+
}
|