@ni/nimble-components 15.5.6 → 15.5.7

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.
@@ -26876,7 +26876,7 @@ Instead styling against the role which is more general and likely a better appro
26876
26876
  return x;
26877
26877
  }
26878
26878
 
26879
- function normalize(a, b) {
26879
+ function normalize$1(a, b) {
26880
26880
  return (b -= (a = +a))
26881
26881
  ? function(x) { return (x - a) / b; }
26882
26882
  : constants(isNaN(b) ? NaN : 0.5);
@@ -26892,8 +26892,8 @@ Instead styling against the role which is more general and likely a better appro
26892
26892
  // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
26893
26893
  function bimap(domain, range, interpolate) {
26894
26894
  var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
26895
- if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
26896
- else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
26895
+ if (d1 < d0) d0 = normalize$1(d1, d0), r0 = interpolate(r1, r0);
26896
+ else d0 = normalize$1(d0, d1), r0 = interpolate(r0, r1);
26897
26897
  return function(x) { return r0(d0(x)); };
26898
26898
  }
26899
26899
 
@@ -26910,7 +26910,7 @@ Instead styling against the role which is more general and likely a better appro
26910
26910
  }
26911
26911
 
26912
26912
  while (++i < j) {
26913
- d[i] = normalize(domain[i], domain[i + 1]);
26913
+ d[i] = normalize$1(domain[i], domain[i + 1]);
26914
26914
  r[i] = interpolate(range[i], range[i + 1]);
26915
26915
  }
26916
26916
 
@@ -27526,6 +27526,1105 @@ Instead styling against the role which is more general and likely a better appro
27526
27526
  }
27527
27527
  }
27528
27528
 
