bard-legends-framework 1.4.8 → 1.5.1

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as actions_lib from 'actions-lib';
2
- import { IDAttachable, Attachable, SingleEvent, Sequence, SingleNotifier, Notifier, Reducer, Variable, Action } from 'actions-lib';
2
+ import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent, Reducer, Variable, Action, ClassID } from 'actions-lib';
3
3
  import { Vector, Radian, Rectangle, Vec2, RGBColor, Grid, GridNeighborType, Line } from 'helpers-lib';
4
4
  import * as Pixi from 'pixi.js';
5
5
 
@@ -22,7 +22,7 @@ declare abstract class Entity extends IDAttachable {
22
22
  constructor();
23
23
  destroy(): void;
24
24
  attach(parent: Attachable): this;
25
- attachByID(id: number): this;
25
+ attachByID(id: AttachmentID): this;
26
26
  attachToRoot(): this;
27
27
  }
28
28
 
@@ -30,8 +30,8 @@ type SingletonEntityClassType<T extends SingletonEntity = SingletonEntity> = (ne
30
30
  id: number;
31
31
  };
32
32
  declare abstract class SingletonEntity extends Entity {
33
- static getInstanceAsync<T extends SingletonEntity>(this: SingletonEntityClassType<T>): SingleEvent<T>;
34
- static continuesSubscription<T extends SingletonEntity>(this: SingletonEntityClassType<T>): Sequence<{
33
+ static getInstanceAsync<T extends SingletonEntity>(this: SingletonEntityClassType<T>): IdleSingleEvent<T>;
34
+ static continuesSubscription<T extends SingletonEntity>(this: SingletonEntityClassType<T>): IdleSequence<{
35
35
  type: 'open' | 'close';
36
36
  value: T;
37
37
  }>;
@@ -49,23 +49,21 @@ type SceneClassType = new (...services: unknown[]) => Scene<unknown, unknown>;
49
49
  type SceneInput<T> = T extends Scene<infer I, any> ? I : never;
50
50
  declare function SceneDecorator(): (SceneClass: SceneClassType) => any;
51
51
  declare abstract class Scene<InputType, OutputType> extends IDAttachable {
52
- static readonly isTransitioning: actions_lib.Notifier<boolean>;
53
- static getIsTransitioning(this: typeof Scene): boolean;
54
- static readonly activeScene: actions_lib.Notifier<Scene<unknown, unknown> | undefined>;
55
- static getActiveScene(this: typeof Scene): Scene<unknown, unknown> | undefined;
52
+ static readonly isTransitioning: actions_lib.PersistentNotifier<boolean>;
53
+ static readonly activeScene: actions_lib.PersistentNotifier<Scene<unknown, unknown> | undefined>;
56
54
  static getActiveSceneOrFail(this: typeof Scene): Scene<unknown, unknown>;
57
- static cancelActiveScene(): SingleEvent;
55
+ static cancelActiveScene(): IdleSingleEvent;
58
56
  static isActive<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): boolean;
59
57
  static getInstance<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T | undefined;
60
58
  static getInstanceOrFail<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T;
61
- static open<T extends Scene<any, any>>(this: new (...args1: unknown[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): SingleEvent<T>;
62
- readonly onClose: actions_lib.SingleNotifier<OutputType>;
59
+ static open<T extends Scene<any, any>>(this: new (...args1: unknown[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): IdleSingleEvent<T>;
60
+ readonly onClose: actions_lib.PersistentSingleNotifier<OutputType>;
63
61
  constructor();
64
- close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): SingleEvent<OutputType>;
62
+ close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): IdleSingleEvent<OutputType>;
65
63
  private animateAndClose;
66
- protected abstract init(input: InputType): SingleEvent;
64
+ protected abstract init(input: InputType): IdleSingleEvent;
67
65
  protected abstract update(time: number, delta: number): void;
68
- protected abstract prepareToClose(): SingleEvent;
66
+ protected abstract prepareToClose(): IdleSingleEvent;
69
67
  /**
70
68
  * @deprecated
71
69
  */
@@ -90,7 +88,7 @@ declare class UpdateCycle {
90
88
  time: number;
91
89
  delta: number;
92
90
  }>;
93
- static wait(duration: number): SingleEvent;
91
+ static wait(duration: number): IdleSingleEvent;
94
92
  static registerUpdateModifier(callback: (time: number, delta: number) => number): void;
95
93
  static cleanUpdateModifier(): void;
96
94
  static triggerUpdateTick(delta: number): void;
@@ -442,26 +440,25 @@ interface MenuOptions {
442
440
  readonly backgroundDarkeningRatio: number;
443
441
  }
444
442
  declare class MenuUI extends Container {
445
- static isAnyMenuTransitioning: actions_lib.Notifier<boolean>;
446
- static getIsAnyMenuTransitioning(this: typeof MenuUI): boolean;
447
- readonly onCreate: actions_lib.SingleNotifier<void>;
448
- readonly onOpen: actions_lib.SingleNotifier<void>;
449
- readonly onClose: actions_lib.SingleNotifier<void>;
443
+ static isAnyMenuTransitioning: actions_lib.PersistentNotifier<boolean>;
444
+ readonly onCreate: actions_lib.PersistentSingleNotifier<void>;
445
+ readonly onOpen: actions_lib.PersistentSingleNotifier<void>;
446
+ readonly onClose: actions_lib.PersistentSingleNotifier<void>;
450
447
  constructor(windowSprite: string, partialOptions: Partial<MenuOptions>);
451
448
  getBoundingMask(): Sprite;
452
- close(): SingleEvent;
449
+ close(): IdleSingleEvent;
453
450
  }
454
451
 
455
452
  interface MenuEntityOptions {
456
453
  readonly closeOnBackgroundClick: boolean;
457
454
  }
458
455
  declare class MenuEntity extends SingletonEntity {
459
- static subscribeIsOpen(): Sequence<boolean>;
456
+ static subscribeIsOpen(): IdleSequence<boolean>;
460
457
  constructor(partialOptions: Partial<MenuEntityOptions>);
461
- onCreate(): SingleEvent;
462
- onOpen(): SingleEvent;
463
- onClose(): SingleEvent;
464
- close(): SingleEvent;
458
+ onCreate(): IdleSingleEvent;
459
+ onOpen(): IdleSingleEvent;
460
+ onClose(): IdleSingleEvent;
461
+ close(): IdleSingleEvent;
465
462
  }
466
463
 
467
464
  interface MenuViewOptions {
@@ -748,7 +745,7 @@ declare class Camera {
748
745
  constructor();
749
746
  setPosition(position: Vector): void;
750
747
  setTransition(options: FocusingOptions): void;
751
- appear(on: boolean, type?: CameraAppearTransitionType): SingleEvent;
748
+ appear(on: boolean, type?: CameraAppearTransitionType): IdleSingleEvent;
752
749
  }
753
750
 
754
751
  interface GameConfiguration {
@@ -777,11 +774,9 @@ declare class Game {
777
774
  readonly stage: Container;
778
775
  readonly renderer: Pixi.Renderer;
779
776
  readonly _screenSize: Variable<Vector>;
780
- readonly screenSize: actions_lib.Notifier<Vector>;
781
- getScreenSize(): Vector;
777
+ readonly screenSize: actions_lib.PersistentNotifier<Vector>;
782
778
  readonly _screenSizeCenter: Variable<Vector>;
783
- readonly screenSizeCenter: actions_lib.Notifier<Vector>;
784
- getScreenSizeCenter(): Vector;
779
+ readonly screenSizeCenter: actions_lib.PersistentNotifier<Vector>;
785
780
  readonly devMode: boolean;
786
781
  constructor(partialConfiguration?: Partial<GameConfiguration>);
787
782
  setup(setupOptions: GameSetupOptions): Promise<void>;
@@ -813,16 +808,11 @@ declare class KeyboardService {
813
808
  }
814
809
 
815
810
  declare class MouseService {
816
- readonly onInitialMouseMove: actions_lib.Notifier<boolean>;
817
- get initialMouseMoveHappened(): boolean;
818
- readonly stagePosition: actions_lib.Notifier<Vector>;
819
- getStagePosition(): Vector;
820
- readonly screenPosition: actions_lib.Notifier<Vector>;
821
- getScreenPosition(): Vector;
822
- readonly mainButtonState: actions_lib.Notifier<boolean>;
823
- getMainButtonState(): boolean;
824
- readonly secondaryButtonState: actions_lib.Notifier<boolean>;
825
- getSecondaryButtonState(): boolean;
811
+ readonly initialMouseMovementHappened: actions_lib.PersistentNotifier<boolean>;
812
+ readonly stagePosition: actions_lib.PersistentNotifier<Vector>;
813
+ readonly screenPosition: actions_lib.PersistentNotifier<Vector>;
814
+ readonly mainButtonState: actions_lib.PersistentNotifier<boolean>;
815
+ readonly secondaryButtonState: actions_lib.PersistentNotifier<boolean>;
826
816
  constructor();
827
817
  /**
828
818
  * Maps viewport (DOM) coordinates to Pixi logical screen space (`renderer.screen`),
@@ -846,7 +836,7 @@ declare const SPEED_LIMIT = 10.8;
846
836
  declare const ROTATIONAL_SPEED_LIMIT = 10.01;
847
837
  interface PhysicsBodyDTO {
848
838
  readonly entityID: number;
849
- readonly classID: number;
839
+ readonly classID: ClassID;
850
840
  readonly position: Vector;
851
841
  readonly rotation: Radian;
852
842
  readonly velocity: Vector;
@@ -957,7 +947,7 @@ interface BorderProperties {
957
947
 
958
948
  type InteractingBodyGroups = readonly (readonly [PhysicsBodyGroup, PhysicsBodyGroup])[];
959
949
  interface CreatePhysicsWorldRequestDTO {
960
- readonly attachTo: number;
950
+ readonly attachTo: AttachmentID;
961
951
  readonly mapSize: Vector;
962
952
  readonly modifyUpdateCycle: boolean;
963
953
  readonly borderProperties: BorderProperties;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as actions_lib from 'actions-lib';
2
- import { IDAttachable, Attachable, SingleEvent, Sequence, SingleNotifier, Notifier, Reducer, Variable, Action } from 'actions-lib';
2
+ import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent, Reducer, Variable, Action, ClassID } from 'actions-lib';
3
3
  import { Vector, Radian, Rectangle, Vec2, RGBColor, Grid, GridNeighborType, Line } from 'helpers-lib';
4
4
  import * as Pixi from 'pixi.js';
5
5
 
@@ -22,7 +22,7 @@ declare abstract class Entity extends IDAttachable {
22
22
  constructor();
23
23
  destroy(): void;
24
24
  attach(parent: Attachable): this;
25
- attachByID(id: number): this;
25
+ attachByID(id: AttachmentID): this;
26
26
  attachToRoot(): this;
27
27
  }
28
28
 
@@ -30,8 +30,8 @@ type SingletonEntityClassType<T extends SingletonEntity = SingletonEntity> = (ne
30
30
  id: number;
31
31
  };
32
32
  declare abstract class SingletonEntity extends Entity {
33
- static getInstanceAsync<T extends SingletonEntity>(this: SingletonEntityClassType<T>): SingleEvent<T>;
34
- static continuesSubscription<T extends SingletonEntity>(this: SingletonEntityClassType<T>): Sequence<{
33
+ static getInstanceAsync<T extends SingletonEntity>(this: SingletonEntityClassType<T>): IdleSingleEvent<T>;
34
+ static continuesSubscription<T extends SingletonEntity>(this: SingletonEntityClassType<T>): IdleSequence<{
35
35
  type: 'open' | 'close';
36
36
  value: T;
37
37
  }>;
@@ -49,23 +49,21 @@ type SceneClassType = new (...services: unknown[]) => Scene<unknown, unknown>;
49
49
  type SceneInput<T> = T extends Scene<infer I, any> ? I : never;
50
50
  declare function SceneDecorator(): (SceneClass: SceneClassType) => any;
51
51
  declare abstract class Scene<InputType, OutputType> extends IDAttachable {
52
- static readonly isTransitioning: actions_lib.Notifier<boolean>;
53
- static getIsTransitioning(this: typeof Scene): boolean;
54
- static readonly activeScene: actions_lib.Notifier<Scene<unknown, unknown> | undefined>;
55
- static getActiveScene(this: typeof Scene): Scene<unknown, unknown> | undefined;
52
+ static readonly isTransitioning: actions_lib.PersistentNotifier<boolean>;
53
+ static readonly activeScene: actions_lib.PersistentNotifier<Scene<unknown, unknown> | undefined>;
56
54
  static getActiveSceneOrFail(this: typeof Scene): Scene<unknown, unknown>;
57
- static cancelActiveScene(): SingleEvent;
55
+ static cancelActiveScene(): IdleSingleEvent;
58
56
  static isActive<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): boolean;
59
57
  static getInstance<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T | undefined;
60
58
  static getInstanceOrFail<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T;
61
- static open<T extends Scene<any, any>>(this: new (...args1: unknown[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): SingleEvent<T>;
62
- readonly onClose: actions_lib.SingleNotifier<OutputType>;
59
+ static open<T extends Scene<any, any>>(this: new (...args1: unknown[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): IdleSingleEvent<T>;
60
+ readonly onClose: actions_lib.PersistentSingleNotifier<OutputType>;
63
61
  constructor();
64
- close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): SingleEvent<OutputType>;
62
+ close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): IdleSingleEvent<OutputType>;
65
63
  private animateAndClose;
66
- protected abstract init(input: InputType): SingleEvent;
64
+ protected abstract init(input: InputType): IdleSingleEvent;
67
65
  protected abstract update(time: number, delta: number): void;
68
- protected abstract prepareToClose(): SingleEvent;
66
+ protected abstract prepareToClose(): IdleSingleEvent;
69
67
  /**
70
68
  * @deprecated
71
69
  */
@@ -90,7 +88,7 @@ declare class UpdateCycle {
90
88
  time: number;
91
89
  delta: number;
92
90
  }>;
93
- static wait(duration: number): SingleEvent;
91
+ static wait(duration: number): IdleSingleEvent;
94
92
  static registerUpdateModifier(callback: (time: number, delta: number) => number): void;
95
93
  static cleanUpdateModifier(): void;
96
94
  static triggerUpdateTick(delta: number): void;
@@ -442,26 +440,25 @@ interface MenuOptions {
442
440
  readonly backgroundDarkeningRatio: number;
443
441
  }
444
442
  declare class MenuUI extends Container {
445
- static isAnyMenuTransitioning: actions_lib.Notifier<boolean>;
446
- static getIsAnyMenuTransitioning(this: typeof MenuUI): boolean;
447
- readonly onCreate: actions_lib.SingleNotifier<void>;
448
- readonly onOpen: actions_lib.SingleNotifier<void>;
449
- readonly onClose: actions_lib.SingleNotifier<void>;
443
+ static isAnyMenuTransitioning: actions_lib.PersistentNotifier<boolean>;
444
+ readonly onCreate: actions_lib.PersistentSingleNotifier<void>;
445
+ readonly onOpen: actions_lib.PersistentSingleNotifier<void>;
446
+ readonly onClose: actions_lib.PersistentSingleNotifier<void>;
450
447
  constructor(windowSprite: string, partialOptions: Partial<MenuOptions>);
451
448
  getBoundingMask(): Sprite;
452
- close(): SingleEvent;
449
+ close(): IdleSingleEvent;
453
450
  }
454
451
 
455
452
  interface MenuEntityOptions {
456
453
  readonly closeOnBackgroundClick: boolean;
457
454
  }
458
455
  declare class MenuEntity extends SingletonEntity {
459
- static subscribeIsOpen(): Sequence<boolean>;
456
+ static subscribeIsOpen(): IdleSequence<boolean>;
460
457
  constructor(partialOptions: Partial<MenuEntityOptions>);
461
- onCreate(): SingleEvent;
462
- onOpen(): SingleEvent;
463
- onClose(): SingleEvent;
464
- close(): SingleEvent;
458
+ onCreate(): IdleSingleEvent;
459
+ onOpen(): IdleSingleEvent;
460
+ onClose(): IdleSingleEvent;
461
+ close(): IdleSingleEvent;
465
462
  }
466
463
 
467
464
  interface MenuViewOptions {
@@ -748,7 +745,7 @@ declare class Camera {
748
745
  constructor();
749
746
  setPosition(position: Vector): void;
750
747
  setTransition(options: FocusingOptions): void;
751
- appear(on: boolean, type?: CameraAppearTransitionType): SingleEvent;
748
+ appear(on: boolean, type?: CameraAppearTransitionType): IdleSingleEvent;
752
749
  }
753
750
 
754
751
  interface GameConfiguration {
@@ -777,11 +774,9 @@ declare class Game {
777
774
  readonly stage: Container;
778
775
  readonly renderer: Pixi.Renderer;
779
776
  readonly _screenSize: Variable<Vector>;
780
- readonly screenSize: actions_lib.Notifier<Vector>;
781
- getScreenSize(): Vector;
777
+ readonly screenSize: actions_lib.PersistentNotifier<Vector>;
782
778
  readonly _screenSizeCenter: Variable<Vector>;
783
- readonly screenSizeCenter: actions_lib.Notifier<Vector>;
784
- getScreenSizeCenter(): Vector;
779
+ readonly screenSizeCenter: actions_lib.PersistentNotifier<Vector>;
785
780
  readonly devMode: boolean;
786
781
  constructor(partialConfiguration?: Partial<GameConfiguration>);
787
782
  setup(setupOptions: GameSetupOptions): Promise<void>;
@@ -813,16 +808,11 @@ declare class KeyboardService {
813
808
  }
814
809
 
815
810
  declare class MouseService {
816
- readonly onInitialMouseMove: actions_lib.Notifier<boolean>;
817
- get initialMouseMoveHappened(): boolean;
818
- readonly stagePosition: actions_lib.Notifier<Vector>;
819
- getStagePosition(): Vector;
820
- readonly screenPosition: actions_lib.Notifier<Vector>;
821
- getScreenPosition(): Vector;
822
- readonly mainButtonState: actions_lib.Notifier<boolean>;
823
- getMainButtonState(): boolean;
824
- readonly secondaryButtonState: actions_lib.Notifier<boolean>;
825
- getSecondaryButtonState(): boolean;
811
+ readonly initialMouseMovementHappened: actions_lib.PersistentNotifier<boolean>;
812
+ readonly stagePosition: actions_lib.PersistentNotifier<Vector>;
813
+ readonly screenPosition: actions_lib.PersistentNotifier<Vector>;
814
+ readonly mainButtonState: actions_lib.PersistentNotifier<boolean>;
815
+ readonly secondaryButtonState: actions_lib.PersistentNotifier<boolean>;
826
816
  constructor();
827
817
  /**
828
818
  * Maps viewport (DOM) coordinates to Pixi logical screen space (`renderer.screen`),
@@ -846,7 +836,7 @@ declare const SPEED_LIMIT = 10.8;
846
836
  declare const ROTATIONAL_SPEED_LIMIT = 10.01;
847
837
  interface PhysicsBodyDTO {
848
838
  readonly entityID: number;
849
- readonly classID: number;
839
+ readonly classID: ClassID;
850
840
  readonly position: Vector;
851
841
  readonly rotation: Radian;
852
842
  readonly velocity: Vector;
@@ -957,7 +947,7 @@ interface BorderProperties {
957
947
 
958
948
  type InteractingBodyGroups = readonly (readonly [PhysicsBodyGroup, PhysicsBodyGroup])[];
959
949
  interface CreatePhysicsWorldRequestDTO {
960
- readonly attachTo: number;
950
+ readonly attachTo: AttachmentID;
961
951
  readonly mapSize: Vector;
962
952
  readonly modifyUpdateCycle: boolean;
963
953
  readonly borderProperties: BorderProperties;