From e8d90d2b45e8be0595f75454429fc1a5cedb4e33 Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 16 Jun 2023 19:35:50 +0200 Subject: feat(plugin): BiggerStreamPreview (#1222) Co-authored-by: V --- src/webpack/common/classes.ts | 24 +++++++++++++++++++ src/webpack/common/components.ts | 5 ++-- src/webpack/common/index.ts | 2 +- src/webpack/common/types/classes.d.ts | 40 ++++++++++++++++++++++++++++++++ src/webpack/common/types/components.d.ts | 7 ++++++ src/webpack/common/types/menu.d.ts | 1 + 6 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 src/webpack/common/classes.ts create mode 100644 src/webpack/common/types/classes.d.ts (limited to 'src/webpack/common') diff --git a/src/webpack/common/classes.ts b/src/webpack/common/classes.ts new file mode 100644 index 0000000..5c1a676 --- /dev/null +++ b/src/webpack/common/classes.ts @@ -0,0 +1,24 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2023 Vendicated and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +import { findByPropsLazy } from "@webpack"; + +import * as t from "./types/classes"; + +export const ModalImageClasses: t.ImageModalClasses = findByPropsLazy("image", "modal"); +export const ButtonWrapperClasses: t.ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent"); diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index f308cff..55d3b84 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -17,7 +17,7 @@ */ // eslint-disable-next-line path-alias/no-relative -import { filters, findByPropsLazy, waitFor } from "@webpack"; +import { filters, waitFor } from "@webpack"; import { waitForComponent } from "./internal"; import * as t from "./types/components"; @@ -51,11 +51,10 @@ export let Avatar: t.Avatar; /** css colour resolver stuff, no clue what exactly this does, just copied usage from Discord */ export let useToken: t.useToken; +export const MaskedLink = waitForComponent("MaskedLink", m => m?.type?.toString().includes("MASKED_LINK)")); export const Timestamp = waitForComponent("Timestamp", filters.byCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format")); export const Flex = waitForComponent("Flex", ["Justify", "Align", "Wrap"]); -export const ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent") as Record; - waitFor("FormItem", m => { ({ useToken, Card, Button, FormSwitch: Switch, Tooltip, TextInput, TextArea, Text, Select, SearchableSelect, Slider, ButtonLooks, TabBar, Popout, Dialog, Paginator, ScrollerThin, Clickable, Avatar } = m); Forms = m; diff --git a/src/webpack/common/index.ts b/src/webpack/common/index.ts index dff7826..2ad9c54 100644 --- a/src/webpack/common/index.ts +++ b/src/webpack/common/index.ts @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +export * from "./classes"; export * from "./components"; export * from "./menu"; export * from "./react"; @@ -24,4 +25,3 @@ export * as ComponentTypes from "./types/components.d"; export * as MenuTypes from "./types/menu.d"; export * as UtilTypes from "./types/utils.d"; export * from "./utils"; - diff --git a/src/webpack/common/types/classes.d.ts b/src/webpack/common/types/classes.d.ts new file mode 100644 index 0000000..0d2946f --- /dev/null +++ b/src/webpack/common/types/classes.d.ts @@ -0,0 +1,40 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2023 Vendicated and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +export interface ImageModalClasses { + image: string, + modal: string, + responsiveWidthMobile: string; +} + +export interface ButtonWrapperClasses { + hoverScale: string; + buttonWrapper: string; + button: string; + iconMask: string; + buttonContent: string; + icon: string; + pulseIcon: string; + pulseButton: string; + notificationDot: string; + sparkleContainer: string; + sparkleStar: string; + sparklePlus: string; + sparkle: string; + active: string; +} diff --git a/src/webpack/common/types/components.d.ts b/src/webpack/common/types/components.d.ts index 7bc313c..d6d19fe 100644 --- a/src/webpack/common/types/components.d.ts +++ b/src/webpack/common/types/components.d.ts @@ -398,6 +398,13 @@ export type Paginator = ComponentType<{ hideMaxPage?: boolean; }>; +export type MaskedLink = ComponentType<{ + onClick(): void; + trusted: boolean; + title: string, + href: string; +}>; + export type ScrollerThin = ComponentType; MenuCheckboxItem: RC<{ id: string; -- cgit