Skip to content

Commit 696dd4d

Browse files
committed
feat: 🎸 add TypeScript type definitions
1 parent 446e9c1 commit 696dd4d

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

‎index.d.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
type ICssLikeObject = object;
2+
3+
interface IUnits {
4+
px: (num: number) => string;
5+
cm: (num: number) => string;
6+
in: (num: number) => string;
7+
pt: (num: number) => string;
8+
pc: (num: number) => string;
9+
em: (num: number) => string;
10+
ex: (num: number) => string;
11+
ch: (num: number) => string;
12+
rem: (num: number) => string;
13+
vw: (num: number) => string;
14+
vh: (num: number) => string;
15+
deg: (num: number) => string;
16+
vmin: (num: number) => string;
17+
vmax: (num: number) => string;
18+
}
19+
20+
interface NanoRenderer extends Partial<IUnits> {
21+
client: boolean;
22+
raw: string;
23+
pfx: string;
24+
putRaw: (rawCss: string) => void;
25+
put: (selector: string, css: ICssLikeObject, atrule?: string) => void;
26+
27+
/**
28+
* Need to install `rule` addon.
29+
*/
30+
rule?: (css: ICssLikeObject, block?: string) => string;
31+
drule?: (...args) => any;
32+
sheet?: (...args) => any;
33+
dsheet?: (...args) => any;
34+
jsx?: (...args) => any;
35+
style?: (...args) => any;
36+
styled?: (...args) => any;
37+
cache?: (...args) => any;
38+
global?: (...args) => any;
39+
keyframes?: (...args) => any;
40+
hydrate?: (...args) => any;
41+
hyperstyle?: (...args) => any;
42+
pipe?: (...args) => any;
43+
ref?: (...args) => any;
44+
useStyles?: (...args) => any;
45+
withStyles?: (...args) => any;
46+
s?: object;
47+
units?: IUnits;
48+
}
49+
50+
interface INanoOptions {
51+
pfx?: string;
52+
h?: (...args) => any;
53+
sh?: CSSStyleSheet;
54+
verbose?: boolean;
55+
assign?: (...objects: object[]) => object;
56+
stringify?: (obj: object) => string;
57+
}
58+
59+
type TCreateNano = (options: INanoOptions) => NanoRenderer;
60+
61+
export const create: TCreateNano;

‎package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"description": "Smallest 5th gen CSS-in-JS library",
55
"main": "index.js",
66
"unpkg": "dist/nano-css.umd.min.js",
7+
"types": "index.d.ts",
8+
"typings": "index.d.ts",
79
"repository": {
810
"type": "git",
911
"url": "https://github.com/streamich/nano-css.git"

0 commit comments

Comments
 (0)