pixi-multistyle-text
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.8.0"></a> | ||
# [0.8.0](https://github.com/tleunen/pixi-multistyle-text/compare/v0.7.0...v0.8.0) (2019-11-12) | ||
### Features | ||
* Add support for BBCode code style ([#78](https://github.com/tleunen/pixi-multistyle-text/issues/78)) ([2a7be20](https://github.com/tleunen/pixi-multistyle-text/commit/2a7be20)) | ||
<a name="0.7.0"></a> | ||
@@ -7,0 +17,0 @@ # [0.7.0](https://github.com/tleunen/pixi-multistyle-text/compare/v0.6.0...v0.7.0) (2018-10-29) |
@@ -5,2 +5,3 @@ /// <reference types="pixi.js" /> | ||
debug?: boolean; | ||
tagStyle?: "xml" | "bbcode"; | ||
} | ||
@@ -46,2 +47,3 @@ export interface TextStyleSet { | ||
private getPropertyRegex; | ||
private getBBcodePropertyRegex; | ||
private _getTextDataPerLine; | ||
@@ -48,0 +50,0 @@ private getFontString; |
@@ -1,2 +0,2 @@ | ||
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};var e=["pointerover","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","mouseover","mouseenter","mousedown","mousemove","mouseup","mousecancel","mouseout","mouseleave","touchover","touchenter","touchdown","touchmove","touchup","touchcancel","touchout","touchleave"],n=function(n){function o(t,o){var i=n.call(this,t)||this;return i.styles=o,e.forEach(function(t){i.on(t,function(t){return i.handleInteraction(t)})}),i}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(o,n),o.prototype.handleInteraction=function(t){var e=t,n=t.data.getLocalPosition(this),o=this.hitboxes.reduce(function(t,e){return void 0!==t?t:e.hitbox.contains(n.x,n.y)?e:void 0},void 0);e.targetTag=void 0===o?void 0:o.tag},Object.defineProperty(o.prototype,"styles",{set:function(t){for(var e in this.textStyles={},this.textStyles.default=this.assign({},o.DEFAULT_TAG_STYLE),t)"default"===e?this.assign(this.textStyles.default,t[e]):this.textStyles[e]=this.assign({},t[e]);this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},enumerable:!0,configurable:!0}),o.prototype.setTagStyle=function(t,e){t in this.textStyles?this.assign(this.textStyles[t],e):this.textStyles[t]=this.assign({},e),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},o.prototype.deleteTagStyle=function(t){"default"===t?this.textStyles.default=this.assign({},o.DEFAULT_TAG_STYLE):delete this.textStyles[t],this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},o.prototype.getTagRegex=function(t,e){var n=Object.keys(this.textStyles).join("|"),o="<"+(n=t?"("+n+")":"(?:"+n+")")+"(?:\\s+[A-Za-z0-9_\\-]+=(?:\"(?:[^\"]+|\\\\\")*\"|'(?:[^']+|\\\\')*'))*\\s*>|</"+n+"\\s*>";return e&&(o="("+o+")"),new RegExp(o,"g")},o.prototype.getPropertyRegex=function(){return new RegExp("([A-Za-z0-9_\\-]+)=(?:\"((?:[^\"]+|\\\\\")*)\"|'((?:[^']+|\\\\')*)')","g")},o.prototype._getTextDataPerLine=function(t){for(var e=[],n=this.getTagRegex(!0,!1),o=[this.assign({},this.textStyles.default)],i=[{name:"default",properties:{}}],s=0;s<t.length;s++){for(var r=[],a=[],h=void 0;h=n.exec(t[s]);)a.push(h);if(0===a.length)r.push(this.createTextData(t[s],o[o.length-1],i[i.length-1]));else{for(var l=0,c=0;c<a.length;c++){if(a[c].index>l&&r.push(this.createTextData(t[s].substring(l,a[c].index),o[o.length-1],i[i.length-1])),"/"===a[c][0][1])o.length>1&&(o.pop(),i.pop());else{o.push(this.assign({},o[o.length-1],this.textStyles[a[c][1]]));for(var x={},d=this.getPropertyRegex(),u=void 0;u=d.exec(a[c][0]);)x[u[1]]=u[2]||u[3];i.push({name:a[c][1],properties:x})}l=a[c].index+a[c][0].length}l<t[s].length&&r.push(this.createTextData(t[s].substring(l),o[o.length-1],i[i.length-1]))}e.push(r)}return e},o.prototype.getFontString=function(t){return new PIXI.TextStyle(t).toFontString()},o.prototype.createTextData=function(t,e,n){return{text:t,style:e,width:0,height:0,fontProperties:void 0,tag:n}},o.prototype.getDropShadowPadding=function(){var t=this,e=0,n=0;return Object.keys(this.textStyles).forEach(function(o){var i=t.textStyles[o],s=i.dropShadowBlur;e=Math.max(e,i.dropShadowDistance||0),n=Math.max(n,s||0)}),e+n},o.prototype.updateText=function(){var t=this;if(this.dirty){this.hitboxes=[],this.texture.baseTexture.resolution=this.resolution;var e=this.textStyles,n=this.text;this._style.wordWrap&&(n=this.wordWrap(this.text));for(var i=n.split(/(?:\r\n|\r|\n)/),s=this._getTextDataPerLine(i),r=[],a=[],h=[],l=0,c=0;c<i.length;c++){for(var x=0,d=0,u=0,g=0;g<s[c].length;g++){var p=s[c][g].style;this.context.font=this.getFontString(p),s[c][g].width=this.context.measureText(s[c][g].text).width,0!==s[c][g].text.length&&(s[c][g].width+=(s[c][g].text.length-1)*p.letterSpacing,g>0&&(x+=p.letterSpacing/2),g<s[c].length-1&&(x+=p.letterSpacing/2)),x+=s[c][g].width,s[c][g].fontProperties=PIXI.TextMetrics.measureFont(this.context.font),s[c][g].height=s[c][g].fontProperties.fontSize,"number"==typeof p.valign?(d=Math.min(d,p.valign-s[c][g].fontProperties.descent),u=Math.max(u,p.valign+s[c][g].fontProperties.ascent)):(d=Math.min(d,-s[c][g].fontProperties.descent),u=Math.max(u,s[c][g].fontProperties.ascent))}r[c]=x,a[c]=d,h[c]=u,l=Math.max(l,x)}var f=Object.keys(e).map(function(t){return e[t]}).reduce(function(t,e){return Math.max(t,e.strokeThickness||0)},0),y=this.getDropShadowPadding(),b=l+2*f+2*y,v=h.reduce(function(t,e){return t+e},0)-a.reduce(function(t,e){return t+e},0)+2*f+2*y;this.canvas.width=b*this.resolution,this.canvas.height=v*this.resolution,this.context.scale(this.resolution,this.resolution),this.context.textBaseline="alphabetic",this.context.lineJoin="round";var S=y+f,T=[];for(c=0;c<s.length;c++){var w=s[c],m=void 0;switch(this._style.align){case"left":m=y+f;break;case"center":m=y+f+(l-r[c])/2;break;case"right":m=y+f+l-r[c]}for(g=0;g<w.length;g++){var P=w[g],k=P.style,_=P.text,I=P.fontProperties,O=P.width,F=P.tag,A=S+I.ascent;switch(k.valign){case"top":break;case"baseline":A+=h[c]-I.ascent;break;case"middle":A+=(h[c]-a[c]-I.ascent-I.descent)/2;break;case"bottom":A+=h[c]-a[c]-I.ascent-I.descent;break;default:A+=h[c]-I.ascent-k.valign}if(0===k.letterSpacing)T.push({text:_,style:k,x:m,y:A,width:O,ascent:I.ascent,descent:I.descent,tag:F}),m+=w[g].width;else{this.context.font=this.getFontString(w[g].style);for(var D=0;D<_.length;D++){(D>0||g>0)&&(m+=k.letterSpacing/2);var E=this.context.measureText(_.charAt(D)).width;T.push({text:_.charAt(D),style:k,x:m,y:A,width:E,ascent:I.ascent,descent:I.descent,tag:F}),m+=E,(D<_.length-1||g<w.length-1)&&(m+=k.letterSpacing/2)}}}S+=h[c]-a[c]}this.context.save(),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(n.dropShadow){t.context.font=t.getFontString(n);var r=n.dropShadowColor;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.shadowColor=r,t.context.shadowBlur=n.dropShadowBlur,t.context.shadowOffsetX=Math.cos(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.shadowOffsetY=Math.sin(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.fillText(o,i,s)}}),this.context.restore(),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.stroke&&n.strokeThickness){t.context.font=t.getFontString(n);var r=n.stroke;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.strokeStyle=r,t.context.lineWidth=n.strokeThickness,t.context.strokeText(o,i,s)}}),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.fill){t.context.font=t.getFontString(n);var r=n.fill;if("number"==typeof r)r=PIXI.utils.hex2string(r);else if(Array.isArray(r))for(var a=0;a<r.length;a++){var h=r[a];"number"==typeof h&&(r[a]=PIXI.utils.hex2string(h))}t.context.fillStyle=t._generateFillStyle(new PIXI.TextStyle(n),[o]),t.context.fillText(o,i,s)}}),T.forEach(function(e){var n=e.style,i=e.x,s=e.y,r=e.width,a=e.ascent,h=e.descent,l=e.tag,c=-t._style.padding-t.getDropShadowPadding();t.hitboxes.push({tag:l,hitbox:new PIXI.Rectangle(i+c,s-a+c,r,a+h)}),(void 0===n.debug?o.debugOptions.spans.enabled:n.debug)&&(t.context.lineWidth=1,o.debugOptions.spans.bounding&&(t.context.fillStyle=o.debugOptions.spans.bounding,t.context.strokeStyle=o.debugOptions.spans.bounding,t.context.beginPath(),t.context.rect(i,s-a,r,a+h),t.context.fill(),t.context.stroke(),t.context.stroke()),o.debugOptions.spans.baseline&&(t.context.strokeStyle=o.debugOptions.spans.baseline,t.context.beginPath(),t.context.moveTo(i,s),t.context.lineTo(i+r,s),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.top&&(t.context.strokeStyle=o.debugOptions.spans.top,t.context.beginPath(),t.context.moveTo(i,s-a),t.context.lineTo(i+r,s-a),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.bottom&&(t.context.strokeStyle=o.debugOptions.spans.bottom,t.context.beginPath(),t.context.moveTo(i,s+h),t.context.lineTo(i+r,s+h),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.text&&(t.context.fillStyle="#ffffff",t.context.strokeStyle="#000000",t.context.lineWidth=2,t.context.font="8px monospace",t.context.strokeText(l.name,i,s-a+8),t.context.fillText(l.name,i,s-a+8),t.context.strokeText(r.toFixed(2)+"x"+(a+h).toFixed(2),i,s-a+16),t.context.fillText(r.toFixed(2)+"x"+(a+h).toFixed(2),i,s-a+16)))}),o.debugOptions.objects.enabled&&(o.debugOptions.objects.bounding&&(this.context.fillStyle=o.debugOptions.objects.bounding,this.context.beginPath(),this.context.rect(0,0,b,v),this.context.fill()),o.debugOptions.objects.text&&(this.context.fillStyle="#ffffff",this.context.strokeStyle="#000000",this.context.lineWidth=2,this.context.font="8px monospace",this.context.strokeText(b.toFixed(2)+"x"+v.toFixed(2),0,8,b),this.context.fillText(b.toFixed(2)+"x"+v.toFixed(2),0,8,b))),this.updateTexture()}},o.prototype.wordWrap=function(t){var e="",n=this.getTagRegex(!0,!0),o=t.split("\n"),i=this._style.wordWrapWidth,s=[this.assign({},this.textStyles.default)];this.context.font=this.getFontString(this.textStyles.default);for(var r=0;r<o.length;r++){for(var a=i,h=o[r].split(n),l=!0,c=0;c<h.length;c++)if(n.test(h[c]))e+=h[c],"/"===h[c][1]?(c+=2,s.pop()):(s.push(this.assign({},s[s.length-1],this.textStyles[h[++c]])),c++),this.context.font=this.getFontString(s[s.length-1]);else for(var x=h[c].split(" "),d=0;d<x.length;d++){var u=this.context.measureText(x[d]).width;if(this._style.breakWords&&u>a){var g=x[d].split("");d>0&&(e+=" ",a-=this.context.measureText(" ").width);for(var p=0;p<g.length;p++){var f=this.context.measureText(g[p]).width;f>a?(e+="\n"+g[p],a=i-f):(e+=g[p],a-=f)}}else if(this._style.breakWords)e+=x[d],a-=u;else{var y=u+(d>0?this.context.measureText(" ").width:0);y>a?(l||(e+="\n"),e+=x[d],a=i-u):(a-=y,d>0&&(e+=" "),e+=x[d])}l=!1}r<o.length-1&&(e+="\n")}return e},o.prototype.updateTexture=function(){var t=this._texture,e=this.getDropShadowPadding();t.baseTexture.hasLoaded=!0,t.baseTexture.resolution=this.resolution,t.baseTexture.realWidth=this.canvas.width,t.baseTexture.realHeight=this.canvas.height,t.baseTexture.width=this.canvas.width/this.resolution,t.baseTexture.height=this.canvas.height/this.resolution,t.trim.width=t.frame.width=this.canvas.width/this.resolution,t.trim.height=t.frame.height=this.canvas.height/this.resolution,t.trim.x=-this._style.padding-e,t.trim.y=-this._style.padding-e,t.orig.width=t.frame.width-2*(this._style.padding+e),t.orig.height=t.frame.height-2*(this._style.padding+e),this._onTextureUpdate(),t.baseTexture.emit("update",t.baseTexture),this.dirty=!1},o.prototype.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0,i=e;o<i.length;o++){var s=i[o];for(var r in s)t[r]=s[r]}return t},o.DEFAULT_TAG_STYLE={align:"left",breakWords:!1,dropShadow:!1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"#000000",dropShadowDistance:5,fill:"black",fillGradientType:PIXI.TEXT_GRADIENT.LINEAR_VERTICAL,fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",valign:"baseline",wordWrap:!1,wordWrapWidth:100},o.debugOptions={spans:{enabled:!1,baseline:"#44BB44",top:"#BB4444",bottom:"#4444BB",bounding:"rgba(255, 255, 255, 0.1)",text:!0},objects:{enabled:!1,bounding:"rgba(255, 255, 255, 0.05)",text:!0}},o}(PIXI.Text);module.exports=n; | ||
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};var e=["pointerover","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","mouseover","mouseenter","mousedown","mousemove","mouseup","mousecancel","mouseout","mouseleave","touchover","touchenter","touchdown","touchmove","touchup","touchcancel","touchout","touchleave"],n="bbcode",o={bbcode:["[","]"],xml:["<",">"]},s=function(s){function i(t,n){var o=s.call(this,t)||this;return o.styles=n,e.forEach(function(t){o.on(t,function(t){return o.handleInteraction(t)})}),o}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(i,s),i.prototype.handleInteraction=function(t){var e=t,n=t.data.getLocalPosition(this),o=this.hitboxes.reduce(function(t,e){return void 0!==t?t:e.hitbox.contains(n.x,n.y)?e:void 0},void 0);e.targetTag=void 0===o?void 0:o.tag},Object.defineProperty(i.prototype,"styles",{set:function(t){for(var e in this.textStyles={},this.textStyles.default=this.assign({},i.DEFAULT_TAG_STYLE),t)"default"===e?this.assign(this.textStyles.default,t[e]):this.textStyles[e]=this.assign({},t[e]);this.textStyles.default.tagStyle===n&&(this.textStyles.b=this.assign({},{fontStyle:"bold"}),this.textStyles.i=this.assign({},{fontStyle:"italic"}),this.textStyles.color=this.assign({},{fill:""}),this.textStyles.outline=this.assign({},{stroke:"",strokeThickness:6}),this.textStyles.font=this.assign({},{fontFamily:""}),this.textStyles.shadow=this.assign({},{dropShadowColor:"",dropShadow:!0,dropShadowBlur:3,dropShadowDistance:3,dropShadowAngle:2}),this.textStyles.size=this.assign({},{fontSize:"px"}),this.textStyles.spacing=this.assign({},{letterSpacing:""}),this.textStyles.align=this.assign({},{align:""})),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},enumerable:!0,configurable:!0}),i.prototype.setTagStyle=function(t,e){t in this.textStyles?this.assign(this.textStyles[t],e):this.textStyles[t]=this.assign({},e),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},i.prototype.deleteTagStyle=function(t){"default"===t?this.textStyles.default=this.assign({},i.DEFAULT_TAG_STYLE):delete this.textStyles[t],this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},i.prototype.getTagRegex=function(t,e){var s=Object.keys(this.textStyles).join("|");s=t?"("+s+")":"(?:"+s+")";var i=this.textStyles.default.tagStyle===n?"\\"+o.bbcode[0]+s+"(?:\\=(?:[A-Za-z0-9_\\-\\#]+|'(?:[^']+|\\\\')*'))*\\s*\\"+o.bbcode[1]+"|\\"+o.bbcode[0]+"\\/"+s+"\\s*\\"+o.bbcode[1]:"\\"+o.xml[0]+s+"(?:\\s+[A-Za-z0-9_\\-]+=(?:\"(?:[^\"]+|\\\\\")*\"|'(?:[^']+|\\\\')*'))*\\s*\\"+o.xml[1]+"|\\"+o.xml[0]+"\\/"+s+"\\s*\\"+o.xml[1];return e&&(i="("+i+")"),new RegExp(i,"g")},i.prototype.getPropertyRegex=function(){return new RegExp("([A-Za-z0-9_\\-]+)=(?:\"((?:[^\"]+|\\\\\")*)\"|'((?:[^']+|\\\\')*)')","g")},i.prototype.getBBcodePropertyRegex=function(){return new RegExp("[A-Za-z0-9_\\-]+=([A-Za-z0-9_\\-\\#]+)","g")},i.prototype._getTextDataPerLine=function(t){for(var e=[],s=this.getTagRegex(!0,!1),i=[this.assign({},this.textStyles.default)],r=[{name:"default",properties:{}}],a=0;a<t.length;a++){for(var h=[],l=[],c=void 0;c=s.exec(t[a]);)l.push(c);if(0===l.length)h.push(this.createTextData(t[a],i[i.length-1],r[r.length-1]));else{for(var x=0,d=function(e){if(l[e].index>x&&h.push(g.createTextData(t[a].substring(x,l[e].index),i[i.length-1],r[r.length-1])),"/"===l[e][0][1])i.length>1&&(i.pop(),r.pop());else{for(var o={},s=g.getPropertyRegex(),c=void 0;c=s.exec(l[e][0]);)o[c[1]]=c[2]||c[3];if(r.push({name:l[e][1],properties:o}),g.textStyles.default.tagStyle===n&&l[e][0].includes("=")&&g.textStyles[l[e][1]]){var d=g.getBBcodePropertyRegex().exec(l[e][0]),u={};Object.entries(g.textStyles[l[e][1]]).forEach(function(t){u[t[0]]="string"!=typeof t[1]?t[1]:d[1]+t[1]}),i.push(g.assign({},i[i.length-1],u))}else i.push(g.assign({},i[i.length-1],g.textStyles[l[e][1]]))}x=l[e].index+l[e][0].length},g=this,u=0;u<l.length;u++)d(u);if(x<t[a].length){var p=this.createTextData(x?t[a].substring(x):t[a],i[i.length-1],r[r.length-1]);h.push(p)}}e.push(h)}var f=this.textStyles.default.tagStyle;return e[e.length-1].map(function(t){t.text.includes(o[f][0])&&(t.text=t.text.match(f===n?/^(.*)\[/:/^(.*)\</)[1])}),e},i.prototype.getFontString=function(t){return new PIXI.TextStyle(t).toFontString()},i.prototype.createTextData=function(t,e,n){return{text:t,style:e,width:0,height:0,fontProperties:void 0,tag:n}},i.prototype.getDropShadowPadding=function(){var t=this,e=0,n=0;return Object.keys(this.textStyles).forEach(function(o){var s=t.textStyles[o],i=s.dropShadowBlur;e=Math.max(e,s.dropShadowDistance||0),n=Math.max(n,i||0)}),e+n},i.prototype.updateText=function(){var t=this;if(this.dirty){this.hitboxes=[],this.texture.baseTexture.resolution=this.resolution;var e=this.textStyles,n=this.text;this._style.wordWrap&&(n=this.wordWrap(this.text));for(var o=n.split(/(?:\r\n|\r|\n)/),s=this._getTextDataPerLine(o),r=[],a=[],h=[],l=0,c=0;c<o.length;c++){for(var x=0,d=0,g=0,u=0;u<s[c].length;u++){var p=s[c][u].style;this.context.font=this.getFontString(p),s[c][u].width=this.context.measureText(s[c][u].text).width,0!==s[c][u].text.length&&(s[c][u].width+=(s[c][u].text.length-1)*p.letterSpacing,u>0&&(x+=p.letterSpacing/2),u<s[c].length-1&&(x+=p.letterSpacing/2)),x+=s[c][u].width,s[c][u].fontProperties=PIXI.TextMetrics.measureFont(this.context.font),s[c][u].height=s[c][u].fontProperties.fontSize,"number"==typeof p.valign?(d=Math.min(d,p.valign-s[c][u].fontProperties.descent),g=Math.max(g,p.valign+s[c][u].fontProperties.ascent)):(d=Math.min(d,-s[c][u].fontProperties.descent),g=Math.max(g,s[c][u].fontProperties.ascent))}r[c]=x,a[c]=d,h[c]=g,l=Math.max(l,x)}var f=Object.keys(e).map(function(t){return e[t]}).reduce(function(t,e){return Math.max(t,e.strokeThickness||0)},0),y=this.getDropShadowPadding(),S=l+2*f+2*y,b=h.reduce(function(t,e){return t+e},0)-a.reduce(function(t,e){return t+e},0)+2*f+2*y;this.canvas.width=S*this.resolution,this.canvas.height=b*this.resolution,this.context.scale(this.resolution,this.resolution),this.context.textBaseline="alphabetic",this.context.lineJoin="round";var v=y+f,w=[];for(c=0;c<s.length;c++){var m=s[c],T=void 0;switch(this._style.align){case"left":T=y+f;break;case"center":T=y+f+(l-r[c])/2;break;case"right":T=y+f+l-r[c]}for(u=0;u<m.length;u++){var k=m[u],P=k.style,_=k.text,I=k.fontProperties,O=k.width,A=k.tag,F=v+I.ascent;switch(P.valign){case"top":break;case"baseline":F+=h[c]-I.ascent;break;case"middle":F+=(h[c]-a[c]-I.ascent-I.descent)/2;break;case"bottom":F+=h[c]-a[c]-I.ascent-I.descent;break;default:F+=h[c]-I.ascent-P.valign}if(0===P.letterSpacing)w.push({text:_,style:P,x:T,y:F,width:O,ascent:I.ascent,descent:I.descent,tag:A}),T+=m[u].width;else{this.context.font=this.getFontString(m[u].style);for(var E=0;E<_.length;E++){(E>0||u>0)&&(T+=P.letterSpacing/2);var D=this.context.measureText(_.charAt(E)).width;w.push({text:_.charAt(E),style:P,x:T,y:F,width:D,ascent:I.ascent,descent:I.descent,tag:A}),T+=D,(E<_.length-1||u<m.length-1)&&(T+=P.letterSpacing/2)}}}v+=h[c]-a[c]}this.context.save(),w.forEach(function(e){var n=e.style,o=e.text,s=e.x,i=e.y;if(n.dropShadow){t.context.font=t.getFontString(n);var r=n.dropShadowColor;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.shadowColor=r,t.context.shadowBlur=n.dropShadowBlur,t.context.shadowOffsetX=Math.cos(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.shadowOffsetY=Math.sin(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.fillText(o,s,i)}}),this.context.restore(),w.forEach(function(e){var n=e.style,o=e.text,s=e.x,i=e.y;if(void 0!==n.stroke&&n.strokeThickness){t.context.font=t.getFontString(n);var r=n.stroke;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.strokeStyle=r,t.context.lineWidth=n.strokeThickness,t.context.strokeText(o,s,i)}}),w.forEach(function(e){var n=e.style,o=e.text,s=e.x,i=e.y;if(void 0!==n.fill){t.context.font=t.getFontString(n);var r=n.fill;if("number"==typeof r)r=PIXI.utils.hex2string(r);else if(Array.isArray(r))for(var a=0;a<r.length;a++){var h=r[a];"number"==typeof h&&(r[a]=PIXI.utils.hex2string(h))}t.context.fillStyle=t._generateFillStyle(new PIXI.TextStyle(n),[o]),t.context.fillText(o,s,i)}}),w.forEach(function(e){var n=e.style,o=e.x,s=e.y,r=e.width,a=e.ascent,h=e.descent,l=e.tag,c=-t._style.padding-t.getDropShadowPadding();t.hitboxes.push({tag:l,hitbox:new PIXI.Rectangle(o+c,s-a+c,r,a+h)}),(void 0===n.debug?i.debugOptions.spans.enabled:n.debug)&&(t.context.lineWidth=1,i.debugOptions.spans.bounding&&(t.context.fillStyle=i.debugOptions.spans.bounding,t.context.strokeStyle=i.debugOptions.spans.bounding,t.context.beginPath(),t.context.rect(o,s-a,r,a+h),t.context.fill(),t.context.stroke(),t.context.stroke()),i.debugOptions.spans.baseline&&(t.context.strokeStyle=i.debugOptions.spans.baseline,t.context.beginPath(),t.context.moveTo(o,s),t.context.lineTo(o+r,s),t.context.closePath(),t.context.stroke()),i.debugOptions.spans.top&&(t.context.strokeStyle=i.debugOptions.spans.top,t.context.beginPath(),t.context.moveTo(o,s-a),t.context.lineTo(o+r,s-a),t.context.closePath(),t.context.stroke()),i.debugOptions.spans.bottom&&(t.context.strokeStyle=i.debugOptions.spans.bottom,t.context.beginPath(),t.context.moveTo(o,s+h),t.context.lineTo(o+r,s+h),t.context.closePath(),t.context.stroke()),i.debugOptions.spans.text&&(t.context.fillStyle="#ffffff",t.context.strokeStyle="#000000",t.context.lineWidth=2,t.context.font="8px monospace",t.context.strokeText(l.name,o,s-a+8),t.context.fillText(l.name,o,s-a+8),t.context.strokeText(r.toFixed(2)+"x"+(a+h).toFixed(2),o,s-a+16),t.context.fillText(r.toFixed(2)+"x"+(a+h).toFixed(2),o,s-a+16)))}),i.debugOptions.objects.enabled&&(i.debugOptions.objects.bounding&&(this.context.fillStyle=i.debugOptions.objects.bounding,this.context.beginPath(),this.context.rect(0,0,S,b),this.context.fill()),i.debugOptions.objects.text&&(this.context.fillStyle="#ffffff",this.context.strokeStyle="#000000",this.context.lineWidth=2,this.context.font="8px monospace",this.context.strokeText(S.toFixed(2)+"x"+b.toFixed(2),0,8,S),this.context.fillText(S.toFixed(2)+"x"+b.toFixed(2),0,8,S))),this.updateTexture()}},i.prototype.wordWrap=function(t){var e="",n=this.getTagRegex(!0,!0),o=t.split("\n"),s=this._style.wordWrapWidth,i=[this.assign({},this.textStyles.default)];this.context.font=this.getFontString(this.textStyles.default);for(var r=0;r<o.length;r++){for(var a=s,h=o[r].split(n),l=!0,c=0;c<h.length;c++)if(n.test(h[c]))e+=h[c],"/"===h[c][1]?(c+=2,i.pop()):(i.push(this.assign({},i[i.length-1],this.textStyles[h[++c]])),c++),this.context.font=this.getFontString(i[i.length-1]);else for(var x=h[c].split(" "),d=0;d<x.length;d++){var g=this.context.measureText(x[d]).width;if(this._style.breakWords&&g>a){var u=x[d].split("");d>0&&(e+=" ",a-=this.context.measureText(" ").width);for(var p=0;p<u.length;p++){var f=this.context.measureText(u[p]).width;f>a?(e+="\n"+u[p],a=s-f):(e+=u[p],a-=f)}}else if(this._style.breakWords)e+=x[d],a-=g;else{var y=g+(d>0?this.context.measureText(" ").width:0);y>a?(l||(e+="\n"),e+=x[d],a=s-g):(a-=y,d>0&&(e+=" "),e+=x[d])}l=!1}r<o.length-1&&(e+="\n")}return e},i.prototype.updateTexture=function(){var t=this._texture,e=this.getDropShadowPadding();t.baseTexture.hasLoaded=!0,t.baseTexture.resolution=this.resolution,t.baseTexture.realWidth=this.canvas.width,t.baseTexture.realHeight=this.canvas.height,t.baseTexture.width=this.canvas.width/this.resolution,t.baseTexture.height=this.canvas.height/this.resolution,t.trim.width=t.frame.width=this.canvas.width/this.resolution,t.trim.height=t.frame.height=this.canvas.height/this.resolution,t.trim.x=-this._style.padding-e,t.trim.y=-this._style.padding-e,t.orig.width=t.frame.width-2*(this._style.padding+e),t.orig.height=t.frame.height-2*(this._style.padding+e),this._onTextureUpdate(),t.baseTexture.emit("update",t.baseTexture),this.dirty=!1},i.prototype.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0,s=e;o<s.length;o++){var i=s[o];for(var r in i)t[r]=i[r]}return t},i.DEFAULT_TAG_STYLE={align:"left",breakWords:!1,dropShadow:!1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"#000000",dropShadowDistance:5,fill:"black",fillGradientType:PIXI.TEXT_GRADIENT.LINEAR_VERTICAL,fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",valign:"baseline",wordWrap:!1,wordWrapWidth:100,tagStyle:"xml"},i.debugOptions={spans:{enabled:!1,baseline:"#44BB44",top:"#BB4444",bottom:"#4444BB",bounding:"rgba(255, 255, 255, 0.1)",text:!0},objects:{enabled:!1,bounding:"rgba(255, 255, 255, 0.05)",text:!0}},i}(PIXI.Text);module.exports=s; | ||
//# sourceMappingURL=pixi-multistyle-text.js.map |
@@ -1,2 +0,2 @@ | ||
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};var e=["pointerover","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","mouseover","mouseenter","mousedown","mousemove","mouseup","mousecancel","mouseout","mouseleave","touchover","touchenter","touchdown","touchmove","touchup","touchcancel","touchout","touchleave"];export default(function(n){function o(t,o){var i=n.call(this,t)||this;return i.styles=o,e.forEach(function(t){i.on(t,function(t){return i.handleInteraction(t)})}),i}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(o,n),o.prototype.handleInteraction=function(t){var e=t,n=t.data.getLocalPosition(this),o=this.hitboxes.reduce(function(t,e){return void 0!==t?t:e.hitbox.contains(n.x,n.y)?e:void 0},void 0);e.targetTag=void 0===o?void 0:o.tag},Object.defineProperty(o.prototype,"styles",{set:function(t){for(var e in this.textStyles={},this.textStyles.default=this.assign({},o.DEFAULT_TAG_STYLE),t)"default"===e?this.assign(this.textStyles.default,t[e]):this.textStyles[e]=this.assign({},t[e]);this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},enumerable:!0,configurable:!0}),o.prototype.setTagStyle=function(t,e){t in this.textStyles?this.assign(this.textStyles[t],e):this.textStyles[t]=this.assign({},e),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},o.prototype.deleteTagStyle=function(t){"default"===t?this.textStyles.default=this.assign({},o.DEFAULT_TAG_STYLE):delete this.textStyles[t],this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},o.prototype.getTagRegex=function(t,e){var n=Object.keys(this.textStyles).join("|"),o="<"+(n=t?"("+n+")":"(?:"+n+")")+"(?:\\s+[A-Za-z0-9_\\-]+=(?:\"(?:[^\"]+|\\\\\")*\"|'(?:[^']+|\\\\')*'))*\\s*>|</"+n+"\\s*>";return e&&(o="("+o+")"),new RegExp(o,"g")},o.prototype.getPropertyRegex=function(){return new RegExp("([A-Za-z0-9_\\-]+)=(?:\"((?:[^\"]+|\\\\\")*)\"|'((?:[^']+|\\\\')*)')","g")},o.prototype._getTextDataPerLine=function(t){for(var e=[],n=this.getTagRegex(!0,!1),o=[this.assign({},this.textStyles.default)],i=[{name:"default",properties:{}}],s=0;s<t.length;s++){for(var r=[],a=[],h=void 0;h=n.exec(t[s]);)a.push(h);if(0===a.length)r.push(this.createTextData(t[s],o[o.length-1],i[i.length-1]));else{for(var l=0,c=0;c<a.length;c++){if(a[c].index>l&&r.push(this.createTextData(t[s].substring(l,a[c].index),o[o.length-1],i[i.length-1])),"/"===a[c][0][1])o.length>1&&(o.pop(),i.pop());else{o.push(this.assign({},o[o.length-1],this.textStyles[a[c][1]]));for(var x={},d=this.getPropertyRegex(),u=void 0;u=d.exec(a[c][0]);)x[u[1]]=u[2]||u[3];i.push({name:a[c][1],properties:x})}l=a[c].index+a[c][0].length}l<t[s].length&&r.push(this.createTextData(t[s].substring(l),o[o.length-1],i[i.length-1]))}e.push(r)}return e},o.prototype.getFontString=function(t){return new PIXI.TextStyle(t).toFontString()},o.prototype.createTextData=function(t,e,n){return{text:t,style:e,width:0,height:0,fontProperties:void 0,tag:n}},o.prototype.getDropShadowPadding=function(){var t=this,e=0,n=0;return Object.keys(this.textStyles).forEach(function(o){var i=t.textStyles[o],s=i.dropShadowBlur;e=Math.max(e,i.dropShadowDistance||0),n=Math.max(n,s||0)}),e+n},o.prototype.updateText=function(){var t=this;if(this.dirty){this.hitboxes=[],this.texture.baseTexture.resolution=this.resolution;var e=this.textStyles,n=this.text;this._style.wordWrap&&(n=this.wordWrap(this.text));for(var i=n.split(/(?:\r\n|\r|\n)/),s=this._getTextDataPerLine(i),r=[],a=[],h=[],l=0,c=0;c<i.length;c++){for(var x=0,d=0,u=0,g=0;g<s[c].length;g++){var p=s[c][g].style;this.context.font=this.getFontString(p),s[c][g].width=this.context.measureText(s[c][g].text).width,0!==s[c][g].text.length&&(s[c][g].width+=(s[c][g].text.length-1)*p.letterSpacing,g>0&&(x+=p.letterSpacing/2),g<s[c].length-1&&(x+=p.letterSpacing/2)),x+=s[c][g].width,s[c][g].fontProperties=PIXI.TextMetrics.measureFont(this.context.font),s[c][g].height=s[c][g].fontProperties.fontSize,"number"==typeof p.valign?(d=Math.min(d,p.valign-s[c][g].fontProperties.descent),u=Math.max(u,p.valign+s[c][g].fontProperties.ascent)):(d=Math.min(d,-s[c][g].fontProperties.descent),u=Math.max(u,s[c][g].fontProperties.ascent))}r[c]=x,a[c]=d,h[c]=u,l=Math.max(l,x)}var f=Object.keys(e).map(function(t){return e[t]}).reduce(function(t,e){return Math.max(t,e.strokeThickness||0)},0),y=this.getDropShadowPadding(),b=l+2*f+2*y,v=h.reduce(function(t,e){return t+e},0)-a.reduce(function(t,e){return t+e},0)+2*f+2*y;this.canvas.width=b*this.resolution,this.canvas.height=v*this.resolution,this.context.scale(this.resolution,this.resolution),this.context.textBaseline="alphabetic",this.context.lineJoin="round";var S=y+f,T=[];for(c=0;c<s.length;c++){var w=s[c],m=void 0;switch(this._style.align){case"left":m=y+f;break;case"center":m=y+f+(l-r[c])/2;break;case"right":m=y+f+l-r[c]}for(g=0;g<w.length;g++){var P=w[g],k=P.style,_=P.text,I=P.fontProperties,O=P.width,F=P.tag,A=S+I.ascent;switch(k.valign){case"top":break;case"baseline":A+=h[c]-I.ascent;break;case"middle":A+=(h[c]-a[c]-I.ascent-I.descent)/2;break;case"bottom":A+=h[c]-a[c]-I.ascent-I.descent;break;default:A+=h[c]-I.ascent-k.valign}if(0===k.letterSpacing)T.push({text:_,style:k,x:m,y:A,width:O,ascent:I.ascent,descent:I.descent,tag:F}),m+=w[g].width;else{this.context.font=this.getFontString(w[g].style);for(var D=0;D<_.length;D++){(D>0||g>0)&&(m+=k.letterSpacing/2);var E=this.context.measureText(_.charAt(D)).width;T.push({text:_.charAt(D),style:k,x:m,y:A,width:E,ascent:I.ascent,descent:I.descent,tag:F}),m+=E,(D<_.length-1||g<w.length-1)&&(m+=k.letterSpacing/2)}}}S+=h[c]-a[c]}this.context.save(),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(n.dropShadow){t.context.font=t.getFontString(n);var r=n.dropShadowColor;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.shadowColor=r,t.context.shadowBlur=n.dropShadowBlur,t.context.shadowOffsetX=Math.cos(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.shadowOffsetY=Math.sin(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.fillText(o,i,s)}}),this.context.restore(),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.stroke&&n.strokeThickness){t.context.font=t.getFontString(n);var r=n.stroke;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.strokeStyle=r,t.context.lineWidth=n.strokeThickness,t.context.strokeText(o,i,s)}}),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.fill){t.context.font=t.getFontString(n);var r=n.fill;if("number"==typeof r)r=PIXI.utils.hex2string(r);else if(Array.isArray(r))for(var a=0;a<r.length;a++){var h=r[a];"number"==typeof h&&(r[a]=PIXI.utils.hex2string(h))}t.context.fillStyle=t._generateFillStyle(new PIXI.TextStyle(n),[o]),t.context.fillText(o,i,s)}}),T.forEach(function(e){var n=e.style,i=e.x,s=e.y,r=e.width,a=e.ascent,h=e.descent,l=e.tag,c=-t._style.padding-t.getDropShadowPadding();t.hitboxes.push({tag:l,hitbox:new PIXI.Rectangle(i+c,s-a+c,r,a+h)}),(void 0===n.debug?o.debugOptions.spans.enabled:n.debug)&&(t.context.lineWidth=1,o.debugOptions.spans.bounding&&(t.context.fillStyle=o.debugOptions.spans.bounding,t.context.strokeStyle=o.debugOptions.spans.bounding,t.context.beginPath(),t.context.rect(i,s-a,r,a+h),t.context.fill(),t.context.stroke(),t.context.stroke()),o.debugOptions.spans.baseline&&(t.context.strokeStyle=o.debugOptions.spans.baseline,t.context.beginPath(),t.context.moveTo(i,s),t.context.lineTo(i+r,s),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.top&&(t.context.strokeStyle=o.debugOptions.spans.top,t.context.beginPath(),t.context.moveTo(i,s-a),t.context.lineTo(i+r,s-a),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.bottom&&(t.context.strokeStyle=o.debugOptions.spans.bottom,t.context.beginPath(),t.context.moveTo(i,s+h),t.context.lineTo(i+r,s+h),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.text&&(t.context.fillStyle="#ffffff",t.context.strokeStyle="#000000",t.context.lineWidth=2,t.context.font="8px monospace",t.context.strokeText(l.name,i,s-a+8),t.context.fillText(l.name,i,s-a+8),t.context.strokeText(r.toFixed(2)+"x"+(a+h).toFixed(2),i,s-a+16),t.context.fillText(r.toFixed(2)+"x"+(a+h).toFixed(2),i,s-a+16)))}),o.debugOptions.objects.enabled&&(o.debugOptions.objects.bounding&&(this.context.fillStyle=o.debugOptions.objects.bounding,this.context.beginPath(),this.context.rect(0,0,b,v),this.context.fill()),o.debugOptions.objects.text&&(this.context.fillStyle="#ffffff",this.context.strokeStyle="#000000",this.context.lineWidth=2,this.context.font="8px monospace",this.context.strokeText(b.toFixed(2)+"x"+v.toFixed(2),0,8,b),this.context.fillText(b.toFixed(2)+"x"+v.toFixed(2),0,8,b))),this.updateTexture()}},o.prototype.wordWrap=function(t){var e="",n=this.getTagRegex(!0,!0),o=t.split("\n"),i=this._style.wordWrapWidth,s=[this.assign({},this.textStyles.default)];this.context.font=this.getFontString(this.textStyles.default);for(var r=0;r<o.length;r++){for(var a=i,h=o[r].split(n),l=!0,c=0;c<h.length;c++)if(n.test(h[c]))e+=h[c],"/"===h[c][1]?(c+=2,s.pop()):(s.push(this.assign({},s[s.length-1],this.textStyles[h[++c]])),c++),this.context.font=this.getFontString(s[s.length-1]);else for(var x=h[c].split(" "),d=0;d<x.length;d++){var u=this.context.measureText(x[d]).width;if(this._style.breakWords&&u>a){var g=x[d].split("");d>0&&(e+=" ",a-=this.context.measureText(" ").width);for(var p=0;p<g.length;p++){var f=this.context.measureText(g[p]).width;f>a?(e+="\n"+g[p],a=i-f):(e+=g[p],a-=f)}}else if(this._style.breakWords)e+=x[d],a-=u;else{var y=u+(d>0?this.context.measureText(" ").width:0);y>a?(l||(e+="\n"),e+=x[d],a=i-u):(a-=y,d>0&&(e+=" "),e+=x[d])}l=!1}r<o.length-1&&(e+="\n")}return e},o.prototype.updateTexture=function(){var t=this._texture,e=this.getDropShadowPadding();t.baseTexture.hasLoaded=!0,t.baseTexture.resolution=this.resolution,t.baseTexture.realWidth=this.canvas.width,t.baseTexture.realHeight=this.canvas.height,t.baseTexture.width=this.canvas.width/this.resolution,t.baseTexture.height=this.canvas.height/this.resolution,t.trim.width=t.frame.width=this.canvas.width/this.resolution,t.trim.height=t.frame.height=this.canvas.height/this.resolution,t.trim.x=-this._style.padding-e,t.trim.y=-this._style.padding-e,t.orig.width=t.frame.width-2*(this._style.padding+e),t.orig.height=t.frame.height-2*(this._style.padding+e),this._onTextureUpdate(),t.baseTexture.emit("update",t.baseTexture),this.dirty=!1},o.prototype.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0,i=e;o<i.length;o++){var s=i[o];for(var r in s)t[r]=s[r]}return t},o.DEFAULT_TAG_STYLE={align:"left",breakWords:!1,dropShadow:!1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"#000000",dropShadowDistance:5,fill:"black",fillGradientType:PIXI.TEXT_GRADIENT.LINEAR_VERTICAL,fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",valign:"baseline",wordWrap:!1,wordWrapWidth:100},o.debugOptions={spans:{enabled:!1,baseline:"#44BB44",top:"#BB4444",bottom:"#4444BB",bounding:"rgba(255, 255, 255, 0.1)",text:!0},objects:{enabled:!1,bounding:"rgba(255, 255, 255, 0.05)",text:!0}},o}(PIXI.Text)); | ||
var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};var e=["pointerover","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","mouseover","mouseenter","mousedown","mousemove","mouseup","mousecancel","mouseout","mouseleave","touchover","touchenter","touchdown","touchmove","touchup","touchcancel","touchout","touchleave"],n="bbcode",o={bbcode:["[","]"],xml:["<",">"]};export default(function(s){function i(t,n){var o=s.call(this,t)||this;return o.styles=n,e.forEach(function(t){o.on(t,function(t){return o.handleInteraction(t)})}),o}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(i,s),i.prototype.handleInteraction=function(t){var e=t,n=t.data.getLocalPosition(this),o=this.hitboxes.reduce(function(t,e){return void 0!==t?t:e.hitbox.contains(n.x,n.y)?e:void 0},void 0);e.targetTag=void 0===o?void 0:o.tag},Object.defineProperty(i.prototype,"styles",{set:function(t){for(var e in this.textStyles={},this.textStyles.default=this.assign({},i.DEFAULT_TAG_STYLE),t)"default"===e?this.assign(this.textStyles.default,t[e]):this.textStyles[e]=this.assign({},t[e]);this.textStyles.default.tagStyle===n&&(this.textStyles.b=this.assign({},{fontStyle:"bold"}),this.textStyles.i=this.assign({},{fontStyle:"italic"}),this.textStyles.color=this.assign({},{fill:""}),this.textStyles.outline=this.assign({},{stroke:"",strokeThickness:6}),this.textStyles.font=this.assign({},{fontFamily:""}),this.textStyles.shadow=this.assign({},{dropShadowColor:"",dropShadow:!0,dropShadowBlur:3,dropShadowDistance:3,dropShadowAngle:2}),this.textStyles.size=this.assign({},{fontSize:"px"}),this.textStyles.spacing=this.assign({},{letterSpacing:""}),this.textStyles.align=this.assign({},{align:""})),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},enumerable:!0,configurable:!0}),i.prototype.setTagStyle=function(t,e){t in this.textStyles?this.assign(this.textStyles[t],e):this.textStyles[t]=this.assign({},e),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},i.prototype.deleteTagStyle=function(t){"default"===t?this.textStyles.default=this.assign({},i.DEFAULT_TAG_STYLE):delete this.textStyles[t],this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},i.prototype.getTagRegex=function(t,e){var s=Object.keys(this.textStyles).join("|");s=t?"("+s+")":"(?:"+s+")";var i=this.textStyles.default.tagStyle===n?"\\"+o.bbcode[0]+s+"(?:\\=(?:[A-Za-z0-9_\\-\\#]+|'(?:[^']+|\\\\')*'))*\\s*\\"+o.bbcode[1]+"|\\"+o.bbcode[0]+"\\/"+s+"\\s*\\"+o.bbcode[1]:"\\"+o.xml[0]+s+"(?:\\s+[A-Za-z0-9_\\-]+=(?:\"(?:[^\"]+|\\\\\")*\"|'(?:[^']+|\\\\')*'))*\\s*\\"+o.xml[1]+"|\\"+o.xml[0]+"\\/"+s+"\\s*\\"+o.xml[1];return e&&(i="("+i+")"),new RegExp(i,"g")},i.prototype.getPropertyRegex=function(){return new RegExp("([A-Za-z0-9_\\-]+)=(?:\"((?:[^\"]+|\\\\\")*)\"|'((?:[^']+|\\\\')*)')","g")},i.prototype.getBBcodePropertyRegex=function(){return new RegExp("[A-Za-z0-9_\\-]+=([A-Za-z0-9_\\-\\#]+)","g")},i.prototype._getTextDataPerLine=function(t){for(var e=[],s=this.getTagRegex(!0,!1),i=[this.assign({},this.textStyles.default)],r=[{name:"default",properties:{}}],a=0;a<t.length;a++){for(var h=[],l=[],c=void 0;c=s.exec(t[a]);)l.push(c);if(0===l.length)h.push(this.createTextData(t[a],i[i.length-1],r[r.length-1]));else{for(var x=0,d=function(e){if(l[e].index>x&&h.push(g.createTextData(t[a].substring(x,l[e].index),i[i.length-1],r[r.length-1])),"/"===l[e][0][1])i.length>1&&(i.pop(),r.pop());else{for(var o={},s=g.getPropertyRegex(),c=void 0;c=s.exec(l[e][0]);)o[c[1]]=c[2]||c[3];if(r.push({name:l[e][1],properties:o}),g.textStyles.default.tagStyle===n&&l[e][0].includes("=")&&g.textStyles[l[e][1]]){var d=g.getBBcodePropertyRegex().exec(l[e][0]),u={};Object.entries(g.textStyles[l[e][1]]).forEach(function(t){u[t[0]]="string"!=typeof t[1]?t[1]:d[1]+t[1]}),i.push(g.assign({},i[i.length-1],u))}else i.push(g.assign({},i[i.length-1],g.textStyles[l[e][1]]))}x=l[e].index+l[e][0].length},g=this,u=0;u<l.length;u++)d(u);if(x<t[a].length){var p=this.createTextData(x?t[a].substring(x):t[a],i[i.length-1],r[r.length-1]);h.push(p)}}e.push(h)}var f=this.textStyles.default.tagStyle;return e[e.length-1].map(function(t){t.text.includes(o[f][0])&&(t.text=t.text.match(f===n?/^(.*)\[/:/^(.*)\</)[1])}),e},i.prototype.getFontString=function(t){return new PIXI.TextStyle(t).toFontString()},i.prototype.createTextData=function(t,e,n){return{text:t,style:e,width:0,height:0,fontProperties:void 0,tag:n}},i.prototype.getDropShadowPadding=function(){var t=this,e=0,n=0;return Object.keys(this.textStyles).forEach(function(o){var s=t.textStyles[o],i=s.dropShadowBlur;e=Math.max(e,s.dropShadowDistance||0),n=Math.max(n,i||0)}),e+n},i.prototype.updateText=function(){var t=this;if(this.dirty){this.hitboxes=[],this.texture.baseTexture.resolution=this.resolution;var e=this.textStyles,n=this.text;this._style.wordWrap&&(n=this.wordWrap(this.text));for(var o=n.split(/(?:\r\n|\r|\n)/),s=this._getTextDataPerLine(o),r=[],a=[],h=[],l=0,c=0;c<o.length;c++){for(var x=0,d=0,g=0,u=0;u<s[c].length;u++){var p=s[c][u].style;this.context.font=this.getFontString(p),s[c][u].width=this.context.measureText(s[c][u].text).width,0!==s[c][u].text.length&&(s[c][u].width+=(s[c][u].text.length-1)*p.letterSpacing,u>0&&(x+=p.letterSpacing/2),u<s[c].length-1&&(x+=p.letterSpacing/2)),x+=s[c][u].width,s[c][u].fontProperties=PIXI.TextMetrics.measureFont(this.context.font),s[c][u].height=s[c][u].fontProperties.fontSize,"number"==typeof p.valign?(d=Math.min(d,p.valign-s[c][u].fontProperties.descent),g=Math.max(g,p.valign+s[c][u].fontProperties.ascent)):(d=Math.min(d,-s[c][u].fontProperties.descent),g=Math.max(g,s[c][u].fontProperties.ascent))}r[c]=x,a[c]=d,h[c]=g,l=Math.max(l,x)}var f=Object.keys(e).map(function(t){return e[t]}).reduce(function(t,e){return Math.max(t,e.strokeThickness||0)},0),y=this.getDropShadowPadding(),S=l+2*f+2*y,b=h.reduce(function(t,e){return t+e},0)-a.reduce(function(t,e){return t+e},0)+2*f+2*y;this.canvas.width=S*this.resolution,this.canvas.height=b*this.resolution,this.context.scale(this.resolution,this.resolution),this.context.textBaseline="alphabetic",this.context.lineJoin="round";var v=y+f,w=[];for(c=0;c<s.length;c++){var m=s[c],T=void 0;switch(this._style.align){case"left":T=y+f;break;case"center":T=y+f+(l-r[c])/2;break;case"right":T=y+f+l-r[c]}for(u=0;u<m.length;u++){var k=m[u],P=k.style,_=k.text,I=k.fontProperties,O=k.width,A=k.tag,F=v+I.ascent;switch(P.valign){case"top":break;case"baseline":F+=h[c]-I.ascent;break;case"middle":F+=(h[c]-a[c]-I.ascent-I.descent)/2;break;case"bottom":F+=h[c]-a[c]-I.ascent-I.descent;break;default:F+=h[c]-I.ascent-P.valign}if(0===P.letterSpacing)w.push({text:_,style:P,x:T,y:F,width:O,ascent:I.ascent,descent:I.descent,tag:A}),T+=m[u].width;else{this.context.font=this.getFontString(m[u].style);for(var E=0;E<_.length;E++){(E>0||u>0)&&(T+=P.letterSpacing/2);var D=this.context.measureText(_.charAt(E)).width;w.push({text:_.charAt(E),style:P,x:T,y:F,width:D,ascent:I.ascent,descent:I.descent,tag:A}),T+=D,(E<_.length-1||u<m.length-1)&&(T+=P.letterSpacing/2)}}}v+=h[c]-a[c]}this.context.save(),w.forEach(function(e){var n=e.style,o=e.text,s=e.x,i=e.y;if(n.dropShadow){t.context.font=t.getFontString(n);var r=n.dropShadowColor;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.shadowColor=r,t.context.shadowBlur=n.dropShadowBlur,t.context.shadowOffsetX=Math.cos(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.shadowOffsetY=Math.sin(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.fillText(o,s,i)}}),this.context.restore(),w.forEach(function(e){var n=e.style,o=e.text,s=e.x,i=e.y;if(void 0!==n.stroke&&n.strokeThickness){t.context.font=t.getFontString(n);var r=n.stroke;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.strokeStyle=r,t.context.lineWidth=n.strokeThickness,t.context.strokeText(o,s,i)}}),w.forEach(function(e){var n=e.style,o=e.text,s=e.x,i=e.y;if(void 0!==n.fill){t.context.font=t.getFontString(n);var r=n.fill;if("number"==typeof r)r=PIXI.utils.hex2string(r);else if(Array.isArray(r))for(var a=0;a<r.length;a++){var h=r[a];"number"==typeof h&&(r[a]=PIXI.utils.hex2string(h))}t.context.fillStyle=t._generateFillStyle(new PIXI.TextStyle(n),[o]),t.context.fillText(o,s,i)}}),w.forEach(function(e){var n=e.style,o=e.x,s=e.y,r=e.width,a=e.ascent,h=e.descent,l=e.tag,c=-t._style.padding-t.getDropShadowPadding();t.hitboxes.push({tag:l,hitbox:new PIXI.Rectangle(o+c,s-a+c,r,a+h)}),(void 0===n.debug?i.debugOptions.spans.enabled:n.debug)&&(t.context.lineWidth=1,i.debugOptions.spans.bounding&&(t.context.fillStyle=i.debugOptions.spans.bounding,t.context.strokeStyle=i.debugOptions.spans.bounding,t.context.beginPath(),t.context.rect(o,s-a,r,a+h),t.context.fill(),t.context.stroke(),t.context.stroke()),i.debugOptions.spans.baseline&&(t.context.strokeStyle=i.debugOptions.spans.baseline,t.context.beginPath(),t.context.moveTo(o,s),t.context.lineTo(o+r,s),t.context.closePath(),t.context.stroke()),i.debugOptions.spans.top&&(t.context.strokeStyle=i.debugOptions.spans.top,t.context.beginPath(),t.context.moveTo(o,s-a),t.context.lineTo(o+r,s-a),t.context.closePath(),t.context.stroke()),i.debugOptions.spans.bottom&&(t.context.strokeStyle=i.debugOptions.spans.bottom,t.context.beginPath(),t.context.moveTo(o,s+h),t.context.lineTo(o+r,s+h),t.context.closePath(),t.context.stroke()),i.debugOptions.spans.text&&(t.context.fillStyle="#ffffff",t.context.strokeStyle="#000000",t.context.lineWidth=2,t.context.font="8px monospace",t.context.strokeText(l.name,o,s-a+8),t.context.fillText(l.name,o,s-a+8),t.context.strokeText(r.toFixed(2)+"x"+(a+h).toFixed(2),o,s-a+16),t.context.fillText(r.toFixed(2)+"x"+(a+h).toFixed(2),o,s-a+16)))}),i.debugOptions.objects.enabled&&(i.debugOptions.objects.bounding&&(this.context.fillStyle=i.debugOptions.objects.bounding,this.context.beginPath(),this.context.rect(0,0,S,b),this.context.fill()),i.debugOptions.objects.text&&(this.context.fillStyle="#ffffff",this.context.strokeStyle="#000000",this.context.lineWidth=2,this.context.font="8px monospace",this.context.strokeText(S.toFixed(2)+"x"+b.toFixed(2),0,8,S),this.context.fillText(S.toFixed(2)+"x"+b.toFixed(2),0,8,S))),this.updateTexture()}},i.prototype.wordWrap=function(t){var e="",n=this.getTagRegex(!0,!0),o=t.split("\n"),s=this._style.wordWrapWidth,i=[this.assign({},this.textStyles.default)];this.context.font=this.getFontString(this.textStyles.default);for(var r=0;r<o.length;r++){for(var a=s,h=o[r].split(n),l=!0,c=0;c<h.length;c++)if(n.test(h[c]))e+=h[c],"/"===h[c][1]?(c+=2,i.pop()):(i.push(this.assign({},i[i.length-1],this.textStyles[h[++c]])),c++),this.context.font=this.getFontString(i[i.length-1]);else for(var x=h[c].split(" "),d=0;d<x.length;d++){var g=this.context.measureText(x[d]).width;if(this._style.breakWords&&g>a){var u=x[d].split("");d>0&&(e+=" ",a-=this.context.measureText(" ").width);for(var p=0;p<u.length;p++){var f=this.context.measureText(u[p]).width;f>a?(e+="\n"+u[p],a=s-f):(e+=u[p],a-=f)}}else if(this._style.breakWords)e+=x[d],a-=g;else{var y=g+(d>0?this.context.measureText(" ").width:0);y>a?(l||(e+="\n"),e+=x[d],a=s-g):(a-=y,d>0&&(e+=" "),e+=x[d])}l=!1}r<o.length-1&&(e+="\n")}return e},i.prototype.updateTexture=function(){var t=this._texture,e=this.getDropShadowPadding();t.baseTexture.hasLoaded=!0,t.baseTexture.resolution=this.resolution,t.baseTexture.realWidth=this.canvas.width,t.baseTexture.realHeight=this.canvas.height,t.baseTexture.width=this.canvas.width/this.resolution,t.baseTexture.height=this.canvas.height/this.resolution,t.trim.width=t.frame.width=this.canvas.width/this.resolution,t.trim.height=t.frame.height=this.canvas.height/this.resolution,t.trim.x=-this._style.padding-e,t.trim.y=-this._style.padding-e,t.orig.width=t.frame.width-2*(this._style.padding+e),t.orig.height=t.frame.height-2*(this._style.padding+e),this._onTextureUpdate(),t.baseTexture.emit("update",t.baseTexture),this.dirty=!1},i.prototype.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0,s=e;o<s.length;o++){var i=s[o];for(var r in i)t[r]=i[r]}return t},i.DEFAULT_TAG_STYLE={align:"left",breakWords:!1,dropShadow:!1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"#000000",dropShadowDistance:5,fill:"black",fillGradientType:PIXI.TEXT_GRADIENT.LINEAR_VERTICAL,fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",valign:"baseline",wordWrap:!1,wordWrapWidth:100,tagStyle:"xml"},i.debugOptions={spans:{enabled:!1,baseline:"#44BB44",top:"#BB4444",bottom:"#4444BB",bounding:"rgba(255, 255, 255, 0.1)",text:!0},objects:{enabled:!1,bounding:"rgba(255, 255, 255, 0.05)",text:!0}},i}(PIXI.Text)); | ||
//# sourceMappingURL=pixi-multistyle-text.m.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.MultiStyleText=e()}(this,function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};var e=["pointerover","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","mouseover","mouseenter","mousedown","mousemove","mouseup","mousecancel","mouseout","mouseleave","touchover","touchenter","touchdown","touchmove","touchup","touchcancel","touchout","touchleave"];return function(n){function o(t,o){var i=n.call(this,t)||this;return i.styles=o,e.forEach(function(t){i.on(t,function(t){return i.handleInteraction(t)})}),i}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(o,n),o.prototype.handleInteraction=function(t){var e=t,n=t.data.getLocalPosition(this),o=this.hitboxes.reduce(function(t,e){return void 0!==t?t:e.hitbox.contains(n.x,n.y)?e:void 0},void 0);e.targetTag=void 0===o?void 0:o.tag},Object.defineProperty(o.prototype,"styles",{set:function(t){for(var e in this.textStyles={},this.textStyles.default=this.assign({},o.DEFAULT_TAG_STYLE),t)"default"===e?this.assign(this.textStyles.default,t[e]):this.textStyles[e]=this.assign({},t[e]);this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},enumerable:!0,configurable:!0}),o.prototype.setTagStyle=function(t,e){t in this.textStyles?this.assign(this.textStyles[t],e):this.textStyles[t]=this.assign({},e),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},o.prototype.deleteTagStyle=function(t){"default"===t?this.textStyles.default=this.assign({},o.DEFAULT_TAG_STYLE):delete this.textStyles[t],this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},o.prototype.getTagRegex=function(t,e){var n=Object.keys(this.textStyles).join("|"),o="<"+(n=t?"("+n+")":"(?:"+n+")")+"(?:\\s+[A-Za-z0-9_\\-]+=(?:\"(?:[^\"]+|\\\\\")*\"|'(?:[^']+|\\\\')*'))*\\s*>|</"+n+"\\s*>";return e&&(o="("+o+")"),new RegExp(o,"g")},o.prototype.getPropertyRegex=function(){return new RegExp("([A-Za-z0-9_\\-]+)=(?:\"((?:[^\"]+|\\\\\")*)\"|'((?:[^']+|\\\\')*)')","g")},o.prototype._getTextDataPerLine=function(t){for(var e=[],n=this.getTagRegex(!0,!1),o=[this.assign({},this.textStyles.default)],i=[{name:"default",properties:{}}],s=0;s<t.length;s++){for(var r=[],a=[],h=void 0;h=n.exec(t[s]);)a.push(h);if(0===a.length)r.push(this.createTextData(t[s],o[o.length-1],i[i.length-1]));else{for(var l=0,c=0;c<a.length;c++){if(a[c].index>l&&r.push(this.createTextData(t[s].substring(l,a[c].index),o[o.length-1],i[i.length-1])),"/"===a[c][0][1])o.length>1&&(o.pop(),i.pop());else{o.push(this.assign({},o[o.length-1],this.textStyles[a[c][1]]));for(var d={},x=this.getPropertyRegex(),u=void 0;u=x.exec(a[c][0]);)d[u[1]]=u[2]||u[3];i.push({name:a[c][1],properties:d})}l=a[c].index+a[c][0].length}l<t[s].length&&r.push(this.createTextData(t[s].substring(l),o[o.length-1],i[i.length-1]))}e.push(r)}return e},o.prototype.getFontString=function(t){return new PIXI.TextStyle(t).toFontString()},o.prototype.createTextData=function(t,e,n){return{text:t,style:e,width:0,height:0,fontProperties:void 0,tag:n}},o.prototype.getDropShadowPadding=function(){var t=this,e=0,n=0;return Object.keys(this.textStyles).forEach(function(o){var i=t.textStyles[o],s=i.dropShadowBlur;e=Math.max(e,i.dropShadowDistance||0),n=Math.max(n,s||0)}),e+n},o.prototype.updateText=function(){var t=this;if(this.dirty){this.hitboxes=[],this.texture.baseTexture.resolution=this.resolution;var e=this.textStyles,n=this.text;this._style.wordWrap&&(n=this.wordWrap(this.text));for(var i=n.split(/(?:\r\n|\r|\n)/),s=this._getTextDataPerLine(i),r=[],a=[],h=[],l=0,c=0;c<i.length;c++){for(var d=0,x=0,u=0,p=0;p<s[c].length;p++){var g=s[c][p].style;this.context.font=this.getFontString(g),s[c][p].width=this.context.measureText(s[c][p].text).width,0!==s[c][p].text.length&&(s[c][p].width+=(s[c][p].text.length-1)*g.letterSpacing,p>0&&(d+=g.letterSpacing/2),p<s[c].length-1&&(d+=g.letterSpacing/2)),d+=s[c][p].width,s[c][p].fontProperties=PIXI.TextMetrics.measureFont(this.context.font),s[c][p].height=s[c][p].fontProperties.fontSize,"number"==typeof g.valign?(x=Math.min(x,g.valign-s[c][p].fontProperties.descent),u=Math.max(u,g.valign+s[c][p].fontProperties.ascent)):(x=Math.min(x,-s[c][p].fontProperties.descent),u=Math.max(u,s[c][p].fontProperties.ascent))}r[c]=d,a[c]=x,h[c]=u,l=Math.max(l,d)}var f=Object.keys(e).map(function(t){return e[t]}).reduce(function(t,e){return Math.max(t,e.strokeThickness||0)},0),y=this.getDropShadowPadding(),b=l+2*f+2*y,v=h.reduce(function(t,e){return t+e},0)-a.reduce(function(t,e){return t+e},0)+2*f+2*y;this.canvas.width=b*this.resolution,this.canvas.height=v*this.resolution,this.context.scale(this.resolution,this.resolution),this.context.textBaseline="alphabetic",this.context.lineJoin="round";var S=y+f,T=[];for(c=0;c<s.length;c++){var w=s[c],m=void 0;switch(this._style.align){case"left":m=y+f;break;case"center":m=y+f+(l-r[c])/2;break;case"right":m=y+f+l-r[c]}for(p=0;p<w.length;p++){var P=w[p],k=P.style,_=P.text,I=P.fontProperties,O=P.width,F=P.tag,A=S+I.ascent;switch(k.valign){case"top":break;case"baseline":A+=h[c]-I.ascent;break;case"middle":A+=(h[c]-a[c]-I.ascent-I.descent)/2;break;case"bottom":A+=h[c]-a[c]-I.ascent-I.descent;break;default:A+=h[c]-I.ascent-k.valign}if(0===k.letterSpacing)T.push({text:_,style:k,x:m,y:A,width:O,ascent:I.ascent,descent:I.descent,tag:F}),m+=w[p].width;else{this.context.font=this.getFontString(w[p].style);for(var D=0;D<_.length;D++){(D>0||p>0)&&(m+=k.letterSpacing/2);var E=this.context.measureText(_.charAt(D)).width;T.push({text:_.charAt(D),style:k,x:m,y:A,width:E,ascent:I.ascent,descent:I.descent,tag:F}),m+=E,(D<_.length-1||p<w.length-1)&&(m+=k.letterSpacing/2)}}}S+=h[c]-a[c]}this.context.save(),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(n.dropShadow){t.context.font=t.getFontString(n);var r=n.dropShadowColor;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.shadowColor=r,t.context.shadowBlur=n.dropShadowBlur,t.context.shadowOffsetX=Math.cos(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.shadowOffsetY=Math.sin(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.fillText(o,i,s)}}),this.context.restore(),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.stroke&&n.strokeThickness){t.context.font=t.getFontString(n);var r=n.stroke;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.strokeStyle=r,t.context.lineWidth=n.strokeThickness,t.context.strokeText(o,i,s)}}),T.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.fill){t.context.font=t.getFontString(n);var r=n.fill;if("number"==typeof r)r=PIXI.utils.hex2string(r);else if(Array.isArray(r))for(var a=0;a<r.length;a++){var h=r[a];"number"==typeof h&&(r[a]=PIXI.utils.hex2string(h))}t.context.fillStyle=t._generateFillStyle(new PIXI.TextStyle(n),[o]),t.context.fillText(o,i,s)}}),T.forEach(function(e){var n=e.style,i=e.x,s=e.y,r=e.width,a=e.ascent,h=e.descent,l=e.tag,c=-t._style.padding-t.getDropShadowPadding();t.hitboxes.push({tag:l,hitbox:new PIXI.Rectangle(i+c,s-a+c,r,a+h)}),(void 0===n.debug?o.debugOptions.spans.enabled:n.debug)&&(t.context.lineWidth=1,o.debugOptions.spans.bounding&&(t.context.fillStyle=o.debugOptions.spans.bounding,t.context.strokeStyle=o.debugOptions.spans.bounding,t.context.beginPath(),t.context.rect(i,s-a,r,a+h),t.context.fill(),t.context.stroke(),t.context.stroke()),o.debugOptions.spans.baseline&&(t.context.strokeStyle=o.debugOptions.spans.baseline,t.context.beginPath(),t.context.moveTo(i,s),t.context.lineTo(i+r,s),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.top&&(t.context.strokeStyle=o.debugOptions.spans.top,t.context.beginPath(),t.context.moveTo(i,s-a),t.context.lineTo(i+r,s-a),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.bottom&&(t.context.strokeStyle=o.debugOptions.spans.bottom,t.context.beginPath(),t.context.moveTo(i,s+h),t.context.lineTo(i+r,s+h),t.context.closePath(),t.context.stroke()),o.debugOptions.spans.text&&(t.context.fillStyle="#ffffff",t.context.strokeStyle="#000000",t.context.lineWidth=2,t.context.font="8px monospace",t.context.strokeText(l.name,i,s-a+8),t.context.fillText(l.name,i,s-a+8),t.context.strokeText(r.toFixed(2)+"x"+(a+h).toFixed(2),i,s-a+16),t.context.fillText(r.toFixed(2)+"x"+(a+h).toFixed(2),i,s-a+16)))}),o.debugOptions.objects.enabled&&(o.debugOptions.objects.bounding&&(this.context.fillStyle=o.debugOptions.objects.bounding,this.context.beginPath(),this.context.rect(0,0,b,v),this.context.fill()),o.debugOptions.objects.text&&(this.context.fillStyle="#ffffff",this.context.strokeStyle="#000000",this.context.lineWidth=2,this.context.font="8px monospace",this.context.strokeText(b.toFixed(2)+"x"+v.toFixed(2),0,8,b),this.context.fillText(b.toFixed(2)+"x"+v.toFixed(2),0,8,b))),this.updateTexture()}},o.prototype.wordWrap=function(t){var e="",n=this.getTagRegex(!0,!0),o=t.split("\n"),i=this._style.wordWrapWidth,s=[this.assign({},this.textStyles.default)];this.context.font=this.getFontString(this.textStyles.default);for(var r=0;r<o.length;r++){for(var a=i,h=o[r].split(n),l=!0,c=0;c<h.length;c++)if(n.test(h[c]))e+=h[c],"/"===h[c][1]?(c+=2,s.pop()):(s.push(this.assign({},s[s.length-1],this.textStyles[h[++c]])),c++),this.context.font=this.getFontString(s[s.length-1]);else for(var d=h[c].split(" "),x=0;x<d.length;x++){var u=this.context.measureText(d[x]).width;if(this._style.breakWords&&u>a){var p=d[x].split("");x>0&&(e+=" ",a-=this.context.measureText(" ").width);for(var g=0;g<p.length;g++){var f=this.context.measureText(p[g]).width;f>a?(e+="\n"+p[g],a=i-f):(e+=p[g],a-=f)}}else if(this._style.breakWords)e+=d[x],a-=u;else{var y=u+(x>0?this.context.measureText(" ").width:0);y>a?(l||(e+="\n"),e+=d[x],a=i-u):(a-=y,x>0&&(e+=" "),e+=d[x])}l=!1}r<o.length-1&&(e+="\n")}return e},o.prototype.updateTexture=function(){var t=this._texture,e=this.getDropShadowPadding();t.baseTexture.hasLoaded=!0,t.baseTexture.resolution=this.resolution,t.baseTexture.realWidth=this.canvas.width,t.baseTexture.realHeight=this.canvas.height,t.baseTexture.width=this.canvas.width/this.resolution,t.baseTexture.height=this.canvas.height/this.resolution,t.trim.width=t.frame.width=this.canvas.width/this.resolution,t.trim.height=t.frame.height=this.canvas.height/this.resolution,t.trim.x=-this._style.padding-e,t.trim.y=-this._style.padding-e,t.orig.width=t.frame.width-2*(this._style.padding+e),t.orig.height=t.frame.height-2*(this._style.padding+e),this._onTextureUpdate(),t.baseTexture.emit("update",t.baseTexture),this.dirty=!1},o.prototype.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0,i=e;o<i.length;o++){var s=i[o];for(var r in s)t[r]=s[r]}return t},o.DEFAULT_TAG_STYLE={align:"left",breakWords:!1,dropShadow:!1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"#000000",dropShadowDistance:5,fill:"black",fillGradientType:PIXI.TEXT_GRADIENT.LINEAR_VERTICAL,fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",valign:"baseline",wordWrap:!1,wordWrapWidth:100},o.debugOptions={spans:{enabled:!1,baseline:"#44BB44",top:"#BB4444",bottom:"#4444BB",bounding:"rgba(255, 255, 255, 0.1)",text:!0},objects:{enabled:!1,bounding:"rgba(255, 255, 255, 0.05)",text:!0}},o}(PIXI.Text)}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.MultiStyleText=e()}(this,function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};var e=["pointerover","pointerenter","pointerdown","pointermove","pointerup","pointercancel","pointerout","pointerleave","gotpointercapture","lostpointercapture","mouseover","mouseenter","mousedown","mousemove","mouseup","mousecancel","mouseout","mouseleave","touchover","touchenter","touchdown","touchmove","touchup","touchcancel","touchout","touchleave"],n="bbcode",o={bbcode:["[","]"],xml:["<",">"]};return function(i){function s(t,n){var o=i.call(this,t)||this;return o.styles=n,e.forEach(function(t){o.on(t,function(t){return o.handleInteraction(t)})}),o}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(s,i),s.prototype.handleInteraction=function(t){var e=t,n=t.data.getLocalPosition(this),o=this.hitboxes.reduce(function(t,e){return void 0!==t?t:e.hitbox.contains(n.x,n.y)?e:void 0},void 0);e.targetTag=void 0===o?void 0:o.tag},Object.defineProperty(s.prototype,"styles",{set:function(t){for(var e in this.textStyles={},this.textStyles.default=this.assign({},s.DEFAULT_TAG_STYLE),t)"default"===e?this.assign(this.textStyles.default,t[e]):this.textStyles[e]=this.assign({},t[e]);this.textStyles.default.tagStyle===n&&(this.textStyles.b=this.assign({},{fontStyle:"bold"}),this.textStyles.i=this.assign({},{fontStyle:"italic"}),this.textStyles.color=this.assign({},{fill:""}),this.textStyles.outline=this.assign({},{stroke:"",strokeThickness:6}),this.textStyles.font=this.assign({},{fontFamily:""}),this.textStyles.shadow=this.assign({},{dropShadowColor:"",dropShadow:!0,dropShadowBlur:3,dropShadowDistance:3,dropShadowAngle:2}),this.textStyles.size=this.assign({},{fontSize:"px"}),this.textStyles.spacing=this.assign({},{letterSpacing:""}),this.textStyles.align=this.assign({},{align:""})),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},enumerable:!0,configurable:!0}),s.prototype.setTagStyle=function(t,e){t in this.textStyles?this.assign(this.textStyles[t],e):this.textStyles[t]=this.assign({},e),this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},s.prototype.deleteTagStyle=function(t){"default"===t?this.textStyles.default=this.assign({},s.DEFAULT_TAG_STYLE):delete this.textStyles[t],this._style=new PIXI.TextStyle(this.textStyles.default),this.dirty=!0},s.prototype.getTagRegex=function(t,e){var i=Object.keys(this.textStyles).join("|");i=t?"("+i+")":"(?:"+i+")";var s=this.textStyles.default.tagStyle===n?"\\"+o.bbcode[0]+i+"(?:\\=(?:[A-Za-z0-9_\\-\\#]+|'(?:[^']+|\\\\')*'))*\\s*\\"+o.bbcode[1]+"|\\"+o.bbcode[0]+"\\/"+i+"\\s*\\"+o.bbcode[1]:"\\"+o.xml[0]+i+"(?:\\s+[A-Za-z0-9_\\-]+=(?:\"(?:[^\"]+|\\\\\")*\"|'(?:[^']+|\\\\')*'))*\\s*\\"+o.xml[1]+"|\\"+o.xml[0]+"\\/"+i+"\\s*\\"+o.xml[1];return e&&(s="("+s+")"),new RegExp(s,"g")},s.prototype.getPropertyRegex=function(){return new RegExp("([A-Za-z0-9_\\-]+)=(?:\"((?:[^\"]+|\\\\\")*)\"|'((?:[^']+|\\\\')*)')","g")},s.prototype.getBBcodePropertyRegex=function(){return new RegExp("[A-Za-z0-9_\\-]+=([A-Za-z0-9_\\-\\#]+)","g")},s.prototype._getTextDataPerLine=function(t){for(var e=[],i=this.getTagRegex(!0,!1),s=[this.assign({},this.textStyles.default)],r=[{name:"default",properties:{}}],a=0;a<t.length;a++){for(var h=[],l=[],c=void 0;c=i.exec(t[a]);)l.push(c);if(0===l.length)h.push(this.createTextData(t[a],s[s.length-1],r[r.length-1]));else{for(var x=0,d=function(e){if(l[e].index>x&&h.push(g.createTextData(t[a].substring(x,l[e].index),s[s.length-1],r[r.length-1])),"/"===l[e][0][1])s.length>1&&(s.pop(),r.pop());else{for(var o={},i=g.getPropertyRegex(),c=void 0;c=i.exec(l[e][0]);)o[c[1]]=c[2]||c[3];if(r.push({name:l[e][1],properties:o}),g.textStyles.default.tagStyle===n&&l[e][0].includes("=")&&g.textStyles[l[e][1]]){var d=g.getBBcodePropertyRegex().exec(l[e][0]),u={};Object.entries(g.textStyles[l[e][1]]).forEach(function(t){u[t[0]]="string"!=typeof t[1]?t[1]:d[1]+t[1]}),s.push(g.assign({},s[s.length-1],u))}else s.push(g.assign({},s[s.length-1],g.textStyles[l[e][1]]))}x=l[e].index+l[e][0].length},g=this,u=0;u<l.length;u++)d(u);if(x<t[a].length){var p=this.createTextData(x?t[a].substring(x):t[a],s[s.length-1],r[r.length-1]);h.push(p)}}e.push(h)}var f=this.textStyles.default.tagStyle;return e[e.length-1].map(function(t){t.text.includes(o[f][0])&&(t.text=t.text.match(f===n?/^(.*)\[/:/^(.*)\</)[1])}),e},s.prototype.getFontString=function(t){return new PIXI.TextStyle(t).toFontString()},s.prototype.createTextData=function(t,e,n){return{text:t,style:e,width:0,height:0,fontProperties:void 0,tag:n}},s.prototype.getDropShadowPadding=function(){var t=this,e=0,n=0;return Object.keys(this.textStyles).forEach(function(o){var i=t.textStyles[o],s=i.dropShadowBlur;e=Math.max(e,i.dropShadowDistance||0),n=Math.max(n,s||0)}),e+n},s.prototype.updateText=function(){var t=this;if(this.dirty){this.hitboxes=[],this.texture.baseTexture.resolution=this.resolution;var e=this.textStyles,n=this.text;this._style.wordWrap&&(n=this.wordWrap(this.text));for(var o=n.split(/(?:\r\n|\r|\n)/),i=this._getTextDataPerLine(o),r=[],a=[],h=[],l=0,c=0;c<o.length;c++){for(var x=0,d=0,g=0,u=0;u<i[c].length;u++){var p=i[c][u].style;this.context.font=this.getFontString(p),i[c][u].width=this.context.measureText(i[c][u].text).width,0!==i[c][u].text.length&&(i[c][u].width+=(i[c][u].text.length-1)*p.letterSpacing,u>0&&(x+=p.letterSpacing/2),u<i[c].length-1&&(x+=p.letterSpacing/2)),x+=i[c][u].width,i[c][u].fontProperties=PIXI.TextMetrics.measureFont(this.context.font),i[c][u].height=i[c][u].fontProperties.fontSize,"number"==typeof p.valign?(d=Math.min(d,p.valign-i[c][u].fontProperties.descent),g=Math.max(g,p.valign+i[c][u].fontProperties.ascent)):(d=Math.min(d,-i[c][u].fontProperties.descent),g=Math.max(g,i[c][u].fontProperties.ascent))}r[c]=x,a[c]=d,h[c]=g,l=Math.max(l,x)}var f=Object.keys(e).map(function(t){return e[t]}).reduce(function(t,e){return Math.max(t,e.strokeThickness||0)},0),y=this.getDropShadowPadding(),S=l+2*f+2*y,b=h.reduce(function(t,e){return t+e},0)-a.reduce(function(t,e){return t+e},0)+2*f+2*y;this.canvas.width=S*this.resolution,this.canvas.height=b*this.resolution,this.context.scale(this.resolution,this.resolution),this.context.textBaseline="alphabetic",this.context.lineJoin="round";var v=y+f,m=[];for(c=0;c<i.length;c++){var w=i[c],T=void 0;switch(this._style.align){case"left":T=y+f;break;case"center":T=y+f+(l-r[c])/2;break;case"right":T=y+f+l-r[c]}for(u=0;u<w.length;u++){var k=w[u],P=k.style,_=k.text,I=k.fontProperties,O=k.width,A=k.tag,F=v+I.ascent;switch(P.valign){case"top":break;case"baseline":F+=h[c]-I.ascent;break;case"middle":F+=(h[c]-a[c]-I.ascent-I.descent)/2;break;case"bottom":F+=h[c]-a[c]-I.ascent-I.descent;break;default:F+=h[c]-I.ascent-P.valign}if(0===P.letterSpacing)m.push({text:_,style:P,x:T,y:F,width:O,ascent:I.ascent,descent:I.descent,tag:A}),T+=w[u].width;else{this.context.font=this.getFontString(w[u].style);for(var E=0;E<_.length;E++){(E>0||u>0)&&(T+=P.letterSpacing/2);var D=this.context.measureText(_.charAt(E)).width;m.push({text:_.charAt(E),style:P,x:T,y:F,width:D,ascent:I.ascent,descent:I.descent,tag:A}),T+=D,(E<_.length-1||u<w.length-1)&&(T+=P.letterSpacing/2)}}}v+=h[c]-a[c]}this.context.save(),m.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(n.dropShadow){t.context.font=t.getFontString(n);var r=n.dropShadowColor;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.shadowColor=r,t.context.shadowBlur=n.dropShadowBlur,t.context.shadowOffsetX=Math.cos(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.shadowOffsetY=Math.sin(n.dropShadowAngle)*n.dropShadowDistance*t.resolution,t.context.fillText(o,i,s)}}),this.context.restore(),m.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.stroke&&n.strokeThickness){t.context.font=t.getFontString(n);var r=n.stroke;"number"==typeof r&&(r=PIXI.utils.hex2string(r)),t.context.strokeStyle=r,t.context.lineWidth=n.strokeThickness,t.context.strokeText(o,i,s)}}),m.forEach(function(e){var n=e.style,o=e.text,i=e.x,s=e.y;if(void 0!==n.fill){t.context.font=t.getFontString(n);var r=n.fill;if("number"==typeof r)r=PIXI.utils.hex2string(r);else if(Array.isArray(r))for(var a=0;a<r.length;a++){var h=r[a];"number"==typeof h&&(r[a]=PIXI.utils.hex2string(h))}t.context.fillStyle=t._generateFillStyle(new PIXI.TextStyle(n),[o]),t.context.fillText(o,i,s)}}),m.forEach(function(e){var n=e.style,o=e.x,i=e.y,r=e.width,a=e.ascent,h=e.descent,l=e.tag,c=-t._style.padding-t.getDropShadowPadding();t.hitboxes.push({tag:l,hitbox:new PIXI.Rectangle(o+c,i-a+c,r,a+h)}),(void 0===n.debug?s.debugOptions.spans.enabled:n.debug)&&(t.context.lineWidth=1,s.debugOptions.spans.bounding&&(t.context.fillStyle=s.debugOptions.spans.bounding,t.context.strokeStyle=s.debugOptions.spans.bounding,t.context.beginPath(),t.context.rect(o,i-a,r,a+h),t.context.fill(),t.context.stroke(),t.context.stroke()),s.debugOptions.spans.baseline&&(t.context.strokeStyle=s.debugOptions.spans.baseline,t.context.beginPath(),t.context.moveTo(o,i),t.context.lineTo(o+r,i),t.context.closePath(),t.context.stroke()),s.debugOptions.spans.top&&(t.context.strokeStyle=s.debugOptions.spans.top,t.context.beginPath(),t.context.moveTo(o,i-a),t.context.lineTo(o+r,i-a),t.context.closePath(),t.context.stroke()),s.debugOptions.spans.bottom&&(t.context.strokeStyle=s.debugOptions.spans.bottom,t.context.beginPath(),t.context.moveTo(o,i+h),t.context.lineTo(o+r,i+h),t.context.closePath(),t.context.stroke()),s.debugOptions.spans.text&&(t.context.fillStyle="#ffffff",t.context.strokeStyle="#000000",t.context.lineWidth=2,t.context.font="8px monospace",t.context.strokeText(l.name,o,i-a+8),t.context.fillText(l.name,o,i-a+8),t.context.strokeText(r.toFixed(2)+"x"+(a+h).toFixed(2),o,i-a+16),t.context.fillText(r.toFixed(2)+"x"+(a+h).toFixed(2),o,i-a+16)))}),s.debugOptions.objects.enabled&&(s.debugOptions.objects.bounding&&(this.context.fillStyle=s.debugOptions.objects.bounding,this.context.beginPath(),this.context.rect(0,0,S,b),this.context.fill()),s.debugOptions.objects.text&&(this.context.fillStyle="#ffffff",this.context.strokeStyle="#000000",this.context.lineWidth=2,this.context.font="8px monospace",this.context.strokeText(S.toFixed(2)+"x"+b.toFixed(2),0,8,S),this.context.fillText(S.toFixed(2)+"x"+b.toFixed(2),0,8,S))),this.updateTexture()}},s.prototype.wordWrap=function(t){var e="",n=this.getTagRegex(!0,!0),o=t.split("\n"),i=this._style.wordWrapWidth,s=[this.assign({},this.textStyles.default)];this.context.font=this.getFontString(this.textStyles.default);for(var r=0;r<o.length;r++){for(var a=i,h=o[r].split(n),l=!0,c=0;c<h.length;c++)if(n.test(h[c]))e+=h[c],"/"===h[c][1]?(c+=2,s.pop()):(s.push(this.assign({},s[s.length-1],this.textStyles[h[++c]])),c++),this.context.font=this.getFontString(s[s.length-1]);else for(var x=h[c].split(" "),d=0;d<x.length;d++){var g=this.context.measureText(x[d]).width;if(this._style.breakWords&&g>a){var u=x[d].split("");d>0&&(e+=" ",a-=this.context.measureText(" ").width);for(var p=0;p<u.length;p++){var f=this.context.measureText(u[p]).width;f>a?(e+="\n"+u[p],a=i-f):(e+=u[p],a-=f)}}else if(this._style.breakWords)e+=x[d],a-=g;else{var y=g+(d>0?this.context.measureText(" ").width:0);y>a?(l||(e+="\n"),e+=x[d],a=i-g):(a-=y,d>0&&(e+=" "),e+=x[d])}l=!1}r<o.length-1&&(e+="\n")}return e},s.prototype.updateTexture=function(){var t=this._texture,e=this.getDropShadowPadding();t.baseTexture.hasLoaded=!0,t.baseTexture.resolution=this.resolution,t.baseTexture.realWidth=this.canvas.width,t.baseTexture.realHeight=this.canvas.height,t.baseTexture.width=this.canvas.width/this.resolution,t.baseTexture.height=this.canvas.height/this.resolution,t.trim.width=t.frame.width=this.canvas.width/this.resolution,t.trim.height=t.frame.height=this.canvas.height/this.resolution,t.trim.x=-this._style.padding-e,t.trim.y=-this._style.padding-e,t.orig.width=t.frame.width-2*(this._style.padding+e),t.orig.height=t.frame.height-2*(this._style.padding+e),this._onTextureUpdate(),t.baseTexture.emit("update",t.baseTexture),this.dirty=!1},s.prototype.assign=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var o=0,i=e;o<i.length;o++){var s=i[o];for(var r in s)t[r]=s[r]}return t},s.DEFAULT_TAG_STYLE={align:"left",breakWords:!1,dropShadow:!1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"#000000",dropShadowDistance:5,fill:"black",fillGradientType:PIXI.TEXT_GRADIENT.LINEAR_VERTICAL,fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",valign:"baseline",wordWrap:!1,wordWrapWidth:100,tagStyle:"xml"},s.debugOptions={spans:{enabled:!1,baseline:"#44BB44",top:"#BB4444",bottom:"#4444BB",bounding:"rgba(255, 255, 255, 0.1)",text:!0},objects:{enabled:!1,bounding:"rgba(255, 255, 255, 0.05)",text:!0}},s}(PIXI.Text)}); | ||
//# sourceMappingURL=pixi-multistyle-text.umd.js.map |
{ | ||
"name": "pixi-multistyle-text", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Multi-Style Text for pixi.js", | ||
@@ -5,0 +5,0 @@ "source": "src/pixi-multistyle-text.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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.
Found 1 instance in 1 package
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.
Found 1 instance in 1 package
189351
212