Compare commits

...

37 commits

Author SHA1 Message Date
programminglaboratorys
5ff14242fa
Merge fddccea8b8 into bcfef05a8a 2024-09-15 03:01:44 -04:00
programminglaboratorys
fddccea8b8 removing UserSettingDefinitions 2024-06-28 17:41:53 +03:00
programminglaboratorys
2ae278942e following lint 2024-06-28 17:35:41 +03:00
programminglaboratorys
3e12c8758a
Merge branch 'dev' into TablistApi 2024-06-28 17:29:25 +03:00
programminglaboratorys
efbcbec349 resolving conflicts 2024-06-28 17:27:17 +03:00
programminglaboratorys
35b712da61
Merge branch 'dev' into TablistApi 2024-06-28 12:45:37 +03:00
programminglaboratorys
c268a3d885
fix patch 2024-06-24 04:49:08 +03:00
programminglaboratorys
6cca09e571
resolving conflict affects 2024-06-24 04:48:55 +03:00
programminglaboratorys
3a916b37ca
Merge branch 'dev' into TablistApi 2024-06-24 04:01:00 +03:00
programminglaboratorys
39163b3705
Merge branch 'dev' into TablistApi 2024-06-20 11:53:29 +03:00
Nuckyz
ceaaf9ab8a
Reporter: Test mapMangledModule 2024-06-20 01:00:07 -03:00
Nuckyz
a01ee40591
Clean-up related additions to mangled exports 2024-06-19 23:50:04 -03:00
programminglaboratorys
b4532ad968
Merge branch 'dev' into TablistApi 2024-06-19 20:03:03 +03:00
programminglaboratorys
0bce276c37 patch fix and api/index.ts update 2024-06-19 19:55:47 +03:00
programminglaboratorys
c4f1def5e2 Merge branch 'TablistApi' of https://github.com/programminglaboratorys/Vencord into TablistApi 2024-06-12 13:37:47 +03:00
programminglaboratorys
23db98a492 resolving 'Invalid header' lint error 2024-06-12 13:37:28 +03:00
programminglaboratorys
7b8ad34aae
Merge branch 'Vendicated:main' into TablistApi 2024-06-12 13:01:30 +03:00
programminglaboratorys
90c970c2d0 adding me to constants 2024-06-08 13:33:56 +03:00
programminglaboratorys
954a3e87cf damnit messive mistake 2024-06-08 13:28:42 +03:00
programminglaboratorys
f5f6f56738 resolving conflicts 2024-06-08 13:21:05 +03:00
programminglaboratorys
4b337e30ff merging 2024-06-08 13:15:51 +03:00
programminglaboratorys
24202b0b2f resolving conflicts 2024-06-08 12:38:38 +03:00
programminglaboratorys
bb026be0fd
Merge branch 'dev' into TablistApi 2024-06-03 05:44:11 +03:00
programminglaboratorys
d2cb9e9863
conflict resolving 2024-06-03 05:40:15 +03:00
Nuckyz
6e6ee4db68
NoPendingCount: Fix for message requests 2024-06-01 23:40:05 -03:00
Nuckyz
d8524b087c
Add shortcut for lazy loading chunks 2024-06-01 18:39:01 -03:00
Vendicated
78fd37a4c6
fix(css): brand-experiment is now brand-500 2024-06-01 19:13:27 +02:00
programminglaboratorys
64f1912bdb
Merge branch 'Vendicated:main' into TablistApi 2024-05-29 09:16:55 +03:00
programminglaboratorys
3dfd47af53
Merge branch 'Vendicated:main' into TablistApi 2024-05-28 05:40:29 +03:00
programminglaboratorys
5daddac821 fix a patch 2024-05-23 10:27:38 +03:00
programminglaboratorys
743c279adc following linter rules, and renaming functions/components to match the new name of the api 2024-05-23 07:55:55 +03:00
programminglaboratorys
01f5de3793
Merge branch 'Vendicated:main' into TablistApi 2024-05-23 07:22:39 +03:00
programminglaboratorys
2b252c4011
name update, and added ErrorBoundary to RenderTabButtons 2024-05-20 20:15:39 +03:00
programminglaboratorys
cf5886eac6
Merge branch 'Vendicated:main' into TablistApi 2024-05-20 20:07:11 +03:00
programminglaboratorys
6c3a4a8f4b
Merge branch 'dev' into TablistApi 2024-05-12 13:35:23 +03:00
programminglaboratorys
c7244d8b26 fixing some bugs to adapt with the new TablistComponents data type 2024-04-27 19:48:20 +03:00
programminglaboratorys
955232f4d6 adding the api 2024-04-26 14:46:13 +03:00
4 changed files with 102 additions and 1 deletions

