@eva/renderer-adapter 2.0.1-beta.2 → 2.0.1-beta.20
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.
|
@@ -4,6 +4,17 @@ var _EVA_IIFE_rendererAdapter = function (exports, pixi_js) {
|
|
|
4
4
|
|
|
5
5
|
class Container extends pixi_js.Container {}
|
|
6
6
|
class Graphics extends pixi_js.Graphics {}
|
|
7
|
+
class HTMLText extends pixi_js.HTMLText {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
if (typeof options === 'string') {
|
|
10
|
+
super({
|
|
11
|
+
text: options
|
|
12
|
+
});
|
|
13
|
+
} else {
|
|
14
|
+
super(options || {});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
7
18
|
class NinePatch extends pixi_js.NineSliceSprite {
|
|
8
19
|
constructor(img, leftWidth, topHeight, rightWidth, bottomHeight) {
|
|
9
20
|
let texture;
|
|
@@ -121,7 +132,7 @@ var _EVA_IIFE_rendererAdapter = function (exports, pixi_js) {
|
|
|
121
132
|
this._image = null;
|
|
122
133
|
this._image = image;
|
|
123
134
|
if (image) {
|
|
124
|
-
if (image instanceof HTMLImageElement) {
|
|
135
|
+
if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) {
|
|
125
136
|
this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.from(image));
|
|
126
137
|
} else if (image instanceof pixi_js.Texture) {
|
|
127
138
|
this.tilingSprite = new pixi_js.TilingSprite(image);
|
|
@@ -134,7 +145,7 @@ var _EVA_IIFE_rendererAdapter = function (exports, pixi_js) {
|
|
|
134
145
|
if (this._image === val) {
|
|
135
146
|
return;
|
|
136
147
|
}
|
|
137
|
-
if (val instanceof HTMLImageElement) {
|
|
148
|
+
if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) {
|
|
138
149
|
this.tilingSprite.texture = pixi_js.Texture.from(val);
|
|
139
150
|
} else if (val instanceof pixi_js.Texture) {
|
|
140
151
|
this.tilingSprite.texture = val;
|
|
@@ -148,6 +159,7 @@ var _EVA_IIFE_rendererAdapter = function (exports, pixi_js) {
|
|
|
148
159
|
exports.Application = pixi_js.Application;
|
|
149
160
|
exports.Container = Container;
|
|
150
161
|
exports.Graphics = Graphics;
|
|
162
|
+
exports.HTMLText = HTMLText;
|
|
151
163
|
exports.NinePatch = NinePatch;
|
|
152
164
|
exports.Sprite = Sprite;
|
|
153
165
|
exports.SpriteAnimation = SpriteAnimation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.EVA=globalThis.EVA||{};var _EVA_IIFE_rendererAdapter=function(e,t){"use strict";class i extends t.Container{}class r extends t.Graphics{}class n extends t.NineSliceSprite{constructor(e,i,r,n,s){let a;a=e instanceof t.Texture?e:t.Texture.from(e),super({texture:a,leftWidth:i,topHeight:r,rightWidth:n,bottomHeight:s})}}class
|
|
1
|
+
globalThis.EVA=globalThis.EVA||{};var _EVA_IIFE_rendererAdapter=function(e,t){"use strict";class i extends t.Container{}class r extends t.Graphics{}class n extends t.HTMLText{constructor(e){super("string"==typeof e?{text:e}:e||{})}}class s extends t.NineSliceSprite{constructor(e,i,r,n,s){let a;a=e instanceof t.Texture?e:t.Texture.from(e),super({texture:a,leftWidth:i,topHeight:r,rightWidth:n,bottomHeight:s})}}class a extends t.Text{constructor(e,i){if(i.strokeThickness){const e=i.stroke;i.stroke={color:e,width:i.strokeThickness},delete i.strokeThickness}if(Array.isArray(i.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),i.fill=i.fill[0]),Array.isArray(i.fillGradientStops)){let e;null==i.fontSize?i.fontSize=t.TextStyle.defaultTextStyle.fontSize:e="string"==typeof i.fontSize?parseInt(i.fontSize,10):i.fontSize;const r=new t.FillGradient(0,0,0,1.7*e),n=i.fillGradientStops.map((e=>t.Color.shared.setValue(e).toNumber()));n.forEach(((e,t)=>{const i=t/(n.length-1);r.addColorStop(i,e)})),i.fill={fill:r},delete i.fillGradientStops}super({text:e,style:i})}}return e.Application=t.Application,e.Container=i,e.Graphics=r,e.HTMLText=n,e.NinePatch=s,e.Sprite=class{constructor(e){this._image=null,this._image=e,e?"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?this.sprite=t.Sprite.from(e):e instanceof t.Texture&&(this.sprite=new t.Sprite(e)):this.sprite=new t.Sprite}set image(e){this._image!==e&&("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=t.Texture.from(e)):e instanceof t.Texture&&(this.sprite.texture=e),this._image=e)}get image(){return this._image}},e.SpriteAnimation=class{constructor({frames:e}){this.animatedSprite=new t.AnimatedSprite(e)}play(){this.animatedSprite.play()}stop(){this.animatedSprite.stop()}gotoAndPlay(e){this.animatedSprite.gotoAndPlay(e)}gotoAndStop(e){this.animatedSprite.gotoAndStop(e)}set speed(e){this.animatedSprite.animationSpeed=e}get speed(){return this.animatedSprite.animationSpeed}},e.Text=a,e.TilingSprite=class{constructor(e){this._image=null,this._image=e,e?"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?this.tilingSprite=new t.TilingSprite(t.Texture.from(e)):e instanceof t.Texture&&(this.tilingSprite=new t.TilingSprite(e)):this.tilingSprite=new t.TilingSprite(t.Texture.EMPTY)}set image(e){this._image!==e&&("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?this.tilingSprite.texture=t.Texture.from(e):e instanceof t.Texture&&(this.tilingSprite.texture=e),this._image=e)}get image(){return this._image}},Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI);globalThis.EVA.rendererAdapter=globalThis.EVA.rendererAdapter||_EVA_IIFE_rendererAdapter;
|
|
@@ -10,6 +10,17 @@ class Container extends pixi_js.Container {
|
|
|
10
10
|
class Graphics extends pixi_js.Graphics {
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
class HTMLText extends pixi_js.HTMLText {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
if (typeof options === 'string') {
|
|
16
|
+
super({ text: options });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
super(options || {});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
class NinePatch extends pixi_js.NineSliceSprite {
|
|
14
25
|
constructor(img, leftWidth, topHeight, rightWidth, bottomHeight) {
|
|
15
26
|
let texture;
|
|
@@ -135,7 +146,7 @@ class TilingSprite {
|
|
|
135
146
|
this._image = null;
|
|
136
147
|
this._image = image;
|
|
137
148
|
if (image) {
|
|
138
|
-
if (image instanceof HTMLImageElement) {
|
|
149
|
+
if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) {
|
|
139
150
|
this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.from(image));
|
|
140
151
|
}
|
|
141
152
|
else if (image instanceof pixi_js.Texture) {
|
|
@@ -150,7 +161,7 @@ class TilingSprite {
|
|
|
150
161
|
if (this._image === val) {
|
|
151
162
|
return;
|
|
152
163
|
}
|
|
153
|
-
if (val instanceof HTMLImageElement) {
|
|
164
|
+
if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) {
|
|
154
165
|
this.tilingSprite.texture = pixi_js.Texture.from(val);
|
|
155
166
|
}
|
|
156
167
|
else if (val instanceof pixi_js.Texture) {
|
|
@@ -166,6 +177,7 @@ class TilingSprite {
|
|
|
166
177
|
exports.Application = pixi_js.Application;
|
|
167
178
|
exports.Container = Container;
|
|
168
179
|
exports.Graphics = Graphics;
|
|
180
|
+
exports.HTMLText = HTMLText;
|
|
169
181
|
exports.NinePatch = NinePatch;
|
|
170
182
|
exports.Sprite = Sprite;
|
|
171
183
|
exports.SpriteAnimation = SpriteAnimation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js");class t extends e.Container{}class i extends e.Graphics{}class r extends e.NineSliceSprite{constructor(t,i,r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js");class t extends e.Container{}class i extends e.Graphics{}class s extends e.HTMLText{constructor(e){super("string"==typeof e?{text:e}:e||{})}}class r extends e.NineSliceSprite{constructor(t,i,s,r,n){let o;o=t instanceof e.Texture?t:e.Texture.from(t),super({texture:o,leftWidth:i,topHeight:s,rightWidth:r,bottomHeight:n})}}class n extends e.Text{constructor(t,i){if(i.strokeThickness){const e=i.stroke;i.stroke={color:e,width:i.strokeThickness},delete i.strokeThickness}if(Array.isArray(i.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),i.fill=i.fill[0]),Array.isArray(i.fillGradientStops)){let t;null==i.fontSize?i.fontSize=e.TextStyle.defaultTextStyle.fontSize:t="string"==typeof i.fontSize?parseInt(i.fontSize,10):i.fontSize;const s=new e.FillGradient(0,0,0,1.7*t),r=i.fillGradientStops.map((t=>e.Color.shared.setValue(t).toNumber()));r.forEach(((e,t)=>{const i=t/(r.length-1);s.addColorStop(i,e)})),i.fill={fill:s},delete i.fillGradientStops}super({text:t,style:i})}}exports.Application=e.Application,exports.Container=t,exports.Graphics=i,exports.HTMLText=s,exports.NinePatch=r,exports.Sprite=class{constructor(t){this._image=null,this._image=t,t?"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?this.sprite=e.Sprite.from(t):t instanceof e.Texture&&(this.sprite=new e.Sprite(t)):this.sprite=new e.Sprite}set image(t){this._image!==t&&("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=e.Texture.from(t)):t instanceof e.Texture&&(this.sprite.texture=t),this._image=t)}get image(){return this._image}},exports.SpriteAnimation=class{constructor({frames:t}){this.animatedSprite=new e.AnimatedSprite(t)}play(){this.animatedSprite.play()}stop(){this.animatedSprite.stop()}gotoAndPlay(e){this.animatedSprite.gotoAndPlay(e)}gotoAndStop(e){this.animatedSprite.gotoAndStop(e)}set speed(e){this.animatedSprite.animationSpeed=e}get speed(){return this.animatedSprite.animationSpeed}},exports.Text=n,exports.TilingSprite=class{constructor(t){this._image=null,this._image=t,t?"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?this.tilingSprite=new e.TilingSprite(e.Texture.from(t)):t instanceof e.Texture&&(this.tilingSprite=new e.TilingSprite(t)):this.tilingSprite=new e.TilingSprite(e.Texture.EMPTY)}set image(t){this._image!==t&&("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?this.tilingSprite.texture=e.Texture.from(t):t instanceof e.Texture&&(this.tilingSprite.texture=t),this._image=t)}get image(){return this._image}};
|
|
@@ -2,6 +2,9 @@ import { AnimatedSprite } from 'pixi.js';
|
|
|
2
2
|
import { Application } from 'pixi.js';
|
|
3
3
|
import { Container as Container_2 } from 'pixi.js';
|
|
4
4
|
import { Graphics as Graphics_2 } from 'pixi.js';
|
|
5
|
+
import { HTMLText as HTMLText_2 } from 'pixi.js';
|
|
6
|
+
import type { HTMLTextOptions } from 'pixi.js';
|
|
7
|
+
import type { HTMLTextStyle } from 'pixi.js';
|
|
5
8
|
import { NineSliceSprite } from 'pixi.js';
|
|
6
9
|
import { Sprite as Sprite_2 } from 'pixi.js';
|
|
7
10
|
import { Text as Text_3 } from 'pixi.js';
|
|
@@ -18,6 +21,12 @@ export declare class Graphics extends Graphics_2 {
|
|
|
18
21
|
[propName: string]: any;
|
|
19
22
|
}
|
|
20
23
|
|
|
24
|
+
export declare class HTMLText extends HTMLText_2 {
|
|
25
|
+
constructor(options?: string | HTMLTextOptions);
|
|
26
|
+
}
|
|
27
|
+
export { HTMLTextOptions }
|
|
28
|
+
export { HTMLTextStyle }
|
|
29
|
+
|
|
21
30
|
export declare class NinePatch extends NineSliceSprite {
|
|
22
31
|
constructor(img: any, leftWidth: any, topHeight: any, rightWidth: any, bottomHeight: any);
|
|
23
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container as Container$1, Graphics as Graphics$1, NineSliceSprite, Texture, Sprite as Sprite$1, AnimatedSprite, Text as Text$1, TextStyle, FillGradient, Color, TilingSprite as TilingSprite$1 } from 'pixi.js';
|
|
1
|
+
import { Container as Container$1, Graphics as Graphics$1, HTMLText as HTMLText$1, NineSliceSprite, Texture, Sprite as Sprite$1, AnimatedSprite, Text as Text$1, TextStyle, FillGradient, Color, TilingSprite as TilingSprite$1 } from 'pixi.js';
|
|
2
2
|
export { Application } from 'pixi.js';
|
|
3
3
|
|
|
4
4
|
class Container extends Container$1 {
|
|
@@ -7,6 +7,17 @@ class Container extends Container$1 {
|
|
|
7
7
|
class Graphics extends Graphics$1 {
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
class HTMLText extends HTMLText$1 {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
if (typeof options === 'string') {
|
|
13
|
+
super({ text: options });
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
super(options || {});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
class NinePatch extends NineSliceSprite {
|
|
11
22
|
constructor(img, leftWidth, topHeight, rightWidth, bottomHeight) {
|
|
12
23
|
let texture;
|
|
@@ -132,7 +143,7 @@ class TilingSprite {
|
|
|
132
143
|
this._image = null;
|
|
133
144
|
this._image = image;
|
|
134
145
|
if (image) {
|
|
135
|
-
if (image instanceof HTMLImageElement) {
|
|
146
|
+
if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) {
|
|
136
147
|
this.tilingSprite = new TilingSprite$1(Texture.from(image));
|
|
137
148
|
}
|
|
138
149
|
else if (image instanceof Texture) {
|
|
@@ -147,7 +158,7 @@ class TilingSprite {
|
|
|
147
158
|
if (this._image === val) {
|
|
148
159
|
return;
|
|
149
160
|
}
|
|
150
|
-
if (val instanceof HTMLImageElement) {
|
|
161
|
+
if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) {
|
|
151
162
|
this.tilingSprite.texture = Texture.from(val);
|
|
152
163
|
}
|
|
153
164
|
else if (val instanceof Texture) {
|
|
@@ -160,4 +171,4 @@ class TilingSprite {
|
|
|
160
171
|
}
|
|
161
172
|
}
|
|
162
173
|
|
|
163
|
-
export { Container, Graphics, NinePatch, Sprite, SpriteAnimation, Text, TilingSprite };
|
|
174
|
+
export { Container, Graphics, HTMLText, NinePatch, Sprite, SpriteAnimation, Text, TilingSprite };
|