bc-deeplib 2.0.0 → 2.1.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 +54 -35
- package/dist/deeplib.js +180 -87
- package/dist/deeplib.js.map +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vendored_types/utility.d.ts +3 -0
- package/package.json +1 -1
package/dist/deeplib.d.ts
CHANGED
|
@@ -125,6 +125,21 @@ declare module 'bc-deeplib/base/base_subscreen' {
|
|
|
125
125
|
* Currently supports only images from the Club.
|
|
126
126
|
*/
|
|
127
127
|
background?: string;
|
|
128
|
+
/**
|
|
129
|
+
* If `true`, the exit button will be shown on the subscreen.
|
|
130
|
+
* Defaults to `true`.
|
|
131
|
+
*/
|
|
132
|
+
doShowExitButton?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* If `true`, the title will be shown on the subscreen.
|
|
135
|
+
* Defaults to `true`.
|
|
136
|
+
*/
|
|
137
|
+
doShowTitle?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* The width of the settings div in canvas pixels.
|
|
140
|
+
* Defaults to 1000.
|
|
141
|
+
*/
|
|
142
|
+
settingsWidth?: number;
|
|
128
143
|
};
|
|
129
144
|
/**
|
|
130
145
|
* Represents a constructor type for a subscreen.
|
|
@@ -233,46 +248,61 @@ declare module 'bc-deeplib/base/base_subscreen' {
|
|
|
233
248
|
|
|
234
249
|
}
|
|
235
250
|
declare module 'bc-deeplib/base/elements_typings' {
|
|
236
|
-
export type SettingElement = Button | Checkbox | Input | Label | Custom;
|
|
251
|
+
export type SettingElement = Button | Checkbox | Input | Label | Dropdown | Custom;
|
|
237
252
|
export type BaseElementModel = {
|
|
238
253
|
id: string;
|
|
239
254
|
size?: [width: number | null, height: number | null] | (() => [width: number | null, height: number | null]);
|
|
240
255
|
position?: [x: number, y: number] | (() => [x: number, y: number]);
|
|
241
256
|
disabled?: boolean | (() => boolean);
|
|
242
257
|
};
|
|
243
|
-
export type Button =
|
|
258
|
+
export type Button = Prettify<{
|
|
244
259
|
id: Parameters<typeof ElementButton.Create>[0];
|
|
245
260
|
type: 'button';
|
|
246
261
|
onClick?: Parameters<typeof ElementButton.Create>[1];
|
|
247
262
|
options?: Parameters<typeof ElementButton.Create>[2];
|
|
248
263
|
htmlOptions?: Parameters<typeof ElementButton.Create>[3];
|
|
249
|
-
}
|
|
250
|
-
export type Checkbox =
|
|
264
|
+
} & Omit<BaseElementModel, 'id'>>;
|
|
265
|
+
export type Checkbox = Prettify<{
|
|
251
266
|
type: 'checkbox';
|
|
252
267
|
label?: string;
|
|
253
268
|
description?: string;
|
|
254
269
|
setElementValue?: () => boolean;
|
|
255
270
|
setSettingValue?: (val: boolean) => void;
|
|
256
|
-
htmlOptions?: Omit<HTMLOptions<any>, 'tag'
|
|
257
|
-
}
|
|
258
|
-
export type Input =
|
|
271
|
+
htmlOptions?: Partial<Record<'container' | 'checkbox' | 'label', Omit<HTMLOptions<any>, 'tag'>>> | null | undefined;
|
|
272
|
+
} & BaseElementModel>;
|
|
273
|
+
export type Input = Prettify<{
|
|
259
274
|
type: 'text' | 'number' | 'color';
|
|
260
275
|
label?: string;
|
|
261
276
|
description?: string;
|
|
262
277
|
setElementValue?: () => string;
|
|
263
278
|
setSettingValue?: (val: string) => void;
|
|
264
|
-
htmlOptions?: Omit<HTMLOptions<any>, 'tag'
|
|
265
|
-
}
|
|
266
|
-
export type
|
|
279
|
+
htmlOptions?: Partial<Record<'container' | 'input' | 'label', Omit<HTMLOptions<any>, 'tag'>>> | null | undefined;
|
|
280
|
+
} & BaseElementModel>;
|
|
281
|
+
export type Dropdown = Prettify<{
|
|
282
|
+
id: Parameters<typeof ElementCreateDropdown>[0];
|
|
283
|
+
type: 'dropdown';
|
|
284
|
+
label?: string;
|
|
285
|
+
description?: string;
|
|
286
|
+
optionsList: Parameters<typeof ElementCreateDropdown>[1];
|
|
287
|
+
setElementValue?: () => string;
|
|
288
|
+
setSettingValue?: (val: string) => void;
|
|
289
|
+
options?: Parameters<typeof ElementCreateDropdown>[3];
|
|
290
|
+
htmlOptions?: {
|
|
291
|
+
container?: Partial<Omit<HTMLOptions<any>, 'tag'>>;
|
|
292
|
+
select?: Parameters<typeof ElementCreateDropdown>[4];
|
|
293
|
+
label?: Partial<Omit<HTMLOptions<'label'>, 'tag'>>;
|
|
294
|
+
};
|
|
295
|
+
} & Omit<BaseElementModel, 'id' | 'disabled'>>;
|
|
296
|
+
export type Label = Prettify<{
|
|
267
297
|
type: 'label';
|
|
268
298
|
label?: string;
|
|
269
299
|
description?: string;
|
|
270
300
|
htmlOptions?: Omit<HTMLOptions<any>, 'tag'>;
|
|
271
|
-
}
|
|
272
|
-
export type Custom =
|
|
301
|
+
} & BaseElementModel>;
|
|
302
|
+
export type Custom = Prettify<{
|
|
273
303
|
type: 'custom';
|
|
274
304
|
htmlOptions: HTMLOptions<keyof HTMLElementTagNameMap>;
|
|
275
|
-
}
|
|
305
|
+
} & BaseElementModel>;
|
|
276
306
|
|
|
277
307
|
}
|
|
278
308
|
declare module 'bc-deeplib/base/initialization' {
|
|
@@ -331,20 +361,6 @@ declare module 'bc-deeplib/base/initialization' {
|
|
|
331
361
|
* - Delaying initialization until login (if necessary)
|
|
332
362
|
*/
|
|
333
363
|
export function initMod(options: InitOptions): void;
|
|
334
|
-
/**
|
|
335
|
-
* Fully initializes the mod after login.
|
|
336
|
-
* Handles:
|
|
337
|
-
* - Preventing double-load
|
|
338
|
-
* - Loading mod data
|
|
339
|
-
* - Initializing localization
|
|
340
|
-
* - Registering modules and migrators
|
|
341
|
-
* - Running optional init functions
|
|
342
|
-
* - Applying main menu changes
|
|
343
|
-
* - Merging default settings into module settings
|
|
344
|
-
*
|
|
345
|
-
* @param options {InitOptions} Configuration for mod initialization.
|
|
346
|
-
*/
|
|
347
|
-
export function init(options: InitOptions): Promise<void>;
|
|
348
364
|
/**
|
|
349
365
|
* Cleans up and removes the mod from memory.
|
|
350
366
|
* Calls `unload()` on all modules and removes the global loaded flag.
|
|
@@ -416,6 +432,7 @@ declare module 'bc-deeplib/base/modules' {
|
|
|
416
432
|
declare module 'bc-deeplib/deeplib' {
|
|
417
433
|
export * from 'bc-deeplib/base/base_module';
|
|
418
434
|
export * from 'bc-deeplib/base/base_subscreen';
|
|
435
|
+
export * from 'bc-deeplib/base/elements_typings';
|
|
419
436
|
export * from 'bc-deeplib/base/initialization';
|
|
420
437
|
export * from 'bc-deeplib/base/modules';
|
|
421
438
|
export * from 'bc-deeplib/migrators/base_migrator';
|
|
@@ -563,7 +580,7 @@ declare module 'bc-deeplib/modules/gui' {
|
|
|
563
580
|
declare module 'bc-deeplib/modules/version' {
|
|
564
581
|
import { BaseMigrator, BaseModule } from 'bc-deeplib/deeplib';
|
|
565
582
|
export type VersionModuleOptions = {
|
|
566
|
-
newVersionMessage
|
|
583
|
+
newVersionMessage?: string;
|
|
567
584
|
beforeEach?: () => void;
|
|
568
585
|
afterEach?: () => void;
|
|
569
586
|
beforeAll?: () => void;
|
|
@@ -586,7 +603,7 @@ declare module 'bc-deeplib/modules/version' {
|
|
|
586
603
|
/** The current mod version (retrieved from `ModSdkManager.ModInfo.version`) */
|
|
587
604
|
private static version;
|
|
588
605
|
/** Message to display when a new version is detected */
|
|
589
|
-
private static newVersionMessage
|
|
606
|
+
private static newVersionMessage?;
|
|
590
607
|
/** List of registered migration handlers, sorted by version */
|
|
591
608
|
private static migrators;
|
|
592
609
|
/** Optional lifecycle hook. Runs before each migration */
|
|
@@ -744,12 +761,12 @@ declare module 'bc-deeplib/screens/main_menu' {
|
|
|
744
761
|
}
|
|
745
762
|
declare module 'bc-deeplib/utilities/common' {
|
|
746
763
|
/**
|
|
747
|
-
* Deeply merges
|
|
748
|
-
* -
|
|
749
|
-
* -
|
|
750
|
-
* -
|
|
764
|
+
* Deeply merges two values into a new value.
|
|
765
|
+
* - Arrays are concatenated.
|
|
766
|
+
* - Plain objects are merged recursively.
|
|
767
|
+
* - Other values are replaced by `source`.
|
|
751
768
|
*/
|
|
752
|
-
export function deepMerge(target:
|
|
769
|
+
export function deepMerge<T, U>(target: T, source: U): T & U;
|
|
753
770
|
/**
|
|
754
771
|
* Returns a new array with elements of the input array shuffled.
|
|
755
772
|
* Uses something-something shuffle algorithm by splicing from a cloned array.
|
|
@@ -810,7 +827,7 @@ declare module 'bc-deeplib/utilities/data' {
|
|
|
810
827
|
|
|
811
828
|
}
|
|
812
829
|
declare module 'bc-deeplib/utilities/elements/elements' {
|
|
813
|
-
import { Button, Checkbox, Custom, Input, Label } from 'bc-deeplib/base/elements_typings';
|
|
830
|
+
import { Button, Checkbox, Custom, Dropdown, Input, Label } from 'bc-deeplib/base/elements_typings';
|
|
814
831
|
/**
|
|
815
832
|
* Collection of element creation utilities.
|
|
816
833
|
* Provides convenience wrappers for generating commonly used UI elements.
|
|
@@ -821,6 +838,7 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
821
838
|
createInput: typeof elementCreateInput;
|
|
822
839
|
createLabel: typeof elementCreateLabel;
|
|
823
840
|
createCustom: typeof elementCreateCustom;
|
|
841
|
+
createDropdown: typeof elementCreateDropdown;
|
|
824
842
|
createTooltip: typeof elementCreateTooltip;
|
|
825
843
|
getTooltip: typeof elementGetTooltip;
|
|
826
844
|
setTooltip: typeof elementSetTooltip;
|
|
@@ -831,6 +849,7 @@ declare module 'bc-deeplib/utilities/elements/elements' {
|
|
|
831
849
|
function elementCreateCustom(options: Omit<Custom, 'type'>): HTMLElement;
|
|
832
850
|
function elementCreateInput(options: Input): HTMLElement;
|
|
833
851
|
function elementCreateLabel(options: Omit<Label, 'type'>): HTMLElement;
|
|
852
|
+
function elementCreateDropdown(options: Omit<Dropdown, 'type'>): HTMLDivElement;
|
|
834
853
|
function elementCreateTooltip(): HTMLDivElement;
|
|
835
854
|
function elementGetTooltip(): HTMLElement | undefined;
|
|
836
855
|
function elementSetTooltip(text: string): boolean;
|