pixi.js 7.1.2 → 7.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pixi.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.1.2
3
- * Compiled Tue, 31 Jan 2023 14:52:16 UTC
2
+ * pixi.js - v7.2.0-beta.2
3
+ * Compiled Wed, 22 Feb 2023 16:50:25 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -219,19 +219,6 @@ const BrowserAdapter = {
219
219
  const settings = {
220
220
  ADAPTER: BrowserAdapter,
221
221
  RESOLUTION: 1,
222
- RENDER_OPTIONS: {
223
- view: null,
224
- width: 800,
225
- height: 600,
226
- autoDensity: false,
227
- backgroundColor: 0,
228
- backgroundAlpha: 1,
229
- clearBeforeRender: true,
230
- antialias: false,
231
- premultipliedAlpha: true,
232
- preserveDrawingBuffer: false,
233
- hello: false
234
- },
235
222
  CREATE_IMAGE_BITMAP: false,
236
223
  ROUND_PIXELS: false
237
224
  };
@@ -3329,331 +3316,215 @@ function isWebGLSupported() {
3329
3316
  return supported;
3330
3317
  }
3331
3318
 
3332
- var aliceblue = "#f0f8ff";
3333
- var antiquewhite = "#faebd7";
3334
- var aqua = "#00ffff";
3335
- var aquamarine = "#7fffd4";
3336
- var azure = "#f0ffff";
3337
- var beige = "#f5f5dc";
3338
- var bisque = "#ffe4c4";
3339
- var black = "#000000";
3340
- var blanchedalmond = "#ffebcd";
3341
- var blue = "#0000ff";
3342
- var blueviolet = "#8a2be2";
3343
- var brown = "#a52a2a";
3344
- var burlywood = "#deb887";
3345
- var cadetblue = "#5f9ea0";
3346
- var chartreuse = "#7fff00";
3347
- var chocolate = "#d2691e";
3348
- var coral = "#ff7f50";
3349
- var cornflowerblue = "#6495ed";
3350
- var cornsilk = "#fff8dc";
3351
- var crimson = "#dc143c";
3352
- var cyan = "#00ffff";
3353
- var darkblue = "#00008b";
3354
- var darkcyan = "#008b8b";
3355
- var darkgoldenrod = "#b8860b";
3356
- var darkgray = "#a9a9a9";
3357
- var darkgreen = "#006400";
3358
- var darkgrey = "#a9a9a9";
3359
- var darkkhaki = "#bdb76b";
3360
- var darkmagenta = "#8b008b";
3361
- var darkolivegreen = "#556b2f";
3362
- var darkorange = "#ff8c00";
3363
- var darkorchid = "#9932cc";
3364
- var darkred = "#8b0000";
3365
- var darksalmon = "#e9967a";
3366
- var darkseagreen = "#8fbc8f";
3367
- var darkslateblue = "#483d8b";
3368
- var darkslategray = "#2f4f4f";
3369
- var darkslategrey = "#2f4f4f";
3370
- var darkturquoise = "#00ced1";
3371
- var darkviolet = "#9400d3";
3372
- var deeppink = "#ff1493";
3373
- var deepskyblue = "#00bfff";
3374
- var dimgray = "#696969";
3375
- var dimgrey = "#696969";
3376
- var dodgerblue = "#1e90ff";
3377
- var firebrick = "#b22222";
3378
- var floralwhite = "#fffaf0";
3379
- var forestgreen = "#228b22";
3380
- var fuchsia = "#ff00ff";
3381
- var gainsboro = "#dcdcdc";
3382
- var ghostwhite = "#f8f8ff";
3383
- var goldenrod = "#daa520";
3384
- var gold = "#ffd700";
3385
- var gray = "#808080";
3386
- var green = "#008000";
3387
- var greenyellow = "#adff2f";
3388
- var grey = "#808080";
3389
- var honeydew = "#f0fff0";
3390
- var hotpink = "#ff69b4";
3391
- var indianred = "#cd5c5c";
3392
- var indigo = "#4b0082";
3393
- var ivory = "#fffff0";
3394
- var khaki = "#f0e68c";
3395
- var lavenderblush = "#fff0f5";
3396
- var lavender = "#e6e6fa";
3397
- var lawngreen = "#7cfc00";
3398
- var lemonchiffon = "#fffacd";
3399
- var lightblue = "#add8e6";
3400
- var lightcoral = "#f08080";
3401
- var lightcyan = "#e0ffff";
3402
- var lightgoldenrodyellow = "#fafad2";
3403
- var lightgray = "#d3d3d3";
3404
- var lightgreen = "#90ee90";
3405
- var lightgrey = "#d3d3d3";
3406
- var lightpink = "#ffb6c1";
3407
- var lightsalmon = "#ffa07a";
3408
- var lightseagreen = "#20b2aa";
3409
- var lightskyblue = "#87cefa";
3410
- var lightslategray = "#778899";
3411
- var lightslategrey = "#778899";
3412
- var lightsteelblue = "#b0c4de";
3413
- var lightyellow = "#ffffe0";
3414
- var lime = "#00ff00";
3415
- var limegreen = "#32cd32";
3416
- var linen = "#faf0e6";
3417
- var magenta = "#ff00ff";
3418
- var maroon = "#800000";
3419
- var mediumaquamarine = "#66cdaa";
3420
- var mediumblue = "#0000cd";
3421
- var mediumorchid = "#ba55d3";
3422
- var mediumpurple = "#9370db";
3423
- var mediumseagreen = "#3cb371";
3424
- var mediumslateblue = "#7b68ee";
3425
- var mediumspringgreen = "#00fa9a";
3426
- var mediumturquoise = "#48d1cc";
3427
- var mediumvioletred = "#c71585";
3428
- var midnightblue = "#191970";
3429
- var mintcream = "#f5fffa";
3430
- var mistyrose = "#ffe4e1";
3431
- var moccasin = "#ffe4b5";
3432
- var navajowhite = "#ffdead";
3433
- var navy = "#000080";
3434
- var oldlace = "#fdf5e6";
3435
- var olive = "#808000";
3436
- var olivedrab = "#6b8e23";
3437
- var orange = "#ffa500";
3438
- var orangered = "#ff4500";
3439
- var orchid = "#da70d6";
3440
- var palegoldenrod = "#eee8aa";
3441
- var palegreen = "#98fb98";
3442
- var paleturquoise = "#afeeee";
3443
- var palevioletred = "#db7093";
3444
- var papayawhip = "#ffefd5";
3445
- var peachpuff = "#ffdab9";
3446
- var peru = "#cd853f";
3447
- var pink = "#ffc0cb";
3448
- var plum = "#dda0dd";
3449
- var powderblue = "#b0e0e6";
3450
- var purple = "#800080";
3451
- var rebeccapurple = "#663399";
3452
- var red = "#ff0000";
3453
- var rosybrown = "#bc8f8f";
3454
- var royalblue = "#4169e1";
3455
- var saddlebrown = "#8b4513";
3456
- var salmon = "#fa8072";
3457
- var sandybrown = "#f4a460";
3458
- var seagreen = "#2e8b57";
3459
- var seashell = "#fff5ee";
3460
- var sienna = "#a0522d";
3461
- var silver = "#c0c0c0";
3462
- var skyblue = "#87ceeb";
3463
- var slateblue = "#6a5acd";
3464
- var slategray = "#708090";
3465
- var slategrey = "#708090";
3466
- var snow = "#fffafa";
3467
- var springgreen = "#00ff7f";
3468
- var steelblue = "#4682b4";
3469
- var tan = "#d2b48c";
3470
- var teal = "#008080";
3471
- var thistle = "#d8bfd8";
3472
- var tomato = "#ff6347";
3473
- var turquoise = "#40e0d0";
3474
- var violet = "#ee82ee";
3475
- var wheat = "#f5deb3";
3476
- var white = "#ffffff";
3477
- var whitesmoke = "#f5f5f5";
3478
- var yellow = "#ffff00";
3479
- var yellowgreen = "#9acd32";
3480
- var cssColorNames = {
3481
- aliceblue: aliceblue,
3482
- antiquewhite: antiquewhite,
3483
- aqua: aqua,
3484
- aquamarine: aquamarine,
3485
- azure: azure,
3486
- beige: beige,
3487
- bisque: bisque,
3488
- black: black,
3489
- blanchedalmond: blanchedalmond,
3490
- blue: blue,
3491
- blueviolet: blueviolet,
3492
- brown: brown,
3493
- burlywood: burlywood,
3494
- cadetblue: cadetblue,
3495
- chartreuse: chartreuse,
3496
- chocolate: chocolate,
3497
- coral: coral,
3498
- cornflowerblue: cornflowerblue,
3499
- cornsilk: cornsilk,
3500
- crimson: crimson,
3501
- cyan: cyan,
3502
- darkblue: darkblue,
3503
- darkcyan: darkcyan,
3504
- darkgoldenrod: darkgoldenrod,
3505
- darkgray: darkgray,
3506
- darkgreen: darkgreen,
3507
- darkgrey: darkgrey,
3508
- darkkhaki: darkkhaki,
3509
- darkmagenta: darkmagenta,
3510
- darkolivegreen: darkolivegreen,
3511
- darkorange: darkorange,
3512
- darkorchid: darkorchid,
3513
- darkred: darkred,
3514
- darksalmon: darksalmon,
3515
- darkseagreen: darkseagreen,
3516
- darkslateblue: darkslateblue,
3517
- darkslategray: darkslategray,
3518
- darkslategrey: darkslategrey,
3519
- darkturquoise: darkturquoise,
3520
- darkviolet: darkviolet,
3521
- deeppink: deeppink,
3522
- deepskyblue: deepskyblue,
3523
- dimgray: dimgray,
3524
- dimgrey: dimgrey,
3525
- dodgerblue: dodgerblue,
3526
- firebrick: firebrick,
3527
- floralwhite: floralwhite,
3528
- forestgreen: forestgreen,
3529
- fuchsia: fuchsia,
3530
- gainsboro: gainsboro,
3531
- ghostwhite: ghostwhite,
3532
- goldenrod: goldenrod,
3533
- gold: gold,
3534
- gray: gray,
3535
- green: green,
3536
- greenyellow: greenyellow,
3537
- grey: grey,
3538
- honeydew: honeydew,
3539
- hotpink: hotpink,
3540
- indianred: indianred,
3541
- indigo: indigo,
3542
- ivory: ivory,
3543
- khaki: khaki,
3544
- lavenderblush: lavenderblush,
3545
- lavender: lavender,
3546
- lawngreen: lawngreen,
3547
- lemonchiffon: lemonchiffon,
3548
- lightblue: lightblue,
3549
- lightcoral: lightcoral,
3550
- lightcyan: lightcyan,
3551
- lightgoldenrodyellow: lightgoldenrodyellow,
3552
- lightgray: lightgray,
3553
- lightgreen: lightgreen,
3554
- lightgrey: lightgrey,
3555
- lightpink: lightpink,
3556
- lightsalmon: lightsalmon,
3557
- lightseagreen: lightseagreen,
3558
- lightskyblue: lightskyblue,
3559
- lightslategray: lightslategray,
3560
- lightslategrey: lightslategrey,
3561
- lightsteelblue: lightsteelblue,
3562
- lightyellow: lightyellow,
3563
- lime: lime,
3564
- limegreen: limegreen,
3565
- linen: linen,
3566
- magenta: magenta,
3567
- maroon: maroon,
3568
- mediumaquamarine: mediumaquamarine,
3569
- mediumblue: mediumblue,
3570
- mediumorchid: mediumorchid,
3571
- mediumpurple: mediumpurple,
3572
- mediumseagreen: mediumseagreen,
3573
- mediumslateblue: mediumslateblue,
3574
- mediumspringgreen: mediumspringgreen,
3575
- mediumturquoise: mediumturquoise,
3576
- mediumvioletred: mediumvioletred,
3577
- midnightblue: midnightblue,
3578
- mintcream: mintcream,
3579
- mistyrose: mistyrose,
3580
- moccasin: moccasin,
3581
- navajowhite: navajowhite,
3582
- navy: navy,
3583
- oldlace: oldlace,
3584
- olive: olive,
3585
- olivedrab: olivedrab,
3586
- orange: orange,
3587
- orangered: orangered,
3588
- orchid: orchid,
3589
- palegoldenrod: palegoldenrod,
3590
- palegreen: palegreen,
3591
- paleturquoise: paleturquoise,
3592
- palevioletred: palevioletred,
3593
- papayawhip: papayawhip,
3594
- peachpuff: peachpuff,
3595
- peru: peru,
3596
- pink: pink,
3597
- plum: plum,
3598
- powderblue: powderblue,
3599
- purple: purple,
3600
- rebeccapurple: rebeccapurple,
3601
- red: red,
3602
- rosybrown: rosybrown,
3603
- royalblue: royalblue,
3604
- saddlebrown: saddlebrown,
3605
- salmon: salmon,
3606
- sandybrown: sandybrown,
3607
- seagreen: seagreen,
3608
- seashell: seashell,
3609
- sienna: sienna,
3610
- silver: silver,
3611
- skyblue: skyblue,
3612
- slateblue: slateblue,
3613
- slategray: slategray,
3614
- slategrey: slategrey,
3615
- snow: snow,
3616
- springgreen: springgreen,
3617
- steelblue: steelblue,
3618
- tan: tan,
3619
- teal: teal,
3620
- thistle: thistle,
3621
- tomato: tomato,
3622
- turquoise: turquoise,
3623
- violet: violet,
3624
- wheat: wheat,
3625
- white: white,
3626
- whitesmoke: whitesmoke,
3627
- yellow: yellow,
3628
- yellowgreen: yellowgreen
3319
+ var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return "string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return (r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return {r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return {r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return {h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return {r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return {h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return {h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e;},c=function(r){return {h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u;},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return {h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return [e,t[n][1]]}return [null,void 0]},x=function(r){return "string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return {h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return (299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return {h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i;},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u;},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u;},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r;},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r;},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return "number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t;},r.prototype.hue=function(r){var t=c(this.rgba);return "number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r));});},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
3320
+
3321
+ function namesPlugin(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return "transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g);}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"]);}
3322
+
3323
+ k([namesPlugin]);
3324
+ const _Color = class {
3325
+ constructor(value = 16777215) {
3326
+ this._value = null;
3327
+ this._components = new Float32Array(4);
3328
+ this._components.fill(1);
3329
+ this._int = 16777215;
3330
+ this.value = value;
3331
+ }
3332
+ get red() {
3333
+ return this._components[0];
3334
+ }
3335
+ get green() {
3336
+ return this._components[1];
3337
+ }
3338
+ get blue() {
3339
+ return this._components[2];
3340
+ }
3341
+ get alpha() {
3342
+ return this._components[3];
3343
+ }
3344
+ setValue(value) {
3345
+ this.value = value;
3346
+ return this;
3347
+ }
3348
+ set value(value) {
3349
+ if (value instanceof _Color) {
3350
+ this._value = value._value;
3351
+ this._int = value._int;
3352
+ this._components.set(value._components);
3353
+ } else if (value === null) {
3354
+ throw new Error("Cannot set PIXI.Color#value to null");
3355
+ } else if (this._value !== value) {
3356
+ this.normalize(value);
3357
+ this._value = value;
3358
+ }
3359
+ }
3360
+ get value() {
3361
+ return this._value;
3362
+ }
3363
+ toRgba() {
3364
+ const [r, g, b, a] = this._components;
3365
+ return { r, g, b, a };
3366
+ }
3367
+ toRgb() {
3368
+ const [r, g, b] = this._components;
3369
+ return { r, g, b };
3370
+ }
3371
+ toRgbaString() {
3372
+ const [r, g, b] = this.toUint8RgbArray();
3373
+ return `rgba(${r},${g},${b},${this.alpha})`;
3374
+ }
3375
+ toUint8RgbArray(out) {
3376
+ const [r, g, b] = this._components;
3377
+ out = out ?? [];
3378
+ out[0] = Math.round(r * 255);
3379
+ out[1] = Math.round(g * 255);
3380
+ out[2] = Math.round(b * 255);
3381
+ return out;
3382
+ }
3383
+ toRgbArray(out) {
3384
+ out = out ?? [];
3385
+ const [r, g, b] = this._components;
3386
+ out[0] = r;
3387
+ out[1] = g;
3388
+ out[2] = b;
3389
+ return out;
3390
+ }
3391
+ toNumber() {
3392
+ return this._int;
3393
+ }
3394
+ toLittleEndianNumber() {
3395
+ const value = this._int;
3396
+ return (value >> 16) + (value & 65280) + ((value & 255) << 16);
3397
+ }
3398
+ multiply(value) {
3399
+ const [r, g, b, a] = _Color.temp.setValue(value)._components;
3400
+ this._components[0] *= r;
3401
+ this._components[1] *= g;
3402
+ this._components[2] *= b;
3403
+ this._components[3] *= a;
3404
+ this.refreshInt();
3405
+ this._value = null;
3406
+ return this;
3407
+ }
3408
+ premultiply(alpha, applyToRGB = true) {
3409
+ if (applyToRGB) {
3410
+ this._components[0] *= alpha;
3411
+ this._components[1] *= alpha;
3412
+ this._components[2] *= alpha;
3413
+ }
3414
+ this._components[3] = alpha;
3415
+ this.refreshInt();
3416
+ this._value = null;
3417
+ return this;
3418
+ }
3419
+ toPremultiplied(alpha) {
3420
+ if (alpha === 1) {
3421
+ return (alpha * 255 << 24) + this._int;
3422
+ }
3423
+ if (alpha === 0) {
3424
+ return 0;
3425
+ }
3426
+ let r = this._int >> 16 & 255;
3427
+ let g = this._int >> 8 & 255;
3428
+ let b = this._int & 255;
3429
+ r = r * alpha + 0.5 | 0;
3430
+ g = g * alpha + 0.5 | 0;
3431
+ b = b * alpha + 0.5 | 0;
3432
+ return (alpha * 255 << 24) + (r << 16) + (g << 8) + b;
3433
+ }
3434
+ toHex() {
3435
+ const hexString = this._int.toString(16);
3436
+ return `#${"000000".substring(0, 6 - hexString.length) + hexString}`;
3437
+ }
3438
+ toHexa() {
3439
+ const alphaValue = Math.round(this._components[3] * 255);
3440
+ const alphaString = alphaValue.toString(16);
3441
+ return this.toHex() + "00".substring(0, 2 - alphaString.length) + alphaString;
3442
+ }
3443
+ setAlpha(alpha) {
3444
+ this._components[3] = alpha;
3445
+ return this;
3446
+ }
3447
+ round(step) {
3448
+ const [r, g, b] = this._components;
3449
+ this._components.set([
3450
+ Math.min(255, r / step * step),
3451
+ Math.min(255, g / step * step),
3452
+ Math.min(255, b / step * step)
3453
+ ]);
3454
+ this.refreshInt();
3455
+ this._value = null;
3456
+ return this;
3457
+ }
3458
+ toArray(out) {
3459
+ out = out ?? [];
3460
+ const [r, g, b, a] = this._components;
3461
+ out[0] = r;
3462
+ out[1] = g;
3463
+ out[2] = b;
3464
+ out[3] = a;
3465
+ return out;
3466
+ }
3467
+ normalize(value) {
3468
+ let components;
3469
+ if ((typeof value === "number" || value instanceof Number) && value >= 0 && value <= 16777215) {
3470
+ const int = value;
3471
+ components = [
3472
+ (int >> 16 & 255) / 255,
3473
+ (int >> 8 & 255) / 255,
3474
+ (int & 255) / 255,
3475
+ 1
3476
+ ];
3477
+ } else if ((Array.isArray(value) || value instanceof Float32Array) && value.length >= 3 && value.length <= 4 && value.every((v) => v <= 1 && v >= 0)) {
3478
+ const [r, g, b, a = 1] = value;
3479
+ components = [r, g, b, a];
3480
+ } else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray) && value.length >= 3 && value.length <= 4) {
3481
+ const [r, g, b, a = 255] = value;
3482
+ components = [r / 255, g / 255, b / 255, a / 255];
3483
+ } else if (typeof value === "string" || typeof value === "object") {
3484
+ if (typeof value === "string") {
3485
+ const match = _Color.HEX_PATTERN.exec(value);
3486
+ if (match) {
3487
+ value = `#${match[2]}`;
3488
+ }
3489
+ }
3490
+ const color = w(value);
3491
+ if (color.isValid()) {
3492
+ const { r, g, b, a } = color.rgba;
3493
+ components = [r / 255, g / 255, b / 255, a];
3494
+ }
3495
+ }
3496
+ if (components) {
3497
+ this._components.set(components);
3498
+ this.refreshInt();
3499
+ } else {
3500
+ throw new Error(`Unable to convert color ${value}`);
3501
+ }
3502
+ }
3503
+ refreshInt() {
3504
+ const [r, g, b] = this._components;
3505
+ this._int = (r * 255 << 16) + (g * 255 << 8) + (b * 255 | 0);
3506
+ }
3629
3507
  };
