Skip to content

Commit

Permalink
Autogenerate ./types
Browse files Browse the repository at this point in the history
  • Loading branch information
krypciak committed Oct 29, 2024
1 parent 6f279f3 commit e51d378
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions types/gui/options/option-elements-inject.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { GuiOption } from '../../mod-options';
declare global {
namespace modmanager.gui {
interface OptionsObjectSlider extends sc.OPTION_GUIS_DEFS.OBJECT_SLIDER {
base: modmanager.gui.OptionsOptionRow;
currentNumber: sc.TextGui;
}
interface OptionsObjectSliderConstructor extends ImpactClass<OptionsObjectSlider> {
new (optionRow: sc.OptionRow, x: number, rowGroup: sc.RowButtonGroup): OptionsObjectSlider;
}
var OptionsObjectSlider: OptionsObjectSliderConstructor;
}
}
declare global {
namespace modmanager.gui {
interface OptionsOptionInfoBox extends ig.GuiElementBase {
Expand Down
14 changes: 14 additions & 0 deletions types/mod-options.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
export type Enum = Record<string, number>;
/** Option that has state that can change */
export interface OptionChangeable {
/** Does the option require a game restart to take effect */
restart?: boolean;
/** Option change callback */
changeEvent?: (this: GuiOption) => void;
/** Redraw the menu on option change */
updateMenuOnChange?: boolean;
/** Prevent the option from resetting the settings using the "Reset Settings" */
preventResettingToDefault?: boolean;
}
/** A option entry */
export type Option = {
/** Option display name */
name?: ig.LangLabel.Data;
/** Option description */
description?: ig.LangLabel.Data;
/** Is the option hidden from the menu */
hidden?: boolean | (() => boolean);
} & (BUTTON_GROUP | ARRAY_SLIDER | OBJECT_SILDER | CHECKBOX | CONTROLS | INFO | BUTTON | JSON_DATA);
type BUTTON_GROUP = OptionChangeable & {
type: 'BUTTON_GROUP';
/** Initial option value */
init: number;
/** Button display names */
buttonNames?: string[];
} & ({
enum: Enum;
Expand All @@ -36,6 +46,8 @@ type OBJECT_SILDER = OptionChangeable & {
snap?: boolean;
fill?: boolean;
showPercentage?: boolean;
/** Force the thumb width (values below 30 will be ignored) */
thumbWidth?: number;
customNumberDisplay?: (index: number) => number | string;
} & ({
min: number;
Expand Down Expand Up @@ -68,6 +80,8 @@ interface CONTROLS {
};
pressEvent?: () => void;
holdEvent?: () => void;
/** If false, the keybinding only works in-game
If true, the keybinding works everywhere */
global?: boolean;
data?: undefined;
}
Expand Down
1 change: 1 addition & 0 deletions types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export declare function registerOpts(): {
readonly manualEnforcerRead: {
readonly type: "JSON_DATA";
readonly init: Record<string, boolean>;
readonly preventResettingToDefault: true;
};
};
readonly advanced: {
Expand Down

0 comments on commit e51d378

Please sign in to comment.