-
-
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.
Migrate
@emotion/utils
to TypeScript (#2359)
* feat(ts-utils): Initial migration of utils * Small tweaks * More small tweaks Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
- Loading branch information
1 parent
52aadc6
commit 16d8a8c
Showing
8 changed files
with
47 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@emotion/utils': minor | ||
--- | ||
|
||
Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written. |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ coverage/ | |
node_modules/ | ||
stylis.min.js | ||
/demo/dist | ||
/packages/site/build | ||
/packages/site/build |
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 was deleted.
Oops, something went wrong.
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,27 @@ | ||
import { StyleSheet } from '@emotion/sheet' | ||
|
||
export { StyleSheet } | ||
|
||
export type RegisteredCache = Record<string, string | undefined> | ||
|
||
export type SerializedStyles = { | ||
name: string | ||
styles: string | ||
map?: string | ||
next?: SerializedStyles | ||
} | ||
|
||
export type EmotionCache = { | ||
inserted: Record<string, string | true | undefined> | ||
registered: RegisteredCache | ||
sheet: StyleSheet | ||
key: string | ||
compat?: true | ||
nonce?: string | ||
insert: ( | ||
selector: string, | ||
serialized: SerializedStyles, | ||
sheet: StyleSheet, | ||
shouldCache: boolean | ||
) => string | void | ||
} |
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 |
---|---|---|
@@ -1,51 +1,3 @@ | ||
// Definitions by: Junyoung Clare Jang </~https://github.com/Ailrun> | ||
// TypeScript Version: 2.2 | ||
|
||
export interface RegisteredCache { | ||
[key: string]: string | ||
} | ||
|
||
export interface StyleSheet { | ||
container: HTMLElement | ||
nonce?: string | ||
key: string | ||
insert(rule: string): void | ||
flush(): void | ||
tags: Array<HTMLStyleElement> | ||
} | ||
|
||
export interface EmotionCache { | ||
inserted: { | ||
[key: string]: string | true | ||
} | ||
registered: RegisteredCache | ||
sheet: StyleSheet | ||
key: string | ||
compat?: true | ||
nonce?: string | ||
insert( | ||
selector: string, | ||
serialized: SerializedStyles, | ||
sheet: StyleSheet, | ||
shouldCache: boolean | ||
): string | void | ||
} | ||
|
||
export interface SerializedStyles { | ||
name: string | ||
styles: string | ||
map?: string | ||
next?: SerializedStyles | ||
} | ||
|
||
export const isBrowser: boolean | ||
export function getRegisteredStyles( | ||
registered: RegisteredCache, | ||
registeredStyles: Array<string>, | ||
classNames: string | ||
): string | ||
export function insertStyles( | ||
cache: EmotionCache, | ||
serialized: SerializedStyles, | ||
isStringTag: boolean | ||
): string | void | ||
export * from '../src' |
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