bc-deeplib 2.0.0 → 2.2.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 CHANGED
@@ -125,6 +125,25 @@ 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;
143
+ /**
144
+ * If `true`, the character will be forced to the top of the screen.
145
+ */
146
+ forceUpCharacter?: boolean;
128
147
  };
129
148
  /**
130
149
  * Represents a constructor type for a subscreen.
@@ -233,46 +252,61 @@ declare module 'bc-deeplib/base/base_subscreen' {
233
252
 
234
253
  }
235
254
  declare module 'bc-deeplib/base/elements_typings' {
236
- export type SettingElement = Button | Checkbox | Input | Label | Custom;
255
+ export type SettingElement = Button | Checkbox | Input | Label | Dropdown | Custom;
237
256
  export type BaseElementModel = {
238
257
  id: string;
239
258
  size?: [width: number | null, height: number | null] | (() => [width: number | null, height: number | null]);
240
259
  position?: [x: number, y: number] | (() => [x: number, y: number]);
241
260
  disabled?: boolean | (() => boolean);
242
261
  };
243
- export type Button = Omit<BaseElementModel, 'id'> & {
262
+ export type Button = Prettify<{
244
263
  id: Parameters<typeof ElementButton.Create>[0];
245
264
  type: 'button';
246
265
  onClick?: Parameters<typeof ElementButton.Create>[1];
247
266
  options?: Parameters<typeof ElementButton.Create>[2];
248
267
  htmlOptions?: Parameters<typeof ElementButton.Create>[3];
249
- };
250
- export type Checkbox = BaseElementModel & {
268
+ } & Omit<BaseElementModel, 'id'>>;
269
+ export type Checkbox = Prettify<{
251
270
  type: 'checkbox';
252
271
  label?: string;
253
272
  description?: string;
254
273
  setElementValue?: () => boolean;
255
274
  setSettingValue?: (val: boolean) => void;
256
- htmlOptions?: Omit<HTMLOptions<any>, 'tag'>;
257
- };
258
- export type Input = BaseElementModel & {
275
+ htmlOptions?: Partial<Record<'container' | 'checkbox' | 'label', Omit<HTMLOptions<any>, 'tag'>>> | null | undefined;
276
+ } & BaseElementModel>;
277
+ export type Input = Prettify<{
259
278
  type: 'text' | 'number' | 'color';
260
279
  label?: string;
261
280
  description?: string;
262
281
  setElementValue?: () => string;
263
282
  setSettingValue?: (val: string) => void;
264
- htmlOptions?: Omit<HTMLOptions<any>, 'tag'>;
265
- };
266
- export type Label = BaseElementModel & {
283
+ htmlOptions?: Partial<Record<'container' | 'input' | 'label', Omit<HTMLOptions<any>, 'tag'>>> | null | undefined;
284
+ } & BaseElementModel>;
285
+ export type Dropdown = Prettify<{
286
+ id: Parameters<typeof ElementCreateDropdown>[0];
287
+ type: 'dropdown';
288
+ label?: string;
289
+ description?: string;
290
+ optionsList: Parameters<typeof ElementCreateDropdown>[1];
291
+ setElementValue?: () => string;
292
+ setSettingValue?: (val: string) => void;
293
+ options?: Parameters<typeof ElementCreateDropdown>[3];
294
+ htmlOptions?: {
295
+ container?: Partial<Omit<HTMLOptions<any>, 'tag'>>;
296
+ select?: Parameters<typeof ElementCreateDropdown>[4];
297
+ label?: Partial<Omit<HTMLOptions<'label'>, 'tag'>>;
298
+ };
299
+ } & Omit<BaseElementModel, 'id' | 'disabled'>>;
300
+ export type Label = Prettify<{
267
301
  type: 'label';
268
302
  label?: string;
269
303
  description?: string;
270
304
  htmlOptions?: Omit<HTMLOptions<any>, 'tag'>;
271
- };
272
- export type Custom = BaseElementModel & {
305
+ } & BaseElementModel>;
306
+ export type Custom = Prettify<{
273
307
  type: 'custom';
274
308
  htmlOptions: HTMLOptions<keyof HTMLElementTagNameMap>;
275
- };
309
+ } & BaseElementModel>;
276
310
 
277
311
  }
278
312
  declare module 'bc-deeplib/base/initialization' {
@@ -331,20 +365,6 @@ declare module 'bc-deeplib/base/initialization' {
331
365
  * - Delaying initialization until login (if necessary)
332
366
  */
