Skip to content

Commit 6611aac

Browse files
committedMar 22, 2019
feat: 🎸 add TypeScript definitiosn for some missing addons
1 parent 224ee56 commit 6611aac

11 files changed

+73
-51
lines changed
 

‎addon/amp.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {NanoRenderer} from '../types/nano';
2+
3+
export interface AmpAddon {}
4+
5+
export function addon(nano: NanoRenderer);

‎addon/array.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {NanoRenderer} from '../types/nano';
2+
3+
export interface ArrayAddon {}
4+
5+
export function addon(nano: NanoRenderer);

‎addon/cache.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {NanoRenderer} from '../types/nano';
2+
import {CssLikeObject} from '../types/common';
3+
4+
export interface CacheAddon {
5+
cache(css: CssLikeObject): string;
6+
}
7+
8+
export function addon(nano: NanoRenderer);

‎addon/dsheet.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {NanoRenderer} from '../types/nano';
2+
import {CssLikeObject} from '../types/common';
3+
4+
export interface DsheetAddon {
5+
dsheet(map: object, block?: string): object;
6+
}
7+
8+
export function addon(nano: NanoRenderer);

‎addon/extract.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {NanoRenderer} from '../types/nano';
2+
3+
export interface ExtractAddon {}
4+
5+
export function addon(nano: NanoRenderer);

‎addon/global.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {NanoRenderer} from '../types/nano';
2+
import {CssLikeObject} from '../types/common';
3+
4+
export interface GlobalAddon {
5+
global(css: CssLikeObject);
6+
}
7+
8+
export function addon(nano: NanoRenderer);

‎addon/googleFont.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {NanoRenderer} from '../types/nano';
2+
import {CssLikeObject} from '../types/common';
3+
4+
export interface GoogleFontAddon {
5+
googleFont(font: string, weights: number | string | (number | string)[], subsets: string | string[]);
6+
}
7+
8+
export function addon(nano: NanoRenderer);

‎addon/hydrate.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {NanoRenderer} from '../types/nano';
2+
3+
export interface HydrateAddon {
4+
hydrate(sh: HTMLStyleElement);
5+
}
6+
7+
export function addon(nano: NanoRenderer);

‎index.d.ts

+1-48
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,3 @@
11
import {CreateNano} from './types/nano';
2-
import {UnitsAddon} from './types/addon/units';
3-
import {DruleAddon} from './types/addon/drule';
4-
import {SheetAddon} from './types/addon/sheet';
5-
import {AtomsAddon} from './types/addon/atoms';
6-
import {EmmetAddon} from './types/addon/emmet';
7-
import {SheetPreset} from './types/preset/sheet';
8-
import {KeyframesAddon} from './types/addon/keyframes';
9-
102
export * from './types/nano';
11-
12-
declare module 'nano-css' {
13-
export const create: CreateNano;
14-
}
15-
16-
// Addons
17-
18-
declare module 'nano-css/addon/rule' {
19-
export const addon: RuleAddon;
20-
}
21-
22-
declare module 'nano-css/addon/rdule' {
23-
export const addon: DruleAddon;
24-
}
25-
26-
declare module 'nano-css/addon/sheet' {
27-
export const addon: SheetAddon;
28-
}
29-
30-
declare module 'nano-css/addon/units' {
31-
export const addon: UnitsAddon;
32-
}
33-
34-
declare module 'nano-css/addon/atoms' {
35-
export const addon: AtomsAddon;
36-
}
37-
38-
declare module 'nano-css/addon/emmet' {
39-
export const addon: EmmetAddon;
40-
}
41-
42-
declare module 'nano-css/addon/keyframes' {
43-
export const addon: KeyframesAddon;
44-
}
45-
46-
// Presets
47-
48-
declare module 'nano-css/preset/sheet' {
49-
export const preset: SheetPreset;
50-
}
3+
export const create: CreateNano;

‎types/demo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {create} from './nano';
1+
import {create} from '..';
22

33
const nano = create();
44

‎types/nano.d.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import {EmmetAddon} from '../addon/emmet';
88
import {SheetAddon} from '../addon/sheet';
99
import {UnitsAddon} from '../addon/units';
1010
import {KeyframesAddon} from '../addon/keyframes';
11+
import {AmpAddon} from '../addon/amp';
12+
import {ArrayAddon} from '../addon/array';
13+
import {CacheAddon} from '../addon/cache';
14+
import {DsheetAddon} from '../addon/dsheet';
15+
import {ExtractAddon} from '../addon/extract';
16+
import {GlobalAddon} from '../addon/global';
17+
import {GoogleFontAddon} from '../addon/googleFont';
18+
import {HydrateAddon} from '../addon/hydrate';
1119

1220
export type Addons = RuleAddon &
1321
SheetAddon &
@@ -17,7 +25,15 @@ export type Addons = RuleAddon &
1725
DecoratorAddon &
1826
EmmetAddon &
1927
CSSOMAddon &
20-
VCSSOMAddon;
28+
VCSSOMAddon &
29+
ArrayAddon &
30+
CacheAddon &
31+
DsheetAddon &
32+
ExtractAddon &
33+
GlobalAddon &
34+
GoogleFontAddon &
35+
HydrateAddon &
36+
AmpAddon;
2137

2238
/**
2339
* nano-css main object.
@@ -123,4 +139,3 @@ export interface NanoOptions {
123139
}
124140

125141
export type CreateNano = (options?: NanoOptions) => NanoRenderer;
126-
export const create: CreateNano;

0 commit comments

Comments
 (0)