chore: add js-doc (#275)

This commit is contained in:
doprz
2024-10-07 23:06:35 -05:00
committed by GitHub
parent 668c8d0075
commit b3632c0196
7 changed files with 22 additions and 5 deletions

View File

@@ -1,3 +1,6 @@
/**
* Represents a tab with an additional `id` property
*/
export type TabWithId = Omit<chrome.tabs.Tab, 'id'> & { id: number }; export type TabWithId = Omit<chrome.tabs.Tab, 'id'> & { id: number };
/** /**

View File

@@ -12,6 +12,9 @@ const MIMEType = {
ANY: '*/*', ANY: '*/*',
} as const satisfies Record<string, string>; } as const satisfies Record<string, string>;
/**
* Represents a key of the MIMEType object
*/
export type MIMETypeKey = keyof typeof MIMEType; export type MIMETypeKey = keyof typeof MIMEType;
export default MIMEType; export default MIMEType;

View File

@@ -52,11 +52,15 @@ type NestedKeys<T> = {
export type ThemeColor = NestedKeys<typeof colors>; 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 = { export type TWColorway = {
[K in keyof typeof theme.colors]: (typeof theme.colors)[K] extends Record<string, unknown> ? K : never; [K in keyof typeof theme.colors]: (typeof theme.colors)[K] extends Record<string, unknown> ? K : never;
}[keyof typeof theme.colors]; }[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]; export type TWIndex = keyof (typeof theme.colors)[TWColorway];
/** /**

View File

@@ -207,9 +207,9 @@ export function getUnusedColor(
} }
// OKLab helper functions (https://github.com/bottosson/bottosson.github.io/blob/master/misc/colorpicker/colorconversion.js) // OKLab helper functions (https://github.com/bottosson/bottosson.github.io/blob/master/misc/colorpicker/colorconversion.js)
function srgbTransferFunction(a: number): number { // function srgbTransferFunction(a: number): number {
return a <= 0.0031308 ? 12.92 * a : 1.055 * a ** 0.4166666666666667 - 0.055; // return a <= 0.0031308 ? 12.92 * a : 1.055 * a ** 0.4166666666666667 - 0.055;
} // }
function srgbTransferFunctionInv(a: number): number { function srgbTransferFunctionInv(a: number): number {
return a > 0.04045 ? ((a + 0.055) / 1.055) ** 2.4 : a / 12.92; return a > 0.04045 ? ((a + 0.055) / 1.055) ** 2.4 : a / 12.92;

View File

@@ -2,7 +2,7 @@ import Text from '@views/components/common/Text/Text';
import React from 'react'; import React from 'react';
/** /**
* A type that represents the flags that a course can have. * A type that represents the flags that a course can have
*/ */
export type Flag = 'WR' | 'QR' | 'GC' | 'CD' | 'E' | 'II'; export type Flag = 'WR' | 'QR' | 'GC' | 'CD' | 'E' | 'II';
export const flagMap = { export const flagMap = {

View File

@@ -13,6 +13,9 @@ import React, { Fragment } from 'react';
import ExtensionRoot from './ExtensionRoot/ExtensionRoot'; import ExtensionRoot from './ExtensionRoot/ExtensionRoot';
/**
* Represents the props for the _Dialog component
*/
export interface _DialogProps { export interface _DialogProps {
className?: string; className?: string;
title?: JSX.Element; title?: JSX.Element;

View File

@@ -7,6 +7,10 @@ import Dialog from '../Dialog';
import Text from '../Text/Text'; import Text from '../Text/Text';
type DialogElement = (show: boolean) => ReactNode; type DialogElement = (show: boolean) => ReactNode;
/**
* Represents information for a prompt dialog
*/
export interface PromptInfo extends Omit<DialogInfo, 'buttons' | 'className' | 'title' | 'description'> { export interface PromptInfo extends Omit<DialogInfo, 'buttons' | 'className' | 'title' | 'description'> {
title: JSX.Element | string; title: JSX.Element | string;
description: JSX.Element | string; description: JSX.Element | string;