View file

@ -0,0 +1,61 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import ErrorBoundary from "@components/ErrorBoundary";
import { Channel } from "discord-types/general";
export interface ExpressionPickerButtonProps {
id?: string;
"aria-controls": string;
"aria-selected": boolean;
isActive: boolean;
viewType: string;
children: string | JSX.Element;
autoFocus?: boolean;
[key: string]: any;
}
export interface ExpressionPickerPanelProps {
selectedTab: string;
channel: Channel;
}
export type ExpressionPickerButtonComponent = (props: ExpressionPickerButtonProps) => JSX.Element | null;
export type ExpressionPickerPanelComponent = (props: ExpressionPickerPanelProps) => JSX.Element | null;
export interface ExpressionPickerTabItem {
tab: string,
Component: ExpressionPickerPanelComponent;
autoFocus?: boolean;
}
const ExpressionPickerComponents = new Map<string, ExpressionPickerTabItem>();
export const addExpressionPickerTabButton = (id: string, tab: string, PanelComponent: ExpressionPickerPanelComponent, autoFocus?: boolean) => ExpressionPickerComponents.set(id, { tab: tab, Component: PanelComponent, autoFocus: autoFocus });
export const removeExpressionPickerTabButton = (id: string) => ExpressionPickerComponents.delete(id);
export function* RenderTabButtons(ExpressionPickerButtonComponent: ExpressionPickerButtonComponent, selectedTab: string) {
for (const [id, { tab }] of ExpressionPickerComponents) {
yield (<ErrorBoundary><ExpressionPickerButtonComponent
id={id + "-picker-tab"}
aria-controls={id + "-picker-tab-panel"}
aria-selected={id === selectedTab}
viewType={id}
isActive={id === selectedTab}
>{tab}</ExpressionPickerButtonComponent></ErrorBoundary>);
}
}
export function* TabPanels(selectedTab: string, channel: Channel) {
for (const [id, { Component }] of ExpressionPickerComponents) {
if (id !== selectedTab) { continue; }
const PanelComponent: ExpressionPickerPanelComponent = Component;
yield (<ErrorBoundary><PanelComponent selectedTab={selectedTab} channel={channel} /></ErrorBoundary>);
}
}

View file

@ -21,6 +21,7 @@ import * as $ChatButtons from "./ChatButtons";
import * as $Commands from "./Commands";
import * as $ContextMenu from "./ContextMenu";
import * as $DataStore from "./DataStore";
import * as $ExpressionPickerTabs from "./ExpressionPickerTabs";
import * as $MemberListDecorators from "./MemberListDecorators";
import * as $MessageAccessories from "./MessageAccessories";
import * as $MessageDecorations from "./MessageDecorations";
@ -119,6 +120,11 @@ export const ChatButtons = $ChatButtons;
export const MessageUpdater = $MessageUpdater;
/**
* An API allowing you to get an user setting
* An API allowing you to add panels to the expression picker
*/
export const ExpressionPickerTabs = $ExpressionPickerTabs;
/**
* An API allowing you to get an user setting
*/
export const UserSettings = $UserSettings;

View file

@ -0,0 +1,30 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "ExpressionPickerTabsAPI",
description: "an API to add panels to the expression picker",
authors: [Devs.iamme],
patches: [
{
find: ".EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL",
replacement: [
{
match: /\.jsx\)\((\i),\{id:\i\.E\i,.+?,"aria-selected":(\i)===\i\.\i\.EMOJI.+?,viewType:(\i).+?\}\)/,
replace: "$&,...Vencord.Api.ExpressionPickerTabs.RenderTabButtons($1, $2)"
},
{
match: /null,(\i)===\i\.\i\.EMOJI\?.{0,55}channel:(\i),.+?\):null/,
replace: "$&,...Vencord.Api.ExpressionPickerTabs.TabPanels($1, $2)"
}
]
}
]
});

View file

@ -475,6 +475,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "Sqaaakoi",
id: 259558259491340288n
},
iamme: {
name: "i am me",
id: 984392761929256980n
},
Byron: {
name: "byeoon",
id: 1167275288036655133n