@mkbabb/value.js 0.5.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +35 -53
  3. package/dist/easing.d.ts +49 -0
  4. package/dist/index.d.ts +22 -10
  5. package/dist/math.d.ts +17 -1
  6. package/dist/parsing/animation-shorthand.d.ts +19 -0
  7. package/dist/parsing/color.d.ts +10 -3
  8. package/dist/parsing/extract.d.ts +48 -0
  9. package/dist/parsing/index.d.ts +5 -20
  10. package/dist/parsing/serialize.d.ts +24 -0
  11. package/dist/parsing/stylesheet.d.ts +44 -0
  12. package/dist/parsing/units.d.ts +24 -6
  13. package/dist/parsing/utils.d.ts +19 -0
  14. package/dist/postcss-CRluLK2m.js +6400 -0
  15. package/dist/quantize/cluster.d.ts +45 -0
  16. package/dist/quantize/index.d.ts +14 -0
  17. package/dist/quantize/types.d.ts +39 -0
  18. package/dist/standalone-Ck3UyY5I.js +3458 -0
  19. package/dist/units/color/constants.d.ts +21 -0
  20. package/dist/units/color/contrast.d.ts +35 -0
  21. package/dist/units/color/conversions/cylindrical.d.ts +13 -0
  22. package/dist/units/color/conversions/direct.d.ts +41 -0
  23. package/dist/units/color/conversions/hex.d.ts +3 -0
  24. package/dist/units/color/conversions/index.d.ts +17 -0
  25. package/dist/units/color/conversions/kelvin.d.ts +5 -0
  26. package/dist/units/color/conversions/lab.d.ts +8 -0
  27. package/dist/units/color/conversions/oklab.d.ts +11 -0
  28. package/dist/units/color/conversions/transfer.d.ts +22 -0
  29. package/dist/units/color/conversions/xyz-extended.d.ts +13 -0
  30. package/dist/units/color/dispatch.d.ts +25 -0
  31. package/dist/units/color/gamut.d.ts +6 -0
  32. package/dist/units/color/index.d.ts +221 -116
  33. package/dist/units/color/mix.d.ts +16 -0
  34. package/dist/units/color/normalize.d.ts +3 -3
  35. package/dist/units/index.d.ts +71 -1
  36. package/dist/units/interpolate.d.ts +70 -0
  37. package/dist/units/normalize.d.ts +57 -7
  38. package/dist/units/utils.d.ts +1 -1
  39. package/dist/utils.d.ts +3 -2
  40. package/dist/value.js +4323 -4392
  41. package/package.json +52 -28
  42. package/dist/units/color/utils.d.ts +0 -77
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkbabb/value.js",
3
- "version": "0.5.1",
3
+ "version": "0.11.0",
4
4
  "description": "CSS value units for color, length, angles, & c.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -18,11 +18,16 @@
18
18
  "type": "module",
19
19
  "main": "./dist/value.js",
20
20
  "types": "./dist/index.d.ts",
21
- "sideEffects": false,
21
+ "sideEffects": [
22
+ "./demo/**",
23
+ "**/*.css"
24
+ ],
22
25
  "exports": {
23
26
  ".": {
27
+ "development": "./src/index.ts",
24
28
  "types": "./dist/index.d.ts",
25
- "import": "./dist/value.js"
29
+ "import": "./dist/value.js",
30
+ "default": "./dist/value.js"
26
31
  }
27
32
  },
28
33
  "files": [
@@ -30,8 +35,15 @@
30
35
  ],
