Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "csstype", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"main": "index.d.ts", | ||
@@ -12,6 +12,7 @@ "description": "TypeScript definitions for CSS", | ||
"@types/jest": "^22.1.1", | ||
"@types/node": "^9.4.0", | ||
"@types/node": "^9.4.2", | ||
"@types/prettier": "^1.10.0", | ||
"chokidar": "^2.0.0", | ||
"jest": "^22.1.4", | ||
"flow-bin": "^0.65.0", | ||
"jest": "^22.2.1", | ||
"mdn-data": "1.1.0", | ||
@@ -34,4 +35,5 @@ "prettier": "^1.10.2", | ||
"files": [ | ||
"index.d.ts" | ||
"index.d.ts", | ||
"flow-typed/" | ||
] | ||
} |
# CSSType | ||
TypeScript definitions for CSS, generated by [data from MDN](https://github.com/mdn/data). It provides autocompletion and type checking for CSS properties and values. | ||
TypeScript and Flow definitions for CSS, generated by [data from MDN](https://github.com/mdn/data). It provides autocompletion and type checking for CSS properties and values. | ||
@@ -16,5 +16,6 @@ ```ts | ||
```bash | ||
$ npm install csstype@latest # For projects | ||
$ npm install csstype@* # For libraries | ||
```sh | ||
$ npm install csstype | ||
$ # or | ||
$ yarn add csstype | ||
``` | ||
@@ -24,3 +25,3 @@ | ||
Lengths defaults to `string`. But it's possible to add `number` as well using generics. | ||
Lengths defaults to `string | number`. But it's possible to override it using generics. | ||
@@ -30,4 +31,4 @@ ```ts | ||
const style: CSS.Properties<string | number> = { | ||
padding: 10, | ||
const style: CSS.Properties<string> = { | ||
padding: '10px', | ||
margin: '1rem', | ||
@@ -62,1 +63,16 @@ } | ||
``` | ||
Hyphen cased (kebab cased) properties are provided in `CSS.PropertiesHyphen` and `CSS.PropertiesHyphenFallback`. It's not **not** added by default in `CSS.Properties`. To allow both of them, you can simply extend with `CSS.PropertiesHyphen` or/and `CSS.PropertiesHyphenFallback`. | ||
```ts | ||
import * as CSS from 'csstype'; | ||
interface Style extends CSS.Properties, CSS.PropertiesHyphen { } | ||
const style: Style = { | ||
'flex-grow': 1, | ||
'flex-shrink': 0, | ||
'font-weight': 'normal', | ||
backgroundColor: 'white', | ||
} | ||
``` |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257475
4
4793
75
13