File tree Expand file tree Collapse file tree 5 files changed +35
-11
lines changed Expand file tree Collapse file tree 5 files changed +35
-11
lines changed Original file line number Diff line number Diff line change 4
4
"version" : " 0.3.0" ,
5
5
"main" : " dist/index.js" ,
6
6
"module" : " dist/index.esm.js" ,
7
+ "source" : " src/index.ts" ,
8
+ "types" : " dist/index.d.ts" ,
7
9
"author" :
" John Otander <[email protected] >" ,
8
10
"license" : " MIT" ,
9
11
"scripts" : {
10
- "prepare" : " microbundle --no-compress" ,
11
- "watch" : " microbundle watch --no-compress"
12
+ "prepare" : " microbundle --no-compress --tsconfig tsconfig.json " ,
13
+ "watch" : " microbundle watch --no-compress --tsconfig tsconfig.json "
12
14
},
13
15
"devDependencies" : {
14
16
"babel-polyfill" : " ^6.26.0" ,
15
- "execa" : " ^4.0.0"
17
+ "execa" : " ^4.0.0" ,
18
+ "@theme-ui/core" : " ^0.3.1"
16
19
},
17
20
"publishConfig" : {
18
21
"access" : " public"
Original file line number Diff line number Diff line change 1
- const KEY_MAPPING = {
1
+ import { Theme } from '@theme-ui/core'
2
+
3
+ const KEY_MAPPING : {
4
+ readonly [ Key : string ] : string | string [ ]
5
+ } = {
2
6
space : 'spacing' ,
3
- radii : 'borderRadius' ,
4
7
fonts : 'fontFamily' ,
5
8
borderStyles : 'borderStyle' ,
6
9
radii : 'borderRadius' ,
@@ -13,23 +16,26 @@ const KEY_MAPPING = {
13
16
zIndices : 'zIndex' ,
14
17
}
15
18
16
- export default theme => {
17
- const transformedTheme = Object . entries ( theme ) . reduce ( ( acc , [ key , value ] ) => {
18
- if ( ! KEY_MAPPING [ key ] ) {
19
+ export default ( theme : Theme ) => {
20
+ const transformedTheme = Object . entries ( theme ) . reduce < {
21
+ [ Key : string ] : unknown
22
+ } > ( ( acc , [ key , value ] ) => {
23
+ const matchingKey = KEY_MAPPING [ key ]
24
+ if ( ! matchingKey ) {
19
25
return {
20
26
...acc ,
21
27
[ key ] : value ,
22
28
}
23
- } else if ( Array . isArray ( KEY_MAPPING [ key ] ) ) {
24
- KEY_MAPPING [ key ] . forEach ( tachyonsKey => {
29
+ } else if ( Array . isArray ( matchingKey ) ) {
30
+ matchingKey . forEach ( tachyonsKey => {
25
31
acc [ tachyonsKey ] = value
26
32
} )
27
33
28
34
return acc
29
35
} else {
30
36
return {
31
37
...acc ,
32
- [ KEY_MAPPING [ key ] ] : value ,
38
+ [ matchingKey ] : value ,
33
39
}
34
40
}
35
41
} , { } )
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ {
2
+ "compilerOptions" : {
3
+ "resolveJsonModule" : true ,
4
+ "esModuleInterop" : true ,
5
+ "moduleResolution" : " node" ,
6
+ "strict" : true
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ declare module 'tachyons-generator' {
2
+ export default function ( config : {
3
+ [ TachyonsKey : string ] : unknown
4
+ } ) : {
5
+ generate ( ) : Promise < { css : string } >
6
+ }
7
+ }
You can’t perform that action at this time.
0 commit comments