diff --git a/src/components/ThemeSettings/components/SettingColorComponent.tsx b/src/components/ThemeSettings/components/SettingColorComponent.tsx index a23be1e7..5ebf86e5 100644 --- a/src/components/ThemeSettings/components/SettingColorComponent.tsx +++ b/src/components/ThemeSettings/components/SettingColorComponent.tsx @@ -7,15 +7,8 @@ import "./colorStyles.css"; import { classNameFactory } from "@api/Styles"; -import { findByCodeLazy, findComponentByCodeLazy } from "@webpack"; -import { Forms, useMemo } from "@webpack/common"; - -interface ColorPickerProps { - color: number | null; - showEyeDropper?: boolean; - onChange(value: number | null): void; -} -const ColorPicker = findComponentByCodeLazy(".BACKGROUND_ACCENT.css"); +import { findByCodeLazy } from "@webpack"; +import { ColorPicker, Forms, useMemo } from "@webpack/common"; // TinyColor is completely unmangled and it's duplicated in two modules! Fun! const TinyColor: tinycolor.Constructor = findByCodeLazy("this._gradientType="); diff --git a/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx b/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx index 8ee35fc3..531546c0 100644 --- a/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx +++ b/src/equicordplugins/channelTabs/components/ChannelTabsContainer.tsx @@ -130,4 +130,4 @@ export function ChannelTabsPreview(p) { ); -} \ No newline at end of file +} diff --git a/src/equicordplugins/channelTabs/util/constants.tsx b/src/equicordplugins/channelTabs/util/constants.tsx index 7d72f16c..2bb0db76 100644 --- a/src/equicordplugins/channelTabs/util/constants.tsx +++ b/src/equicordplugins/channelTabs/util/constants.tsx @@ -99,4 +99,4 @@ export const settings = definePluginSettings({ } }); -export const CircleQuestionIcon = findComponentByCodeLazy("10.58l-3.3-3.3a1"); \ No newline at end of file +export const CircleQuestionIcon = findComponentByCodeLazy("10.58l-3.3-3.3a1"); diff --git a/src/equicordplugins/channelTabs/util/tabs.tsx b/src/equicordplugins/channelTabs/util/tabs.tsx index 74773495..fe8dcd32 100644 --- a/src/equicordplugins/channelTabs/util/tabs.tsx +++ b/src/equicordplugins/channelTabs/util/tabs.tsx @@ -306,4 +306,4 @@ export function useGhostTabs() { setCount(0); }; return new Array(count).fill(
); -} \ No newline at end of file +} diff --git a/src/equicordplugins/copyStickerLinks/index.tsx b/src/equicordplugins/copyStickerLinks/index.tsx index d4d95841..ac4a43d4 100644 --- a/src/equicordplugins/copyStickerLinks/index.tsx +++ b/src/equicordplugins/copyStickerLinks/index.tsx @@ -8,12 +8,9 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co import { Devs } from "@utils/constants"; import { copyWithToast } from "@utils/misc"; import definePlugin from "@utils/types"; -import { findStoreLazy } from "@webpack"; -import { Menu, React } from "@webpack/common"; +import { Menu, React, StickerStore } from "@webpack/common"; import { Promisable } from "type-fest"; -const StickersStore = findStoreLazy("StickersStore"); - interface Sticker { t: "Sticker"; format_type: number; @@ -117,7 +114,7 @@ const expressionPickerPatch: NavContextMenuPatchCallback = (children, props: { t if (!id) return; if (!props.target.className?.includes("lottieCanvas")) { - const stickerCache = StickersStore.getStickerById(id); + const stickerCache = StickerStore.getStickerById(id); if (stickerCache) { children.push(buildMenuExpression("Sticker", () => stickerCache)); } diff --git a/src/equicordplugins/customUserColors/SetColorModal.tsx b/src/equicordplugins/customUserColors/SetColorModal.tsx index dcbeef06..ba979da6 100644 --- a/src/equicordplugins/customUserColors/SetColorModal.tsx +++ b/src/equicordplugins/customUserColors/SetColorModal.tsx @@ -8,19 +8,10 @@ import { set } from "@api/DataStore"; import { classNameFactory } from "@api/Styles"; import { Margins } from "@utils/margins"; import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot } from "@utils/modal"; -import { findComponentByCodeLazy } from "@webpack"; -import { Button, Forms, useState } from "@webpack/common"; +import { Button, ColorPicker, Forms, useState } from "@webpack/common"; import { colors, DATASTORE_KEY } from "./index"; -interface ColorPickerProps { - color: number; - showEyeDropper?: boolean; - suggestedColors?: string[]; - onChange(value: number | null): void; -} -const ColorPicker = findComponentByCodeLazy(".BACKGROUND_ACCENT.css"); - const cl = classNameFactory("vc-customColors-"); export function SetColorModal({ userId, modalProps }: { userId: string, modalProps: ModalProps; }) { diff --git a/src/equicordplugins/glide/index.tsx b/src/equicordplugins/glide/index.tsx index 7e6a6976..919b74e6 100644 --- a/src/equicordplugins/glide/index.tsx +++ b/src/equicordplugins/glide/index.tsx @@ -8,8 +8,7 @@ import { definePluginSettings, Settings } from "@api/Settings"; import { copyToClipboard } from "@utils/clipboard"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType, StartAt } from "@utils/types"; -import { findComponentByCodeLazy } from "@webpack"; -import { Button, Forms, TextInput, Toasts, useState } from "@webpack/common"; +import { Button, ColorPicker, Forms, TextInput, Toasts, useState } from "@webpack/common"; import { darkenColorHex, generateRandomColorHex, saturateColorHex } from "./generateTheme"; import { themes } from "./themeDefinitions"; @@ -86,8 +85,6 @@ function CopyPresetComponent() { ); } -const ColorPicker = findComponentByCodeLazy(".BACKGROUND_ACCENT.css"); - export function generateAndApplyProceduralTheme() { const randomBackgroundColor = generateRandomColorHex(); @@ -214,7 +211,7 @@ export function ColorPick({ propertyname }: { propertyname: string; }) { { - const hexColor = color.toString(16).padStart(6, "0"); + const hexColor = (color ?? 0).toString(16).padStart(6, "0"); settings.store[propertyname] = hexColor; injectCSS(); } diff --git a/src/equicordplugins/guildPickerDumper/index.tsx b/src/equicordplugins/guildPickerDumper/index.tsx index 754ba808..1499201b 100644 --- a/src/equicordplugins/guildPickerDumper/index.tsx +++ b/src/equicordplugins/guildPickerDumper/index.tsx @@ -8,7 +8,7 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co import { migratePluginSettings } from "@api/Settings"; import { Devs, EquicordDevs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { EmojiStore, Menu, StickersStore } from "@webpack/common"; +import { EmojiStore, Menu, StickerStore } from "@webpack/common"; import type { Guild } from "discord-types/general"; import { zipSync } from "fflate"; @@ -30,7 +30,7 @@ async function zipGuildAssets(guild: Guild, type: "emojis" | "stickers") { const isEmojis = type === "emojis"; const items = isEmojis ? EmojiStore.getGuilds()[guild.id]?.emojis - : StickersStore.getStickersByGuildId(guild.id); + : StickerStore.getStickersByGuildId(guild.id); if (!items) { return console.log("Server not found!"); diff --git a/src/equicordplugins/imagePreview/index.ts b/src/equicordplugins/imagePreview/index.ts index 2d177f28..a3c8f6a4 100644 --- a/src/equicordplugins/imagePreview/index.ts +++ b/src/equicordplugins/imagePreview/index.ts @@ -9,7 +9,7 @@ import "./styles.css"; import { EquicordDevs } from "@utils/constants"; import { Logger } from "@utils/Logger"; import definePlugin from "@utils/types"; -import { StickersStore } from "@webpack/common"; +import { StickerStore } from "@webpack/common"; import { getMimeType, isLinkAnImage, settings, stripDiscordParams } from "./settings"; @@ -121,7 +121,7 @@ function loadImagePreview(url: string, sticker: boolean) { if (sticker) { const stickerId = url.split("/").pop()?.split(".")[0] ?? null; - const stickerData = stickerId ? StickersStore.getStickerById(stickerId) : null; + const stickerData = stickerId ? StickerStore.getStickerById(stickerId) : null; if (stickerData) { switch (stickerData.type) { diff --git a/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx b/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx index 457fcce7..f768d9ce 100644 --- a/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx +++ b/src/equicordplugins/remix/editor/components/SettingColorComponent.tsx @@ -10,8 +10,7 @@ import "./colorStyles.css"; import { classNameFactory } from "@api/Styles"; -import { findComponentByCodeLazy } from "@webpack"; -import { Forms } from "@webpack/common"; +import { ColorPicker, Forms } from "@webpack/common"; interface ColorPickerProps { color: number | null; @@ -19,8 +18,6 @@ interface ColorPickerProps { onChange(value: number | null): void; } -const ColorPicker = findComponentByCodeLazy(".BACKGROUND_ACCENT.css"); - const cl = classNameFactory("vc-remix-settings-color-"); interface Props { diff --git a/src/plugins/expressionCloner/index.tsx b/src/plugins/expressionCloner/index.tsx index 3a73489c..b723c818 100644 --- a/src/plugins/expressionCloner/index.tsx +++ b/src/plugins/expressionCloner/index.tsx @@ -24,12 +24,11 @@ import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; import { ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal"; import definePlugin from "@utils/types"; -import { findByCodeLazy, findStoreLazy } from "@webpack"; -import { Constants, EmojiStore, FluxDispatcher, Forms, GuildStore, Menu, PermissionsBits, PermissionStore, React, RestAPI, Toasts, Tooltip, UserStore } from "@webpack/common"; +import { findByCodeLazy } from "@webpack"; +import { Constants, EmojiStore, FluxDispatcher, Forms, GuildStore, Menu, PermissionsBits, PermissionStore, React, RestAPI, StickerStore, Toasts, Tooltip, UserStore } from "@webpack/common"; import { Guild } from "discord-types/general"; import { Promisable } from "type-fest"; -const StickersStore = findStoreLazy("StickersStore"); const uploadEmoji = findByCodeLazy(".GUILD_EMOJIS(", "EMOJI_UPLOAD_START"); const getGuildMaxEmojiSlots = findByCodeLazy(".additionalEmojiSlots") as (guild: Guild) => number; @@ -64,7 +63,7 @@ function getUrl(data: Data) { } async function fetchSticker(id: string) { - const cached = StickersStore.getStickerById(id); + const cached = StickerStore.getStickerById(id); if (cached) return cached; const { body } = await RestAPI.get({ diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index b554f7ac..0d24ad93 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -50,7 +50,7 @@ export let GuildMemberStore: Stores.GuildMemberStore & t.FluxStore; export let RelationshipStore: t.RelationshipStore; export let EmojiStore: t.EmojiStore; -export let StickersStore: t.StickersStore; +export let StickerStore: t.StickerStore; export let ThemeStore: t.ThemeStore; export let WindowStore: t.WindowStore; export let DraftStore: t.DraftStore; @@ -83,7 +83,7 @@ waitForStore("GuildChannelStore", m => GuildChannelStore = m); waitForStore("MessageStore", m => MessageStore = m); waitForStore("WindowStore", m => WindowStore = m); waitForStore("EmojiStore", m => EmojiStore = m); -waitForStore("StickersStore", m => StickersStore = m); +waitForStore("StickersStore", m => StickerStore = m); waitForStore("TypingStore", m => TypingStore = m); waitForStore("ThemeStore", m => { ThemeStore = m; diff --git a/src/webpack/common/types/stores.d.ts b/src/webpack/common/types/stores.d.ts index d83a75da..f14a3fc1 100644 --- a/src/webpack/common/types/stores.d.ts +++ b/src/webpack/common/types/stores.d.ts @@ -177,7 +177,7 @@ export class EmojiStore extends FluxStore { }; } -export class StickersStore extends FluxStore { +export class StickerStore extends FluxStore { getStickerById(id: string): Sticker | undefined; getStickerPack(id: string): StickerPack | undefined; getPremiumPacks(): StickerPack[];