bc-deeplib 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/deeplib.d.ts CHANGED
@@ -99,8 +99,6 @@ declare module 'bc-deeplib/base/base_subscreen' {
99
99
  * configuration options and a parent module reference.
100
100
  */
101
101
  export type Subscreen = new (subscreenOptions?: SubscreenOptions, module?: BaseModule) => BaseSubscreen;
102
- /** Retrieves the currently active subscreen from the global `GUI` instance. */
103
- export function getCurrentSubscreen(): BaseSubscreen | null;
104
102
  /** Switches the active subscreen in the global `GUI` instance. */
105
103
  export function setSubscreen(subscreen: BaseSubscreen | string | null): BaseSubscreen | null;
106
104
  /**
@@ -456,8 +454,14 @@ declare module 'bc-deeplib/migrators/base_migrator' {
456
454
 
457
455
  }
458
456
  declare module 'bc-deeplib/models/base' {
457
+ /**
458
+ * Represents the base settings structure for a mod.
459
+ * Present for all mods.
460
+ */
459
461
  export type BaseSettingsModel = {
462
+ /** Whether the mod is currently active. */
460
463
  modEnabled: boolean;
464
+ /** Whether to display a notification when a new version is detected. */
461
465
  doShowNewVersionMessage: boolean;
462
466
  };
463
467
 
@@ -473,28 +477,69 @@ declare module 'bc-deeplib/models/settings' {
473
477
  }
474
478
  declare module 'bc-deeplib/modules/gui' {
475
479
  import { BaseModule, BaseSubscreen, MainMenu } from 'bc-deeplib/deeplib';
480
+ /** Options for configuring a mod's main button in the extensions menu. */
476
481
  type ModButtonOptions = {
482
+ /**
483
+ * Unique identifier for the mod's settings button.
484
+ * Used internally by the preference system to track the button.
485
+ */
477
486
  Identifier: string;
487
+ /**
488
+ * The label displayed on the settings button.
489
+ * Can be a string or a function that returns a string dynamically.
490
+ */
478
491
  ButtonText: string | (() => string);
492
+ /**
493
+ * The path to or Base64 data of the icon for the settings button.
494
+ * Can be a string or a function that returns a string dynamically.
495
+ */
479
496
  Image: string | (() => string);
480
- load?: () => void;
481
- click?: () => void;
482
- run?: () => void;
483
- unload?: () => void;
484
- exit?: () => boolean | void;
485
497
  };
498
+ /**
499
+ * Central mod GUI controller that manages all subscreens.
500
+ *
501
+ * This module is responsible for:
502
+ * - Registering the mod's settings button in the game's preferences.
503
+ * - Managing subscreens (including settings screens for all registered modules).
504
+ * - Routing lifecycle events (load, run, click, exit, unload) to the active subscreen.
505
+ */
486
506
  export class GUI extends BaseModule {
507
+ /** The singleton instance of the GUI controller. */
487
508
  static instance: GUI | null;
509
+ /** All subscreens managed by this GUI, including the main menu and module settings screens. */
488
510
  private _subscreens;
511
+ /** The mod's main menu screen. */
489
512
  private _mainMenu;
513
+ /** The currently active subscreen, or `null` if none is active. */
490
514
  private _currentSubscreen;
515
+ /** Options defining how the mod's settings button is displayed and behaves. */
491
516
  private _modButtonOptions;
517
+ /** Returns all registered subscreens. */
492
518
  get subscreens(): BaseSubscreen[];
519
+ /** Returns the main menu subscreen instance. */
493
520
  get mainMenu(): MainMenu;
521
+ /** Returns the currently active subscreen. */
494
522
  get currentSubscreen(): BaseSubscreen | null;
523
+ /**
524
+ * Sets the current subscreen.
525
+ * Accepts either a `BaseSubscreen` instance or the `name` of a subscreen.
526
+ *
527
+ * @throws If a string is provided but no subscreen with that name exists.
528
+ */
495
529
  set currentSubscreen(subscreen: BaseSubscreen | string | null);
530
+ /**
531
+ * Creates the GUI instance and initializes the main menu.
532
+ *
533
+ * @throws If another `GUI` instance already exists.
534
+ */
496
535
  constructor(modButtonOptions: ModButtonOptions);
497
- get defaultSettings(): null;
536
+ /**
537
+ * Loads the GUI and registers the mod's settings button in the extensions menu.
538
+ *
539
+ * - Creates subscreens for each module's settings screen.
540
+ * - Registers lifecycle callbacks for subscreens events.
541
+ * - Sets up the main menu and its subscreens.
542
+ */
498
543
  load(): void;
499
544
  }
500
545
  export {};
@@ -502,19 +547,64 @@ declare module 'bc-deeplib/modules/gui' {
502
547
  }
503
548
  declare module 'bc-deeplib/modules/version' {
504
549
  import { BaseMigrator, BaseModule } from 'bc-deeplib/deeplib';
550
+ /**
551
+ * Handles version tracking, new version detection, and version-based migrations
552
+ * for the mod. Also manages displaying a "new version" message to players and
553
+ * executing registered migration routines when an update occurs.
554
+ *
555
+ * **Key Responsibilities:**
556
+ * - Track and store the current mod version in persistent player storage.
557
+ * - Detect if the mod has been updated since the last session.
558
+ * - Run version-specific migrations via registered `BaseMigrator` instances.
559
+ * - Optionally display a message to the user upon detecting a new version.
560
+ */
505
561
  export class VersionModule extends BaseModule {
562
+ /** Whether the current session is running a new version compared to stored data */
506
563
  private static isItNewVersion;
564
+ /** The current mod version (retrieved from `ModSdkManager.ModInfo.version`) */
507
565
  static Version: string;
566
+ /** Message to display when a new version is detected */
508
567
  static NewVersionMessage: string;
568
+ /** List of registered migration handlers, sorted by version */
509
569
  private static Migrators;
570
+ /**
571
+ * Initializes the module on load:
572
+ * - Stores the current mod version.
573
+ * - Hooks into `ChatRoomSync` to show a "new version" message when applicable.
574
+ */
510
575
  load(): void;
576
+ /**
577
+ * Checks if the stored version differs from the current version.
578
+ * If a new version is detected:
579
+ * - Flags the session as updated.
580
+ * - Runs applicable migrations.
581
+ * - Updates stored version in player data.
582
+ * - Saves `modStorage`.
583
+ */
511
584
  static checkVersionUpdate(): void;
585
+ /**
586
+ * Executes migrations for all registered migrators whose `MigrationVersion`
587
+ * is newer than the previously stored version.
588
+ */
512
589
  private static checkVersionMigration;
590
+ /**
591
+ * Registers a new migrator for handling version-specific changes.
592
+ * Migrators are sorted by their `MigrationVersion` in ascending order.
593
+ */
513
594
  static registerMigrator(migrator: BaseMigrator): void;
595
+ /** Sets the message that will be displayed when a new version is detected. */
514
596
  static setNewVersionMessage(newVersionMessage: string): void;
597
+ /** Sends the currently configured "new version" message to the local player. */
515
598
  static sendNewVersionMessage(): void;
599
+ /**
600
+ * Determines if a given `candidate` version is newer than the `current` version.
601
+ *
602
+ * Version strings are expected in `MAJOR.MINOR.PATCH` format.
603
+ */
516
604
  private static isNewVersion;
605
+ /** Saves the current mod version into persistent player storage. */
517
606
  private static saveVersion;
607
+ /** Loads the stored mod version from persistent player storage. */
518
608
  private static loadVersion;
519
609
  }
520
610
 
@@ -530,26 +620,47 @@ declare module 'bc-deeplib/screens/debug' {
530
620
  }
531
621
  declare module 'bc-deeplib/screens/import_export' {
532
622
  import { BaseSubscreen } from 'bc-deeplib/deeplib';
623
+ /**
624
+ * Configuration options for the {@link GuiImportExport} class.
625
+ */
533
626
  export type ImportExportOptions = {
534
- /** A custom save file extension. */
627
+ /**
628
+ * A custom save file extension (e.g., ".mydata").
629
+ * If it doesn't start with a dot, it will be automatically prefixed.
630
+ */
535
631
  customFileExtension: string;
536
- /** A callback to be called after data is imported. */
632
+ /** Optional callback invoked after data has been successfully imported. */
537
633
  onImport?: () => void;
538
- /** A callback to be called after data is exported. */
634
+ /** Optional callback invoked after data has been successfully exported. */
539
635
  onExport?: () => void;
540
636
  };
637
+ /**
638
+ * Possible data transfer methods for import/export operations.
639
+ * - `clipboard`: Uses the system clipboard.
640
+ * - `file`: Uses file save/load dialogs.
641
+ */
541
642
  type DataTransferMethod = 'clipboard' | 'file';
643
+ /**
644
+ * GUI screen for importing and exporting mod data.
645
+ * Provides buttons to import/export data either via file or clipboard.
646
+ */
542
647
  export class GuiImportExport extends BaseSubscreen {
543
648
  private importExportOptions;
544
649
  get name(): string;
545
650
  constructor(importExportOptions: ImportExportOptions);
546
651
  load(): void;
547
652
  resize(): void;
653
+ /** Exports the mod data using the specified method. */
548
654
  dataExport(transferMethod: DataTransferMethod): Promise<void>;
655
+ /** Imports mod data using the specified method. */
549
656
  dataImport(transferMethod: DataTransferMethod): Promise<void>;
657
+ /** Saves data to a file using the browser's save dialog. */
550
658
  exportToFile(data: string, defaultFileName: string): Promise<void>;
659
+ /** Opens a file picker and reads the selected file's contents, importing the data. */
551
660
  importFromFile(): Promise<string | null>;
661
+ /** Copies the given data to the clipboard. */
552
662
  exportToClipboard(data: string): Promise<void>;
663
+ /** Prompts the user to enter data and returns it. */
553
664
  importFromClipboard(): Promise<string | null>;
554
665
  }
555
666
  export {};
@@ -558,10 +669,30 @@ declare module 'bc-deeplib/screens/import_export' {
558
669
  declare module 'bc-deeplib/screens/main_menu' {
559
670
  import { BaseSubscreen, GUI } from 'bc-deeplib/deeplib';
560
671
  import { GuiImportExport } from 'bc-deeplib/screens/import_export';
672
+ /**
673
+ * Configuration options for the main menu.
674
+ *
675
+ * If these are defined, new button for each option will be added to the main menu.
676
+ */
561
677
  export type MainMenuOptions = {
678
+ /**
679
+ * Optional URL to the project's repository.
680
+ * Example: "https://github.com/user/project"
681
+ */
562
682
  repoLink?: string;
683
+ /**
684
+ * Optional URL to the project's wiki or documentation.
685
+ * Example: "https://github.com/user/project/wiki"
686
+ */
563
687
  wikiLink?: string;
688
+ /**
689
+ * Optional subscreen to use for the "reset" action.
690
+ */
564
691
  resetSubscreen?: BaseSubscreen;
692
+ /**
693
+ * Optional subscreen for import/export functionality.
694
+ * Provides tools to import or export data to or from the mod.
695
+ */
565
696
  importExportSubscreen?: GuiImportExport;
566
697
  };
567
698
  export class MainMenu extends BaseSubscreen {
@@ -579,19 +710,52 @@ declare module 'bc-deeplib/screens/main_menu' {
579
710
 
580
711
  }
581
712
  declare module 'bc-deeplib/utilities/common' {
713
+ /**
714
+ * Deeply merges properties from `source` into `target`.
715
+ * - If both target and source properties are arrays, concatenates them.
716
+ * - If both are objects, recursively merges them.
717
+ * - Otherwise, source overwrites target.
718
+ */
582
719
  export function deepMerge(target: any, source: any): any;
720
+ /**
721
+ * Returns a new array with elements of the input array shuffled.
722
+ * Uses something-something shuffle algorithm by splicing from a cloned array.
723
+ */
583
724
  export function shuffleArray(array: string[]): string[];
725
+ /**
726
+ * Exports a value to the global object under a nested namespace path.
727
+ * Creates intermediate objects if they do not exist.
728
+ *
729
+ * Example: `exportToGlobal('MyMod.Utils', value)` creates `globalThis.MyMod.Utils = value`.
730
+ */
584
731
  export function exportToGlobal(name: string, value: any): void;
585
- /** Merges matching properties from `mergeFrom` into `mergeTo`. */
732
+ /**
733
+ * Deeply merges only matching properties from `mergeFrom` into `mergeTo`.
734
+ * Properties not present in `mergeTo` are ignored.
735
+ * Objects are recursively merged, primitive properties overwritten.
736
+ */
586
737
  export function deepMergeMatchingProperties<T extends object>(mergeTo: T, mergeFrom: T): T;
738
+ /** Checks if the given property has a getter defined on the object or its prototype chain. */
587
739
  export function hasGetter<T extends object>(obj: T, prop: keyof T | string): boolean;
740
+ /** Checks if the given property has a setter defined on the object or its prototype chain. */
588
741
  export function hasSetter<T extends object>(obj: T, prop: keyof T | string): boolean;
589
742
 
590
743
  }
591
744
  declare module 'bc-deeplib/utilities/data' {
592
745
  import { SettingsModel } from 'bc-deeplib/deeplib';
746
+ /**
747
+ * ModStorage is a singleton class responsible for managing
748
+ * mod-specific persistent storage both in player settings
749
+ * and in browser localStorage.
750
+ *
751
+ * It provides methods to load and save mod data compressed
752
+ * as base64 strings, and exposes typed accessors for
753
+ * playerStorage and extensionStorage.
754
+ */
593
755
  export class ModStorage<T extends SettingsModel = SettingsModel> {
756
+ /** Singleton instance of ModStorage */
594
757
  private static _instance;
758
+ /** The unique mod identifier used as key prefix in storage */
595
759
  private modName;
596
760
  constructor(modName: string);
597
761
  get playerStorage(): T;
@@ -609,6 +773,10 @@ declare module 'bc-deeplib/utilities/data' {
609
773
  }
610
774
  declare module 'bc-deeplib/utilities/elements/elements' {
611
775
  import { Button, Checkbox, Custom, Input, Label } from 'bc-deeplib/base/elements_typings';
776
+ /**
777
+ * Collection of element creation utilities.
778
+ * Provides convenience wrappers for generating commonly used UI elements.
779
+ */
612
780
  export const advElement: {
613
781
  createButton: typeof elementCreateButton;
614
782
  createCheckbox: typeof elementCreateCheckbox;
@@ -643,41 +811,79 @@ declare module 'bc-deeplib/utilities/elements/elements' {
643
811
  }
644
812
  function elementPrevNext(options: PrevNext): HTMLElement;
645
813
  export type ModalButton<T extends string = string> = {
814
+ /** Button label text. */
646
815
  text: string;
816
+ /** Action identifier returned when the button is clicked. */
647
817
  action: T;
818
+ /** Whether the button is disabled. */
648
819
  disabled?: boolean;
649
820
  };
650
821
  export type ModalInputOptions = {
822
+ /** Default input value. */
651
823
  defaultValue?: string;
824
+ /** Makes the input read-only if true. */
652
825
  readOnly?: boolean;
826
+ /** Placeholder text. */
653
827
  placeholder?: string;
828
+ /** Input type. */
654
829
  type: 'input' | 'textarea';
830
+ /** Validation callback to check if the input value is valid. */
655
831
  validate?: (value: string) => string | null;
656
832
  };
657
833
  export type ModalOptions<T extends string = string> = {
834
+ /** Content or DOM node displayed in the modal header. */
658
835
  prompt: string | Node;
836
+ /** Optional input configuration. */
659
837
  input?: ModalInputOptions;
838
+ /** Buttons to display in the modal. */
660
839
  buttons?: ModalButton<T>[];
840
+ /** Whether clicking backdrop closes the modal (default: true). */
661
841
  closeOnBackdrop?: boolean;
842
+ /** Auto-close timeout in milliseconds. */
662
843
  timeoutMs?: number;
663
844
  };
845
+ /**
846
+ * Modal dialog implementation with queuing, buttons, optional input, and focus trapping.
847
+ * Multiple modals are queued to ensure only one is visible at a time.
848
+ */
664
849
  export class Modal<T extends string = string> {
665
850
  private opts;
666
851
  private dialog;
667
852
  private blocker;
668
853
  private inputEl?;
669
854
  private timeoutId?;
855
+ /** Static modal queue. */
670
856
  private static queue;
857
+ /** Flag to indicate if a modal is currently being shown. */
671
858
  private static processing;
672
859
  constructor(opts: ModalOptions<T>);
860
+ /**
861
+ * Displays the modal and resolves with the chosen action and input value.
862
+ */
673
863
  show(): Promise<[T, string | null]>;
864
+ /**
865
+ * Shows a simple alert modal with a single "OK" button.
866
+ */
674
867
  static alert(msg: string, timeoutMs?: number): Promise<void>;
868
+ /**
869
+ * Shows a confirmation modal with "Cancel" and "OK" buttons.
870
+ * Returns true if "OK" is clicked.
871
+ */
675
872
  static confirm(msg: string): Promise<boolean>;
873
+ /**
874
+ * Shows a prompt modal with an input field and "Submit"/"Cancel" buttons.
875
+ * Returns the input value if submitted, otherwise null.
876
+ */
676
877
  static prompt(msg: string, defaultValue?: string): Promise<string | null>;
878
+ /** Creates the input element for the modal, applying configuration and validation. */
677
879
  private renderInput;
880
+ /** Creates modal action buttons from configuration. */
678
881
  private renderButtons;
882
+ /** Creates the modal backdrop blocker with optional click-to-close behavior. */
679
883
  private createBlocker;
884
+ /** Implements a focus trap to keep keyboard navigation inside the modal. */
680
885
  private setupFocusTrap;
886
+ /** Closes the modal, cleans up DOM, resolves promise, and shows next queued modal. */
681
887
  private close;
682
888
  /**
683
889
  * An internal function where we will save promise function.
@@ -694,10 +900,34 @@ declare module 'bc-deeplib/utilities/elements/elements' {
694
900
  declare module 'bc-deeplib/utilities/elements/helpers' {
695
901
  import { SettingElement } from 'bc-deeplib/base/elements_typings';
696
902
  export const domUtil: {
903
+ /**
904
+ * Automatically sets the position of the element based on the given position.
905
+ * The position can be either a [x, y] tuple or a function returning such a tuple.
906
+ * If both x and y are defined, the element's position is updated accordingly.
907
+ */
697
908
  autoSetPosition: typeof autoSetPosition;
909
+ /**
910
+ * Automatically sets the size of the element based on the given size.
911
+ * The size can be either a [width, height] tuple or a function returning such a tuple.
912
+ * If both width and height are defined, the element's size is updated accordingly.
913
+ */
698
914
  autoSetSize: typeof autoSetSize;
915
+ /**
916
+ * Hides the element by setting its CSS display property to 'none'.
917
+ * If the element cannot be found, the function does nothing.
918
+ */
699
919
  hide: typeof hide;
920
+ /**
921
+ * Unhides the element by clearing its CSS display property (sets it to '').
922
+ * If the element cannot be found, the function does nothing.
923
+ */
700
924
  unhide: typeof unhide;
925
+ /**
926
+ * Checks if the element has overflow content.
927
+ * Returns an object indicating if there is any overflow,
928
+ * and specifically if there is vertical or horizontal overflow.
929
+ * Returns null if the element is not found.
930
+ */
701
931
  hasOverflow: typeof hasOverflow;
702
932
  };
703
933
  function autoSetPosition(_: ElementHelp.ElementOrId, position: SettingElement['position']): void;
@@ -770,6 +1000,10 @@ declare module 'bc-deeplib/utilities/messages' {
770
1000
 
771
1001
  }
772
1002
  declare module 'bc-deeplib/utilities/sdk' {
1003
+ /**
1004
+ * Defines priority levels for hooking functions.
1005
+ * Hooks with higher priority are called first in hook chain.
1006
+ */
773
1007
  export const HookPriority: {
774
1008
  Observe: number;
775
1009
  AddBehavior: number;
@@ -777,7 +1011,12 @@ declare module 'bc-deeplib/utilities/sdk' {
777
1011
  OverrideBehavior: number;
778
1012
  Top: number;
779
1013
  };
1014
+ /** Type alias representing module of hook? */
780
1015
  export type ModuleCategory = number | string;
1016
+ /**
1017
+ * Interface representing data about a patched function,
1018
+ * including the function name and all hooks applied to it.
1019
+ */
781
1020
  interface IPatchedFunctionData {
782
1021
  name: string;
783
1022
  hooks: {
@@ -787,16 +1026,41 @@ declare module 'bc-deeplib/utilities/sdk' {
787
1026
  removeCallback: () => void;
788
1027
  }[];
789
1028
  }
1029
+ /**
1030
+ * Manager class for mod SDK integration,
1031
+ * provides methods to register mods, hook functions, and manage patches.
1032
+ */
790
1033
  export class ModSdkManager {
791
1034
  private static SDK;
792
1035
  private static patchedFunctions;
793
1036
  static ModInfo: ModSDKModInfo;
1037
+ /** Registers a mod with the SDK and stores mod information. */
794
1038
  constructor(info: ModSDKModInfo, options?: ModSDKModOptions);
1039
+ /** Retrieves or initializes patch data for a given target function. */
795
1040
  initPatchableFunction(target: string): IPatchedFunctionData;
1041
+ /**
1042
+ * Hooks a function with a callback at a given priority.
1043
+ *
1044
+ * Prevents duplicate hooks.
1045
+ */
796
1046
  hookFunction<TargetName extends string>(target: TargetName, priority: number, hook: PatchHook<GetDotedPathType<typeof globalThis, TargetName>>, module?: ModuleCategory | null): () => void;
1047
+ /**
1048
+ * Applies patches to a target function.
1049
+ *
1050
+ * **This method is DANGEROUS** to use and has high potential to conflict with other mods.
1051
+ */
797
1052
  patchFunction(target: string, patches: Record<string, string>): void;
1053
+ /**
1054
+ * Removes all patches from a target function.
1055
+ */
798
1056
  unpatchFunction(target: string): void;
1057
+ /**
1058
+ * Removes all hooks associated with a specific module from a target function.
1059
+ */
799
1060
  removeHookByModule(target: string, module: ModuleCategory): boolean;
1061
+ /**
1062
+ * Removes all hooks associated with a specific module across all patched functions.
1063
+ */
800
1064
  removeAllHooksByModule(module: ModuleCategory): boolean;
801
1065
  }
802
1066
  export {};
@@ -804,36 +1068,78 @@ declare module 'bc-deeplib/utilities/sdk' {
804
1068
  }
805
1069
  declare module 'bc-deeplib/utilities/style' {
806
1070
  export const Style: {
1071
+ /**
1072
+ * Injects a CSS style block directly into the document head using a <style> tag.
1073
+ * If a style element with the same `styleId` already exists, it won't inject again.
1074
+ */
807
1075
  injectInline(styleId: string, styleSource: string): void;
1076
+ /**
1077
+ * Injects a CSS stylesheet link into the document head using a <link> tag.
1078
+ * If a link element with the same `styleId` already exists, it won't inject again.
1079
+ */
808
1080
  injectEmbed(styleId: string, styleLink: string): void;
1081
+ /**
1082
+ * Removes a style element from the document head by its ID.
1083
+ * Does nothing if the element is not found.
1084
+ */
809
1085
  eject(id: string): void;
1086
+ /**
1087
+ * Reloads an inline style by removing the existing style element (if any)
1088
+ * and injecting the new styles inline again.
1089
+ */
810
1090
  reload(styleId: string, styleSource: string): void;
1091
+ /** Fetches the text content of a stylesheet or any resource at the given link. */
811
1092
  fetch(link: string): Promise<string>;
812
1093
  };
813
1094
 
814
1095
  }
815
1096
  declare module 'bc-deeplib/utilities/translation' {
1097
+ /**
1098
+ * Options for initializing the Localization system.
1099
+ */
816
1100
  export interface TranslationOptions {
817
1101
  /** The path to the folder where the translations are stored. */
818
1102
  pathToTranslationsFolder?: string;
819
1103
  /** The default language to use. */
820
1104
  defaultLanguage?: string;
821
- /** If true, the localization will be fixed to the default language. */
1105
+ /** If true, the localization will be fixed to the default language, ignoring user language settings. */
822
1106
  fixedLanguage?: boolean;
823
1107
  }
1108
+ /**
1109
+ * Localization class handles loading and retrieving translation strings
1110
+ * from library and mod-specific language files.
1111
+ */
824
1112
  export class Localization {
825
1113
  private static LibTranslation;
826
1114
  private static ModTranslation;
827
1115
  private static PathToModTranslation;
828
1116
  private static PathToLibTranslation;
829
1117
  private static DefaultLanguage;
1118
+ /** Flag to prevent re-initialization */
830
1119
  private static initialized;
1120
+ /** Initialize the localization system by loading translation files. */
831
1121
  static init(initOptions?: TranslationOptions): Promise<void>;
1122
+ /** Get a translated string from mod translations by source tag. */
832
1123
  static getTextMod(srcTag: string): string | undefined;
1124
+ /** Get a translated string from library translations by source tag. */
833
1125
  static getTextLib(srcTag: string): string | undefined;
1126
+ /**
1127
+ * Fetch and parse a language file from the given base URL and language code.
1128
+ * Falls back to default language if the requested language file is unavailable.
1129
+ */
834
1130
  private static fetchLanguageFile;
1131
+ /**
1132
+ * Parse the raw content of a language file into a TranslationDict.
1133
+ * Ignores empty lines and comments starting with '#'.
1134
+ */
835
1135
  private static parseLanguageFile;
836
1136
  }
1137
+ /**
1138
+ * Retrieve a localized string for the given source tag.
1139
+ * First attempts to get the mod-specific translation,
1140
+ * then falls back to the library translation,
1141
+ * and if neither exist, returns the source tag itself.
1142
+ */
837
1143
  export const getText: (srcTag: string) => string;
838
1144
 
839
1145
  }