diff options
author | Vendicated <vendicated@riseup.net> | 2023-04-04 21:09:47 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2023-04-04 21:14:55 +0200 |
commit | f092f434fe48ba0db8b3c0c66524899b5a21c4f1 (patch) | |
tree | e6d571da1f9caa7198a0f8583358235354387998 /src/webpack/common/components.ts | |
parent | 2e6dfaa8795d093e50d87ebb5e7805cddb29a52c (diff) | |
download | Vencord-f092f434fe48ba0db8b3c0c66524899b5a21c4f1.tar.gz Vencord-f092f434fe48ba0db8b3c0c66524899b5a21c4f1.tar.bz2 Vencord-f092f434fe48ba0db8b3c0c66524899b5a21c4f1.zip |
Fix Vencord
Diffstat (limited to 'src/webpack/common/components.ts')
-rw-r--r-- | src/webpack/common/components.ts | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts index 4993b22..9554f95 100644 --- a/src/webpack/common/components.ts +++ b/src/webpack/common/components.ts @@ -17,40 +17,37 @@ */ // eslint-disable-next-line path-alias/no-relative -import { filters, findByPropsLazy } from "../webpack"; +import { filters, findByPropsLazy, waitFor } from "@webpack"; + import { waitForComponent } from "./internal"; import * as t from "./types/components"; -export const Forms = { - FormTitle: waitForComponent<t.FormTitle>("FormTitle", filters.byCode("errorSeparator")), - FormSection: waitForComponent<t.FormSection>("FormSection", filters.byCode("titleClassName", "sectionTitle")), - FormDivider: waitForComponent<t.FormDivider>("FormDivider", m => { - if (typeof m !== "function") return false; - const s = m.toString(); - return s.length < 200 && s.includes(".divider"); - }), - FormText: waitForComponent<t.FormText>("FormText", m => m.Types?.INPUT_PLACEHOLDER), +export let Forms = {} as { + FormTitle: t.FormTitle, + FormSection: t.FormSection, + FormDivider: t.FormDivider, + FormText: t.FormText, }; -export const Card = waitForComponent<t.Card>("Card", m => m.Types?.PRIMARY && m.defaultProps); -export const Button = waitForComponent<t.Button>("Button", ["Hovers", "Looks", "Sizes"]); -export const Switch = waitForComponent<t.Switch>("Switch", filters.byCode("tooltipNote", "ringTarget")); -export const Tooltip = waitForComponent<t.Tooltip>("Tooltip", filters.byCode("shouldShowTooltip:!1", "clickableOnMobile||")); +export let Card: t.Card; +export let Button: t.Button; +export let Switch: t.Switch; +export let Tooltip: t.Tooltip; +export let TextInput: t.TextInput; +export let TextArea: t.TextArea; +export let Text: t.Text; +export let Select: t.Select; +export let SearchableSelect: t.SearchableSelect; +export let Slider: t.Slider; +export let ButtonLooks: t.ButtonLooks; +export let TabBar: any; + export const Timestamp = waitForComponent<t.Timestamp>("Timestamp", filters.byCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format")); -export const TextInput = waitForComponent<t.TextInput>("TextInput", ["defaultProps", "Sizes", "contextType"]); -export const TextArea = waitForComponent<t.TextArea>("TextArea", filters.byCode("handleSetRef", "textArea")); -export const Text = waitForComponent<t.Text>("Text", m => { - if (typeof m !== "function") return false; - const s = m.toString(); - return (s.length < 1500 && s.includes("data-text-variant") && s.includes("always-white")); -}); -export const Select = waitForComponent<t.Select>("Select", filters.byCode("optionClassName", "popoutPosition", "autoFocus", "maxVisibleItems")); -const searchableSelectFilter = filters.byCode("autoFocus", ".Messages.SELECT"); -export const SearchableSelect = waitForComponent<t.SearchableSelect>("SearchableSelect", m => - m.render && searchableSelectFilter(m.render) -); -export const Slider = waitForComponent<t.Slider>("Slider", filters.byCode("closestMarkerIndex", "stickToMarkers")); export const Flex = waitForComponent<t.Flex>("Flex", ["Justify", "Align", "Wrap"]); export const ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent") as Record<string, string>; -export const ButtonLooks: t.ButtonLooks = findByPropsLazy("BLANK", "FILLED", "INVERTED"); + +waitFor("FormItem", m => { + ({ Card, Button, FormSwitch: Switch, Tooltip, TextInput, TextArea, Text, Select, SearchableSelect, Slider, ButtonLooks, TabBar } = m); + Forms = m; +}); |