3508
+ let Color = _Color;
3509
+ Color.shared = new _Color();
3510
+ Color.temp = new _Color();
3511
+ Color.HEX_PATTERN = /^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;
3630
3512
 
3631
3513
  function hex2rgb(hex, out = []) {
3632
- out[0] = (hex >> 16 & 255) / 255;
3633
- out[1] = (hex >> 8 & 255) / 255;
3634
- out[2] = (hex & 255) / 255;
3635
- return out;
3514
+ deprecation("7.2.0", "utils.hex2rgb is deprecated, use Color#toRgbArray instead");
3515
+ return Color.shared.setValue(hex).toRgbArray(out);
3636
3516
  }
3637
3517
  function hex2string(hex) {
3638
- let hexString = hex.toString(16);
3639
- hexString = "000000".substring(0, 6 - hexString.length) + hexString;
3640
- return `#${hexString}`;
3518
+ deprecation("7.2.0", "utils.hex2string is deprecated, use Color#toHex instead");
3519
+ return Color.shared.setValue(hex).toHex();
3641
3520
  }
3642
3521
  function string2hex(string) {
3643
- if (typeof string === "string") {
3644
- string = cssColorNames[string.toLowerCase()] || string;
3645
- if (string[0] === "#") {
3646
- string = string.slice(1);
3647
- }
3648
- if (string.length === 3) {
3649
- const [r, g, b] = string;
3650
- string = r + r + g + g + b + b;
3651
- }
3652
- }
3653
- return parseInt(string, 16);
3522
+ deprecation("7.2.0", "utils.string2hex is deprecated, use Color#toNumber instead");
3523
+ return Color.shared.setValue(string).toNumber();
3654
3524
  }
3655
3525
  function rgb2hex(rgb) {
3656
- return (rgb[0] * 255 << 16) + (rgb[1] * 255 << 8) + (rgb[2] * 255 | 0);
3526
+ deprecation("7.2.0", "utils.rgb2hex is deprecated, use Color#toNumber instead");
3527
+ return Color.shared.setValue(rgb).toNumber();
3657
3528
  }
3658
3529
 
3659
3530
  function mapPremultipliedBlendModes() {
@@ -3678,47 +3549,17 @@ const premultiplyBlendMode = mapPremultipliedBlendModes();
3678
3549
  function correctBlendMode(blendMode, premultiplied) {
3679
3550
  return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];
3680
3551
  }