31
36
  "scripts": {
32
37
  "dev": "vite --port 9000",
38
+ "dev:hero-lab": "vite --mode hero-lab --port 9010",
33
39
  "build": "vite build --mode production",
40
+ "build:hero-lab": "vite build --mode hero-lab",
41
+ "build:watch": "vite build --mode production --watch",
34
42
  "gh-pages": "vite build --mode gh-pages",
43
+ "prepare": "test -f dist/value.js || npm run build",
44
+ "bench": "node bench/color-channel-access.mjs && node bench/color2-direct-paths.mjs && node bench/parser-namelookup.mjs && node bench/computed-endpoint.mjs",
45
+ "typecheck": "node scripts/check-types.mjs",
46
+ "lint": "eslint . --max-warnings=0",
35
47
  "test": "vitest",
36
48
  "test:e2e": "playwright test"
37
49
  },
@@ -48,44 +60,56 @@
48
60
  },
49
61
  "homepage": "https://github.com/mkbabb/value.js#readme",
50
62
  "dependencies": {
51
- "@mkbabb/parse-that": "^0.8.0"
63
+ "@mkbabb/parse-that": "^0.8.2"
52
64
  },
53
65
  "devDependencies": {
54
- "@iconify-json/radix-icons": "^1.2.2",
66
+ "@iconify-json/radix-icons": "^1.2.6",
55
67
  "@iconify/vue": "^4.1.2",
56
- "@playwright/test": "^1.58.2",
57
- "@tailwindcss/cli": "^4.1.11",
58
- "@tailwindcss/postcss": "^4.1.11",
59
- "@types/katex": "^0.16.7",
60
- "@types/node": "^24.1.0",
61
- "@unovis/ts": "^1.5.2",
62
- "@unovis/vue": "^1.5.2",
63
- "@vee-validate/zod": "^4.13.2",
64
- "@vitejs/plugin-vue": "^6.0.0",
65
- "@vue/test-utils": "^2.4.6",
66
- "@vueuse/core": "^14.2.1",
68
+ "@lucide/vue": "^1.16.0",
69
+ "@mkbabb/glass-ui": "file:../glass-ui",
70
+ "@mkbabb/keyframes.js": "file:../keyframes.js",
71
+ "@playwright/test": "^1.60.0",
72
+ "@tailwindcss/cli": "^4.3.0",
73
+ "@tailwindcss/postcss": "^4.3.0",
74
+ "@types/katex": "^0.16.8",
75
+ "@types/node": "^24.12.3",
76
+ "@types/sortablejs": "^1.15.9",
77
+ "@typescript-eslint/eslint-plugin": "^8.59.4",
78
+ "@typescript-eslint/parser": "^8.59.4",
79
+ "@unovis/ts": "^1.6.5",
80
+ "@unovis/vue": "^1.6.5",
81
+ "@vee-validate/zod": "^4.15.1",
82
+ "@vitejs/plugin-vue": "^6.0.7",
83
+ "@vue/test-utils": "^2.4.10",
84
+ "@vueuse/core": "^14.3.0",
85
+ "@vueuse/integrations": "^14.3.0",
67
86
  "class-variance-authority": "^0.7.1",
68
87
  "clsx": "^2.1.1",
69
88
  "embla-carousel-vue": "^8.6.0",
89
+ "eslint": "^10.4.0",
90
+ "eslint-plugin-vue": "^10.9.1",
91
+ "globals": "^17.6.0",
70
92
  "highlight.js": "^11.11.1",
71
93
  "jsdom": "^26.1.0",
72
- "katex": "^0.16.22",
73
- "lucide-vue-next": "^0.525.0",
74
- "prettier": "^3.6.2",
94
+ "katex": "^0.16.47",
95
+ "prettier": "^3.8.3",
75
96
  "reka-ui": "^2.0.0",
76
- "tailwind-merge": "^3.3.1",
77
- "tailwindcss": "^4.1.11",
78
- "tw-animate-css": "^1.2.5",
79
- "typescript": "^5.8.3",
97
+ "sortablejs": "^1.15.7",
98
+ "tailwind-merge": "^3.6.0",
99
+ "tailwindcss": "^4.3.0",
100
+ "tw-animate-css": "^1.4.0",
101
+ "typescript": "^6.0.3",
80
102
  "unplugin-vue-markdown": "^29.2.0",
81
103
  "v-calendar": "^3.1.2",
82
- "vaul-vue": "^0.2.0",
83
- "vee-validate": "^4.13.2",
84
- "vite": "^7.0.6",
104
+ "vaul-vue": "^0.4.0",
105
+ "vee-validate": "^4.15.1",
106
+ "vite": "^8.0.13",
85
107
  "vite-plugin-dts": "^4.5.4",
86
108
  "vitest": "^3.2.4",
87
- "vue": "^3.5.18",
88
- "vue-sonner": "^1.1.3",
109
+ "vue": "^3.5.34",
110
+ "vue-eslint-parser": "^10.4.0",
111
+ "vue-router": "^4.6.4",
112
+ "vue-tsc": "^3.3.1",
89
113
  "zod": "^3.23.8"
90
114
  }
