@drincs/pixi-vn 0.4.1 → 0.4.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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as pixi_js from 'pixi.js';
2
- import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
2
+ import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, ContainerChild, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
3
3
  export { Assets } from 'pixi.js';
4
4
  import deepDiff from 'deep-diff';
5
5
 
@@ -531,25 +531,19 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
531
531
  * @param fn
532
532
  * @param context
533
533
  */
534
- on<T extends keyof ContainerEvents | keyof {
534
+ on<T extends keyof ContainerEvents<ContainerChild> | keyof {
535
535
  [K: symbol]: any;
536
536
  [K: {} & string]: any;
537
- }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents & {
537
+ }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & {
538
538
  [K: symbol]: any;
539
539
  [K: {} & string]: any;
540
- }>[Extract<T, keyof ContainerEvents | keyof {
540
+ }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof {
541
541
  [K: symbol]: any;
542
542
  [K: {} & string]: any;
543
543
  }>]) => void, context?: any): this;
544
544
  static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any>;
545
545
  }
546
546
 
547
- interface CanvasImageOptions extends SpriteOptions {
548
- /**
549
- * The image link to load in the canvas.
550
- */
551
- textureImage?: string;
552
- }
553
547
  /**
554
548
  * This class is a extension of the CanvasSprite class, it has the same properties and methods,
555
549
  * but it has some features that make texture management easier.
@@ -557,11 +551,11 @@ interface CanvasImageOptions extends SpriteOptions {
557
551
  * This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
558
552
  * @example
559
553
  * ```typescript
560
- * let alien = new CanvasImage({ textureImage: 'https://pixijs.com/assets/eggHead.png' })
554
+ * let alien = new CanvasImage()
561
555
  * alien.anchor.set(0.5);
562
556
  * alien.x = 100
563
557
  * alien.y = 100
564
- * await alien.load()
558
+ * await alien.load('https://pixijs.com/assets/eggHead.png')
565
559
  * GameWindowManager.addCanvasElement("alien", alien)
566
560
  * ```
567
561
  * @example
@@ -574,16 +568,16 @@ interface CanvasImageOptions extends SpriteOptions {
574
568
  * ```
575
569
  */
576
570
  declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
577
- constructor(options?: CanvasImageOptions | Texture | undefined);
578
571
  get memory(): ICanvasImageMemory;
579
572
  set memory(memory: ICanvasImageMemory);
580
573
  imageLink: string;
581
574
  static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasImage;
582
575
  /**
583
- * Load the image in the canvas.
584
- * @returns a promise that resolves when the image is loaded.
576
+ * Load the image from the link and set the texture of the sprite.
577
+ * @param image The link of the image. If it is not set, it will use the imageLink property.
578
+ * @returns A promise that resolves when the image is loaded.
585
579
  */
586
- load(): Promise<void>;
580
+ load(image?: string): Promise<void>;
587
581
  }
588
582
 
589
583
  /**
@@ -642,13 +636,13 @@ declare class CanvasText extends Text implements CanvasBase<ICanvasTextMemory> {
642
636
  * @param fn
643
637
  * @param context
644
638
  */
645
- on<T extends keyof ContainerEvents | keyof {
639
+ on<T extends keyof ContainerEvents<ContainerChild> | keyof {
646
640
  [K: symbol]: any;
647
641
  [K: {} & string]: any;
648
- }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents & {
642
+ }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & {
649
643
  [K: symbol]: any;
650
644
  [K: {} & string]: any;
651
- }>[Extract<T, keyof ContainerEvents | keyof {
645
+ }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof {
652
646
  [K: symbol]: any;
653
647
  [K: {} & string]: any;
654
648
  }>]) => void, context?: any): this;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as pixi_js from 'pixi.js';
2
- import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
2
+ import { ContainerOptions, SpriteOptions, TextOptions, Container, Sprite, ContainerEvents, ContainerChild, EventEmitter, Texture, TextureSourceLike, Text, UPDATE_PRIORITY, Ticker, TickerCallback, Application, ApplicationOptions } from 'pixi.js';
3
3
  export { Assets } from 'pixi.js';
4
4
  import deepDiff from 'deep-diff';
5
5
 
@@ -531,25 +531,19 @@ declare class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = IC
531
531
  * @param fn
532
532
  * @param context
533
533
  */
534
- on<T extends keyof ContainerEvents | keyof {
534
+ on<T extends keyof ContainerEvents<ContainerChild> | keyof {
535
535
  [K: symbol]: any;
536
536
  [K: {} & string]: any;
537
- }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents & {
537
+ }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & {
538
538
  [K: symbol]: any;
539
539
  [K: {} & string]: any;
540
- }>[Extract<T, keyof ContainerEvents | keyof {
540
+ }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof {
541
541
  [K: symbol]: any;
542
542
  [K: {} & string]: any;
543
543
  }>]) => void, context?: any): this;
