Skip to content

Commit

Permalink
feat(types): update modules
Browse files Browse the repository at this point in the history
280244 -> 296435
  • Loading branch information
FedeIlLeone committed May 26, 2024
1 parent 49fc063 commit 47431f8
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 84 deletions.
23 changes: 6 additions & 17 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,30 @@
"dictionaryDefinitions": [],
"dictionaries": [],
"words": [
"alertdialog",
"APPDATA",
"asar",
"Automod",
"automod",
"autosize",
"backoff",
"blurple",
"Breacrumb",
"Chunkdiscord",
"codemirror",
"cooldown",
"coremod",
"coremods",
"crosspost",
"customitem",
"dataurl",
"dependants",
"devmode",
"discordapp",
"doas",
"dont",
"esbuild",
"flatpak",
"flatpaks",
"fontawesome",
"Fonticons",
"Frecency",
"getent",
"gifv",
"globstar",
"gpgsign",
"groupstart",
"HighlightJS",
"installdir",
"Jsonifiable",
Expand All @@ -50,30 +42,27 @@
"notrack",
"outfile",
"popout",
"postpublish",
"Promisable",
"quickcss",
"ratelimited",
"RATELIMITED",
"rauenzi",
"RDNN",
"Recents",
"recents",
"reinject",
"replug",
"replugged",
"resizeable",
"Scroller",
"shopt",
"scroller",
"signingkey",
"Skema",
"skus",
"uninject",
"uninjector",
"uninjectors",
"Vendicated",
"Webauthn",
"webauthn",
"weblate",
"Withs",
"XLARGE"
"Withs"
],
"ignoreWords": [],
"import": [],
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/modules/common/fluxDispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ interface Breadcrumb {
}

interface SentryUtils {
addBreacrumb: (breadcrumb: Breadcrumb) => void;
addBreadcrumb: (breadcrumb: Breadcrumb) => void;
}

