Skip to content

Commit cec6ec4

Browse files
docs: more documentation cleanup (#10)
1 parent 788f84a commit cec6ec4

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
## 0.2.0 (Unreleased)
44
### Features
55
- Adds `CssColor` type, which represents a generic color space and the CSS `color()` function (CSS Colors Module Level 4). This polyfills the official `CSSColor` type.
6-
- Adds `matchesType()` function, for dynamically checking the type of a `CSSNumericValue`.
6+
- Exports the `matchesType()` function (formerly internal), for dynamically checking the type of a `CSSNumericValue`.
77

88
### Fixes
99
- Fixes a typo in a function name, where `matchesPercent()` is renamed to `matchesPercentage()` (matching the CSS type, `<percentage>`).
1010

1111
### Documentation
1212
- Adds usage examples for `CssRgb`, `CssHsl`, and `CssHwb`.
13+
- `CssLab`, `CssLch`: Fixes text-rendering in the summary.
14+
- `CssColor`: Adds MDN link to the CSS `color()` function for `CssColor`.
15+
- `CssColor`: Clarifies valid color space types for `CssColor`.
1316
- Cleans up documentation for type-matching functions.
1417
- (Internal) Clarifies the conditions that a reifying/rectifying function (under `./reify`) throws a `SyntaxError`.
1518

src/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/**
2-
* Canonically represents a value that is either `<number>`, `<percentage>`, or the keyword `none`
2+
* Canonically represents a value that is either `<number>`, `<percentage>`, or the keyword `none`.
33
* @see {@link https://drafts.css-houdini.org/css-typed-om/#typedefdef-csscolorrgbcomp}
44
*/
55
export type CSSColorRGBComp = CSSNumberish | CSSKeywordish
66

77
/**
8-
* Canonically represents a value that is either `<percentage>`, or the keyword `none`
8+
* Canonically represents a value that is either `<percentage>`, or the keyword `none`.
99
* @see {@link https://drafts.css-houdini.org/css-typed-om/#typedefdef-csscolorpercent}
1010
*/
1111
export type CSSColorPercent = CSSNumberish | CSSKeywordish
1212

1313
/**
14-
* Canonically represents a value that is either `<number>`, or the keyword `none`
14+
* Canonically represents a value that is either `<number>`, or the keyword `none`.
1515
* @see {@link https://drafts.css-houdini.org/css-typed-om/#typedefdef-csscolornumber}
1616
*/
1717
export type CSSColorNumber = CSSNumberish | CSSKeywordish
1818

1919
/**
20-
* Canonically represents a value that is either `<angle>`, or the keyword `none`
20+
* Canonically represents a value that is either `<angle>`, or the keyword `none`.
2121
* @see {@link https://drafts.css-houdini.org/css-typed-om/#typedefdef-csscolorangle}
2222
*/
2323
export type CSSColorAngle = CSSNumberish | CSSKeywordish

src/values/color.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import type { CSSColorPercent } from '../mod.ts'
33
import { rectifyColorPercent, rectifyKeywordish } from '../reify.ts'
44

55
/**
6-
* A generic color space, representing the CSS `color()` function.
6+
* A generic color space, which represents the CSS `color()` function
7+
* (introduced in CSS Colors Module Level 4).
78
*
89
* @see {@link https://drafts.css-houdini.org/css-typed-om/#csscolor}
10+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color}
911
*/
1012
export class CSSColor extends CssColorValue {
1113
private _colorSpace: CSSKeywordish
@@ -24,7 +26,19 @@ export class CSSColor extends CssColorValue {
2426
this._alpha = rectifyColorPercent(alpha) as CSSNumberish
2527
}
2628

27-
/** The color space */
29+
/**
30+
* The color space, which must be one of
31+
* the following predefined color space strings:
32+
* - `'srgb'` (Standard RGB)
33+
* - `'srgb-linear'` (Linear Standard RGB)
34+
* - `'display-p3'` (Display P3)
35+
* - `'a98-rgb'` (Adobe® 98 RGB)
36+
* - `'prophoto-rgb'` (PropPhoto RGB)
37+
* - `'rec2020'` (Rec. 2020, or BT.2020)
38+
* - `'xyz'` (CIE XYZ)
39+
* - `'xyz-d50'` (CIE XYZ with standard illuminant D50 white)
40+
* - `'xyz-d65'` (CIE XYZ with standard illuminant D65 white)
41+
*/
2842
public get colorSpace(): CSSKeywordish {
2943
return this._colorSpace
3044
}

src/values/lab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { rectifyColorNumber, rectifyColorPercent } from '../reify.ts'
33
import type { CSSColorNumber, CSSColorPercent } from '../types.ts'
44

55
/**
6-
* The CIE L*a*b* (CIELAB) color space, which represents the CSS `lab()` function.
6+
* The CIE L\*a\*b\* (CIELAB) color space, which represents the CSS `lab()` function.
77
*
88
* @see {@link https://www.w3.org/TR/css-typed-om-1/#csslab}
99
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab}

src/values/lch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { rectifyColorAngle, rectifyColorPercent } from '../reify.ts'
33
import type { CSSColorAngle, CSSColorPercent } from '../types.ts'
44

55
/**
6-
* The CIE L*C*h° (CIELCh) color space (a polar version of CIE L*a*b*),
6+
* The CIE L\*C\*h° (CIELCh) color space (a polar version of CIE L*a*b*),
77
* which represents the CSS `lch()` function.
88
*
99
* @see {@link https://www.w3.org/TR/css-typed-om-1/#csslch}

0 commit comments

Comments
 (0)