Merge remote-tracking branch 'upstream/dev'

This commit is contained in:
thororen1234 2024-06-20 12:35:54 -04:00
commit cd96099b3d
31 changed files with 347 additions and 202 deletions

View file

@ -20,9 +20,9 @@ export * from "./classes";
export * from "./components";
export * from "./menu";
export * from "./react";
export * from "./settingsStores";
export * from "./stores";
export * as ComponentTypes from "./types/components.d";
export * as MenuTypes from "./types/menu.d";
export * as UtilTypes from "./types/utils.d";
export * from "./userSettings";
export * from "./utils";

View file

@ -1,11 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
export interface SettingsStore<T = any> {
getSetting(): T;
updateSetting(value: T): void;
useSetting(): T;
}

View file

@ -18,6 +18,7 @@
import { Guild, GuildMember } from "discord-types/general";
import type { ReactNode } from "react";
import { LiteralUnion } from "type-fest";
import type { FluxEvents } from "./fluxEvents";
import { i18nMessages } from "./i18nMessages";
@ -81,7 +82,7 @@ interface RestRequestData {
retries?: number;
}
export type RestAPI = Record<"delete" | "get" | "patch" | "post" | "put", (data: RestRequestData) => Promise<any>>;
export type RestAPI = Record<"del" | "get" | "patch" | "post" | "put", (data: RestRequestData) => Promise<any>>;
export type Permissions = "CREATE_INSTANT_INVITE"
| "KICK_MEMBERS"
@ -221,3 +222,37 @@ export interface Constants {
UserFlags: Record<string, number>;
FriendsSections: Record<string, string>;
}
export interface ExpressionPickerStore {
closeExpressionPicker(activeViewType?: any): void;
openExpressionPicker(activeView: LiteralUnion<"emoji" | "gif" | "sticker", string>, activeViewType?: any): void;
}
export interface BrowserWindowFeatures {
toolbar?: boolean;
menubar?: boolean;
location?: boolean;
directories?: boolean;
width?: number;
height?: number;
defaultWidth?: number;
defaultHeight?: number;
left?: number;
top?: number;
defaultAlwaysOnTop?: boolean;
movable?: boolean;
resizable?: boolean;
frame?: boolean;
alwaysOnTop?: boolean;
hasShadow?: boolean;
transparent?: boolean;
skipTaskbar?: boolean;
titleBarStyle?: string | null;
backgroundColor?: string;
}
export interface PopoutActions {
open(key: string, render: (windowKey: string) => ReactNode, features?: BrowserWindowFeatures);
close(key: string): void;
setAlwaysOnTop(key: string, alwaysOnTop: boolean): void;
}

View file

@ -158,9 +158,15 @@ export const InviteActions = findByPropsLazy("resolveInvite");
export const IconUtils: t.IconUtils = findByPropsLazy("getGuildBannerURL", "getUserAvatarURL");
const openExpressionPickerMatcher = canonicalizeMatch(/setState\({activeView:\i/);
const openExpressionPickerMatcher = canonicalizeMatch(/setState\({activeView:\i,activeViewType:/);
// TODO: type
export const ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
export const ExpressionPickerStore: t.ExpressionPickerStore = mapMangledModuleLazy("expression-picker-last-active-view", {
closeExpressionPicker: filters.byCode("setState({activeView:null"),
openExpressionPicker: m => typeof m === "function" && openExpressionPickerMatcher.test(m.toString()),
});
export const PopoutActions: t.PopoutActions = mapMangledModuleLazy('type:"POPOUT_WINDOW_OPEN"', {
open: filters.byCode('type:"POPOUT_WINDOW_OPEN"'),
close: filters.byCode('type:"POPOUT_WINDOW_CLOSE"'),
setAlwaysOnTop: filters.byCode('type:"POPOUT_WINDOW_SET_ALWAYS_ON_TOP"'),
});