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.js 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
@@ -222,19 +222,6 @@ var PIXI = (function (exports) {
222
222
  const settings = {
223
223
  ADAPTER: BrowserAdapter,
224
224
  RESOLUTION: 1,
225
- RENDER_OPTIONS: {
226
- view: null,
227
- width: 800,
228
- height: 600,
229
- autoDensity: false,
230
- backgroundColor: 0,
231
- backgroundAlpha: 1,
232
- clearBeforeRender: true,
233
- antialias: false,
234
- premultipliedAlpha: true,
235
- preserveDrawingBuffer: false,
236
- hello: false
237
- },
238
225
  CREATE_IMAGE_BITMAP: false,
239
226
  ROUND_PIXELS: false
240
227
  };
@@ -3332,331 +3319,215 @@ Deprecated since v${version}`);
3332
3319
  return supported;
3333
3320
  }
3334
3321
 
3335
- var aliceblue = "#f0f8ff";
3336
- var antiquewhite = "#faebd7";
3337
- var aqua = "#00ffff";
3338
- var aquamarine = "#7fffd4";
3339
- var azure = "#f0ffff";
3340
- var beige = "#f5f5dc";
3341
- var bisque = "#ffe4c4";
3342
- var black = "#000000";
3343
- var blanchedalmond = "#ffebcd";
3344
- var blue = "#0000ff";
3345
- var blueviolet = "#8a2be2";
3346
- var brown = "#a52a2a";
3347
- var burlywood = "#deb887";
3348
- var cadetblue = "#5f9ea0";
3349
- var chartreuse = "#7fff00";
3350
- var chocolate = "#d2691e";
3351
- var coral = "#ff7f50";
3352
- var cornflowerblue = "#6495ed";
3353
- var cornsilk = "#fff8dc";
3354
- var crimson = "#dc143c";
3355
- var cyan = "#00ffff";
3356
- var darkblue = "#00008b";
3357
- var darkcyan = "#008b8b";
3358
- var darkgoldenrod = "#b8860b";
3359
- var darkgray = "#a9a9a9";
3360
- var darkgreen = "#006400";
3361
- var darkgrey = "#a9a9a9";
3362
- var darkkhaki = "#bdb76b";
3363
- var darkmagenta = "#8b008b";
3364
- var darkolivegreen = "#556b2f";
3365
- var darkorange = "#ff8c00";
3366
- var darkorchid = "#9932cc";
3367
- var darkred = "#8b0000";
3368
- var darksalmon = "#e9967a";
3369
- var darkseagreen = "#8fbc8f";
3370
- var darkslateblue = "#483d8b";
3371
- var darkslategray = "#2f4f4f";
3372
- var darkslategrey = "#2f4f4f";
3373
- var darkturquoise = "#00ced1";
3374
- var darkviolet = "#9400d3";
3375
- var deeppink = "#ff1493";
3376
- var deepskyblue = "#00bfff";
3377
- var dimgray = "#696969";
3378
- var dimgrey = "#696969";
3379
- var dodgerblue = "#1e90ff";
3380
- var firebrick = "#b22222";
3381
- var floralwhite = "#fffaf0";
3382
- var forestgreen = "#228b22";
3383
- var fuchsia = "#ff00ff";
3384
- var gainsboro = "#dcdcdc";
3385
- var ghostwhite = "#f8f8ff";
3386
- var goldenrod = "#daa520";
3387
- var gold = "#ffd700";
3388
- var gray = "#808080";
3389
- var green = "#008000";
3390
- var greenyellow = "#adff2f";
3391
- var grey = "#808080";
3392
- var honeydew = "#f0fff0";
3393
- var hotpink = "#ff69b4";
3394
- var indianred = "#cd5c5c";
3395
- var indigo = "#4b0082";
3396
- var ivory = "#fffff0";
3397
- var khaki = "#f0e68c";
3398
- var lavenderblush = "#fff0f5";
3399
- var lavender = "#e6e6fa";
3400
- var lawngreen = "#7cfc00";
3401
- var lemonchiffon = "#fffacd";
3402
- var lightblue = "#add8e6";
3403
- var lightcoral = "#f08080";
3404
- var lightcyan = "#e0ffff";
3405
- var lightgoldenrodyellow = "#fafad2";
3406
- var lightgray = "#d3d3d3";
3407
- var lightgreen = "#90ee90";
3408
- var lightgrey = "#d3d3d3";
3409
- var lightpink = "#ffb6c1";
3410
- var lightsalmon = "#ffa07a";
3411
- var lightseagreen = "#20b2aa";
3412
- var lightskyblue = "#87cefa";
3413
- var lightslategray = "#778899";
3414
- var lightslategrey = "#778899";
3415
- var lightsteelblue = "#b0c4de";
3416
- var lightyellow = "#ffffe0";
3417
- var lime = "#00ff00";
3418
- var limegreen = "#32cd32";
3419
- var linen = "#faf0e6";
3420
- var magenta = "#ff00ff";
3421
- var maroon = "#800000";
3422
- var mediumaquamarine = "#66cdaa";
3423
- var mediumblue = "#0000cd";
3424
- var mediumorchid = "#ba55d3";
3425
- var mediumpurple = "#9370db";
3426
- var mediumseagreen = "#3cb371";
3427
- var mediumslateblue = "#7b68ee";
3428
- var mediumspringgreen = "#00fa9a";
3429
- var mediumturquoise = "#48d1cc";
3430
- var mediumvioletred = "#c71585";
3431
- var midnightblue = "#191970";
3432
- var mintcream = "#f5fffa";
3433
- var mistyrose = "#ffe4e1";
3434
- var moccasin = "#ffe4b5";
3435
- var navajowhite = "#ffdead";
3436
- var navy = "#000080";
3437
- var oldlace = "#fdf5e6";
3438
- var olive = "#808000";
3439
- var olivedrab = "#6b8e23";
3440
- var orange = "#ffa500";
3441
- var orangered = "#ff4500";
3442
- var orchid = "#da70d6";
3443
- var palegoldenrod = "#eee8aa";
3444
- var palegreen = "#98fb98";
3445
- var paleturquoise = "#afeeee";
3446
- var palevioletred = "#db7093";
3447
- var papayawhip = "#ffefd5";
3448
- var peachpuff = "#ffdab9";
3449
- var peru = "#cd853f";
3450
- var pink = "#ffc0cb";
3451
- var plum = "#dda0dd";
3452
- var powderblue = "#b0e0e6";
3453
- var purple = "#800080";
3454
- var rebeccapurple = "#663399";
3455
- var red = "#ff0000";
3456
- var rosybrown = "#bc8f8f";
3457
- var royalblue = "#4169e1";
3458
- var saddlebrown = "#8b4513";
3459
- var salmon = "#fa8072";
3460
- var sandybrown = "#f4a460";
3461
- var seagreen = "#2e8b57";
3462
- var seashell = "#fff5ee";
3463
- var sienna = "#a0522d";
3464
- var silver = "#c0c0c0";
3465
- var skyblue = "#87ceeb";
3466
- var slateblue = "#6a5acd";
3467
- var slategray = "#708090";
3468
- var slategrey = "#708090";
3469
- var snow = "#fffafa";
3470
- var springgreen = "#00ff7f";
3471
- var steelblue = "#4682b4";
3472
- var tan = "#d2b48c";
3473
- var teal = "#008080";
3474
- var thistle = "#d8bfd8";
3475
- var tomato = "#ff6347";
3476
- var turquoise = "#40e0d0";
3477
- var violet = "#ee82ee";
3478
- var wheat = "#f5deb3";
3479
- var white = "#ffffff";
3480
- var whitesmoke = "#f5f5f5";
3481
- var yellow = "#ffff00";
3482
- var yellowgreen = "#9acd32";
3483
- var cssColorNames = {
3484
- aliceblue: aliceblue,
3485
- antiquewhite: antiquewhite,
3486
- aqua: aqua,
3487
- aquamarine: aquamarine,
3488
- azure: azure,
3489
- beige: beige,
3490
- bisque: bisque,
3491
- black: black,
3492
- blanchedalmond: blanchedalmond,
3493
- blue: blue,
3494
- blueviolet: blueviolet,
3495
- brown: brown,
3496
- burlywood: burlywood,
3497
- cadetblue: cadetblue,
3498
- chartreuse: chartreuse,
3499
- chocolate: chocolate,
3500
- coral: coral,
3501
- cornflowerblue: cornflowerblue,
3502
- cornsilk: cornsilk,
3503
- crimson: crimson,
3504
- cyan: cyan,
3505
- darkblue: darkblue,
3506
- darkcyan: darkcyan,
3507
- darkgoldenrod: darkgoldenrod,
3508
- darkgray: darkgray,
3509
- darkgreen: darkgreen,
3510
- darkgrey: darkgrey,
3511
- darkkhaki: darkkhaki,
3512
- darkmagenta: darkmagenta,
3513
- darkolivegreen: darkolivegreen,
3514
- darkorange: darkorange,
3515
- darkorchid: darkorchid,
3516
- darkred: darkred,
3517
- darksalmon: darksalmon,
3518
- darkseagreen: darkseagreen,
3519
- darkslateblue: darkslateblue,
3520
- darkslategray: darkslategray,
3521
- darkslategrey: darkslategrey,
3522
- darkturquoise: darkturquoise,
3523
- darkviolet: darkviolet,
3524
- deeppink: deeppink,
3525
- deepskyblue: deepskyblue,
3526
- dimgray: dimgray,
3527
- dimgrey: dimgrey,
3528
- dodgerblue: dodgerblue,
3529
- firebrick: firebrick,
3530
- floralwhite: floralwhite,
3531
- forestgreen: forestgreen,
3532
- fuchsia: fuchsia,
3533
- gainsboro: gainsboro,
3534
- ghostwhite: ghostwhite,
3535
- goldenrod: goldenrod,
3536
- gold: gold,
3537
- gray: gray,
3538
- green: green,
3539
- greenyellow: greenyellow,
3540
- grey: grey,
3541
- honeydew: honeydew,
3542
- hotpink: hotpink,
3543
- indianred: indianred,
3544
- indigo: indigo,
3545
- ivory: ivory,
3546
- khaki: khaki,
3547
- lavenderblush: lavenderblush,
3548
- lavender: lavender,
3549
- lawngreen: lawngreen,
3550
- lemonchiffon: lemonchiffon,
3551
- lightblue: lightblue,
3552
- lightcoral: lightcoral,
3553
- lightcyan: lightcyan,
3554
- lightgoldenrodyellow: lightgoldenrodyellow,
3555
- lightgray: lightgray,
3556
- lightgreen: lightgreen,
3557
- lightgrey: lightgrey,
3558
- lightpink: lightpink,
3559
- lightsalmon: lightsalmon,
3560
- lightseagreen: lightseagreen,
3561
- lightskyblue: lightskyblue,
3562
- lightslategray: lightslategray,
3563
- lightslategrey: lightslategrey,
3564
- lightsteelblue: lightsteelblue,
3565
- lightyellow: lightyellow,
3566
- lime: lime,
3567
- limegreen: limegreen,
3568
- linen: linen,
3569
- magenta: magenta,
3570
- maroon: maroon,
3571
- mediumaquamarine: mediumaquamarine,
3572
- mediumblue: mediumblue,
3573
- mediumorchid: mediumorchid,
3574
- mediumpurple: mediumpurple,
3575
- mediumseagreen: mediumseagreen,
3576
- mediumslateblue: mediumslateblue,
3577
- mediumspringgreen: mediumspringgreen,
3578
- mediumturquoise: mediumturquoise,
3579
- mediumvioletred: mediumvioletred,
3580
- midnightblue: midnightblue,
3581
- mintcream: mintcream,
3582
- mistyrose: mistyrose,
3583
- moccasin: moccasin,
3584
- navajowhite: navajowhite,
3585
- navy: navy,
3586
- oldlace: oldlace,
3587
- olive: olive,
3588
- olivedrab: olivedrab,
3589
- orange: orange,
3590
- orangered: orangered,
3591
- orchid: orchid,
3592
- palegoldenrod: palegoldenrod,
3593
- palegreen: palegreen,
3594
- paleturquoise: paleturquoise,
3595
- palevioletred: palevioletred,
3596
- papayawhip: papayawhip,
3597
- peachpuff: peachpuff,
3598
- peru: peru,
3599
- pink: pink,
3600
- plum: plum,
3601
- powderblue: powderblue,
3602
- purple: purple,
3603
- rebeccapurple: rebeccapurple,
3604
- red: red,
3605
- rosybrown: rosybrown,
3606
- royalblue: royalblue,
3607
- saddlebrown: saddlebrown,
3608
- salmon: salmon,
3609
- sandybrown: sandybrown,
3610
- seagreen: seagreen,
3611
- seashell: seashell,
3612
- sienna: sienna,
3613
- silver: silver,
3614
- skyblue: skyblue,
3615
- slateblue: slateblue,
3616
- slategray: slategray,
3617
- slategrey: slategrey,
3618
- snow: snow,
3619
- springgreen: springgreen,
3620
- steelblue: steelblue,
3621
- tan: tan,
3622
- teal: teal,
3623
- thistle: thistle,
3624
- tomato: tomato,
3625
- turquoise: turquoise,
3626
- violet: violet,
3627
- wheat: wheat,
3628
- white: white,
3629
- whitesmoke: whitesmoke,
3630
- yellow: yellow,
3631
- yellowgreen: yellowgreen
3322
+ 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()})};
3323
+
3324
+ 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"]);}
3325
+
3326
+ k([namesPlugin]);
3327
+ const _Color = class {
3328
+ constructor(value = 16777215) {
3329
+ this._value = null;
3330
+ this._components = new Float32Array(4);
3331
+ this._components.fill(1);
3332
+ this._int = 16777215;
3333
+ this.value = value;
3334
+ }
3335
+ get red() {
3336
+ return this._components[0];
3337
+ }
3338
+ get green() {
3339
+ return this._components[1];
3340
+ }
3341
+ get blue() {
3342
+ return this._components[2];
3343
+ }
3344
+ get alpha() {
3345
+ return this._components[3];
3346
+ }
3347
+ setValue(value) {
3348
+ this.value = value;
3349
+ return this;
3350
+ }
3351
+ set value(value) {
3352
+ if (value instanceof _Color) {
3353
+ this._value = value._value;
3354
+ this._int = value._int;
3355
+ this._components.set(value._components);
3356
+ } else if (value === null) {
3357
+ throw new Error("Cannot set PIXI.Color#value to null");
3358
+ } else if (this._value !== value) {
3359
+ this.normalize(value);
3360
+ this._value = value;
3361
+ }
3362
+ }
3363
+ get value() {
3364
+ return this._value;
3365
+ }
3366
+ toRgba() {
3367
+ const [r, g, b, a] = this._components;
3368
+ return { r, g, b, a };
3369
+ }
3370
+ toRgb() {
3371
+ const [r, g, b] = this._components;
3372
+ return { r, g, b };
3373
+ }
3374
+ toRgbaString() {
3375
+ const [r, g, b] = this.toUint8RgbArray();
3376
+ return `rgba(${r},${g},${b},${this.alpha})`;
3377
+ }
3378
+ toUint8RgbArray(out) {
3379
+ const [r, g, b] = this._components;
3380
+ out = out ?? [];
3381
+ out[0] = Math.round(r * 255);
3382
+ out[1] = Math.round(g * 255);
3383
+ out[2] = Math.round(b * 255);
3384
+ return out;
3385
+ }
3386
+ toRgbArray(out) {
3387
+ out = out ?? [];
3388
+ const [r, g, b] = this._components;
3389
+ out[0] = r;
3390
+ out[1] = g;
3391
+ out[2] = b;
3392
+ return out;
3393
+ }
3394
+ toNumber() {
3395
+ return this._int;
3396
+ }
3397
+ toLittleEndianNumber() {
3398
+ const value = this._int;
3399
+ return (value >> 16) + (value & 65280) + ((value & 255) << 16);
3400
+ }
3401
+ multiply(value) {
3402
+ const [r, g, b, a] = _Color.temp.setValue(value)._components;
3403
+ this._components[0] *= r;
3404
+ this._components[1] *= g;
3405
+ this._components[2] *= b;
3406
+ this._components[3] *= a;
3407
+ this.refreshInt();
3408
+ this._value = null;
3409
+ return this;
3410
+ }
3411
+ premultiply(alpha, applyToRGB = true) {
3412
+ if (applyToRGB) {
3413
+ this._components[0] *= alpha;
3414
+ this._components[1] *= alpha;
3415
+ this._components[2] *= alpha;
3416
+ }
3417
+ this._components[3] = alpha;
3418
+ this.refreshInt();
3419
+ this._value = null;
3420
+ return this;
3421
+ }
3422
+ toPremultiplied(alpha) {
3423
+ if (alpha === 1) {
3424
+ return (alpha * 255 << 24) + this._int;
3425
+ }
3426
+ if (alpha === 0) {
3427
+ return 0;
3428
+ }
3429
+ let r = this._int >> 16 & 255;
3430
+ let g = this._int >> 8 & 255;
3431
+ let b = this._int & 255;
3432
+ r = r * alpha + 0.5 | 0;
3433
+ g = g * alpha + 0.5 | 0;
3434
+ b = b * alpha + 0.5 | 0;
3435
+ return (alpha * 255 << 24) + (r << 16) + (g << 8) + b;
3436
+ }
3437
+ toHex() {
3438
+ const hexString = this._int.toString(16);
3439
+ return `#${"000000".substring(0, 6 - hexString.length) + hexString}`;
3440
+ }
3441
+ toHexa() {
3442
+ const alphaValue = Math.round(this._components[3] * 255);
3443
+ const alphaString = alphaValue.toString(16);
3444
+ return this.toHex() + "00".substring(0, 2 - alphaString.length) + alphaString;
3445
+ }
3446
+ setAlpha(alpha) {
3447
+ this._components[3] = alpha;
3448
+ return this;
3449
+ }
3450
+ round(step) {
3451
+ const [r, g, b] = this._components;
3452
+ this._components.set([
3453
+ Math.min(255, r / step * step),
3454
+ Math.min(255, g / step * step),
3455
+ Math.min(255, b / step * step)
3456
+ ]);
3457
+ this.refreshInt();
3458
+ this._value = null;
3459
+ return this;
3460
+ }
3461
+ toArray(out) {
3462
+ out = out ?? [];
3463
+ const [r, g, b, a] = this._components;
3464
+ out[0] = r;
3465
+ out[1] = g;
3466
+ out[2] = b;
3467
+ out[3] = a;
3468
+ return out;
3469
+ }
3470
+ normalize(value) {
3471
+ let components;
3472
+ if ((typeof value === "number" || value instanceof Number) && value >= 0 && value <= 16777215) {
3473
+ const int = value;
3474
+ components = [
3475
+ (int >> 16 & 255) / 255,
3476
+ (int >> 8 & 255) / 255,
3477
+ (int & 255) / 255,
3478
+ 1
3479
+ ];
3480
+ } else if ((Array.isArray(value) || value instanceof Float32Array) && value.length >= 3 && value.length <= 4 && value.every((v) => v <= 1 && v >= 0)) {
3481
+ const [r, g, b, a = 1] = value;
3482
+ components = [r, g, b, a];
3483
+ } else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray) && value.length >= 3 && value.length <= 4) {
3484
+ const [r, g, b, a = 255] = value;
3485
+ components = [r / 255, g / 255, b / 255, a / 255];
3486
+ } else if (typeof value === "string" || typeof value === "object") {
3487
+ if (typeof value === "string") {
3488
+ const match = _Color.HEX_PATTERN.exec(value);
3489
+ if (match) {
3490
+ value = `#${match[2]}`;
3491
+ }
3492
+ }
3493
+ const color = w(value);
3494
+ if (color.isValid()) {
3495
+ const { r, g, b, a } = color.rgba;
3496
+ components = [r / 255, g / 255, b / 255, a];
3497
+ }
3498
+ }
3499
+ if (components) {
3500
+ this._components.set(components);
3501
+ this.refreshInt();
3502
+ } else {
3503
+ throw new Error(`Unable to convert color ${value}`);
3504
+ }
3505
+ }
3506
+ refreshInt() {
3507
+ const [r, g, b] = this._components;
3508
+ this._int = (r * 255 << 16) + (g * 255 << 8) + (b * 255 | 0);
3509
+ }
3632
3510
  };
3511
+ let Color = _Color;
3512
+ Color.shared = new _Color();
3513
+ Color.temp = new _Color();
3514
+ Color.HEX_PATTERN = /^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;
3633
3515
 
3634
3516
  function hex2rgb(hex, out = []) {
3635
- out[0] = (hex >> 16 & 255) / 255;
3636
- out[1] = (hex >> 8 & 255) / 255;
3637
- out[2] = (hex & 255) / 255;
3638
- return out;
3517
+ deprecation("7.2.0", "utils.hex2rgb is deprecated, use Color#toRgbArray instead");
3518
+ return Color.shared.setValue(hex).toRgbArray(out);
3639
3519
  }
3640
3520
  function hex2string(hex) {
3641
- let hexString = hex.toString(16);
3642
- hexString = "000000".substring(0, 6 - hexString.length) + hexString;
3643
- return `#${hexString}`;
3521
+ deprecation("7.2.0", "utils.hex2string is deprecated, use Color#toHex instead");
3522
+ return Color.shared.setValue(hex).toHex();
3644
3523
  }
3645
3524
  function string2hex(string) {
3646
- if (typeof string === "string") {
3647
- string = cssColorNames[string.toLowerCase()] || string;
3648
- if (string[0] === "#") {
3649
- string = string.slice(1);
3650
- }
3651
- if (string.length === 3) {
3652
- const [r, g, b] = string;
3653
- string = r + r + g + g + b + b;
3654
- }
3655
- }
3656
- return parseInt(string, 16);
3525
+ deprecation("7.2.0", "utils.string2hex is deprecated, use Color#toNumber instead");
3526
+ return Color.shared.setValue(string).toNumber();
3657
3527
  }
3658
3528
  function rgb2hex(rgb) {
3659
- return (rgb[0] * 255 << 16) + (rgb[1] * 255 << 8) + (rgb[2] * 255 | 0);
3529
+ deprecation("7.2.0", "utils.rgb2hex is deprecated, use Color#toNumber instead");
3530
+ return Color.shared.setValue(rgb).toNumber();
3660
3531
  }
3661
3532
 
3662
3533
  function mapPremultipliedBlendModes() {
@@ -3681,47 +3552,17 @@ Deprecated since v${version}`);
3681
3552
  function correctBlendMode(blendMode, premultiplied) {
3682
3553
  return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];
3683
3554
  }
3684
- function premultiplyRgba(rgb, alpha, out, premultiply) {
3685
- out = out || new Float32Array(4);
3686
- if (premultiply || premultiply === void 0) {
3687
- out[0] = rgb[0] * alpha;
3688
- out[1] = rgb[1] * alpha;
3689
- out[2] = rgb[2] * alpha;
3690
- } else {
3691
- out[0] = rgb[0];
3692
- out[1] = rgb[1];
3693
- out[2] = rgb[2];
3694
- }
3695
- out[3] = alpha;
3696
- return out;
3555
+ function premultiplyRgba(rgb, alpha, out, premultiply = true) {
3556
+ deprecation("7.2.0", `utils.premultiplyRgba has moved to Color.premultiply`);
3557
+ return Color.shared.setValue(rgb).premultiply(alpha, premultiply).toArray(out ?? new Float32Array(4));
3697
3558
  }
3698
3559
  function premultiplyTint(tint, alpha) {
3699
- if (alpha === 1) {
3700
- return (alpha * 255 << 24) + tint;
3701
- }
3702
- if (alpha === 0) {
3703
- return 0;
3704
- }
3705
- let R = tint >> 16 & 255;
3706
- let G = tint >> 8 & 255;
3707
- let B = tint & 255;
3708
- R = R * alpha + 0.5 | 0;
3709
- G = G * alpha + 0.5 | 0;
3710
- B = B * alpha + 0.5 | 0;
3711
- return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;
3712
- }
3713
- function premultiplyTintToRgba(tint, alpha, out, premultiply) {
3714
- out = out || new Float32Array(4);
3715
- out[0] = (tint >> 16 & 255) / 255;
3716
- out[1] = (tint >> 8 & 255) / 255;
3717
- out[2] = (tint & 255) / 255;
3718
- if (premultiply || premultiply === void 0) {
3719
- out[0] *= alpha;
3720
- out[1] *= alpha;
3721
- out[2] *= alpha;
3722
- }
3723
- out[3] = alpha;
3724
- return out;
3560
+ deprecation("7.2.0", `utils.premultiplyTint has moved to Color.toPremultiplied`);
3561
+ return Color.shared.setValue(tint).toPremultiplied(alpha);
3562
+ }
3563
+ function premultiplyTintToRgba(tint, alpha, out, premultiply = true) {
3564
+ deprecation("7.2.0", `utils.premultiplyTintToRgba has moved to Color.premultiply`);
3565
+ return Color.shared.setValue(tint).premultiply(alpha, premultiply).toArray(out ?? new Float32Array(4));
3725
3566
  }
3726
3567
 
3727
3568
  const DATA_URI = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;
@@ -6108,6 +5949,51 @@ Deprecated since v${version}`);
6108
5949
  data[offset+3] = v.height;
6109
5950
  `
6110
5951
  },
5952
+ {
5953
+ test: (data, uniform) => data.type === "vec4" && data.size === 1 && !data.isArray && uniform.red !== void 0,
5954
+ code: (name) => `
5955
+ cv = ud["${name}"].value;
5956
+ v = uv["${name}"];
5957
+
5958
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
5959
+ {
5960
+ cv[0] = v.red;
5961
+ cv[1] = v.green;
5962
+ cv[2] = v.blue;
5963
+ cv[3] = v.alpha;
5964
+ gl.uniform4f(ud["${name}"].location, v.red, v.green, v.blue, v.alpha)
5965
+ }`,
5966
+ codeUbo: (name) => `
5967
+ v = uv.${name};
5968
+
5969
+ data[offset] = v.red;
5970
+ data[offset+1] = v.green;
5971
+ data[offset+2] = v.blue;
5972
+ data[offset+3] = v.alpha;
5973
+ `
5974
+ },
5975
+ {
5976
+ test: (data, uniform) => data.type === "vec3" && data.size === 1 && !data.isArray && uniform.red !== void 0,
5977
+ code: (name) => `
5978
+ cv = ud["${name}"].value;
5979
+ v = uv["${name}"];
5980
+
5981
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
5982
+ {
5983
+ cv[0] = v.red;
5984
+ cv[1] = v.green;
5985
+ cv[2] = v.blue;
5986
+
5987
+ gl.uniform3f(ud["${name}"].location, v.red, v.green, v.blue)
5988
+ }`,
5989
+ codeUbo: (name) => `
5990
+ v = uv.${name};
5991
+
5992
+ data[offset] = v.red;
5993
+ data[offset+1] = v.green;
5994
+ data[offset+2] = v.blue;
5995
+ `
5996
+ },
6111
5997
  {
6112
5998
  test: (data) => data.type === "vec4" && data.size === 1 && !data.isArray,
6113
5999
  code: (name) => `
@@ -7098,7 +6984,7 @@ ${this.fragmentSrc}`;
7098
6984
  const vertexData = element.vertexData;
7099
6985
  const textureId = element._texture.baseTexture._batchLocation;
7100
6986
  const alpha = Math.min(element.worldAlpha, 1);
7101
- const argb = alpha < 1 && element._texture.baseTexture.alphaMode ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24);
6987
+ const argb = Color.shared.setValue(element._tintRGB).toPremultiplied(alpha);
7102
6988
  for (let i = 0; i < vertexData.length; i += 2) {
7103
6989
  float32View[aIndex++] = vertexData[i];
7104
6990
  float32View[aIndex++] = vertexData[i + 1];
@@ -7166,42 +7052,41 @@ ${this.fragmentSrc}`;
7166
7052
  class BackgroundSystem {
7167
7053
  constructor() {
7168
7054
  this.clearBeforeRender = true;
7169
- this._backgroundColor = 0;
7170
- this._backgroundColorRgba = [0, 0, 0, 1];
7171
- this._backgroundColorString = "#000000";
7172
- this.color = this._backgroundColor;
7055
+ this._backgroundColor = new Color(0);
7173
7056
  this.alpha = 1;
7174
7057
  }
7175
7058
  init(options) {
7176
7059
  this.clearBeforeRender = options.clearBeforeRender;
7177
- if (options.color) {
7178
- this.color = typeof options.color === "string" ? string2hex(options.color) : options.color;
7060
+ const { backgroundColor, background, backgroundAlpha } = options;
7061
+ const color = background ?? backgroundColor;
7062
+ if (color !== void 0) {
7063
+ this.color = color;
7179
7064
  }
7180
- this.alpha = options.alpha;
7065
+ this.alpha = backgroundAlpha;
7181
7066
  }
7182
7067
  get color() {
7183
- return this._backgroundColor;
7068
+ return this._backgroundColor.value;
7184
7069
  }
7185
7070
  set color(value) {
7186
- this._backgroundColor = value;
7187
- this._backgroundColorString = hex2string(value);
7188
- hex2rgb(value, this._backgroundColorRgba);
7071
+ this._backgroundColor.setValue(value);
7189
7072
  }
7190
7073
  get alpha() {
7191
- return this._backgroundColorRgba[3];
7074
+ return this._backgroundColor.alpha;
7192
7075
  }
7193
7076
  set alpha(value) {
7194
- this._backgroundColorRgba[3] = value;
7077
+ this._backgroundColor.setAlpha(value);
7195
7078
  }
7196
- get colorRgba() {
7197
- return this._backgroundColorRgba;
7198
- }
7199
- get colorString() {
7200
- return this._backgroundColorString;
7079
+ get backgroundColor() {
7080
+ return this._backgroundColor;
7201
7081
  }
7202
7082
  destroy() {
7203
7083
  }
7204
7084
  }
7085
+ BackgroundSystem.defaultOptions = {
7086
+ backgroundAlpha: 1,
7087
+ backgroundColor: 0,
7088
+ clearBeforeRender: true
7089
+ };
7205
7090
  BackgroundSystem.extension = {
7206
7091
  type: [
7207
7092
  ExtensionType.RendererSystem,
@@ -7421,6 +7306,13 @@ ${this.fragmentSrc}`;
7421
7306
  }
7422
7307
  }
7423
7308
  }
7309
+ ContextSystem.defaultOptions = {
7310
+ context: null,
7311
+ antialias: false,
7312
+ premultipliedAlpha: true,
7313
+ preserveDrawingBuffer: false,
7314
+ powerPreference: "default"
7315
+ };
7424
7316
  ContextSystem.extension = {
7425
7317
  type: ExtensionType.RendererSystem,
7426
7318
  name: "context"
@@ -7547,12 +7439,21 @@ ${this.fragmentSrc}`;
7547
7439
  super(null, options);
7548
7440
  this.mipmap = MIPMAP_MODES.OFF;
7549
7441
  this.valid = true;
7550
- this.clearColor = [0, 0, 0, 0];
7442
+ this._clear = new Color([0, 0, 0, 0]);
7551
7443
  this.framebuffer = new Framebuffer(this.realWidth, this.realHeight).addColorTexture(0, this);
7552
7444
  this.framebuffer.multisample = options.multisample;
7553
7445
  this.maskStack = [];
7554
7446
  this.filterStack = [{}];
7555
7447
  }
7448
+ set clearColor(value) {
7449
+ this._clear.setValue(value);
7450
+ }
7451
+ get clearColor() {
7452
+ return this._clear.value;
7453
+ }
7454
+ get clear() {
7455
+ return this._clear;
7456
+ }
7556
7457
  resize(desiredWidth, desiredHeight) {
7557
7458
  this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);
7558
7459
  this.setRealSize(this.framebuffer.width, this.framebuffer.height);
@@ -7826,7 +7727,7 @@ ${this.fragmentSrc}`;
7826
7727
  };
7827
7728
  }
7828
7729
  class Texture extends eventemitter3 {
7829
- constructor(baseTexture, frame, orig, trim, rotate, anchor) {
7730
+ constructor(baseTexture, frame, orig, trim, rotate, anchor, borders) {
7830
7731
  super();
7831
7732
  this.noFrame = false;
7832
7733
  if (!frame) {
@@ -7850,6 +7751,7 @@ ${this.fragmentSrc}`;
7850
7751
  throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");
7851
7752
  }
7852
7753
  this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);
7754
+ this.defaultBorders = borders;
7853
7755
  this._updateID = 0;
7854
7756
  this.textureCacheIds = [];
7855
7757
  if (!baseTexture.valid) {
@@ -7908,7 +7810,7 @@ ${this.fragmentSrc}`;
7908
7810
  clone() {
7909
7811
  const clonedFrame = this._frame.clone();
7910
7812
  const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();
7911
- const clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim?.clone(), this.rotate, this.defaultAnchor);
7813
+ const clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim?.clone(), this.rotate, this.defaultAnchor, this.defaultBorders);
7912
7814
  if (this.noFrame) {
7913
7815
  clonedTexture._frame = clonedFrame;
7914
7816
  }
@@ -9810,7 +9712,8 @@ ${this.fragmentSrc}`;
9810
9712
  }
9811
9713
  });
9812
9714
  }
9813
- init(staticMap) {
9715
+ init() {
9716
+ const staticMap = this.rendererPlugins;
9814
9717
  for (const o in staticMap) {
9815
9718
  this.plugins[o] = new staticMap[o](this.renderer);
9816
9719
  }
@@ -9984,11 +9887,8 @@ ${this.fragmentSrc}`;
9984
9887
  this.destinationFrame.copyFrom(destinationFrame);
9985
9888
  }
9986
9889
  clear(clearColor, mask) {
9987
- if (this.current) {
9988
- clearColor = clearColor || this.current.baseTexture.clearColor;
9989
- } else {
9990
- clearColor = clearColor || this.renderer.background.colorRgba;
9991
- }
9890
+ const fallbackColor = this.current ? this.current.baseTexture.clear : this.renderer.background.backgroundColor;
9891
+ const color = clearColor ? Color.shared.setValue(clearColor) : fallbackColor;
9992
9892
  const destinationFrame = this.destinationFrame;
9993
9893
  const baseFrame = this.current ? this.current.baseTexture : this.renderer._view.screen;
9994
9894
  const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;
@@ -10001,7 +9901,7 @@ ${this.fragmentSrc}`;
10001
9901
  this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);
10002
9902
  this.renderer.gl.scissor(x, y, width, height);
10003
9903
  }
10004
- this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);
9904
+ this.renderer.framebuffer.clear(color.red, color.green, color.blue, color.alpha, mask);
10005
9905
  if (clearMask) {
10006
9906
  this.renderer.scissor.pop();
10007
9907
  }
@@ -10454,16 +10354,19 @@ ${this.fragmentSrc}`;
10454
10354
  this.renderer = renderer;
10455
10355
  }
10456
10356
  run(options) {
10457
- const renderer = this.renderer;
10458
- renderer.emitWithCustomOptions(renderer.runners.init, options);
10357
+ const { renderer } = this;
10358
+ renderer.runners.init.emit(renderer.options);
10459
10359
  if (options.hello) {
10460
- console.log(`PixiJS ${"7.1.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
10360
+ console.log(`PixiJS ${"7.2.0-beta.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
10461
10361
  }
10462
- renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
10362
+ renderer.resize(renderer.screen.width, renderer.screen.height);
10463
10363
  }
10464
10364
  destroy() {
10465
10365
  }
10466
10366
  }
10367
+ StartupSystem.defaultOptions = {
10368
+ hello: false
10369
+ };
10467
10370
  StartupSystem.extension = {
10468
10371
  type: [
10469
10372
  ExtensionType.RendererSystem,
@@ -11223,6 +11126,12 @@ ${this.fragmentSrc}`;
11223
11126
  this.screen = null;
11224
11127
  }
11225
11128
  }
11129
+ ViewSystem.defaultOptions = {
11130
+ width: 800,
11131
+ height: 600,
11132
+ resolution: settings.RESOLUTION,
11133
+ autoDensity: false
11134
+ };
11226
11135
  ViewSystem.extension = {
11227
11136
  type: [
11228
11137
  ExtensionType.RendererSystem,
@@ -11234,6 +11143,12 @@ ${this.fragmentSrc}`;
11234
11143
 
11235
11144
  settings.PREFER_ENV = ENV.WEBGL2;
11236
11145
  settings.STRICT_TEXTURE_CACHE = false;
11146
+ settings.RENDER_OPTIONS = {
11147
+ ...ContextSystem.defaultOptions,
11148
+ ...BackgroundSystem.defaultOptions,
11149
+ ...ViewSystem.defaultOptions,
11150
+ ...StartupSystem.defaultOptions
11151
+ };
11237
11152
  Object.defineProperties(settings, {
11238
11153
  WRAP_MODE: {
11239
11154
  get() {
@@ -11364,6 +11279,7 @@ ${this.fragmentSrc}`;
11364
11279
  });
11365
11280
 
11366
11281
  var UPDATE_PRIORITY = /* @__PURE__ */ ((UPDATE_PRIORITY2) => {
11282
+ UPDATE_PRIORITY2[UPDATE_PRIORITY2["INTERACTION"] = 50] = "INTERACTION";
11367
11283
  UPDATE_PRIORITY2[UPDATE_PRIORITY2["HIGH"] = 25] = "HIGH";
11368
11284
  UPDATE_PRIORITY2[UPDATE_PRIORITY2["NORMAL"] = 0] = "NORMAL";
11369
11285
  UPDATE_PRIORITY2[UPDATE_PRIORITY2["LOW"] = -25] = "LOW";
@@ -11940,31 +11856,9 @@ ${this.fragmentSrc}`;
11940
11856
  options.premultipliedAlpha = options.useContextAlpha && options.useContextAlpha !== "notMultiplied";
11941
11857
  options.backgroundAlpha = options.useContextAlpha === false ? 1 : options.backgroundAlpha;
11942
11858
  }
11943
- const startupOptions = {
11944
- hello: options.hello,
11945
- _plugin: _Renderer.__plugins,
11946
- background: {
11947
- alpha: options.backgroundAlpha,
11948
- color: options.background ?? options.backgroundColor,
11949
- clearBeforeRender: options.clearBeforeRender
11950
- },
11951
- _view: {
11952
- height: options.height,
11953
- width: options.width,
11954
- autoDensity: options.autoDensity,
11955
- resolution: options.resolution,
11956
- view: options.view
11957
- },
11958
- context: {
11959
- antialias: options.antialias,
11960
- context: options.context,
11961
- powerPreference: options.powerPreference,
11962
- premultipliedAlpha: options.premultipliedAlpha,
11963
- preserveDrawingBuffer: options.preserveDrawingBuffer
11964
- }
11965
- };
11859
+ this._plugin.rendererPlugins = _Renderer.__plugins;
11966
11860
  this.options = options;
11967
- this.startup.run(startupOptions);
11861
+ this.startup.run(this.options);
11968
11862
  }
11969
11863
  static test(options) {
11970
11864
  if (options?.forceCanvas) {
@@ -12052,7 +11946,7 @@ ${this.fragmentSrc}`;
12052
11946
  }
12053
11947
  get backgroundAlpha() {
12054
11948
  deprecation("7.0.0", "renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.");
12055
- return this.background.color;
11949
+ return this.background.alpha;
12056
11950
  }
12057
11951
  set backgroundAlpha(value) {
12058
11952
  deprecation("7.0.0", "renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.");
@@ -12648,7 +12542,7 @@ ${this.fragmentSrc}`;
12648
12542
  }
12649
12543
  }
12650
12544
 
12651
- const VERSION = "7.1.2";
12545
+ const VERSION = "7.2.0-beta.2";
12652
12546
 
12653
12547
  class Bounds {
12654
12548
  constructor() {
@@ -13043,7 +12937,7 @@ ${this.fragmentSrc}`;
13043
12937
  this.filters = null;
13044
12938
  this.filterArea = null;
13045
12939
  this.hitArea = null;
13046
- this.interactive = false;
12940
+ this.eventMode = "auto";
13047
12941
  this.interactiveChildren = false;
13048
12942
  this.emit("destroyed");
13049
12943
  this.removeAllListeners();
@@ -13537,7 +13431,7 @@ ${this.fragmentSrc}`;
13537
13431
  this._texture = null;
13538
13432
  this._width = 0;
13539
13433
  this._height = 0;
13540
- this._tint = null;
13434
+ this._tintColor = new Color(16777215);
13541
13435
  this._tintRGB = null;
13542
13436
  this.tint = 16777215;
13543
13437
  this.blendMode = BLEND_MODES.NORMAL;
@@ -13749,11 +13643,14 @@ ${this.fragmentSrc}`;
13749
13643
  this._anchor.copyFrom(value);
13750
13644
  }
13751
13645
  get tint() {
13752
- return this._tint;
13646
+ return this._tintColor.value;
13753
13647
  }
13754
13648
  set tint(value) {
13755
- this._tint = value;
13756
- this._tintRGB = (value >> 16) + (value & 65280) + ((value & 255) << 16);
13649
+ this._tintColor.setValue(value);
13650
+ this._tintRGB = this._tintColor.toLittleEndianNumber();
13651
+ }
13652
+ get tintValue() {
13653
+ return this._tintColor.toNumber();
13757
13654
  }
13758
13655
  get texture() {
13759
13656
  return this._texture;
@@ -14392,23 +14289,21 @@ ${this.fragmentSrc}`;
14392
14289
  this._loadMatrix(matrix, multiply);
14393
14290
  }
14394
14291
  tint(color, multiply) {
14395
- const r = color >> 16 & 255;
14396
- const g = color >> 8 & 255;
14397
- const b = color & 255;
14292
+ const [r, g, b] = Color.shared.setValue(color).toArray();
14398
14293
  const matrix = [
14399
- r / 255,
14294
+ r,
14400
14295
  0,
14401
14296
  0,
14402
14297
  0,
14403
14298
  0,
14404
14299
  0,
14405
- g / 255,
14300
+ g,
14406
14301
  0,
14407
14302
  0,
14408
14303
  0,
14409
14304
  0,
14410
14305
  0,
14411
- b / 255,
14306
+ b,
14412
14307
  0,
14413
14308
  0,
14414
14309
  0,
@@ -14771,12 +14666,9 @@ ${this.fragmentSrc}`;
14771
14666
  toned = toned || 0.15;
14772
14667
  lightColor = lightColor || 16770432;
14773
14668
  darkColor = darkColor || 3375104;
14774
- const lR = (lightColor >> 16 & 255) / 255;
14775
- const lG = (lightColor >> 8 & 255) / 255;
14776
- const lB = (lightColor & 255) / 255;
14777
- const dR = (darkColor >> 16 & 255) / 255;
14778
- const dG = (darkColor >> 8 & 255) / 255;
14779
- const dB = (darkColor & 255) / 255;
14669
+ const temp = Color.shared;
14670
+ const [lR, lG, lB] = temp.setValue(lightColor).toArray();
14671
+ const [dR, dG, dB] = temp.setValue(darkColor).toArray();
14780
14672
  const matrix = [
14781
14673
  0.3,
14782
14674
  0.59,
@@ -15014,6 +14906,74 @@ ${this.fragmentSrc}`;
15014
14906
  });
15015
14907
  });
15016
14908
 
14909
+ class EventsTickerClass {
14910
+ constructor() {
14911
+ this.interactionFrequency = 10;
14912
+ this._deltaTime = 0;
14913
+ this._didMove = false;
14914
+ this.tickerAdded = false;
14915
+ this._pauseUpdate = true;
14916
+ }
14917
+ init(events) {
14918
+ this.removeTickerListener();
14919
+ this.events = events;
14920
+ this.interactionFrequency = 10;
14921
+ this._deltaTime = 0;
14922
+ this._didMove = false;
14923
+ this.tickerAdded = false;
14924
+ this._pauseUpdate = true;
14925
+ }
14926
+ get pauseUpdate() {
14927
+ return this._pauseUpdate;
14928
+ }
14929
+ set pauseUpdate(paused) {
14930
+ this._pauseUpdate = paused;
14931
+ }
14932
+ addTickerListener() {
14933
+ if (this.tickerAdded || !this.domElement) {
14934
+ return;
14935
+ }
14936
+ Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);
14937
+ this.tickerAdded = true;
14938
+ }
14939
+ removeTickerListener() {
14940
+ if (!this.tickerAdded) {
14941
+ return;
14942
+ }
14943
+ Ticker.system.remove(this.tickerUpdate, this);
14944
+ this.tickerAdded = false;
14945
+ }
14946
+ pointerMoved() {
14947
+ this._didMove = true;
14948
+ }
14949
+ update() {
14950
+ if (!this.domElement || this._pauseUpdate) {
14951
+ return;
14952
+ }
14953
+ if (this._didMove) {
14954
+ this._didMove = false;
14955
+ return;
14956
+ }
14957
+ const rootPointerEvent = this.events["rootPointerEvent"];
14958
+ if (this.events.supportsTouchEvents && rootPointerEvent.pointerType === "touch") {
14959
+ return;
14960
+ }
14961
+ globalThis.document.dispatchEvent(new PointerEvent("pointermove", {
14962
+ clientX: rootPointerEvent.clientX,
14963
+ clientY: rootPointerEvent.clientY
14964
+ }));
14965
+ }
14966
+ tickerUpdate(deltaTime) {
14967
+ this._deltaTime += deltaTime;
14968
+ if (this._deltaTime < this.interactionFrequency) {
14969
+ return;
14970
+ }
14971
+ this._deltaTime = 0;
14972
+ this.update();
14973
+ }
14974
+ }
14975
+ const EventsTicker = new EventsTickerClass();
14976
+
15017
14977
  class FederatedEvent {
15018
14978
  constructor(manager) {
15019
14979
  this.bubbles = true;
@@ -15118,6 +15078,9 @@ ${this.fragmentSrc}`;
15118
15078
  get screenY() {
15119
15079
  return this.screen.y;
15120
15080
  }
15081
+ getLocalPosition(displayObject, point, globalPos) {
15082
+ return displayObject.worldTransform.applyInverse(globalPos || this.global, point);
15083
+ }
15121
15084
  getModifierState(key) {
15122
15085
  return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(key);
15123
15086
  }
@@ -15147,11 +15110,14 @@ ${this.fragmentSrc}`;
15147
15110
  class FederatedWheelEvent extends FederatedMouseEvent {
15148
15111
  constructor() {
15149
15112
  super(...arguments);
15150
- this.DOM_DELTA_LINE = 0;
15151
- this.DOM_DELTA_PAGE = 1;
15152
- this.DOM_DELTA_PIXEL = 2;
15113
+ this.DOM_DELTA_PIXEL = 0;
15114
+ this.DOM_DELTA_LINE = 1;
15115
+ this.DOM_DELTA_PAGE = 2;
15153
15116
  }
15154
15117
  }
15118
+ FederatedWheelEvent.DOM_DELTA_PIXEL = 0;
15119
+ FederatedWheelEvent.DOM_DELTA_LINE = 1;
15120
+ FederatedWheelEvent.DOM_DELTA_PAGE = 2;
15155
15121
 
15156
15122
  const PROPAGATION_LIMIT = 2048;
15157
15123
  const tempHitLocation = new Point();
@@ -15214,7 +15180,8 @@ ${this.fragmentSrc}`;
15214
15180
  }
15215
15181
  }
15216
15182
  hitTest(x, y) {
15217
- const invertedPath = this.hitTestRecursive(this.rootTarget, this.rootTarget.interactive, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
15183
+ EventsTicker.pauseUpdate = true;
15184
+ const invertedPath = this.hitTestRecursive(this.rootTarget, this.rootTarget.eventMode, tempHitLocation.set(x, y), this.hitTestFn, this.hitPruneFn);
15218
15185
  return invertedPath && invertedPath[0];
15219
15186
  }
15220
15187
  propagate(e, type) {
@@ -15245,9 +15212,15 @@ ${this.fragmentSrc}`;
15245
15212
  all(e, type, target = this.rootTarget) {
15246
15213
  e.eventPhase = e.BUBBLING_PHASE;
15247
15214
  const children = target.children;
15248
- if (children) {
15249
- for (let i = 0; i < children.length; i++) {
15250
- this.all(e, type, children[i]);
15215
+ const interactionNone = target.eventMode === "none";
15216
+ const interactionPassive = target.eventMode === "passive" && !target.interactiveChildren;
15217
+ const interactiveChildren = target.interactiveChildren;
15218
+ const shouldIterateChildren = !interactionNone && interactiveChildren && !interactionPassive;
15219
+ if (children && children.length > 0) {
15220
+ if (shouldIterateChildren) {
15221
+ for (let i = 0; i < children.length; i++) {
15222
+ this.all(e, type, children[i]);
15223
+ }
15251
15224
  }
15252
15225
  }
15253
15226
  e.currentTarget = target;
@@ -15265,35 +15238,50 @@ ${this.fragmentSrc}`;
15265
15238
  propagationPath.reverse();
15266
15239
  return propagationPath;
15267
15240
  }
15268
- hitTestRecursive(currentTarget, interactive, location, testFn, pruneFn) {
15241
+ hitTestRecursive(currentTarget, eventMode, location, testFn, pruneFn) {
15269
15242
  if (!currentTarget || !currentTarget.visible) {
15270
15243
  return null;
15271
15244
  }
15272
15245
  if (pruneFn(currentTarget, location)) {
15273
15246
  return null;
15274
15247
  }
15248
+ if (currentTarget.eventMode === "dynamic" || eventMode === "dynamic") {
15249
+ EventsTicker.pauseUpdate = false;
15250
+ }
15275
15251
  if (currentTarget.interactiveChildren && currentTarget.children) {
15276
15252
  const children = currentTarget.children;
15277
15253
  for (let i = children.length - 1; i >= 0; i--) {
15278
15254
  const child = children[i];
15279
- const nestedHit = this.hitTestRecursive(child, interactive || child.interactive, location, testFn, pruneFn);
15255
+ const nestedHit = this.hitTestRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn);
15280
15256
  if (nestedHit) {
15281
15257
  if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {
15282
15258
  continue;
15283
15259
  }
15284
- if (nestedHit.length > 0 || currentTarget.interactive) {
15260
+ if (nestedHit.length > 0 || currentTarget.isInteractive()) {
15285
15261
  nestedHit.push(currentTarget);
15286
15262
  }
15287
15263
  return nestedHit;
15288
15264
  }
15289
15265
  }
15290
15266
  }
15291
- if (interactive && testFn(currentTarget, location)) {
15292
- return currentTarget.interactive ? [currentTarget] : [];
15267
+ if (this._isInteractive(eventMode) && testFn(currentTarget, location)) {
15268
+ return currentTarget.isInteractive() ? [currentTarget] : [];
15293
15269
  }
15294
15270
  return null;
15295
15271
  }
15272
+ _isInteractive(int) {
15273
+ return int === "static" || int === "dynamic";
15274
+ }
15296
15275
  hitPruneFn(displayObject, location) {
15276
+ if (displayObject.eventMode === "none") {
15277
+ return true;
15278
+ }
15279
+ if (displayObject.eventMode === "passive" && !displayObject.interactiveChildren) {
15280
+ return true;
15281
+ }
15282
+ if (displayObject.isMask) {
15283
+ return true;
15284
+ }
15297
15285
  if (displayObject.hitArea) {
15298
15286
  displayObject.worldTransform.applyInverse(location, tempLocalMapping);
15299
15287
  if (!displayObject.hitArea.contains(tempLocalMapping.x, tempLocalMapping.y)) {
@@ -15309,6 +15297,9 @@ ${this.fragmentSrc}`;
15309
15297
  return false;
15310
15298
  }
15311
15299
  hitTestFn(displayObject, location) {
15300
+ if (displayObject.eventMode === "passive") {
15301
+ return false;
15302
+ }
15312
15303
  if (displayObject.hitArea) {
15313
15304
  return true;
15314
15305
  }
@@ -15523,7 +15514,8 @@ ${this.fragmentSrc}`;
15523
15514
  clickHistory.timeStamp = now;
15524
15515
  clickEvent.detail = clickHistory.clickCount;
15525
15516
  if (clickEvent.pointerType === "mouse") {
15526
- this.dispatchEvent(clickEvent, "click");
15517
+ const isRightButton = clickEvent.button === 2;
15518
+ this.dispatchEvent(clickEvent, isRightButton ? "rightclick" : "click");
15527
15519
  } else if (clickEvent.pointerType === "touch") {
15528
15520
  this.dispatchEvent(clickEvent, "tap");
15529
15521
  }
@@ -15692,10 +15684,16 @@ ${this.fragmentSrc}`;
15692
15684
  const listeners = e.currentTarget._events[type];
15693
15685
  if (!listeners)
15694
15686
  return;
15687
+ if (!e.currentTarget.isInteractive())
15688
+ return;
15695
15689
  if ("fn" in listeners) {
15690
+ if (listeners.once)
15691
+ e.currentTarget.removeListener(type, listeners.fn, void 0, true);
15696
15692
  listeners.fn.call(listeners.context, e);
15697
15693
  } else {
15698
15694
  for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {
15695
+ if (listeners[i].once)
15696
+ e.currentTarget.removeListener(type, listeners[i].fn, void 0, true);
15699
15697
  listeners[i].fn.call(listeners[i].context, e);
15700
15698
  }
15701
15699
  }
@@ -15710,7 +15708,7 @@ ${this.fragmentSrc}`;
15710
15708
  touchmove: "pointermove",
15711
15709
  touchcancel: "pointercancel"
15712
15710
  };
15713
- class EventSystem {
15711
+ const _EventSystem = class {
15714
15712
  constructor(renderer) {
15715
15713
  this.supportsTouchEvents = "ontouchstart" in globalThis;
15716
15714
  this.supportsPointerEvents = !!globalThis.PointerEvent;
@@ -15718,6 +15716,7 @@ ${this.fragmentSrc}`;
15718
15716
  this.resolution = 1;
15719
15717
  this.renderer = renderer;
15720
15718
  this.rootBoundary = new EventBoundary(null);
15719
+ EventsTicker.init(this);
15721
15720
  this.autoPreventDefault = true;
15722
15721
  this.eventsAdded = false;
15723
15722
  this.rootPointerEvent = new FederatedPointerEvent(null);
@@ -15732,10 +15731,14 @@ ${this.fragmentSrc}`;
15732
15731
  this.onPointerOverOut = this.onPointerOverOut.bind(this);
15733
15732
  this.onWheel = this.onWheel.bind(this);
15734
15733
  }
15735
- init() {
15734
+ static get defaultEventMode() {
15735
+ return this._defaultEventMode;
15736
+ }
15737
+ init(options) {
15736
15738
  const { view, resolution } = this.renderer;
15737
15739
  this.setTargetElement(view);
15738
15740
  this.resolution = resolution;
15741
+ _EventSystem._defaultEventMode = options.eventMode ?? "auto";
15739
15742
  }
15740
15743
  resolutionChange(resolution) {
15741
15744
  this.resolution = resolution;
@@ -15797,6 +15800,7 @@ ${this.fragmentSrc}`;
15797
15800
  this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
15798
15801
  if (this.supportsTouchEvents && nativeEvent.pointerType === "touch")
15799
15802
  return;
15803
+ EventsTicker.pointerMoved();
15800
15804
  const normalizedEvents = this.normalizeToPointerData(nativeEvent);
15801
15805
  for (let i = 0, j = normalizedEvents.length; i < j; i++) {
15802
15806
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
@@ -15840,12 +15844,14 @@ ${this.fragmentSrc}`;
15840
15844
  setTargetElement(element) {
15841
15845
  this.removeEvents();
15842
15846
  this.domElement = element;
15847
+ EventsTicker.domElement = element;
15843
15848
  this.addEvents();
15844
15849
  }
15845
15850
  addEvents() {
15846
15851
  if (this.eventsAdded || !this.domElement) {
15847
15852
  return;
15848
15853
  }
15854
+ EventsTicker.addTickerListener();
15849
15855
  const style = this.domElement.style;
15850
15856
  if (style) {
15851
15857
  if (globalThis.navigator.msPointerEnabled) {
@@ -15883,6 +15889,7 @@ ${this.fragmentSrc}`;
15883
15889
  if (!this.eventsAdded || !this.domElement) {
15884
15890
  return;
15885
15891
  }
15892
+ EventsTicker.removeTickerListener();
15886
15893
  const style = this.domElement.style;
15887
15894
  if (globalThis.navigator.msPointerEnabled) {
15888
15895
  style.msContentZooming = "";
@@ -16059,7 +16066,8 @@ ${this.fragmentSrc}`;
16059
16066
  event.relatedTarget = null;
16060
16067
  event.shiftKey = nativeEvent.shiftKey;
16061
16068
  }
16062
- }
16069
+ };
16070
+ let EventSystem = _EventSystem;
16063
16071
  EventSystem.extension = {
16064
16072
  name: "events",
16065
16073
  type: [
@@ -16069,6 +16077,9 @@ ${this.fragmentSrc}`;
16069
16077
  };
16070
16078
  extensions$1.add(EventSystem);
16071
16079
 
16080
+ function convertEventModeToInteractiveMode(mode) {
16081
+ return mode === "dynamic" || mode === "static";
16082
+ }
16072
16083
  const FederatedDisplayObject = {
16073
16084
  onclick: null,
16074
16085
  onmousedown: null,
@@ -16103,7 +16114,26 @@ ${this.fragmentSrc}`;
16103
16114
  onglobaltouchmove: null,
16104
16115
  ontouchstart: null,
16105
16116
  onwheel: null,
16106
- interactive: false,
16117
+ _internalInteractive: void 0,
16118
+ get interactive() {
16119
+ return this._internalInteractive ?? convertEventModeToInteractiveMode(EventSystem.defaultEventMode);
16120
+ },
16121
+ set interactive(value) {
16122
+ deprecation("7.2.0", `Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead.`);
16123
+ this._internalInteractive = value;
16124
+ this.eventMode = value ? "static" : "auto";
16125
+ },
16126
+ _internalEventMode: void 0,
16127
+ get eventMode() {
16128
+ return this._internalEventMode ?? EventSystem.defaultEventMode;
16129
+ },
16130
+ set eventMode(value) {
16131
+ this._internalInteractive = convertEventModeToInteractiveMode(value);
16132
+ this._internalEventMode = value;
16133
+ },
16134
+ isInteractive() {
16135
+ return this.eventMode === "static" || this.eventMode === "dynamic";
16136
+ },
16107
16137
  interactiveChildren: true,
16108
16138
  hitArea: null,
16109
16139
  addEventListener(type, listener, options) {
@@ -16238,7 +16268,7 @@ ${this.fragmentSrc}`;
16238
16268
  if (!displayObject.visible || !displayObject.accessibleChildren) {
16239
16269
  return;
16240
16270
  }
16241
- if (displayObject.accessible && displayObject.interactive) {
16271
+ if (displayObject.accessible && displayObject.isInteractive()) {
16242
16272
  if (!displayObject._accessibleActive) {
16243
16273
  this.addChild(displayObject);
16244
16274
  }
@@ -17115,14 +17145,16 @@ ${e}`);
17115
17145
  priority: LoaderParserPriority.High
17116
17146
  },
17117
17147
  config: {
17118
- preferWorkers: true
17148
+ preferWorkers: true,
17149
+ preferCreateImageBitmap: true,
17150
+ crossOrigin: "anonymous"
17119
17151
  },
17120
17152
  test(url) {
17121
17153
  return checkDataUrl(url, validImageMIMEs) || checkExtension(url, validImageExtensions);
17122
17154
  },
17123
17155
  async load(url, asset, loader) {
17124
17156
  let src = null;
17125
- if (globalThis.createImageBitmap) {
17157
+ if (globalThis.createImageBitmap && this.config.preferCreateImageBitmap) {
17126
17158
  if (this.config.preferWorkers && await WorkerManager.isImageBitmapSupported()) {
17127
17159
  src = await WorkerManager.loadImageBitmap(url);
17128
17160
  } else {
@@ -17131,7 +17163,7 @@ ${e}`);
17131
17163
  } else {
17132
17164
  src = await new Promise((resolve) => {
17133
17165
  src = new Image();
17134
- src.crossOrigin = "anonymous";
17166
+ src.crossOrigin = this.config.crossOrigin;
17135
17167
  src.src = url;
17136
17168
  if (src.complete) {
17137
17169
  resolve(src);
@@ -17485,6 +17517,9 @@ ${e}`);
17485
17517
  resolution
17486
17518
  }
17487
17519
  });
17520
+ if (options.preferences) {
17521
+ this.setPreferences(options.preferences);
17522
+ }
17488
17523
  }
17489
17524
  add(keysIn, assetsIn, data) {
17490
17525
  this.resolver.add(keysIn, assetsIn, data);
@@ -17625,7 +17660,17 @@ ${e}`);
17625
17660
  return loadTextures.config.preferWorkers;
17626
17661
  }
17627
17662
  set preferWorkers(value) {
17628
- loadTextures.config.preferWorkers = value;
17663
+ deprecation("7.2.0", "Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead.");
17664
+ this.setPreferences({ preferWorkers: value });
17665
+ }
17666
+ setPreferences(preferences) {
17667
+ this.loader.parsers.forEach((parser) => {
17668
+ if (!parser.config)
17669
+ return;
17670
+ Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {
17671
+ parser.config[key] = preferences[key];
17672
+ });
17673
+ });
17629
17674
  }
17630
17675
  }
17631
17676
  const Assets = new AssetsClass();
@@ -19803,11 +19848,11 @@ ${e}`);
19803
19848
  }
19804
19849
  }
19805
19850
  addColors(colors, color, alpha, size, offset = 0) {
19806
- const rgb = (color >> 16) + (color & 65280) + ((color & 255) << 16);
19807
- const rgba = premultiplyTint(rgb, alpha);
19851
+ const bgr = Color.shared.setValue(color).toLittleEndianNumber();
19852
+ const result = Color.shared.setValue(bgr).toPremultiplied(alpha);
19808
19853
  colors.length = Math.max(colors.length, offset + size);
19809
19854
  for (let i = 0; i < size; i++) {
19810
- colors[offset + i] = rgba;
19855
+ colors[offset + i] = result;
19811
19856
  }
19812
19857
  }
19813
19858
  addTextureIds(textureIds, id, size, offset = 0) {
@@ -19927,7 +19972,6 @@ ${e}`);
19927
19972
  }
19928
19973
  }
19929
19974
 
19930
- const temp = new Float32Array(3);
19931
19975
  const DEFAULT_SHADERS = {};
19932
19976
  const _Graphics = class extends Container {
19933
19977
  constructor(geometry = null) {
@@ -19947,7 +19991,7 @@ ${e}`);
19947
19991
  this._geometry = geometry || new GraphicsGeometry();
19948
19992
  this._geometry.refCount++;
19949
19993
  this._transformID = -1;
19950
- this.tint = 16777215;
19994
+ this._tintColor = new Color(16777215);
19951
19995
  this.blendMode = BLEND_MODES.NORMAL;
19952
19996
  }
19953
19997
  get geometry() {
@@ -19964,10 +20008,10 @@ ${e}`);
19964
20008
  return this.state.blendMode;
19965
20009
  }
19966
20010
  get tint() {
19967
- return this._tint;
20011
+ return this._tintColor.value;
19968
20012
  }
19969
20013
  set tint(value) {
19970
- this._tint = value;
20014
+ this._tintColor.setValue(value);
19971
20015
  }
19972
20016
  get fill() {
19973
20017
  return this._fillStyle;
@@ -19975,25 +20019,26 @@ ${e}`);
19975
20019
  get line() {
19976
20020
  return this._lineStyle;
19977
20021
  }
19978
- lineStyle(options = null, color = 0, alpha = 1, alignment = 0.5, native = false) {
20022
+ lineStyle(options = null, color = 0, alpha, alignment = 0.5, native = false) {
19979
20023
  if (typeof options === "number") {
19980
20024
  options = { width: options, color, alpha, alignment, native };
19981
20025
  }
19982
20026
  return this.lineTextureStyle(options);
19983
20027
  }
19984
20028
  lineTextureStyle(options) {
19985
- options = Object.assign({
20029
+ const defaultLineStyleOptions = {
19986
20030
  width: 0,
19987
20031
  texture: Texture.WHITE,
19988
20032
  color: options?.texture ? 16777215 : 0,
19989
- alpha: 1,
19990
20033
  matrix: null,
19991
20034
  alignment: 0.5,
19992
20035
  native: false,
19993
20036
  cap: LINE_CAP.BUTT,
19994
20037
  join: LINE_JOIN.MITER,
19995
20038
  miterLimit: 10
19996
- }, options);
20039
+ };
20040
+ options = Object.assign(defaultLineStyleOptions, options);
20041
+ this.normalizeColor(options);
19997
20042
  if (this.currentPath) {
19998
20043
  this.startPoly();
19999
20044
  }
@@ -20116,16 +20161,22 @@ ${e}`);
20116
20161
  ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);
20117
20162
  return this;
20118
20163
  }
20119
- beginFill(color = 0, alpha = 1) {
20164
+ beginFill(color = 0, alpha) {
20120
20165
  return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });
20121
20166
  }
20167
+ normalizeColor(options) {
20168
+ const temp = Color.shared.setValue(options.color ?? 0);
20169
+ options.color = temp.toNumber();
20170
+ options.alpha ?? (options.alpha = temp.alpha);
20171
+ }
20122
20172
  beginTextureFill(options) {
20123
- options = Object.assign({
20173
+ const defaultOptions = {
20124
20174
  texture: Texture.WHITE,
20125
20175
  color: 16777215,
20126
- alpha: 1,
20127
20176
  matrix: null
20128
- }, options);
20177
+ };
20178
+ options = Object.assign(defaultOptions, options);
20179
+ this.normalizeColor(options);
20129
20180
  if (this.currentPath) {
20130
20181
  this.startPoly();
20131
20182
  }
@@ -20231,7 +20282,7 @@ ${e}`);
20231
20282
  blendMode,
20232
20283
  indices,
20233
20284
  uvs,
20234
- _batchRGB: hex2rgb(color),
20285
+ _batchRGB: Color.shared.setValue(color).toRgbArray(),
20235
20286
  _tintRGB: color,
20236
20287
  _texture: gI.style.texture,
20237
20288
  alpha: gI.style.alpha,
@@ -20256,15 +20307,11 @@ ${e}`);
20256
20307
  _renderDirect(renderer) {
20257
20308
  const shader = this._resolveDirectShader(renderer);
20258
20309
  const geometry = this._geometry;
20259
- const tint = this.tint;
20260
20310
  const worldAlpha = this.worldAlpha;
20261
20311
  const uniforms = shader.uniforms;
20262
20312
  const drawCalls = geometry.drawCalls;
20263
20313
  uniforms.translationMatrix = this.transform.worldTransform;
20264
- uniforms.tint[0] = (tint >> 16 & 255) / 255 * worldAlpha;
20265
- uniforms.tint[1] = (tint >> 8 & 255) / 255 * worldAlpha;
20266
- uniforms.tint[2] = (tint & 255) / 255 * worldAlpha;
20267
- uniforms.tint[3] = worldAlpha;
20314
+ Color.shared.setValue(this._tintColor).multiply([worldAlpha, worldAlpha, worldAlpha]).setAlpha(worldAlpha).toArray(uniforms.tint);
20268
20315
  renderer.shader.bind(shader);
20269
20316
  renderer.geometry.bind(geometry, shader);
20270
20317
  renderer.state.set(this.state);
@@ -20317,16 +20364,10 @@ ${e}`);
20317
20364
  }
20318
20365
  calculateTints() {
20319
20366
  if (this.batchTint !== this.tint) {
20320
- this.batchTint = this.tint;
20321
- const tintRGB = hex2rgb(this.tint, temp);
20367
+ this.batchTint = this._tintColor.toNumber();
20322
20368
  for (let i = 0; i < this.batches.length; i++) {
20323
20369
  const batch = this.batches[i];
20324
- const batchTint = batch._batchRGB;
20325
- const r = tintRGB[0] * batchTint[0] * 255;
20326
- const g = tintRGB[1] * batchTint[1] * 255;
20327
- const b = tintRGB[2] * batchTint[2] * 255;
20328
- const color = (r << 16) + (g << 8) + (b | 0);
20329
- batch._tintRGB = (color >> 16) + (color & 65280) + ((color & 255) << 16);
20370
+ batch._tintRGB = Color.shared.setValue(this._tintColor).multiply(batch._batchRGB).toLittleEndianNumber();
20330
20371
  }
20331
20372
  }
20332
20373
  }
@@ -20508,6 +20549,9 @@ ${e}`);
20508
20549
  set tint(value) {
20509
20550
  this.shader.tint = value;
20510
20551
  }
20552
+ get tintValue() {
20553
+ return this.shader.tintValue;
20554
+ }
20511
20555
  get texture() {
20512
20556
  return "texture" in this.shader ? this.shader.texture : null;
20513
20557
  }
@@ -20684,7 +20728,9 @@ ${e}`);
20684
20728
  this.uvMatrix = new TextureMatrix(uSampler);
20685
20729
  this.batchable = options.program === void 0;
20686
20730
  this.pluginName = options.pluginName;
20687
- this.tint = options.tint;
20731
+ this._tintColor = new Color(options.tint);
20732
+ this._tintRGB = this._tintColor.toLittleEndianNumber();
20733
+ this._colorDirty = true;
20688
20734
  this.alpha = options.alpha;
20689
20735
  }
20690
20736
  get texture() {
@@ -20709,20 +20755,24 @@ ${e}`);
20709
20755
  return this._alpha;
20710
20756
  }
20711
20757
  set tint(value) {
20712
- if (value === this._tint)
20758
+ if (value === this.tint)
20713
20759
  return;
20714
- this._tint = value;
20715
- this._tintRGB = (value >> 16) + (value & 65280) + ((value & 255) << 16);
20760
+ this._tintColor.setValue(value);
20761
+ this._tintRGB = this._tintColor.toLittleEndianNumber();
20716
20762
  this._colorDirty = true;
20717
20763
  }
20718
20764
  get tint() {
20719
- return this._tint;
20765
+ return this._tintColor.value;
20766
+ }
20767
+ get tintValue() {
20768
+ return this._tintColor.toNumber();
20720
20769
  }
20721
20770
  update() {
20722
20771
  if (this._colorDirty) {
20723
20772
  this._colorDirty = false;
20724
20773
  const baseTexture = this.texture.baseTexture;
20725
- premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode);
20774
+ const applyToChannels = baseTexture.alphaMode;
20775
+ Color.shared.setValue(this._tintColor).premultiply(this._alpha, applyToChannels).toArray(this.uniforms.uColor);
20726
20776
  }
20727
20777
  if (this.uvMatrix.update()) {
20728
20778
  this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;
@@ -20934,16 +20984,16 @@ ${e}`);
20934
20984
 
20935
20985
  const DEFAULT_BORDER_SIZE = 10;
20936
20986
  class NineSlicePlane extends SimplePlane {
20937
- constructor(texture, leftWidth = DEFAULT_BORDER_SIZE, topHeight = DEFAULT_BORDER_SIZE, rightWidth = DEFAULT_BORDER_SIZE, bottomHeight = DEFAULT_BORDER_SIZE) {
20987
+ constructor(texture, leftWidth, topHeight, rightWidth, bottomHeight) {
20938
20988
  super(Texture.WHITE, 4, 4);
20939
20989
  this._origWidth = texture.orig.width;
20940
20990
  this._origHeight = texture.orig.height;
20941
20991
  this._width = this._origWidth;
20942
20992
  this._height = this._origHeight;
20943
- this._leftWidth = leftWidth;
20944
- this._rightWidth = rightWidth;
20945
- this._topHeight = topHeight;
20946
- this._bottomHeight = bottomHeight;
20993
+ this._leftWidth = leftWidth ?? texture.defaultBorders?.left ?? DEFAULT_BORDER_SIZE;
20994
+ this._rightWidth = rightWidth ?? texture.defaultBorders?.right ?? DEFAULT_BORDER_SIZE;
20995
+ this._topHeight = topHeight ?? texture.defaultBorders?.top ?? DEFAULT_BORDER_SIZE;
20996
+ this._bottomHeight = bottomHeight ?? texture.defaultBorders?.bottom ?? DEFAULT_BORDER_SIZE;
20947
20997
  this.texture = texture;
20948
20998
  }
20949
20999
  textureUpdated() {
@@ -21103,8 +21153,8 @@ ${e}`);
21103
21153
  this.roundPixels = true;
21104
21154
  this.baseTexture = null;
21105
21155
  this.setProperties(properties);
21106
- this._tint = 0;
21107
- this.tintRgb = new Float32Array(4);
21156
+ this._tintColor = new Color(0);
21157
+ this.tintRgb = new Float32Array(3);
21108
21158
  this.tint = 16777215;
21109
21159
  }
21110
21160
  setProperties(properties) {
@@ -21120,11 +21170,11 @@ ${e}`);
21120
21170
  this.displayObjectUpdateTransform();
21121
21171
  }
21122
21172
  get tint() {
21123
- return this._tint;
21173
+ return this._tintColor.value;
21124
21174
  }
21125
21175
  set tint(value) {
21126
- this._tint = value;
21127
- hex2rgb(value, this.tintRgb);
21176
+ this._tintColor.setValue(value);
21177
+ this._tintColor.toRgbArray(this.tintRgb);
21128
21178
  }
21129
21179
  render(renderer) {
21130
21180
  if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) {
@@ -21330,7 +21380,7 @@ ${e}`);
21330
21380
  const m = container.worldTransform.copyTo(this.tempMatrix);
21331
21381
  m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);
21332
21382
  this.shader.uniforms.translationMatrix = m.toArray(true);
21333
- this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, premultiplied);
21383
+ this.shader.uniforms.uColor = Color.shared.setValue(container.tintRgb).premultiply(container.worldAlpha, premultiplied).toArray(this.shader.uniforms.uColor);
21334
21384
  this.shader.uniforms.uSampler = baseTexture;
21335
21385
  this.renderer.shader.bind(this.shader);
21336
21386
  let updateStatic = false;
@@ -21456,13 +21506,11 @@ ${e}`);
21456
21506
  uploadTint(children, startIndex, amount, array, stride, offset) {
21457
21507
  for (let i = 0; i < amount; ++i) {
21458
21508
  const sprite = children[startIndex + i];
21459
- const premultiplied = sprite._texture.baseTexture.alphaMode > 0;
21460
- const alpha = sprite.alpha;
21461
- const argb = alpha < 1 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);
21462
- array[offset] = argb;
21463
- array[offset + stride] = argb;
21464
- array[offset + stride * 2] = argb;
21465
- array[offset + stride * 3] = argb;
21509
+ const result = Color.shared.setValue(sprite._tintRGB).toPremultiplied(sprite.alpha);
21510
+ array[offset] = result;
21511
+ array[offset + stride] = result;
21512
+ array[offset + stride * 2] = result;
21513
+ array[offset + stride * 3] = result;
21466
21514
  offset += stride * 4;
21467
21515
  }
21468
21516
  }
@@ -22204,24 +22252,12 @@ ${e}`);
22204
22252
  wordWrap: false,
22205
22253
  wordWrapWidth: 100
22206
22254
  };
22207
- function getSingleColor(color) {
22208
- if (typeof color === "number") {
22209
- return hex2string(color);
22210
- } else if (typeof color === "string") {
22211
- if (color.startsWith("0x")) {
22212
- color = color.replace("0x", "#");
22213
- }
22214
- }
22215
- return color;
22216
- }
22217
22255
  function getColor(color) {
22256
+ const temp = Color.shared;
22218
22257
  if (!Array.isArray(color)) {
22219
- return getSingleColor(color);
22258
+ return temp.setValue(color).toHex();
22220
22259
  } else {
22221
- for (let i = 0; i < color.length; ++i) {
22222
- color[i] = getSingleColor(color[i]);
22223
- }
22224
- return color;
22260
+ return color.map((c) => temp.setValue(c).toHex());
22225
22261
  }
22226
22262
  }
22227
22263
  function areArraysEqual(array1, array2) {
@@ -22327,10 +22363,9 @@ ${e}`);
22327
22363
  context.fillStyle = "black";
22328
22364
  context.strokeStyle = "black";
22329
22365
  const dropShadowColor = style.dropShadowColor;
22330
- const rgb = hex2rgb(typeof dropShadowColor === "number" ? dropShadowColor : string2hex(dropShadowColor));
22331
22366
  const dropShadowBlur = style.dropShadowBlur * this._resolution;
22332
22367
  const dropShadowDistance = style.dropShadowDistance * this._resolution;
22333
- context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;
22368
+ context.shadowColor = Color.shared.setValue(dropShadowColor).setAlpha(style.dropShadowAlpha).toRgbaString();
22334
22369
  context.shadowBlur = dropShadowBlur;
22335
22370
  context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;
22336
22371
  context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance + dsOffsetShadow;
@@ -23238,7 +23273,7 @@ ${e}`);
23238
23273
  shader.uniforms.uClampOffset = uv.uClampOffset;
23239
23274
  }
23240
23275
  shader.uniforms.uTransform = tempMat.toArray(true);
23241
- shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, premultiplied);
23276
+ shader.uniforms.uColor = Color.shared.setValue(ts.tint).premultiply(ts.worldAlpha, premultiplied).toArray(shader.uniforms.uColor);
23242
23277
  shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);
23243
23278
  shader.uniforms.uSampler = tex;
23244
23279
  renderer.shader.bind(shader);
@@ -23313,7 +23348,7 @@ ${e}`);
23313
23348
  if (data.trimmed !== false && data.spriteSourceSize) {
23314
23349
  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);
23315
23350
  }
23316
- this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor);
23351
+ this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor, data.borders);
23317
23352
  Texture.addToCache(this.textures[i], i);
23318
23353
  }
23319
23354
  frameIndex++;
@@ -23704,10 +23739,9 @@ ${e}`);
23704
23739
  context.strokeStyle = style.stroke;
23705
23740
  if (style.dropShadow) {
23706
23741
  const dropShadowColor = style.dropShadowColor;
23707
- const rgb = hex2rgb(typeof dropShadowColor === "number" ? dropShadowColor : string2hex(dropShadowColor));
23708
23742
  const dropShadowBlur = style.dropShadowBlur * resolution;
23709
23743
  const dropShadowDistance = style.dropShadowDistance * resolution;
23710
- context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;
23744
+ context.shadowColor = Color.shared.setValue(dropShadowColor).setAlpha(style.dropShadowAlpha).toRgbaString();
23711
23745
  context.shadowBlur = dropShadowBlur;
23712
23746
  context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;
23713
23747
  context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;
@@ -23998,7 +24032,6 @@ ${e}`);
23998
24032
  const _BitmapText = class extends Container {
23999
24033
  constructor(text, style = {}) {
24000
24034
  super();
24001
- this._tint = 16777215;
24002
24035
  const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign({}, _BitmapText.styleDefaults, style);
24003
24036
  if (!BitmapFont.available[fontName]) {
24004
24037
  throw new Error(`Missing BitmapFont "${fontName}"`);
@@ -24007,7 +24040,7 @@ ${e}`);
24007
24040
  this._textWidth = 0;
24008
24041
  this._textHeight = 0;
24009
24042
  this._align = align;
24010
- this._tint = tint;
24043
+ this._tintColor = new Color(tint);
24011
24044
  this._font = void 0;
24012
24045
  this._fontName = fontName;
24013
24046
  this._fontSize = fontSize;
@@ -24169,7 +24202,7 @@ ${e}`);
24169
24202
  const { _textureCache } = this;
24170
24203
  _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);
24171
24204
  pageMeshData.mesh.texture = _textureCache[baseTextureUid];
24172
- pageMeshData.mesh.tint = this._tint;
24205
+ pageMeshData.mesh.tint = this._tintColor.value;
24173
24206
  newPagesMeshData.push(pageMeshData);
24174
24207
  pagesMeshData[baseTextureUid] = pageMeshData;
24175
24208
  }
@@ -24314,12 +24347,12 @@ ${e}`);
24314
24347
  }
24315
24348
  }
24316
24349
  get tint() {
24317
- return this._tint;
24350
+ return this._tintColor.value;
24318
24351
  }
24319
24352
  set tint(value) {
24320
- if (this._tint === value)
24353
+ if (this.tint === value)
24321
24354
  return;
24322
- this._tint = value;
24355
+ this._tintColor.setValue(value);
24323
24356
  for (let i = 0; i < this._activePagesMeshData.length; i++) {
24324
24357
  this._activePagesMeshData[i].mesh.tint = value;
24325
24358
  }
@@ -24444,6 +24477,7 @@ ${e}`);
24444
24477
  delete _textureCache[id];
24445
24478
  }
24446
24479
  this._font = null;
24480
+ this._tintColor = null;
24447
24481
  this._textureCache = null;
24448
24482
  super.destroy(options);
24449
24483
  }
@@ -24493,6 +24527,499 @@ ${e}`);
24493
24527
  };
24494
24528
  extensions$1.add(loadBitmapFont);
24495
24529
 
24530
+ const _HTMLTextStyle = class extends TextStyle {
24531
+ constructor() {
24532
+ super(...arguments);
24533
+ this._fonts = [];
24534
+ this._overrides = [];
24535
+ this._stylesheet = "";
24536
+ this.fontsDirty = false;
24537
+ }
24538
+ static from(originalStyle) {
24539
+ return new _HTMLTextStyle(Object.keys(_HTMLTextStyle.defaultOptions).reduce((obj, prop) => ({ ...obj, [prop]: originalStyle[prop] }), {}));
24540
+ }
24541
+ cleanFonts() {
24542
+ if (this._fonts.length > 0) {
24543
+ this._fonts.forEach((font) => {
24544
+ URL.revokeObjectURL(font.src);
24545
+ font.refs--;
24546
+ if (font.refs === 0) {
24547
+ if (font.fontFace) {
24548
+ document.fonts.delete(font.fontFace);
24549
+ }
24550
+ delete _HTMLTextStyle.availableFonts[font.originalUrl];
24551
+ }
24552
+ });
24553
+ this.fontFamily = "Arial";
24554
+ this._fonts.length = 0;
24555
+ this.styleID++;
24556
+ this.fontsDirty = true;
24557
+ }
24558
+ }
24559
+ loadFont(url, options = {}) {
24560
+ const { availableFonts } = _HTMLTextStyle;
24561
+ if (availableFonts[url]) {
24562
+ const font = availableFonts[url];
24563
+ this._fonts.push(font);
24564
+ font.refs++;
24565
+ this.styleID++;
24566
+ this.fontsDirty = true;
24567
+ return Promise.resolve();
24568
+ }
24569
+ return settings.ADAPTER.fetch(url).then((response) => response.blob()).then(async (blob) => new Promise((resolve, reject) => {
24570
+ const src = URL.createObjectURL(blob);
24571
+ const reader = new FileReader();
24572
+ reader.onload = () => resolve([src, reader.result]);
24573
+ reader.onerror = reject;
24574
+ reader.readAsDataURL(blob);
24575
+ })).then(async ([src, dataSrc]) => {
24576
+ const font = Object.assign({
24577
+ family: path.basename(url, path.extname(url)),
24578
+ weight: "normal",
24579
+ style: "normal",
24580
+ src,
24581
+ dataSrc,
24582
+ refs: 1,
24583
+ originalUrl: url,
24584
+ fontFace: null
24585
+ }, options);
24586
+ availableFonts[url] = font;
24587
+ this._fonts.push(font);
24588
+ this.styleID++;
24589
+ const fontFace = new FontFace(font.family, `url(${font.src})`, {
24590
+ weight: font.weight,
24591
+ style: font.style
24592
+ });
24593
+ font.fontFace = fontFace;
24594
+ await fontFace.load();
24595
+ document.fonts.add(fontFace);
24596
+ await document.fonts.ready;
24597
+ this.styleID++;
24598
+ this.fontsDirty = true;
24599
+ });
24600
+ }
24601
+ addOverride(...value) {
24602
+ const toAdd = value.filter((v) => !this._overrides.includes(v));
24603
+ if (toAdd.length > 0) {
24604
+ this._overrides.push(...toAdd);
24605
+ this.styleID++;
24606
+ }
24607
+ }
24608
+ removeOverride(...value) {
24609
+ const toRemove = value.filter((v) => this._overrides.includes(v));
24610
+ if (toRemove.length > 0) {
24611
+ this._overrides = this._overrides.filter((v) => !toRemove.includes(v));
24612
+ this.styleID++;
24613
+ }
24614
+ }
24615
+ toCSS(scale) {
24616
+ return [
24617
+ "display: inline-block",
24618
+ `color: ${this.normalizeColor(this.fill)}`,
24619
+ `font-size: ${this.fontSize * scale}px`,
24620
+ `font-family: ${this.fontFamily}`,
24621
+ `font-weight: ${this.fontWeight}`,
24622
+ `font-style: ${this.fontStyle}`,
24623
+ `font-variant: ${this.fontVariant}`,
24624
+ `letter-spacing: ${this.letterSpacing * scale}px`,
24625
+ `text-align: ${this.align}`,
24626
+ `padding: ${this.padding * scale}px`,
24627
+ `white-space: ${this.whiteSpace}`,
24628
+ ...this.lineHeight ? [`line-height: ${this.lineHeight * scale}px`] : [],
24629
+ ...this.wordWrap ? [
24630
+ `word-wrap: ${this.breakWords ? "break-all" : "break-word"}`,
24631
+ `max-width: ${this.wordWrapWidth * scale}px`
24632
+ ] : [],
24633
+ ...this.strokeThickness ? [
24634
+ `-webkit-text-stroke-width: ${this.strokeThickness * scale}px`,
24635
+ `-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,
24636
+ `text-stroke-width: ${this.strokeThickness * scale}px`,
24637
+ `text-stroke-color: ${this.normalizeColor(this.stroke)}`,
24638
+ "paint-order: stroke"
24639
+ ] : [],
24640
+ ...this.dropShadow ? [this.dropShadowToCSS(scale)] : [],
24641
+ ...this._overrides
24642
+ ].join(";");
24643
+ }
24644
+ toGlobalCSS() {
24645
+ return this._fonts.reduce((result, font) => `${result}
24646
+ @font-face {
24647
+ font-family: "${font.family}";
24648
+ src: url('${font.dataSrc}');
24649
+ font-weight: ${font.weight};
24650
+ font-style: ${font.style};
24651
+ }`, this._stylesheet);
24652
+ }
24653
+ get stylesheet() {
24654
+ return this._stylesheet;
24655
+ }
24656
+ set stylesheet(value) {
24657
+ if (this._stylesheet !== value) {
24658
+ this._stylesheet = value;
24659
+ this.styleID++;
24660
+ }
24661
+ }
24662
+ normalizeColor(color) {
24663
+ if (Array.isArray(color)) {
24664
+ color = rgb2hex(color);
24665
+ }
24666
+ if (typeof color === "number") {
24667
+ return hex2string(color);
24668
+ }
24669
+ return color;
24670
+ }
24671
+ dropShadowToCSS(scale) {
24672
+ let color = this.normalizeColor(this.dropShadowColor);
24673
+ const alpha = this.dropShadowAlpha;
24674
+ const x = Math.round(Math.cos(this.dropShadowAngle) * this.dropShadowDistance);
24675
+ const y = Math.round(Math.sin(this.dropShadowAngle) * this.dropShadowDistance);
24676
+ if (color.startsWith("#") && alpha < 1) {
24677
+ color += (alpha * 255 | 0).toString(16).padStart(2, "0");
24678
+ }
24679
+ const position = `${x * scale}px ${y * scale}px`;
24680
+ if (this.dropShadowBlur > 0) {
24681
+ return `text-shadow: ${position} ${this.dropShadowBlur}px ${color}`;
24682
+ }
24683
+ return `text-shadow: ${position} ${color}`;
24684
+ }
24685
+ reset() {
24686
+ Object.assign(this, _HTMLTextStyle.defaultOptions);
24687
+ }
24688
+ onBeforeDraw() {
24689
+ const { fontsDirty: prevFontsDirty } = this;
24690
+ this.fontsDirty = false;
24691
+ if (this.isSafari && this._fonts.length > 0 && prevFontsDirty) {
24692
+ return new Promise((resolve) => setTimeout(resolve, 100));
24693
+ }
24694
+ return Promise.resolve();
24695
+ }
24696
+ get isSafari() {
24697
+ const { userAgent } = settings.ADAPTER.getNavigator();
24698
+ return /^((?!chrome|android).)*safari/i.test(userAgent);
24699
+ }
24700
+ set fillGradientStops(_value) {
24701
+ console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText");
24702
+ }
24703
+ get fillGradientStops() {
24704
+ return super.fillGradientStops;
24705
+ }
24706
+ set fillGradientType(_value) {
24707
+ console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText");
24708
+ }
24709
+ get fillGradientType() {
24710
+ return super.fillGradientType;
24711
+ }
24712
+ set miterLimit(_value) {
24713
+ console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText");
24714
+ }
24715
+ get miterLimit() {
24716
+ return super.miterLimit;
24717
+ }
24718
+ set trim(_value) {
24719
+ console.warn("[HTMLTextStyle] trim is not supported by HTMLText");
24720
+ }
24721
+ get trim() {
24722
+ return super.trim;
24723
+ }
24724
+ set textBaseline(_value) {
24725
+ console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText");
24726
+ }
24727
+ get textBaseline() {
24728
+ return super.textBaseline;
24729
+ }
24730
+ set leading(_value) {
24731
+ console.warn("[HTMLTextStyle] leading is not supported by HTMLText");
24732
+ }
24733
+ get leading() {
24734
+ return super.leading;
24735
+ }
24736
+ set lineJoin(_value) {
24737
+ console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText");
24738
+ }
24739
+ get lineJoin() {
24740
+ return super.lineJoin;
24741
+ }
24742
+ };
24743
+ let HTMLTextStyle = _HTMLTextStyle;
24744
+ HTMLTextStyle.availableFonts = {};
24745
+ HTMLTextStyle.defaultOptions = {
24746
+ align: "left",
24747
+ breakWords: false,
24748
+ dropShadow: false,
24749
+ dropShadowAlpha: 1,
24750
+ dropShadowAngle: Math.PI / 6,
24751
+ dropShadowBlur: 0,
24752
+ dropShadowColor: "black",
24753
+ dropShadowDistance: 5,
24754
+ fill: "black",
24755
+ fontFamily: "Arial",
24756
+ fontSize: 26,
24757
+ fontStyle: "normal",
24758
+ fontVariant: "normal",
24759
+ fontWeight: "normal",
24760
+ letterSpacing: 0,
24761
+ lineHeight: 0,
24762
+ padding: 0,
24763
+ stroke: "black",
24764
+ strokeThickness: 0,
24765
+ whiteSpace: "normal",
24766
+ wordWrap: false,
24767
+ wordWrapWidth: 100
24768
+ };
24769
+
24770
+ const _HTMLText = class extends Sprite {
24771
+ constructor(text = "", style = {}) {
24772
+ super(Texture.EMPTY);
24773
+ this._text = null;
24774
+ this._style = null;
24775
+ this._autoResolution = true;
24776
+ this._loading = false;
24777
+ this.localStyleID = -1;
24778
+ this.dirty = false;
24779
+ this.ownsStyle = false;
24780
+ const image = new Image();
24781
+ const texture = Texture.from(image, {
24782
+ scaleMode: settings.SCALE_MODE,
24783
+ resourceOptions: {
24784
+ autoLoad: false
24785
+ }
24786
+ });
24787
+ texture.orig = new Rectangle();
24788
+ texture.trim = new Rectangle();
24789
+ this.texture = texture;
24790
+ const nssvg = "http://www.w3.org/2000/svg";
24791
+ const nsxhtml = "http://www.w3.org/1999/xhtml";
24792
+ const svgRoot = document.createElementNS(nssvg, "svg");
24793
+ const foreignObject = document.createElementNS(nssvg, "foreignObject");
24794
+ const domElement = document.createElementNS(nsxhtml, "div");
24795
+ const styleElement = document.createElementNS(nsxhtml, "style");
24796
+ foreignObject.setAttribute("width", "10000");
24797
+ foreignObject.setAttribute("height", "10000");
24798
+ foreignObject.style.overflow = "hidden";
24799
+ svgRoot.appendChild(foreignObject);
24800
+ this.maxWidth = _HTMLText.defaultMaxWidth;
24801
+ this.maxHeight = _HTMLText.defaultMaxHeight;
24802
+ this._domElement = domElement;
24803
+ this._styleElement = styleElement;
24804
+ this._svgRoot = svgRoot;
24805
+ this._foreignObject = foreignObject;
24806
+ this._foreignObject.appendChild(styleElement);
24807
+ this._foreignObject.appendChild(domElement);
24808
+ this._image = image;
24809
+ this._loadImage = new Image();
24810
+ this._autoResolution = _HTMLText.defaultAutoResolution;
24811
+ this._resolution = _HTMLText.defaultResolution ?? settings.RESOLUTION;
24812
+ this.text = text;
24813
+ this.style = style;
24814
+ }
24815
+ measureText(overrides) {
24816
+ const { text, style, resolution } = Object.assign({
24817
+ text: this._text,
24818
+ style: this._style,
24819
+ resolution: this._resolution
24820
+ }, overrides);
24821
+ Object.assign(this._domElement, {
24822
+ innerHTML: text,
24823
+ style: style.toCSS(resolution)
24824
+ });
24825
+ this._styleElement.textContent = style.toGlobalCSS();
24826
+ document.body.appendChild(this._svgRoot);
24827
+ const contentBounds = this._domElement.getBoundingClientRect();
24828
+ this._svgRoot.remove();
24829
+ const contentWidth = Math.min(this.maxWidth, Math.ceil(contentBounds.width));
24830
+ const contentHeight = Math.min(this.maxHeight, Math.ceil(contentBounds.height));
24831
+ this._svgRoot.setAttribute("width", contentWidth.toString());
24832
+ this._svgRoot.setAttribute("height", contentHeight.toString());
24833
+ if (text !== this._text) {
24834
+ this._domElement.innerHTML = this._text;
24835
+ }
24836
+ if (style !== this._style) {
24837
+ Object.assign(this._domElement, { style: this._style?.toCSS(resolution) });
24838
+ this._styleElement.textContent = this._style?.toGlobalCSS();
24839
+ }
24840
+ return {
24841
+ width: contentWidth + style.padding * 2,
24842
+ height: contentHeight + style.padding * 2
24843
+ };
24844
+ }
24845
+ async updateText(respectDirty = true) {
24846
+ const { style, _image: image, _loadImage: loadImage } = this;
24847
+ if (this.localStyleID !== style.styleID) {
24848
+ this.dirty = true;
24849
+ this.localStyleID = style.styleID;
24850
+ }
24851
+ if (!this.dirty && respectDirty) {
24852
+ return;
24853
+ }
24854
+ const { width, height } = this.measureText();
24855
+ image.width = loadImage.width = Math.ceil(Math.max(1, width));
24856
+ image.height = loadImage.height = Math.ceil(Math.max(1, height));
24857
+ if (!this._loading) {
24858
+ this._loading = true;
24859
+ await new Promise((resolve) => {
24860
+ loadImage.onload = async () => {
24861
+ await style.onBeforeDraw();
24862
+ this._loading = false;
24863
+ image.src = loadImage.src;
24864
+ loadImage.onload = null;
24865
+ loadImage.src = "";
24866
+ this.updateTexture();
24867
+ resolve();
24868
+ };
24869
+ const svgURL = new XMLSerializer().serializeToString(this._svgRoot);
24870
+ loadImage.src = `data:image/svg+xml;charset=utf8,${encodeURIComponent(svgURL)}`;
24871
+ });
24872
+ }
24873
+ }
24874
+ get source() {
24875
+ return this._image;
24876
+ }
24877
+ updateTexture() {
24878
+ const { style, texture, _image: image, resolution } = this;
24879
+ const { padding } = style;
24880
+ const { baseTexture } = texture;
24881
+ texture.trim.width = texture._frame.width = image.width / resolution;
24882
+ texture.trim.height = texture._frame.height = image.height / resolution;
24883
+ texture.trim.x = -padding;
24884
+ texture.trim.y = -padding;
24885
+ texture.orig.width = texture._frame.width - padding * 2;
24886
+ texture.orig.height = texture._frame.height - padding * 2;
24887
+ this._onTextureUpdate();
24888
+ baseTexture.setRealSize(image.width, image.height, resolution);
24889
+ this.dirty = false;
24890
+ }
24891
+ _render(renderer) {
24892
+ if (this._autoResolution && this._resolution !== renderer.resolution) {
24893
+ this._resolution = renderer.resolution;
24894
+ this.dirty = true;
24895
+ }
24896
+ this.updateText(true);
24897
+ super._render(renderer);
24898
+ }
24899
+ _renderCanvas(renderer) {
24900
+ if (this._autoResolution && this._resolution !== renderer.resolution) {
24901
+ this._resolution = renderer.resolution;
24902
+ this.dirty = true;
24903
+ }
24904
+ this.updateText(true);
24905
+ super._renderCanvas(renderer);
24906
+ }
24907
+ getLocalBounds(rect) {
24908
+ this.updateText(true);
24909
+ return super.getLocalBounds(rect);
24910
+ }
24911
+ _calculateBounds() {
24912
+ this.updateText(true);
24913
+ this.calculateVertices();
24914
+ this._bounds.addQuad(this.vertexData);
24915
+ }
24916
+ _onStyleChange() {
24917
+ this.dirty = true;
24918
+ }
24919
+ destroy(options) {
24920
+ if (typeof options === "boolean") {
24921
+ options = { children: options };
24922
+ }
24923
+ options = Object.assign({}, _HTMLText.defaultDestroyOptions, options);
24924
+ super.destroy(options);
24925
+ const forceClear = null;
24926
+ if (this.ownsStyle) {
24927
+ this._style?.cleanFonts();
24928
+ }
24929
+ this._style = forceClear;
24930
+ this._svgRoot?.remove();
24931
+ this._svgRoot = forceClear;
24932
+ this._domElement?.remove();
24933
+ this._domElement = forceClear;
24934
+ this._foreignObject?.remove();
24935
+ this._foreignObject = forceClear;
24936
+ this._styleElement?.remove();
24937
+ this._styleElement = forceClear;
24938
+ this._loadImage.src = "";
24939
+ this._loadImage.onload = null;
24940
+ this._loadImage = forceClear;
24941
+ this._image.src = "";
24942
+ this._image = forceClear;
24943
+ }
24944
+ get width() {
24945
+ this.updateText(true);
24946
+ return Math.abs(this.scale.x) * this._image.width / this.resolution;
24947
+ }
24948
+ set width(value) {
24949
+ this.updateText(true);
24950
+ const s = sign(this.scale.x) || 1;
24951
+ this.scale.x = s * value / this._image.width / this.resolution;
24952
+ this._width = value;
24953
+ }
24954
+ get height() {
24955
+ this.updateText(true);
24956
+ return Math.abs(this.scale.y) * this._image.height / this.resolution;
24957
+ }
24958
+ set height(value) {
24959
+ this.updateText(true);
24960
+ const s = sign(this.scale.y) || 1;
24961
+ this.scale.y = s * value / this._image.height / this.resolution;
24962
+ this._height = value;
24963
+ }
24964
+ get style() {
24965
+ return this._style;
24966
+ }
24967
+ set style(style) {
24968
+ if (this._style === style) {
24969
+ return;
24970
+ }
24971
+ style = style || {};
24972
+ if (style instanceof HTMLTextStyle) {
24973
+ this.ownsStyle = false;
24974
+ this._style = style;
24975
+ } else if (style instanceof TextStyle) {
24976
+ console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle");
24977
+ this.ownsStyle = true;
24978
+ this._style = HTMLTextStyle.from(style);
24979
+ } else {
24980
+ this.ownsStyle = true;
24981
+ this._style = new HTMLTextStyle(style);
24982
+ }
24983
+ this.localStyleID = -1;
24984
+ this.dirty = true;
24985
+ }
24986
+ get text() {
24987
+ return this._text;
24988
+ }
24989
+ set text(text) {
24990
+ text = String(text === "" || text === null || text === void 0 ? " " : text);
24991
+ text = this.sanitiseText(text);
24992
+ if (this._text === text) {
24993
+ return;
24994
+ }
24995
+ this._text = text;
24996
+ this.dirty = true;
24997
+ }
24998
+ get resolution() {
24999
+ return this._resolution;
25000
+ }
25001
+ set resolution(value) {
25002
+ this._autoResolution = false;
25003
+ if (this._resolution === value) {
25004
+ return;
25005
+ }
25006
+ this._resolution = value;
25007
+ this.dirty = true;
25008
+ }
25009
+ sanitiseText(text) {
25010
+ return text.replace(/<br>/gi, "<br/>").replace(/<hr>/gi, "<hr/>").replace(/&nbsp;/gi, "&#160;");
25011
+ }
25012
+ };
25013
+ let HTMLText = _HTMLText;
25014
+ HTMLText.defaultDestroyOptions = {
25015
+ texture: true,
25016
+ children: false,
25017
+ baseTexture: true
25018
+ };
25019
+ HTMLText.defaultMaxWidth = 2024;
25020
+ HTMLText.defaultMaxHeight = 2024;
25021
+ HTMLText.defaultAutoResolution = true;
25022
+
24496
25023
  exports.ALPHA_MODES = ALPHA_MODES;
24497
25024
  exports.AbstractMultiResource = AbstractMultiResource;
24498
25025
  exports.AccessibilityManager = AccessibilityManager;
@@ -24533,6 +25060,7 @@ ${e}`);
24533
25060
  exports.Cache = Cache;
24534
25061
  exports.CanvasResource = CanvasResource;
24535
25062
  exports.Circle = Circle;
25063
+ exports.Color = Color;
24536
25064
  exports.ColorMatrixFilter = ColorMatrixFilter;
24537
25065
  exports.CompressedTextureResource = CompressedTextureResource;
24538
25066
  exports.Container = Container;
@@ -24574,6 +25102,8 @@ ${e}`);
24574
25102
  exports.Graphics = Graphics;
24575
25103
  exports.GraphicsData = GraphicsData;
24576
25104
  exports.GraphicsGeometry = GraphicsGeometry;
25105
+ exports.HTMLText = HTMLText;
25106
+ exports.HTMLTextStyle = HTMLTextStyle;
24577
25107
  exports.IGLUniformData = IGLUniformData;
24578
25108
  exports.INSTALLED = INSTALLED;
24579
25109
  exports.INTERNAL_FORMATS = INTERNAL_FORMATS;