-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TypeScript types and tests for the emotion package.
- Loading branch information
1 parent
74cc4fa
commit d7b73e0
Showing
5 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "es2015", | ||
"strict": true, | ||
"allowSyntheticDefaultImports": true, | ||
"moduleResolution": "node" | ||
}, | ||
"include": [ | ||
"./*.ts", | ||
"./*.tsx" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
sheet, | ||
useStylisPlugin, | ||
injectGlobal, | ||
flush, | ||
css, | ||
fontFace, | ||
hydrate | ||
} from '../'; | ||
|
||
sheet.speedy(true); | ||
sheet.inject(); | ||
sheet.insert('.foo { font-size: 1 };', 'some source map'); | ||
sheet.flush(); | ||
|
||
useStylisPlugin(() => {})([() => {}, () => {}])(null); | ||
|
||
flush(); | ||
|
||
const className: string = css` | ||
${(true as boolean) && ''} | ||
${'bar'} | ||
${css``} | ||
${1} | ||
`; | ||
|
||
fontFace` | ||
font-family: 'Foo'; | ||
`; | ||
|
||
injectGlobal` | ||
#foo { | ||
font-face: 'Foo'; | ||
} | ||
`; | ||
|
||
hydrate(['css-123', 'css-456']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
export type Interpolation = string | number | false | undefined; | ||
export type CreateStyles<TRet> = (strings: TemplateStringsArray, ...vars: Interpolation[]) => TRet; | ||
export interface StylisUse { | ||
// TODO: Make this more precise than just Function | ||
(plugin: Function | Function[] | null): StylisUse; | ||
} | ||
|
||
declare const foo: StyleSheetList; | ||
|
||
|
||
export interface StyleSheet { | ||
inject(): void; | ||
speedy(bool: boolean): void; | ||
insert(rule: string, sourceMap: string): void; | ||
flush(): void; | ||
} | ||
|
||
export const sheet: StyleSheet; | ||
|
||
export const useStylisPlugin: StylisUse; | ||
|
||
export const inserted: Record<string, boolean | undefined>; | ||
|
||
export const registered: Record<string, string | undefined>; | ||
|
||
export function flush(): void; | ||
|
||
export function values(cls: string, vars: Interpolation[]): string; | ||
|
||
export const css: CreateStyles<string>; | ||
|
||
export const injectGlobal: CreateStyles<void>; | ||
|
||
export const keyframes: CreateStyles<string>; | ||
|
||
export const fontFace: CreateStyles<void>; | ||
|
||
export function getRegisteredStyles(registeredStyles: string[], classNames: string): string; | ||
|
||
export function hydrate(ids: string[]): void; |