From 752cd5eae4456f4f40b5cc2773f230ebe395322d Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Mon, 24 Apr 2023 15:45:06 +0200 Subject: [PATCH] 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. --- .../package-lock.json | 11 ++++++++ .../tailwindcss-language-service/package.json | 1 + types/culori.d.ts | 28 ------------------- 3 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 types/culori.d.ts diff --git a/packages/tailwindcss-language-service/package-lock.json b/packages/tailwindcss-language-service/package-lock.json index b611686..ea3f67b 100644 --- a/packages/tailwindcss-language-service/package-lock.json +++ b/packages/tailwindcss-language-service/package-lock.json @@ -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", diff --git a/packages/tailwindcss-language-service/package.json b/packages/tailwindcss-language-service/package.json index 3eea755..84a48f8 100644 --- a/packages/tailwindcss-language-service/package.json +++ b/packages/tailwindcss-language-service/package.json @@ -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", diff --git a/types/culori.d.ts b/types/culori.d.ts deleted file mode 100644 index a24c2cd..0000000 --- a/types/culori.d.ts +++ /dev/null @@ -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( - mode: T - ): (color: Color | string) => T extends 'rgb' ? RgbColor : T extends 'hsl' ? HslColor : never -}