Use @types/culori (#735)
This removes the need to define types here. Also this allows third parties to use this package without having to declare type definitions for culori.master
parent
c5d20ab343
commit
752cd5eae4
|
@ -8,6 +8,7 @@
|
|||
"name": "tailwindcss-language-service",
|
||||
"version": "0.0.27",
|
||||
"dependencies": {
|
||||
"@types/culori": "^2.0.0",
|
||||
"@types/moo": "0.5.3",
|
||||
"@types/semver": "7.3.10",
|
||||
"becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0",
|
||||
|
@ -2158,6 +2159,11 @@
|
|||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/culori": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/culori/-/culori-2.0.0.tgz",
|
||||
"integrity": "sha512-bKpEra39sQS9UZ+1JoWhuGJEzwKS0dUkNCohVYmn6CAEBkqyIXimKiPDRZWtiOB7sKgkWMaTUpHFimygRoGIlg=="
|
||||
},
|
||||
"node_modules/@types/eslint-visitor-keys": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
|
||||
|
@ -14221,6 +14227,11 @@
|
|||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"@types/culori": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/culori/-/culori-2.0.0.tgz",
|
||||
"integrity": "sha512-bKpEra39sQS9UZ+1JoWhuGJEzwKS0dUkNCohVYmn6CAEBkqyIXimKiPDRZWtiOB7sKgkWMaTUpHFimygRoGIlg=="
|
||||
},
|
||||
"@types/eslint-visitor-keys": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/culori": "^2.0.0",
|
||||
"@types/moo": "0.5.3",
|
||||
"@types/semver": "7.3.10",
|
||||
"becke-ch--regex--s0-0-v1--base--pl--lib": "1.4.0",
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
declare module 'culori' {
|
||||
export interface RgbColor {
|
||||
mode: 'rgb'
|
||||
r: number
|
||||
g: number
|
||||
b: number
|
||||
alpha?: number
|
||||
}
|
||||
export interface HslColor {
|
||||
mode: 'hsl'
|
||||
h: number
|
||||
s: number
|
||||
b: number
|
||||
alpha?: number
|
||||
}
|
||||
export type Color = RgbColor | HslColor
|
||||
export function parse(color: string): Color | undefined
|
||||
export function formatRgb(color: Color | string): string
|
||||
export function formatHsl(color: Color | string): string
|
||||
export function formatHex(color: Color | string): string
|
||||
export function formatHex8(color: Color | string): string
|
||||
|
||||
type Mode = 'rgb' | 'hsl'
|
||||
|
||||
export function converter<T extends Mode>(
|
||||
mode: T
|
||||
): (color: Color | string) => T extends 'rgb' ? RgbColor : T extends 'hsl' ? HslColor : never
|
||||
}
|
Loading…
Reference in New Issue