91
115
  }
@@ -1,77 +0,0 @@
1
- import { AdobeRGBColor, Color, DisplayP3Color, HSLColor, HSVColor, HWBColor, KelvinColor, LABColor, LCHColor, LinearSRGBColor, OKLABColor, OKLCHColor, ProPhotoRGBColor, RGBColor, Rec2020Color, XYZColor, ColorSpaceMap } from '.';
2
- import { ColorSpace, WhitePoint } from './constants';
3
- export declare const getFormattedColorSpaceRange: <T extends ColorSpace>(colorSpace: T) => ColorSpaceMap<{
4
- min: string;
5
- max: string;
6
- }>[T];
7
- export declare const hex2rgb: (hex: string) => RGBColor;
8
- export declare const rgb2hex: ({ r, g, b, alpha }: RGBColor) => string;
9
- export declare const kelvin2rgb: ({ kelvin, alpha }: KelvinColor) => RGBColor;
10
- export declare const rgb2kelvin: ({ r, g, b, alpha }: RGBColor) => KelvinColor;
11
- export declare const hsv2hsl: ({ h, s, v, alpha }: HSVColor) => HSLColor;
12
- export declare const hsl2hsv: ({ h, s, l, alpha }: HSLColor) => HSVColor;
13
- export declare const hwb2hsl: ({ h, w, b, alpha }: HWBColor) => HSLColor;
14
- export declare const hsl2hwb: ({ h, s, l, alpha }: HSLColor) => HWBColor;
15
- export declare const rgb2hsl: ({ r, g, b, alpha }: RGBColor) => HSLColor;
16
- export declare function hsl2rgb({ h, s, l, alpha }: HSLColor): RGBColor;
17
- export declare function xyz2lab(xyz: XYZColor, toWhitePoint?: WhitePoint): LABColor;
18
- export declare function lab2xyz(lab: LABColor): XYZColor;
19
- export declare function srgbToLinear(channel: number): number;
20
- export declare function linearToSrgb(channel: number): number;
21
- export declare function rgb2xyz({ r, g, b, alpha }: RGBColor): XYZColor;
22
- export declare const xyz2rgb: ({ x, y, z, alpha }: XYZColor, correctGamut?: boolean) => RGBColor;
23
- export declare function lch2lab({ l, c, h, alpha }: LCHColor): LABColor;
24
- export declare function lab2lch({ l, a, b, alpha }: LABColor): LCHColor;
25
- export declare function oklab2xyz({ l, a, b, alpha }: OKLABColor): XYZColor;
26
- export declare function xyz2oklab(xyz: XYZColor): OKLABColor;
27
- export declare function oklab2lab(oklab: OKLABColor): LABColor;
28
- export declare function lab2oklab(lab: LABColor): OKLABColor;
29
- export declare function oklab2oklch({ l, a, b, alpha }: OKLABColor): OKLCHColor;
30
- export declare function oklch2oklab({ l, c, h, alpha }: OKLCHColor): OKLABColor;
31
- export declare function oklch2lab(oklch: OKLCHColor): LABColor;
32
- export declare function lab2oklch(lab: LABColor): OKLCHColor;
33
- export declare function hsl2xyz(hsl: HSLColor): XYZColor<number>;
34
- export declare function xyz2hsl(xyz: XYZColor): HSLColor<number>;
35
- export declare function hsv2xyz(hsv: HSVColor): XYZColor;
36
- export declare function xyz2hsv(xyz: XYZColor): HSVColor;
37
- export declare function hwb2xyz(hwb: HWBColor): XYZColor;
38
- export declare function xyz2hwb(xyz: XYZColor): HWBColor;
39
- export declare function lch2xyz(lch: LCHColor): XYZColor;
40
- export declare function xyz2lch(xyz: XYZColor): LCHColor;
41
- export declare function oklch2xyz(oklch: OKLCHColor): XYZColor;
42
- export declare function xyz2oklch(xyz: XYZColor): OKLCHColor;
43
- export declare function kelvin2xyz(kelvin: KelvinColor): XYZColor;
44
- export declare function xyz2kelvin(xyz: XYZColor): KelvinColor;
45
- export declare function adobeRgbToLinear(c: number): number;
46
- export declare function linearToAdobeRgb(c: number): number;
47
- export declare function proPhotoToLinear(c: number): number;
48
- export declare function linearToProPhoto(c: number): number;
49
- export declare function rec2020ToLinear(c: number): number;
50
- export declare function linearToRec2020(c: number): number;
51
- export declare function linearSrgb2xyz({ r, g, b, alpha }: LinearSRGBColor): XYZColor;
52
- export declare function xyz2linearSrgb({ x, y, z, alpha }: XYZColor): LinearSRGBColor;
53
- export declare function displayP32xyz({ r, g, b, alpha }: DisplayP3Color): XYZColor;
54
- export declare function xyz2displayP3({ x, y, z, alpha }: XYZColor): DisplayP3Color;
55
- export declare function adobeRgb2xyz({ r, g, b, alpha }: AdobeRGBColor): XYZColor;
56
- export declare function xyz2adobeRgb({ x, y, z, alpha }: XYZColor): AdobeRGBColor;
57
- export declare function proPhoto2xyz({ r, g, b, alpha }: ProPhotoRGBColor): XYZColor;
58
- export declare function xyz2proPhoto({ x, y, z, alpha }: XYZColor): ProPhotoRGBColor;
59
- export declare function rec20202xyz({ r, g, b, alpha }: Rec2020Color): XYZColor;
60
- export declare function xyz2rec2020({ x, y, z, alpha }: XYZColor): Rec2020Color;
61
- export declare function color2<T, C extends ColorSpace>(color: Color<T>, to: C): Color<T>;
62
- export { deltaEOK, isInSRGBGamut, DELTA_E_OK_JND } from './gamut';
63
- export declare function gamutMap<C extends Color>(color: C): C;
64
- export type HueInterpolationMethod = "shorter" | "longer" | "increasing" | "decreasing";
65
- export declare const CYLINDRICAL_HUE_COMPONENT: Partial<Record<ColorSpace, string>>;
66
- /**
67
- * Interpolate between two hue values using the given method.
68
- * Hues are in [0, 1] (normalized). Returns an interpolated hue in [0, 1].
69
- * Handles NaN (CSS `none`): if one hue is NaN, the other's value is used.
70
- */
71
- export declare function interpolateHue(h1: number, h2: number, t: number, method?: HueInterpolationMethod): number;
72
- /**
73
- * Mix two colors per CSS color-mix() specification.
74
- * Both colors should be normalized (components in [0, 1]).
75
- * Percentages p1, p2 are in [0, 1] (e.g. 0.5 = 50%).
76
- */
77
- export declare function mixColors(col1: Color, col2: Color, p1: number, p2: number, space?: ColorSpace, hueMethod?: HueInterpolationMethod): Color;