27529
+ /**
27530
+ * Ensures that an input number does not exceed a max value and is not less than a min value.
27531
+ * @param i - the number to clamp
27532
+ * @param min - the maximum (inclusive) value
27533
+ * @param max - the minimum (inclusive) value
27534
+ * @public
27535
+ */
27536
+ function clamp(i, min, max) {
27537
+ if (isNaN(i) || i <= min) {
27538
+ return min;
27539
+ }
27540
+ else if (i >= max) {
27541
+ return max;
27542
+ }
27543
+ return i;
27544
+ }
27545
+ /**
27546
+ * Scales an input to a number between 0 and 1
27547
+ * @param i - a number between min and max
27548
+ * @param min - the max value
27549
+ * @param max - the min value
27550
+ * @public
27551
+ */
27552
+ function normalize(i, min, max) {
27553
+ if (isNaN(i) || i <= min) {
27554
+ return 0.0;
27555
+ }
27556
+ else if (i >= max) {
27557
+ return 1.0;
27558
+ }
27559
+ return i / (max - min);
27560
+ }
27561
+ /**
27562
+ * Scales a number between 0 and 1
27563
+ * @param i - the number to denormalize
27564
+ * @param min - the min value
27565
+ * @param max - the max value
27566
+ * @public
27567
+ */
27568
+ function denormalize(i, min, max) {
27569
+ if (isNaN(i)) {
27570
+ return min;
27571
+ }
27572
+ return min + i * (max - min);
27573
+ }
27574
+ /**
27575
+ * Converts a number between 0 and 255 to a hex string.
27576
+ * @param i - the number to convert to a hex string
27577
+ * @public
27578
+ */
27579
+ function getHexStringForByte(i) {
27580
+ const s = Math.round(clamp(i, 0.0, 255.0)).toString(16);
27581
+ if (s.length === 1) {
27582
+ return "0" + s;
27583
+ }
27584
+ return s;
27585
+ }
27586
+ /**
27587
+ *
27588
+ * Will return infinity if i*10^(precision) overflows number
27589
+ * note that floating point rounding rules come into play here
27590
+ * so values that end up rounding on a .5 round to the nearest
27591
+ * even not always up so 2.5 rounds to 2
27592
+ * @param i - the number to round
27593
+ * @param precision - the precision to round to
27594
+ *
27595
+ * @public
27596
+ */
27597
+ function roundToPrecisionSmall(i, precision) {
27598
+ const factor = Math.pow(10, precision);
27599
+ return Math.round(i * factor) / factor;
27600
+ }
27601
+
27602
+ /**
27603
+ * A RGBA color with 64 bit channels.
27604
+ *
27605
+ * @example
27606
+ * ```ts
27607
+ * new ColorRGBA64(1, 0, 0, 1) // red
27608
+ * ```
27609
+ * @public
27610
+ */
27611
+ class ColorRGBA64 {
27612
+ /**
27613
+ *
27614
+ * @param red - the red value
27615
+ * @param green - the green value
27616
+ * @param blue - the blue value
27617
+ * @param alpha - the alpha value
27618
+ */
27619
+ constructor(red, green, blue, alpha) {
27620
+ this.r = red;
27621
+ this.g = green;
27622
+ this.b = blue;
27623
+ this.a = typeof alpha === "number" && !isNaN(alpha) ? alpha : 1;
27624
+ }
27625
+ /**
27626
+ * Construct a {@link ColorRGBA64} from a {@link ColorRGBA64Config}
27627
+ * @param data - the config object
27628
+ */
27629
+ static fromObject(data) {
27630
+ return data && !isNaN(data.r) && !isNaN(data.g) && !isNaN(data.b)
27631
+ ? new ColorRGBA64(data.r, data.g, data.b, data.a)
27632
+ : null;
27633
+ }
27634
+ /**
27635
+ * Determines if one color is equal to another.
27636
+ * @param rhs - the color to compare
27637
+ */
27638
+ equalValue(rhs) {
27639
+ return (this.r === rhs.r && this.g === rhs.g && this.b === rhs.b && this.a === rhs.a);
27640
+ }
27641
+ /**
27642
+ * Returns the color formatted as a string; #RRGGBB
27643
+ */
27644
+ toStringHexRGB() {
27645
+ return "#" + [this.r, this.g, this.b].map(this.formatHexValue).join("");
27646
+ }
27647
+ /**
27648
+ * Returns the color formatted as a string; #RRGGBBAA
27649
+ */
27650
+ toStringHexRGBA() {
27651
+ return this.toStringHexRGB() + this.formatHexValue(this.a);
27652
+ }
27653
+ /**
27654
+ * Returns the color formatted as a string; #AARRGGBB
27655
+ */
27656
+ toStringHexARGB() {
27657
+ return "#" + [this.a, this.r, this.g, this.b].map(this.formatHexValue).join("");
27658
+ }
27659
+ /**
27660
+ * Returns the color formatted as a string; "rgb(0xRR, 0xGG, 0xBB)"
27661
+ */
27662
+ toStringWebRGB() {
27663
+ return `rgb(${Math.round(denormalize(this.r, 0.0, 255.0))},${Math.round(denormalize(this.g, 0.0, 255.0))},${Math.round(denormalize(this.b, 0.0, 255.0))})`;
27664
+ }
27665
+ /**
27666
+ * Returns the color formatted as a string; "rgba(0xRR, 0xGG, 0xBB, a)"
27667
+ * @remarks
27668
+ * Note that this follows the convention of putting alpha in the range [0.0,1.0] while the other three channels are [0,255]
27669
+ */
27670
+ toStringWebRGBA() {
27671
+ return `rgba(${Math.round(denormalize(this.r, 0.0, 255.0))},${Math.round(denormalize(this.g, 0.0, 255.0))},${Math.round(denormalize(this.b, 0.0, 255.0))},${clamp(this.a, 0, 1)})`;
27672
+ }
27673
+ /**
27674
+ * Returns a new {@link ColorRGBA64} rounded to the provided precision
27675
+ * @param precision - the precision to round to
27676
+ */
27677
+ roundToPrecision(precision) {
27678
+ return new ColorRGBA64(roundToPrecisionSmall(this.r, precision), roundToPrecisionSmall(this.g, precision), roundToPrecisionSmall(this.b, precision), roundToPrecisionSmall(this.a, precision));
27679
+ }
27680
+ /**
27681
+ * Returns a new {@link ColorRGBA64} with channel values clamped between 0 and 1.
27682
+ */
27683
+ clamp() {
27684
+ return new ColorRGBA64(clamp(this.r, 0, 1), clamp(this.g, 0, 1), clamp(this.b, 0, 1), clamp(this.a, 0, 1));
27685
+ }
27686
+ /**
27687
+ * Converts the {@link ColorRGBA64} to a {@link ColorRGBA64Config}.
27688
+ */
27689
+ toObject() {
27690
+ return { r: this.r, g: this.g, b: this.b, a: this.a };
27691
+ }
27692
+ formatHexValue(value) {
27693
+ return getHexStringForByte(denormalize(value, 0.0, 255.0));
27694
+ }
27695
+ }
27696
+
27697
+ const namedColorsConfigs = {
27698
+ aliceblue: {
27699
+ r: 0.941176,
27700
+ g: 0.972549,
27701
+ b: 1,
27702
+ },
27703
+ antiquewhite: {
27704
+ r: 0.980392,
27705
+ g: 0.921569,
27706
+ b: 0.843137,
27707
+ },
27708
+ aqua: {
27709
+ r: 0,
27710
+ g: 1,
27711
+ b: 1,
27712
+ },
27713
+ aquamarine: {
27714
+ r: 0.498039,
27715
+ g: 1,
27716
+ b: 0.831373,
27717
+ },
27718
+ azure: {
27719
+ r: 0.941176,
27720
+ g: 1,
27721
+ b: 1,
27722
+ },
27723
+ beige: {
27724
+ r: 0.960784,
27725
+ g: 0.960784,
27726
+ b: 0.862745,
27727
+ },
27728
+ bisque: {
27729
+ r: 1,
27730
+ g: 0.894118,
27731
+ b: 0.768627,
27732
+ },
27733
+ black: {
27734
+ r: 0,
27735
+ g: 0,
27736
+ b: 0,
27737
+ },
27738
+ blanchedalmond: {
27739
+ r: 1,
27740
+ g: 0.921569,
27741
+ b: 0.803922,
27742
+ },
27743
+ blue: {
27744
+ r: 0,
27745
+ g: 0,
27746
+ b: 1,
27747
+ },
27748
+ blueviolet: {
27749
+ r: 0.541176,
27750
+ g: 0.168627,
27751
+ b: 0.886275,
27752
+ },
27753
+ brown: {
27754
+ r: 0.647059,
27755
+ g: 0.164706,
27756
+ b: 0.164706,
27757
+ },
27758
+ burlywood: {
27759
+ r: 0.870588,
27760
+ g: 0.721569,
27761
+ b: 0.529412,
27762
+ },
27763
+ cadetblue: {
27764
+ r: 0.372549,
27765
+ g: 0.619608,
27766
+ b: 0.627451,
27767
+ },
27768
+ chartreuse: {
27769
+ r: 0.498039,
27770
+ g: 1,
27771
+ b: 0,
27772
+ },
27773
+ chocolate: {
27774
+ r: 0.823529,
27775
+ g: 0.411765,
27776
+ b: 0.117647,
27777
+ },
27778
+ coral: {
27779
+ r: 1,
27780
+ g: 0.498039,
27781
+ b: 0.313725,
27782
+ },
27783
+ cornflowerblue: {
27784
+ r: 0.392157,
27785
+ g: 0.584314,
27786
+ b: 0.929412,
27787
+ },
27788
+ cornsilk: {
27789
+ r: 1,
27790
+ g: 0.972549,
27791
+ b: 0.862745,
27792
+ },
27793
+ crimson: {
27794
+ r: 0.862745,
27795
+ g: 0.078431,
27796
+ b: 0.235294,
27797
+ },
27798
+ cyan: {
27799
+ r: 0,
27800
+ g: 1,
27801
+ b: 1,
27802
+ },
27803
+ darkblue: {
27804
+ r: 0,
27805
+ g: 0,
27806
+ b: 0.545098,
27807
+ },
27808
+ darkcyan: {
27809
+ r: 0,
27810
+ g: 0.545098,
27811
+ b: 0.545098,
27812
+ },
27813
+ darkgoldenrod: {
27814
+ r: 0.721569,
27815
+ g: 0.52549,
27816
+ b: 0.043137,
27817
+ },
27818
+ darkgray: {
27819
+ r: 0.662745,
27820
+ g: 0.662745,
27821
+ b: 0.662745,
27822
+ },
27823
+ darkgreen: {
27824
+ r: 0,
27825
+ g: 0.392157,
27826
+ b: 0,
27827
+ },
27828
+ darkgrey: {
27829
+ r: 0.662745,
27830
+ g: 0.662745,
27831
+ b: 0.662745,
27832
+ },
27833
+ darkkhaki: {
27834
+ r: 0.741176,
27835
+ g: 0.717647,
27836
+ b: 0.419608,
27837
+ },
27838
+ darkmagenta: {
27839
+ r: 0.545098,
27840
+ g: 0,
27841
+ b: 0.545098,
27842
+ },
27843
+ darkolivegreen: {
27844
+ r: 0.333333,
27845
+ g: 0.419608,
27846
+ b: 0.184314,
27847
+ },
27848
+ darkorange: {
27849
+ r: 1,
27850
+ g: 0.54902,
27851
+ b: 0,
27852
+ },
27853
+ darkorchid: {
27854
+ r: 0.6,
27855
+ g: 0.196078,
27856
+ b: 0.8,
27857
+ },
27858
+ darkred: {
27859
+ r: 0.545098,
27860
+ g: 0,
27861
+ b: 0,
27862
+ },
27863
+ darksalmon: {
27864
+ r: 0.913725,
27865
+ g: 0.588235,
27866
+ b: 0.478431,
27867
+ },
27868
+ darkseagreen: {
27869
+ r: 0.560784,
27870
+ g: 0.737255,
27871
+ b: 0.560784,
27872
+ },
27873
+ darkslateblue: {
27874
+ r: 0.282353,
27875
+ g: 0.239216,
27876
+ b: 0.545098,
27877
+ },
27878
+ darkslategray: {
27879
+ r: 0.184314,
27880
+ g: 0.309804,
27881
+ b: 0.309804,
27882
+ },
27883
+ darkslategrey: {
27884
+ r: 0.184314,
27885
+ g: 0.309804,
27886
+ b: 0.309804,
27887
+ },
27888
+ darkturquoise: {
27889
+ r: 0,
27890
+ g: 0.807843,
27891
+ b: 0.819608,
27892
+ },
27893
+ darkviolet: {
27894
+ r: 0.580392,
27895
+ g: 0,
27896
+ b: 0.827451,
27897
+ },
27898
+ deeppink: {
27899
+ r: 1,
27900
+ g: 0.078431,
27901
+ b: 0.576471,
27902
+ },
27903
+ deepskyblue: {
27904
+ r: 0,
27905
+ g: 0.74902,
27906
+ b: 1,
27907
+ },
27908
+ dimgray: {
27909
+ r: 0.411765,
27910
+ g: 0.411765,
27911
+ b: 0.411765,
27912
+ },
27913
+ dimgrey: {
27914
+ r: 0.411765,
27915
+ g: 0.411765,
27916
+ b: 0.411765,
27917
+ },
27918
+ dodgerblue: {
27919
+ r: 0.117647,
27920
+ g: 0.564706,
27921
+ b: 1,
27922
+ },
27923
+ firebrick: {
27924
+ r: 0.698039,
27925
+ g: 0.133333,
27926
+ b: 0.133333,
27927
+ },
27928
+ floralwhite: {
27929
+ r: 1,
27930
+ g: 0.980392,
27931
+ b: 0.941176,
27932
+ },
27933
+ forestgreen: {
27934
+ r: 0.133333,
27935
+ g: 0.545098,
27936
+ b: 0.133333,
27937
+ },
27938
+ fuchsia: {
27939
+ r: 1,
27940
+ g: 0,
27941
+ b: 1,
27942
+ },
27943
+ gainsboro: {
27944
+ r: 0.862745,
27945
+ g: 0.862745,
27946
+ b: 0.862745,
27947
+ },
27948
+ ghostwhite: {
27949
+ r: 0.972549,
27950
+ g: 0.972549,
27951
+ b: 1,
27952
+ },
27953
+ gold: {
27954
+ r: 1,
27955
+ g: 0.843137,
27956
+ b: 0,
27957
+ },
27958
+ goldenrod: {
27959
+ r: 0.854902,
27960
+ g: 0.647059,
27961
+ b: 0.12549,
27962
+ },
27963
+ gray: {
27964
+ r: 0.501961,
27965
+ g: 0.501961,
27966
+ b: 0.501961,
27967
+ },
27968
+ green: {
27969
+ r: 0,
27970
+ g: 0.501961,
27971
+ b: 0,
27972
+ },
27973
+ greenyellow: {
27974
+ r: 0.678431,
27975
+ g: 1,
27976
+ b: 0.184314,
27977
+ },
27978
+ grey: {
27979
+ r: 0.501961,
27980
+ g: 0.501961,
27981
+ b: 0.501961,
27982
+ },
27983
+ honeydew: {
27984
+ r: 0.941176,
27985
+ g: 1,
27986
+ b: 0.941176,
27987
+ },
27988
+ hotpink: {
27989
+ r: 1,
27990
+ g: 0.411765,
27991
+ b: 0.705882,
27992
+ },
27993
+ indianred: {
27994
+ r: 0.803922,
27995
+ g: 0.360784,
27996
+ b: 0.360784,
27997
+ },
27998
+ indigo: {
27999
+ r: 0.294118,
28000
+ g: 0,
28001
+ b: 0.509804,
28002
+ },
28003
+ ivory: {
28004
+ r: 1,
28005
+ g: 1,
28006
+ b: 0.941176,
28007
+ },
28008
+ khaki: {
28009
+ r: 0.941176,
28010
+ g: 0.901961,
28011
+ b: 0.54902,
28012
+ },
28013
+ lavender: {
28014
+ r: 0.901961,
28015
+ g: 0.901961,
28016
+ b: 0.980392,
28017
+ },
28018
+ lavenderblush: {
28019
+ r: 1,
28020
+ g: 0.941176,
28021
+ b: 0.960784,
28022
+ },
28023
+ lawngreen: {
28024
+ r: 0.486275,
28025
+ g: 0.988235,
28026
+ b: 0,
28027
+ },
28028
+ lemonchiffon: {
28029
+ r: 1,
28030
+ g: 0.980392,
28031
+ b: 0.803922,
28032
+ },
28033
+ lightblue: {
28034
+ r: 0.678431,
28035
+ g: 0.847059,
28036
+ b: 0.901961,
28037
+ },
28038
+ lightcoral: {
28039
+ r: 0.941176,
28040
+ g: 0.501961,
28041
+ b: 0.501961,
28042
+ },
28043
+ lightcyan: {
28044
+ r: 0.878431,
28045
+ g: 1,
28046
+ b: 1,
28047
+ },
28048
+ lightgoldenrodyellow: {
28049
+ r: 0.980392,
28050
+ g: 0.980392,
28051
+ b: 0.823529,
28052
+ },
28053
+ lightgray: {
28054
+ r: 0.827451,
28055
+ g: 0.827451,
28056
+ b: 0.827451,
28057
+ },
28058
+ lightgreen: {
28059
+ r: 0.564706,
28060
+ g: 0.933333,
28061
+ b: 0.564706,
28062
+ },
28063
+ lightgrey: {
28064
+ r: 0.827451,
28065
+ g: 0.827451,
28066
+ b: 0.827451,
28067
+ },
28068
+ lightpink: {
28069
+ r: 1,
28070
+ g: 0.713725,
28071
+ b: 0.756863,
28072
+ },
28073
+ lightsalmon: {
28074
+ r: 1,
28075
+ g: 0.627451,
28076
+ b: 0.478431,
28077
+ },
28078
+ lightseagreen: {
28079
+ r: 0.12549,
28080
+ g: 0.698039,
28081
+ b: 0.666667,
28082
+ },
28083
+ lightskyblue: {
28084
+ r: 0.529412,
28085
+ g: 0.807843,
28086
+ b: 0.980392,
28087
+ },
28088
+ lightslategray: {
28089
+ r: 0.466667,
28090
+ g: 0.533333,
28091
+ b: 0.6,
28092
+ },
28093
+ lightslategrey: {
28094
+ r: 0.466667,
28095
+ g: 0.533333,
28096
+ b: 0.6,
28097
+ },
28098
+ lightsteelblue: {
28099
+ r: 0.690196,
28100
+ g: 0.768627,
28101
+ b: 0.870588,
28102
+ },
28103
+ lightyellow: {
28104
+ r: 1,
28105
+ g: 1,
28106
+ b: 0.878431,
28107
+ },
28108
+ lime: {
28109
+ r: 0,
28110
+ g: 1,
28111
+ b: 0,
28112
+ },
28113
+ limegreen: {
28114
+ r: 0.196078,
28115
+ g: 0.803922,
28116
+ b: 0.196078,
28117
+ },
28118
+ linen: {
28119
+ r: 0.980392,
28120
+ g: 0.941176,
28121
+ b: 0.901961,
28122
+ },
28123
+ magenta: {
28124
+ r: 1,
28125
+ g: 0,
28126
+ b: 1,
28127
+ },
28128
+ maroon: {
28129
+ r: 0.501961,
28130
+ g: 0,
28131
+ b: 0,
28132
+ },
28133
+ mediumaquamarine: {
28134
+ r: 0.4,
28135
+ g: 0.803922,
28136
+ b: 0.666667,
28137
+ },
28138
+ mediumblue: {
28139
+ r: 0,
28140
+ g: 0,
28141
+ b: 0.803922,
28142
+ },
28143
+ mediumorchid: {
28144
+ r: 0.729412,
28145
+ g: 0.333333,
28146
+ b: 0.827451,
28147
+ },
28148
+ mediumpurple: {
28149
+ r: 0.576471,
28150
+ g: 0.439216,
28151
+ b: 0.858824,
28152
+ },
28153
+ mediumseagreen: {
28154
+ r: 0.235294,
28155
+ g: 0.701961,
28156
+ b: 0.443137,
28157
+ },
28158
+ mediumslateblue: {
28159
+ r: 0.482353,
28160
+ g: 0.407843,
28161
+ b: 0.933333,
28162
+ },
28163
+ mediumspringgreen: {
28164
+ r: 0,
28165
+ g: 0.980392,
28166
+ b: 0.603922,
28167
+ },
28168
+ mediumturquoise: {
28169
+ r: 0.282353,
28170
+ g: 0.819608,
28171
+ b: 0.8,
28172
+ },
28173
+ mediumvioletred: {
28174
+ r: 0.780392,
28175
+ g: 0.082353,
28176
+ b: 0.521569,
28177
+ },
28178
+ midnightblue: {
28179
+ r: 0.098039,
28180
+ g: 0.098039,
28181
+ b: 0.439216,
28182
+ },
28183
+ mintcream: {
28184
+ r: 0.960784,
28185
+ g: 1,
28186
+ b: 0.980392,
28187
+ },
28188
+ mistyrose: {
28189
+ r: 1,
28190
+ g: 0.894118,
28191
+ b: 0.882353,
28192
+ },
28193
+ moccasin: {
28194
+ r: 1,
28195
+ g: 0.894118,
28196
+ b: 0.709804,
28197
+ },
28198
+ navajowhite: {
28199
+ r: 1,
28200
+ g: 0.870588,
28201
+ b: 0.678431,
28202
+ },
28203
+ navy: {
28204
+ r: 0,
28205
+ g: 0,
28206
+ b: 0.501961,
28207
+ },
28208
+ oldlace: {
28209
+ r: 0.992157,
28210
+ g: 0.960784,
28211
+ b: 0.901961,
28212
+ },
28213
+ olive: {
28214
+ r: 0.501961,
28215
+ g: 0.501961,
28216
+ b: 0,
28217
+ },
28218
+ olivedrab: {
28219
+ r: 0.419608,
28220
+ g: 0.556863,
28221
+ b: 0.137255,
28222
+ },
28223
+ orange: {
28224
+ r: 1,
28225
+ g: 0.647059,
28226
+ b: 0,
28227
+ },
28228
+ orangered: {
28229
+ r: 1,
28230
+ g: 0.270588,
28231
+ b: 0,
28232
+ },
28233
+ orchid: {
28234
+ r: 0.854902,
28235
+ g: 0.439216,
28236
+ b: 0.839216,
28237
+ },
28238
+ palegoldenrod: {
28239
+ r: 0.933333,
28240
+ g: 0.909804,
28241
+ b: 0.666667,
28242
+ },
28243
+ palegreen: {
28244
+ r: 0.596078,
28245
+ g: 0.984314,
28246
+ b: 0.596078,
28247
+ },
28248
+ paleturquoise: {
28249
+ r: 0.686275,
28250
+ g: 0.933333,
28251
+ b: 0.933333,
28252
+ },
28253
+ palevioletred: {
28254
+ r: 0.858824,
28255
+ g: 0.439216,
28256
+ b: 0.576471,
28257
+ },
28258
+ papayawhip: {
28259
+ r: 1,
28260
+ g: 0.937255,
28261
+ b: 0.835294,
28262
+ },
28263
+ peachpuff: {
28264
+ r: 1,
28265
+ g: 0.854902,
28266
+ b: 0.72549,
28267
+ },
28268
+ peru: {
28269
+ r: 0.803922,
28270
+ g: 0.521569,
28271
+ b: 0.247059,
28272
+ },
28273
+ pink: {
28274
+ r: 1,
28275
+ g: 0.752941,
28276
+ b: 0.796078,
28277
+ },
28278
+ plum: {
28279
+ r: 0.866667,
28280
+ g: 0.627451,
28281
+ b: 0.866667,
28282
+ },
28283
+ powderblue: {
28284
+ r: 0.690196,
28285
+ g: 0.878431,
28286
+ b: 0.901961,
28287
+ },
28288
+ purple: {
28289
+ r: 0.501961,
28290
+ g: 0,
28291
+ b: 0.501961,
28292
+ },
28293
+ red: {
28294
+ r: 1,
28295
+ g: 0,
28296
+ b: 0,
28297
+ },
28298
+ rosybrown: {
28299
+ r: 0.737255,
28300
+ g: 0.560784,
28301
+ b: 0.560784,
28302
+ },
28303
+ royalblue: {
28304
+ r: 0.254902,
28305
+ g: 0.411765,
28306
+ b: 0.882353,
28307
+ },
28308
+ saddlebrown: {
28309
+ r: 0.545098,
28310
+ g: 0.270588,
28311
+ b: 0.07451,
28312
+ },
28313
+ salmon: {
28314
+ r: 0.980392,
28315
+ g: 0.501961,
28316
+ b: 0.447059,
28317
+ },
28318
+ sandybrown: {
28319
+ r: 0.956863,
28320
+ g: 0.643137,
28321
+ b: 0.376471,
28322
+ },
28323
+ seagreen: {
28324
+ r: 0.180392,
28325
+ g: 0.545098,
28326
+ b: 0.341176,
28327
+ },
28328
+ seashell: {
28329
+ r: 1,
28330
+ g: 0.960784,
28331
+ b: 0.933333,
28332
+ },
28333
+ sienna: {
28334
+ r: 0.627451,
28335
+ g: 0.321569,
28336
+ b: 0.176471,
28337
+ },
28338
+ silver: {
28339
+ r: 0.752941,
28340
+ g: 0.752941,
28341
+ b: 0.752941,
28342
+ },
28343
+ skyblue: {
28344
+ r: 0.529412,
28345
+ g: 0.807843,
28346
+ b: 0.921569,
28347
+ },
28348
+ slateblue: {
28349
+ r: 0.415686,
28350
+ g: 0.352941,
28351
+ b: 0.803922,
28352
+ },
28353
+ slategray: {
28354
+ r: 0.439216,
28355
+ g: 0.501961,
28356
+ b: 0.564706,
28357
+ },
28358
+ slategrey: {
28359
+ r: 0.439216,
28360
+ g: 0.501961,
28361
+ b: 0.564706,
28362
+ },
28363
+ snow: {
28364
+ r: 1,
28365
+ g: 0.980392,
28366
+ b: 0.980392,
28367
+ },
28368
+ springgreen: {
28369
+ r: 0,
28370
+ g: 1,
28371
+ b: 0.498039,
28372
+ },
28373
+ steelblue: {
28374
+ r: 0.27451,
28375
+ g: 0.509804,
28376
+ b: 0.705882,
28377
+ },
28378
+ tan: {
28379
+ r: 0.823529,
28380
+ g: 0.705882,
28381
+ b: 0.54902,
28382
+ },
28383
+ teal: {
28384
+ r: 0,
28385
+ g: 0.501961,
28386
+ b: 0.501961,
28387
+ },
28388
+ thistle: {
28389
+ r: 0.847059,
28390
+ g: 0.74902,
28391
+ b: 0.847059,
28392
+ },
28393
+ tomato: {
28394
+ r: 1,
28395
+ g: 0.388235,
28396
+ b: 0.278431,
28397
+ },
28398
+ transparent: {
28399
+ r: 0,
28400
+ g: 0,
28401
+ b: 0,
28402
+ a: 0,
28403
+ },
28404
+ turquoise: {
28405
+ r: 0.25098,
28406
+ g: 0.878431,
28407
+ b: 0.815686,
28408
+ },
28409
+ violet: {
28410
+ r: 0.933333,
28411
+ g: 0.509804,
28412
+ b: 0.933333,
28413
+ },
28414
+ wheat: {
28415
+ r: 0.960784,
28416
+ g: 0.870588,
28417
+ b: 0.701961,
28418
+ },
28419
+ white: {
28420
+ r: 1,
28421
+ g: 1,
28422
+ b: 1,
28423
+ },
28424
+ whitesmoke: {
28425
+ r: 0.960784,
28426
+ g: 0.960784,
28427
+ b: 0.960784,
28428
+ },
28429
+ yellow: {
28430
+ r: 1,
28431
+ g: 1,
28432
+ b: 0,
28433
+ },
28434
+ yellowgreen: {
28435
+ r: 0.603922,
28436
+ g: 0.803922,
28437
+ b: 0.196078,
28438
+ },
28439
+ };
28440
+
28441
+ // Matches rgb(R, G, B) where R, G, and B are integers [0 - 255]
28442
+ const webRGBRegex = /^rgb\(\s*((?:(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})\s*,\s*){2}(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})\s*)\)$/i;
28443
+ // Matches rgb(R, G, B, A) where R, G, and B are integers [0 - 255] and A is [0-1] floating
28444
+ const webRGBARegex = /^rgba\(\s*((?:(?:25[0-5]|2[0-4]\d|1\d\d|\d{1,2})\s*,\s*){3}(?:0|1|0?\.\d*)\s*)\)$/i;
28445
+ // Matches #RGB and #RRGGBB, where R, G, and B are [0-9] or [A-F]
28446
+ const hexRGBRegex = /^#((?:[0-9a-f]{6}|[0-9a-f]{3}))$/i;
28447
+ // Matches #RGB and #RRGGBBAA, where R, G, B, and A are [0-9] or [A-F]
28448
+ const hexRGBARegex = /^#((?:[0-9a-f]{8}|[0-9a-f]{4}))$/i;
28449
+ /**
28450
+ * Test if a color matches #RRGGBB or #RGB
28451
+ * @public
28452
+ */
28453
+ function isColorStringHexRGB(raw) {
28454
+ return hexRGBRegex.test(raw);
28455
+ }
28456
+ /**
28457
+ * Test if a color matches #AARRGGBB or #ARGB
28458
+ * @public
28459
+ */
28460
+ function isColorStringHexARGB(raw) {
28461
+ return hexRGBARegex.test(raw);
28462
+ }
28463
+ /**
28464
+ * Test if a color matches #RRGGBBAA or #RGBA
28465
+ * @public
28466
+ */
28467
+ function isColorStringHexRGBA(raw) {
28468
+ return isColorStringHexARGB(raw); // No way to differentiate these two formats, so just use the same test
28469
+ }
28470
+ /**
28471
+ * Test if a color matches rgb(rr, gg, bb)
28472
+ * @public
28473
+ */
28474
+ function isColorStringWebRGB(raw) {
28475
+ return webRGBRegex.test(raw);
28476
+ }
28477
+ /**
28478
+ * Test if a color matches rgba(rr, gg, bb, aa)
28479
+ *
28480
+ * @public
28481
+ */
28482
+ function isColorStringWebRGBA(raw) {
28483
+ return webRGBARegex.test(raw);
28484
+ }
28485
+ /**
28486
+ * Tests whether a color is in {@link @microsoft/fast-colors#NamedColors}.
28487
+ * @param raw - the color name to test
28488
+ * @public
28489
+ */
28490
+ function isColorNamed(raw) {
28491
+ return namedColorsConfigs.hasOwnProperty(raw);
28492
+ }
28493
+ /**
28494
+ * Converts a hexadecimal color string to a {@link @microsoft/fast-colors#ColorRGBA64}.
28495
+ * @param raw - a color string in the form of "#RRGGBB" or "#RGB"
28496
+ * @example
28497
+ * ```ts
28498
+ * parseColorHexRGBA("#FF0000");
28499
+ * parseColorHexRGBA("#F00");
28500
+ * ```
28501
+ * @public
28502
+ */
28503
+ function parseColorHexRGB(raw) {
28504
+ const result = hexRGBRegex.exec(raw);
28505
+ if (result === null) {
28506
+ return null;
28507
+ }
28508
+ let digits = result[1];
28509
+ if (digits.length === 3) {
28510
+ const r = digits.charAt(0);
28511
+ const g = digits.charAt(1);
28512
+ const b = digits.charAt(2);
28513
+ digits = r.concat(r, g, g, b, b);
28514
+ }
28515
+ const rawInt = parseInt(digits, 16);
28516
+ if (isNaN(rawInt)) {
28517
+ return null;
28518
+ }
28519
+ // Note the use of >>> rather than >> as we want JS to manipulate these as unsigned numbers
28520
+ return new ColorRGBA64(normalize((rawInt & 0xff0000) >>> 16, 0, 255), normalize((rawInt & 0x00ff00) >>> 8, 0, 255), normalize(rawInt & 0x0000ff, 0, 255), 1);
28521
+ }
28522
+ /**
28523
+ * Converts a hexadecimal color string to a {@link @microsoft/fast-colors#ColorRGBA64}.
28524
+ * @param raw - a color string in the form of "#AARRGGBB" or "#ARGB"
28525
+ * @example
28526
+ * ```ts
28527
+ * parseColorHexRGBA("#AAFF0000");
28528
+ * parseColorHexRGBA("#AF00");
28529
+ * ```
28530
+ * @public
28531
+ */
28532
+ function parseColorHexARGB(raw) {
28533
+ const result = hexRGBARegex.exec(raw);
28534
+ if (result === null) {
28535
+ return null;
28536
+ }
28537
+ let digits = result[1];
28538
+ if (digits.length === 4) {
28539
+ const a = digits.charAt(0);
28540
+ const r = digits.charAt(1);
28541
+ const g = digits.charAt(2);
28542
+ const b = digits.charAt(3);
28543
+ digits = a.concat(a, r, r, g, g, b, b);
28544
+ }
28545
+ const rawInt = parseInt(digits, 16);
28546
+ if (isNaN(rawInt)) {
28547
+ return null;
28548
+ }
28549
+ // Note the use of >>> rather than >> as we want JS to manipulate these as unsigned numbers
28550
+ return new ColorRGBA64(normalize((rawInt & 0x00ff0000) >>> 16, 0, 255), normalize((rawInt & 0x0000ff00) >>> 8, 0, 255), normalize(rawInt & 0x000000ff, 0, 255), normalize((rawInt & 0xff000000) >>> 24, 0, 255));
28551
+ }
28552
+ /**
28553
+ * Converts a rgb color string to a {@link @microsoft/fast-colors#ColorRGBA64}.
28554
+ * @param raw - a color string format "rgba(RR,GG,BB)" where RR,GG,BB are [0,255]
28555
+ * @example
28556
+ * ```ts
28557
+ * parseColorWebRGB("rgba(255, 0, 0");
28558
+ * ```
28559
+ * @public
28560
+ */
28561
+ function parseColorWebRGB(raw) {
28562
+ const result = webRGBRegex.exec(raw);
28563
+ if (result === null) {
28564
+ return null;
28565
+ }
28566
+ const split = result[1].split(",");
28567
+ return new ColorRGBA64(normalize(Number(split[0]), 0, 255), normalize(Number(split[1]), 0, 255), normalize(Number(split[2]), 0, 255), 1);
28568
+ }
28569
+ /**
28570
+ * Converts a rgba color string to a {@link @microsoft/fast-colors#ColorRGBA64}.
28571
+ * @param raw - a color string format "rgba(RR,GG,BB,a)" where RR,GG,BB are [0,255] and a is [0,1]
28572
+ * @example
28573
+ * ```ts
28574
+ * parseColorWebRGBA("rgba(255, 0, 0, 1");
28575
+ * ```
28576
+ * @public
28577
+ */
28578
+ function parseColorWebRGBA(raw) {
28579
+ const result = webRGBARegex.exec(raw);
28580
+ if (result === null) {
28581
+ return null;
28582
+ }
28583
+ const split = result[1].split(",");
28584
+ if (split.length === 4) {
28585
+ return new ColorRGBA64(normalize(Number(split[0]), 0, 255), normalize(Number(split[1]), 0, 255), normalize(Number(split[2]), 0, 255), Number(split[3]));
28586
+ }
28587
+ return null;
28588
+ }
28589
+ /**
28590
+ * Converts a named color to a {@link @microsoft/fast-colors#ColorRGBA64}.
28591
+ * @param raw - a {@link https://www.w3schools.com/colors/colors_names.asp | CSS color name}.
28592
+ * @example
28593
+ * ```ts
28594
+ * parseColorNamed("red");
28595
+ * ```
28596
+ * @public
28597
+ */
28598
+ function parseColorNamed(raw) {
28599
+ // const rawLower: typeof raw = raw.toLowerCase() : raw.toString();
28600
+ const config = namedColorsConfigs[raw.toLowerCase()];
28601
+ return config
28602
+ ? new ColorRGBA64(config.r, config.g, config.b, config.hasOwnProperty("a") ? config.a : void 0)
28603
+ : null;
28604
+ }
28605
+ /**
28606
+ *
28607
+ Expects any of the following and attempts to determine which is being used
28608
+ * #RRGGBB, #AARRGGBB, rgb(RR,GG,BB) rgba(RR,GG,BB,a),
28609
+ * or any of the {@link https://www.w3schools.com/colors/colors_names.asp | CSS color names}.
28610
+ * @param raw - the color string to parse
28611
+ * @public
28612
+ */
28613
+ function parseColor(raw) {
28614
+ const rawLower = raw.toLowerCase();
28615
+ return isColorStringHexRGB(rawLower)
28616
+ ? parseColorHexRGB(rawLower)
28617
+ : isColorStringHexRGBA(rawLower)
28618
+ ? parseColorHexARGB(rawLower)
28619
+ : isColorStringWebRGB(rawLower)
28620
+ ? parseColorWebRGB(rawLower)
28621
+ : isColorStringWebRGBA(rawLower)
28622
+ ? parseColorWebRGBA(rawLower)
28623
+ : isColorNamed(rawLower)
28624
+ ? parseColorNamed(rawLower)
28625
+ : null;
28626
+ }
28627
+
27529
28628
  /**
27530
28629
  * Prerendering prepares render-ready dies data to be used by the rendering module
27531
28630
  */
