2023-01-25 03:25:29 +01:00
|
|
|
/*
|
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-01-29 01:04:36 -03:00
|
|
|
import { LazyComponent } from "@utils/lazyReact";
|
2025-07-10 00:38:39 +02:00
|
|
|
import * as t from "@vencord/discord-types";
|
2025-01-29 01:04:36 -03:00
|
|
|
import { filters, mapMangledModuleLazy, waitFor } from "@webpack";
|
2023-04-04 21:09:47 +02:00
|
|
|
|
2025-08-14 15:42:58 -04:00
|
|
|
import { FormText } from "./FormText";
|
2023-01-25 03:25:29 +01:00
|
|
|
import { waitForComponent } from "./internal";
|
|
|
|
|
|
2025-01-29 01:04:36 -03:00
|
|
|
|
|
|
|
|
const FormTitle = waitForComponent<t.FormTitle>("FormTitle", filters.componentByCode('["defaultMargin".concat', '="h5"'));
|
2025-04-04 00:12:17 -04:00
|
|
|
const FormSection = waitForComponent<t.FormSection>("FormSection", filters.componentByCode(".titleId)"));
|
2025-01-29 01:04:36 -03:00
|
|
|
const FormDivider = waitForComponent<t.FormDivider>("FormDivider", filters.componentByCode(".divider,", ",style:", '"div"', /\.divider,\i\),style:/));
|
|
|
|
|
|
|
|
|
|
export const Forms = {
|
|
|
|
|
FormTitle,
|
|
|
|
|
FormText,
|
|
|
|
|
FormSection,
|
|
|
|
|
FormDivider
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Card = waitForComponent<t.Card>("Card", filters.componentByCode(".editable),", ".outline:"));
|
|
|
|
|
export const Button = waitForComponent<t.Button>("Button", filters.componentByCode("#{intl::A11Y_LOADING_STARTED}))),!1"));
|
|
|
|
|
export const Switch = waitForComponent<t.Switch>("Switch", filters.componentByCode(".labelRow,ref:", ".disabledText"));
|
2025-02-27 19:32:09 -05:00
|
|
|
export const Checkbox = waitForComponent<t.Checkbox>("Checkbox", filters.componentByCode(".checkboxWrapperDisabled:"));
|
2025-01-29 01:04:36 -03:00
|
|
|
|
|
|
|
|
const Tooltips = mapMangledModuleLazy(".tooltipTop,bottom:", {
|
|
|
|
|
Tooltip: filters.componentByCode("this.renderTooltip()]"),
|
2025-02-20 23:18:57 -05:00
|
|
|
TooltipContainer: filters.componentByCode('="div"')
|
2025-01-29 01:04:36 -03:00
|
|
|
}) as {
|
|
|
|
|
Tooltip: t.Tooltip,
|
|
|
|
|
TooltipContainer: t.TooltipContainer;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Tooltip = LazyComponent(() => Tooltips.Tooltip);
|
|
|
|
|
export const TooltipContainer = LazyComponent(() => Tooltips.TooltipContainer);
|
|
|
|
|
|
2025-07-22 22:43:31 +02:00
|
|
|
export const TextInput = waitForComponent<t.TextInput>("TextInput", filters.componentByCode("#{intl::MAXIMUM_LENGTH_ERROR}", '"input"'));
|
2025-01-29 01:04:36 -03:00
|
|
|
export const TextArea = waitForComponent<t.TextArea>("TextArea", filters.componentByCode("this.getPaddingRight()},id:"));
|
|
|
|
|
export const Text = waitForComponent<t.Text>("Text", filters.componentByCode('case"always-white"'));
|
|
|
|
|
export const Heading = waitForComponent<t.Heading>("Heading", filters.componentByCode(">6?{", "variant:"));
|
|
|
|
|
export const Select = waitForComponent<t.Select>("Select", filters.componentByCode('.selectPositionTop]:"top"===', '"Escape"==='));
|
|
|
|
|
export const SearchableSelect = waitForComponent<t.SearchableSelect>("SearchableSelect", filters.componentByCode('.selectPositionTop]:"top"===', ".multi]:"));
|
|
|
|
|
export const Slider = waitForComponent<t.Slider>("Slider", filters.componentByCode('"markDash".concat('));
|
2025-02-03 22:20:57 -03:00
|
|
|
export const Popout = waitForComponent<t.Popout>("Popout", filters.componentByCode("ref:this.ref,", "renderPopout:this.renderPopout,"));
|
2025-01-29 01:04:36 -03:00
|
|
|
export const Dialog = waitForComponent<t.Dialog>("Dialog", filters.componentByCode('role:"dialog",tabIndex:-1'));
|
|
|
|
|
export const TabBar = waitForComponent("TabBar", filters.componentByCode("ref:this.tabBarRef,className:"));
|
|
|
|
|
export const Paginator = waitForComponent<t.Paginator>("Paginator", filters.componentByCode('rel:"prev",children:'));
|
|
|
|
|
export const Clickable = waitForComponent<t.Clickable>("Clickable", filters.componentByCode("this.context?this.renderNonInteractive():"));
|
|
|
|
|
export const Avatar = waitForComponent<t.Avatar>("Avatar", filters.componentByCode(".size-1.375*"));
|
|
|
|
|
|
2025-06-24 21:25:36 -04:00
|
|
|
export const ColorPicker = waitForComponent<t.ColorPicker>("ColorPicker", filters.componentByCode("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", "showEyeDropper"));
|
|
|
|
|
|
2025-07-15 15:57:24 +02:00
|
|
|
export const UserSummaryItem = waitForComponent("UserSummaryItem", filters.componentByCode("defaultRenderUser", "showDefaultAvatarsForNullUsers"));
|
2025-06-24 21:25:36 -04:00
|
|
|
|
2025-01-29 01:04:36 -03:00
|
|
|
export let createScroller: (scrollbarClassName: string, fadeClassName: string, customThemeClassName: string) => t.ScrollerThin;
|
2025-08-05 19:20:28 +02:00
|
|
|
export let createListScroller: (scrollBarClassName: string, fadeClassName: string, someOtherClassIdkMan: string, resizeObserverClass: typeof ResizeObserver) => t.ListScrollerThin;
|
2025-01-29 01:04:36 -03:00
|
|
|
export let scrollerClasses: Record<string, string>;
|
2025-08-05 19:20:28 +02:00
|
|
|
export let listScrollerClasses: Record<string, string>;
|
|
|
|
|
|
2025-01-29 01:04:36 -03:00
|
|
|
waitFor(filters.byCode('="ltr",orientation:', "customTheme:", "forwardRef"), m => createScroller = m);
|
2025-08-05 19:20:28 +02:00
|
|
|
waitFor(filters.byCode("getScrollerNode:", "resizeObserver:", "sectionHeight:"), m => createListScroller = m);
|
2025-01-29 01:04:36 -03:00
|
|
|
waitFor(["thin", "auto", "customTheme"], m => scrollerClasses = m);
|
2025-08-05 19:20:28 +02:00
|
|
|
waitFor(m => m.thin && m.auto && !m.customTheme, m => listScrollerClasses = m);
|
2025-01-29 01:04:36 -03:00
|
|
|
|
|
|
|
|
export const ScrollerNone = LazyComponent(() => createScroller(scrollerClasses.none, scrollerClasses.fade, scrollerClasses.customTheme));
|
|
|
|
|
export const ScrollerThin = LazyComponent(() => createScroller(scrollerClasses.thin, scrollerClasses.fade, scrollerClasses.customTheme));
|
|
|
|
|
export const ScrollerAuto = LazyComponent(() => createScroller(scrollerClasses.auto, scrollerClasses.fade, scrollerClasses.customTheme));
|
|
|
|
|
|
2025-08-05 19:20:28 +02:00
|
|
|
export const ListScrollerNone = LazyComponent(() => createListScroller(listScrollerClasses.none, listScrollerClasses.fade, "", ResizeObserver));
|
|
|
|
|
export const ListScrollerThin = LazyComponent(() => createListScroller(listScrollerClasses.thin, listScrollerClasses.fade, "", ResizeObserver));
|
|
|
|
|
export const ListScrollerAuto = LazyComponent(() => createListScroller(listScrollerClasses.auto, listScrollerClasses.fade, "", ResizeObserver));
|
|
|
|
|
|
2025-04-04 00:12:17 -04:00
|
|
|
const { FocusLock_ } = mapMangledModuleLazy('document.getElementById("app-mount"))', {
|
2025-01-29 01:04:36 -03:00
|
|
|
FocusLock_: filters.componentByCode(".containerRef")
|
|
|
|
|
}) as {
|
|
|
|
|
FocusLock_: t.FocusLock;
|
2023-01-25 03:25:29 +01:00
|
|
|
};
|
|
|
|
|
|
2025-01-29 01:04:36 -03:00
|
|
|
export const FocusLock = LazyComponent(() => FocusLock_);
|
|
|
|
|
|
2023-05-10 23:13:47 +02:00
|
|
|
export let useToken: t.useToken;
|
2025-01-29 01:04:36 -03:00
|
|
|
waitFor(m => {
|
|
|
|
|
if (typeof m !== "function") {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const str = String(m);
|
|
|
|
|
return str.includes(".resolve({theme:null") && !str.includes("useMemo");
|
|
|
|
|
}, m => useToken = m);
|
2023-04-04 21:09:47 +02:00
|
|
|
|
2024-03-08 00:23:35 -03:00
|
|
|
export const MaskedLink = waitForComponent<t.MaskedLink>("MaskedLink", filters.componentByCode("MASKED_LINK)"));
|
2025-01-29 01:04:36 -03:00
|
|
|
export const Timestamp = waitForComponent<t.Timestamp>("Timestamp", filters.componentByCode("#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}"));
|
2023-01-25 03:25:29 +01:00
|
|
|
export const Flex = waitForComponent<t.Flex>("Flex", ["Justify", "Align", "Wrap"]);
|
2025-03-04 16:17:33 -05:00
|
|
|
export const OAuth2AuthorizeModal = waitForComponent("OAuth2AuthorizeModal", filters.componentByCode(".authorize,children:", ".contentBackground"));
|
2025-01-29 11:52:49 -03:00
|
|
|
|
|
|
|
|
export const Animations = mapMangledModuleLazy(".assign({colorNames:", {
|
|
|
|
|
Transition: filters.componentByCode('["items","children"]', ",null,"),
|
|
|
|
|
animated: filters.byProps("div", "text")
|
|
|
|
|
});
|