export interface FluxDispatcher {
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/modules/common/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ interface CreateMessageOptions {
flags?: number;
nonce?: string;
poll?: Poll;
changelogId?: string;
}

interface UserServer {
Expand All @@ -488,7 +489,6 @@ interface UserServer {
interface MessageUtils {
createBotMessage: (options: CreateBotMessageOptions) => Message;
createMessage: (options: CreateMessageOptions) => Message;
createNonce: () => string;
userRecordToServer: (user: User) => UserServer;
}

Expand All @@ -498,7 +498,6 @@ const MessageUtilsMod = await waitForModule(filters.bySource('username:"Clyde"')
const MessageUtils = {
createBotMessage: getFunctionBySource(MessageUtilsMod, 'username:"Clyde"'),
createMessage: getFunctionBySource(MessageUtilsMod, "createMessage"),
createNonce: getFunctionBySource(MessageUtilsMod, "fromTimestamp"),
userRecordToServer: getFunctionBySource(MessageUtilsMod, "global_name:"),
} as MessageUtils;

Expand Down
52 changes: 9 additions & 43 deletions src/renderer/modules/components/ButtonItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ import { waitForProps } from "../webpack";

interface ButtonProps extends React.ComponentPropsWithoutRef<"button"> {
look?: string;
size?: string;
color?: string;
borderColor?: string;
hover?: string;
size?: string;
fullWidth?: boolean;
grow?: boolean;
submitting?: boolean;
submittingStartedLabel?: string;
submittingFinishedLabel?: string;
wrapperClassName?: string;
innerClassName?: string;
buttonRef?: React.Ref<HTMLButtonElement>;
focusProps?: Record<string, unknown>;
innerClassName?: string;
wrapperClassName?: string;
submittingStartedLabel?: string;
submittingFinishedLabel?: string;
}

interface Path {
Expand All @@ -37,61 +35,29 @@ interface LinkProps extends Omit<React.ComponentPropsWithoutRef<"a">, "href"> {

interface ButtonLinkProps extends LinkProps {
look?: string;
size?: string;
color?: string;
borderColor?: string;
hover?: string;
size?: string;
fullWidth?: boolean;
grow?: boolean;
innerClassName?: string;
}

export type ButtonType = React.FC<React.PropsWithChildren<ButtonProps>> & {
Link: React.FC<React.PropsWithChildren<ButtonLinkProps>>;
Looks: Record<"FILLED" | "INVERTED" | "OUTLINED" | "LINK" | "BLANK", string>;
Looks: Record<"FILLED" | "OUTLINED" | "LINK" | "BLANK", string>;
Colors: Record<
| "BRAND"
| "BRAND_INVERTED"
| "RED"
| "GREEN"
| "YELLOW"
| "PRIMARY"
| "LINK"
| "WHITE"
| "TRANSPARENT"
| "BRAND_NEW"
| "CUSTOM",
string
>;
BorderColors: Record<
| "BRAND"
| "RED"
| "GREEN"
| "YELLOW"
| "PRIMARY"
| "LINK"
| "WHITE"
| "BLACK"
| "TRANSPARENT"
| "BRAND_NEW",
string
>;
Hovers: Record<
| "DEFAULT"
| "BRAND"
| "RED"
| "GREEN"
| "YELLOW"
| "PRIMARY"
| "LINK"
| "WHITE"
| "BLACK"
| "TRANSPARENT",
string
>;
Sizes: Record<
"NONE" | "TINY" | "SMALL" | "MEDIUM" | "LARGE" | "XLARGE" | "MIN" | "MAX" | "ICON",
string
>;
Sizes: Record<"NONE" | "TINY" | "SMALL" | "MEDIUM" | "LARGE" | "MIN" | "MAX" | "ICON", string>;
};

export const { Button } = components;
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/modules/components/Clickable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import components from "../common/components";
// TODO: generic type for tags?
type ClickableProps = React.ComponentPropsWithoutRef<"div"> & {
tag?: keyof JSX.IntrinsicElements;
focusProps?: Record<string, unknown>;
innerRef?: React.Ref<HTMLDivElement>;
ignoreKeyPress?: boolean;
};

Expand Down
3 changes: 3 additions & 0 deletions src/renderer/modules/components/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ interface FormItemCompProps extends Omit<React.ComponentPropsWithoutRef<"div">,
children: React.ReactNode;
title?: React.ReactNode;
error?: React.ReactNode;
faded?: boolean;
disabled?: boolean;
required?: boolean;
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "label" | "legend";
titleId?: string;
errorId?: string;
titleClassName?: string;
}

Expand Down
4 changes: 1 addition & 3 deletions src/renderer/modules/components/FormText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ export type FormTextTypeKey =
| "SUCCESS"
| string;

interface FormTextProps {
interface FormTextProps extends React.ComponentPropsWithoutRef<"div"> {
type?: string;
disabled?: boolean;
selectable?: boolean;
style?: React.CSSProperties;
className?: string;
}

export type FormTextCompType = React.FC<React.PropsWithChildren<FormTextProps>>;
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/modules/components/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const Types = {

interface GenericLoaderProps {
animated?: boolean;
className?: string;
itemClassName?: string;
style?: React.CSSProperties;
}

type LoaderProps = GenericLoaderProps & {
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/modules/components/SwitchItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import type React from "react";
import components from "../common/components";

interface SwitchProps {
checked: boolean;
onChange: (value: boolean) => void;
checked?: boolean;
onChange?: (value: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
disabled?: boolean;
id?: string;
innerRef?: React.Ref<unknown>;
innerRef?: React.Ref<HTMLInputElement>;
focusProps?: Record<string, unknown>;
className?: string;
}

export type SwitchType = React.FC<React.PropsWithChildren<SwitchProps>>;
export type SwitchType = React.FC<SwitchProps>;

interface SwitchItemProps {
value: boolean;
onChange: (value: boolean) => void;
value?: boolean;
onChange?: (value: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
note?: string;
tooltipNote?: string;
disabled?: boolean;
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/modules/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export type Variant =
| "redesign/message-preview/medium"
| "redesign/message-preview/semibold"
| "redesign/message-preview/bold"
| "redesign/channel-title/normal"
| "redesign/channel-title/medium"
| "redesign/channel-title/semibold"
| "redesign/channel-title/bold"
| "display-sm"
| "display-md"
| "display-lg"
Expand All @@ -71,6 +75,7 @@ interface TextProps extends React.ComponentPropsWithoutRef<"div"> {
selectable?: boolean;
tabularNumbers?: boolean;
lineClamp?: number;
scaleFontToUserSetting?: boolean;
}

interface CustomTextProps extends TextProps {
Expand Down
15 changes: 9 additions & 6 deletions src/renderer/modules/components/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface TextAreaProps {
autosize?: boolean;
spellCheck?: boolean;
showCharacterCount?: boolean;
showCharacterCountFullPadding?: boolean;
showRemainingCharacterCount?: boolean;
minLength?: number;
maxLength?: number;
Expand All @@ -20,13 +21,15 @@ interface TextAreaProps {
error?: string;
value?: string;
id?: string;
inputRef?: React.Ref<HTMLInputElement>;
defaultDirty?: boolean;
inputRef?: React.Ref<HTMLTextAreaElement>;
className?: string;
onChange?: (value: string) => void;
onInvalid?: React.FormEventHandler<HTMLInputElement>;
onFocus?: React.FocusEventHandler<HTMLInputElement>;
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
onChange?: (value: string, name: string) => void;
onInvalid?: React.FormEventHandler<HTMLTextAreaElement>;
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>, name: string) => void;
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>, name: string) => void;
onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
"aria-labelledby"?: string;
}

export type TextAreaType = React.ComponentClass<TextAreaProps> & {
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/modules/components/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import type React from "react";
import components from "../common/components";

interface TextInputProps
extends Omit<React.ComponentPropsWithoutRef<"input">, "size" | "onChange"> {
extends Omit<
React.ComponentPropsWithoutRef<"input">,
"size" | "onChange" | "onFocus" | "onBlur"
> {
editable?: boolean;
inputPrefix?: string;
prefixElement?: React.ReactNode;
Expand All @@ -11,7 +14,10 @@ interface TextInputProps
inputRef?: React.Ref<HTMLInputElement>;
focusProps?: Record<string, unknown>;
inputClassName?: string;
onChange?: (value: string) => void;
defaultDirty?: boolean;
onChange?: (value: string, name: string) => void;
onFocus?: (event: React.FocusEvent<HTMLInputElement>, name: string) => void;
onBlur?: (event: React.FocusEvent<HTMLInputElement>, name: string) => void;
}

export type TextInputType = React.ComponentClass<TextInputProps> & {
Expand Down
12 changes: 11 additions & 1 deletion src/renderer/modules/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ interface TooltipEnums {
Aligns: typeof Aligns;
Positions: typeof Positions;
Colors: Record<
"PRIMARY" | "BLACK" | "GREY" | "BRAND" | "GREEN" | "YELLOW" | "RED" | "CUSTOM" | "PREMIUM",
| "PRIMARY"
| "NESTED"
| "BLACK"
| "GREY"
| "BRAND"
| "GREEN"
| "YELLOW"
| "RED"
| "CUSTOM"
| "PREMIUM",
string
>;
}
Expand All @@ -45,6 +54,7 @@ interface BaseTooltipProps {
tooltipClassName?: string;
tooltipContentClassName?: string;
style?: React.CSSProperties;
tooltipStyle?: React.CSSProperties;
onTooltipShow?: () => void;
onAnimationRest?: (result: unknown, spring: unknown, item?: unknown) => void;
}
Expand Down
Loading

0 comments on commit 47431f8

Please sign in to comment.