bc-deeplib 2.4.2 → 4.0.0
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 +194 -118
- package/dist/deeplib.js +24 -2830
- package/dist/deeplib.js.map +4 -4
- package/dist/public/dl_translations/en.lang +8 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vendored_types/declarations.d.ts +10 -1
- package/dist/vendored_types/utility.d.ts +3 -1
- package/lib/build.js +15 -13
- package/package.json +11 -8
package/dist/deeplib.d.ts
CHANGED
|
@@ -38,15 +38,14 @@ declare module 'bc-deeplib/base/base_module' {
|
|
|
38
38
|
* Retrieves the current settings for this module.
|
|
39
39
|
* If no settings exist yet, registers default settings first.
|
|
40
40
|
*/
|
|
41
|
-
get settings(): BaseSettingsModel;
|
|
41
|
+
get settings(): BaseSettingsModel | null;
|
|
42
42
|
/**
|
|
43
43
|
* Persists new settings for this module.
|
|
44
44
|
* Automatically initializes storage and defaults if they don't exist.
|
|
45
45
|
*/
|
|
46
|
-
set settings(value: BaseSettingsModel);
|
|
46
|
+
set settings(value: BaseSettingsModel | null);
|
|
47
47
|
/**
|
|
48
48
|
* Initializes the module.
|
|
49
|
-
* Default implementation registers default settings immediately.
|
|
50
49
|
* Subclasses can override to perform additional setup.
|
|
51
50
|
*/
|
|
52
51
|
init(): void;
|
|
@@ -257,9 +256,9 @@ declare module 'bc-deeplib/base/elements_typings' {
|
|
|
257
256
|
export type SettingElement = Button | Checkbox | Input | Label | Dropdown | Custom;
|
|
258
257
|
export type BaseElementModel = {
|
|
259
258
|
id: string;
|
|
260
|
-
size?: [width: number | null, height: number | null]
|
|
261
|
-
position?: [x: number, y: number
|
|
262
|
-
disabled?: boolean
|
|
259
|
+
size?: Thunk<[width: number | null, height: number | null]>;
|
|
260
|
+
position?: Thunk<[x: number, y: number, anchor?: ElementHelp.AnchorXY]>;
|
|
261
|
+
disabled?: Thunk<boolean>;
|
|
263
262
|
};
|
|
264
263
|
export type Button = Prettify<{
|
|
265
264
|
id: Parameters<typeof ElementButton.Create>[0];
|
|
@@ -271,7 +270,7 @@ declare module 'bc-deeplib/base/elements_typings' {
|
|
|
271
270
|
export type Checkbox = Prettify<{
|
|
272
271
|
type: 'checkbox';
|
|
273
272
|
label?: string;
|
|
274
|
-
description?:
|
|
273
|
+
description?: ElementButton.StaticNode;
|
|
275
274
|
setElementValue?: () => boolean;
|
|
276
275
|
setSettingValue?: (val: boolean) => void;
|
|
277
276
|
htmlOptions?: Partial<Record<'container' | 'checkbox' | 'label', Omit<HTMLOptions<any>, 'tag'>>> | null | undefined;
|
|
@@ -279,7 +278,7 @@ declare module 'bc-deeplib/base/elements_typings' {
|
|
|
279
278
|
export type Input = Prettify<{
|
|
280
279
|
type: 'text' | 'number' | 'color';
|
|
281
280
|
label?: string;
|
|
282
|
-
description?:
|
|
281
|
+
description?: ElementButton.StaticNode;
|
|
283
282
|
setElementValue?: () => string;
|
|
284
283
|
setSettingValue?: (val: string) => void;
|
|
285
284
|
htmlOptions?: Partial<Record<'container' | 'input' | 'label', Omit<HTMLOptions<any>, 'tag'>>> | null | undefined;
|
|
@@ -288,7 +287,7 @@ declare module 'bc-deeplib/base/elements_typings' {
|
|
|
288
287
|
id: Parameters<typeof ElementCreateDropdown>[0];
|
|
289
288
|
type: 'dropdown';
|
|
290
289
|
label?: string;
|
|
291
|
-
description?:
|
|
290
|
+
description?: ElementButton.StaticNode;
|
|
292
291
|
optionsList: Parameters<typeof ElementCreateDropdown>[1];
|
|
293
292
|
setElementValue?: () => string;
|
|
294
293
|
setSettingValue?: (val: string) => void;
|
|
@@ -302,7 +301,7 @@ declare module 'bc-deeplib/base/elements_typings' {
|
|
|
302
301
|
export type Label = Prettify<{
|
|
303
302
|
type: 'label';
|
|
304
303
|
label?: string;
|
|
305
|
-
description?:
|
|
304
|
+
description?: ElementButton.StaticNode;
|
|
306
305
|
htmlOptions?: Omit<HTMLOptions<any>, 'tag'>;
|
|
307
306
|
} & BaseElementModel>;
|
|
308
307
|
export type Custom = Prettify<{
|
|
@@ -312,25 +311,29 @@ declare module 'bc-deeplib/base/elements_typings' {
|
|
|
312
311
|
|
|
313
312
|
}
|
|
314
313
|
declare module 'bc-deeplib/base/initialization' {
|
|
315
|
-
import {
|
|
314
|
+
import { ModSdkManager, ModStorage, MainMenuOptions, TranslationOptions, Logger, ModulesList } from 'bc-deeplib/deeplib';
|
|
316
315
|
/** Configuration object for initializing a mod via `initMod`. */
|
|
317
316
|
interface InitOptions {
|
|
318
317
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* - `options` — Optional runtime configuration for the Mod SDK.
|
|
318
|
+
* Name of the mod.
|
|
319
|
+
* Used to identify the mod in the Mod SDK and storage.
|
|
322
320
|
*/
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
modName: string;
|
|
322
|
+
/**
|
|
323
|
+
* Repository URL for the mod.
|
|
324
|
+
* Used to register the mod with the Mod SDK and display in the main menu.
|
|
325
|
+
*/
|
|
326
|
+
modRepository?: string;
|
|
327
327
|
/**
|
|
328
328
|
* List of modules (`BaseModule` subclasses) to register with the mod system.
|
|
329
329
|
* Modules are initialized, loaded, and run in order.
|
|
330
330
|
*/
|
|
331
|
-
modules?:
|
|
332
|
-
/**
|
|
333
|
-
|
|
331
|
+
modules?: Partial<ModulesList>;
|
|
332
|
+
/**
|
|
333
|
+
* Configuration for customizing the main menu when the mod is active.
|
|
334
|
+
* Does nothing if GUI module is not loaded.
|
|
335
|
+
*/
|
|
336
|
+
mainMenuOptions?: Prettify<Omit<MainMenuOptions, 'repoLink'>>;
|
|
334
337
|
/**
|
|
335
338
|
* Optional hook executed *before* login when the player is not yet authenticated.
|
|
336
339
|
* Useful for pre-login setup or display changes.
|
|
@@ -358,7 +361,8 @@ declare module 'bc-deeplib/base/initialization' {
|
|
|
358
361
|
* Mod specific logger instance.
|
|
359
362
|
* Initialized by `initMod()`.
|
|
360
363
|
*/
|
|
361
|
-
export let
|
|
364
|
+
export let modLogger: Logger;
|
|
365
|
+
export let MOD_NAME: string;
|
|
362
366
|
/**
|
|
363
367
|
* Entry point for initializing a mod. Handles:
|
|
364
368
|
* - Setting up the Mod SDK
|
|
@@ -376,14 +380,14 @@ declare module 'bc-deeplib/base/initialization' {
|
|
|
376
380
|
|
|
377
381
|
}
|
|
378
382
|
declare module 'bc-deeplib/base/modules' {
|
|
379
|
-
import {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
export
|
|
383
|
+
import { GUI, VersionModule } from 'bc-deeplib/deeplib';
|
|
384
|
+
import { DebugModule } from 'bc-deeplib/modules/debug';
|
|
385
|
+
export interface ModulesList {
|
|
386
|
+
VersionModule: VersionModule;
|
|
387
|
+
GUI: GUI;
|
|
388
|
+
DebugModule: DebugModule;
|
|
389
|
+
}
|
|
390
|
+
export type ModuleKey = Prettify<keyof ModulesList>;
|
|
387
391
|
/**
|
|
388
392
|
* Retrieves all registered module instances.
|
|
389
393
|
*
|
|
@@ -400,7 +404,7 @@ declare module 'bc-deeplib/base/modules' {
|
|
|
400
404
|
* }
|
|
401
405
|
* ```
|
|
402
406
|
*/
|
|
403
|
-
export function modules():
|
|
407
|
+
export function modules(): ModulesList[ModuleKey][];
|
|
404
408
|
/**
|
|
405
409
|
* Registers a module instance in the global registry.
|
|
406
410
|
*
|
|
@@ -416,7 +420,7 @@ declare module 'bc-deeplib/base/modules' {
|
|
|
416
420
|
* registerModule(new MyGlobalModule());
|
|
417
421
|
* ```
|
|
418
422
|
*/
|
|
419
|
-
export function registerModule<
|
|
423
|
+
export function registerModule<K extends ModuleKey>(key: K, module: ModulesList[K]): ModulesList[K];
|
|
420
424
|
/**
|
|
421
425
|
* Retrieves a registered module by its type name.
|
|
422
426
|
*
|
|
@@ -432,7 +436,7 @@ declare module 'bc-deeplib/base/modules' {
|
|
|
432
436
|
* themeModule?.reloadTheme();
|
|
433
437
|
* ```
|
|
434
438
|
*/
|
|
435
|
-
export function getModule<
|
|
439
|
+
export function getModule<K extends ModuleKey>(key: K): ModulesList[K];
|
|
436
440
|
|
|
437
441
|
}
|
|
438
442
|
declare module 'bc-deeplib/deeplib' {
|
|
@@ -446,6 +450,7 @@ declare module 'bc-deeplib/deeplib' {
|
|
|
446
450
|
export * from 'bc-deeplib/models/settings';
|
|
447
451
|
export * from 'bc-deeplib/modules/gui';
|
|
448
452
|
export * from 'bc-deeplib/modules/version';
|
|
453
|
+
export * from 'bc-deeplib/modules/debug';
|
|
449
454
|
export * from 'bc-deeplib/screens/debug';
|
|
450
455
|
export * from 'bc-deeplib/screens/main_menu';
|
|
451
456
|
export * from 'bc-deeplib/screens/import_export';
|
|
@@ -453,6 +458,7 @@ declare module 'bc-deeplib/deeplib' {
|
|
|
453
458
|
export * from 'bc-deeplib/utilities/elements/elements';
|
|
454
459
|
export * from 'bc-deeplib/utilities/elements/helpers';
|
|
455
460
|
export * from 'bc-deeplib/utilities/elements/layout';
|
|
461
|
+
export * from 'bc-deeplib/utilities/elements/modal';
|
|
456
462
|
export * from 'bc-deeplib/utilities/common';
|
|
457
463
|
export * from 'bc-deeplib/utilities/logger';
|
|
458
464
|
export * from 'bc-deeplib/utilities/messages';
|
|
@@ -519,6 +525,29 @@ declare module 'bc-deeplib/models/settings' {
|
|
|
519
525
|
Version: string;
|
|
520
526
|
};
|
|
521
527
|
|
|
528
|
+
}
|
|
529
|
+
declare module 'bc-deeplib/modules/debug' {
|
|
530
|
+
import { BaseModule } from 'bc-deeplib/deeplib';
|
|
531
|
+
interface DebugSettings {
|
|
532
|
+
showRawTranslations: boolean;
|
|
533
|
+
showFileNames: boolean;
|
|
534
|
+
showIncomingServerTransactions: boolean;
|
|
535
|
+
incomingMessageFilterMode: 'include' | 'exclude';
|
|
536
|
+
incomingMessageTypes: string;
|
|
537
|
+
showOutcomingServerTransactions: boolean;
|
|
538
|
+
outcomingMessageFilterMode: 'include' | 'exclude';
|
|
539
|
+
outcomingMessageTypes: string;
|
|
540
|
+
showRawActivityNames: boolean;
|
|
541
|
+
showRawAssetNames: boolean;
|
|
542
|
+
}
|
|
543
|
+
export class DebugModule extends BaseModule {
|
|
544
|
+
debugSettings: DebugSettings;
|
|
545
|
+
load(): void;
|
|
546
|
+
unload(): void;
|
|
547
|
+
saveDebugSettings(): void;
|
|
548
|
+
}
|
|
549
|
+
export {};
|
|
550
|
+
|
|
522
551
|
}
|
|
523
552
|
declare module 'bc-deeplib/modules/gui' {
|
|
524
553
|
import { BaseModule, BaseSubscreen, MainMenu } from 'bc-deeplib/deeplib';
|
|
@@ -533,12 +562,12 @@ declare module 'bc-deeplib/modules/gui' {
|
|
|
533
562
|
* The label displayed on the settings button.
|
|
534
563
|
* Can be a string or a function that returns a string dynamically.
|
|
535
564
|
*/
|
|
536
|
-
buttonText: string
|
|
565
|
+
buttonText: Thunk<string>;
|
|
537
566
|
/**
|
|
538
567
|
* The path to or Base64 data of the icon for the settings button.
|
|
539
568
|
* Can be a string or a function that returns a string dynamically.
|
|
540
569
|
*/
|
|
541
|
-
image: string
|
|
570
|
+
image: Thunk<string>;
|
|
542
571
|
/**
|
|
543
572
|
* The main menu screen for the mod.
|
|
544
573
|
*/
|
|
@@ -625,7 +654,7 @@ declare module 'bc-deeplib/modules/version' {
|
|
|
625
654
|
private static afterEach?;
|
|
626
655
|
private static beforeAll?;
|
|
627
656
|
private static afterAll?;
|
|
628
|
-
constructor(options
|
|
657
|
+
constructor(options?: VersionModuleOptions);
|
|
629
658
|
/**
|
|
630
659
|
* Initializes the module on load:
|
|
631
660
|
* - Stores the current mod version.
|
|
@@ -664,9 +693,12 @@ declare module 'bc-deeplib/modules/version' {
|
|
|
664
693
|
declare module 'bc-deeplib/screens/debug' {
|
|
665
694
|
import { SettingElement } from 'bc-deeplib/base/elements_typings';
|
|
666
695
|
import { BaseSubscreen, SubscreenOptions } from 'bc-deeplib/deeplib';
|
|
696
|
+
import { DebugModule } from 'bc-deeplib/modules/debug';
|
|
667
697
|
export class GuiDebug extends BaseSubscreen {
|
|
668
698
|
protected static subscreenOptions: SubscreenOptions;
|
|
699
|
+
readonly module: DebugModule;
|
|
669
700
|
get pageStructure(): SettingElement[][];
|
|
701
|
+
exit(): void;
|
|
670
702
|
}
|
|
671
703
|
|
|
672
704
|
}
|
|
@@ -714,6 +746,9 @@ declare module 'bc-deeplib/screens/import_export' {
|
|
|
714
746
|
exportToClipboard(data: string): Promise<void>;
|
|
715
747
|
/** Prompts the user to enter data and returns it. */
|
|
716
748
|
importFromClipboard(): Promise<string | null>;
|
|
749
|
+
private getSelectedModules;
|
|
750
|
+
private buildExportPayload;
|
|
751
|
+
private applyImportPayload;
|
|
717
752
|
}
|
|
718
753
|
export {};
|
|
719
754
|
|
|
@@ -799,6 +834,17 @@ declare module 'bc-deeplib/utilities/common' {
|
|
|
799
834
|
* Converts bytes to kilobytes.
|
|
800
835
|
*/
|
|
801
836
|
export const byteToKB: (nByte: number) => number;
|
|
837
|
+
export type Ok<T> = {
|
|
838
|
+
ok: true;
|
|
839
|
+
value: T;
|
|
840
|
+
};
|
|
841
|
+
export type Err<E = unknown> = {
|
|
842
|
+
ok: false;
|
|
843
|
+
error: E;
|
|
844
|
+
};
|
|
845
|
+
export type Result<T, E = unknown> = Ok<T> | Err<E>;
|
|
846
|
+
export function tryCatch<T, E = unknown>(fn: () => T, mapError?: (e: unknown) => E): Result<T, E>;
|
|
847
|
+
export function tryCatchAsync<T, E = unknown>(fn: () => Promise<T>, mapError?: (e: unknown) => E): Promise<Result<T, E>>;
|
|
802
848
|
|
|
803
849
|
}
|
|
804
850
|
declare module 'bc-deeplib/utilities/data' {
|
|
@@ -821,11 +867,12 @@ declare module 'bc-deeplib/utilities/data' {
|
|
|
821
867
|
get playerStorage(): T;
|
|
822
868
|
set playerStorage(value: T);
|
|
823
869
|
get extensionStorage(): string;
|
|
824
|
-
set extensionStorage(value
|
|
870
|
+
private set extensionStorage(value);
|
|
825
871
|
setLocalStorage(key: string, value: object): void;
|
|
826
872
|
getLocalStorage(key: string): object | null;
|
|
827
873
|
load(): void;
|
|
828
874
|
save(): void;
|
|
875
|
+
storageSize(): number;
|
|
829
876
|
static dataDecompress<T = object>(string: string): T | null;
|
|
830
877
|
static dataCompress(object: object): string;
|
|
831
878
|
static measureSize(data: unknown): number;
|
|
@@ -851,14 +898,14 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
851
898
|
createBackNext: typeof elementPrevNext;
|
|
852
899
|
};
|
|
853
900
|
function elementCreateButton(options: Omit<Button, 'type'>): HTMLButtonElement;
|
|
854
|
-
function elementCreateCheckbox(options: Omit<Checkbox, 'type'>):
|
|
901
|
+
function elementCreateCheckbox(options: Omit<Checkbox, 'type'>): HTMLLabelElement;
|
|
855
902
|
function elementCreateCustom(options: Omit<Custom, 'type'>): HTMLElement;
|
|
856
|
-
function elementCreateInput(options: Input):
|
|
857
|
-
function elementCreateLabel(options: Omit<Label, 'type'>):
|
|
858
|
-
function elementCreateDropdown(options: Omit<Dropdown, 'type'>): HTMLLabelElement
|
|
903
|
+
function elementCreateInput(options: Input): HTMLLabelElement;
|
|
904
|
+
function elementCreateLabel(options: Omit<Label, 'type'>): HTMLLabelElement;
|
|
905
|
+
function elementCreateDropdown(options: Omit<Dropdown, 'type'>): HTMLLabelElement;
|
|
859
906
|
function elementCreateTooltip(): HTMLDivElement;
|
|
860
907
|
function elementGetTooltip(): HTMLElement | undefined;
|
|
861
|
-
function elementSetTooltip(text:
|
|
908
|
+
function elementSetTooltip(text: ElementButton.StaticNode, position?: 'top' | 'bottom'): boolean;
|
|
862
909
|
interface PrevNext {
|
|
863
910
|
id: string;
|
|
864
911
|
initialLabel?: string;
|
|
@@ -873,6 +920,85 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
873
920
|
setNextTooltip: (tooltip: string) => void;
|
|
874
921
|
}
|
|
875
922
|
function elementPrevNext(options: PrevNext): HTMLElement;
|
|
923
|
+
export {};
|
|
924
|
+
|
|
925
|
+
}
|
|
926
|
+
declare module 'bc-deeplib/utilities/elements/helpers' {
|
|
927
|
+
import { SettingElement } from 'bc-deeplib/base/elements_typings';
|
|
928
|
+
export const domUtil: {
|
|
929
|
+
/**
|
|
930
|
+
* Automatically sets the position of the element based on the given position.
|
|
931
|
+
* The position can be either a [x, y] tuple or a function returning such a tuple.
|
|
932
|
+
* If both x and y are defined, the element's position is updated accordingly.
|
|
933
|
+
*/
|
|
934
|
+
autoSetPosition: typeof autoSetPosition;
|
|
935
|
+
/**
|
|
936
|
+
* Automatically sets the size of the element based on the given size.
|
|
937
|
+
* The size can be either a [width, height] tuple or a function returning such a tuple.
|
|
938
|
+
* If both width and height are defined, the element's size is updated accordingly.
|
|
939
|
+
*/
|
|
940
|
+
autoSetSize: typeof autoSetSize;
|
|
941
|
+
/**
|
|
942
|
+
* Hides the element by setting its CSS display property to 'none'.
|
|
943
|
+
* If the element cannot be found, the function does nothing.
|
|
944
|
+
*/
|
|
945
|
+
hide: typeof hide;
|
|
946
|
+
/**
|
|
947
|
+
* Unhides the element by clearing its CSS display property (sets it to '').
|
|
948
|
+
* If the element cannot be found, the function does nothing.
|
|
949
|
+
*/
|
|
950
|
+
unhide: typeof unhide;
|
|
951
|
+
/**
|
|
952
|
+
* Checks if the element has overflow content.
|
|
953
|
+
* Returns an object indicating if there is any overflow,
|
|
954
|
+
* and specifically if there is vertical or horizontal overflow.
|
|
955
|
+
* Returns null if the element is not found.
|
|
956
|
+
*/
|
|
957
|
+
hasOverflow: typeof hasOverflow;
|
|
958
|
+
/**
|
|
959
|
+
* Checks if two rectangles overlap.
|
|
960
|
+
* Returns true if the rectangles overlap, false otherwise.
|
|
961
|
+
*/
|
|
962
|
+
doRectsOverlap: typeof doRectsOverlap;
|
|
963
|
+
};
|
|
964
|
+
function autoSetPosition(_: ElementHelp.ElementOrId, position: SettingElement['position']): void;
|
|
965
|
+
function autoSetSize(_: ElementHelp.ElementOrId, size: SettingElement['size']): void;
|
|
966
|
+
function hide(_: ElementHelp.ElementOrId): void;
|
|
967
|
+
function unhide(_: ElementHelp.ElementOrId): void;
|
|
968
|
+
function hasOverflow(el: ElementHelp.ElementOrId): {
|
|
969
|
+
any: boolean;
|
|
970
|
+
vertical: boolean;
|
|
971
|
+
horizontal: boolean;
|
|
972
|
+
} | null;
|
|
973
|
+
function doRectsOverlap(rect1: DOMRect, rect2: DOMRect): boolean;
|
|
974
|
+
export {};
|
|
975
|
+
|
|
976
|
+
}
|
|
977
|
+
declare module 'bc-deeplib/utilities/elements/layout' {
|
|
978
|
+
export const layout: {
|
|
979
|
+
getSubscreen: typeof elementGetSubscreenDiv;
|
|
980
|
+
appendToSubscreen: typeof elementAppendToSubscreenDiv;
|
|
981
|
+
removeSubscreen: typeof elementRemoveSubscreenDiv;
|
|
982
|
+
getSettingsDiv: typeof elementGetSettingsDiv;
|
|
983
|
+
appendToSettingsDiv: typeof elementAppendToSettingsDiv;
|
|
984
|
+
removeSettingsDiv: typeof elementRemoveSettingsDiv;
|
|
985
|
+
getMiscDiv: typeof elementGetMiscDiv;
|
|
986
|
+
appendToMiscDiv: typeof elementAppendToMiscDiv;
|
|
987
|
+
removeMiscDiv: typeof elementRemoveMiscDiv;
|
|
988
|
+
};
|
|
989
|
+
function elementGetSubscreenDiv(): HTMLElement;
|
|
990
|
+
function elementRemoveSubscreenDiv(): void;
|
|
991
|
+
function elementAppendToSubscreenDiv(...element: HTMLElement[]): void;
|
|
992
|
+
function elementGetSettingsDiv(): HTMLElement;
|
|
993
|
+
function elementAppendToSettingsDiv(...element: HTMLElement[]): void;
|
|
994
|
+
function elementRemoveSettingsDiv(): void;
|
|
995
|
+
function elementGetMiscDiv(): HTMLElement;
|
|
996
|
+
function elementAppendToMiscDiv(...element: HTMLElement[]): void;
|
|
997
|
+
function elementRemoveMiscDiv(): void;
|
|
998
|
+
export {};
|
|
999
|
+
|
|
1000
|
+
}
|
|
1001
|
+
declare module 'bc-deeplib/utilities/elements/modal' {
|
|
876
1002
|
export type ModalButton<T extends string = string> = {
|
|
877
1003
|
/** Button label text. */
|
|
878
1004
|
text: string;
|
|
@@ -908,7 +1034,24 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
908
1034
|
escapeAction?: T;
|
|
909
1035
|
/** Action sent when Enter key is pressed. */
|
|
910
1036
|
enterAction?: T;
|
|
1037
|
+
/** Modal ID. */
|
|
1038
|
+
modalId?: string;
|
|
911
1039
|
};
|
|
1040
|
+
export interface AlertOptions {
|
|
1041
|
+
/** Auto-close timeout in milliseconds. */
|
|
1042
|
+
timeoutMs?: number;
|
|
1043
|
+
/** Modal ID. */
|
|
1044
|
+
modalId?: string;
|
|
1045
|
+
}
|
|
1046
|
+
export interface ConfirmOptions {
|
|
1047
|
+
/** Modal ID. */
|
|
1048
|
+
modalId?: string;
|
|
1049
|
+
}
|
|
1050
|
+
export interface PromptOptions {
|
|
1051
|
+
defaultValue?: string;
|
|
1052
|
+
/** Modal ID. */
|
|
1053
|
+
modalId?: string;
|
|
1054
|
+
}
|
|
912
1055
|
/**
|
|
913
1056
|
* Modal dialog implementation with queuing, buttons, optional input, and focus trapping.
|
|
914
1057
|
* Multiple modals are queued to ensure only one is visible at a time.
|
|
@@ -931,17 +1074,17 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
931
1074
|
/**
|
|
932
1075
|
* Shows a simple alert modal with a single "OK" button.
|
|
933
1076
|
*/
|
|
934
|
-
static alert(msg: ElementButton.StaticNode,
|
|
1077
|
+
static alert(msg: ElementButton.StaticNode, opts?: AlertOptions): Promise<void>;
|
|
935
1078
|
/**
|
|
936
1079
|
* Shows a confirmation modal with "Cancel" and "OK" buttons.
|
|
937
1080
|
* Returns true if "OK" is clicked.
|
|
938
1081
|
*/
|
|
939
|
-
static confirm(msg: ElementButton.StaticNode): Promise<boolean>;
|
|
1082
|
+
static confirm(msg: ElementButton.StaticNode, opts?: ConfirmOptions): Promise<boolean>;
|
|
940
1083
|
/**
|
|
941
1084
|
* Shows a prompt modal with an input field and "Submit"/"Cancel" buttons.
|
|
942
1085
|
* Returns the input value if submitted, otherwise null.
|
|
943
1086
|
*/
|
|
944
|
-
static prompt(msg: ElementButton.StaticNode,
|
|
1087
|
+
static prompt(msg: ElementButton.StaticNode, opts?: PromptOptions): Promise<string | null>;
|
|
945
1088
|
/** Creates the input element for the modal, applying configuration and validation. */
|
|
946
1089
|
private renderInput;
|
|
947
1090
|
/** Creates modal action buttons from configuration. */
|
|
@@ -961,76 +1104,6 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
961
1104
|
/** A function that processes the queue, removing the first modal */
|
|
962
1105
|
private static dequeue;
|
|
963
1106
|
}
|
|
964
|
-
export {};
|
|
965
|
-
|
|
966
|
-
}
|
|
967
|
-
declare module 'bc-deeplib/utilities/elements/helpers' {
|
|
968
|
-
import { SettingElement } from 'bc-deeplib/base/elements_typings';
|
|
969
|
-
export const domUtil: {
|
|
970
|
-
/**
|
|
971
|
-
* Automatically sets the position of the element based on the given position.
|
|
972
|
-
* The position can be either a [x, y] tuple or a function returning such a tuple.
|
|
973
|
-
* If both x and y are defined, the element's position is updated accordingly.
|
|
974
|
-
*/
|
|
975
|
-
autoSetPosition: typeof autoSetPosition;
|
|
976
|
-
/**
|
|
977
|
-
* Automatically sets the size of the element based on the given size.
|
|
978
|
-
* The size can be either a [width, height] tuple or a function returning such a tuple.
|
|
979
|
-
* If both width and height are defined, the element's size is updated accordingly.
|
|
980
|
-
*/
|
|
981
|
-
autoSetSize: typeof autoSetSize;
|
|
982
|
-
/**
|
|
983
|
-
* Hides the element by setting its CSS display property to 'none'.
|
|
984
|
-
* If the element cannot be found, the function does nothing.
|
|
985
|
-
*/
|
|
986
|
-
hide: typeof hide;
|
|
987
|
-
/**
|
|
988
|
-
* Unhides the element by clearing its CSS display property (sets it to '').
|
|
989
|
-
* If the element cannot be found, the function does nothing.
|
|
990
|
-
*/
|
|
991
|
-
unhide: typeof unhide;
|
|
992
|
-
/**
|
|
993
|
-
* Checks if the element has overflow content.
|
|
994
|
-
* Returns an object indicating if there is any overflow,
|
|
995
|
-
* and specifically if there is vertical or horizontal overflow.
|
|
996
|
-
* Returns null if the element is not found.
|
|
997
|
-
*/
|
|
998
|
-
hasOverflow: typeof hasOverflow;
|
|
999
|
-
};
|
|
1000
|
-
function autoSetPosition(_: ElementHelp.ElementOrId, position: SettingElement['position']): void;
|
|
1001
|
-
function autoSetSize(_: ElementHelp.ElementOrId, size: SettingElement['size']): void;
|
|
1002
|
-
function hide(_: ElementHelp.ElementOrId): void;
|
|
1003
|
-
function unhide(_: ElementHelp.ElementOrId): void;
|
|
1004
|
-
function hasOverflow(el: ElementHelp.ElementOrId): {
|
|
1005
|
-
any: boolean;
|
|
1006
|
-
vertical: boolean;
|
|
1007
|
-
horizontal: boolean;
|
|
1008
|
-
} | null;
|
|
1009
|
-
export {};
|
|
1010
|
-
|
|
1011
|
-
}
|
|
1012
|
-
declare module 'bc-deeplib/utilities/elements/layout' {
|
|
1013
|
-
export const layout: {
|
|
1014
|
-
getSubscreen: typeof elementGetSubscreenDiv;
|
|
1015
|
-
appendToSubscreen: typeof elementAppendToSubscreenDiv;
|
|
1016
|
-
removeSubscreen: typeof elementRemoveSubscreenDiv;
|
|
1017
|
-
getSettingsDiv: typeof elementGetSettingsDiv;
|
|
1018
|
-
appendToSettingsDiv: typeof elementAppendToSettingsDiv;
|
|
1019
|
-
removeSettingsDiv: typeof elementRemoveSettingsDiv;
|
|
1020
|
-
getMiscDiv: typeof elementGetMiscDiv;
|
|
1021
|
-
appendToMiscDiv: typeof elementAppendToMiscDiv;
|
|
1022
|
-
removeMiscDiv: typeof elementRemoveMiscDiv;
|
|
1023
|
-
};
|
|
1024
|
-
function elementGetSubscreenDiv(): HTMLElement;
|
|
1025
|
-
function elementRemoveSubscreenDiv(): void;
|
|
1026
|
-
function elementAppendToSubscreenDiv(...element: HTMLElement[]): void;
|
|
1027
|
-
function elementGetSettingsDiv(): HTMLElement;
|
|
1028
|
-
function elementAppendToSettingsDiv(...element: HTMLElement[]): void;
|
|
1029
|
-
function elementRemoveSettingsDiv(): void;
|
|
1030
|
-
function elementGetMiscDiv(): HTMLElement;
|
|
1031
|
-
function elementAppendToMiscDiv(...element: HTMLElement[]): void;
|
|
1032
|
-
function elementRemoveMiscDiv(): void;
|
|
1033
|
-
export {};
|
|
1034
1107
|
|
|
1035
1108
|
}
|
|
1036
1109
|
declare module 'bc-deeplib/utilities/event_channel' {
|
|
@@ -1131,9 +1204,8 @@ declare module 'bc-deeplib/utilities/sdk' {
|
|
|
1131
1204
|
* provides methods to register mods, hook functions, and manage patches.
|
|
1132
1205
|
*/
|
|
1133
1206
|
export class ModSdkManager {
|
|
1134
|
-
private
|
|
1135
|
-
private
|
|
1136
|
-
static ModInfo: ModSDKModInfo;
|
|
1207
|
+
private SDK;
|
|
1208
|
+
private patchedFunctions;
|
|
1137
1209
|
/** Registers a mod with the SDK and stores mod information. */
|
|
1138
1210
|
constructor(info: ModSDKModInfo, options?: ModSDKModOptions);
|
|
1139
1211
|
/** Retrieves or initializes patch data for a given target function. */
|
|
@@ -1162,6 +1234,10 @@ declare module 'bc-deeplib/utilities/sdk' {
|
|
|
1162
1234
|
* Removes all hooks associated with a specific module across all patched functions.
|
|
1163
1235
|
*/
|
|
1164
1236
|
removeAllHooksByModule(module: ModuleCategory): boolean;
|
|
1237
|
+
/**
|
|
1238
|
+
* Unloads the mod removing all hooks and patches by it.
|
|
1239
|
+
*/
|
|
1240
|
+
unload(): void;
|
|
1165
1241
|
}
|
|
1166
1242
|
export {};
|
|
1167
1243
|
|