Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
eb190b660e | ||
|
d6f9068695 | ||
|
cb507babaa | ||
|
235d114193 | ||
|
9aba70dcb1 | ||
|
0b61d29c31 | ||
|
335a13a38a | ||
|
128ee41252 | ||
|
ccca41a168 | ||
|
af4c7d8a90 | ||
|
77c691651e | ||
|
e14ec96e21 | ||
|
ff1f337699 | ||
|
3ca87848e5 |
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.0.6",
|
"version": "1.0.8",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Logger from "@utils/Logger";
|
import Logger from "@utils/Logger";
|
||||||
|
import { Margins } from "@utils/margins";
|
||||||
import { LazyComponent } from "@utils/misc";
|
import { LazyComponent } from "@utils/misc";
|
||||||
import { Margins, React } from "@webpack/common";
|
import { React } from "@webpack/common";
|
||||||
|
|
||||||
import { ErrorCard } from "./ErrorCard";
|
import { ErrorCard } from "./ErrorCard";
|
||||||
|
|
||||||
@ -84,15 +85,13 @@ const ErrorBoundary = LazyComponent(() => {
|
|||||||
const msg = this.props.message || "An error occurred while rendering this Component. More info can be found below and in your console.";
|
const msg = this.props.message || "An error occurred while rendering this Component. More info can be found below and in your console.";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorCard style={{
|
<ErrorCard style={{ overflow: "hidden" }}>
|
||||||
overflow: "hidden",
|
|
||||||
}}>
|
|
||||||
<h1>Oh no!</h1>
|
<h1>Oh no!</h1>
|
||||||
<p>{msg}</p>
|
<p>{msg}</p>
|
||||||
<code>
|
<code>
|
||||||
{this.state.message}
|
{this.state.message}
|
||||||
{!!this.state.stack && (
|
{!!this.state.stack && (
|
||||||
<pre className={Margins.marginTop8}>
|
<pre className={Margins.top8}>
|
||||||
{this.state.stack}
|
{this.state.stack}
|
||||||
</pre>
|
</pre>
|
||||||
)}
|
)}
|
||||||
|
7
src/components/ErrorCard.css
Normal file
7
src/components/ErrorCard.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.vc-error-card {
|
||||||
|
padding: 2em;
|
||||||
|
background-color: #e7828430;
|
||||||
|
border: 1px solid #e78284;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: var(--text-normal, white);
|
||||||
|
}
|
@ -16,24 +16,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Card } from "@webpack/common";
|
import "./ErrorCard.css";
|
||||||
|
|
||||||
interface Props {
|
import { classes } from "@utils/misc";
|
||||||
style?: React.CSSProperties;
|
import type { HTMLProps } from "react";
|
||||||
className?: string;
|
|
||||||
}
|
export function ErrorCard(props: React.PropsWithChildren<HTMLProps<HTMLDivElement>>) {
|
||||||
export function ErrorCard(props: React.PropsWithChildren<Props>) {
|
|
||||||
return (
|
return (
|
||||||
<Card className={props.className} style={
|
<div {...props} className={classes(props.className, "vc-error-card")}>
|
||||||
{
|
|
||||||
padding: "2em",
|
|
||||||
backgroundColor: "#e7828430",
|
|
||||||
borderColor: "#e78284",
|
|
||||||
color: "var(--text-normal)",
|
|
||||||
...props.style
|
|
||||||
}
|
|
||||||
}>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</Card>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,8 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {
|
|||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: join(__dirname, "preload.js"),
|
preload: join(__dirname, "preload.js"),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
nodeIntegration: false
|
nodeIntegration: false,
|
||||||
|
sandbox: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await win.loadURL(`data:text/html;base64,${monacoHtml}`);
|
await win.loadURL(`data:text/html;base64,${monacoHtml}`);
|
||||||
|
@ -43,7 +43,7 @@ export default definePlugin({
|
|||||||
{
|
{
|
||||||
find: '"Menu API',
|
find: '"Menu API',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /function.{0,80}type===(.{1,3})\..{1,3}\).{0,50}navigable:.+?Menu API/s,
|
match: /function.{0,80}type===(\i)\).{0,50}navigable:.+?Menu API/s,
|
||||||
replace: (m, mod) => {
|
replace: (m, mod) => {
|
||||||
let nicenNames = "";
|
let nicenNames = "";
|
||||||
const redefines = [] as string[];
|
const redefines = [] as string[];
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
import * as Webpack from "@webpack";
|
||||||
|
import { extract, filters, findAll, search } from "@webpack";
|
||||||
|
import { React } from "@webpack/common";
|
||||||
|
|
||||||
const WEB_ONLY = (f: string) => () => {
|
const WEB_ONLY = (f: string) => () => {
|
||||||
throw new Error(`'${f}' is Discord Desktop only.`);
|
throw new Error(`'${f}' is Discord Desktop only.`);
|
||||||
@ -29,19 +32,48 @@ export default definePlugin({
|
|||||||
authors: [Devs.Ven],
|
authors: [Devs.Ven],
|
||||||
|
|
||||||
getShortcuts() {
|
getShortcuts() {
|
||||||
|
function newFindWrapper(filterFactory: (props: any) => Webpack.FilterFn) {
|
||||||
|
const cache = new Map<string, any>();
|
||||||
|
|
||||||
|
return function (filterProps: any) {
|
||||||
|
const cacheKey = String(filterProps);
|
||||||
|
if (cache.has(cacheKey)) return cache.get(cacheKey);
|
||||||
|
|
||||||
|
const matches = findAll(filterFactory(filterProps));
|
||||||
|
|
||||||
|
const result = (() => {
|
||||||
|
switch (matches.length) {
|
||||||
|
case 0: return null;
|
||||||
|
case 1: return matches[0];
|
||||||
|
default:
|
||||||
|
const uniqueMatches = [...new Set(matches)];
|
||||||
|
if (uniqueMatches.length > 1)
|
||||||
|
console.warn(`Warning: This filter matches ${matches.length} modules. Make it more specific!\n`, uniqueMatches);
|
||||||
|
|
||||||
|
return matches[0];
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
if (result && cacheKey) cache.set(cacheKey, result);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
toClip: IS_WEB ? WEB_ONLY("toClip") : window.DiscordNative.clipboard.copy,
|
wp: Webpack,
|
||||||
fromClip: IS_WEB ? WEB_ONLY("fromClip") : window.DiscordNative.clipboard.read,
|
wpc: Webpack.wreq.c,
|
||||||
wp: Vencord.Webpack,
|
wreq: Webpack.wreq,
|
||||||
wpc: Vencord.Webpack.wreq.c,
|
wpsearch: search,
|
||||||
wreq: Vencord.Webpack.wreq,
|
wpex: extract,
|
||||||
wpsearch: Vencord.Webpack.search,
|
|
||||||
wpex: Vencord.Webpack.extract,
|
|
||||||
wpexs: (code: string) => Vencord.Webpack.extract(Vencord.Webpack.findModuleId(code)!),
|
wpexs: (code: string) => Vencord.Webpack.extract(Vencord.Webpack.findModuleId(code)!),
|
||||||
findByProps: Vencord.Webpack.findByProps,
|
find: newFindWrapper(f => f),
|
||||||
find: Vencord.Webpack.find,
|
findAll,
|
||||||
Plugins: Vencord.Plugins,
|
findByProps: newFindWrapper(filters.byProps),
|
||||||
React: Vencord.Webpack.Common.React,
|
findAllByProps: (...props: string[]) => findAll(filters.byProps(...props)),
|
||||||
|
findByCode: newFindWrapper(filters.byCode),
|
||||||
|
findAllByCode: (code: string) => findAll(filters.byCode(code)),
|
||||||
|
PluginsApi: Vencord.Plugins,
|
||||||
|
plugins: Vencord.Plugins.plugins,
|
||||||
|
React,
|
||||||
Settings: Vencord.Settings,
|
Settings: Vencord.Settings,
|
||||||
Api: Vencord.Api,
|
Api: Vencord.Api,
|
||||||
reload: () => location.reload(),
|
reload: () => location.reload(),
|
||||||
|
@ -22,11 +22,14 @@ import { Devs } from "@utils/constants";
|
|||||||
import { ApngDisposeOp, getGifEncoder, importApngJs } from "@utils/dependencies";
|
import { ApngDisposeOp, getGifEncoder, importApngJs } from "@utils/dependencies";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||||
import { ChannelStore, UserStore } from "@webpack/common";
|
import { ChannelStore, PermissionStore, UserStore } from "@webpack/common";
|
||||||
|
|
||||||
const DRAFT_TYPE = 0;
|
const DRAFT_TYPE = 0;
|
||||||
const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR");
|
const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR");
|
||||||
|
|
||||||
|
const USE_EXTERNAL_EMOJIS = 1n << 18n;
|
||||||
|
const USE_EXTERNAL_STICKERS = 1n << 37n;
|
||||||
|
|
||||||
enum EmojiIntentions {
|
enum EmojiIntentions {
|
||||||
REACTION = 0,
|
REACTION = 0,
|
||||||
STATUS = 1,
|
STATUS = 1,
|
||||||
@ -69,8 +72,8 @@ migratePluginSettings("FakeNitro", "NitroBypass");
|
|||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "FakeNitro",
|
name: "FakeNitro",
|
||||||
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.obscurity],
|
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.obscurity, Devs.captain],
|
||||||
description: "Allows you to stream in nitro quality and send fake emojis/stickers.",
|
description: "Allows you to stream in nitro quality, send fake emojis/stickers and use client themes.",
|
||||||
dependencies: ["MessageEventsAPI"],
|
dependencies: ["MessageEventsAPI"],
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
@ -79,12 +82,16 @@ export default definePlugin({
|
|||||||
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=(?<intention>\i)=\i\.intention.+?\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g,
|
match: /(?<=(?<intention>\i)=\i\.intention)/,
|
||||||
replace: ",$<intention>"
|
replace: ",fakeNitroIntention=$<intention>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=,\i=)\i\.\i\.can\(\i\.\i\.USE_EXTERNAL_EMOJIS,\i\)(?=;)/,
|
match: /(?<=\.(?:canUseEmojisEverywhere|canUseAnimatedEmojis)\(\i)(?=\))/g,
|
||||||
replace: "true"
|
replace: ",fakeNitroIntention"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(?<=&&!\i&&)!(?<canUseExternal>\i)(?=\)return \i\.\i\.DISALLOW_EXTERNAL;)/,
|
||||||
|
replace: `(!$<canUseExternal>&&![${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention))`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -92,12 +99,12 @@ export default definePlugin({
|
|||||||
find: "canUseAnimatedEmojis:function",
|
find: "canUseAnimatedEmojis:function",
|
||||||
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\(\i)\){/g,
|
match: /(?<=(?:canUseEmojisEverywhere|canUseAnimatedEmojis):function\((?<user>\i))\){(?<premiumCheck>.+?\))/g,
|
||||||
replace: `,fakeNitroIntention){return fakeNitroIntention===undefined||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention);`
|
replace: `,fakeNitroIntention){$<premiumCheck>||fakeNitroIntention===undefined||[${EmojiIntentions.CHAT},${EmojiIntentions.GUILD_STICKER_RELATED_EMOJI}].includes(fakeNitroIntention)`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "canUseAnimatedEmojis:function",
|
find: "canUseStickersEverywhere:function",
|
||||||
predicate: () => Settings.plugins.FakeNitro.enableStickerBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableStickerBypass === true,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /canUseStickersEverywhere:function\(.+?\{/,
|
match: /canUseStickersEverywhere:function\(.+?\{/,
|
||||||
@ -113,7 +120,7 @@ export default definePlugin({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "canUseAnimatedEmojis:function",
|
find: "canStreamHighQuality:function",
|
||||||
predicate: () => Settings.plugins.FakeNitro.enableStreamQualityBypass === true,
|
predicate: () => Settings.plugins.FakeNitro.enableStreamQualityBypass === true,
|
||||||
replacement: [
|
replacement: [
|
||||||
"canUseHighVideoUploadQuality",
|
"canUseHighVideoUploadQuality",
|
||||||
@ -134,6 +141,13 @@ export default definePlugin({
|
|||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
find: "canUseClientThemes:function",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=canUseClientThemes:function\(\i\){)/,
|
||||||
|
replace: "return true;"
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
@ -181,6 +195,22 @@ export default definePlugin({
|
|||||||
return (UserStore.getCurrentUser().premiumType ?? 0) > 1;
|
return (UserStore.getCurrentUser().premiumType ?? 0) > 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hasPermissionToUseExternalEmojis(channelId: string) {
|
||||||
|
const channel = ChannelStore.getChannel(channelId);
|
||||||
|
|
||||||
|
if (!channel || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return true;
|
||||||
|
|
||||||
|
return PermissionStore.can(USE_EXTERNAL_EMOJIS, channel);
|
||||||
|
},
|
||||||
|
|
||||||
|
hasPermissionToUseExternalStickers(channelId: string) {
|
||||||
|
const channel = ChannelStore.getChannel(channelId);
|
||||||
|
|
||||||
|
if (!channel || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return true;
|
||||||
|
|
||||||
|
return PermissionStore.can(USE_EXTERNAL_STICKERS, channel);
|
||||||
|
},
|
||||||
|
|
||||||
getStickerLink(stickerId: string) {
|
getStickerLink(stickerId: string) {
|
||||||
return `https://media.discordapp.net/stickers/${stickerId}.png?size=${Settings.plugins.FakeNitro.stickerSize}`;
|
return `https://media.discordapp.net/stickers/${stickerId}.png?size=${Settings.plugins.FakeNitro.stickerSize}`;
|
||||||
},
|
},
|
||||||
@ -265,7 +295,7 @@ export default definePlugin({
|
|||||||
if (!sticker)
|
if (!sticker)
|
||||||
break stickerBypass;
|
break stickerBypass;
|
||||||
|
|
||||||
if (sticker.available !== false && (this.canUseStickers || (sticker as GuildSticker)?.guild_id === guildId))
|
if (sticker.available !== false && ((this.canUseStickers && this.hasPermissionToUseExternalStickers(channelId)) || (sticker as GuildSticker)?.guild_id === guildId))
|
||||||
break stickerBypass;
|
break stickerBypass;
|
||||||
|
|
||||||
let link = this.getStickerLink(sticker.id);
|
let link = this.getStickerLink(sticker.id);
|
||||||
@ -288,7 +318,7 @@ export default definePlugin({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.canUseEmotes && settings.enableEmojiBypass) {
|
if ((!this.canUseEmotes || !this.hasPermissionToUseExternalEmojis(channelId)) && settings.enableEmojiBypass) {
|
||||||
for (const emoji of messageObj.validNonShortcutEmojis) {
|
for (const emoji of messageObj.validNonShortcutEmojis) {
|
||||||
if (!emoji.require_colons) continue;
|
if (!emoji.require_colons) continue;
|
||||||
if (emoji.guildId === guildId && !emoji.animated) continue;
|
if (emoji.guildId === guildId && !emoji.animated) continue;
|
||||||
@ -304,8 +334,9 @@ export default definePlugin({
|
|||||||
return { cancel: false };
|
return { cancel: false };
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.canUseEmotes && settings.enableEmojiBypass) {
|
this.preEdit = addPreEditListener((channelId, __, messageObj) => {
|
||||||
this.preEdit = addPreEditListener((_, __, messageObj) => {
|
if (this.canUseEmotes && this.hasPermissionToUseExternalEmojis(channelId)) return;
|
||||||
|
|
||||||
const { guildId } = this;
|
const { guildId } = this;
|
||||||
|
|
||||||
for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) {
|
for (const [emojiStr, _, emojiId] of messageObj.content.matchAll(/(?<!\\)<a?:(\w+):(\d+)>/ig)) {
|
||||||
@ -319,7 +350,6 @@ export default definePlugin({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
@ -30,10 +30,10 @@ export default definePlugin({
|
|||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".revealSpoiler=function",
|
find: ".removeObscurity=function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.revealSpoiler=function\((.{1,2})\){/,
|
match: /\.removeObscurity=function\((\i)\){/,
|
||||||
replace: ".revealSpoiler=function($1){$self.reveal($1);"
|
replace: ".removeObscurity=function($1){$self.reveal($1);"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -32,6 +32,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
|
|||||||
fallbackValue: [],
|
fallbackValue: [],
|
||||||
deps: [refetchCount],
|
deps: [refetchCount],
|
||||||
});
|
});
|
||||||
|
const username = UserStore.getUser(userId)?.username ?? "";
|
||||||
|
|
||||||
const dirtyRefetch = () => setRefetchCount(refetchCount + 1);
|
const dirtyRefetch = () => setRefetchCount(refetchCount + 1);
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
|
|||||||
<textarea
|
<textarea
|
||||||
className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")}
|
className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")}
|
||||||
// this produces something like '-_59yqs ...' but since no class exists with that name its fine
|
// this produces something like '-_59yqs ...' but since no class exists with that name its fine
|
||||||
placeholder={"Review @" + UserStore.getUser(userId)?.username ?? ""}
|
placeholder={reviews?.some(r => r.senderdiscordid === UserStore.getCurrentUser().id) ? `Update review for @${username}` : `Review @${username}`}
|
||||||
onKeyDown={onKeyPress}
|
onKeyDown={onKeyPress}
|
||||||
style={{
|
style={{
|
||||||
marginTop: "6px",
|
marginTop: "6px",
|
||||||
|
@ -73,7 +73,7 @@ function TypingIndicator({ channelId }: { channelId: string; }) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
tooltipText = Formatters.Messages.THREE_USERS_TYPING.format({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), c: getDisplayName(guildId, typingUsersArray[1]) });
|
tooltipText = Formatters.Messages.THREE_USERS_TYPING.format({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), c: getDisplayName(guildId, typingUsersArray[2]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -24,7 +24,7 @@ import { findByCodeLazy } from "@webpack";
|
|||||||
import { GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
import { GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
const Avatar = findByCodeLazy(".Positions.TOP,spacing:");
|
const Avatar = findByCodeLazy('"top",spacing:');
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
showAvatars: {
|
showAvatars: {
|
||||||
|
@ -48,7 +48,7 @@ export default definePlugin({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// channel mentions
|
// channel mentions
|
||||||
find: ".EMOJI_IN_MESSAGE_HOVER",
|
find: ".shouldCloseDefaultModals",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /onClick:(\i)(?=,.{0,30}className:"channelMention")/,
|
match: /onClick:(\i)(?=,.{0,30}className:"channelMention")/,
|
||||||
replace: "onClick:(_vcEv)=>(_vcEv.detail>=2||_vcEv.target.className.includes('MentionText'))&&($1)()",
|
replace: "onClick:(_vcEv)=>(_vcEv.detail>=2||_vcEv.target.className.includes('MentionText'))&&($1)()",
|
||||||
|
@ -141,8 +141,8 @@ export function humanFriendlyJoin(elements: any[], mapper: (e: any) => string =
|
|||||||
* Calls .join(" ") on the arguments
|
* Calls .join(" ") on the arguments
|
||||||
* classes("one", "two") => "one two"
|
* classes("one", "two") => "one two"
|
||||||
*/
|
*/
|
||||||
export function classes(...classes: string[]) {
|
export function classes(...classes: Array<string | null | undefined>) {
|
||||||
return classes.filter(c => typeof c === "string").join(" ");
|
return classes.filter(Boolean).join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,10 +32,10 @@ export const Forms = {
|
|||||||
FormText: waitForComponent<t.FormText>("FormText", m => m.Types?.INPUT_PLACEHOLDER),
|
FormText: waitForComponent<t.FormText>("FormText", m => m.Types?.INPUT_PLACEHOLDER),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Card = waitForComponent<t.Card>("Card", m => m.Types?.PRIMARY === "cardPrimary");
|
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 Button = waitForComponent<t.Button>("Button", ["Hovers", "Looks", "Sizes"]);
|
||||||
export const Switch = waitForComponent<t.Switch>("Switch", filters.byCode("tooltipNote", "ringTarget"));
|
export const Switch = waitForComponent<t.Switch>("Switch", filters.byCode("tooltipNote", "ringTarget"));
|
||||||
export const Tooltip = waitForComponent<t.Tooltip>("Tooltip", ["Positions", "Colors"]);
|
export const Tooltip = waitForComponent<t.Tooltip>("Tooltip", filters.byCode("shouldShowTooltip:!1", "clickableOnMobile||"));
|
||||||
export const Timestamp = waitForComponent<t.Timestamp>("Timestamp", filters.byCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format"));
|
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 TextInput = waitForComponent<t.TextInput>("TextInput", ["defaultProps", "Sizes", "contextType"]);
|
||||||
export const TextArea = waitForComponent<t.TextArea>("TextArea", filters.byCode("handleSetRef", "textArea"));
|
export const TextArea = waitForComponent<t.TextArea>("TextArea", filters.byCode("handleSetRef", "textArea"));
|
||||||
@ -45,6 +45,10 @@ export const Text = waitForComponent<t.Text>("Text", m => {
|
|||||||
return (s.length < 1500 && s.includes("data-text-variant") && s.includes("always-white"));
|
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"));
|
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 Slider = waitForComponent<t.Slider>("Slider", filters.byCode("closestMarkerIndex", "stickToMarkers"));
|
||||||
export const Flex = waitForComponent<t.Flex>("Flex", ["Justify", "Align", "Wrap"]);
|
export const Flex = waitForComponent<t.Flex>("Flex", ["Justify", "Align", "Wrap"]);
|
||||||
|
|
||||||
|
48
src/webpack/common/types/components.d.ts
vendored
48
src/webpack/common/types/components.d.ts
vendored
@ -90,16 +90,17 @@ export type Tooltip = ComponentType<{
|
|||||||
|
|
||||||
/** Tooltip.Colors.BLACK */
|
/** Tooltip.Colors.BLACK */
|
||||||
color?: string;
|
color?: string;
|
||||||
/** Tooltip.Positions.TOP */
|
/** TooltipPositions.TOP */
|
||||||
position?: string;
|
position?: string;
|
||||||
|
|
||||||
tooltipClassName?: string;
|
tooltipClassName?: string;
|
||||||
tooltipContentClassName?: string;
|
tooltipContentClassName?: string;
|
||||||
}> & {
|
}> & {
|
||||||
Positions: Record<"BOTTOM" | "CENTER" | "LEFT" | "RIGHT" | "TOP" | "WINDOW_CENTER", string>;
|
|
||||||
Colors: Record<"BLACK" | "BRAND" | "CUSTOM" | "GREEN" | "GREY" | "PRIMARY" | "RED" | "YELLOW", string>;
|
Colors: Record<"BLACK" | "BRAND" | "CUSTOM" | "GREEN" | "GREY" | "PRIMARY" | "RED" | "YELLOW", string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TooltipPositions = Record<"BOTTOM" | "CENTER" | "LEFT" | "RIGHT" | "TOP" | "WINDOW_CENTER", string>;
|
||||||
|
|
||||||
export type Card = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement> & {
|
export type Card = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement> & {
|
||||||
editable?: boolean;
|
editable?: boolean;
|
||||||
outline?: boolean;
|
outline?: boolean;
|
||||||
@ -234,6 +235,49 @@ export type Select = ComponentType<PropsWithChildren<{
|
|||||||
"aria-labelledby"?: boolean;
|
"aria-labelledby"?: boolean;
|
||||||
}>>;
|
}>>;
|
||||||
|
|
||||||
|
export type SearchableSelect = ComponentType<PropsWithChildren<{
|
||||||
|
placeholder?: string;
|
||||||
|
options: ReadonlyArray<SelectOption>; // TODO
|
||||||
|
value?: SelectOption;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - 0 ~ Filled
|
||||||
|
* - 1 ~ Custom
|
||||||
|
*/
|
||||||
|
look?: 0 | 1;
|
||||||
|
className?: string;
|
||||||
|
popoutClassName?: string;
|
||||||
|
wrapperClassName?: string;
|
||||||
|
popoutPosition?: "top" | "left" | "right" | "bottom" | "center" | "window_center";
|
||||||
|
optionClassName?: string;
|
||||||
|
|
||||||
|
autoFocus?: boolean;
|
||||||
|
isDisabled?: boolean;
|
||||||
|
clearable?: boolean;
|
||||||
|
closeOnSelect?: boolean;
|
||||||
|
clearOnSelect?: boolean;
|
||||||
|
multi?: boolean;
|
||||||
|
|
||||||
|
onChange(value: any): void;
|
||||||
|
onSearchChange?(value: string): void;
|
||||||
|
|
||||||
|
onClose?(): void;
|
||||||
|
onOpen?(): void;
|
||||||
|
onBlur?(): void;
|
||||||
|
|
||||||
|
renderOptionPrefix?(option: SelectOption): ReactNode;
|
||||||
|
renderOptionSuffix?(option: SelectOption): ReactNode;
|
||||||
|
|
||||||
|
filter?(option: SelectOption[], query: string): SelectOption[];
|
||||||
|
|
||||||
|
centerCaret?: boolean;
|
||||||
|
debounceTime?: number;
|
||||||
|
maxVisibleItems?: number;
|
||||||
|
popoutWidth?: number;
|
||||||
|
|
||||||
|
"aria-labelledby"?: boolean;
|
||||||
|
}>>;
|
||||||
|
|
||||||
export type Slider = ComponentType<PropsWithChildren<{
|
export type Slider = ComponentType<PropsWithChildren<{
|
||||||
initialValue: number;
|
initialValue: number;
|
||||||
defaultValue?: number;
|
defaultValue?: number;
|
||||||
|
@ -307,13 +307,6 @@ export function findByPropsLazy(...props: string[]) {
|
|||||||
return findLazy(filters.byProps(...props));
|
return findLazy(filters.byProps(...props));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find all modules that have the specified properties
|
|
||||||
*/
|
|
||||||
export function findAllByProps(...props: string[]) {
|
|
||||||
return findAll(filters.byProps(...props));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a function by its code
|
* Find a function by its code
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user