chore: add js-doc (#275)
This commit is contained in:
@@ -12,6 +12,9 @@ const MIMEType = {
|
||||
ANY: '*/*',
|
||||
} as const satisfies Record<string, string>;
|
||||
|
||||
/**
|
||||
* Represents a key of the MIMEType object
|
||||
*/
|
||||
export type MIMETypeKey = keyof typeof MIMEType;
|
||||
|
||||
export default MIMEType;
|
||||
|
||||
@@ -52,11 +52,15 @@ type NestedKeys<T> = {
|
||||
export type ThemeColor = NestedKeys<typeof colors>;
|
||||
|
||||
/**
|
||||
* Represents a Tailwind colorway: a colorway is a key in the theme.colors object that has an object as its value.
|
||||
* Represents a Tailwind colorway: a colorway is a key in the theme.colors object that has an object as its value
|
||||
*/
|
||||
export type TWColorway = {
|
||||
[K in keyof typeof theme.colors]: (typeof theme.colors)[K] extends Record<string, unknown> ? K : never;
|
||||
}[keyof typeof theme.colors];
|
||||
|
||||
/**
|
||||
* Represents the index type for accessing the theme colors based on the specified TWColorway
|
||||
*/
|
||||
export type TWIndex = keyof (typeof theme.colors)[TWColorway];
|
||||
|
||||
/**
|
||||
|
||||
@@ -207,9 +207,9 @@ export function getUnusedColor(
|
||||
}
|
||||
|
||||
// OKLab helper functions (https://github.com/bottosson/bottosson.github.io/blob/master/misc/colorpicker/colorconversion.js)
|
||||
function srgbTransferFunction(a: number): number {
|
||||
return a <= 0.0031308 ? 12.92 * a : 1.055 * a ** 0.4166666666666667 - 0.055;
|
||||
}
|
||||
// function srgbTransferFunction(a: number): number {
|
||||
// return a <= 0.0031308 ? 12.92 * a : 1.055 * a ** 0.4166666666666667 - 0.055;
|
||||
// }
|
||||
|
||||
function srgbTransferFunctionInv(a: number): number {
|
||||
return a > 0.04045 ? ((a + 0.055) / 1.055) ** 2.4 : a / 12.92;
|
||||
|
||||
Reference in New Issue
Block a user