333
367
  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
368
  /**
349
369
  * Cleans up and removes the mod from memory.
350
370
  * Calls `unload()` on all modules and removes the global loaded flag.
@@ -416,6 +436,7 @@ declare module 'bc-deeplib/base/modules' {
416
436
  declare module 'bc-deeplib/deeplib' {
417
437
  export * from 'bc-deeplib/base/base_module';
418
438
  export * from 'bc-deeplib/base/base_subscreen';
439
+ export * from 'bc-deeplib/base/elements_typings';
419
440
  export * from 'bc-deeplib/base/initialization';
420
441
  export * from 'bc-deeplib/base/modules';
421
442
  export * from 'bc-deeplib/migrators/base_migrator';
@@ -563,7 +584,7 @@ declare module 'bc-deeplib/modules/gui' {
563
584
  declare module 'bc-deeplib/modules/version' {
564
585
  import { BaseMigrator, BaseModule } from 'bc-deeplib/deeplib';
565
586
  export type VersionModuleOptions = {
566
- newVersionMessage: string;
587
+ newVersionMessage?: string;
567
588
  beforeEach?: () => void;
568
589
  afterEach?: () => void;
569
590
  beforeAll?: () => void;
@@ -586,7 +607,7 @@ declare module 'bc-deeplib/modules/version' {
586
607
  /** The current mod version (retrieved from `ModSdkManager.ModInfo.version`) */
587
608
  private static version;
588
609
  /** Message to display when a new version is detected */
589
- private static newVersionMessage;
610
+ private static newVersionMessage?;
590
611
  /** List of registered migration handlers, sorted by version */
591
612
  private static migrators;
592
613
  /** Optional lifecycle hook. Runs before each migration */
@@ -744,12 +765,12 @@ declare module 'bc-deeplib/screens/main_menu' {
744
765
  }
745
766
  declare module 'bc-deeplib/utilities/common' {
746
767
  /**
747
- * Deeply merges properties from `source` into `target`.
748
- * - If both target and source properties are arrays, concatenates them.
749
- * - If both are objects, recursively merges them.
750
- * - Otherwise, source overwrites target.
768
+ * Deeply merges two values into a new value.
769
+ * - Arrays are concatenated.
770
+ * - Plain objects are merged recursively.
771
+ * - Other values are replaced by `source`.
751
772
  */
752
- export function deepMerge(target: any, source: any): any;
773
+ export function deepMerge<T, U>(target: T, source: U): T & U;
753
774
  /**
754
775
  * Returns a new array with elements of the input array shuffled.
755
776
  * Uses something-something shuffle algorithm by splicing from a cloned array.
@@ -810,7 +831,7 @@ declare module 'bc-deeplib/utilities/data' {
810
831
 
811
832
  }
812
833
  declare module 'bc-deeplib/utilities/elements/elements' {
813
- import { Button, Checkbox, Custom, Input, Label } from 'bc-deeplib/base/elements_typings';
834
+ import { Button, Checkbox, Custom, Dropdown, Input, Label } from 'bc-deeplib/base/elements_typings';
814
835
  /**
815
836
  * Collection of element creation utilities.
816
837
  * Provides convenience wrappers for generating commonly used UI elements.
@@ -821,6 +842,7 @@ declare module 'bc-deeplib/utilities/elements/elements' {
821
842
  createInput: typeof elementCreateInput;
822
843
  createLabel: typeof elementCreateLabel;
823
844
  createCustom: typeof elementCreateCustom;
845
+ createDropdown: typeof elementCreateDropdown;
824
846
  createTooltip: typeof elementCreateTooltip;
825
847
  getTooltip: typeof elementGetTooltip;
826
848
  setTooltip: typeof elementSetTooltip;
@@ -831,6 +853,7 @@ declare module 'bc-deeplib/utilities/elements/elements' {
831
853
  function elementCreateCustom(options: Omit<Custom, 'type'>): HTMLElement;
832
854
  function elementCreateInput(options: Input): HTMLElement;
833
855
  function elementCreateLabel(options: Omit<Label, 'type'>): HTMLElement;
856
+ function elementCreateDropdown(options: Omit<Dropdown, 'type'>): HTMLDivElement;
834
857
  function elementCreateTooltip(): HTMLDivElement;
835
858
  function elementGetTooltip(): HTMLElement | undefined;
836
859
  function elementSetTooltip(text: string): boolean;