diff options
author | megumin <megumin.bakaretsurie@gmail.com> | 2022-10-19 20:57:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 21:57:27 +0200 |
commit | 1f50f78912caeeff1c65182d61b72e6ec95b9899 (patch) | |
tree | 8b1bc59c606617d7a8c39951950dc3c3e7bfd074 /src/utils | |
parent | efab399309a44f8ea6a783abd13c49abb8cd6e38 (diff) | |
download | Vencord-1f50f78912caeeff1c65182d61b72e6ec95b9899.tar.gz Vencord-1f50f78912caeeff1c65182d61b72e6ec95b9899.tar.bz2 Vencord-1f50f78912caeeff1c65182d61b72e6ec95b9899.zip |
feat: settings sliders (#120)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/types.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/utils/types.ts b/src/utils/types.ts index 5ed95e4..1318799 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -70,13 +70,15 @@ export enum OptionType { BIGINT, BOOLEAN, SELECT, + SLIDER, } export type PluginOptionsItem = | PluginOptionString | PluginOptionNumber | PluginOptionBoolean - | PluginOptionSelect; + | PluginOptionSelect + | PluginOptionSlider; export interface PluginOptionBase { description: string; @@ -132,4 +134,24 @@ export interface PluginOptionSelectOption { default?: boolean; } +export interface PluginOptionSlider extends PluginOptionBase { + type: OptionType.SLIDER; + /** + * All the possible values in the slider. Needs at least two values. + */ + markers: number[]; + /** + * Default value to use + */ + default: number; + /** + * If false, allow users to select values in-between your markers. + */ + stickToMarkers?: boolean; + /** + * Prevents the user from saving settings if this is false or a string + */ + isValid?(value: number): number; +} + export type IpcRes<V = any> = { ok: true; value: V; } | { ok: false, error: any; }; |