File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import {CreateNano} from './types/nano';
2
2
import { RuleAddon } from './types/addon/rule' ;
3
3
import { UnitsAddon } from './types/addon/units' ;
4
4
import { DruleAddon } from './types/addon/drule' ;
5
+ import { SheetAddon } from './types/addon/sheet' ;
5
6
6
7
export * from './types/nano' ;
7
8
@@ -17,6 +18,10 @@ declare module 'nano-css/addon/rdule' {
17
18
export const addon : DruleAddon ;
18
19
}
19
20
21
+ declare module 'nano-css/addon/sheet' {
22
+ export const addon : SheetAddon ;
23
+ }
24
+
20
25
declare module 'nano-css/addon/units' {
21
26
export const addon : UnitsAddon ;
22
27
}
Original file line number Diff line number Diff line change
1
+ import { CssLikeObject } from '../common' ;
2
+ import { NanoRenderer } from '../nano' ;
3
+
4
+ export interface SheetPatch {
5
+ /**
6
+ * Creates a collection of CSS rules.
7
+ *
8
+ * ```js
9
+ * const classes = sheet({
10
+ * wrapper: {
11
+ * border: '1px solid red',
12
+ * },
13
+ * button: {
14
+ * color: 'red',
15
+ * },
16
+ * });
17
+ * ```
18
+ */
19
+ sheet : ( cssMap : { [ s : string ] : CssLikeObject } , block ?: string ) => { [ s : string ] : string } ;
20
+ }
21
+
22
+ export type SheetAddon = < T extends NanoRenderer > ( nano : T ) => T & SheetPatch ;
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ import {CssLikeObject} from './common';
2
2
import { RulePatch } from './addon/rule' ;
3
3
import { DrulePatch } from './addon/drule' ;
4
4
import { UnitsPatch } from './addon/units' ;
5
+ import { SheetPatch } from './addon/sheet' ;
5
6
6
7
/*
7
8
interface NanoRenderer extends Partial<IUnits> {
8
- sheet?: (cssMap: {[s: string]: ICssLikeObject}, block?: string) => {[s: string]: string};
9
9
dsheet?: (cssMap: {[s: string]: ICssLikeObject}, block?: string) => {[s: string]: TDynamicCss};
10
10
jsx?: (
11
11
type: THyperscriptType,
@@ -45,7 +45,11 @@ interface NanoRenderer extends Partial<IUnits> {
45
45
}
46
46
*/
47
47
48
- export interface NanoRenderer extends Partial < RulePatch > , Partial < UnitsPatch > , Partial < DrulePatch > {
48
+ export interface NanoRenderer
49
+ extends Partial < RulePatch > ,
50
+ Partial < UnitsPatch > ,
51
+ Partial < DrulePatch > ,
52
+ Partial < SheetPatch > {
49
53
/**
50
54
* Equals to `true` if in browser environment.
51
55
*/
You can’t perform that action at this time.
0 commit comments