544
544
  static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any>;
545
545
  }
546
546
 
547
- interface CanvasImageOptions extends SpriteOptions {
548
- /**
549
- * The image link to load in the canvas.
550
- */
551
- textureImage?: string;
552
- }
553
547
  /**
554
548
  * This class is a extension of the CanvasSprite class, it has the same properties and methods,
555
549
  * but it has some features that make texture management easier.
@@ -557,11 +551,11 @@ interface CanvasImageOptions extends SpriteOptions {
557
551
  * This class is used for functions like addImage, loadImages and showImageWithDissolveTransition.
558
552
  * @example
559
553
  * ```typescript
560
- * let alien = new CanvasImage({ textureImage: 'https://pixijs.com/assets/eggHead.png' })
554
+ * let alien = new CanvasImage()
561
555
  * alien.anchor.set(0.5);
562
556
  * alien.x = 100
563
557
  * alien.y = 100
564
- * await alien.load()
558
+ * await alien.load('https://pixijs.com/assets/eggHead.png')
565
559
  * GameWindowManager.addCanvasElement("alien", alien)
566
560
  * ```
567
561
  * @example
@@ -574,16 +568,16 @@ interface CanvasImageOptions extends SpriteOptions {
574
568
  * ```
575
569
  */
576
570
  declare class CanvasImage extends CanvasSprite<ICanvasImageMemory> {
577
- constructor(options?: CanvasImageOptions | Texture | undefined);
578
571
  get memory(): ICanvasImageMemory;
579
572
  set memory(memory: ICanvasImageMemory);
580
573
  imageLink: string;
581
574
  static from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasImage;
582
575
  /**
583
- * Load the image in the canvas.
584
- * @returns a promise that resolves when the image is loaded.
576
+ * Load the image from the link and set the texture of the sprite.
577
+ * @param image The link of the image. If it is not set, it will use the imageLink property.
578
+ * @returns A promise that resolves when the image is loaded.
585
579
  */
586
- load(): Promise<void>;
580
+ load(image?: string): Promise<void>;
587
581
  }
588
582
 
589
583
  /**
@@ -642,13 +636,13 @@ declare class CanvasText extends Text implements CanvasBase<ICanvasTextMemory> {
642
636
  * @param fn
643
637
  * @param context
644
638
  */
645
- on<T extends keyof ContainerEvents | keyof {
639
+ on<T extends keyof ContainerEvents<ContainerChild> | keyof {
646
640
  [K: symbol]: any;
647
641
  [K: {} & string]: any;
648
- }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents & {
642
+ }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & {
649
643
  [K: symbol]: any;
650
644
  [K: {} & string]: any;
651
- }>[Extract<T, keyof ContainerEvents | keyof {
645
+ }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof {
652
646
  [K: symbol]: any;
653
647
  [K: {} & string]: any;
654
648
  }>]) => void, context?: any): this;
package/dist/index.js CHANGED
@@ -665,12 +665,9 @@ function setMemorySprite(element, memory) {
665
665
 
666
666
  // src/classes/canvas/CanvasImage.ts
667
667
  var CanvasImage = class _CanvasImage extends CanvasSprite {
668
- constructor(options) {
669
- super(options);
668
+ constructor() {
669
+ super(...arguments);
670
670
  this.imageLink = "";
671
- if (options && typeof options === "object" && "textureImage" in options && options.textureImage) {
672
- this.imageLink = options.textureImage;
673
- }
674
671
  }
675
672
  get memory() {
676
673
  return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
@@ -688,11 +685,15 @@ var CanvasImage = class _CanvasImage extends CanvasSprite {
688
685
  return mySprite;
689
686
  }
690
687
  /**
691
- * Load the image in the canvas.
692
- * @returns a promise that resolves when the image is loaded.
688
+ * Load the image from the link and set the texture of the sprite.
689
+ * @param image The link of the image. If it is not set, it will use the imageLink property.
690
+ * @returns A promise that resolves when the image is loaded.
693
691
  */
694
- load() {
692
+ load(image) {
695
693
  return __async(this, null, function* () {
694
+ if (!image) {
695
+ image = this.imageLink;
696
+ }
696
697
  return getTexture(this.imageLink).then((texture) => {
697
698
  if (texture) {
698
699
  this.texture = texture;
@@ -1118,7 +1119,7 @@ function showImageWithDissolveTransition(tag, imageUrl, speed, priority) {
1118
1119
  }
1119
1120
 
1120
1121
  // src/constants.ts
1121
- var PIXIVN_VERSION = "0.4.1";
1122
+ var PIXIVN_VERSION = "0.4.3";
1122
1123
 
1123
1124
  // src/functions/SavesUtility.ts
1124
1125
  function getSaveData() {