-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from sure-thing/typescript
typescript
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
dist | ||
*.d.ts |
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,64 @@ | ||
import { Properties as CSSProperties, Pseudos as CSSPsuedos } from 'csstype'; | ||
import { KeyframesAddon } from 'nano-css/addon/keyframes' | ||
|
||
type Unitless = string | number; | ||
type StringKeyValue = { [name: string]: string } | ||
type UnitlessKeyValue = { [name: string]: Unitless } | ||
type AnyKeyValue = { [name: string]: any } | ||
type CSSPropertyNames = keyof CSSProperties | ||
|
||
export interface Tokens { | ||
color?: StringKeyValue | string[]; | ||
space?: Unitless[] | UnitlessKeyValue; | ||
width?: UnitlessKeyValue | Unitless[]; | ||
zIndex?: Unitless[] | UnitlessKeyValue; | ||
fontSize?: string[] | StringKeyValue; | ||
fontFamily?: StringKeyValue; | ||
fontWeight?: Unitless[] | UnitlessKeyValue; | ||
lineHeight?: Unitless[] | UnitlessKeyValue; | ||
} | ||
|
||
export interface Shorthands { | ||
[shorthand: string]: { | ||
properties: CSSPropertyNames[]; | ||
token?: keyof Tokens; | ||
unit?: (v: any) => string; | ||
} | ||
} | ||
|
||
export interface Macros { | ||
[macro: string]: { | ||
[prop: string]: Unitless; | ||
} | ||
} | ||
|
||
export interface UserTheme {} | ||
|
||
export type Theme = { | ||
breakpoints?: Unitless[]; | ||
tokens?: Tokens; | ||
shorthands?: Shorthands; | ||
macros?: Macros; | ||
} & UserTheme | ||
|
||
export type Options = {} | ||
|
||
export type StyleObject = CSSProperties | CSSPsuedos | { | ||
[property: string]: StyleObject; | ||
} | ||
export type HypostyleProperties = CSSPropertyNames | CSSPsuedos | string; | ||
export type HypostyleObject = CSSProperties | CSSPsuedos | { | ||
[property in HypostyleProperties]: HypostyleObject | string | number | boolean | undefined; | ||
} | ||
|
||
export declare function hypostyle(theme?: Theme, options?: Options): { | ||
css(props: Partial<HypostyleObject>): string; | ||
injectGlobal(props: Partial<HypostyleObject>): any; | ||
keyframes: KeyframesAddon['keyframes']; | ||
flush(): string; | ||
style(props: Partial<HypostyleObject>): StyleObject; | ||
pick(props: Partial<HypostyleObject>): { | ||
props: AnyKeyValue; | ||
styles: HypostyleObject; | ||
}; | ||
} |
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