Skip to content

Commit

Permalink
chore: add js-doc (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
doprz authored Oct 8, 2024
1 parent 668c8d0 commit b3632c0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/pages/background/util/openNewTab.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Represents a tab with an additional `id` property
*/
export type TabWithId = Omit<chrome.tabs.Tab, 'id'> & { id: number };

/**
Expand Down
3 changes: 3 additions & 0 deletions src/shared/types/MIMEType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
6 changes: 5 additions & 1 deletion src/shared/types/ThemeColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];

/**
Expand Down
6 changes: 3 additions & 3 deletions src/shared/util/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/views/components/common/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Text from '@views/components/common/Text/Text';
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 const flagMap = {
Expand Down
3 changes: 3 additions & 0 deletions src/views/components/common/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import React, { Fragment } from 'react';

import ExtensionRoot from './ExtensionRoot/ExtensionRoot';

/**
* Represents the props for the _Dialog component
*/
export interface _DialogProps {
className?: string;
title?: JSX.Element;
Expand Down
4 changes: 4 additions & 0 deletions src/views/components/common/DialogProvider/DialogProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import Dialog from '../Dialog';
import Text from '../Text/Text';

type DialogElement = (show: boolean) => ReactNode;

/**
* Represents information for a prompt dialog
*/
export interface PromptInfo extends Omit<DialogInfo, 'buttons' | 'className' | 'title' | 'description'> {
title: JSX.Element | string;
description: JSX.Element | string;
Expand Down

0 comments on commit b3632c0

Please sign in to comment.