~repos /atoms-element

#js

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
Files changed (2) hide show
  1. element.d.ts +19 -29
  2. 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
- export declare const useState: <S>(initialState: S | (() => S)) => [S, Dispatch<SetStateAction<S>>];
39
+ useState: <S>(initialState: S | (() => S)) => [S, Dispatch<SetStateAction<S>>];
40
+ useEffect: (effect: EffectCallback, deps?: DependencyList) => void;
46
- export declare const useEffect: (effect: EffectCallback, deps?: DependencyList) => void;
41
+ useLayoutEffect: (effect: EffectCallback, deps?: DependencyList) => void;
47
- export declare const useLayoutEffect: (effect: EffectCallback, deps?: DependencyList) => void;
48
- export declare const useReducer: <R extends ReducerWithoutAction<any>, I>(
42
+ useReducer: <R extends ReducerWithoutAction<any>, I>(
49
- reducer: R,
43
+ reducer: R,
50
- initializerArg: I,
44
+ initializerArg: I,
51
- initializer: (arg: I) => ReducerStateWithoutAction<R>
45
+ initializer: (arg: I) => ReducerStateWithoutAction<R>
52
- ) => [ReducerStateWithoutAction<R>, DispatchWithoutAction];
46
+ ) => [ReducerStateWithoutAction<R>, DispatchWithoutAction];
53
-
54
- export declare const useCallback: <T extends (...args: any[]) => any>(callback: T, deps: DependencyList) => T;
47
+ useCallback: <T extends (...args: any[]) => any>(callback: T, deps: DependencyList) => T;
55
- export declare const useMemo: <T>(factory: () => T, deps: DependencyList | undefined) => T;
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
- export declare const useRef: <T>(initialValue: T | null | undefined) => MutableRefObject<T>;
49
+ useRef: <T>(initialValue: T | null | undefined) => MutableRefObject<T>;
58
-
59
- export declare const useConfig: () => Config;
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
+ }