@eva/renderer-adapter
Advanced tools
| function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } | ||
| globalThis.EVA = globalThis.EVA || {}; | ||
| var _EVA_IIFE_rendererAdapter = function (exports, pixi_js) { | ||
| 'use strict'; | ||
| class BitmapText extends pixi_js.BitmapText { | ||
| constructor(text, style) { | ||
| const processedStyle = _extends({}, style); | ||
| if (processedStyle.strokeThickness) { | ||
| const color = processedStyle.stroke; | ||
| processedStyle.stroke = { | ||
| color, | ||
| width: processedStyle.strokeThickness | ||
| }; | ||
| delete processedStyle['strokeThickness']; | ||
| } | ||
| if (processedStyle.dropShadow) { | ||
| const dropShadowConfig = {}; | ||
| if (processedStyle.dropShadowColor != null) dropShadowConfig.color = processedStyle.dropShadowColor; | ||
| if (processedStyle.dropShadowDistance != null) dropShadowConfig.distance = processedStyle.dropShadowDistance; | ||
| if (processedStyle.dropShadowAngle != null) dropShadowConfig.angle = processedStyle.dropShadowAngle; | ||
| if (processedStyle.dropShadowAlpha != null) dropShadowConfig.alpha = processedStyle.dropShadowAlpha; | ||
| if (processedStyle.dropShadowBlur != null) dropShadowConfig.blur = processedStyle.dropShadowBlur; | ||
| processedStyle.dropShadow = dropShadowConfig; | ||
| delete processedStyle['dropShadowColor']; | ||
| delete processedStyle['dropShadowDistance']; | ||
| delete processedStyle['dropShadowAngle']; | ||
| delete processedStyle['dropShadowAlpha']; | ||
| delete processedStyle['dropShadowBlur']; | ||
| } | ||
| if (Array.isArray(processedStyle.fill)) { | ||
| console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.'); | ||
| processedStyle.fill = processedStyle.fill[0]; | ||
| } | ||
| super({ | ||
| text, | ||
| style: processedStyle | ||
| }); | ||
| } | ||
| } | ||
| class Container extends pixi_js.Container {} | ||
| class Graphics extends pixi_js.Graphics {} | ||
| class HTMLText extends pixi_js.HTMLText { | ||
| constructor(options) { | ||
| if (typeof options === 'string') { | ||
| super({ | ||
| text: options | ||
| }); | ||
| } else { | ||
| super(options || {}); | ||
| } | ||
| } | ||
| } | ||
| class NinePatch extends pixi_js.NineSliceSprite { | ||
| constructor(img, leftWidth, topHeight, rightWidth, bottomHeight, width, height) { | ||
| let texture; | ||
| if (img instanceof pixi_js.Texture) { | ||
| texture = img; | ||
| } else { | ||
| texture = pixi_js.Texture.from(img); | ||
| } | ||
| super({ | ||
| texture, | ||
| leftWidth, | ||
| topHeight, | ||
| rightWidth, | ||
| bottomHeight, | ||
| width, | ||
| height | ||
| }); | ||
| } | ||
| } | ||
| class Sprite { | ||
| constructor(image) { | ||
| this._image = null; | ||
| this._image = image; | ||
| if (image) { | ||
| if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) { | ||
| this.sprite = pixi_js.Sprite.from(image); | ||
| } else if (image instanceof pixi_js.Texture) { | ||
| this.sprite = new pixi_js.Sprite(image); | ||
| } | ||
| } else { | ||
| this.sprite = new pixi_js.Sprite(); | ||
| } | ||
| } | ||
| set image(val) { | ||
| if (this._image === val) { | ||
| return; | ||
| } | ||
| if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) { | ||
| this.sprite.texture && this.sprite.texture.destroy(false); | ||
| this.sprite.texture = pixi_js.Texture.from(val); | ||
| } else if (val instanceof pixi_js.Texture) { | ||
| this.sprite.texture = val; | ||
| } | ||
| this._image = val; | ||
| } | ||
| get image() { | ||
| return this._image; | ||
| } | ||
| } | ||
| class SpriteAnimation { | ||
| constructor({ | ||
| frames | ||
| }) { | ||
| this.animatedSprite = new pixi_js.AnimatedSprite(frames); | ||
| } | ||
| play() { | ||
| this.animatedSprite.play(); | ||
| } | ||
| stop() { | ||
| this.animatedSprite.stop(); | ||
| } | ||
| gotoAndPlay(frameNumber) { | ||
| this.animatedSprite.gotoAndPlay(frameNumber); | ||
| } | ||
| gotoAndStop(frameNumber) { | ||
| this.animatedSprite.gotoAndStop(frameNumber); | ||
| } | ||
| set speed(val) { | ||
| this.animatedSprite.animationSpeed = val; | ||
| } | ||
| get speed() { | ||
| return this.animatedSprite.animationSpeed; | ||
| } | ||
| } | ||
| class Text extends pixi_js.Text { | ||
| constructor(text, style) { | ||
| if (style.strokeThickness) { | ||
| const color = style.stroke; | ||
| style.stroke = { | ||
| color, | ||
| width: style.strokeThickness | ||
| }; | ||
| delete style['strokeThickness']; | ||
| } | ||
| if (style.dropShadow) { | ||
| const dropShadowConfig = {}; | ||
| if (style.dropShadowColor != null) dropShadowConfig.color = style.dropShadowColor; | ||
| if (style.dropShadowDistance != null) dropShadowConfig.distance = style.dropShadowDistance; | ||
| if (style.dropShadowAngle != null) dropShadowConfig.angle = style.dropShadowAngle; | ||
| if (style.dropShadowAlpha != null) dropShadowConfig.alpha = style.dropShadowAlpha; | ||
| if (style.dropShadowBlur != null) dropShadowConfig.blur = style.dropShadowBlur; | ||
| style.dropShadow = dropShadowConfig; | ||
| delete style['dropShadowColor']; | ||
| delete style['dropShadowDistance']; | ||
| delete style['dropShadowAngle']; | ||
| delete style['dropShadowAlpha']; | ||
| delete style['dropShadowBlur']; | ||
| } | ||
| if (Array.isArray(style.fill)) { | ||
| console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.'); | ||
| style.fill = style.fill[0]; | ||
| } | ||
| if (Array.isArray(style.fillGradientStops)) { | ||
| let fontSize; | ||
| if (style.fontSize == null) { | ||
| style.fontSize = pixi_js.TextStyle.defaultTextStyle.fontSize; | ||
| } else if (typeof style.fontSize === 'string') { | ||
| fontSize = parseInt(style.fontSize, 10); | ||
| } else { | ||
| fontSize = style.fontSize; | ||
| } | ||
| const gradientFill = new pixi_js.FillGradient(0, 0, 0, fontSize * 1.7); | ||
| const fills = style.fillGradientStops.map(color => pixi_js.Color.shared.setValue(color).toNumber()); | ||
| fills.forEach((number, index) => { | ||
| const ratio = index / (fills.length - 1); | ||
| gradientFill.addColorStop(ratio, number); | ||
| }); | ||
| style.fill = { | ||
| fill: gradientFill | ||
| }; | ||
| delete style['fillGradientStops']; | ||
| } | ||
| super({ | ||
| text, | ||
| style | ||
| }); | ||
| } | ||
| } | ||
| class TilingSprite { | ||
| constructor(image) { | ||
| this._image = null; | ||
| this._image = image; | ||
| if (image) { | ||
| if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) { | ||
| this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.from(image)); | ||
| } else if (image instanceof pixi_js.Texture) { | ||
| this.tilingSprite = new pixi_js.TilingSprite(image); | ||
| } | ||
| } else { | ||
| this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.EMPTY); | ||
| } | ||
| } | ||
| set image(val) { | ||
| if (this._image === val) { | ||
| return; | ||
| } | ||
| if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) { | ||
| this.tilingSprite.texture = pixi_js.Texture.from(val); | ||
| } else if (val instanceof pixi_js.Texture) { | ||
| this.tilingSprite.texture = val; | ||
| } | ||
| this._image = val; | ||
| } | ||
| get image() { | ||
| return this._image; | ||
| } | ||
| } | ||
| exports.Application = pixi_js.Application; | ||
| exports.BitmapText = BitmapText; | ||
| exports.Container = Container; | ||
| exports.Graphics = Graphics; | ||
| exports.HTMLText = HTMLText; | ||
| exports.NinePatch = NinePatch; | ||
| exports.Sprite = Sprite; | ||
| exports.SpriteAnimation = SpriteAnimation; | ||
| exports.Text = Text; | ||
| exports.TilingSprite = TilingSprite; | ||
| Object.defineProperty(exports, '__esModule', { | ||
| value: true | ||
| }); | ||
| return exports; | ||
| }({}, PIXI); | ||
| globalThis.EVA.rendererAdapter = globalThis.EVA.rendererAdapter || _EVA_IIFE_rendererAdapter; |
| function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{};var _EVA_IIFE_rendererAdapter=function(e,t){"use strict";class r extends t.BitmapText{constructor(e,t){const r=_extends({},t);if(r.strokeThickness){const e=r.stroke;r.stroke={color:e,width:r.strokeThickness},delete r.strokeThickness}if(r.dropShadow){const e={};null!=r.dropShadowColor&&(e.color=r.dropShadowColor),null!=r.dropShadowDistance&&(e.distance=r.dropShadowDistance),null!=r.dropShadowAngle&&(e.angle=r.dropShadowAngle),null!=r.dropShadowAlpha&&(e.alpha=r.dropShadowAlpha),null!=r.dropShadowBlur&&(e.blur=r.dropShadowBlur),r.dropShadow=e,delete r.dropShadowColor,delete r.dropShadowDistance,delete r.dropShadowAngle,delete r.dropShadowAlpha,delete r.dropShadowBlur}Array.isArray(r.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),r.fill=r.fill[0]),super({text:e,style:r})}}class i extends t.Container{}class o extends t.Graphics{}class n extends t.HTMLText{constructor(e){super("string"==typeof e?{text:e}:e||{})}}class a extends t.NineSliceSprite{constructor(e,r,i,o,n,a,s){let l;l=e instanceof t.Texture?e:t.Texture.from(e),super({texture:l,leftWidth:r,topHeight:i,rightWidth:o,bottomHeight:n,width:a,height:s})}}class s extends t.Text{constructor(e,r){if(r.strokeThickness){const e=r.stroke;r.stroke={color:e,width:r.strokeThickness},delete r.strokeThickness}if(r.dropShadow){const e={};null!=r.dropShadowColor&&(e.color=r.dropShadowColor),null!=r.dropShadowDistance&&(e.distance=r.dropShadowDistance),null!=r.dropShadowAngle&&(e.angle=r.dropShadowAngle),null!=r.dropShadowAlpha&&(e.alpha=r.dropShadowAlpha),null!=r.dropShadowBlur&&(e.blur=r.dropShadowBlur),r.dropShadow=e,delete r.dropShadowColor,delete r.dropShadowDistance,delete r.dropShadowAngle,delete r.dropShadowAlpha,delete r.dropShadowBlur}if(Array.isArray(r.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),r.fill=r.fill[0]),Array.isArray(r.fillGradientStops)){let e;null==r.fontSize?r.fontSize=t.TextStyle.defaultTextStyle.fontSize:e="string"==typeof r.fontSize?parseInt(r.fontSize,10):r.fontSize;const i=new t.FillGradient(0,0,0,1.7*e),o=r.fillGradientStops.map(e=>t.Color.shared.setValue(e).toNumber());o.forEach((e,t)=>{const r=t/(o.length-1);i.addColorStop(r,e)}),r.fill={fill:i},delete r.fillGradientStops}super({text:e,style:r})}}return e.Application=t.Application,e.BitmapText=r,e.Container=i,e.Graphics=o,e.HTMLText=n,e.NinePatch=a,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=s,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; |
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| var pixi_js = require('pixi.js'); | ||
| class BitmapText extends pixi_js.BitmapText { | ||
| constructor(text, style) { | ||
| const processedStyle = Object.assign({}, style); | ||
| // @ts-ignore | ||
| if (processedStyle.strokeThickness) { | ||
| const color = processedStyle.stroke; | ||
| // @ts-ignore | ||
| processedStyle.stroke = { | ||
| color, | ||
| // @ts-ignore | ||
| width: processedStyle.strokeThickness, | ||
| }; | ||
| delete processedStyle['strokeThickness']; | ||
| } | ||
| // dropShadow* -> dropShadow: { color, distance, angle, alpha, blur } | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadow) { | ||
| const dropShadowConfig = {}; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowColor != null) | ||
| dropShadowConfig.color = processedStyle.dropShadowColor; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowDistance != null) | ||
| dropShadowConfig.distance = processedStyle.dropShadowDistance; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowAngle != null) | ||
| dropShadowConfig.angle = processedStyle.dropShadowAngle; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowAlpha != null) | ||
| dropShadowConfig.alpha = processedStyle.dropShadowAlpha; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowBlur != null) | ||
| dropShadowConfig.blur = processedStyle.dropShadowBlur; | ||
| // @ts-ignore | ||
| processedStyle.dropShadow = dropShadowConfig; | ||
| delete processedStyle['dropShadowColor']; | ||
| delete processedStyle['dropShadowDistance']; | ||
| delete processedStyle['dropShadowAngle']; | ||
| delete processedStyle['dropShadowAlpha']; | ||
| delete processedStyle['dropShadowBlur']; | ||
| } | ||
| if (Array.isArray(processedStyle.fill)) { | ||
| console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.'); | ||
| processedStyle.fill = processedStyle.fill[0]; | ||
| } | ||
| super({ | ||
| text, | ||
| style: processedStyle, | ||
| }); | ||
| } | ||
| } | ||
| class Container extends pixi_js.Container { | ||
| } | ||
| class Graphics extends pixi_js.Graphics { | ||
| } | ||
| class HTMLText extends pixi_js.HTMLText { | ||
| constructor(options) { | ||
| // 兼容字符串和对象两种参数形式 | ||
| if (typeof options === 'string') { | ||
| super({ text: options }); | ||
| } | ||
| else { | ||
| super(options || {}); | ||
| } | ||
| } | ||
| } | ||
| class NinePatch extends pixi_js.NineSliceSprite { | ||
| constructor(img, leftWidth, topHeight, rightWidth, bottomHeight, width, height) { | ||
| let texture; | ||
| if (img instanceof pixi_js.Texture) { | ||
| texture = img; | ||
| } | ||
| else { | ||
| texture = pixi_js.Texture.from(img); | ||
| } | ||
| super({ | ||
| texture, | ||
| leftWidth, | ||
| topHeight, | ||
| rightWidth, | ||
| bottomHeight, | ||
| width, | ||
| height, | ||
| }); | ||
| } | ||
| } | ||
| class Sprite { | ||
| constructor(image) { | ||
| this._image = null; | ||
| this._image = image; | ||
| if (image) { | ||
| if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) { | ||
| this.sprite = pixi_js.Sprite.from(image); | ||
| } | ||
| else if (image instanceof pixi_js.Texture) { | ||
| this.sprite = new pixi_js.Sprite(image); | ||
| } | ||
| } | ||
| else { | ||
| this.sprite = new pixi_js.Sprite(); | ||
| } | ||
| } | ||
| set image(val) { | ||
| if (this._image === val) { | ||
| return; | ||
| } | ||
| if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) { | ||
| this.sprite.texture && this.sprite.texture.destroy(false); | ||
| this.sprite.texture = pixi_js.Texture.from(val); | ||
| } | ||
| else if (val instanceof pixi_js.Texture) { | ||
| this.sprite.texture = val; | ||
| } | ||
| this._image = val; | ||
| } | ||
| get image() { | ||
| return this._image; | ||
| } | ||
| } | ||
| class SpriteAnimation { | ||
| constructor({ frames }) { | ||
| this.animatedSprite = new pixi_js.AnimatedSprite(frames); | ||
| } | ||
| play() { | ||
| this.animatedSprite.play(); | ||
| } | ||
| stop() { | ||
| this.animatedSprite.stop(); | ||
| } | ||
| gotoAndPlay(frameNumber) { | ||
| this.animatedSprite.gotoAndPlay(frameNumber); | ||
| } | ||
| gotoAndStop(frameNumber) { | ||
| this.animatedSprite.gotoAndStop(frameNumber); | ||
| } | ||
| set speed(val) { | ||
| this.animatedSprite.animationSpeed = val; | ||
| } | ||
| get speed() { | ||
| return this.animatedSprite.animationSpeed; | ||
| } | ||
| } | ||
| class Text extends pixi_js.Text { | ||
| constructor(text, style) { | ||
| // @ts-ignore | ||
| if (style.strokeThickness) { | ||
| const color = style.stroke; | ||
| // @ts-ignore | ||
| style.stroke = { | ||
| color, | ||
| // @ts-ignore | ||
| width: style.strokeThickness, | ||
| }; | ||
| delete style['strokeThickness']; | ||
| } | ||
| // dropShadow* -> dropShadow: { color, distance, angle, alpha, blur } | ||
| // @ts-ignore | ||
| if (style.dropShadow) { | ||
| const dropShadowConfig = {}; | ||
| // @ts-ignore | ||
| if (style.dropShadowColor != null) | ||
| dropShadowConfig.color = style.dropShadowColor; | ||
| // @ts-ignore | ||
| if (style.dropShadowDistance != null) | ||
| dropShadowConfig.distance = style.dropShadowDistance; | ||
| // @ts-ignore | ||
| if (style.dropShadowAngle != null) | ||
| dropShadowConfig.angle = style.dropShadowAngle; | ||
| // @ts-ignore | ||
| if (style.dropShadowAlpha != null) | ||
| dropShadowConfig.alpha = style.dropShadowAlpha; | ||
| // @ts-ignore | ||
| if (style.dropShadowBlur != null) | ||
| dropShadowConfig.blur = style.dropShadowBlur; | ||
| // @ts-ignore | ||
| style.dropShadow = dropShadowConfig; | ||
| delete style['dropShadowColor']; | ||
| delete style['dropShadowDistance']; | ||
| delete style['dropShadowAngle']; | ||
| delete style['dropShadowAlpha']; | ||
| delete style['dropShadowBlur']; | ||
| } | ||
| if (Array.isArray(style.fill)) { | ||
| console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.'); | ||
| style.fill = style.fill[0]; | ||
| } | ||
| // @ts-ignore | ||
| if (Array.isArray(style.fillGradientStops)) { | ||
| let fontSize; | ||
| if (style.fontSize == null) { | ||
| style.fontSize = pixi_js.TextStyle.defaultTextStyle.fontSize; | ||
| } | ||
| else if (typeof style.fontSize === 'string') { | ||
| fontSize = parseInt(style.fontSize, 10); | ||
| } | ||
| else { | ||
| fontSize = style.fontSize; | ||
| } | ||
| const gradientFill = new pixi_js.FillGradient(0, 0, 0, fontSize * 1.7); | ||
| // @ts-ignore | ||
| const fills = style.fillGradientStops.map(color => pixi_js.Color.shared.setValue(color).toNumber()); | ||
| fills.forEach((number, index) => { | ||
| const ratio = index / (fills.length - 1); | ||
| gradientFill.addColorStop(ratio, number); | ||
| }); | ||
| style.fill = { | ||
| fill: gradientFill, | ||
| }; | ||
| delete style['fillGradientStops']; | ||
| } | ||
| super({ | ||
| text, | ||
| style, | ||
| }); | ||
| } | ||
| } | ||
| class TilingSprite { | ||
| constructor(image) { | ||
| this._image = null; | ||
| this._image = image; | ||
| if (image) { | ||
| if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) { | ||
| this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.from(image)); | ||
| } | ||
| else if (image instanceof pixi_js.Texture) { | ||
| this.tilingSprite = new pixi_js.TilingSprite(image); | ||
| } | ||
| } | ||
| else { | ||
| this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.EMPTY); | ||
| } | ||
| } | ||
| set image(val) { | ||
| if (this._image === val) { | ||
| return; | ||
| } | ||
| if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) { | ||
| this.tilingSprite.texture = pixi_js.Texture.from(val); | ||
| } | ||
| else if (val instanceof pixi_js.Texture) { | ||
| this.tilingSprite.texture = val; | ||
| } | ||
| this._image = val; | ||
| } | ||
| get image() { | ||
| return this._image; | ||
| } | ||
| } | ||
| exports.Application = pixi_js.Application; | ||
| exports.BitmapText = BitmapText; | ||
| exports.Container = Container; | ||
| exports.Graphics = Graphics; | ||
| exports.HTMLText = HTMLText; | ||
| exports.NinePatch = NinePatch; | ||
| exports.Sprite = Sprite; | ||
| exports.SpriteAnimation = SpriteAnimation; | ||
| exports.Text = Text; | ||
| exports.TilingSprite = TilingSprite; |
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js");class t extends e.BitmapText{constructor(e,t){const i=Object.assign({},t);if(i.strokeThickness){const e=i.stroke;i.stroke={color:e,width:i.strokeThickness},delete i.strokeThickness}if(i.dropShadow){const e={};null!=i.dropShadowColor&&(e.color=i.dropShadowColor),null!=i.dropShadowDistance&&(e.distance=i.dropShadowDistance),null!=i.dropShadowAngle&&(e.angle=i.dropShadowAngle),null!=i.dropShadowAlpha&&(e.alpha=i.dropShadowAlpha),null!=i.dropShadowBlur&&(e.blur=i.dropShadowBlur),i.dropShadow=e,delete i.dropShadowColor,delete i.dropShadowDistance,delete i.dropShadowAngle,delete i.dropShadowAlpha,delete i.dropShadowBlur}Array.isArray(i.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),i.fill=i.fill[0]),super({text:e,style:i})}}class i extends e.Container{}class o extends e.Graphics{}class r extends e.HTMLText{constructor(e){super("string"==typeof e?{text:e}:e||{})}}class s extends e.NineSliceSprite{constructor(t,i,o,r,s,n,a){let l;l=t instanceof e.Texture?t:e.Texture.from(t),super({texture:l,leftWidth:i,topHeight:o,rightWidth:r,bottomHeight:s,width:n,height:a})}}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(i.dropShadow){const e={};null!=i.dropShadowColor&&(e.color=i.dropShadowColor),null!=i.dropShadowDistance&&(e.distance=i.dropShadowDistance),null!=i.dropShadowAngle&&(e.angle=i.dropShadowAngle),null!=i.dropShadowAlpha&&(e.alpha=i.dropShadowAlpha),null!=i.dropShadowBlur&&(e.blur=i.dropShadowBlur),i.dropShadow=e,delete i.dropShadowColor,delete i.dropShadowDistance,delete i.dropShadowAngle,delete i.dropShadowAlpha,delete i.dropShadowBlur}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 o=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);o.addColorStop(i,e)}),i.fill={fill:o},delete i.fillGradientStops}super({text:t,style:i})}}exports.Application=e.Application,exports.BitmapText=t,exports.Container=i,exports.Graphics=o,exports.HTMLText=r,exports.NinePatch=s,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}}; |
| import { AnimatedSprite } from 'pixi.js'; | ||
| import { Application } from 'pixi.js'; | ||
| import { BitmapText as BitmapText_2 } from 'pixi.js'; | ||
| import { Container as Container_2 } from 'pixi.js'; | ||
| import { Graphics as Graphics_2 } from 'pixi.js'; | ||
| import { HTMLText as HTMLText_2 } from 'pixi.js'; | ||
| import type { HTMLTextOptions } from 'pixi.js'; | ||
| import type { HTMLTextStyle } from 'pixi.js'; | ||
| import { NineSliceSprite } from 'pixi.js'; | ||
| import { Sprite as Sprite_2 } from 'pixi.js'; | ||
| import { Text as Text_3 } from 'pixi.js'; | ||
| import type { TextStyleOptions } from 'pixi.js'; | ||
| import { Texture } from 'pixi.js'; | ||
| import { TilingSprite as TilingSprite_2 } from 'pixi.js'; | ||
| export { Application } | ||
| export declare class BitmapText extends BitmapText_2 { | ||
| constructor(text: string, style?: TextStyleOptions); | ||
| } | ||
| export declare class Container extends Container_2 { | ||
| [propName: string]: any; | ||
| } | ||
| export declare class Graphics extends Graphics_2 { | ||
| [propName: string]: any; | ||
| } | ||
| export declare class HTMLText extends HTMLText_2 { | ||
| constructor(options?: string | HTMLTextOptions); | ||
| } | ||
| export { HTMLTextOptions } | ||
| export { HTMLTextStyle } | ||
| export declare class NinePatch extends NineSliceSprite { | ||
| constructor(img: any, leftWidth: any, topHeight: any, rightWidth: any, bottomHeight: any, width?: any, height?: any); | ||
| } | ||
| export declare class Sprite { | ||
| _image: HTMLImageElement | Texture; | ||
| sprite: Sprite_2; | ||
| constructor(image: HTMLImageElement | Texture); | ||
| set image(val: HTMLImageElement | Texture); | ||
| get image(): HTMLImageElement | Texture; | ||
| } | ||
| export declare class SpriteAnimation { | ||
| animatedSprite: AnimatedSprite; | ||
| constructor({ frames }: { | ||
| frames: any; | ||
| }); | ||
| play(): void; | ||
| stop(): void; | ||
| gotoAndPlay(frameNumber: any): void; | ||
| gotoAndStop(frameNumber: any): void; | ||
| set speed(val: number); | ||
| get speed(): number; | ||
| } | ||
| declare class Text_2 extends Text_3 { | ||
| constructor(text: string, style?: TextStyleOptions); | ||
| } | ||
| export { Text_2 as Text } | ||
| export declare class TilingSprite { | ||
| _image: HTMLImageElement | Texture; | ||
| tilingSprite: TilingSprite_2; | ||
| constructor(image: HTMLImageElement | Texture); | ||
| set image(val: Texture | HTMLImageElement); | ||
| get image(): Texture | HTMLImageElement; | ||
| } | ||
| export { } |
| import { BitmapText as BitmapText$1, 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'; | ||
| export { Application } from 'pixi.js'; | ||
| class BitmapText extends BitmapText$1 { | ||
| constructor(text, style) { | ||
| const processedStyle = Object.assign({}, style); | ||
| // @ts-ignore | ||
| if (processedStyle.strokeThickness) { | ||
| const color = processedStyle.stroke; | ||
| // @ts-ignore | ||
| processedStyle.stroke = { | ||
| color, | ||
| // @ts-ignore | ||
| width: processedStyle.strokeThickness, | ||
| }; | ||
| delete processedStyle['strokeThickness']; | ||
| } | ||
| // dropShadow* -> dropShadow: { color, distance, angle, alpha, blur } | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadow) { | ||
| const dropShadowConfig = {}; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowColor != null) | ||
| dropShadowConfig.color = processedStyle.dropShadowColor; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowDistance != null) | ||
| dropShadowConfig.distance = processedStyle.dropShadowDistance; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowAngle != null) | ||
| dropShadowConfig.angle = processedStyle.dropShadowAngle; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowAlpha != null) | ||
| dropShadowConfig.alpha = processedStyle.dropShadowAlpha; | ||
| // @ts-ignore | ||
| if (processedStyle.dropShadowBlur != null) | ||
| dropShadowConfig.blur = processedStyle.dropShadowBlur; | ||
| // @ts-ignore | ||
| processedStyle.dropShadow = dropShadowConfig; | ||
| delete processedStyle['dropShadowColor']; | ||
| delete processedStyle['dropShadowDistance']; | ||
| delete processedStyle['dropShadowAngle']; | ||
| delete processedStyle['dropShadowAlpha']; | ||
| delete processedStyle['dropShadowBlur']; | ||
| } | ||
| if (Array.isArray(processedStyle.fill)) { | ||
| console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.'); | ||
| processedStyle.fill = processedStyle.fill[0]; | ||
| } | ||
| super({ | ||
| text, | ||
| style: processedStyle, | ||
| }); | ||
| } | ||
| } | ||
| class Container extends Container$1 { | ||
| } | ||
| class Graphics extends Graphics$1 { | ||
| } | ||
| class HTMLText extends HTMLText$1 { | ||
| constructor(options) { | ||
| // 兼容字符串和对象两种参数形式 | ||
| if (typeof options === 'string') { | ||
| super({ text: options }); | ||
| } | ||
| else { | ||
| super(options || {}); | ||
| } | ||
| } | ||
| } | ||
| class NinePatch extends NineSliceSprite { | ||
| constructor(img, leftWidth, topHeight, rightWidth, bottomHeight, width, height) { | ||
| let texture; | ||
| if (img instanceof Texture) { | ||
| texture = img; | ||
| } | ||
| else { | ||
| texture = Texture.from(img); | ||
| } | ||
| super({ | ||
| texture, | ||
| leftWidth, | ||
| topHeight, | ||
| rightWidth, | ||
| bottomHeight, | ||
| width, | ||
| height, | ||
| }); | ||
| } | ||
| } | ||
| class Sprite { | ||
| constructor(image) { | ||
| this._image = null; | ||
| this._image = image; | ||
| if (image) { | ||
| if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) { | ||
| this.sprite = Sprite$1.from(image); | ||
| } | ||
| else if (image instanceof Texture) { | ||
| this.sprite = new Sprite$1(image); | ||
| } | ||
| } | ||
| else { | ||
| this.sprite = new Sprite$1(); | ||
| } | ||
| } | ||
| set image(val) { | ||
| if (this._image === val) { | ||
| return; | ||
| } | ||
| if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) { | ||
| this.sprite.texture && this.sprite.texture.destroy(false); | ||
| this.sprite.texture = Texture.from(val); | ||
| } | ||
| else if (val instanceof Texture) { | ||
| this.sprite.texture = val; | ||
| } | ||
| this._image = val; | ||
| } | ||
| get image() { | ||
| return this._image; | ||
| } | ||
| } | ||
| class SpriteAnimation { | ||
| constructor({ frames }) { | ||
| this.animatedSprite = new AnimatedSprite(frames); | ||
| } | ||
| play() { | ||
| this.animatedSprite.play(); | ||
| } | ||
| stop() { | ||
| this.animatedSprite.stop(); | ||
| } | ||
| gotoAndPlay(frameNumber) { | ||
| this.animatedSprite.gotoAndPlay(frameNumber); | ||
| } | ||
| gotoAndStop(frameNumber) { | ||
| this.animatedSprite.gotoAndStop(frameNumber); | ||
| } | ||
| set speed(val) { | ||
| this.animatedSprite.animationSpeed = val; | ||
| } | ||
| get speed() { | ||
| return this.animatedSprite.animationSpeed; | ||
| } | ||
| } | ||
| class Text extends Text$1 { | ||
| constructor(text, style) { | ||
| // @ts-ignore | ||
| if (style.strokeThickness) { | ||
| const color = style.stroke; | ||
| // @ts-ignore | ||
| style.stroke = { | ||
| color, | ||
| // @ts-ignore | ||
| width: style.strokeThickness, | ||
| }; | ||
| delete style['strokeThickness']; | ||
| } | ||
| // dropShadow* -> dropShadow: { color, distance, angle, alpha, blur } | ||
| // @ts-ignore | ||
| if (style.dropShadow) { | ||
| const dropShadowConfig = {}; | ||
| // @ts-ignore | ||
| if (style.dropShadowColor != null) | ||
| dropShadowConfig.color = style.dropShadowColor; | ||
| // @ts-ignore | ||
| if (style.dropShadowDistance != null) | ||
| dropShadowConfig.distance = style.dropShadowDistance; | ||
| // @ts-ignore | ||
| if (style.dropShadowAngle != null) | ||
| dropShadowConfig.angle = style.dropShadowAngle; | ||
| // @ts-ignore | ||
| if (style.dropShadowAlpha != null) | ||
| dropShadowConfig.alpha = style.dropShadowAlpha; | ||
| // @ts-ignore | ||
| if (style.dropShadowBlur != null) | ||
| dropShadowConfig.blur = style.dropShadowBlur; | ||
| // @ts-ignore | ||
| style.dropShadow = dropShadowConfig; | ||
| delete style['dropShadowColor']; | ||
| delete style['dropShadowDistance']; | ||
| delete style['dropShadowAngle']; | ||
| delete style['dropShadowAlpha']; | ||
| delete style['dropShadowBlur']; | ||
| } | ||
| if (Array.isArray(style.fill)) { | ||
| console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.'); | ||
| style.fill = style.fill[0]; | ||
| } | ||
| // @ts-ignore | ||
| if (Array.isArray(style.fillGradientStops)) { | ||
| let fontSize; | ||
| if (style.fontSize == null) { | ||
| style.fontSize = TextStyle.defaultTextStyle.fontSize; | ||
| } | ||
| else if (typeof style.fontSize === 'string') { | ||
| fontSize = parseInt(style.fontSize, 10); | ||
| } | ||
| else { | ||
| fontSize = style.fontSize; | ||
| } | ||
| const gradientFill = new FillGradient(0, 0, 0, fontSize * 1.7); | ||
| // @ts-ignore | ||
| const fills = style.fillGradientStops.map(color => Color.shared.setValue(color).toNumber()); | ||
| fills.forEach((number, index) => { | ||
| const ratio = index / (fills.length - 1); | ||
| gradientFill.addColorStop(ratio, number); | ||
| }); | ||
| style.fill = { | ||
| fill: gradientFill, | ||
| }; | ||
| delete style['fillGradientStops']; | ||
| } | ||
| super({ | ||
| text, | ||
| style, | ||
| }); | ||
| } | ||
| } | ||
| class TilingSprite { | ||
| constructor(image) { | ||
| this._image = null; | ||
| this._image = image; | ||
| if (image) { | ||
| if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement) { | ||
| this.tilingSprite = new TilingSprite$1(Texture.from(image)); | ||
| } | ||
| else if (image instanceof Texture) { | ||
| this.tilingSprite = new TilingSprite$1(image); | ||
| } | ||
| } | ||
| else { | ||
| this.tilingSprite = new TilingSprite$1(Texture.EMPTY); | ||
| } | ||
| } | ||
| set image(val) { | ||
| if (this._image === val) { | ||
| return; | ||
| } | ||
| if (typeof HTMLImageElement !== 'undefined' && val instanceof HTMLImageElement) { | ||
| this.tilingSprite.texture = Texture.from(val); | ||
| } | ||
| else if (val instanceof Texture) { | ||
| this.tilingSprite.texture = val; | ||
| } | ||
| this._image = val; | ||
| } | ||
| get image() { | ||
| return this._image; | ||
| } | ||
| } | ||
| export { BitmapText, Container, Graphics, HTMLText, NinePatch, Sprite, SpriteAnimation, Text, TilingSprite }; |
+1
-1
| { | ||
| "name": "@eva/renderer-adapter", | ||
| "version": "2.1.0-beta.3", | ||
| "version": "2.1.0-beta.4", | ||
| "description": "@eva/renderer-adapter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
37310
4346.96%9
200%839
13883.33%1
-50%3
200%