bump dependencies, migrate to new Vencord Switch component

This commit is contained in:
Vendicated
2025-10-07 00:37:45 +02:00
parent a55b1f0250
commit 8cc34e217c
9 changed files with 556 additions and 573 deletions

View File

@@ -34,15 +34,15 @@
}, },
"devDependencies": { "devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2", "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@stylistic/eslint-plugin": "^5.3.1", "@stylistic/eslint-plugin": "^5.4.0",
"@types/node": "^24.3.1", "@types/node": "^24.7.0",
"@types/react": "18.3.1", "@types/react": "19.2.1",
"@vencord/types": "^1.11.5", "@vencord/types": "^1.13.2",
"dotenv": "^17.2.2", "dotenv": "^17.2.3",
"electron": "^38.0.0", "electron": "^38.0.0",
"electron-builder": "^26.0.12", "electron-builder": "^26.0.12",
"esbuild": "^0.25.9", "esbuild": "^0.25.10",
"eslint": "^9.34.0", "eslint": "^9.37.0",
"eslint-import-resolver-alias": "^1.1.2", "eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-path-alias": "^2.1.0", "eslint-plugin-path-alias": "^2.1.0",
"eslint-plugin-prettier": "^5.5.4", "eslint-plugin-prettier": "^5.5.4",
@@ -51,11 +51,11 @@
"eslint-plugin-unused-imports": "^4.2.0", "eslint-plugin-unused-imports": "^4.2.0",
"prettier": "^3.6.2", "prettier": "^3.6.2",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"tsx": "^4.20.5", "tsx": "^4.20.6",
"type-fest": "^4.41.0", "type-fest": "^5.0.1",
"typescript": "^5.9.2", "typescript": "^5.9.3",
"typescript-eslint": "^8.42.0", "typescript-eslint": "^8.46.0",
"xml-formatter": "^3.6.6" "xml-formatter": "^3.6.7"
}, },
"packageManager": "pnpm@10.7.1", "packageManager": "pnpm@10.7.1",
"engines": { "engines": {

944
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,19 +6,10 @@
import "./screenSharePicker.css"; import "./screenSharePicker.css";
import { FormSwitch } from "@vencord/types/components";
import { closeModal, Logger, Modals, ModalSize, openModal, useAwaiter } from "@vencord/types/utils"; import { closeModal, Logger, Modals, ModalSize, openModal, useAwaiter } from "@vencord/types/utils";
import { onceReady } from "@vencord/types/webpack"; import { onceReady } from "@vencord/types/webpack";
import { import { Button, Card, FluxDispatcher, Forms, Select, Text, UserStore, useState } from "@vencord/types/webpack/common";
Button,
Card,
FluxDispatcher,
Forms,
Select,
Switch,
Text,
UserStore,
useState
} from "@vencord/types/webpack/common";
import { Node } from "@vencord/venmic"; import { Node } from "@vencord/venmic";
import type { Dispatch, SetStateAction } from "react"; import type { Dispatch, SetStateAction } from "react";
import { MediaEngineStore } from "renderer/common"; import { MediaEngineStore } from "renderer/common";
@@ -202,67 +193,64 @@ function AudioSettingsModal({
<Modals.ModalCloseButton onClick={close} /> <Modals.ModalCloseButton onClick={close} />
</Modals.ModalHeader> </Modals.ModalHeader>
<Modals.ModalContent className={cl("modal")}> <Modals.ModalContent className={cl("modal")}>
<Switch <FormSwitch
hideBorder title="Microphone Workaround"
onChange={v => (Settings.audio = { ...Settings.audio, workaround: v })} description={
value={Settings.audio?.workaround ?? false}
note={
<> <>
Work around an issue that causes the microphone to be shared instead of the correct audio. Work around an issue that causes the microphone to be shared instead of the correct audio.
Only enable if you're experiencing this issue. Only enable if you're experiencing this issue.
</> </>
} }
>
Microphone Workaround
</Switch>
<Switch
hideBorder hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, onlySpeakers: v })} onChange={v => (Settings.audio = { ...Settings.audio, workaround: v })}
value={Settings.audio?.onlySpeakers ?? true} value={Settings.audio?.workaround ?? false}
note={ />
<FormSwitch
title="Only Speakers"
description={
<> <>
When sharing entire desktop audio, only share apps that play to a speaker. You may want to When sharing entire desktop audio, only share apps that play to a speaker. You may want to
disable this when using "mix bussing". disable this when using "mix bussing".
</> </>
} }
>
Only Speakers
</Switch>
<Switch
hideBorder hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, onlyDefaultSpeakers: v })} onChange={v => (Settings.audio = { ...Settings.audio, onlySpeakers: v })}
value={Settings.audio?.onlyDefaultSpeakers ?? true} value={Settings.audio?.onlySpeakers ?? true}
note={ />
<FormSwitch
title="Only Default Speakers"
description={
<> <>
When sharing entire desktop audio, only share apps that play to the <b>default</b> speakers. When sharing entire desktop audio, only share apps that play to the <b>default</b> speakers.
You may want to disable this when using "mix bussing". You may want to disable this when using "mix bussing".
</> </>
} }
> hideBorder
Only Default Speakers onChange={v => (Settings.audio = { ...Settings.audio, onlyDefaultSpeakers: v })}
</Switch> value={Settings.audio?.onlyDefaultSpeakers ?? true}
<Switch />
<FormSwitch
title="Ignore Inputs"
description={<>Exclude nodes that are intended to capture audio.</>}
hideBorder hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, ignoreInputMedia: v })} onChange={v => (Settings.audio = { ...Settings.audio, ignoreInputMedia: v })}
value={Settings.audio?.ignoreInputMedia ?? true} value={Settings.audio?.ignoreInputMedia ?? true}
note={<>Exclude nodes that are intended to capture audio.</>} />
> <FormSwitch
Ignore Inputs title="Ignore Virtual"
</Switch> description={
<Switch
hideBorder
onChange={v => (Settings.audio = { ...Settings.audio, ignoreVirtual: v })}
value={Settings.audio?.ignoreVirtual ?? false}
note={
<> <>
Exclude virtual nodes, such as nodes belonging to loopbacks. This might be useful when using Exclude virtual nodes, such as nodes belonging to loopbacks. This might be useful when using
"mix bussing". "mix bussing".
</> </>
} }
> hideBorder
Ignore Virtual onChange={v => (Settings.audio = { ...Settings.audio, ignoreVirtual: v })}
</Switch> value={Settings.audio?.ignoreVirtual ?? false}
<Switch />
<FormSwitch
title="Ignore Devices"
description={<>Exclude device nodes, such as nodes belonging to microphones or speakers.</>}
hideBorder hideBorder
onChange={v => onChange={v =>
(Settings.audio = { (Settings.audio = {
@@ -272,22 +260,25 @@ function AudioSettingsModal({
}) })
} }
value={Settings.audio?.ignoreDevices ?? true} value={Settings.audio?.ignoreDevices ?? true}
note={<>Exclude device nodes, such as nodes belonging to microphones or speakers.</>} />
> <FormSwitch
Ignore Devices title="Granular Selection"
</Switch> description={<>Allow to select applications more granularly.</>}
<Switch
hideBorder hideBorder
onChange={value => { onChange={value => {
Settings.audio = { ...Settings.audio, granularSelect: value }; Settings.audio = { ...Settings.audio, granularSelect: value };
setAudioSources("None"); setAudioSources("None");
}} }}
value={Settings.audio?.granularSelect ?? false} value={Settings.audio?.granularSelect ?? false}
note={<>Allow to select applications more granularly.</>} />
> <FormSwitch
Granular Selection title="Device Selection"
</Switch> description={
<Switch <>
Allow to select devices such as microphones. Requires <b>Ignore Devices</b> to be turned
off.
</>
}
hideBorder hideBorder
onChange={value => { onChange={value => {
Settings.audio = { ...Settings.audio, deviceSelect: value }; Settings.audio = { ...Settings.audio, deviceSelect: value };
@@ -295,15 +286,7 @@ function AudioSettingsModal({
}} }}
value={Settings.audio?.deviceSelect ?? false} value={Settings.audio?.deviceSelect ?? false}
disabled={Settings.audio?.ignoreDevices} disabled={Settings.audio?.ignoreDevices}
note={ />
<>
Allow to select devices such as microphones. Requires <b>Ignore Devices</b> to be turned
off.
</>
}
>
Device Selection
</Switch>
</Modals.ModalContent> </Modals.ModalContent>
<Modals.ModalFooter className={cl("footer")}> <Modals.ModalFooter className={cl("footer")}>
<Button color={Button.Colors.TRANSPARENT} onClick={close}> <Button color={Button.Colors.TRANSPARENT} onClick={close}>
@@ -427,14 +410,13 @@ function StreamSettingsUi({
</div> </div>
</div> </div>
{isWindows && ( {isWindows && (
<Switch <FormSwitch
title="Stream With Audio"
hideBorder
value={settings.audio} value={settings.audio}
onChange={checked => setSettings(s => ({ ...s, audio: checked }))} onChange={checked => setSettings(s => ({ ...s, audio: checked }))}
hideBorder
className={cl("audio")} className={cl("audio")}
> />
Stream With Audio
</Switch>
)} )}
</section> </section>
</div> </div>

View File

@@ -14,14 +14,13 @@ export const AutoStartToggle: SettingsComponent = () => {
return ( return (
<VesktopSettingsSwitch <VesktopSettingsSwitch
title="Start With System"
description="Automatically start Vesktop on computer start-up"
value={autoStartEnabled} value={autoStartEnabled}
onChange={async v => { onChange={async v => {
await VesktopNative.autostart[v ? "enable" : "disable"](); await VesktopNative.autostart[v ? "enable" : "disable"]();
setAutoStartEnabled(v); setAutoStartEnabled(v);
}} }}
note="Automatically start Vesktop on computer start-up" />
>
Start With System
</VesktopSettingsSwitch>
); );
}; };

View File

@@ -12,15 +12,14 @@ import { VesktopSettingsSwitch } from "./VesktopSettingsSwitch";
export const NotificationBadgeToggle: SettingsComponent = ({ settings }) => { export const NotificationBadgeToggle: SettingsComponent = ({ settings }) => {
return ( return (
<VesktopSettingsSwitch <VesktopSettingsSwitch
title="Notification Badge"
description="Show mention badge on the app icon"
value={settings.appBadge ?? true} value={settings.appBadge ?? true}
onChange={v => { onChange={v => {
settings.appBadge = v; settings.appBadge = v;
if (v) setBadge(); if (v) setBadge();
else VesktopNative.app.setBadgeCount(0); else VesktopNative.app.setBadgeCount(0);
}} }}
note="Show mention badge on the app icon" />
>
Notification Badge
</VesktopSettingsSwitch>
); );
}; };

View File

@@ -158,14 +158,13 @@ function SettingsSections() {
return ( return (
<VesktopSettingsSwitch <VesktopSettingsSwitch
title={title}
description={description}
value={Settings[key as any] ?? defaultValue} value={Settings[key as any] ?? defaultValue}
onChange={v => (Settings[key as any] = v)} onChange={v => (Settings[key as any] = v)}
note={description}
disabled={disabled?.()} disabled={disabled?.()}
key={key} key={key}
> />
{title}
</VesktopSettingsSwitch>
); );
})} })}
</div> </div>
@@ -181,8 +180,6 @@ export default ErrorBoundary.wrap(
function SettingsUI() { function SettingsUI() {
return ( return (
<Forms.FormSection> <Forms.FormSection>
{/* FIXME: Outdated type */}
{/* @ts-expect-error Outdated type */}
<Text variant="heading-xl/semibold" color="header-primary" className="vcd-settings-title"> <Text variant="heading-xl/semibold" color="header-primary" className="vcd-settings-title">
Vesktop Settings Vesktop Settings
</Text> </Text>

View File

@@ -4,13 +4,9 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { Switch } from "@vencord/types/webpack/common"; import { FormSwitch } from "@vencord/types/components";
import { ComponentProps } from "react"; import { ComponentProps } from "react";
export function VesktopSettingsSwitch(props: ComponentProps<typeof Switch>) { export function VesktopSettingsSwitch(props: ComponentProps<typeof FormSwitch>) {
return ( return <FormSwitch {...props} hideBorder className="vcd-settings-switch" />;
<Switch {...props} hideBorder className="vcd-settings-switch">
{props.children}
</Switch>
);
} }

View File

@@ -49,7 +49,7 @@ export interface State {
maximized?: boolean; maximized?: boolean;
minimized?: boolean; minimized?: boolean;
windowBounds?: Rectangle; windowBounds?: Rectangle;
displayId: int; displayId: number;
firstLaunch?: boolean; firstLaunch?: boolean;

View File

@@ -10,7 +10,7 @@
"target": "ESNEXT", "target": "ESNEXT",
"jsx": "preserve", "jsx": "preserve",
// we have duplicate electron types but it's w/e // @vencord/types has some errors for now
"skipLibCheck": true, "skipLibCheck": true,
"baseUrl": "./src/", "baseUrl": "./src/",