3681
- function premultiplyRgba(rgb, alpha, out, premultiply) {
3682
- out = out || new Float32Array(4);
3683
- if (premultiply || premultiply === void 0) {
3684
- out[0] = rgb[0] * alpha;
3685
- out[1] = rgb[1] * alpha;
3686
- out[2] = rgb[2] * alpha;
3687
- } else {
3688
- out[0] = rgb[0];
3689
- out[1] = rgb[1];
3690
- out[2] = rgb[2];
3691
- }
3692
- out[3] = alpha;
3693
- return out;
3552
+ function premultiplyRgba(rgb, alpha, out, premultiply = true) {
3553
+ deprecation("7.2.0", `utils.premultiplyRgba has moved to Color.premultiply`);
3554
+ return Color.shared.setValue(rgb).premultiply(alpha, premultiply).toArray(out ?? new Float32Array(4));
3694
3555
  }
3695
3556
  function premultiplyTint(tint, alpha) {
3696
- if (alpha === 1) {
3697
- return (alpha * 255 << 24) + tint;
3698
- }
3699
- if (alpha === 0) {
3700
- return 0;
3701
- }
3702
- let R = tint >> 16 & 255;
3703
- let G = tint >> 8 & 255;
3704
- let B = tint & 255;
3705
- R = R * alpha + 0.5 | 0;
3706
- G = G * alpha + 0.5 | 0;
3707
- B = B * alpha + 0.5 | 0;
3708
- return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;
3709
- }
3710
- function premultiplyTintToRgba(tint, alpha, out, premultiply) {
3711
- out = out || new Float32Array(4);
3712
- out[0] = (tint >> 16 & 255) / 255;
3713
- out[1] = (tint >> 8 & 255) / 255;
3714
- out[2] = (tint & 255) / 255;
3715
- if (premultiply || premultiply === void 0) {
3716
- out[0] *= alpha;
3717
- out[1] *= alpha;
3718
- out[2] *= alpha;
3719
- }
3720
- out[3] = alpha;
3721
- return out;
3557
+ deprecation("7.2.0", `utils.premultiplyTint has moved to Color.toPremultiplied`);
3558
+ return Color.shared.setValue(tint).toPremultiplied(alpha);
3559
+ }
3560
+ function premultiplyTintToRgba(tint, alpha, out, premultiply = true) {
3561
+ deprecation("7.2.0", `utils.premultiplyTintToRgba has moved to Color.premultiply`);
3562
+ return Color.shared.setValue(tint).premultiply(alpha, premultiply).toArray(out ?? new Float32Array(4));
3722
3563
  }
3723
3564
 
3724
3565
  const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;
@@ -6105,6 +5946,51 @@ const uniformParsers = [
6105
5946
  data[offset+3] = v.height;
6106
5947
  `
6107
5948
  },
5949
+ {
5950
+ test: (data, uniform) => data.type === "vec4" && data.size === 1 && !data.isArray && uniform.red !== void 0,
5951
+ code: (name) => `
5952
+ cv = ud["${name}"].value;
5953
+ v = uv["${name}"];
5954
+
5955
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
5956
+ {
5957
+ cv[0] = v.red;
5958
+ cv[1] = v.green;
5959
+ cv[2] = v.blue;
5960
+ cv[3] = v.alpha;
5961
+ gl.uniform4f(ud["${name}"].location, v.red, v.green, v.blue, v.alpha)
5962
+ }`,
5963
+ codeUbo: (name) => `
5964
+ v = uv.${name};
5965
+
5966
+ data[offset] = v.red;
5967
+ data[offset+1] = v.green;
5968
+ data[offset+2] = v.blue;
5969
+ data[offset+3] = v.alpha;
5970
+ `
5971
+ },
5972
+ {
5973
+ test: (data, uniform) => data.type === "vec3" && data.size === 1 && !data.isArray && uniform.red !== void 0,
5974
+ code: (name) => `
5975
+ cv = ud["${name}"].value;
5976
+ v = uv["${name}"];
5977
+
5978
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
5979
+ {
5980
+ cv[0] = v.red;
5981
+ cv[1] = v.green;
5982
+ cv[2] = v.blue;
5983
+
5984
+ gl.uniform3f(ud["${name}"].location, v.red, v.green, v.blue)
5985
+ }`,
5986
+ codeUbo: (name) => `
5987
+ v = uv.${name};
5988
+
5989
+ data[offset] = v.red;
5990
+ data[offset+1] = v.green;
5991
+ data[offset+2] = v.blue;
5992
+ `
5993
+ },
6108
5994
  {
6109
5995
  test: (data) => data.type === "vec4" && data.size === 1 && !data.isArray,
6110
5996
  code: (name) => `
@@ -7095,7 +6981,7 @@ const _BatchRenderer = class extends ObjectRenderer {
7095
6981
  const vertexData = element.vertexData;
7096
6982
  const textureId = element._texture.baseTexture._batchLocation;
7097
6983
  const alpha = Math.min(element.worldAlpha, 1);
7098
- const argb = alpha < 1 && element._texture.baseTexture.alphaMode ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24);
6984
+ const argb = Color.shared.setValue(element._tintRGB).toPremultiplied(alpha);
7099
6985
  for (let i = 0; i < vertexData.length; i += 2) {
7100
6986
  float32View[aIndex++] = vertexData[i];
7101
6987
  float32View[aIndex++] = vertexData[i + 1];
@@ -7163,42 +7049,41 @@ Filter.defaultMultisample = MSAA_QUALITY.NONE;
7163
7049
  class BackgroundSystem {
7164
7050
  constructor() {
7165
7051
  this.clearBeforeRender = true;
7166
- this._backgroundColor = 0;
7167
- this._backgroundColorRgba = [0, 0, 0, 1];
7168
- this._backgroundColorString = "#000000";
7169
- this.color = this._backgroundColor;
7052
+ this._backgroundColor = new Color(0);
7170
7053
  this.alpha = 1;
7171
7054
  }
7172
7055
  init(options) {
7173
7056
  this.clearBeforeRender = options.clearBeforeRender;
7174
- if (options.color) {
7175
- this.color = typeof options.color === "string" ? string2hex(options.color) : options.color;
7057
+ const { backgroundColor, background, backgroundAlpha } = options;
7058
+ const color = background ?? backgroundColor;
7059
+ if (color !== void 0) {
7060
+ this.color = color;
7176
7061
  }
7177
- this.alpha = options.alpha;
7062
+ this.alpha = backgroundAlpha;
7178
7063
  }
7179
7064
  get color() {
7180
- return this._backgroundColor;
7065
+ return this._backgroundColor.value;
7181
7066
  }
7182
7067
  set color(value) {
7183
- this._backgroundColor = value;
7184
- this._backgroundColorString = hex2string(value);
7185
- hex2rgb(value, this._backgroundColorRgba);
7068
+ this._backgroundColor.setValue(value);
7186
7069
  }
7187
7070
  get alpha() {
7188
- return this._backgroundColorRgba[3];
7071
+ return this._backgroundColor.alpha;
7189
7072
  }
7190
7073
  set alpha(value) {
7191
- this._backgroundColorRgba[3] = value;
7074
+ this._backgroundColor.setAlpha(value);
7192
7075
  }
7193
- get colorRgba() {
7194
- return this._backgroundColorRgba;
7195
- }
7196
- get colorString() {
7197
- return this._backgroundColorString;
7076
+ get backgroundColor() {
7077
+ return this._backgroundColor;
7198
7078
  }
7199
7079
  destroy() {
7200
7080
  }
7201
7081
  }
7082
+ BackgroundSystem.defaultOptions = {
7083
+ backgroundAlpha: 1,
7084
+ backgroundColor: 0,
7085
+ clearBeforeRender: true
7086
+ };
7202
7087
  BackgroundSystem.extension = {
7203
7088
  type: [
7204
7089
  ExtensionType.RendererSystem,
@@ -7418,6 +7303,13 @@ class ContextSystem {
7418
7303
  }
7419
7304
  }
7420
7305
  }
7306
+ ContextSystem.defaultOptions = {
7307
+ context: null,
7308
+ antialias: false,
7309
+ premultipliedAlpha: true,
7310
+ preserveDrawingBuffer: false,
7311
+ powerPreference: "default"
7312
+ };
7421
7313
  ContextSystem.extension = {
7422
7314
  type: ExtensionType.RendererSystem,
7423
7315
  name: "context"
@@ -7544,12 +7436,21 @@ class BaseRenderTexture extends BaseTexture {
7544
7436
  super(null, options);
7545
7437
  this.mipmap = MIPMAP_MODES.OFF;
7546
7438
  this.valid = true;
7547
- this.clearColor = [0, 0, 0, 0];
7439
+ this._clear = new Color([0, 0, 0, 0]);
7548
7440
  this.framebuffer = new Framebuffer(this.realWidth, this.realHeight).addColorTexture(0, this);
7549
7441
  this.framebuffer.multisample = options.multisample;
7550
7442
  this.maskStack = [];
7551
7443
  this.filterStack = [{}];
7552
7444
  }
7445
+ set clearColor(value) {
7446
+ this._clear.setValue(value);
7447
+ }
7448
+ get clearColor() {
7449
+ return this._clear.value;
7450
+ }
7451
+ get clear() {
7452
+ return this._clear;
7453
+ }
7553
7454
  resize(desiredWidth, desiredHeight) {
7554
7455
  this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);
7555
7456
  this.setRealSize(this.framebuffer.width, this.framebuffer.height);
@@ -7823,7 +7724,7 @@ function removeAllHandlers(tex) {
7823
7724
  };
7824
7725
  }
7825
7726
  class Texture extends eventemitter3 {
7826
- constructor(baseTexture, frame, orig, trim, rotate, anchor) {
7727
+ constructor(baseTexture, frame, orig, trim, rotate, anchor, borders) {
7827
7728
  super();
7828
7729
  this.noFrame = false;
7829
7730
  if (!frame) {
@@ -7847,6 +7748,7 @@ class Texture extends eventemitter3 {
7847
7748
  throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");
7848
7749
  }
7849
7750
  this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);
7751
+ this.defaultBorders = borders;
7850
7752
  this._updateID = 0;
7851
7753
  this.textureCacheIds = [];
7852
7754
  if (!baseTexture.valid) {
@@ -7905,7 +7807,7 @@ class Texture extends eventemitter3 {
7905
7807
  clone() {
7906
7808
  const clonedFrame = this._frame.clone();
7907
7809
  const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();
7908
- const clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim?.clone(), this.rotate, this.defaultAnchor);
7810
+ const clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim?.clone(), this.rotate, this.defaultAnchor, this.defaultBorders);
7909
7811
  if (this.noFrame) {
7910
7812
  clonedTexture._frame = clonedFrame;
7911
7813
  }
@@ -9807,7 +9709,8 @@ class PluginSystem {
9807
9709
  }
9808
9710
  });
9809
9711
  }
9810
- init(staticMap) {
9712
+ init() {
9713
+ const staticMap = this.rendererPlugins;
9811
9714
  for (const o in staticMap) {
9812
9715
  this.plugins[o] = new staticMap[o](this.renderer);
9813
9716
  }
@@ -9981,11 +9884,8 @@ class RenderTextureSystem {
9981
9884
  this.destinationFrame.copyFrom(destinationFrame);
9982
9885
  }
9983
9886
  clear(clearColor, mask) {
9984
- if (this.current) {
9985
- clearColor = clearColor || this.current.baseTexture.clearColor;
9986
- } else {
9987
- clearColor = clearColor || this.renderer.background.colorRgba;
9988
- }
9887
+ const fallbackColor = this.current ? this.current.baseTexture.clear : this.renderer.background.backgroundColor;
9888
+ const color = clearColor ? Color.shared.setValue(clearColor) : fallbackColor;
9989
9889
  const destinationFrame = this.destinationFrame;
9990
9890
  const baseFrame = this.current ? this.current.baseTexture : this.renderer._view.screen;
9991
9891
  const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;
@@ -9998,7 +9898,7 @@ class RenderTextureSystem {
9998
9898
  this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);
9999
9899
  this.renderer.gl.scissor(x, y, width, height);
10000
9900
  }
10001
- this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);
9901
+ this.renderer.framebuffer.clear(color.red, color.green, color.blue, color.alpha, mask);
10002
9902
  if (clearMask) {
10003
9903
  this.renderer.scissor.pop();
10004
9904
  }
@@ -10451,16 +10351,19 @@ class StartupSystem {
10451
10351
  this.renderer = renderer;
10452
10352
  }
10453
10353
  run(options) {
10454
- const renderer = this.renderer;
10455
- renderer.emitWithCustomOptions(renderer.runners.init, options);
10354
+ const { renderer } = this;
10355
+ renderer.runners.init.emit(renderer.options);
10456
10356
  if (options.hello) {
10457
- console.log(`PixiJS ${"7.1.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
10357
+ console.log(`PixiJS ${"7.2.0-beta.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
10458
10358
  }
10459
- renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
10359
+ renderer.resize(renderer.screen.width, renderer.screen.height);
10460
10360
  }
10461
10361
  destroy() {
10462
10362
  }
10463
10363
  }
10364
+ StartupSystem.defaultOptions = {
10365
+ hello: false
10366
+ };
10464
10367
  StartupSystem.extension = {
10465
10368
  type: [
10466
10369
  ExtensionType.RendererSystem,
@@ -11220,6 +11123,12 @@ class ViewSystem {
11220
11123
  this.screen = null;
11221
11124
  }
11222
11125
  }
11126
+ ViewSystem.defaultOptions = {
11127
+ width: 800,
11128
+ height: 600,
11129
+ resolution: settings.RESOLUTION,
11130
+ autoDensity: false
11131
+ };
11223
11132
  ViewSystem.extension = {
11224
11133
  type: [
11225
11134
  ExtensionType.RendererSystem,
@@ -11231,6 +11140,12 @@ extensions$1.add(ViewSystem);
11231
11140
 
11232
11141
  settings.PREFER_ENV = ENV.WEBGL2;
11233
11142
  settings.STRICT_TEXTURE_CACHE = false;
11143
+ settings.RENDER_OPTIONS = {
11144
+ ...ContextSystem.defaultOptions,
11145
+ ...BackgroundSystem.defaultOptions,
11146
+ ...ViewSystem.defaultOptions,
11147
+ ...StartupSystem.defaultOptions
11148
+ };
11234
11149
  Object.defineProperties(settings, {
11235
11150
  WRAP_MODE: {
11236
11151
  get() {
@@ -11361,6 +11276,7 @@ Object.defineProperties(settings, {
11361
11276
  });
11362
11277
 
11363
11278
  var UPDATE_PRIORITY = /* @__PURE__ */ ((UPDATE_PRIORITY2) => {
11279
+ UPDATE_PRIORITY2[UPDATE_PRIORITY2["INTERACTION"] = 50] = "INTERACTION";
11364
11280
  UPDATE_PRIORITY2[UPDATE_PRIORITY2["HIGH"] = 25] = "HIGH";
11365
11281
  UPDATE_PRIORITY2[UPDATE_PRIORITY2["NORMAL"] = 0] = "NORMAL";
11366
11282
  UPDATE_PRIORITY2[UPDATE_PRIORITY2["LOW"] = -25] = "LOW";
@@ -11937,31 +11853,9 @@ const _Renderer = class extends SystemManager {
11937
11853
  options.premultipliedAlpha = options.useContextAlpha && options.useContextAlpha !== "notMultiplied";
11938
11854
  options.backgroundAlpha = options.useContextAlpha === false ? 1 : options.backgroundAlpha;
11939
11855
  }
11940
- const startupOptions = {
11941
- hello: options.hello,
11942
- _plugin: _Renderer.__plugins,
11943
- background: {
11944
- alpha: options.backgroundAlpha,
11945
- color: options.background ?? options.backgroundColor,
11946
- clearBeforeRender: options.clearBeforeRender
11947
- },
11948
- _view: {
11949
- height: options.height,
11950
- width: options.width,
11951
- autoDensity: options.autoDensity,
11952
- resolution: options.resolution,
11953
- view: options.view
11954
- },
11955
- context: {
11956
- antialias: options.antialias,
11957
- context: options.context,
11958
- powerPreference: options.powerPreference,
11959
- premultipliedAlpha: options.premultipliedAlpha,
11960
- preserveDrawingBuffer: options.preserveDrawingBuffer
11961
- }
11962
- };
11856
+ this._plugin.rendererPlugins = _Renderer.__plugins;
11963
11857
  this.options = options;
11964
- this.startup.run(startupOptions);
11858
+ this.startup.run(this.options);
11965
11859
  }
11966
11860
  static test(options) {
11967
11861
  if (options?.forceCanvas) {
@@ -12049,7 +11943,7 @@ const _Renderer = class extends SystemManager {
12049
11943
  }
12050
11944
  get backgroundAlpha() {
12051
11945
  deprecation("7.0.0", "renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.");
12052
- return this.background.color;
11946
+ return this.background.alpha;
12053
11947
  }
12054
11948
  set backgroundAlpha(value) {
12055
11949
  deprecation("7.0.0", "renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.");
@@ -12645,7 +12539,7 @@ class TransformFeedback {
12645
12539
  }
12646
12540
  }
12647
12541
 
12648
- const VERSION = "7.1.2";
12542
+ const VERSION = "7.2.0-beta.2";
12649
12543
 
12650
12544
  class Bounds {
12651
12545
  constructor() {
@@ -13040,7 +12934,7 @@ class DisplayObject extends eventemitter3 {
13040
12934
  this.filters = null;
13041
12935
  this.filterArea = null;
13042
12936
  this.hitArea = null;
13043
- this.interactive = false;
12937
+ this.eventMode = "auto";
13044
12938
  this.interactiveChildren = false;
13045
12939
  this.emit("destroyed");
13046
12940
  this.removeAllListeners();
@@ -13534,7 +13428,7 @@ class Sprite extends Container {
13534
13428
  this._texture = null;
13535
13429
  this._width = 0;
13536
13430
  this._height = 0;
13537
- this._tint = null;
13431
+ this._tintColor = new Color(16777215);
13538
13432
  this._tintRGB = null;
13539
13433
  this.tint = 16777215;
13540
13434
  this.blendMode = BLEND_MODES.NORMAL;
@@ -13746,11 +13640,14 @@ class Sprite extends Container {
13746
13640
  this._anchor.copyFrom(value);
13747
13641
  }
13748
13642
  get tint() {
13749
- return this._tint;
13643
+ return this._tintColor.value;
13750
13644
  }
13751
13645
  set tint(value) {
13752
- this._tint = value;
13753
- this._tintRGB = (value >> 16) + (value & 65280) + ((value & 255) << 16);
13646
+ this._tintColor.setValue(value);
13647
+ this._tintRGB = this._tintColor.toLittleEndianNumber();
13648
+ }
13649
+ get tintValue() {
13650
+ return this._tintColor.toNumber();
13754
13651
  }
13755
13652
  get texture() {
13756
13653
  return this._texture;
@@ -14389,23 +14286,21 @@ class ColorMatrixFilter extends Filter {
14389
14286
  this._loadMatrix(matrix, multiply);
14390
14287
  }
14391
14288
  tint(color, multiply) {
14392
- const r = color >> 16 & 255;
14393
- const g = color >> 8 & 255;
14394
- const b = color & 255;
14289
+ const [r, g, b] = Color.shared.setValue(color).toArray();
14395
14290
  const matrix = [
14396
- r / 255,
14291
+ r,
14397
14292
  0,
14398
14293
  0,
14399
14294
  0,
14400
14295
  0,
14401
14296
  0,
14402
- g / 255,
14297
+ g,
14403
14298
  0,
14404
14299
  0,
14405
14300
  0,
14406
14301
  0,
14407
14302
  0,
14408
- b / 255,
14303
+ b,
14409
14304
  0,
14410
14305
  0,
14411
14306
  0,
@@ -14768,12 +14663,9 @@ class ColorMatrixFilter extends Filter {
14768
14663
  toned = toned || 0.15;
14769
14664
  lightColor = lightColor || 16770432;
14770
14665
  darkColor = darkColor || 3375104;
14771
- const lR = (lightColor >> 16 & 255) / 255;
14772
- const lG = (lightColor >> 8 & 255) / 255;
14773
- const lB = (lightColor & 255) / 255;
14774
- const dR = (darkColor >> 16 & 255) / 255;
14775
- const dG = (darkColor >> 8 & 255) / 255;
14776
- const dB = (darkColor & 255) / 255;
14666
+ const temp = Color.shared;
14667
+ const [lR, lG, lB] = temp.setValue(lightColor).toArray();
14668
+ const [dR, dG, dB] = temp.setValue(darkColor).toArray();
14777
14669
  const matrix = [
14778
14670
  0.3,
14779
14671
  0.59,
@@ -15011,6 +14903,74 @@ Object.entries(filters).forEach(([key, FilterClass]) => {
15011
14903
  });
15012
14904
  });
15013
14905
 
14906
+ class EventsTickerClass {
14907
+ constructor() {
14908
+ this.interactionFrequency = 10;
14909
+ this._deltaTime = 0;
14910
+ this._didMove = false;
14911
+ this.tickerAdded = false;
14912
+ this._pauseUpdate = true;
14913
+ }
14914
+ init(events) {
14915
+ this.removeTickerListener();
14916
+ this.events = events;
14917
+ this.interactionFrequency = 10;
14918
+ this._deltaTime = 0;
14919
+ this._didMove = false;
14920
+ this.tickerAdded = false;
14921
+ this._pauseUpdate = true;
14922
+ }
14923
+ get pauseUpdate() {
14924
+ return this._pauseUpdate;
14925
+ }
14926
+ set pauseUpdate(paused) {
14927
+ this._pauseUpdate = paused;
14928
+ }
14929
+ addTickerListener() {
14930
+ if (this.tickerAdded || !this.domElement) {
14931
+ return;
14932
+ }
14933
+ Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);
14934
+ this.tickerAdded = true;
14935
+ }
14936
+ removeTickerListener() {
14937
+ if (!this.tickerAdded) {
14938
+ return;
14939
+ }
14940
+ Ticker.system.remove(this.tickerUpdate, this);
14941
+ this.tickerAdded = false;
14942
+ }
14943
+ pointerMoved() {
14944
+ this._didMove = true;
14945
+ }
14946
+ update() {
14947
+ if (!this.domElement || this._pauseUpdate) {
14948
+ return;
14949
+ }
14950
+ if (this._didMove) {
14951
+ this._didMove = false;
14952
+ return;
14953
+ }
14954
+ const rootPointerEvent = this.events["rootPointerEvent"];
14955
+ if (this.events.supportsTouchEvents && rootPointerEvent.pointerType === "touch") {
14956
+ return;
14957
+ }
14958
+ globalThis.document.dispatchEvent(new PointerEvent("pointermove", {
14959
+ clientX: rootPointerEvent.clientX,
14960
+ clientY: rootPointerEvent.clientY
14961
+ }));
14962
+ }
14963
+ tickerUpdate(deltaTime) {
14964
+ this._deltaTime += deltaTime;
14965
+ if (this._deltaTime < this.interactionFrequency) {
14966
+ return;
14967
+ }
14968
+ this._deltaTime = 0;
14969
+ this.update();
14970
+ }
14971
+ }
14972
+ const EventsTicker = new EventsTickerClass();
14973
+
15014
14974
  class FederatedEvent {
15015
14975
  constructor(manager) {
15016
14976
  this.bubbles = true;
@@ -15115,6 +15075,9 @@ class FederatedMouseEvent extends FederatedEvent {
15115
15075
  get screenY() {
15116
15076
  return this.screen.y;
15117
15077
  }
15078
+ getLocalPosition(displayObject, point, globalPos) {
15079
+ return displayObject.worldTransform.applyInverse(globalPos || this.global, point);
15080
+ }
15118
15081
  getModifierState(key) {
15119
15082
  return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(key);
15120
15083
  }
@@ -15144,11 +15107,14 @@ class FederatedPointerEvent extends FederatedMouseEvent {
15144
15107
  class FederatedWheelEvent extends FederatedMouseEvent {
15145
15108
  constructor() {
15146
15109
  super(...arguments);
15147
- this.DOM_DELTA_LINE = 0;
15148
- this.DOM_DELTA_PAGE = 1;
15149
- this.DOM_DELTA_PIXEL = 2;
15110
+ this.DOM_DELTA_PIXEL = 0;
15111
+ this.DOM_DELTA_LINE = 1;
15112
+ this.DOM_DELTA_PAGE = 2;
15150
15113
  }
15151
15114
  }
15115
+ FederatedWheelEvent.DOM_DELTA_PIXEL = 0;
15116
+ FederatedWheelEvent.DOM_DELTA_LINE = 1;
15117
+ FederatedWheelEvent.DOM_DELTA_PAGE = 2;
15152
15118
 
15153
15119
  const PROPAGATION_LIMIT = 2048;
15154
15120
  const tempHitLocation = new Point();
@@ -15211,7 +15177,8 @@ class EventBoundary {
15211
15177
  }
15212
15178
  }
15213
15179
  hitTest(x, y) {
15214
- const invertedPath = this.hitTestRecursive(this.rootTarget, this.rootTarget.interactive, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
15180
+ EventsTicker.pauseUpdate = true;
15181
+ const invertedPath = this.hitTestRecursive(this.rootTarget, this.rootTarget.eventMode, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
15215
15182
  return invertedPath && invertedPath[0];
15216
15183
  }
15217
15184
  propagate(e, type) {
@@ -15242,9 +15209,15 @@ class EventBoundary {
15242
15209
  all(e, type, target = this.rootTarget) {
15243
15210
  e.eventPhase = e.BUBBLING_PHASE;
15244
15211
  const children = target.children;
15245
- if (children) {
15246
- for (let i = 0; i < children.length; i++) {
15247
- this.all(e, type, children[i]);
15212
+ const interactionNone = target.eventMode === "none";
15213
+ const interactionPassive = target.eventMode === "passive" && !target.interactiveChildren;
15214
+ const interactiveChildren = target.interactiveChildren;
15215
+ const shouldIterateChildren = !interactionNone && interactiveChildren && !interactionPassive;
15216
+ if (children && children.length > 0) {
15217
+ if (shouldIterateChildren) {
15218
+ for (let i = 0; i < children.length; i++) {
15219
+ this.all(e, type, children[i]);
15220
+ }
15248
15221
  }
15249
15222
  }
15250
15223
  e.currentTarget = target;
@@ -15262,35 +15235,50 @@ class EventBoundary {
15262
15235
  propagationPath.reverse();
15263
15236
  return propagationPath;
15264
15237
  }
15265
- hitTestRecursive(currentTarget, interactive, location, testFn, pruneFn) {
15238
+ hitTestRecursive(currentTarget, eventMode, location, testFn, pruneFn) {
15266
15239
  if (!currentTarget || !currentTarget.visible) {
15267
15240
  return null;
15268
15241
  }
15269
15242
  if (pruneFn(currentTarget, location)) {
15270
15243
  return null;
15271
15244
  }
15245
+ if (currentTarget.eventMode === "dynamic" || eventMode === "dynamic") {
15246
+ EventsTicker.pauseUpdate = false;
15247
+ }
15272
15248
  if (currentTarget.interactiveChildren && currentTarget.children) {
15273
15249
  const children = currentTarget.children;
15274
15250
  for (let i = children.length - 1; i >= 0; i--) {
15275
15251
  const child = children[i];
15276
- const nestedHit = this.hitTestRecursive(child, interactive || child.interactive, location, testFn, pruneFn);
15252
+ const nestedHit = this.hitTestRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn);
15277
15253
  if (nestedHit) {
15278
15254
  if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {
15279
15255
  continue;
15280
15256
  }
15281
- if (nestedHit.length > 0 || currentTarget.interactive) {
15257
+ if (nestedHit.length > 0 || currentTarget.isInteractive()) {
15282
15258
  nestedHit.push(currentTarget);
15283
15259
  }
15284
15260
  return nestedHit;
15285
15261
  }
15286
15262
  }
15287
15263
  }
15288
- if (interactive && testFn(currentTarget, location)) {
15289
- return currentTarget.interactive ? [currentTarget] : [];
15264
+ if (this._isInteractive(eventMode) && testFn(currentTarget, location)) {
15265
+ return currentTarget.isInteractive() ? [currentTarget] : [];
15290
15266
  }
15291
15267
  return null;
15292
15268
  }
15269
+ _isInteractive(int) {
15270
+ return int === "static" || int === "dynamic";
15271
+ }
15293
15272
  hitPruneFn(displayObject, location) {
15273
+ if (displayObject.eventMode === "none") {
15274
+ return true;
15275
+ }
15276
+ if (displayObject.eventMode === "passive" && !displayObject.interactiveChildren) {
15277
+ return true;
15278
+ }
15279
+ if (displayObject.isMask) {
15280
+ return true;
15281
+ }
15294
15282
  if (displayObject.hitArea) {
15295
15283
  displayObject.worldTransform.applyInverse(location, tempLocalMapping);
15296
15284
  if (!displayObject.hitArea.contains(tempLocalMapping.x, tempLocalMapping.y)) {
@@ -15306,6 +15294,9 @@ class EventBoundary {
15306
15294
  return false;
15307
15295
  }
15308
15296
  hitTestFn(displayObject, location) {
15297
+ if (displayObject.eventMode === "passive") {
15298
+ return false;
15299
+ }
15309
15300
  if (displayObject.hitArea) {
15310
15301
  return true;
15311
15302
  }
@@ -15520,7 +15511,8 @@ class EventBoundary {
15520
15511
  clickHistory.timeStamp = now;
15521
15512
  clickEvent.detail = clickHistory.clickCount;
15522
15513
  if (clickEvent.pointerType === "mouse") {
15523
- this.dispatchEvent(clickEvent, "click");
15514
+ const isRightButton = clickEvent.button === 2;
15515
+ this.dispatchEvent(clickEvent, isRightButton ? "rightclick" : "click");
15524
15516
  } else if (clickEvent.pointerType === "touch") {
15525
15517
  this.dispatchEvent(clickEvent, "tap");
15526
15518
  }
@@ -15689,10 +15681,16 @@ class EventBoundary {
15689
15681
  const listeners = e.currentTarget._events[type];
15690
15682
  if (!listeners)
15691
15683
  return;
15684
+ if (!e.currentTarget.isInteractive())
15685
+ return;
15692
15686
  if ("fn" in listeners) {
15687
+ if (listeners.once)
15688
+ e.currentTarget.removeListener(type, listeners.fn, void 0, true);
15693
15689
  listeners.fn.call(listeners.context, e);
15694
15690
  } else {
15695
15691
  for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {
15692
+ if (listeners[i].once)
15693
+ e.currentTarget.removeListener(type, listeners[i].fn, void 0, true);
15696
15694
  listeners[i].fn.call(listeners[i].context, e);
15697
15695
  }
15698
15696
  }
@@ -15707,7 +15705,7 @@ const TOUCH_TO_POINTER = {
15707
15705
  touchmove: "pointermove",
15708
15706
  touchcancel: "pointercancel"
15709
15707
  };
15710
- class EventSystem {
15708
+ const _EventSystem = class {
15711
15709
  constructor(renderer) {
15712
15710
  this.supportsTouchEvents = "ontouchstart" in globalThis;
15713
15711
  this.supportsPointerEvents = !!globalThis.PointerEvent;
@@ -15715,6 +15713,7 @@ class EventSystem {
15715
15713
  this.resolution = 1;
15716
15714
  this.renderer = renderer;
15717
15715
  this.rootBoundary = new EventBoundary(null);
15716
+ EventsTicker.init(this);
15718
15717
  this.autoPreventDefault = true;
15719
15718
  this.eventsAdded = false;
15720
15719
  this.rootPointerEvent = new FederatedPointerEvent(null);
@@ -15729,10 +15728,14 @@ class EventSystem {
15729
15728
  this.onPointerOverOut = this.onPointerOverOut.bind(this);
15730
15729
  this.onWheel = this.onWheel.bind(this);
15731
15730
  }
15732
- init() {
15731
+ static get defaultEventMode() {
15732
+ return this._defaultEventMode;
15733
+ }
15734
+ init(options) {
15733
15735
  const { view, resolution } = this.renderer;
15734
15736
  this.setTargetElement(view);
15735
15737
  this.resolution = resolution;
15738
+ _EventSystem._defaultEventMode = options.eventMode ?? "auto";
15736
15739
  }
15737
15740
  resolutionChange(resolution) {
15738
15741
  this.resolution = resolution;
@@ -15794,6 +15797,7 @@ class EventSystem {
15794
15797
  this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
15795
15798
  if (this.supportsTouchEvents && nativeEvent.pointerType === "touch")
15796
15799
  return;
15800
+ EventsTicker.pointerMoved();
15797
15801
  const normalizedEvents = this.normalizeToPointerData(nativeEvent);
15798
15802
  for (let i = 0, j = normalizedEvents.length; i < j; i++) {
15799
15803
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
@@ -15837,12 +15841,14 @@ class EventSystem {
15837
15841
  setTargetElement(element) {
15838
15842
  this.removeEvents();
15839
15843
  this.domElement = element;
15844
+ EventsTicker.domElement = element;
15840
15845
  this.addEvents();
15841
15846
  }
15842
15847
  addEvents() {
15843
15848
  if (this.eventsAdded || !this.domElement) {
15844
15849
  return;
15845
15850
  }
15851
+ EventsTicker.addTickerListener();
15846
15852
  const style = this.domElement.style;
15847
15853
  if (style) {
15848
15854
  if (globalThis.navigator.msPointerEnabled) {
@@ -15880,6 +15886,7 @@ class EventSystem {
15880
15886
  if (!this.eventsAdded || !this.domElement) {
15881
15887
  return;
15882
15888
  }
15889
+ EventsTicker.removeTickerListener();
15883
15890
  const style = this.domElement.style;
15884
15891
  if (globalThis.navigator.msPointerEnabled) {
15885
15892
  style.msContentZooming = "";
@@ -16056,7 +16063,8 @@ class EventSystem {
16056
16063
  event.relatedTarget = null;
16057
16064
  event.shiftKey = nativeEvent.shiftKey;
16058
16065
  }
16059
- }
16066
+ };
16067
+ let EventSystem = _EventSystem;
16060
16068
  EventSystem.extension = {
16061
16069
  name: "events",
16062
16070
  type: [
@@ -16066,6 +16074,9 @@ EventSystem.extension = {
16066
16074
  };
16067
16075
  extensions$1.add(EventSystem);
16068
16076
 
16077
+ function convertEventModeToInteractiveMode(mode) {
16078
+ return mode === "dynamic" || mode === "static";
16079
+ }
16069
16080
  const FederatedDisplayObject = {
16070
16081
  onclick: null,
16071
16082
  onmousedown: null,
@@ -16100,7 +16111,26 @@ const FederatedDisplayObject = {
16100
16111
  onglobaltouchmove: null,
16101
16112
  ontouchstart: null,
16102
16113
  onwheel: null,
16103
- interactive: false,
16114
+ _internalInteractive: void 0,
16115
+ get interactive() {
16116
+ return this._internalInteractive ?? convertEventModeToInteractiveMode(EventSystem.defaultEventMode);
16117
+ },
16118
+ set interactive(value) {
16119
+ deprecation("7.2.0", `Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead.`);
16120
+ this._internalInteractive = value;
16121
+ this.eventMode = value ? "static" : "auto";
16122
+ },
16123
+ _internalEventMode: void 0,
16124
+ get eventMode() {
16125
+ return this._internalEventMode ?? EventSystem.defaultEventMode;
16126
+ },
16127
+ set eventMode(value) {
16128
+ this._internalInteractive = convertEventModeToInteractiveMode(value);
16129
+ this._internalEventMode = value;
16130
+ },
16131
+ isInteractive() {
16132
+ return this.eventMode === "static" || this.eventMode === "dynamic";
16133
+ },
16104
16134
  interactiveChildren: true,
16105
16135
  hitArea: null,
16106
16136
  addEventListener(type, listener, options) {
@@ -16235,7 +16265,7 @@ class AccessibilityManager {
16235
16265
  if (!displayObject.visible || !displayObject.accessibleChildren) {
16236
16266
  return;
16237
16267
  }
16238
- if (displayObject.accessible && displayObject.interactive) {
16268
+ if (displayObject.accessible && displayObject.isInteractive()) {
16239
16269
  if (!displayObject._accessibleActive) {
16240
16270
  this.addChild(displayObject);
16241
16271
  }
@@ -17112,14 +17142,16 @@ const loadTextures = {
17112
17142
  priority: LoaderParserPriority.High
17113
17143
  },
17114
17144
  config: {
17115
- preferWorkers: true
17145
+ preferWorkers: true,
17146
+ preferCreateImageBitmap: true,
17147
+ crossOrigin: "anonymous"
17116
17148
  },
17117
17149
  test(url) {
17118
17150
  return checkDataUrl(url, validImageMIMEs) || checkExtension(url, validImageExtensions);
17119
17151
  },
17120
17152
  async load(url, asset, loader) {
17121
17153
  let src = null;
17122
- if (globalThis.createImageBitmap) {
17154
+ if (globalThis.createImageBitmap && this.config.preferCreateImageBitmap) {
17123
17155
  if (this.config.preferWorkers && await WorkerManager.isImageBitmapSupported()) {
17124
17156
  src = await WorkerManager.loadImageBitmap(url);
17125
17157
  } else {
@@ -17128,7 +17160,7 @@ const loadTextures = {
17128
17160
  } else {
17129
17161
  src = await new Promise((resolve) => {
17130
17162
  src = new Image();
17131
- src.crossOrigin = "anonymous";
17163
+ src.crossOrigin = this.config.crossOrigin;
17132
17164
  src.src = url;
17133
17165
  if (src.complete) {
17134
17166
  resolve(src);
@@ -17482,6 +17514,9 @@ class AssetsClass {
17482
17514
  resolution
17483
17515
  }
17484
17516
  });
17517
+ if (options.preferences) {
17518
+ this.setPreferences(options.preferences);
17519
+ }
17485
17520
  }
17486
17521
  add(keysIn, assetsIn, data) {
17487
17522
  this.resolver.add(keysIn, assetsIn, data);
@@ -17622,7 +17657,17 @@ class AssetsClass {
17622
17657
  return loadTextures.config.preferWorkers;
17623
17658
  }
17624
17659
  set preferWorkers(value) {
17625
- loadTextures.config.preferWorkers = value;
17660
+ deprecation("7.2.0", "Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead.");
17661
+ this.setPreferences({ preferWorkers: value });
17662
+ }
17663
+ setPreferences(preferences) {
17664
+ this.loader.parsers.forEach((parser) => {
17665
+ if (!parser.config)
17666
+ return;
17667
+ Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {
17668
+ parser.config[key] = preferences[key];
17669
+ });
17670
+ });
17626
17671
  }
17627
17672
  }
17628
17673
  const Assets = new AssetsClass();
@@ -19800,11 +19845,11 @@ const _GraphicsGeometry = class extends BatchGeometry {
19800
19845
  }
19801
19846
  }
19802
19847
  addColors(colors, color, alpha, size, offset = 0) {
19803
- const rgb = (color >> 16) + (color & 65280) + ((color & 255) << 16);
19804
- const rgba = premultiplyTint(rgb, alpha);
19848
+ const bgr = Color.shared.setValue(color).toLittleEndianNumber();
19849
+ const result = Color.shared.setValue(bgr).toPremultiplied(alpha);
19805
19850
  colors.length = Math.max(colors.length, offset + size);
19806
19851
  for (let i = 0; i < size; i++) {
19807
- colors[offset + i] = rgba;
19852
+ colors[offset + i] = result;
19808
19853
  }
19809
19854
  }
19810
19855
  addTextureIds(textureIds, id, size, offset = 0) {
@@ -19924,7 +19969,6 @@ class LineStyle extends FillStyle {
19924
19969
  }
19925
19970
  }
19926
19971
 
19927
- const temp = new Float32Array(3);
19928
19972
  const DEFAULT_SHADERS = {};
19929
19973
  const _Graphics = class extends Container {
19930
19974
  constructor(geometry = null) {
@@ -19944,7 +19988,7 @@ const _Graphics = class extends Container {
19944
19988
  this._geometry = geometry || new GraphicsGeometry();
19945
19989
  this._geometry.refCount++;
19946
19990
  this._transformID = -1;
19947
- this.tint = 16777215;
19991
+ this._tintColor = new Color(16777215);
19948
19992
  this.blendMode = BLEND_MODES.NORMAL;
19949
19993
  }
19950
19994
  get geometry() {
@@ -19961,10 +20005,10 @@ const _Graphics = class extends Container {
19961
20005
  return this.state.blendMode;
19962
20006
  }
19963
20007
  get tint() {
19964
- return this._tint;
20008
+ return this._tintColor.value;
19965
20009
  }
19966
20010
  set tint(value) {
19967
- this._tint = value;
20011
+ this._tintColor.setValue(value);
19968
20012
  }
19969
20013
  get fill() {
19970
20014
  return this._fillStyle;
@@ -19972,25 +20016,26 @@ const _Graphics = class extends Container {
19972
20016
  get line() {
19973
20017
  return this._lineStyle;
19974
20018
  }
19975
- lineStyle(options = null, color = 0, alpha = 1, alignment = 0.5, native = false) {
20019
+ lineStyle(options = null, color = 0, alpha, alignment = 0.5, native = false) {
19976
20020
  if (typeof options === "number") {
19977
20021
  options = { width: options, color, alpha, alignment, native };
19978
20022
  }
19979
20023
  return this.lineTextureStyle(options);
19980
20024
  }
19981
20025
  lineTextureStyle(options) {
19982
- options = Object.assign({
20026
+ const defaultLineStyleOptions = {
19983
20027
  width: 0,
19984
20028
  texture: Texture.WHITE,
19985
20029
  color: options?.texture ? 16777215 : 0,
19986
- alpha: 1,
19987
20030
  matrix: null,
19988
20031
  alignment: 0.5,
19989
20032
  native: false,
19990
20033
  cap: LINE_CAP.BUTT,
19991
20034
  join: LINE_JOIN.MITER,
19992
20035
  miterLimit: 10
19993
- }, options);
20036
+ };
20037
+ options = Object.assign(defaultLineStyleOptions, options);
20038
+ this.normalizeColor(options);
19994
20039
  if (this.currentPath) {
19995
20040
  this.startPoly();
19996
20041
  }
@@ -20113,16 +20158,22 @@ const _Graphics = class extends Container {
20113
20158
  ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);
20114
20159
  return this;
20115
20160
  }
20116
- beginFill(color = 0, alpha = 1) {
20161
+ beginFill(color = 0, alpha) {
20117
20162
  return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });
20118
20163
  }
20164
+ normalizeColor(options) {
20165
+ const temp = Color.shared.setValue(options.color ?? 0);
20166
+ options.color = temp.toNumber();
20167
+ options.alpha ?? (options.alpha = temp.alpha);
20168
+ }
20119
20169
  beginTextureFill(options) {
20120
- options = Object.assign({
20170
+ const defaultOptions = {
20121
20171
  texture: Texture.WHITE,
20122
20172
  color: 16777215,
20123
- alpha: 1,
20124
20173
  matrix: null
20125
- }, options);
20174
+ };
20175
+ options = Object.assign(defaultOptions, options);
20176
+ this.normalizeColor(options);
20126
20177
  if (this.currentPath) {
20127
20178
  this.startPoly();
20128
20179
  }
@@ -20228,7 +20279,7 @@ const _Graphics = class extends Container {
20228
20279
  blendMode,
20229
20280
  indices,
20230
20281
  uvs,
20231
- _batchRGB: hex2rgb(color),
20282
+ _batchRGB: Color.shared.setValue(color).toRgbArray(),
20232
20283
  _tintRGB: color,
20233
20284
  _texture: gI.style.texture,
20234
20285
  alpha: gI.style.alpha,
@@ -20253,15 +20304,11 @@ const _Graphics = class extends Container {
20253
20304
  _renderDirect(renderer) {
20254
20305
  const shader = this._resolveDirectShader(renderer);
20255
20306
  const geometry = this._geometry;
20256
- const tint = this.tint;
20257
20307
  const worldAlpha = this.worldAlpha;
20258
20308
  const uniforms = shader.uniforms;
20259
20309
  const drawCalls = geometry.drawCalls;
20260
20310
  uniforms.translationMatrix = this.transform.worldTransform;
20261
- uniforms.tint[0] = (tint >> 16 & 255) / 255 * worldAlpha;
20262
- uniforms.tint[1] = (tint >> 8 & 255) / 255 * worldAlpha;
20263
- uniforms.tint[2] = (tint & 255) / 255 * worldAlpha;
20264
- uniforms.tint[3] = worldAlpha;
20311
+ Color.shared.setValue(this._tintColor).multiply([worldAlpha, worldAlpha, worldAlpha]).setAlpha(worldAlpha).toArray(uniforms.tint);
20265
20312
  renderer.shader.bind(shader);
20266
20313
  renderer.geometry.bind(geometry, shader);
20267
20314
  renderer.state.set(this.state);
@@ -20314,16 +20361,10 @@ const _Graphics = class extends Container {
20314
20361
  }
20315
20362
  calculateTints() {
20316
20363
  if (this.batchTint !== this.tint) {
20317
- this.batchTint = this.tint;
20318
- const tintRGB = hex2rgb(this.tint, temp);
20364
+ this.batchTint = this._tintColor.toNumber();
20319
20365
  for (let i = 0; i < this.batches.length; i++) {
20320
20366
  const batch = this.batches[i];
20321
- const batchTint = batch._batchRGB;
20322
- const r = tintRGB[0] * batchTint[0] * 255;
20323
- const g = tintRGB[1] * batchTint[1] * 255;
20324
- const b = tintRGB[2] * batchTint[2] * 255;
20325
- const color = (r << 16) + (g << 8) + (b | 0);
20326
- batch._tintRGB = (color >> 16) + (color & 65280) + ((color & 255) << 16);
20367
+ batch._tintRGB = Color.shared.setValue(this._tintColor).multiply(batch._batchRGB).toLittleEndianNumber();
20327
20368
  }
20328
20369
  }
20329
20370
  }
@@ -20505,6 +20546,9 @@ const _Mesh = class extends Container {
20505
20546
  set tint(value) {
20506
20547
  this.shader.tint = value;
20507
20548
  }
20549
+ get tintValue() {
20550
+ return this.shader.tintValue;
20551
+ }
20508
20552
  get texture() {
20509
20553
  return "texture" in this.shader ? this.shader.texture : null;
20510
20554
  }
@@ -20681,7 +20725,9 @@ class MeshMaterial extends Shader {
20681
20725
  this.uvMatrix = new TextureMatrix(uSampler);
20682
20726
  this.batchable = options.program === void 0;
20683
20727
  this.pluginName = options.pluginName;
20684
- this.tint = options.tint;
20728
+ this._tintColor = new Color(options.tint);
20729
+ this._tintRGB = this._tintColor.toLittleEndianNumber();
20730
+ this._colorDirty = true;
20685
20731
  this.alpha = options.alpha;
20686
20732
  }
20687
20733
  get texture() {
@@ -20706,20 +20752,24 @@ class MeshMaterial extends Shader {
20706
20752
  return this._alpha;
20707
20753
  }
20708
20754
  set tint(value) {
20709
- if (value === this._tint)
20755
+ if (value === this.tint)
20710
20756
  return;
20711
- this._tint = value;
20712
- this._tintRGB = (value >> 16) + (value & 65280) + ((value & 255) << 16);
20757
+ this._tintColor.setValue(value);
20758
+ this._tintRGB = this._tintColor.toLittleEndianNumber();
20713
20759
  this._colorDirty = true;
20714
20760
  }
20715
20761
  get tint() {
20716
- return this._tint;
20762
+ return this._tintColor.value;
20763
+ }
20764
+ get tintValue() {
20765
+ return this._tintColor.toNumber();
20717
20766
  }
20718
20767
  update() {
20719
20768
  if (this._colorDirty) {
20720
20769
  this._colorDirty = false;
20721
20770
  const baseTexture = this.texture.baseTexture;
20722
- premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode);
20771
+ const applyToChannels = baseTexture.alphaMode;
20772
+ Color.shared.setValue(this._tintColor).premultiply(this._alpha, applyToChannels).toArray(this.uniforms.uColor);
20723
20773
  }
20724
20774
  if (this.uvMatrix.update()) {
20725
20775
  this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;
@@ -20931,16 +20981,16 @@ class SimplePlane extends Mesh {
20931
20981
 
20932
20982
  const DEFAULT_BORDER_SIZE = 10;
20933
20983
  class NineSlicePlane extends SimplePlane {
20934
- constructor(texture, leftWidth = DEFAULT_BORDER_SIZE, topHeight = DEFAULT_BORDER_SIZE, rightWidth = DEFAULT_BORDER_SIZE, bottomHeight = DEFAULT_BORDER_SIZE) {
20984
+ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) {
20935
20985
  super(Texture.WHITE, 4, 4);
20936
20986
  this._origWidth = texture.orig.width;
20937
20987
  this._origHeight = texture.orig.height;
20938
20988
  this._width = this._origWidth;
20939
20989
  this._height = this._origHeight;
20940
- this._leftWidth = leftWidth;
20941
- this._rightWidth = rightWidth;
20942
- this._topHeight = topHeight;
20943
- this._bottomHeight = bottomHeight;
20990
+ this._leftWidth = leftWidth ?? texture.defaultBorders?.left ?? DEFAULT_BORDER_SIZE;
20991
+ this._rightWidth = rightWidth ?? texture.defaultBorders?.right ?? DEFAULT_BORDER_SIZE;
20992
+ this._topHeight = topHeight ?? texture.defaultBorders?.top ?? DEFAULT_BORDER_SIZE;
20993
+ this._bottomHeight = bottomHeight ?? texture.defaultBorders?.bottom ?? DEFAULT_BORDER_SIZE;
20944
20994
  this.texture = texture;
20945
20995
  }
20946
20996
  textureUpdated() {
@@ -21100,8 +21150,8 @@ class ParticleContainer extends Container {
21100
21150
  this.roundPixels = true;
21101
21151
  this.baseTexture = null;
21102
21152
  this.setProperties(properties);
21103
- this._tint = 0;
21104
- this.tintRgb = new Float32Array(4);
21153
+ this._tintColor = new Color(0);
21154
+ this.tintRgb = new Float32Array(3);
21105
21155
  this.tint = 16777215;
21106
21156
  }
21107
21157
  setProperties(properties) {
@@ -21117,11 +21167,11 @@ class ParticleContainer extends Container {
21117
21167
  this.displayObjectUpdateTransform();
21118
21168
  }
21119
21169
  get tint() {
21120
- return this._tint;
21170
+ return this._tintColor.value;
21121
21171
  }
21122
21172
  set tint(value) {
21123
- this._tint = value;
21124
- hex2rgb(value, this.tintRgb);
21173
+ this._tintColor.setValue(value);
21174
+ this._tintColor.toRgbArray(this.tintRgb);
21125
21175
  }
21126
21176
  render(renderer) {
21127
21177
  if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) {
@@ -21327,7 +21377,7 @@ class ParticleRenderer extends ObjectRenderer {
21327
21377
  const m = container.worldTransform.copyTo(this.tempMatrix);
21328
21378
  m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);
21329
21379
  this.shader.uniforms.translationMatrix = m.toArray(true);
21330
- this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, premultiplied);
21380
+ this.shader.uniforms.uColor = Color.shared.setValue(container.tintRgb).premultiply(container.worldAlpha, premultiplied).toArray(this.shader.uniforms.uColor);
21331
21381
  this.shader.uniforms.uSampler = baseTexture;
21332
21382
  this.renderer.shader.bind(this.shader);
21333
21383
  let updateStatic = false;
@@ -21453,13 +21503,11 @@ class ParticleRenderer extends ObjectRenderer {
21453
21503
  uploadTint(children, startIndex, amount, array, stride, offset) {
21454
21504
  for (let i = 0; i < amount; ++i) {
21455
21505
  const sprite = children[startIndex + i];
21456
- const premultiplied = sprite._texture.baseTexture.alphaMode > 0;
21457
- const alpha = sprite.alpha;
21458
- const argb = alpha < 1 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);
21459
- array[offset] = argb;
21460
- array[offset + stride] = argb;
21461
- array[offset + stride * 2] = argb;
21462
- array[offset + stride * 3] = argb;
21506
+ const result = Color.shared.setValue(sprite._tintRGB).toPremultiplied(sprite.alpha);
21507
+ array[offset] = result;
21508
+ array[offset + stride] = result;
21509
+ array[offset + stride * 2] = result;
21510
+ array[offset + stride * 3] = result;
21463
21511
  offset += stride * 4;
21464
21512
  }
21465
21513
  }
@@ -22201,24 +22249,12 @@ TextStyle.defaultStyle = {
22201
22249
  wordWrap: false,
22202
22250
  wordWrapWidth: 100
22203
22251
  };
22204
- function getSingleColor(color) {
22205
- if (typeof color === "number") {
22206
- return hex2string(color);
22207
- } else if (typeof color === "string") {
22208
- if (color.startsWith("0x")) {
22209
- color = color.replace("0x", "#");
22210
- }
22211
- }
22212
- return color;
22213
- }
22214
22252
  function getColor(color) {
22253
+ const temp = Color.shared;
22215
22254
  if (!Array.isArray(color)) {
22216
- return getSingleColor(color);
22255
+ return temp.setValue(color).toHex();
22217
22256
  } else {
22218
- for (let i = 0; i < color.length; ++i) {
22219
- color[i] = getSingleColor(color[i]);
22220
- }
22221
- return color;
22257
+ return color.map((c) => temp.setValue(c).toHex());
22222
22258
  }
22223
22259
  }
22224
22260
  function areArraysEqual(array1, array2) {
@@ -22324,10 +22360,9 @@ const _Text = class extends Sprite {
22324
22360
  context.fillStyle = "black";
22325
22361
  context.strokeStyle = "black";
22326
22362
  const dropShadowColor = style.dropShadowColor;
22327
- const rgb = hex2rgb(typeof dropShadowColor === "number" ? dropShadowColor : string2hex(dropShadowColor));
22328
22363
  const dropShadowBlur = style.dropShadowBlur * this._resolution;
22329
22364
  const dropShadowDistance = style.dropShadowDistance * this._resolution;
22330
- context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;
22365
+ context.shadowColor = Color.shared.setValue(dropShadowColor).setAlpha(style.dropShadowAlpha).toRgbaString();
22331
22366
  context.shadowBlur = dropShadowBlur;
22332
22367
  context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;
22333
22368
  context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance + dsOffsetShadow;
@@ -23235,7 +23270,7 @@ class TilingSpriteRenderer extends ObjectRenderer {
23235
23270
  shader.uniforms.uClampOffset = uv.uClampOffset;
23236
23271
  }
23237
23272
  shader.uniforms.uTransform = tempMat.toArray(true);
23238
- shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, premultiplied);
23273
+ shader.uniforms.uColor = Color.shared.setValue(ts.tint).premultiply(ts.worldAlpha, premultiplied).toArray(shader.uniforms.uColor);
23239
23274
  shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);
23240
23275
  shader.uniforms.uSampler = tex;
23241
23276
  renderer.shader.bind(shader);
@@ -23310,7 +23345,7 @@ const _Spritesheet = class {
23310
23345
  if (data.trimmed !== false && data.spriteSourceSize) {
23311
23346
  trim = new Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution);
23312
23347
  }
23313
- this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor);
23348
+ this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor, data.borders);
23314
23349
  Texture.addToCache(this.textures[i], i);
23315
23350
  }
23316
23351
  frameIndex++;
@@ -23701,10 +23736,9 @@ function drawGlyph(canvas, context, metrics, x, y, resolution, style) {
23701
23736
  context.strokeStyle = style.stroke;
23702
23737
  if (style.dropShadow) {
23703
23738
  const dropShadowColor = style.dropShadowColor;
23704
- const rgb = hex2rgb(typeof dropShadowColor === "number" ? dropShadowColor : string2hex(dropShadowColor));
23705
23739
  const dropShadowBlur = style.dropShadowBlur * resolution;
23706
23740
  const dropShadowDistance = style.dropShadowDistance * resolution;
23707
- context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;
23741
+ context.shadowColor = Color.shared.setValue(dropShadowColor).setAlpha(style.dropShadowAlpha).toRgbaString();
23708
23742
  context.shadowBlur = dropShadowBlur;
23709
23743
  context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;
23710
23744
  context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;
@@ -23995,7 +24029,6 @@ const charRenderDataPool = [];
23995
24029
  const _BitmapText = class extends Container {
23996
24030
  constructor(text, style = {}) {
23997
24031
  super();
23998
- this._tint = 16777215;
23999
24032
  const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign({}, _BitmapText.styleDefaults, style);
24000
24033
  if (!BitmapFont.available[fontName]) {
24001
24034
  throw new Error(`Missing BitmapFont "${fontName}"`);
@@ -24004,7 +24037,7 @@ const _BitmapText = class extends Container {
24004
24037
  this._textWidth = 0;
24005
24038
  this._textHeight = 0;
24006
24039
  this._align = align;
24007
- this._tint = tint;
24040
+ this._tintColor = new Color(tint);
24008
24041
  this._font = void 0;
24009
24042
  this._fontName = fontName;
24010
24043
  this._fontSize = fontSize;
@@ -24166,7 +24199,7 @@ const _BitmapText = class extends Container {
24166
24199
  const { _textureCache } = this;
24167
24200
  _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);
24168
24201
  pageMeshData.mesh.texture = _textureCache[baseTextureUid];
24169
- pageMeshData.mesh.tint = this._tint;
24202
+ pageMeshData.mesh.tint = this._tintColor.value;
24170
24203
  newPagesMeshData.push(pageMeshData);
24171
24204
  pagesMeshData[baseTextureUid] = pageMeshData;
24172
24205
  }
@@ -24311,12 +24344,12 @@ const _BitmapText = class extends Container {
24311
24344
  }
24312
24345
  }
24313
24346
  get tint() {
24314
- return this._tint;
24347
+ return this._tintColor.value;
24315
24348
  }
24316
24349
  set tint(value) {
24317
- if (this._tint === value)
24350
+ if (this.tint === value)
24318
24351
  return;
24319
- this._tint = value;
24352
+ this._tintColor.setValue(value);
24320
24353
  for (let i = 0; i < this._activePagesMeshData.length; i++) {
24321
24354
  this._activePagesMeshData[i].mesh.tint = value;
24322
24355
  }
@@ -24441,6 +24474,7 @@ const _BitmapText = class extends Container {
24441
24474
  delete _textureCache[id];
24442
24475
  }
24443
24476
  this._font = null;
24477
+ this._tintColor = null;
24444
24478
  this._textureCache = null;
24445
24479
  super.destroy(options);
24446
24480
  }
@@ -24490,5 +24524,498 @@ const loadBitmapFont = {
24490
24524
  };
24491
24525
  extensions$1.add(loadBitmapFont);
24492
24526
 
24493
- export { ALPHA_MODES, AbstractMultiResource, AccessibilityManager, AlphaFilter, AnimatedSprite, Application, ArrayResource, Assets, AssetsClass, Attribute, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, BackgroundSystem, BaseImageResource, BasePrepare, BaseRenderTexture, BaseTexture, BatchDrawCall, BatchGeometry, BatchRenderer, BatchShaderGenerator, BatchSystem, BatchTextureArray, BitmapFont, BitmapFontData, BitmapText, BlobResource, BlurFilter, BlurFilterPass, Bounds, BrowserAdapter, Buffer, BufferResource, BufferSystem, CLEAR_MODES, COLOR_MASK_BITS, Cache, CanvasResource, Circle, ColorMatrixFilter, CompressedTextureResource, Container, ContextSystem, CountLimiter, CubeResource, DEG_TO_RAD, DRAW_MODES, DisplacementFilter, DisplayObject, ENV, Ellipse, EventBoundary, EventSystem, ExtensionType, Extract, FORMATS, FORMATS_TO_COMPONENTS, FXAAFilter, FederatedDisplayObject, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FillStyle, Filter, FilterState, FilterSystem, Framebuffer, FramebufferSystem, GC_MODES, GLFramebuffer, GLProgram, GLTexture, GRAPHICS_CURVES, GenerateTextureSystem, Geometry, GeometrySystem, Graphics, GraphicsData, GraphicsGeometry, IGLUniformData, INSTALLED, INTERNAL_FORMATS, INTERNAL_FORMAT_TO_BYTES_PER_PIXEL, ImageBitmapResource, ImageResource, LINE_CAP, LINE_JOIN, LineStyle, LoaderParserPriority, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, MaskData, MaskSystem, Matrix, Mesh, MeshBatchUvs, MeshGeometry, MeshMaterial, MultisampleSystem, NineSlicePlane, NoiseFilter, ObjectRenderer, ObjectRendererSystem, ObservablePoint, PI_2, PRECISION, ParticleContainer, ParticleRenderer, PlaneGeometry, PluginSystem, Point, Polygon, Prepare, Program, ProjectionSystem, Quad, QuadUv, RAD_TO_DEG, RENDERER_TYPE, Rectangle, RenderTexture, RenderTexturePool, RenderTextureSystem, Renderer, ResizePlugin, Resource, RopeGeometry, RoundedRectangle, Runner, SAMPLER_TYPES, SCALE_MODES, SHAPES, SVGResource, ScissorSystem, Shader, ShaderSystem, SimpleMesh, SimplePlane, SimpleRope, Sprite, SpriteMaskFilter, Spritesheet, StartupSystem, State, StateSystem, StencilSystem, SystemManager, TARGETS, TEXT_GRADIENT, TYPES, TYPES_TO_BYTES_PER_COMPONENT, TYPES_TO_BYTES_PER_PIXEL, TemporaryDisplayObject, Text, TextFormat, TextMetrics, TextStyle, Texture, TextureGCSystem, TextureMatrix, TextureSystem, TextureUvs, Ticker, TickerPlugin, TilingSprite, TilingSpriteRenderer, TimeLimiter, Transform, TransformFeedback, TransformFeedbackSystem, UPDATE_PRIORITY, UniformGroup, VERSION, VideoResource, ViewSystem, ViewableBuffer, WRAP_MODES, XMLFormat, XMLStringFormat, accessibleTarget, autoDetectFormat, autoDetectRenderer, autoDetectResource, cacheTextureArray, checkDataUrl, checkExtension, checkMaxIfStatementsInShader, convertToList, copySearchParams, createStringVariations, createTexture, createUBOElements, curves, defaultFilterVertex, defaultVertex, detectAvif, detectCompressedTextures, detectDefaults, detectWebp, extensions$1 as extensions, filters, generateProgram, generateUniformBufferSync, getFontFamilyName, getTestContext, getUBOData, graphicsUtils, groupD8, isMobile, isSingleItem, loadBitmapFont, loadDDS, loadImageBitmap, loadJson, loadKTX, loadSVG, loadTextures, loadTxt, loadWebFont, parseDDS, parseKTX, resolveCompressedTextureUrl, resolveTextureUrl, settings, spritesheetAsset, uniformParsers, unsafeEvalSupported, index as utils };
24527
+ const _HTMLTextStyle = class extends TextStyle {
24528
+ constructor() {
24529
+ super(...arguments);
24530
+ this._fonts = [];
24531
+ this._overrides = [];
24532
+ this._stylesheet = "";
24533
+ this.fontsDirty = false;
24534
+ }
24535
+ static from(originalStyle) {
24536
+ return new _HTMLTextStyle(Object.keys(_HTMLTextStyle.defaultOptions).reduce((obj, prop) => ({ ...obj, [prop]: originalStyle[prop] }), {}));
24537
+ }
24538
+ cleanFonts() {
24539
+ if (this._fonts.length > 0) {
24540
+ this._fonts.forEach((font) => {
24541
+ URL.revokeObjectURL(font.src);
24542
+ font.refs--;
24543
+ if (font.refs === 0) {
24544
+ if (font.fontFace) {
24545
+ document.fonts.delete(font.fontFace);
24546
+ }
24547
+ delete _HTMLTextStyle.availableFonts[font.originalUrl];
24548
+ }
24549
+ });
24550
+ this.fontFamily = "Arial";
24551
+ this._fonts.length = 0;
24552
+ this.styleID++;
24553
+ this.fontsDirty = true;
24554
+ }
24555
+ }
24556
+ loadFont(url, options = {}) {
24557
+ const { availableFonts } = _HTMLTextStyle;
24558
+ if (availableFonts[url]) {
24559
+ const font = availableFonts[url];
24560
+ this._fonts.push(font);
24561
+ font.refs++;
24562
+ this.styleID++;
24563
+ this.fontsDirty = true;
24564
+ return Promise.resolve();
24565
+ }
24566
+ return settings.ADAPTER.fetch(url).then((response) => response.blob()).then(async (blob) => new Promise((resolve, reject) => {
24567
+ const src = URL.createObjectURL(blob);
24568
+ const reader = new FileReader();
24569
+ reader.onload = () => resolve([src, reader.result]);
24570
+ reader.onerror = reject;
24571
+ reader.readAsDataURL(blob);
24572
+ })).then(async ([src, dataSrc]) => {
24573
+ const font = Object.assign({
24574
+ family: path.basename(url, path.extname(url)),
24575
+ weight: "normal",
24576
+ style: "normal",
24577
+ src,
24578
+ dataSrc,
24579
+ refs: 1,
24580
+ originalUrl: url,
24581
+ fontFace: null
24582
+ }, options);
24583
+ availableFonts[url] = font;
24584
+ this._fonts.push(font);
24585
+ this.styleID++;
24586
+ const fontFace = new FontFace(font.family, `url(${font.src})`, {
24587
+ weight: font.weight,
24588
+ style: font.style
24589
+ });
24590
+ font.fontFace = fontFace;
24591
+ await fontFace.load();
24592
+ document.fonts.add(fontFace);
24593
+ await document.fonts.ready;
24594
+ this.styleID++;
24595
+ this.fontsDirty = true;
24596
+ });
24597
+ }
24598
+ addOverride(...value) {
24599
+ const toAdd = value.filter((v) => !this._overrides.includes(v));
24600
+ if (toAdd.length > 0) {
24601
+ this._overrides.push(...toAdd);
24602
+ this.styleID++;
24603
+ }
24604
+ }
24605
+ removeOverride(...value) {
24606
+ const toRemove = value.filter((v) => this._overrides.includes(v));
24607
+ if (toRemove.length > 0) {
24608
+ this._overrides = this._overrides.filter((v) => !toRemove.includes(v));
24609
+ this.styleID++;
24610
+ }
24611
+ }
24612
+ toCSS(scale) {
24613
+ return [
24614
+ "display: inline-block",
24615
+ `color: ${this.normalizeColor(this.fill)}`,
24616
+ `font-size: ${this.fontSize * scale}px`,
24617
+ `font-family: ${this.fontFamily}`,
24618
+ `font-weight: ${this.fontWeight}`,
24619
+ `font-style: ${this.fontStyle}`,
24620
+ `font-variant: ${this.fontVariant}`,
24621
+ `letter-spacing: ${this.letterSpacing * scale}px`,
24622
+ `text-align: ${this.align}`,
24623
+ `padding: ${this.padding * scale}px`,
24624
+ `white-space: ${this.whiteSpace}`,
24625
+ ...this.lineHeight ? [`line-height: ${this.lineHeight * scale}px`] : [],
24626
+ ...this.wordWrap ? [
24627
+ `word-wrap: ${this.breakWords ? "break-all" : "break-word"}`,
24628
+ `max-width: ${this.wordWrapWidth * scale}px`
24629
+ ] : [],
24630
+ ...this.strokeThickness ? [
24631
+ `-webkit-text-stroke-width: ${this.strokeThickness * scale}px`,
24632
+ `-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,
24633
+ `text-stroke-width: ${this.strokeThickness * scale}px`,
24634
+ `text-stroke-color: ${this.normalizeColor(this.stroke)}`,
24635
+ "paint-order: stroke"
24636
+ ] : [],
24637
+ ...this.dropShadow ? [this.dropShadowToCSS(scale)] : [],
24638
+ ...this._overrides
24639
+ ].join(";");
24640
+ }
24641
+ toGlobalCSS() {
24642
+ return this._fonts.reduce((result, font) => `${result}
24643
+ @font-face {
24644
+ font-family: "${font.family}";
24645
+ src: url('${font.dataSrc}');
24646
+ font-weight: ${font.weight};
24647
+ font-style: ${font.style};
24648
+ }`, this._stylesheet);
24649
+ }
24650
+ get stylesheet() {
24651
+ return this._stylesheet;
24652
+ }
24653
+ set stylesheet(value) {
24654
+ if (this._stylesheet !== value) {
24655
+ this._stylesheet = value;
24656
+ this.styleID++;
24657
+ }
24658
+ }
24659
+ normalizeColor(color) {
24660
+ if (Array.isArray(color)) {
24661
+ color = rgb2hex(color);
24662
+ }
24663
+ if (typeof color === "number") {
24664
+ return hex2string(color);
24665
+ }
24666
+ return color;
24667
+ }
24668
+ dropShadowToCSS(scale) {
24669
+ let color = this.normalizeColor(this.dropShadowColor);
24670
+ const alpha = this.dropShadowAlpha;
24671
+ const x = Math.round(Math.cos(this.dropShadowAngle) * this.dropShadowDistance);
24672
+ const y = Math.round(Math.sin(this.dropShadowAngle) * this.dropShadowDistance);
24673
+ if (color.startsWith("#") && alpha < 1) {
24674
+ color += (alpha * 255 | 0).toString(16).padStart(2, "0");
24675
+ }
24676
+ const position = `${x * scale}px ${y * scale}px`;
24677
+ if (this.dropShadowBlur > 0) {
24678
+ return `text-shadow: ${position} ${this.dropShadowBlur}px ${color}`;
24679
+ }
24680
+ return `text-shadow: ${position} ${color}`;
24681
+ }
24682
+ reset() {
24683
+ Object.assign(this, _HTMLTextStyle.defaultOptions);
24684
+ }
24685
+ onBeforeDraw() {
24686
+ const { fontsDirty: prevFontsDirty } = this;
24687
+ this.fontsDirty = false;
24688
+ if (this.isSafari && this._fonts.length > 0 && prevFontsDirty) {
24689
+ return new Promise((resolve) => setTimeout(resolve, 100));
24690
+ }
24691
+ return Promise.resolve();
24692
+ }
24693
+ get isSafari() {
24694
+ const { userAgent } = settings.ADAPTER.getNavigator();
24695
+ return /^((?!chrome|android).)*safari/i.test(userAgent);
24696
+ }
24697
+ set fillGradientStops(_value) {
24698
+ console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText");
24699
+ }
24700
+ get fillGradientStops() {
24701
+ return super.fillGradientStops;
24702
+ }
24703
+ set fillGradientType(_value) {
24704
+ console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText");
24705
+ }
24706
+ get fillGradientType() {
24707
+ return super.fillGradientType;
24708
+ }
24709
+ set miterLimit(_value) {
24710
+ console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText");
24711
+ }
24712
+ get miterLimit() {
24713
+ return super.miterLimit;
24714
+ }
24715
+ set trim(_value) {
24716
+ console.warn("[HTMLTextStyle] trim is not supported by HTMLText");
24717
+ }
24718
+ get trim() {
24719
+ return super.trim;
24720
+ }
24721
+ set textBaseline(_value) {
24722
+ console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText");
24723
+ }
24724
+ get textBaseline() {
24725
+ return super.textBaseline;
24726
+ }
24727
+ set leading(_value) {
24728
+ console.warn("[HTMLTextStyle] leading is not supported by HTMLText");
24729
+ }
24730
+ get leading() {
24731
+ return super.leading;
24732
+ }
24733
+ set lineJoin(_value) {
24734
+ console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText");
24735
+ }
24736
+ get lineJoin() {
24737
+ return super.lineJoin;
24738
+ }
24739
+ };
24740
+ let HTMLTextStyle = _HTMLTextStyle;
24741
+ HTMLTextStyle.availableFonts = {};
24742
+ HTMLTextStyle.defaultOptions = {
24743
+ align: "left",
24744
+ breakWords: false,
24745
+ dropShadow: false,
24746
+ dropShadowAlpha: 1,
24747
+ dropShadowAngle: Math.PI / 6,
24748
+ dropShadowBlur: 0,
24749
+ dropShadowColor: "black",
24750
+ dropShadowDistance: 5,
24751
+ fill: "black",
24752
+ fontFamily: "Arial",
24753
+ fontSize: 26,
24754
+ fontStyle: "normal",
24755
+ fontVariant: "normal",
24756
+ fontWeight: "normal",
24757
+ letterSpacing: 0,
24758
+ lineHeight: 0,
24759
+ padding: 0,
24760
+ stroke: "black",
24761
+ strokeThickness: 0,
24762
+ whiteSpace: "normal",
24763
+ wordWrap: false,
24764
+ wordWrapWidth: 100
24765
+ };
24766
+
24767
+ const _HTMLText = class extends Sprite {
24768
+ constructor(text = "", style = {}) {
24769
+ super(Texture.EMPTY);
24770
+ this._text = null;
24771
+ this._style = null;
24772
+ this._autoResolution = true;
24773
+ this._loading = false;
24774
+ this.localStyleID = -1;
24775
+ this.dirty = false;
24776
+ this.ownsStyle = false;
24777
+ const image = new Image();
24778
+ const texture = Texture.from(image, {
24779
+ scaleMode: settings.SCALE_MODE,
24780
+ resourceOptions: {
24781
+ autoLoad: false
24782
+ }
24783
+ });
24784
+ texture.orig = new Rectangle();
24785
+ texture.trim = new Rectangle();
24786
+ this.texture = texture;
24787
+ const nssvg = "http://www.w3.org/2000/svg";
24788
+ const nsxhtml = "http://www.w3.org/1999/xhtml";
24789
+ const svgRoot = document.createElementNS(nssvg, "svg");
24790
+ const foreignObject = document.createElementNS(nssvg, "foreignObject");
24791
+ const domElement = document.createElementNS(nsxhtml, "div");
24792
+ const styleElement = document.createElementNS(nsxhtml, "style");
24793
+ foreignObject.setAttribute("width", "10000");
24794
+ foreignObject.setAttribute("height", "10000");
24795
+ foreignObject.style.overflow = "hidden";
24796
+ svgRoot.appendChild(foreignObject);
24797
+ this.maxWidth = _HTMLText.defaultMaxWidth;
24798
+ this.maxHeight = _HTMLText.defaultMaxHeight;
24799
+ this._domElement = domElement;
24800
+ this._styleElement = styleElement;
24801
+ this._svgRoot = svgRoot;
24802
+ this._foreignObject = foreignObject;
24803
+ this._foreignObject.appendChild(styleElement);
24804
+ this._foreignObject.appendChild(domElement);
24805
+ this._image = image;
24806
+ this._loadImage = new Image();
24807
+ this._autoResolution = _HTMLText.defaultAutoResolution;
24808
+ this._resolution = _HTMLText.defaultResolution ?? settings.RESOLUTION;
24809
+ this.text = text;
24810
+ this.style = style;
24811
+ }
24812
+ measureText(overrides) {
24813
+ const { text, style, resolution } = Object.assign({
24814
+ text: this._text,
24815
+ style: this._style,
24816
+ resolution: this._resolution
24817
+ }, overrides);
24818
+ Object.assign(this._domElement, {
24819
+ innerHTML: text,
24820
+ style: style.toCSS(resolution)
24821
+ });
24822
+ this._styleElement.textContent = style.toGlobalCSS();
24823
+ document.body.appendChild(this._svgRoot);
24824
+ const contentBounds = this._domElement.getBoundingClientRect();
24825
+ this._svgRoot.remove();
24826
+ const contentWidth = Math.min(this.maxWidth, Math.ceil(contentBounds.width));
24827
+ const contentHeight = Math.min(this.maxHeight, Math.ceil(contentBounds.height));
24828
+ this._svgRoot.setAttribute("width", contentWidth.toString());
24829
+ this._svgRoot.setAttribute("height", contentHeight.toString());
24830
+ if (text !== this._text) {
24831
+ this._domElement.innerHTML = this._text;
24832
+ }
24833
+ if (style !== this._style) {
24834
+ Object.assign(this._domElement, { style: this._style?.toCSS(resolution) });
24835
+ this._styleElement.textContent = this._style?.toGlobalCSS();
24836
+ }
24837
+ return {
24838
+ width: contentWidth + style.padding * 2,
24839
+ height: contentHeight + style.padding * 2
24840
+ };
24841
+ }
24842
+ async updateText(respectDirty = true) {
24843
+ const { style, _image: image, _loadImage: loadImage } = this;
24844
+ if (this.localStyleID !== style.styleID) {
24845
+ this.dirty = true;
24846
+ this.localStyleID = style.styleID;
24847
+ }
24848
+ if (!this.dirty && respectDirty) {
24849
+ return;
24850
+ }
24851
+ const { width, height } = this.measureText();
24852
+ image.width = loadImage.width = Math.ceil(Math.max(1, width));
24853
+ image.height = loadImage.height = Math.ceil(Math.max(1, height));
24854
+ if (!this._loading) {
24855
+ this._loading = true;
24856
+ await new Promise((resolve) => {
24857
+ loadImage.onload = async () => {
24858
+ await style.onBeforeDraw();
24859
+ this._loading = false;
24860
+ image.src = loadImage.src;
24861
+ loadImage.onload = null;
24862
+ loadImage.src = "";
24863
+ this.updateTexture();
24864
+ resolve();
24865
+ };
24866
+ const svgURL = new XMLSerializer().serializeToString(this._svgRoot);
24867
+ loadImage.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(svgURL)}`;
24868
+ });
24869
+ }
24870
+ }
24871
+ get source() {
24872
+ return this._image;
24873
+ }
24874
+ updateTexture() {
24875
+ const { style, texture, _image: image, resolution } = this;
24876
+ const { padding } = style;
24877
+ const { baseTexture } = texture;
24878
+ texture.trim.width = texture._frame.width = image.width / resolution;
24879
+ texture.trim.height = texture._frame.height = image.height / resolution;
24880
+ texture.trim.x = -padding;
24881
+ texture.trim.y = -padding;
24882
+ texture.orig.width = texture._frame.width - padding * 2;
24883
+ texture.orig.height = texture._frame.height - padding * 2;
24884
+ this._onTextureUpdate();
24885
+ baseTexture.setRealSize(image.width, image.height, resolution);
24886
+ this.dirty = false;
24887
+ }
24888
+ _render(renderer) {
24889
+ if (this._autoResolution && this._resolution !== renderer.resolution) {
24890
+ this._resolution = renderer.resolution;
24891
+ this.dirty = true;
24892
+ }
24893
+ this.updateText(true);
24894
+ super._render(renderer);
24895
+ }
24896
+ _renderCanvas(renderer) {
24897
+ if (this._autoResolution && this._resolution !== renderer.resolution) {
24898
+ this._resolution = renderer.resolution;
24899
+ this.dirty = true;
24900
+ }
24901
+ this.updateText(true);
24902
+ super._renderCanvas(renderer);
24903
+ }
24904
+ getLocalBounds(rect) {
24905
+ this.updateText(true);
24906
+ return super.getLocalBounds(rect);
24907
+ }
24908
+ _calculateBounds() {
24909
+ this.updateText(true);
24910
+ this.calculateVertices();
24911
+ this._bounds.addQuad(this.vertexData);
24912
+ }
24913
+ _onStyleChange() {
24914
+ this.dirty = true;
24915
+ }
24916
+ destroy(options) {
24917
+ if (typeof options === "boolean") {
24918
+ options = { children: options };
24919
+ }
24920
+ options = Object.assign({}, _HTMLText.defaultDestroyOptions, options);
24921
+ super.destroy(options);
24922
+ const forceClear = null;
24923
+ if (this.ownsStyle) {
24924
+ this._style?.cleanFonts();
24925
+ }
24926
+ this._style = forceClear;
24927
+ this._svgRoot?.remove();
24928
+ this._svgRoot = forceClear;
24929
+ this._domElement?.remove();
24930
+ this._domElement = forceClear;
24931
+ this._foreignObject?.remove();
24932
+ this._foreignObject = forceClear;
24933
+ this._styleElement?.remove();
24934
+ this._styleElement = forceClear;
24935
+ this._loadImage.src = "";
24936
+ this._loadImage.onload = null;
24937
+ this._loadImage = forceClear;
24938
+ this._image.src = "";
24939
+ this._image = forceClear;
24940
+ }
24941
+ get width() {
24942
+ this.updateText(true);
24943
+ return Math.abs(this.scale.x) * this._image.width / this.resolution;
24944
+ }
24945
+ set width(value) {
24946
+ this.updateText(true);
24947
+ const s = sign(this.scale.x) || 1;
24948
+ this.scale.x = s * value / this._image.width / this.resolution;
24949
+ this._width = value;
24950
+ }
24951
+ get height() {
24952
+ this.updateText(true);
24953
+ return Math.abs(this.scale.y) * this._image.height / this.resolution;
24954
+ }
24955
+ set height(value) {
24956
+ this.updateText(true);
24957
+ const s = sign(this.scale.y) || 1;
24958
+ this.scale.y = s * value / this._image.height / this.resolution;
24959
+ this._height = value;
24960
+ }
24961
+ get style() {
24962
+ return this._style;
24963
+ }
24964
+ set style(style) {
24965
+ if (this._style === style) {
24966
+ return;
24967
+ }
24968
+ style = style || {};
24969
+ if (style instanceof HTMLTextStyle) {
24970
+ this.ownsStyle = false;
24971
+ this._style = style;
24972
+ } else if (style instanceof TextStyle) {
24973
+ console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle");
24974
+ this.ownsStyle = true;
24975
+ this._style = HTMLTextStyle.from(style);
24976
+ } else {
24977
+ this.ownsStyle = true;
24978
+ this._style = new HTMLTextStyle(style);
24979
+ }
24980
+ this.localStyleID = -1;
24981
+ this.dirty = true;
24982
+ }
24983
+ get text() {
24984
+ return this._text;
24985
+ }
24986
+ set text(text) {
24987
+ text = String(text === "" || text === null || text === void 0 ? " " : text);
24988
+ text = this.sanitiseText(text);
24989
+ if (this._text === text) {
24990
+ return;
24991
+ }
24992
+ this._text = text;
24993
+ this.dirty = true;
24994
+ }
24995
+ get resolution() {
24996
+ return this._resolution;
24997
+ }
24998
+ set resolution(value) {
24999
+ this._autoResolution = false;
25000
+ if (this._resolution === value) {
25001
+ return;
25002
+ }
25003
+ this._resolution = value;
25004
+ this.dirty = true;
25005
+ }
25006
+ sanitiseText(text) {
25007
+ return text.replace(/<br>/gi, "<br/>").replace(/<hr>/gi, "<hr/>").replace(/&nbsp;/gi, "&#160;");
25008
+ }
25009
+ };
25010
+ let HTMLText = _HTMLText;
25011
+ HTMLText.defaultDestroyOptions = {
25012
+ texture: true,
25013
+ children: false,
25014
+ baseTexture: true
25015
+ };
25016
+ HTMLText.defaultMaxWidth = 2024;
25017
+ HTMLText.defaultMaxHeight = 2024;
25018
+ HTMLText.defaultAutoResolution = true;
25019
+
25020
+ export { ALPHA_MODES, AbstractMultiResource, AccessibilityManager, AlphaFilter, AnimatedSprite, Application, ArrayResource, Assets, AssetsClass, Attribute, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, BackgroundSystem, BaseImageResource, BasePrepare, BaseRenderTexture, BaseTexture, BatchDrawCall, BatchGeometry, BatchRenderer, BatchShaderGenerator, BatchSystem, BatchTextureArray, BitmapFont, BitmapFontData, BitmapText, BlobResource, BlurFilter, BlurFilterPass, Bounds, BrowserAdapter, Buffer, BufferResource, BufferSystem, CLEAR_MODES, COLOR_MASK_BITS, Cache, CanvasResource, Circle, Color, ColorMatrixFilter, CompressedTextureResource, Container, ContextSystem, CountLimiter, CubeResource, DEG_TO_RAD, DRAW_MODES, DisplacementFilter, DisplayObject, ENV, Ellipse, EventBoundary, EventSystem, ExtensionType, Extract, FORMATS, FORMATS_TO_COMPONENTS, FXAAFilter, FederatedDisplayObject, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FillStyle, Filter, FilterState, FilterSystem, Framebuffer, FramebufferSystem, GC_MODES, GLFramebuffer, GLProgram, GLTexture, GRAPHICS_CURVES, GenerateTextureSystem, Geometry, GeometrySystem, Graphics, GraphicsData, GraphicsGeometry, HTMLText, HTMLTextStyle, IGLUniformData, INSTALLED, INTERNAL_FORMATS, INTERNAL_FORMAT_TO_BYTES_PER_PIXEL, ImageBitmapResource, ImageResource, LINE_CAP, LINE_JOIN, LineStyle, LoaderParserPriority, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, MaskData, MaskSystem, Matrix, Mesh, MeshBatchUvs, MeshGeometry, MeshMaterial, MultisampleSystem, NineSlicePlane, NoiseFilter, ObjectRenderer, ObjectRendererSystem, ObservablePoint, PI_2, PRECISION, ParticleContainer, ParticleRenderer, PlaneGeometry, PluginSystem, Point, Polygon, Prepare, Program, ProjectionSystem, Quad, QuadUv, RAD_TO_DEG, RENDERER_TYPE, Rectangle, RenderTexture, RenderTexturePool, RenderTextureSystem, Renderer, ResizePlugin, Resource, RopeGeometry, RoundedRectangle, Runner, SAMPLER_TYPES, SCALE_MODES, SHAPES, SVGResource, ScissorSystem, Shader, ShaderSystem, SimpleMesh, SimplePlane, SimpleRope, Sprite, SpriteMaskFilter, Spritesheet, StartupSystem, State, StateSystem, StencilSystem, SystemManager, TARGETS, TEXT_GRADIENT, TYPES, TYPES_TO_BYTES_PER_COMPONENT, TYPES_TO_BYTES_PER_PIXEL, TemporaryDisplayObject, Text, TextFormat, TextMetrics, TextStyle, Texture, TextureGCSystem, TextureMatrix, TextureSystem, TextureUvs, Ticker, TickerPlugin, TilingSprite, TilingSpriteRenderer, TimeLimiter, Transform, TransformFeedback, TransformFeedbackSystem, UPDATE_PRIORITY, UniformGroup, VERSION, VideoResource, ViewSystem, ViewableBuffer, WRAP_MODES, XMLFormat, XMLStringFormat, accessibleTarget, autoDetectFormat, autoDetectRenderer, autoDetectResource, cacheTextureArray, checkDataUrl, checkExtension, checkMaxIfStatementsInShader, convertToList, copySearchParams, createStringVariations, createTexture, createUBOElements, curves, defaultFilterVertex, defaultVertex, detectAvif, detectCompressedTextures, detectDefaults, detectWebp, extensions$1 as extensions, filters, generateProgram, generateUniformBufferSync, getFontFamilyName, getTestContext, getUBOData, graphicsUtils, groupD8, isMobile, isSingleItem, loadBitmapFont, loadDDS, loadImageBitmap, loadJson, loadKTX, loadSVG, loadTextures, loadTxt, loadWebFont, parseDDS, parseKTX, resolveCompressedTextureUrl, resolveTextureUrl, settings, spritesheetAsset, uniformParsers, unsafeEvalSupported, index as utils };
24494
25021
  //# sourceMappingURL=pixi.mjs.map