@@ -27533,8 +28632,8 @@ Instead styling against the role which is more general and likely a better appro
27533
28632
  constructor(dies, colorScale, highlightedValues, horizontalScale, verticalScale, colorScaleMode, dieLabelsHidden, dieLabelsSuffix, maxCharacters, dieDimensions, margin) {
27534
28633
  this.fontSizeFactor = 0.8;
27535
28634
  this.nonHighlightedOpacity = 0.3;
27536
- this.emptyDieColor = '#DADFEC';
27537
- this.nanDieColor = '#7a7a7a';
28635
+ this.emptyDieColor = 'rgba(218,223,236,1)';
28636
+ this.nanDieColor = 'rgba(122,122,122,1)';
27538
28637
  this.d3ColorScale = this.createD3ColorScale(colorScale, colorScaleMode);
27539
28638
  this.labelsFontSize = this.calculateLabelsFontSize(dieDimensions, maxCharacters);
27540
28639
  this.diesRenderInfo = [];
@@ -27542,8 +28641,7 @@ Instead styling against the role which is more general and likely a better appro
27542
28641
  this.diesRenderInfo.push({
27543
28642
  x: horizontalScale(die.x) + margin.right,
27544
28643
  y: verticalScale(die.y) + margin.top,
27545
- fillStyle: this.calculateFillStyle(die, colorScaleMode),
27546
- opacity: this.calculateOpacity(die.value, highlightedValues),
28644
+ fillStyle: this.calculateFillStyle(die.value, colorScaleMode, highlightedValues),
27547
28645
  text: this.buildLabel(die.value, maxCharacters, dieLabelsHidden, dieLabelsSuffix)
27548
28646
  });
27549
28647
  }
