mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
Adapt TypeStyle's CSS typings to JSS
This commit is contained in:
committed by
Fredrik Nicol
parent
c0928c6417
commit
d265ffc544
Vendored
+2880
File diff suppressed because it is too large
Load Diff
Vendored
+1
-178
@@ -5,184 +5,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { types } from 'typestyle';
|
||||
import { Observable } from './observable';
|
||||
|
||||
export type PseudoCssKey =
|
||||
| ':active'
|
||||
| ':any'
|
||||
| ':checked'
|
||||
| ':default'
|
||||
| ':disabled'
|
||||
| ':empty'
|
||||
| ':enabled'
|
||||
| ':first'
|
||||
| ':first-child'
|
||||
| ':first-of-type'
|
||||
| ':fullscreen'
|
||||
| ':focus'
|
||||
| ':hover'
|
||||
| ':indeterminate'
|
||||
| ':in-range'
|
||||
| ':invalid'
|
||||
| ':last-child'
|
||||
| ':last-of-type'
|
||||
| ':left'
|
||||
| ':link'
|
||||
| ':only-child'
|
||||
| ':only-of-type'
|
||||
| ':optional'
|
||||
| ':out-of-range'
|
||||
| ':read-only'
|
||||
| ':read-write'
|
||||
| ':required'
|
||||
| ':right'
|
||||
| ':root'
|
||||
| ':scope'
|
||||
| ':target'
|
||||
| ':valid'
|
||||
| ':visited'
|
||||
// TODO
|
||||
// | ':dir()'
|
||||
// | ':lang()'
|
||||
// | ':not()'
|
||||
// | ':nth-child()'
|
||||
// | ':nth-last-child()'
|
||||
// | ':nth-last-of-type()'
|
||||
// | ':nth-of-type()'
|
||||
| '::after'
|
||||
| '::before'
|
||||
| '::cue'
|
||||
| '::first-letter'
|
||||
| '::first-line'
|
||||
| '::selection'
|
||||
| '::backdrop '
|
||||
| '::placeholder '
|
||||
| '::marker '
|
||||
| '::spelling-error '
|
||||
| '::grammar-error ';
|
||||
|
||||
export type PseudoCss = Partial<Record<PseudoCssKey, types.CSSProperties>>;
|
||||
|
||||
export interface JssProps {
|
||||
'@global'?: types.CSSProperties & PseudoCss;
|
||||
extend?: string;
|
||||
composes?: string | string[];
|
||||
}
|
||||
|
||||
export type css = types.CSSProperties;
|
||||
|
||||
export interface JssExpand {
|
||||
animation:
|
||||
| {
|
||||
delay: css['animationDelay'];
|
||||
direction: css['animationDirection'];
|
||||
duration: css['animationDuration'];
|
||||
iterationCount: css['animationIterationCount'];
|
||||
name: css['animationName'];
|
||||
playState: css['animationPlayState'];
|
||||
timingFunction: any;
|
||||
}
|
||||
| css['animation'];
|
||||
background:
|
||||
| {
|
||||
attachment: css['backgroundAttachment'];
|
||||
color: css['backgroundColor'];
|
||||
image: css['backgroundImage'];
|
||||
position: css['backgroundPosition'] | number[]; // Can be written using array e.g. `[0 0]`
|
||||
repeat: css['backgroundRepeat'];
|
||||
size: Array<css['backgroundSize'] | css['backgroundSize']>; // Can be written using array e.g. `['center' 'center']`
|
||||
}
|
||||
| css['background'];
|
||||
border:
|
||||
| {
|
||||
color: css['borderColor'];
|
||||
style: css['borderStyle'];
|
||||
width: css['borderWidth'];
|
||||
}
|
||||
| css['border'];
|
||||
boxShadow:
|
||||
| {
|
||||
x: any;
|
||||
y: any;
|
||||
blur: any;
|
||||
spread: any;
|
||||
color: css['color'];
|
||||
inset?: 'inset'; // If you want to add inset you need to write "inset: 'inset'"
|
||||
}
|
||||
| css['boxShadow'];
|
||||
flex:
|
||||
| {
|
||||
basis: css['flexBasis'];
|
||||
direction: css['flexDirection'];
|
||||
flow: css['flexFlow'];
|
||||
grow: css['flexGrow'];
|
||||
shrink: css['flexShrink'];
|
||||
wrap: css['flexWrap'];
|
||||
}
|
||||
| css['flex'];
|
||||
font:
|
||||
| {
|
||||
family: css['fontFamily'];
|
||||
size: css['fontSize'];
|
||||
stretch: css['fontStretch'];
|
||||
style: css['fontStyle'];
|
||||
variant: css['fontVariant'];
|
||||
weight: css['fontWeight'];
|
||||
}
|
||||
| css['font'];
|
||||
listStyle:
|
||||
| {
|
||||
image: css['listStyleImage'];
|
||||
position: css['listStylePosition'];
|
||||
type: css['listStyleType'];
|
||||
}
|
||||
| css['listStyle'];
|
||||
margin:
|
||||
| {
|
||||
bottom: css['marginBottom'];
|
||||
left: css['marginLeft'];
|
||||
right: css['marginRight'];
|
||||
top: css['marginTop'];
|
||||
}
|
||||
| css['margin'];
|
||||
padding:
|
||||
| {
|
||||
bottom: css['paddingBottom'];
|
||||
left: css['paddingLeft'];
|
||||
right: css['paddingRight'];
|
||||
top: css['paddingTop'];
|
||||
}
|
||||
| css['padding'];
|
||||
outline:
|
||||
| {
|
||||
color: css['outlineColor'];
|
||||
style: 'none' | 'hidden' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset';
|
||||
width: any;
|
||||
}
|
||||
| css['outline'];
|
||||
textShadow:
|
||||
| {
|
||||
x: any;
|
||||
y: any;
|
||||
blur: any;
|
||||
color: css['color'];
|
||||
}
|
||||
| css['textShadow'];
|
||||
transition:
|
||||
| {
|
||||
delay: css['transitionDelay'];
|
||||
duration: css['transitionDuration'];
|
||||
property: css['transitionProperty'];
|
||||
timingFunction: css['transitionTimingFunction'];
|
||||
}
|
||||
| css['transition'];
|
||||
}
|
||||
|
||||
export type JssExpandArr = { [k in keyof JssExpand]?: JssExpand[k] | Array<JssExpand[k]> };
|
||||
|
||||
export type SimpleStyle = types.CSSProperties & PseudoCss & JssProps & JssExpandArr;
|
||||
export type Style = Observable<SimpleStyle> | SimpleStyle;
|
||||
import { Style } from './css';
|
||||
|
||||
export type Styles<Name extends string = any> = Record<Name, Style>;
|
||||
export type Classes<Name extends string = any> = Record<Name, string>;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"typestyle": "*"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user