mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-20 20:07:03 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
acf04bb01d
49 changed files with 944 additions and 868 deletions
|
@ -16,8 +16,15 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ProfileBadge } from "@api/Badges";
|
||||
import { ChatBarButtonFactory } from "@api/ChatButtons";
|
||||
import { Command } from "@api/Commands";
|
||||
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { MemberListDecoratorFactory } from "@api/MemberListDecorators";
|
||||
import { MessageAccessoryFactory } from "@api/MessageAccessories";
|
||||
import { MessageDecorationFactory } from "@api/MessageDecorations";
|
||||
import { MessageClickListener, MessageEditListener, MessageSendListener } from "@api/MessageEvents";
|
||||
import { MessagePopoverButtonFactory } from "@api/MessagePopover";
|
||||
import { FluxEvents } from "@webpack/types";
|
||||
import { JSX } from "react";
|
||||
import { Promisable } from "type-fest";
|
||||
|
@ -147,6 +154,20 @@ export interface PluginDef {
|
|||
toolboxActions?: Record<string, () => void>;
|
||||
|
||||
tags?: string[];
|
||||
|
||||
userProfileBadge?: ProfileBadge;
|
||||
|
||||
onMessageClick?: MessageClickListener;
|
||||
onBeforeMessageSend?: MessageSendListener;
|
||||
onBeforeMessageEdit?: MessageEditListener;
|
||||
|
||||
renderMessagePopoverButton?: MessagePopoverButtonFactory;
|
||||
renderMessageAccessory?: MessageAccessoryFactory;
|
||||
renderMessageDecoration?: MessageDecorationFactory;
|
||||
|
||||
renderMemberListDecorator?: MemberListDecoratorFactory;
|
||||
|
||||
renderChatBarButton?: ChatBarButtonFactory;
|
||||
}
|
||||
|
||||
export const enum StartAt {
|
||||
|
@ -173,6 +194,7 @@ export const enum OptionType {
|
|||
SELECT,
|
||||
SLIDER,
|
||||
COMPONENT,
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
export type SettingsDefinition = Record<string, PluginSettingDef>;
|
||||
|
@ -181,7 +203,7 @@ export type SettingsChecks<D extends SettingsDefinition> = {
|
|||
(IsDisabled<DefinedSettings<D>> & IsValid<PluginSettingType<D[K]>, DefinedSettings<D>>);
|
||||
};
|
||||
|
||||
export type PluginSettingDef = (
|
||||
export type PluginSettingDef = (PluginSettingCustomDef & Pick<PluginSettingCommon, "onChange">) | ((
|
||||
| PluginSettingStringDef
|
||||
| PluginSettingNumberDef
|
||||
| PluginSettingBooleanDef
|
||||
|
@ -189,7 +211,7 @@ export type PluginSettingDef = (
|
|||
| PluginSettingSliderDef
|
||||
| PluginSettingComponentDef
|
||||
| PluginSettingBigIntDef
|
||||
) & PluginSettingCommon;
|
||||
) & PluginSettingCommon);
|
||||
|
||||
export interface PluginSettingCommon {
|
||||
description: string;
|
||||
|
@ -243,12 +265,18 @@ export interface PluginSettingSelectDef {
|
|||
type: OptionType.SELECT;
|
||||
options: readonly PluginSettingSelectOption[];
|
||||
}
|
||||
|
||||
export interface PluginSettingSelectOption {
|
||||
label: string;
|
||||
value: string | number | boolean;
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
export interface PluginSettingCustomDef {
|
||||
type: OptionType.CUSTOM;
|
||||
default?: any;
|
||||
}
|
||||
|
||||
export interface PluginSettingSliderDef {
|
||||
type: OptionType.SLIDER;
|
||||
/**
|
||||
|
@ -298,7 +326,9 @@ type PluginSettingType<O extends PluginSettingDef> = O extends PluginSettingStri
|
|||
O extends PluginSettingSelectDef ? O["options"][number]["value"] :
|
||||
O extends PluginSettingSliderDef ? number :
|
||||
O extends PluginSettingComponentDef ? any :
|
||||
O extends PluginSettingCustomDef ? O extends { default: infer Default; } ? Default : any :
|
||||
never;
|
||||
|
||||
type PluginSettingDefaultType<O extends PluginSettingDef> = O extends PluginSettingSelectDef ? (
|
||||
O["options"] extends { default?: boolean; }[] ? O["options"][number]["value"] : undefined
|
||||
) : O extends { default: infer T; } ? T : undefined;
|
||||
|
@ -350,13 +380,15 @@ export type PluginOptionsItem =
|
|||
| PluginOptionBoolean
|
||||
| PluginOptionSelect
|
||||
| PluginOptionSlider
|
||||
| PluginOptionComponent;
|
||||
| PluginOptionComponent
|
||||
| PluginOptionCustom;
|
||||
export type PluginOptionString = PluginSettingStringDef & PluginSettingCommon & IsDisabled & IsValid<string>;
|
||||
export type PluginOptionNumber = (PluginSettingNumberDef | PluginSettingBigIntDef) & PluginSettingCommon & IsDisabled & IsValid<number | BigInt>;
|
||||
export type PluginOptionBoolean = PluginSettingBooleanDef & PluginSettingCommon & IsDisabled & IsValid<boolean>;
|
||||
export type PluginOptionSelect = PluginSettingSelectDef & PluginSettingCommon & IsDisabled & IsValid<PluginSettingSelectOption>;
|
||||
export type PluginOptionSlider = PluginSettingSliderDef & PluginSettingCommon & IsDisabled & IsValid<number>;
|
||||
export type PluginOptionComponent = PluginSettingComponentDef & PluginSettingCommon;
|
||||
export type PluginOptionCustom = PluginSettingCustomDef & Pick<PluginSettingCommon, "onChange">;
|
||||
|
||||
export type PluginNative<PluginExports extends Record<string, (event: Electron.IpcMainInvokeEvent, ...args: any[]) => any>> = {
|
||||
[key in keyof PluginExports]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue