babel-plugin-react-compiler 19.0.0-beta-63e3235-20250105 → 19.0.0-beta-decd7b8-20250118
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/index.js +145 -1011
- package/dist/index.js.map +4 -4
- package/package.json +1 -2
package/dist/index.js
CHANGED
@@ -45200,9 +45200,9 @@ var require_escape_string_regexp = __commonJS({
|
|
45200
45200
|
}
|
45201
45201
|
});
|
45202
45202
|
|
45203
|
-
// ../../node_modules
|
45203
|
+
// ../../node_modules/color-convert/node_modules/color-name/index.js
|
45204
45204
|
var require_color_name = __commonJS({
|
45205
|
-
"../../node_modules
|
45205
|
+
"../../node_modules/color-convert/node_modules/color-name/index.js"(exports2, module2) {
|
45206
45206
|
"use strict";
|
45207
45207
|
module2.exports = {
|
45208
45208
|
"aliceblue": [240, 248, 255],
|
@@ -45357,9 +45357,9 @@ var require_color_name = __commonJS({
|
|
45357
45357
|
}
|
45358
45358
|
});
|
45359
45359
|
|
45360
|
-
// ../../node_modules
|
45360
|
+
// ../../node_modules/color-convert/conversions.js
|
45361
45361
|
var require_conversions = __commonJS({
|
45362
|
-
"../../node_modules
|
45362
|
+
"../../node_modules/color-convert/conversions.js"(exports2, module2) {
|
45363
45363
|
var cssKeywords = require_color_name();
|
45364
45364
|
var reverseKeywords = {};
|
45365
45365
|
for (key in cssKeywords) {
|
@@ -46070,9 +46070,9 @@ var require_conversions = __commonJS({
|
|
46070
46070
|
}
|
46071
46071
|
});
|
46072
46072
|
|
46073
|
-
// ../../node_modules
|
46073
|
+
// ../../node_modules/color-convert/route.js
|
46074
46074
|
var require_route = __commonJS({
|
46075
|
-
"../../node_modules
|
46075
|
+
"../../node_modules/color-convert/route.js"(exports2, module2) {
|
46076
46076
|
var conversions = require_conversions();
|
46077
46077
|
function buildGraph() {
|
46078
46078
|
var graph = {};
|
@@ -46140,9 +46140,9 @@ var require_route = __commonJS({
|
|
46140
46140
|
}
|
46141
46141
|
});
|
46142
46142
|
|
46143
|
-
// ../../node_modules
|
46143
|
+
// ../../node_modules/color-convert/index.js
|
46144
46144
|
var require_color_convert = __commonJS({
|
46145
|
-
"../../node_modules
|
46145
|
+
"../../node_modules/color-convert/index.js"(exports2, module2) {
|
46146
46146
|
var conversions = require_conversions();
|
46147
46147
|
var route = require_route();
|
46148
46148
|
var convert = {};
|
@@ -58386,1010 +58386,11 @@ var require_escape_string_regexp2 = __commonJS({
|
|
58386
58386
|
}
|
58387
58387
|
});
|
58388
58388
|
|
58389
|
-
// node_modules/color-name/index.js
|
58390
|
-
var require_color_name2 = __commonJS({
|
58391
|
-
"node_modules/color-name/index.js"(exports2, module2) {
|
58392
|
-
"use strict";
|
58393
|
-
module2.exports = {
|
58394
|
-
"aliceblue": [240, 248, 255],
|
58395
|
-
"antiquewhite": [250, 235, 215],
|
58396
|
-
"aqua": [0, 255, 255],
|
58397
|
-
"aquamarine": [127, 255, 212],
|
58398
|
-
"azure": [240, 255, 255],
|
58399
|
-
"beige": [245, 245, 220],
|
58400
|
-
"bisque": [255, 228, 196],
|
58401
|
-
"black": [0, 0, 0],
|
58402
|
-
"blanchedalmond": [255, 235, 205],
|
58403
|
-
"blue": [0, 0, 255],
|
58404
|
-
"blueviolet": [138, 43, 226],
|
58405
|
-
"brown": [165, 42, 42],
|
58406
|
-
"burlywood": [222, 184, 135],
|
58407
|
-
"cadetblue": [95, 158, 160],
|
58408
|
-
"chartreuse": [127, 255, 0],
|
58409
|
-
"chocolate": [210, 105, 30],
|
58410
|
-
"coral": [255, 127, 80],
|
58411
|
-
"cornflowerblue": [100, 149, 237],
|
58412
|
-
"cornsilk": [255, 248, 220],
|
58413
|
-
"crimson": [220, 20, 60],
|
58414
|
-
"cyan": [0, 255, 255],
|
58415
|
-
"darkblue": [0, 0, 139],
|
58416
|
-
"darkcyan": [0, 139, 139],
|
58417
|
-
"darkgoldenrod": [184, 134, 11],
|
58418
|
-
"darkgray": [169, 169, 169],
|
58419
|
-
"darkgreen": [0, 100, 0],
|
58420
|
-
"darkgrey": [169, 169, 169],
|
58421
|
-
"darkkhaki": [189, 183, 107],
|
58422
|
-
"darkmagenta": [139, 0, 139],
|
58423
|
-
"darkolivegreen": [85, 107, 47],
|
58424
|
-
"darkorange": [255, 140, 0],
|
58425
|
-
"darkorchid": [153, 50, 204],
|
58426
|
-
"darkred": [139, 0, 0],
|
58427
|
-
"darksalmon": [233, 150, 122],
|
58428
|
-
"darkseagreen": [143, 188, 143],
|
58429
|
-
"darkslateblue": [72, 61, 139],
|
58430
|
-
"darkslategray": [47, 79, 79],
|
58431
|
-
"darkslategrey": [47, 79, 79],
|
58432
|
-
"darkturquoise": [0, 206, 209],
|
58433
|
-
"darkviolet": [148, 0, 211],
|
58434
|
-
"deeppink": [255, 20, 147],
|
58435
|
-
"deepskyblue": [0, 191, 255],
|
58436
|
-
"dimgray": [105, 105, 105],
|
58437
|
-
"dimgrey": [105, 105, 105],
|
58438
|
-
"dodgerblue": [30, 144, 255],
|
58439
|
-
"firebrick": [178, 34, 34],
|
58440
|
-
"floralwhite": [255, 250, 240],
|
58441
|
-
"forestgreen": [34, 139, 34],
|
58442
|
-
"fuchsia": [255, 0, 255],
|
58443
|
-
"gainsboro": [220, 220, 220],
|
58444
|
-
"ghostwhite": [248, 248, 255],
|
58445
|
-
"gold": [255, 215, 0],
|
58446
|
-
"goldenrod": [218, 165, 32],
|
58447
|
-
"gray": [128, 128, 128],
|
58448
|
-
"green": [0, 128, 0],
|
58449
|
-
"greenyellow": [173, 255, 47],
|
58450
|
-
"grey": [128, 128, 128],
|
58451
|
-
"honeydew": [240, 255, 240],
|
58452
|
-
"hotpink": [255, 105, 180],
|
58453
|
-
"indianred": [205, 92, 92],
|
58454
|
-
"indigo": [75, 0, 130],
|
58455
|
-
"ivory": [255, 255, 240],
|
58456
|
-
"khaki": [240, 230, 140],
|
58457
|
-
"lavender": [230, 230, 250],
|
58458
|
-
"lavenderblush": [255, 240, 245],
|
58459
|
-
"lawngreen": [124, 252, 0],
|
58460
|
-
"lemonchiffon": [255, 250, 205],
|
58461
|
-
"lightblue": [173, 216, 230],
|
58462
|
-
"lightcoral": [240, 128, 128],
|
58463
|
-
"lightcyan": [224, 255, 255],
|
58464
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
58465
|
-
"lightgray": [211, 211, 211],
|
58466
|
-
"lightgreen": [144, 238, 144],
|
58467
|
-
"lightgrey": [211, 211, 211],
|
58468
|
-
"lightpink": [255, 182, 193],
|
58469
|
-
"lightsalmon": [255, 160, 122],
|
58470
|
-
"lightseagreen": [32, 178, 170],
|
58471
|
-
"lightskyblue": [135, 206, 250],
|
58472
|
-
"lightslategray": [119, 136, 153],
|
58473
|
-
"lightslategrey": [119, 136, 153],
|
58474
|
-
"lightsteelblue": [176, 196, 222],
|
58475
|
-
"lightyellow": [255, 255, 224],
|
58476
|
-
"lime": [0, 255, 0],
|
58477
|
-
"limegreen": [50, 205, 50],
|
58478
|
-
"linen": [250, 240, 230],
|
58479
|
-
"magenta": [255, 0, 255],
|
58480
|
-
"maroon": [128, 0, 0],
|
58481
|
-
"mediumaquamarine": [102, 205, 170],
|
58482
|
-
"mediumblue": [0, 0, 205],
|
58483
|
-
"mediumorchid": [186, 85, 211],
|
58484
|
-
"mediumpurple": [147, 112, 219],
|
58485
|
-
"mediumseagreen": [60, 179, 113],
|
58486
|
-
"mediumslateblue": [123, 104, 238],
|
58487
|
-
"mediumspringgreen": [0, 250, 154],
|
58488
|
-
"mediumturquoise": [72, 209, 204],
|
58489
|
-
"mediumvioletred": [199, 21, 133],
|
58490
|
-
"midnightblue": [25, 25, 112],
|
58491
|
-
"mintcream": [245, 255, 250],
|
58492
|
-
"mistyrose": [255, 228, 225],
|
58493
|
-
"moccasin": [255, 228, 181],
|
58494
|
-
"navajowhite": [255, 222, 173],
|
58495
|
-
"navy": [0, 0, 128],
|
58496
|
-
"oldlace": [253, 245, 230],
|
58497
|
-
"olive": [128, 128, 0],
|
58498
|
-
"olivedrab": [107, 142, 35],
|
58499
|
-
"orange": [255, 165, 0],
|
58500
|
-
"orangered": [255, 69, 0],
|
58501
|
-
"orchid": [218, 112, 214],
|
58502
|
-
"palegoldenrod": [238, 232, 170],
|
58503
|
-
"palegreen": [152, 251, 152],
|
58504
|
-
"paleturquoise": [175, 238, 238],
|
58505
|
-
"palevioletred": [219, 112, 147],
|
58506
|
-
"papayawhip": [255, 239, 213],
|
58507
|
-
"peachpuff": [255, 218, 185],
|
58508
|
-
"peru": [205, 133, 63],
|
58509
|
-
"pink": [255, 192, 203],
|
58510
|
-
"plum": [221, 160, 221],
|
58511
|
-
"powderblue": [176, 224, 230],
|
58512
|
-
"purple": [128, 0, 128],
|
58513
|
-
"rebeccapurple": [102, 51, 153],
|
58514
|
-
"red": [255, 0, 0],
|
58515
|
-
"rosybrown": [188, 143, 143],
|
58516
|
-
"royalblue": [65, 105, 225],
|
58517
|
-
"saddlebrown": [139, 69, 19],
|
58518
|
-
"salmon": [250, 128, 114],
|
58519
|
-
"sandybrown": [244, 164, 96],
|
58520
|
-
"seagreen": [46, 139, 87],
|
58521
|
-
"seashell": [255, 245, 238],
|
58522
|
-
"sienna": [160, 82, 45],
|
58523
|
-
"silver": [192, 192, 192],
|
58524
|
-
"skyblue": [135, 206, 235],
|
58525
|
-
"slateblue": [106, 90, 205],
|
58526
|
-
"slategray": [112, 128, 144],
|
58527
|
-
"slategrey": [112, 128, 144],
|
58528
|
-
"snow": [255, 250, 250],
|
58529
|
-
"springgreen": [0, 255, 127],
|
58530
|
-
"steelblue": [70, 130, 180],
|
58531
|
-
"tan": [210, 180, 140],
|
58532
|
-
"teal": [0, 128, 128],
|
58533
|
-
"thistle": [216, 191, 216],
|
58534
|
-
"tomato": [255, 99, 71],
|
58535
|
-
"turquoise": [64, 224, 208],
|
58536
|
-
"violet": [238, 130, 238],
|
58537
|
-
"wheat": [245, 222, 179],
|
58538
|
-
"white": [255, 255, 255],
|
58539
|
-
"whitesmoke": [245, 245, 245],
|
58540
|
-
"yellow": [255, 255, 0],
|
58541
|
-
"yellowgreen": [154, 205, 50]
|
58542
|
-
};
|
58543
|
-
}
|
58544
|
-
});
|
58545
|
-
|
58546
|
-
// node_modules/color-convert/conversions.js
|
58547
|
-
var require_conversions2 = __commonJS({
|
58548
|
-
"node_modules/color-convert/conversions.js"(exports2, module2) {
|
58549
|
-
var cssKeywords = require_color_name2();
|
58550
|
-
var reverseKeywords = {};
|
58551
|
-
for (key in cssKeywords) {
|
58552
|
-
if (cssKeywords.hasOwnProperty(key)) {
|
58553
|
-
reverseKeywords[cssKeywords[key]] = key;
|
58554
|
-
}
|
58555
|
-
}
|
58556
|
-
var key;
|
58557
|
-
var convert = module2.exports = {
|
58558
|
-
rgb: { channels: 3, labels: "rgb" },
|
58559
|
-
hsl: { channels: 3, labels: "hsl" },
|
58560
|
-
hsv: { channels: 3, labels: "hsv" },
|
58561
|
-
hwb: { channels: 3, labels: "hwb" },
|
58562
|
-
cmyk: { channels: 4, labels: "cmyk" },
|
58563
|
-
xyz: { channels: 3, labels: "xyz" },
|
58564
|
-
lab: { channels: 3, labels: "lab" },
|
58565
|
-
lch: { channels: 3, labels: "lch" },
|
58566
|
-
hex: { channels: 1, labels: ["hex"] },
|
58567
|
-
keyword: { channels: 1, labels: ["keyword"] },
|
58568
|
-
ansi16: { channels: 1, labels: ["ansi16"] },
|
58569
|
-
ansi256: { channels: 1, labels: ["ansi256"] },
|
58570
|
-
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
58571
|
-
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
58572
|
-
gray: { channels: 1, labels: ["gray"] }
|
58573
|
-
};
|
58574
|
-
for (model in convert) {
|
58575
|
-
if (convert.hasOwnProperty(model)) {
|
58576
|
-
if (!("channels" in convert[model])) {
|
58577
|
-
throw new Error("missing channels property: " + model);
|
58578
|
-
}
|
58579
|
-
if (!("labels" in convert[model])) {
|
58580
|
-
throw new Error("missing channel labels property: " + model);
|
58581
|
-
}
|
58582
|
-
if (convert[model].labels.length !== convert[model].channels) {
|
58583
|
-
throw new Error("channel and label counts mismatch: " + model);
|
58584
|
-
}
|
58585
|
-
channels = convert[model].channels;
|
58586
|
-
labels = convert[model].labels;
|
58587
|
-
delete convert[model].channels;
|
58588
|
-
delete convert[model].labels;
|
58589
|
-
Object.defineProperty(convert[model], "channels", { value: channels });
|
58590
|
-
Object.defineProperty(convert[model], "labels", { value: labels });
|
58591
|
-
}
|
58592
|
-
}
|
58593
|
-
var channels;
|
58594
|
-
var labels;
|
58595
|
-
var model;
|
58596
|
-
convert.rgb.hsl = function(rgb) {
|
58597
|
-
var r = rgb[0] / 255;
|
58598
|
-
var g = rgb[1] / 255;
|
58599
|
-
var b = rgb[2] / 255;
|
58600
|
-
var min = Math.min(r, g, b);
|
58601
|
-
var max = Math.max(r, g, b);
|
58602
|
-
var delta = max - min;
|
58603
|
-
var h;
|
58604
|
-
var s;
|
58605
|
-
var l;
|
58606
|
-
if (max === min) {
|
58607
|
-
h = 0;
|
58608
|
-
} else if (r === max) {
|
58609
|
-
h = (g - b) / delta;
|
58610
|
-
} else if (g === max) {
|
58611
|
-
h = 2 + (b - r) / delta;
|
58612
|
-
} else if (b === max) {
|
58613
|
-
h = 4 + (r - g) / delta;
|
58614
|
-
}
|
58615
|
-
h = Math.min(h * 60, 360);
|
58616
|
-
if (h < 0) {
|
58617
|
-
h += 360;
|
58618
|
-
}
|
58619
|
-
l = (min + max) / 2;
|
58620
|
-
if (max === min) {
|
58621
|
-
s = 0;
|
58622
|
-
} else if (l <= 0.5) {
|
58623
|
-
s = delta / (max + min);
|
58624
|
-
} else {
|
58625
|
-
s = delta / (2 - max - min);
|
58626
|
-
}
|
58627
|
-
return [h, s * 100, l * 100];
|
58628
|
-
};
|
58629
|
-
convert.rgb.hsv = function(rgb) {
|
58630
|
-
var rdif;
|
58631
|
-
var gdif;
|
58632
|
-
var bdif;
|
58633
|
-
var h;
|
58634
|
-
var s;
|
58635
|
-
var r = rgb[0] / 255;
|
58636
|
-
var g = rgb[1] / 255;
|
58637
|
-
var b = rgb[2] / 255;
|
58638
|
-
var v = Math.max(r, g, b);
|
58639
|
-
var diff = v - Math.min(r, g, b);
|
58640
|
-
var diffc = function(c) {
|
58641
|
-
return (v - c) / 6 / diff + 1 / 2;
|
58642
|
-
};
|
58643
|
-
if (diff === 0) {
|
58644
|
-
h = s = 0;
|
58645
|
-
} else {
|
58646
|
-
s = diff / v;
|
58647
|
-
rdif = diffc(r);
|
58648
|
-
gdif = diffc(g);
|
58649
|
-
bdif = diffc(b);
|
58650
|
-
if (r === v) {
|
58651
|
-
h = bdif - gdif;
|
58652
|
-
} else if (g === v) {
|
58653
|
-
h = 1 / 3 + rdif - bdif;
|
58654
|
-
} else if (b === v) {
|
58655
|
-
h = 2 / 3 + gdif - rdif;
|
58656
|
-
}
|
58657
|
-
if (h < 0) {
|
58658
|
-
h += 1;
|
58659
|
-
} else if (h > 1) {
|
58660
|
-
h -= 1;
|
58661
|
-
}
|
58662
|
-
}
|
58663
|
-
return [
|
58664
|
-
h * 360,
|
58665
|
-
s * 100,
|
58666
|
-
v * 100
|
58667
|
-
];
|
58668
|
-
};
|
58669
|
-
convert.rgb.hwb = function(rgb) {
|
58670
|
-
var r = rgb[0];
|
58671
|
-
var g = rgb[1];
|
58672
|
-
var b = rgb[2];
|
58673
|
-
var h = convert.rgb.hsl(rgb)[0];
|
58674
|
-
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
58675
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
58676
|
-
return [h, w * 100, b * 100];
|
58677
|
-
};
|
58678
|
-
convert.rgb.cmyk = function(rgb) {
|
58679
|
-
var r = rgb[0] / 255;
|
58680
|
-
var g = rgb[1] / 255;
|
58681
|
-
var b = rgb[2] / 255;
|
58682
|
-
var c;
|
58683
|
-
var m;
|
58684
|
-
var y;
|
58685
|
-
var k;
|
58686
|
-
k = Math.min(1 - r, 1 - g, 1 - b);
|
58687
|
-
c = (1 - r - k) / (1 - k) || 0;
|
58688
|
-
m = (1 - g - k) / (1 - k) || 0;
|
58689
|
-
y = (1 - b - k) / (1 - k) || 0;
|
58690
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
58691
|
-
};
|
58692
|
-
function comparativeDistance(x, y) {
|
58693
|
-
return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
|
58694
|
-
}
|
58695
|
-
convert.rgb.keyword = function(rgb) {
|
58696
|
-
var reversed = reverseKeywords[rgb];
|
58697
|
-
if (reversed) {
|
58698
|
-
return reversed;
|
58699
|
-
}
|
58700
|
-
var currentClosestDistance = Infinity;
|
58701
|
-
var currentClosestKeyword;
|
58702
|
-
for (var keyword in cssKeywords) {
|
58703
|
-
if (cssKeywords.hasOwnProperty(keyword)) {
|
58704
|
-
var value = cssKeywords[keyword];
|
58705
|
-
var distance = comparativeDistance(rgb, value);
|
58706
|
-
if (distance < currentClosestDistance) {
|
58707
|
-
currentClosestDistance = distance;
|
58708
|
-
currentClosestKeyword = keyword;
|
58709
|
-
}
|
58710
|
-
}
|
58711
|
-
}
|
58712
|
-
return currentClosestKeyword;
|
58713
|
-
};
|
58714
|
-
convert.keyword.rgb = function(keyword) {
|
58715
|
-
return cssKeywords[keyword];
|
58716
|
-
};
|
58717
|
-
convert.rgb.xyz = function(rgb) {
|
58718
|
-
var r = rgb[0] / 255;
|
58719
|
-
var g = rgb[1] / 255;
|
58720
|
-
var b = rgb[2] / 255;
|
58721
|
-
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
58722
|
-
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
58723
|
-
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
58724
|
-
var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
58725
|
-
var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
58726
|
-
var z2 = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
58727
|
-
return [x * 100, y * 100, z2 * 100];
|
58728
|
-
};
|
58729
|
-
convert.rgb.lab = function(rgb) {
|
58730
|
-
var xyz = convert.rgb.xyz(rgb);
|
58731
|
-
var x = xyz[0];
|
58732
|
-
var y = xyz[1];
|
58733
|
-
var z2 = xyz[2];
|
58734
|
-
var l;
|
58735
|
-
var a;
|
58736
|
-
var b;
|
58737
|
-
x /= 95.047;
|
58738
|
-
y /= 100;
|
58739
|
-
z2 /= 108.883;
|
58740
|
-
x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
58741
|
-
y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
58742
|
-
z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
|
58743
|
-
l = 116 * y - 16;
|
58744
|
-
a = 500 * (x - y);
|
58745
|
-
b = 200 * (y - z2);
|
58746
|
-
return [l, a, b];
|
58747
|
-
};
|
58748
|
-
convert.hsl.rgb = function(hsl) {
|
58749
|
-
var h = hsl[0] / 360;
|
58750
|
-
var s = hsl[1] / 100;
|
58751
|
-
var l = hsl[2] / 100;
|
58752
|
-
var t1;
|
58753
|
-
var t22;
|
58754
|
-
var t32;
|
58755
|
-
var rgb;
|
58756
|
-
var val;
|
58757
|
-
if (s === 0) {
|
58758
|
-
val = l * 255;
|
58759
|
-
return [val, val, val];
|
58760
|
-
}
|
58761
|
-
if (l < 0.5) {
|
58762
|
-
t22 = l * (1 + s);
|
58763
|
-
} else {
|
58764
|
-
t22 = l + s - l * s;
|
58765
|
-
}
|
58766
|
-
t1 = 2 * l - t22;
|
58767
|
-
rgb = [0, 0, 0];
|
58768
|
-
for (var i = 0; i < 3; i++) {
|
58769
|
-
t32 = h + 1 / 3 * -(i - 1);
|
58770
|
-
if (t32 < 0) {
|
58771
|
-
t32++;
|
58772
|
-
}
|
58773
|
-
if (t32 > 1) {
|
58774
|
-
t32--;
|
58775
|
-
}
|
58776
|
-
if (6 * t32 < 1) {
|
58777
|
-
val = t1 + (t22 - t1) * 6 * t32;
|
58778
|
-
} else if (2 * t32 < 1) {
|
58779
|
-
val = t22;
|
58780
|
-
} else if (3 * t32 < 2) {
|
58781
|
-
val = t1 + (t22 - t1) * (2 / 3 - t32) * 6;
|
58782
|
-
} else {
|
58783
|
-
val = t1;
|
58784
|
-
}
|
58785
|
-
rgb[i] = val * 255;
|
58786
|
-
}
|
58787
|
-
return rgb;
|
58788
|
-
};
|
58789
|
-
convert.hsl.hsv = function(hsl) {
|
58790
|
-
var h = hsl[0];
|
58791
|
-
var s = hsl[1] / 100;
|
58792
|
-
var l = hsl[2] / 100;
|
58793
|
-
var smin = s;
|
58794
|
-
var lmin = Math.max(l, 0.01);
|
58795
|
-
var sv;
|
58796
|
-
var v;
|
58797
|
-
l *= 2;
|
58798
|
-
s *= l <= 1 ? l : 2 - l;
|
58799
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
58800
|
-
v = (l + s) / 2;
|
58801
|
-
sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
58802
|
-
return [h, sv * 100, v * 100];
|
58803
|
-
};
|
58804
|
-
convert.hsv.rgb = function(hsv) {
|
58805
|
-
var h = hsv[0] / 60;
|
58806
|
-
var s = hsv[1] / 100;
|
58807
|
-
var v = hsv[2] / 100;
|
58808
|
-
var hi = Math.floor(h) % 6;
|
58809
|
-
var f = h - Math.floor(h);
|
58810
|
-
var p = 255 * v * (1 - s);
|
58811
|
-
var q = 255 * v * (1 - s * f);
|
58812
|
-
var t5 = 255 * v * (1 - s * (1 - f));
|
58813
|
-
v *= 255;
|
58814
|
-
switch (hi) {
|
58815
|
-
case 0:
|
58816
|
-
return [v, t5, p];
|
58817
|
-
case 1:
|
58818
|
-
return [q, v, p];
|
58819
|
-
case 2:
|
58820
|
-
return [p, v, t5];
|
58821
|
-
case 3:
|
58822
|
-
return [p, q, v];
|
58823
|
-
case 4:
|
58824
|
-
return [t5, p, v];
|
58825
|
-
case 5:
|
58826
|
-
return [v, p, q];
|
58827
|
-
}
|
58828
|
-
};
|
58829
|
-
convert.hsv.hsl = function(hsv) {
|
58830
|
-
var h = hsv[0];
|
58831
|
-
var s = hsv[1] / 100;
|
58832
|
-
var v = hsv[2] / 100;
|
58833
|
-
var vmin = Math.max(v, 0.01);
|
58834
|
-
var lmin;
|
58835
|
-
var sl;
|
58836
|
-
var l;
|
58837
|
-
l = (2 - s) * v;
|
58838
|
-
lmin = (2 - s) * vmin;
|
58839
|
-
sl = s * vmin;
|
58840
|
-
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
58841
|
-
sl = sl || 0;
|
58842
|
-
l /= 2;
|
58843
|
-
return [h, sl * 100, l * 100];
|
58844
|
-
};
|
58845
|
-
convert.hwb.rgb = function(hwb) {
|
58846
|
-
var h = hwb[0] / 360;
|
58847
|
-
var wh = hwb[1] / 100;
|
58848
|
-
var bl = hwb[2] / 100;
|
58849
|
-
var ratio = wh + bl;
|
58850
|
-
var i;
|
58851
|
-
var v;
|
58852
|
-
var f;
|
58853
|
-
var n;
|
58854
|
-
if (ratio > 1) {
|
58855
|
-
wh /= ratio;
|
58856
|
-
bl /= ratio;
|
58857
|
-
}
|
58858
|
-
i = Math.floor(6 * h);
|
58859
|
-
v = 1 - bl;
|
58860
|
-
f = 6 * h - i;
|
58861
|
-
if ((i & 1) !== 0) {
|
58862
|
-
f = 1 - f;
|
58863
|
-
}
|
58864
|
-
n = wh + f * (v - wh);
|
58865
|
-
var r;
|
58866
|
-
var g;
|
58867
|
-
var b;
|
58868
|
-
switch (i) {
|
58869
|
-
default:
|
58870
|
-
case 6:
|
58871
|
-
case 0:
|
58872
|
-
r = v;
|
58873
|
-
g = n;
|
58874
|
-
b = wh;
|
58875
|
-
break;
|
58876
|
-
case 1:
|
58877
|
-
r = n;
|
58878
|
-
g = v;
|
58879
|
-
b = wh;
|
58880
|
-
break;
|
58881
|
-
case 2:
|
58882
|
-
r = wh;
|
58883
|
-
g = v;
|
58884
|
-
b = n;
|
58885
|
-
break;
|
58886
|
-
case 3:
|
58887
|
-
r = wh;
|
58888
|
-
g = n;
|
58889
|
-
b = v;
|
58890
|
-
break;
|
58891
|
-
case 4:
|
58892
|
-
r = n;
|
58893
|
-
g = wh;
|
58894
|
-
b = v;
|
58895
|
-
break;
|
58896
|
-
case 5:
|
58897
|
-
r = v;
|
58898
|
-
g = wh;
|
58899
|
-
b = n;
|
58900
|
-
break;
|
58901
|
-
}
|
58902
|
-
return [r * 255, g * 255, b * 255];
|
58903
|
-
};
|
58904
|
-
convert.cmyk.rgb = function(cmyk) {
|
58905
|
-
var c = cmyk[0] / 100;
|
58906
|
-
var m = cmyk[1] / 100;
|
58907
|
-
var y = cmyk[2] / 100;
|
58908
|
-
var k = cmyk[3] / 100;
|
58909
|
-
var r;
|
58910
|
-
var g;
|
58911
|
-
var b;
|
58912
|
-
r = 1 - Math.min(1, c * (1 - k) + k);
|
58913
|
-
g = 1 - Math.min(1, m * (1 - k) + k);
|
58914
|
-
b = 1 - Math.min(1, y * (1 - k) + k);
|
58915
|
-
return [r * 255, g * 255, b * 255];
|
58916
|
-
};
|
58917
|
-
convert.xyz.rgb = function(xyz) {
|
58918
|
-
var x = xyz[0] / 100;
|
58919
|
-
var y = xyz[1] / 100;
|
58920
|
-
var z2 = xyz[2] / 100;
|
58921
|
-
var r;
|
58922
|
-
var g;
|
58923
|
-
var b;
|
58924
|
-
r = x * 3.2406 + y * -1.5372 + z2 * -0.4986;
|
58925
|
-
g = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
|
58926
|
-
b = x * 0.0557 + y * -0.204 + z2 * 1.057;
|
58927
|
-
r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
|
58928
|
-
g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
|
58929
|
-
b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
|
58930
|
-
r = Math.min(Math.max(0, r), 1);
|
58931
|
-
g = Math.min(Math.max(0, g), 1);
|
58932
|
-
b = Math.min(Math.max(0, b), 1);
|
58933
|
-
return [r * 255, g * 255, b * 255];
|
58934
|
-
};
|
58935
|
-
convert.xyz.lab = function(xyz) {
|
58936
|
-
var x = xyz[0];
|
58937
|
-
var y = xyz[1];
|
58938
|
-
var z2 = xyz[2];
|
58939
|
-
var l;
|
58940
|
-
var a;
|
58941
|
-
var b;
|
58942
|
-
x /= 95.047;
|
58943
|
-
y /= 100;
|
58944
|
-
z2 /= 108.883;
|
58945
|
-
x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
58946
|
-
y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
58947
|
-
z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
|
58948
|
-
l = 116 * y - 16;
|
58949
|
-
a = 500 * (x - y);
|
58950
|
-
b = 200 * (y - z2);
|
58951
|
-
return [l, a, b];
|
58952
|
-
};
|
58953
|
-
convert.lab.xyz = function(lab) {
|
58954
|
-
var l = lab[0];
|
58955
|
-
var a = lab[1];
|
58956
|
-
var b = lab[2];
|
58957
|
-
var x;
|
58958
|
-
var y;
|
58959
|
-
var z2;
|
58960
|
-
y = (l + 16) / 116;
|
58961
|
-
x = a / 500 + y;
|
58962
|
-
z2 = y - b / 200;
|
58963
|
-
var y2 = Math.pow(y, 3);
|
58964
|
-
var x2 = Math.pow(x, 3);
|
58965
|
-
var z22 = Math.pow(z2, 3);
|
58966
|
-
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
58967
|
-
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
58968
|
-
z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
|
58969
|
-
x *= 95.047;
|
58970
|
-
y *= 100;
|
58971
|
-
z2 *= 108.883;
|
58972
|
-
return [x, y, z2];
|
58973
|
-
};
|
58974
|
-
convert.lab.lch = function(lab) {
|
58975
|
-
var l = lab[0];
|
58976
|
-
var a = lab[1];
|
58977
|
-
var b = lab[2];
|
58978
|
-
var hr;
|
58979
|
-
var h;
|
58980
|
-
var c;
|
58981
|
-
hr = Math.atan2(b, a);
|
58982
|
-
h = hr * 360 / 2 / Math.PI;
|
58983
|
-
if (h < 0) {
|
58984
|
-
h += 360;
|
58985
|
-
}
|
58986
|
-
c = Math.sqrt(a * a + b * b);
|
58987
|
-
return [l, c, h];
|
58988
|
-
};
|
58989
|
-
convert.lch.lab = function(lch) {
|
58990
|
-
var l = lch[0];
|
58991
|
-
var c = lch[1];
|
58992
|
-
var h = lch[2];
|
58993
|
-
var a;
|
58994
|
-
var b;
|
58995
|
-
var hr;
|
58996
|
-
hr = h / 360 * 2 * Math.PI;
|
58997
|
-
a = c * Math.cos(hr);
|
58998
|
-
b = c * Math.sin(hr);
|
58999
|
-
return [l, a, b];
|
59000
|
-
};
|
59001
|
-
convert.rgb.ansi16 = function(args) {
|
59002
|
-
var r = args[0];
|
59003
|
-
var g = args[1];
|
59004
|
-
var b = args[2];
|
59005
|
-
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
|
59006
|
-
value = Math.round(value / 50);
|
59007
|
-
if (value === 0) {
|
59008
|
-
return 30;
|
59009
|
-
}
|
59010
|
-
var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
59011
|
-
if (value === 2) {
|
59012
|
-
ansi += 60;
|
59013
|
-
}
|
59014
|
-
return ansi;
|
59015
|
-
};
|
59016
|
-
convert.hsv.ansi16 = function(args) {
|
59017
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
59018
|
-
};
|
59019
|
-
convert.rgb.ansi256 = function(args) {
|
59020
|
-
var r = args[0];
|
59021
|
-
var g = args[1];
|
59022
|
-
var b = args[2];
|
59023
|
-
if (r === g && g === b) {
|
59024
|
-
if (r < 8) {
|
59025
|
-
return 16;
|
59026
|
-
}
|
59027
|
-
if (r > 248) {
|
59028
|
-
return 231;
|
59029
|
-
}
|
59030
|
-
return Math.round((r - 8) / 247 * 24) + 232;
|
59031
|
-
}
|
59032
|
-
var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
59033
|
-
return ansi;
|
59034
|
-
};
|
59035
|
-
convert.ansi16.rgb = function(args) {
|
59036
|
-
var color = args % 10;
|
59037
|
-
if (color === 0 || color === 7) {
|
59038
|
-
if (args > 50) {
|
59039
|
-
color += 3.5;
|
59040
|
-
}
|
59041
|
-
color = color / 10.5 * 255;
|
59042
|
-
return [color, color, color];
|
59043
|
-
}
|
59044
|
-
var mult = (~~(args > 50) + 1) * 0.5;
|
59045
|
-
var r = (color & 1) * mult * 255;
|
59046
|
-
var g = (color >> 1 & 1) * mult * 255;
|
59047
|
-
var b = (color >> 2 & 1) * mult * 255;
|
59048
|
-
return [r, g, b];
|
59049
|
-
};
|
59050
|
-
convert.ansi256.rgb = function(args) {
|
59051
|
-
if (args >= 232) {
|
59052
|
-
var c = (args - 232) * 10 + 8;
|
59053
|
-
return [c, c, c];
|
59054
|
-
}
|
59055
|
-
args -= 16;
|
59056
|
-
var rem;
|
59057
|
-
var r = Math.floor(args / 36) / 5 * 255;
|
59058
|
-
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
59059
|
-
var b = rem % 6 / 5 * 255;
|
59060
|
-
return [r, g, b];
|
59061
|
-
};
|
59062
|
-
convert.rgb.hex = function(args) {
|
59063
|
-
var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
59064
|
-
var string = integer.toString(16).toUpperCase();
|
59065
|
-
return "000000".substring(string.length) + string;
|
59066
|
-
};
|
59067
|
-
convert.hex.rgb = function(args) {
|
59068
|
-
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
59069
|
-
if (!match) {
|
59070
|
-
return [0, 0, 0];
|
59071
|
-
}
|
59072
|
-
var colorString = match[0];
|
59073
|
-
if (match[0].length === 3) {
|
59074
|
-
colorString = colorString.split("").map(function(char) {
|
59075
|
-
return char + char;
|
59076
|
-
}).join("");
|
59077
|
-
}
|
59078
|
-
var integer = parseInt(colorString, 16);
|
59079
|
-
var r = integer >> 16 & 255;
|
59080
|
-
var g = integer >> 8 & 255;
|
59081
|
-
var b = integer & 255;
|
59082
|
-
return [r, g, b];
|
59083
|
-
};
|
59084
|
-
convert.rgb.hcg = function(rgb) {
|
59085
|
-
var r = rgb[0] / 255;
|
59086
|
-
var g = rgb[1] / 255;
|
59087
|
-
var b = rgb[2] / 255;
|
59088
|
-
var max = Math.max(Math.max(r, g), b);
|
59089
|
-
var min = Math.min(Math.min(r, g), b);
|
59090
|
-
var chroma = max - min;
|
59091
|
-
var grayscale;
|
59092
|
-
var hue;
|
59093
|
-
if (chroma < 1) {
|
59094
|
-
grayscale = min / (1 - chroma);
|
59095
|
-
} else {
|
59096
|
-
grayscale = 0;
|
59097
|
-
}
|
59098
|
-
if (chroma <= 0) {
|
59099
|
-
hue = 0;
|
59100
|
-
} else if (max === r) {
|
59101
|
-
hue = (g - b) / chroma % 6;
|
59102
|
-
} else if (max === g) {
|
59103
|
-
hue = 2 + (b - r) / chroma;
|
59104
|
-
} else {
|
59105
|
-
hue = 4 + (r - g) / chroma + 4;
|
59106
|
-
}
|
59107
|
-
hue /= 6;
|
59108
|
-
hue %= 1;
|
59109
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
59110
|
-
};
|
59111
|
-
convert.hsl.hcg = function(hsl) {
|
59112
|
-
var s = hsl[1] / 100;
|
59113
|
-
var l = hsl[2] / 100;
|
59114
|
-
var c = 1;
|
59115
|
-
var f = 0;
|
59116
|
-
if (l < 0.5) {
|
59117
|
-
c = 2 * s * l;
|
59118
|
-
} else {
|
59119
|
-
c = 2 * s * (1 - l);
|
59120
|
-
}
|
59121
|
-
if (c < 1) {
|
59122
|
-
f = (l - 0.5 * c) / (1 - c);
|
59123
|
-
}
|
59124
|
-
return [hsl[0], c * 100, f * 100];
|
59125
|
-
};
|
59126
|
-
convert.hsv.hcg = function(hsv) {
|
59127
|
-
var s = hsv[1] / 100;
|
59128
|
-
var v = hsv[2] / 100;
|
59129
|
-
var c = s * v;
|
59130
|
-
var f = 0;
|
59131
|
-
if (c < 1) {
|
59132
|
-
f = (v - c) / (1 - c);
|
59133
|
-
}
|
59134
|
-
return [hsv[0], c * 100, f * 100];
|
59135
|
-
};
|
59136
|
-
convert.hcg.rgb = function(hcg) {
|
59137
|
-
var h = hcg[0] / 360;
|
59138
|
-
var c = hcg[1] / 100;
|
59139
|
-
var g = hcg[2] / 100;
|
59140
|
-
if (c === 0) {
|
59141
|
-
return [g * 255, g * 255, g * 255];
|
59142
|
-
}
|
59143
|
-
var pure = [0, 0, 0];
|
59144
|
-
var hi = h % 1 * 6;
|
59145
|
-
var v = hi % 1;
|
59146
|
-
var w = 1 - v;
|
59147
|
-
var mg = 0;
|
59148
|
-
switch (Math.floor(hi)) {
|
59149
|
-
case 0:
|
59150
|
-
pure[0] = 1;
|
59151
|
-
pure[1] = v;
|
59152
|
-
pure[2] = 0;
|
59153
|
-
break;
|
59154
|
-
case 1:
|
59155
|
-
pure[0] = w;
|
59156
|
-
pure[1] = 1;
|
59157
|
-
pure[2] = 0;
|
59158
|
-
break;
|
59159
|
-
case 2:
|
59160
|
-
pure[0] = 0;
|
59161
|
-
pure[1] = 1;
|
59162
|
-
pure[2] = v;
|
59163
|
-
break;
|
59164
|
-
case 3:
|
59165
|
-
pure[0] = 0;
|
59166
|
-
pure[1] = w;
|
59167
|
-
pure[2] = 1;
|
59168
|
-
break;
|
59169
|
-
case 4:
|
59170
|
-
pure[0] = v;
|
59171
|
-
pure[1] = 0;
|
59172
|
-
pure[2] = 1;
|
59173
|
-
break;
|
59174
|
-
default:
|
59175
|
-
pure[0] = 1;
|
59176
|
-
pure[1] = 0;
|
59177
|
-
pure[2] = w;
|
59178
|
-
}
|
59179
|
-
mg = (1 - c) * g;
|
59180
|
-
return [
|
59181
|
-
(c * pure[0] + mg) * 255,
|
59182
|
-
(c * pure[1] + mg) * 255,
|
59183
|
-
(c * pure[2] + mg) * 255
|
59184
|
-
];
|
59185
|
-
};
|
59186
|
-
convert.hcg.hsv = function(hcg) {
|
59187
|
-
var c = hcg[1] / 100;
|
59188
|
-
var g = hcg[2] / 100;
|
59189
|
-
var v = c + g * (1 - c);
|
59190
|
-
var f = 0;
|
59191
|
-
if (v > 0) {
|
59192
|
-
f = c / v;
|
59193
|
-
}
|
59194
|
-
return [hcg[0], f * 100, v * 100];
|
59195
|
-
};
|
59196
|
-
convert.hcg.hsl = function(hcg) {
|
59197
|
-
var c = hcg[1] / 100;
|
59198
|
-
var g = hcg[2] / 100;
|
59199
|
-
var l = g * (1 - c) + 0.5 * c;
|
59200
|
-
var s = 0;
|
59201
|
-
if (l > 0 && l < 0.5) {
|
59202
|
-
s = c / (2 * l);
|
59203
|
-
} else if (l >= 0.5 && l < 1) {
|
59204
|
-
s = c / (2 * (1 - l));
|
59205
|
-
}
|
59206
|
-
return [hcg[0], s * 100, l * 100];
|
59207
|
-
};
|
59208
|
-
convert.hcg.hwb = function(hcg) {
|
59209
|
-
var c = hcg[1] / 100;
|
59210
|
-
var g = hcg[2] / 100;
|
59211
|
-
var v = c + g * (1 - c);
|
59212
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
59213
|
-
};
|
59214
|
-
convert.hwb.hcg = function(hwb) {
|
59215
|
-
var w = hwb[1] / 100;
|
59216
|
-
var b = hwb[2] / 100;
|
59217
|
-
var v = 1 - b;
|
59218
|
-
var c = v - w;
|
59219
|
-
var g = 0;
|
59220
|
-
if (c < 1) {
|
59221
|
-
g = (v - c) / (1 - c);
|
59222
|
-
}
|
59223
|
-
return [hwb[0], c * 100, g * 100];
|
59224
|
-
};
|
59225
|
-
convert.apple.rgb = function(apple) {
|
59226
|
-
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
59227
|
-
};
|
59228
|
-
convert.rgb.apple = function(rgb) {
|
59229
|
-
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
59230
|
-
};
|
59231
|
-
convert.gray.rgb = function(args) {
|
59232
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
59233
|
-
};
|
59234
|
-
convert.gray.hsl = convert.gray.hsv = function(args) {
|
59235
|
-
return [0, 0, args[0]];
|
59236
|
-
};
|
59237
|
-
convert.gray.hwb = function(gray) {
|
59238
|
-
return [0, 100, gray[0]];
|
59239
|
-
};
|
59240
|
-
convert.gray.cmyk = function(gray) {
|
59241
|
-
return [0, 0, 0, gray[0]];
|
59242
|
-
};
|
59243
|
-
convert.gray.lab = function(gray) {
|
59244
|
-
return [gray[0], 0, 0];
|
59245
|
-
};
|
59246
|
-
convert.gray.hex = function(gray) {
|
59247
|
-
var val = Math.round(gray[0] / 100 * 255) & 255;
|
59248
|
-
var integer = (val << 16) + (val << 8) + val;
|
59249
|
-
var string = integer.toString(16).toUpperCase();
|
59250
|
-
return "000000".substring(string.length) + string;
|
59251
|
-
};
|
59252
|
-
convert.rgb.gray = function(rgb) {
|
59253
|
-
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
59254
|
-
return [val / 255 * 100];
|
59255
|
-
};
|
59256
|
-
}
|
59257
|
-
});
|
59258
|
-
|
59259
|
-
// node_modules/color-convert/route.js
|
59260
|
-
var require_route2 = __commonJS({
|
59261
|
-
"node_modules/color-convert/route.js"(exports2, module2) {
|
59262
|
-
var conversions = require_conversions2();
|
59263
|
-
function buildGraph() {
|
59264
|
-
var graph = {};
|
59265
|
-
var models = Object.keys(conversions);
|
59266
|
-
for (var len = models.length, i = 0; i < len; i++) {
|
59267
|
-
graph[models[i]] = {
|
59268
|
-
// http://jsperf.com/1-vs-infinity
|
59269
|
-
// micro-opt, but this is simple.
|
59270
|
-
distance: -1,
|
59271
|
-
parent: null
|
59272
|
-
};
|
59273
|
-
}
|
59274
|
-
return graph;
|
59275
|
-
}
|
59276
|
-
function deriveBFS(fromModel) {
|
59277
|
-
var graph = buildGraph();
|
59278
|
-
var queue = [fromModel];
|
59279
|
-
graph[fromModel].distance = 0;
|
59280
|
-
while (queue.length) {
|
59281
|
-
var current = queue.pop();
|
59282
|
-
var adjacents = Object.keys(conversions[current]);
|
59283
|
-
for (var len = adjacents.length, i = 0; i < len; i++) {
|
59284
|
-
var adjacent = adjacents[i];
|
59285
|
-
var node = graph[adjacent];
|
59286
|
-
if (node.distance === -1) {
|
59287
|
-
node.distance = graph[current].distance + 1;
|
59288
|
-
node.parent = current;
|
59289
|
-
queue.unshift(adjacent);
|
59290
|
-
}
|
59291
|
-
}
|
59292
|
-
}
|
59293
|
-
return graph;
|
59294
|
-
}
|
59295
|
-
function link(from, to) {
|
59296
|
-
return function(args) {
|
59297
|
-
return to(from(args));
|
59298
|
-
};
|
59299
|
-
}
|
59300
|
-
function wrapConversion(toModel, graph) {
|
59301
|
-
var path = [graph[toModel].parent, toModel];
|
59302
|
-
var fn = conversions[graph[toModel].parent][toModel];
|
59303
|
-
var cur = graph[toModel].parent;
|
59304
|
-
while (graph[cur].parent) {
|
59305
|
-
path.unshift(graph[cur].parent);
|
59306
|
-
fn = link(conversions[graph[cur].parent][cur], fn);
|
59307
|
-
cur = graph[cur].parent;
|
59308
|
-
}
|
59309
|
-
fn.conversion = path;
|
59310
|
-
return fn;
|
59311
|
-
}
|
59312
|
-
module2.exports = function(fromModel) {
|
59313
|
-
var graph = deriveBFS(fromModel);
|
59314
|
-
var conversion = {};
|
59315
|
-
var models = Object.keys(graph);
|
59316
|
-
for (var len = models.length, i = 0; i < len; i++) {
|
59317
|
-
var toModel = models[i];
|
59318
|
-
var node = graph[toModel];
|
59319
|
-
if (node.parent === null) {
|
59320
|
-
continue;
|
59321
|
-
}
|
59322
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
59323
|
-
}
|
59324
|
-
return conversion;
|
59325
|
-
};
|
59326
|
-
}
|
59327
|
-
});
|
59328
|
-
|
59329
|
-
// node_modules/color-convert/index.js
|
59330
|
-
var require_color_convert2 = __commonJS({
|
59331
|
-
"node_modules/color-convert/index.js"(exports2, module2) {
|
59332
|
-
var conversions = require_conversions2();
|
59333
|
-
var route = require_route2();
|
59334
|
-
var convert = {};
|
59335
|
-
var models = Object.keys(conversions);
|
59336
|
-
function wrapRaw(fn) {
|
59337
|
-
var wrappedFn = function(args) {
|
59338
|
-
if (args === void 0 || args === null) {
|
59339
|
-
return args;
|
59340
|
-
}
|
59341
|
-
if (arguments.length > 1) {
|
59342
|
-
args = Array.prototype.slice.call(arguments);
|
59343
|
-
}
|
59344
|
-
return fn(args);
|
59345
|
-
};
|
59346
|
-
if ("conversion" in fn) {
|
59347
|
-
wrappedFn.conversion = fn.conversion;
|
59348
|
-
}
|
59349
|
-
return wrappedFn;
|
59350
|
-
}
|
59351
|
-
function wrapRounded(fn) {
|
59352
|
-
var wrappedFn = function(args) {
|
59353
|
-
if (args === void 0 || args === null) {
|
59354
|
-
return args;
|
59355
|
-
}
|
59356
|
-
if (arguments.length > 1) {
|
59357
|
-
args = Array.prototype.slice.call(arguments);
|
59358
|
-
}
|
59359
|
-
var result = fn(args);
|
59360
|
-
if (typeof result === "object") {
|
59361
|
-
for (var len = result.length, i = 0; i < len; i++) {
|
59362
|
-
result[i] = Math.round(result[i]);
|
59363
|
-
}
|
59364
|
-
}
|
59365
|
-
return result;
|
59366
|
-
};
|
59367
|
-
if ("conversion" in fn) {
|
59368
|
-
wrappedFn.conversion = fn.conversion;
|
59369
|
-
}
|
59370
|
-
return wrappedFn;
|
59371
|
-
}
|
59372
|
-
models.forEach(function(fromModel) {
|
59373
|
-
convert[fromModel] = {};
|
59374
|
-
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
59375
|
-
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
59376
|
-
var routes = route(fromModel);
|
59377
|
-
var routeModels = Object.keys(routes);
|
59378
|
-
routeModels.forEach(function(toModel) {
|
59379
|
-
var fn = routes[toModel];
|
59380
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
59381
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
59382
|
-
});
|
59383
|
-
});
|
59384
|
-
module2.exports = convert;
|
59385
|
-
}
|
59386
|
-
});
|
59387
|
-
|
59388
58389
|
// node_modules/ansi-styles/index.js
|
59389
58390
|
var require_ansi_styles2 = __commonJS({
|
59390
58391
|
"node_modules/ansi-styles/index.js"(exports2, module2) {
|
59391
58392
|
"use strict";
|
59392
|
-
var colorConvert =
|
58393
|
+
var colorConvert = require_color_convert();
|
59393
58394
|
var wrapAnsi16 = (fn, offset) => function() {
|
59394
58395
|
const code = fn.apply(colorConvert, arguments);
|
59395
58396
|
return `\x1B[${code + offset}m`;
|
@@ -126467,6 +125468,48 @@ var TYPED_GLOBALS = [
|
|
126467
125468
|
]
|
126468
125469
|
])
|
126469
125470
|
],
|
125471
|
+
[
|
125472
|
+
"performance",
|
125473
|
+
addObject(DEFAULT_SHAPES, "performance", [
|
125474
|
+
// Static methods (TODO)
|
125475
|
+
[
|
125476
|
+
"now",
|
125477
|
+
// Date.now()
|
125478
|
+
addFunction(DEFAULT_SHAPES, [], {
|
125479
|
+
positionalParams: [],
|
125480
|
+
restParam: "read" /* Read */,
|
125481
|
+
returnType: { kind: "Poly" },
|
125482
|
+
// TODO: could be Primitive, but that would change existing compilation
|
125483
|
+
calleeEffect: "read" /* Read */,
|
125484
|
+
returnValueKind: "mutable" /* Mutable */,
|
125485
|
+
// same here
|
125486
|
+
impure: true,
|
125487
|
+
canonicalName: "performance.now"
|
125488
|
+
})
|
125489
|
+
]
|
125490
|
+
])
|
125491
|
+
],
|
125492
|
+
[
|
125493
|
+
"Date",
|
125494
|
+
addObject(DEFAULT_SHAPES, "Date", [
|
125495
|
+
// Static methods (TODO)
|
125496
|
+
[
|
125497
|
+
"now",
|
125498
|
+
// Date.now()
|
125499
|
+
addFunction(DEFAULT_SHAPES, [], {
|
125500
|
+
positionalParams: [],
|
125501
|
+
restParam: "read" /* Read */,
|
125502
|
+
returnType: { kind: "Poly" },
|
125503
|
+
// TODO: could be Primitive, but that would change existing compilation
|
125504
|
+
calleeEffect: "read" /* Read */,
|
125505
|
+
returnValueKind: "mutable" /* Mutable */,
|
125506
|
+
// same here
|
125507
|
+
impure: true,
|
125508
|
+
canonicalName: "Date.now"
|
125509
|
+
})
|
125510
|
+
]
|
125511
|
+
])
|
125512
|
+
],
|
126470
125513
|
[
|
126471
125514
|
"Math",
|
126472
125515
|
addObject(DEFAULT_SHAPES, "Math", [
|
@@ -126534,6 +125577,20 @@ var TYPED_GLOBALS = [
|
|
126534
125577
|
calleeEffect: "read" /* Read */,
|
126535
125578
|
returnValueKind: "primitive" /* Primitive */
|
126536
125579
|
})
|
125580
|
+
],
|
125581
|
+
[
|
125582
|
+
"random",
|
125583
|
+
addFunction(DEFAULT_SHAPES, [], {
|
125584
|
+
positionalParams: [],
|
125585
|
+
restParam: "read" /* Read */,
|
125586
|
+
returnType: { kind: "Poly" },
|
125587
|
+
// TODO: could be Primitive, but that would change existing compilation
|
125588
|
+
calleeEffect: "read" /* Read */,
|
125589
|
+
returnValueKind: "mutable" /* Mutable */,
|
125590
|
+
// same here
|
125591
|
+
impure: true,
|
125592
|
+
canonicalName: "Math.random"
|
125593
|
+
})
|
126537
125594
|
]
|
126538
125595
|
])
|
126539
125596
|
],
|
@@ -127072,7 +126129,9 @@ var FunctionTypeSchema = z.object({
|
|
127072
126129
|
returnType: z.lazy(() => TypeSchema),
|
127073
126130
|
returnValueKind: ValueKindSchema,
|
127074
126131
|
noAlias: z.boolean().nullable().optional(),
|
127075
|
-
mutableOnlyIfOperandsAreMutable: z.boolean().nullable().optional()
|
126132
|
+
mutableOnlyIfOperandsAreMutable: z.boolean().nullable().optional(),
|
126133
|
+
impure: z.boolean().nullable().optional(),
|
126134
|
+
canonicalName: z.string().nullable().optional()
|
127076
126135
|
});
|
127077
126136
|
var HookTypeSchema = z.object({
|
127078
126137
|
kind: z.literal("hook"),
|
@@ -127345,6 +126404,10 @@ var EnvironmentConfigSchema = z.object({
|
|
127345
126404
|
*/
|
127346
126405
|
validateNoCapitalizedCalls: z.nullable(z.array(z.string())).default(null),
|
127347
126406
|
validateBlocklistedImports: z.nullable(z.array(z.string())).default(null),
|
126407
|
+
/**
|
126408
|
+
* Validate against impure functions called during render
|
126409
|
+
*/
|
126410
|
+
validateNoImpureFunctionsInRender: z.boolean().default(false),
|
127348
126411
|
/*
|
127349
126412
|
* When enabled, the compiler assumes that hooks follow the Rules of React:
|
127350
126413
|
* - Hooks may memoize computation based on any of their parameters, thus
|
@@ -127648,7 +126711,7 @@ var testComplexConfigDefaults = {
|
|
127648
126711
|
}
|
127649
126712
|
]
|
127650
126713
|
};
|
127651
|
-
function
|
126714
|
+
function parseConfigPragmaEnvironmentForTest(pragma) {
|
127652
126715
|
const maybeConfig = {};
|
127653
126716
|
const defaultConfig = EnvironmentConfigSchema.parse({});
|
127654
126717
|
for (const token of pragma.split(" ")) {
|
@@ -127700,6 +126763,43 @@ function parseConfigPragmaForTests(pragma) {
|
|
127700
126763
|
suggestions: null
|
127701
126764
|
});
|
127702
126765
|
}
|
126766
|
+
function parseConfigPragmaForTests(pragma, defaults) {
|
126767
|
+
const environment = parseConfigPragmaEnvironmentForTest(pragma);
|
126768
|
+
let compilationMode = defaults.compilationMode;
|
126769
|
+
let panicThreshold = "all_errors";
|
126770
|
+
for (const token of pragma.split(" ")) {
|
126771
|
+
if (!token.startsWith("@")) {
|
126772
|
+
continue;
|
126773
|
+
}
|
126774
|
+
switch (token) {
|
126775
|
+
case "@compilationMode(annotation)": {
|
126776
|
+
compilationMode = "annotation";
|
126777
|
+
break;
|
126778
|
+
}
|
126779
|
+
case "@compilationMode(infer)": {
|
126780
|
+
compilationMode = "infer";
|
126781
|
+
break;
|
126782
|
+
}
|
126783
|
+
case "@compilationMode(all)": {
|
126784
|
+
compilationMode = "all";
|
126785
|
+
break;
|
126786
|
+
}
|
126787
|
+
case "@compilationMode(syntax)": {
|
126788
|
+
compilationMode = "syntax";
|
126789
|
+
break;
|
126790
|
+
}
|
126791
|
+
case "@panicThreshold(none)": {
|
126792
|
+
panicThreshold = "none";
|
126793
|
+
break;
|
126794
|
+
}
|
126795
|
+
}
|
126796
|
+
}
|
126797
|
+
return parsePluginOptions({
|
126798
|
+
environment,
|
126799
|
+
compilationMode,
|
126800
|
+
panicThreshold
|
126801
|
+
});
|
126802
|
+
}
|
127703
126803
|
var Environment = class {
|
127704
126804
|
#globals;
|
127705
126805
|
#shapes;
|
@@ -145514,6 +144614,35 @@ function rewriteInstructions(rewriteInstrs, instructions) {
|
|
145514
144614
|
return instructions;
|
145515
144615
|
}
|
145516
144616
|
|
144617
|
+
// src/Validation/ValiateNoImpureFunctionsInRender.ts
|
144618
|
+
function validateNoImpureFunctionsInRender(fn) {
|
144619
|
+
const errors = new CompilerError();
|
144620
|
+
for (const [, block] of fn.body.blocks) {
|
144621
|
+
for (const instr of block.instructions) {
|
144622
|
+
const value = instr.value;
|
144623
|
+
if (value.kind === "MethodCall" || value.kind == "CallExpression") {
|
144624
|
+
const callee = value.kind === "MethodCall" ? value.property : value.callee;
|
144625
|
+
const signature = getFunctionCallSignature(
|
144626
|
+
fn.env,
|
144627
|
+
callee.identifier.type
|
144628
|
+
);
|
144629
|
+
if (signature != null && signature.impure === true) {
|
144630
|
+
errors.push({
|
144631
|
+
reason: "Calling an impure function can produce unstable results. (https://react.dev/reference/rules/components-and-hooks-must-be-pure#components-and-hooks-must-be-idempotent)",
|
144632
|
+
description: signature.canonicalName != null ? `\`${signature.canonicalName}\` is an impure function whose results may change on every call` : null,
|
144633
|
+
severity: "InvalidReact" /* InvalidReact */,
|
144634
|
+
loc: callee.loc,
|
144635
|
+
suggestions: null
|
144636
|
+
});
|
144637
|
+
}
|
144638
|
+
}
|
144639
|
+
}
|
144640
|
+
}
|
144641
|
+
if (errors.hasErrors()) {
|
144642
|
+
throw errors;
|
144643
|
+
}
|
144644
|
+
}
|
144645
|
+
|
145517
144646
|
// src/Entrypoint/Pipeline.ts
|
145518
144647
|
function run(func, config, fnType, useMemoCacheIdentifier, logger, filename, code) {
|
145519
144648
|
const contextIdentifiers = findContextIdentifiers(func);
|
@@ -145612,6 +144741,9 @@ function runWithEnvironment(func, env) {
|
|
145612
144741
|
if (env.config.validateNoJSXInTryStatements) {
|
145613
144742
|
validateNoJSXInTryStatement(hir);
|
145614
144743
|
}
|
144744
|
+
if (env.config.validateNoImpureFunctionsInRender) {
|
144745
|
+
validateNoImpureFunctionsInRender(hir);
|
144746
|
+
}
|
145615
144747
|
inferReactivePlaces(hir);
|
145616
144748
|
log2({ kind: "hir", name: "InferReactivePlaces", value: hir });
|
145617
144749
|
rewriteInstructionKindsBasedOnReassignment(hir);
|
@@ -146608,9 +145740,11 @@ function returnsNonNode(node) {
|
|
146608
145740
|
}
|
146609
145741
|
}
|
146610
145742
|
},
|
145743
|
+
// Skip traversing all nested functions and their return statements
|
146611
145744
|
ArrowFunctionExpression: skipNestedFunctions(node),
|
146612
145745
|
FunctionExpression: skipNestedFunctions(node),
|
146613
|
-
FunctionDeclaration: skipNestedFunctions(node)
|
145746
|
+
FunctionDeclaration: skipNestedFunctions(node),
|
145747
|
+
ObjectMethod: (node2) => node2.skip()
|
146614
145748
|
});
|
146615
145749
|
return !hasReturn || returnsNonNode2;
|
146616
145750
|
}
|