@@ -27579,7 +28677,7 @@ Instead styling against the role which is more general and likely a better appro
27579
28677
  return highlightedValues.length > 0
27580
28678
  && !highlightedValues.some(dieValue => dieValue === selectedValue)
27581
28679
  ? this.nonHighlightedOpacity
27582
- : 0;
28680
+ : 1;
27583
28681
  }
27584
28682
  isColorScaleLinear(colorScaleMode) {
27585
28683
  return colorScaleMode === WaferMapColorScaleMode.linear;
@@ -27587,20 +28685,28 @@ Instead styling against the role which is more general and likely a better appro
27587
28685
  isColorScaleOrdinal(colorScaleMode) {
27588
28686
  return colorScaleMode === WaferMapColorScaleMode.ordinal;
27589
28687
  }
27590
- calculateFillStyle(die, colorScaleMode) {
27591
- if (!this.dieHasData(die.value)) {
27592
- return this.emptyDieColor;
27593
- }
27594
- if (isNaN(+die.value)) {
27595
- return this.nanDieColor;
28688
+ calculateFillStyle(value, colorScaleMode, highlightedValues) {
28689
+ let colorValue = this.emptyDieColor;
28690
+ if (this.dieHasData(value)) {
28691
+ if (isNaN(+value)) {
28692
+ colorValue = this.nanDieColor;
28693
+ }
28694
+ else if (this.isColorScaleLinear(colorScaleMode)) {
28695
+ colorValue = this.d3ColorScale(+value);
28696
+ }
28697
+ else if (this.isColorScaleOrdinal(colorScaleMode)) {
28698
+ colorValue = this.d3ColorScale(value);
28699
+ }
27596
28700
  }
27597
- if (this.isColorScaleLinear(colorScaleMode)) {
27598
- return this.d3ColorScale(+die.value);
28701
+ if (colorValue === undefined) {
28702
+ return this.emptyDieColor;
27599
28703
  }
27600
- if (this.isColorScaleOrdinal(colorScaleMode)) {
27601
- return this.d3ColorScale(die.value);
28704
+ let rgbColor = parseColor(colorValue);
28705
+ if (rgbColor === null) {
28706
+ return this.emptyDieColor;
27602
28707
  }
27603
- return this.emptyDieColor;
28708
+ rgbColor = new ColorRGBA64(rgbColor.r, rgbColor.g, rgbColor.b, this.calculateOpacity(value, highlightedValues));
28709
+ return rgbColor.toStringWebRGBA();
27604
28710
  }
27605
28711
  }
27606
28712