@react-stately/color 3.8.0 → 3.8.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.
Files changed (87) hide show
  1. package/LICENSE +201 -0
  2. package/dist/Color.main.js +3 -15
  3. package/dist/Color.main.js.map +1 -1
  4. package/dist/Color.mjs +3 -15
  5. package/dist/Color.module.js +3 -15
  6. package/dist/Color.module.js.map +1 -1
  7. package/dist/ar-AE.main.js.map +1 -1
  8. package/dist/ar-AE.module.js.map +1 -1
  9. package/dist/bg-BG.main.js.map +1 -1
  10. package/dist/bg-BG.module.js.map +1 -1
  11. package/dist/cs-CZ.main.js.map +1 -1
  12. package/dist/cs-CZ.module.js.map +1 -1
  13. package/dist/da-DK.main.js.map +1 -1
  14. package/dist/da-DK.module.js.map +1 -1
  15. package/dist/de-DE.main.js.map +1 -1
  16. package/dist/de-DE.module.js.map +1 -1
  17. package/dist/el-GR.main.js.map +1 -1
  18. package/dist/el-GR.module.js.map +1 -1
  19. package/dist/en-US.main.js.map +1 -1
  20. package/dist/en-US.module.js.map +1 -1
  21. package/dist/es-ES.main.js.map +1 -1
  22. package/dist/es-ES.module.js.map +1 -1
  23. package/dist/et-EE.main.js.map +1 -1
  24. package/dist/et-EE.module.js.map +1 -1
  25. package/dist/fi-FI.main.js.map +1 -1
  26. package/dist/fi-FI.module.js.map +1 -1
  27. package/dist/fr-FR.main.js.map +1 -1
  28. package/dist/fr-FR.module.js.map +1 -1
  29. package/dist/he-IL.main.js.map +1 -1
  30. package/dist/he-IL.module.js.map +1 -1
  31. package/dist/hr-HR.main.js.map +1 -1
  32. package/dist/hr-HR.module.js.map +1 -1
  33. package/dist/hu-HU.main.js.map +1 -1
  34. package/dist/hu-HU.module.js.map +1 -1
  35. package/dist/it-IT.main.js.map +1 -1
  36. package/dist/it-IT.module.js.map +1 -1
  37. package/dist/ja-JP.main.js.map +1 -1
  38. package/dist/ja-JP.module.js.map +1 -1
  39. package/dist/ko-KR.main.js.map +1 -1
  40. package/dist/ko-KR.module.js.map +1 -1
  41. package/dist/lt-LT.main.js.map +1 -1
  42. package/dist/lt-LT.module.js.map +1 -1
  43. package/dist/lv-LV.main.js.map +1 -1
  44. package/dist/lv-LV.module.js.map +1 -1
  45. package/dist/nb-NO.main.js.map +1 -1
  46. package/dist/nb-NO.module.js.map +1 -1
  47. package/dist/nl-NL.main.js.map +1 -1
  48. package/dist/nl-NL.module.js.map +1 -1
  49. package/dist/pl-PL.main.js.map +1 -1
  50. package/dist/pl-PL.module.js.map +1 -1
  51. package/dist/pt-BR.main.js.map +1 -1
  52. package/dist/pt-BR.module.js.map +1 -1
  53. package/dist/pt-PT.main.js.map +1 -1
  54. package/dist/pt-PT.module.js.map +1 -1
  55. package/dist/ro-RO.main.js.map +1 -1
  56. package/dist/ro-RO.module.js.map +1 -1
  57. package/dist/ru-RU.main.js.map +1 -1
  58. package/dist/ru-RU.module.js.map +1 -1
  59. package/dist/sk-SK.main.js.map +1 -1
  60. package/dist/sk-SK.module.js.map +1 -1
  61. package/dist/sl-SI.main.js.map +1 -1
  62. package/dist/sl-SI.module.js.map +1 -1
  63. package/dist/sr-SP.main.js.map +1 -1
  64. package/dist/sr-SP.module.js.map +1 -1
  65. package/dist/sv-SE.main.js.map +1 -1
  66. package/dist/sv-SE.module.js.map +1 -1
  67. package/dist/tr-TR.main.js.map +1 -1
  68. package/dist/tr-TR.module.js.map +1 -1
  69. package/dist/uk-UA.main.js.map +1 -1
  70. package/dist/uk-UA.module.js.map +1 -1
  71. package/dist/useColor.main.js +1 -1
  72. package/dist/useColor.main.js.map +1 -1
  73. package/dist/useColor.mjs +1 -1
  74. package/dist/useColor.module.js +1 -1
  75. package/dist/useColor.module.js.map +1 -1
  76. package/dist/useColorFieldState.main.js +1 -1
  77. package/dist/useColorFieldState.main.js.map +1 -1
  78. package/dist/useColorFieldState.mjs +1 -1
  79. package/dist/useColorFieldState.module.js +1 -1
  80. package/dist/useColorFieldState.module.js.map +1 -1
  81. package/dist/zh-CN.main.js.map +1 -1
  82. package/dist/zh-CN.module.js.map +1 -1
  83. package/dist/zh-TW.main.js.map +1 -1
  84. package/dist/zh-TW.module.js.map +1 -1
  85. package/package.json +13 -13
  86. package/src/useColor.ts +1 -1
  87. package/src/useColorFieldState.ts +1 -1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Adobe
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -387,11 +387,7 @@ class $83fe1a57d631223b$var$RGBColor extends $83fe1a57d631223b$var$Color {
387
387
  return $83fe1a57d631223b$var$RGBColor.colorChannels;
388
388
  }
389
389
  constructor(red, green, blue, alpha){
390
- super();
391
- this.red = red;
392
- this.green = green;
393
- this.blue = blue;
394
- this.alpha = alpha;
390
+ super(), this.red = red, this.green = green, this.blue = blue, this.alpha = alpha;
395
391
  }
396
392
  }
397
393
  $83fe1a57d631223b$var$RGBColor.colorChannels = [
@@ -528,11 +524,7 @@ class $83fe1a57d631223b$var$HSBColor extends $83fe1a57d631223b$var$Color {
528
524
  return $83fe1a57d631223b$var$HSBColor.colorChannels;
529
525
  }
530
526
  constructor(hue, saturation, brightness, alpha){
531
- super();
532
- this.hue = hue;
533
- this.saturation = saturation;
534
- this.brightness = brightness;
535
- this.alpha = alpha;
527
+ super(), this.hue = hue, this.saturation = saturation, this.brightness = brightness, this.alpha = alpha;
536
528
  }
537
529
  }
538
530
  $83fe1a57d631223b$var$HSBColor.colorChannels = [
@@ -669,11 +661,7 @@ class $83fe1a57d631223b$var$HSLColor extends $83fe1a57d631223b$var$Color {
669
661
  return $83fe1a57d631223b$var$HSLColor.colorChannels;
670
662
  }
671
663
  constructor(hue, saturation, lightness, alpha){
672
- super();
673
- this.hue = hue;
674
- this.saturation = saturation;
675
- this.lightness = lightness;
676
- this.alpha = alpha;
664
+ super(), this.hue = hue, this.saturation = saturation, this.lightness = lightness, this.alpha = alpha;
677
665
  }
678
666
  }
679
667
  $83fe1a57d631223b$var$HSLColor.colorChannels =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,CAAA,MAAM,KAAI,IAAK,OAAO;AACjD;AAEA,SAAS,sCAAgB,CAAS,EAAE,CAAS,EAAE,CAAS;IACtD,0DAA0D;IAC1D,wDAAwD;IACxD,MAAM,IAAI;QACR,SAAS;QAAS,QAAQ;QAAS,QAAQ;QAC3C,QAAQ;QAAU,SAAS;QAAQ,QAAQ;QAC3C,OAAO;QAAW,QAAQ;QAAS,UAAU;KAC9C;IACD,OAAO,qCAAe,GAAG,GAAG,GAAG;AACjC;AAEA,SAAS,mCAAa,CAAS,EAAE,CAAS,EAAE,CAAS;IACnD,8CAA8C;IAC9C,MAAM,WAAW;QACf;QAAoB;QAAoB;QACxC;QAAoB;QAAqB;QACzC;QAAoB;QAAqB;KAC1C;IACD,MAAM,aAAa;QACjB;QAAqB;QAAoB;QACzC;QAAoB;QAAsB;QAC1C;QAAqB;QAAoB;KAC1C;IAED,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,qCAAe,UAAU,GAAG,GAAG;IAC/C,OAAO,qCAAe,YAAY,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC1E;AAEA,SAAS,qCAAe,CAAW,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IAClE,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG;IACrC,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG;IACrC,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG;IACrC,OAAO;QAAC;QAAG;QAAG;KAAE;AAClB","sources":["packages/@react-stately/color/src/Color.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {clamp, toFixedNumber} from '@react-stately/utils';\nimport {ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorSpace, Color as IColor} from '@react-types/color';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {LocalizedStringDictionary, LocalizedStringFormatter} from '@internationalized/string';\nimport {NumberFormatter} from '@internationalized/number';\n\nlet dictionary = new LocalizedStringDictionary(intlMessages);\n\n/** Parses a color from a string value. Throws an error if the string could not be parsed. */\nexport function parseColor(value: string): IColor {\n let res = RGBColor.parse(value) || HSBColor.parse(value) || HSLColor.parse(value);\n if (res) {\n return res;\n }\n\n throw new Error('Invalid color value: ' + value);\n}\n\nexport function normalizeColor(v: string | IColor) {\n if (typeof v === 'string') {\n return parseColor(v);\n } else {\n return v;\n }\n}\n\n/** Returns a list of color channels for a given color space. */\nexport function getColorChannels(colorSpace: ColorSpace) {\n switch (colorSpace) {\n case 'rgb':\n return RGBColor.colorChannels;\n case 'hsl':\n return HSLColor.colorChannels;\n case 'hsb':\n return HSBColor.colorChannels;\n }\n}\n\n/**\n * Returns the hue value normalized to the range of 0 to 360.\n */\nexport function normalizeHue(hue: number) {\n if (hue === 360) {\n return hue;\n }\n\n return ((hue % 360) + 360) % 360;\n}\n\n// Lightness threshold between orange and brown.\nconst ORANGE_LIGHTNESS_THRESHOLD = 0.68;\n// Lightness threshold between pure yellow and \"yellow green\".\nconst YELLOW_GREEN_LIGHTNESS_THRESHOLD = 0.85;\n// The maximum lightness considered to be \"dark\".\nconst MAX_DARK_LIGHTNESS = 0.55;\n// The chroma threshold between gray and color.\nconst GRAY_THRESHOLD = 0.001;\nconst OKLCH_HUES: [number, string][] = [\n [0, 'pink'],\n [15, 'red'],\n [48, 'orange'],\n [94, 'yellow'],\n [135, 'green'],\n [175, 'cyan'],\n [264, 'blue'],\n [284, 'purple'],\n [320, 'magenta'],\n [349, 'pink']\n];\n\nabstract class Color implements IColor {\n abstract toFormat(format: ColorFormat): IColor;\n abstract toString(format: ColorFormat | 'css'): string;\n abstract clone(): IColor;\n abstract getChannelRange(channel: ColorChannel): ColorChannelRange;\n abstract getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;\n abstract formatChannelValue(channel: ColorChannel, locale: string): string;\n\n toHexInt(): number {\n return this.toFormat('rgb').toHexInt();\n }\n\n getChannelValue(channel: ColorChannel): number {\n if (channel in this) {\n return this[channel];\n }\n\n throw new Error('Unsupported color channel: ' + channel);\n }\n\n withChannelValue(channel: ColorChannel, value: number): IColor {\n if (channel in this) {\n let x = this.clone();\n x[channel] = value;\n return x;\n }\n\n throw new Error('Unsupported color channel: ' + channel);\n }\n\n getChannelName(channel: ColorChannel, locale: string) {\n let strings = LocalizedStringDictionary.getGlobalDictionaryForPackage('@react-stately/color') || dictionary;\n return strings.getStringForLocale(channel, locale);\n }\n\n abstract getColorSpace(): ColorSpace;\n\n getColorSpaceAxes(xyChannels: {xChannel?: ColorChannel, yChannel?: ColorChannel}): ColorAxes {\n let {xChannel, yChannel} = xyChannels;\n let xCh = xChannel || this.getColorChannels().find(c => c !== yChannel)!;\n let yCh = yChannel || this.getColorChannels().find(c => c !== xCh)!;\n let zCh = this.getColorChannels().find(c => c !== xCh && c !== yCh)!;\n\n return {xChannel: xCh, yChannel: yCh, zChannel: zCh};\n }\n\n abstract getColorChannels(): [ColorChannel, ColorChannel, ColorChannel]\n\n getColorName(locale: string): string {\n // Convert to oklch color space, which has perceptually uniform lightness across all hues.\n let [l, c, h] = toOKLCH(this);\n\n let strings = LocalizedStringDictionary.getGlobalDictionaryForPackage('@react-stately/color') || dictionary;\n if (l > 0.999) {\n return strings.getStringForLocale('white', locale);\n }\n\n if (l < 0.001) {\n return strings.getStringForLocale('black', locale);\n }\n\n let hue: string;\n [hue, l] = this.getOklchHue(l, c, h, locale);\n\n let lightness = '';\n let chroma = '';\n if (c <= 0.1 && c >= GRAY_THRESHOLD) {\n if (l >= 0.7) {\n chroma = 'pale';\n } else {\n chroma = 'grayish';\n }\n } else if (c >= 0.15) {\n chroma = 'vibrant';\n }\n\n if (l < 0.3) {\n lightness = 'very dark';\n } else if (l < MAX_DARK_LIGHTNESS) {\n lightness = 'dark';\n } else if (l < 0.7) {\n // none\n } else if (l < 0.85) {\n lightness = 'light';\n } else {\n lightness = 'very light';\n }\n\n if (chroma) {\n chroma = strings.getStringForLocale(chroma, locale);\n }\n\n if (lightness) {\n lightness = strings.getStringForLocale(lightness, locale);\n }\n\n let alpha = this.getChannelValue('alpha');\n let formatter = new LocalizedStringFormatter(locale, strings);\n if (alpha < 1) {\n let percentTransparent = new NumberFormatter(locale, {style: 'percent'}).format(1 - alpha);\n return formatter.format('transparentColorName', {\n lightness,\n chroma,\n hue,\n percentTransparent\n }).replace(/\\s+/g, ' ').trim();\n } else {\n return formatter.format('colorName', {\n lightness,\n chroma,\n hue\n }).replace(/\\s+/g, ' ').trim();\n }\n }\n\n private getOklchHue(l: number, c: number, h: number, locale: string): [string, number] {\n let strings = LocalizedStringDictionary.getGlobalDictionaryForPackage('@react-stately/color') || dictionary;\n if (c < GRAY_THRESHOLD) {\n return [strings.getStringForLocale('gray', locale), l];\n }\n\n for (let i = 0; i < OKLCH_HUES.length; i++) {\n let [hue, hueName] = OKLCH_HUES[i];\n let [nextHue, nextHueName] = OKLCH_HUES[i + 1] || [360, 'pink'];\n if (h >= hue && h < nextHue) {\n // Split orange hue into brown/orange depending on lightness.\n if (hueName === 'orange') {\n if (l < ORANGE_LIGHTNESS_THRESHOLD) {\n hueName = 'brown';\n } else {\n // Adjust lightness.\n l = (l - ORANGE_LIGHTNESS_THRESHOLD) + MAX_DARK_LIGHTNESS;\n }\n }\n\n // If the hue is at least halfway to the next hue, add the next hue name as well.\n if (h > hue + (nextHue - hue) / 2 && hueName !== nextHueName) {\n hueName = `${hueName} ${nextHueName}`;\n } else if (hueName === 'yellow' && l < YELLOW_GREEN_LIGHTNESS_THRESHOLD) {\n // Yellow shifts toward green at lower lightnesses.\n hueName = 'yellow green';\n }\n\n let name = strings.getStringForLocale(hueName, locale).toLocaleLowerCase(locale);\n return [name, l];\n }\n }\n\n throw new Error('Unexpected hue');\n }\n\n getHueName(locale: string): string {\n let [l, c, h] = toOKLCH(this);\n let [name] = this.getOklchHue(l, c, h, locale);\n return name;\n }\n}\n\nclass RGBColor extends Color {\n constructor(private red: number, private green: number, private blue: number, private alpha: number) {\n super();\n }\n\n static parse(value: string) {\n let colors: Array<number | undefined> = [];\n // matching #rgb, #rgba, #rrggbb, #rrggbbaa\n if (/^#[\\da-f]+$/i.test(value) && [4, 5, 7, 9].includes(value.length)) {\n const values = (value.length < 6 ? value.replace(/[^#]/gi, '$&$&') : value).slice(1).split('');\n while (values.length > 0) {\n colors.push(parseInt(values.splice(0, 2).join(''), 16));\n }\n colors[3] = colors[3] !== undefined ? colors[3] / 255 : undefined;\n }\n\n // matching rgb(rrr, ggg, bbb), rgba(rrr, ggg, bbb, 0.a)\n const match = value.match(/^rgba?\\((.*)\\)$/);\n if (match?.[1]) {\n colors = match[1].split(',').map(value => Number(value.trim()));\n colors = colors.map((num, i) => {\n return clamp(num ?? 0, 0, i < 3 ? 255 : 1);\n });\n }\n if (colors[0] === undefined || colors[1] === undefined || colors[2] === undefined) {\n return undefined;\n }\n\n return colors.length < 3 ? undefined : new RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);\n }\n\n toString(format: ColorFormat | 'css' = 'css') {\n switch (format) {\n case 'hex':\n return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();\n case 'hexa':\n return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();\n case 'rgb':\n return `rgb(${this.red}, ${this.green}, ${this.blue})`;\n case 'css':\n case 'rgba':\n return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case 'hex':\n case 'hexa':\n case 'rgb':\n case 'rgba':\n return this;\n case 'hsb':\n case 'hsba':\n return this.toHSB();\n case 'hsl':\n case 'hsla':\n return this.toHSL();\n default:\n throw new Error('Unsupported color conversion: rgb -> ' + format);\n }\n }\n\n toHexInt(): number {\n return this.red << 16 | this.green << 8 | this.blue;\n }\n\n /**\n * Converts an RGB color value to HSB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.\n * @returns An HSBColor object.\n */\n private toHSB(): IColor {\n const red = this.red / 255;\n const green = this.green / 255;\n const blue = this.blue / 255;\n const min = Math.min(red, green, blue);\n const brightness = Math.max(red, green, blue);\n const chroma = brightness - min;\n const saturation = brightness === 0 ? 0 : chroma / brightness;\n let hue = 0; // achromatic\n\n if (chroma !== 0) {\n switch (brightness) {\n case red:\n hue = (green - blue) / chroma + (green < blue ? 6 : 0);\n break;\n case green:\n hue = (blue - red) / chroma + 2;\n break;\n case blue:\n hue = (red - green) / chroma + 4;\n break;\n }\n\n hue /= 6;\n }\n\n return new HSBColor(\n toFixedNumber(hue * 360, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(brightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts an RGB color value to HSL.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.\n * @returns An HSLColor object.\n */\n private toHSL(): IColor {\n const red = this.red / 255;\n const green = this.green / 255;\n const blue = this.blue / 255;\n const min = Math.min(red, green, blue);\n const max = Math.max(red, green, blue);\n const lightness = (max + min) / 2;\n const chroma = max - min;\n let hue: number;\n let saturation: number;\n\n if (chroma === 0) {\n hue = saturation = 0; // achromatic\n } else {\n saturation = chroma / (lightness < .5 ? max + min : 2 - max - min);\n\n switch (max) {\n case red:\n hue = (green - blue) / chroma + (green < blue ? 6 : 0);\n break;\n case green:\n hue = (blue - red) / chroma + 2;\n break;\n case blue:\n default:\n hue = (red - green) / chroma + 4;\n break;\n }\n\n hue /= 6;\n }\n\n return new HSLColor(\n toFixedNumber(hue * 360, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(lightness * 100, 2),\n this.alpha);\n }\n\n clone(): IColor {\n return new RGBColor(this.red, this.green, this.blue, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'red':\n case 'green':\n case 'blue':\n return {minValue: 0x0, maxValue: 0xFF, step: 0x1, pageSize: 0x11};\n case 'alpha':\n return {minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n switch (channel) {\n case 'red':\n case 'green':\n case 'blue':\n return {style: 'decimal'};\n case 'alpha':\n return {style: 'percent'};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n let options = this.getChannelFormatOptions(channel);\n let value = this.getChannelValue(channel);\n return new NumberFormatter(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'rgb';\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = ['red', 'green', 'blue'];\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return RGBColor.colorChannels;\n }\n}\n\n// X = <negative/positive number with/without decimal places>\n// before/after a comma, 0 or more whitespaces are allowed\n// - hsb(X, X%, X%)\n// - hsba(X, X%, X%, X)\nconst HSB_REGEX = /hsb\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%)\\)|hsba\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d(.\\d+)?)\\)/;\n\nclass HSBColor extends Color {\n constructor(private hue: number, private saturation: number, private brightness: number, private alpha: number) {\n super();\n }\n\n static parse(value: string): HSBColor | void {\n let m: RegExpMatchArray | null;\n if ((m = value.match(HSB_REGEX))) {\n const [h, s, b, a] = (m[1] ?? m[2]).split(',').map(n => Number(n.trim().replace('%', '')));\n return new HSBColor(normalizeHue(h), clamp(s, 0, 100), clamp(b, 0, 100), clamp(a ?? 1, 0, 1));\n }\n }\n\n toString(format: ColorFormat | 'css' = 'css') {\n switch (format) {\n case 'css':\n return this.toHSL().toString('css');\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n case 'hsb':\n return `hsb(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.brightness, 2)}%)`;\n case 'hsba':\n return `hsba(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case 'hsb':\n case 'hsba':\n return this;\n case 'hsl':\n case 'hsla':\n return this.toHSL();\n case 'rgb':\n case 'rgba':\n return this.toRGB();\n default:\n throw new Error('Unsupported color conversion: hsb -> ' + format);\n }\n }\n\n /**\n * Converts a HSB color to HSL.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.\n * @returns An HSLColor object.\n */\n private toHSL(): IColor {\n let saturation = this.saturation / 100;\n let brightness = this.brightness / 100;\n let lightness = brightness * (1 - saturation / 2);\n saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);\n\n return new HSLColor(\n toFixedNumber(this.hue, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(lightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts a HSV color value to RGB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.\n * @returns An RGBColor object.\n */\n private toRGB(): IColor {\n let hue = this.hue;\n let saturation = this.saturation / 100;\n let brightness = this.brightness / 100;\n let fn = (n: number, k = (n + hue / 60) % 6) => brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0);\n return new RGBColor(\n Math.round(fn(5) * 255),\n Math.round(fn(3) * 255),\n Math.round(fn(1) * 255),\n this.alpha\n );\n }\n\n clone(): IColor {\n return new HSBColor(this.hue, this.saturation, this.brightness, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return {minValue: 0, maxValue: 360, step: 1, pageSize: 15};\n case 'saturation':\n case 'brightness':\n return {minValue: 0, maxValue: 100, step: 1, pageSize: 10};\n case 'alpha':\n return {minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n switch (channel) {\n case 'hue':\n return {style: 'unit', unit: 'degree', unitDisplay: 'narrow'};\n case 'saturation':\n case 'brightness':\n case 'alpha':\n return {style: 'percent'};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n let options = this.getChannelFormatOptions(channel);\n let value = this.getChannelValue(channel);\n if (channel === 'saturation' || channel === 'brightness') {\n value /= 100;\n }\n return new NumberFormatter(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'hsb';\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = ['hue', 'saturation', 'brightness'];\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return HSBColor.colorChannels;\n }\n}\n\n// X = <negative/positive number with/without decimal places>\n// before/after a comma, 0 or more whitespaces are allowed\n// - hsl(X, X%, X%)\n// - hsla(X, X%, X%, X)\nconst HSL_REGEX = /hsl\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%)\\)|hsla\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d(.\\d+)?)\\)/;\n\nclass HSLColor extends Color {\n constructor(private hue: number, private saturation: number, private lightness: number, private alpha: number) {\n super();\n }\n\n static parse(value: string): HSLColor | void {\n let m: RegExpMatchArray | null;\n if ((m = value.match(HSL_REGEX))) {\n const [h, s, l, a] = (m[1] ?? m[2]).split(',').map(n => Number(n.trim().replace('%', '')));\n return new HSLColor(normalizeHue(h), clamp(s, 0, 100), clamp(l, 0, 100), clamp(a ?? 1, 0, 1));\n }\n }\n\n toString(format: ColorFormat | 'css' = 'css') {\n switch (format) {\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n case 'hsl':\n return `hsl(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%)`;\n case 'css':\n case 'hsla':\n return `hsla(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;\n default:\n return this.toFormat(format).toString(format);\n }\n }\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case 'hsl':\n case 'hsla':\n return this;\n case 'hsb':\n case 'hsba':\n return this.toHSB();\n case 'rgb':\n case 'rgba':\n return this.toRGB();\n default:\n throw new Error('Unsupported color conversion: hsl -> ' + format);\n }\n }\n\n /**\n * Converts a HSL color to HSB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.\n * @returns An HSBColor object.\n */\n private toHSB(): IColor {\n let saturation = this.saturation / 100;\n let lightness = this.lightness / 100;\n let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);\n saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);\n return new HSBColor(\n toFixedNumber(this.hue, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(brightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts a HSL color to RGB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.\n * @returns An RGBColor object.\n */\n private toRGB(): IColor {\n let hue = this.hue;\n let saturation = this.saturation / 100;\n let lightness = this.lightness / 100;\n let a = saturation * Math.min(lightness, 1 - lightness);\n let fn = (n: number, k = (n + hue / 30) % 12) => lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return new RGBColor(\n Math.round(fn(0) * 255),\n Math.round(fn(8) * 255),\n Math.round(fn(4) * 255),\n this.alpha\n );\n }\n\n clone(): IColor {\n return new HSLColor(this.hue, this.saturation, this.lightness, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return {minValue: 0, maxValue: 360, step: 1, pageSize: 15};\n case 'saturation':\n case 'lightness':\n return {minValue: 0, maxValue: 100, step: 1, pageSize: 10};\n case 'alpha':\n return {minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n switch (channel) {\n case 'hue':\n return {style: 'unit', unit: 'degree', unitDisplay: 'narrow'};\n case 'saturation':\n case 'lightness':\n case 'alpha':\n return {style: 'percent'};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n let options = this.getChannelFormatOptions(channel);\n let value = this.getChannelValue(channel);\n if (channel === 'saturation' || channel === 'lightness') {\n value /= 100;\n }\n return new NumberFormatter(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'hsl';\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = ['hue', 'saturation', 'lightness'];\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return HSLColor.colorChannels;\n }\n}\n\n// https://www.w3.org/TR/css-color-4/#color-conversion-code\nfunction toOKLCH(color: Color) {\n let rgb = color.toFormat('rgb');\n let red = rgb.getChannelValue('red') / 255;\n let green = rgb.getChannelValue('green') / 255;\n let blue = rgb.getChannelValue('blue') / 255;\n [red, green, blue] = lin_sRGB(red, green, blue);\n let [x, y, z] = lin_sRGB_to_XYZ(red, green, blue);\n let [l, a, b] = XYZ_to_OKLab(x, y, z);\n return OKLab_to_OKLCH(l, a, b);\n}\n\nfunction OKLab_to_OKLCH(l: number, a: number, b: number): [number, number, number] {\n var hue = Math.atan2(b, a) * 180 / Math.PI;\n return [\n l,\n Math.sqrt(a ** 2 + b ** 2), // Chroma\n hue >= 0 ? hue : hue + 360 // Hue, in degrees [0 to 360)\n ];\n}\n\nfunction lin_sRGB(r: number, g: number, b: number): [number, number, number] {\n // convert an array of sRGB values\n // where in-gamut values are in the range [0 - 1]\n // to linear light (un-companded) form.\n // https://en.wikipedia.org/wiki/SRGB\n // Extended transfer function:\n // for negative values, linear portion is extended on reflection of axis,\n // then reflected power function is used.\n return [lin_sRGB_component(r), lin_sRGB_component(g), lin_sRGB_component(b)];\n}\n\nfunction lin_sRGB_component(val: number) {\n let sign = val < 0 ? -1 : 1;\n let abs = Math.abs(val);\n\n if (abs <= 0.04045) {\n return val / 12.92;\n }\n\n return sign * (Math.pow((abs + 0.055) / 1.055, 2.4));\n}\n\nfunction lin_sRGB_to_XYZ(r: number, g: number, b: number) {\n // convert an array of linear-light sRGB values to CIE XYZ\n // using sRGB's own white, D65 (no chromatic adaptation)\n const M = [\n 506752 / 1228815, 87881 / 245763, 12673 / 70218,\n 87098 / 409605, 175762 / 245763, 12673 / 175545,\n 7918 / 409605, 87881 / 737289, 1001167 / 1053270\n ];\n return multiplyMatrix(M, r, g, b);\n}\n\nfunction XYZ_to_OKLab(x: number, y: number, z: number) {\n // Given XYZ relative to D65, convert to OKLab\n const XYZtoLMS = [\n 0.8190224379967030, 0.3619062600528904, -0.1288737815209879,\n 0.0329836539323885, 0.9292868615863434, 0.0361446663506424,\n 0.0481771893596242, 0.2642395317527308, 0.6335478284694309\n ];\n const LMStoOKLab = [\n 0.2104542683093140, 0.7936177747023054, -0.0040720430116193,\n 1.9779985324311684, -2.4285922420485799, 0.4505937096174110,\n 0.0259040424655478, 0.7827717124575296, -0.8086757549230774\n ];\n\n let [a, b, c] = multiplyMatrix(XYZtoLMS, x, y, z);\n return multiplyMatrix(LMStoOKLab, Math.cbrt(a), Math.cbrt(b), Math.cbrt(c));\n}\n\nfunction multiplyMatrix(m: number[], x: number, y: number, z: number): [number, number, number] {\n let a = m[0] * x + m[1] * y + m[2] * z;\n let b = m[3] * x + m[4] * y + m[5] * z;\n let c = m[6] * x + m[7] * y + m[8] * z;\n return [a, b, c];\n}\n"],"names":[],"version":3,"file":"Color.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,IAAI,mCAAa,IAAI,CAAA,GAAA,wDAAwB,EAAE,CAAA,GAAA,mDAAW;AAGnD,SAAS,yCAAW,KAAa;IACtC,IAAI,MAAM,+BAAS,KAAK,CAAC,UAAU,+BAAS,KAAK,CAAC,UAAU,+BAAS,KAAK,CAAC;IAC3E,IAAI,KACF,OAAO;IAGT,MAAM,IAAI,MAAM,0BAA0B;AAC5C;AAEO,SAAS,0CAAe,CAAkB;IAC/C,IAAI,OAAO,MAAM,UACf,OAAO,yCAAW;SAElB,OAAO;AAEX;AAGO,SAAS,0CAAiB,UAAsB;IACrD,OAAQ;QACN,KAAK;YACH,OAAO,+BAAS,aAAa;QAC/B,KAAK;YACH,OAAO,+BAAS,aAAa;QAC/B,KAAK;YAC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AI,CAAC,GAAG,GAAG,EAAE,GAAG,qCAAe,UAAU,GAAG,GAAG;IAC/C,OAAO,qCAAe,YAAY,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC1E;AAEA,SAAS,qCAAe,CAAW,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;IAClE,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG;IACrC,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG;IACrC,IAAI,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,GAAG;IACrC,OAAO;QAAC;QAAG;QAAG;KAAE;AAClB","sources":["packages/@react-stately/color/src/Color.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {clamp, toFixedNumber} from '@react-stately/utils';\nimport {ColorAxes, ColorChannel, ColorChannelRange, ColorFormat, ColorSpace, Color as IColor} from '@react-types/color';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {LocalizedStringDictionary, LocalizedStringFormatter} from '@internationalized/string';\nimport {NumberFormatter} from '@internationalized/number';\n\nlet dictionary = new LocalizedStringDictionary(intlMessages);\n\n/** Parses a color from a string value. Throws an error if the string could not be parsed. */\nexport function parseColor(value: string): IColor {\n let res = RGBColor.parse(value) || HSBColor.parse(value) || HSLColor.parse(value);\n if (res) {\n return res;\n }\n\n throw new Error('Invalid color value: ' + value);\n}\n\nexport function normalizeColor(v: string | IColor) {\n if (typeof v === 'string') {\n return parseColor(v);\n } else {\n return v;\n }\n}\n\n/** Returns a list of color channels for a given color space. */\nexport function getColorChannels(colorSpace: ColorSpace) {\n switch (colorSpace) {\n case 'rgb':\n return RGBColor.colorChannels;\n case 'hsl':\n return HSLColor.colorChannels;\n case 'hsb':\n return HSBColor.colorChannels;\n }\n}\n\n/**\n * Returns the hue value normalized to the range of 0 to 360.\n */\nexport function normalizeHue(hue: number) {\n if (hue === 360) {\n return hue;\n }\n\n return ((hue % 360) + 360) % 360;\n}\n\n// Lightness threshold between orange and brown.\nconst ORANGE_LIGHTNESS_THRESHOLD = 0.68;\n// Lightness threshold between pure yellow and \"yellow green\".\nconst YELLOW_GREEN_LIGHTNESS_THRESHOLD = 0.85;\n// The maximum lightness considered to be \"dark\".\nconst MAX_DARK_LIGHTNESS = 0.55;\n// The chroma threshold between gray and color.\nconst GRAY_THRESHOLD = 0.001;\nconst OKLCH_HUES: [number, string][] = [\n [0, 'pink'],\n [15, 'red'],\n [48, 'orange'],\n [94, 'yellow'],\n [135, 'green'],\n [175, 'cyan'],\n [264, 'blue'],\n [284, 'purple'],\n [320, 'magenta'],\n [349, 'pink']\n];\n\nabstract class Color implements IColor {\n abstract toFormat(format: ColorFormat): IColor;\n abstract toString(format: ColorFormat | 'css'): string;\n abstract clone(): IColor;\n abstract getChannelRange(channel: ColorChannel): ColorChannelRange;\n abstract getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions;\n abstract formatChannelValue(channel: ColorChannel, locale: string): string;\n\n toHexInt(): number {\n return this.toFormat('rgb').toHexInt();\n }\n\n getChannelValue(channel: ColorChannel): number {\n if (channel in this) {\n return this[channel];\n }\n\n throw new Error('Unsupported color channel: ' + channel);\n }\n\n withChannelValue(channel: ColorChannel, value: number): IColor {\n if (channel in this) {\n let x = this.clone();\n x[channel] = value;\n return x;\n }\n\n throw new Error('Unsupported color channel: ' + channel);\n }\n\n getChannelName(channel: ColorChannel, locale: string) {\n let strings = LocalizedStringDictionary.getGlobalDictionaryForPackage('@react-stately/color') || dictionary;\n return strings.getStringForLocale(channel, locale);\n }\n\n abstract getColorSpace(): ColorSpace;\n\n getColorSpaceAxes(xyChannels: {xChannel?: ColorChannel, yChannel?: ColorChannel}): ColorAxes {\n let {xChannel, yChannel} = xyChannels;\n let xCh = xChannel || this.getColorChannels().find(c => c !== yChannel)!;\n let yCh = yChannel || this.getColorChannels().find(c => c !== xCh)!;\n let zCh = this.getColorChannels().find(c => c !== xCh && c !== yCh)!;\n\n return {xChannel: xCh, yChannel: yCh, zChannel: zCh};\n }\n\n abstract getColorChannels(): [ColorChannel, ColorChannel, ColorChannel]\n\n getColorName(locale: string): string {\n // Convert to oklch color space, which has perceptually uniform lightness across all hues.\n let [l, c, h] = toOKLCH(this);\n\n let strings = LocalizedStringDictionary.getGlobalDictionaryForPackage('@react-stately/color') || dictionary;\n if (l > 0.999) {\n return strings.getStringForLocale('white', locale);\n }\n\n if (l < 0.001) {\n return strings.getStringForLocale('black', locale);\n }\n\n let hue: string;\n [hue, l] = this.getOklchHue(l, c, h, locale);\n\n let lightness = '';\n let chroma = '';\n if (c <= 0.1 && c >= GRAY_THRESHOLD) {\n if (l >= 0.7) {\n chroma = 'pale';\n } else {\n chroma = 'grayish';\n }\n } else if (c >= 0.15) {\n chroma = 'vibrant';\n }\n\n if (l < 0.3) {\n lightness = 'very dark';\n } else if (l < MAX_DARK_LIGHTNESS) {\n lightness = 'dark';\n } else if (l < 0.7) {\n // none\n } else if (l < 0.85) {\n lightness = 'light';\n } else {\n lightness = 'very light';\n }\n\n if (chroma) {\n chroma = strings.getStringForLocale(chroma, locale);\n }\n\n if (lightness) {\n lightness = strings.getStringForLocale(lightness, locale);\n }\n\n let alpha = this.getChannelValue('alpha');\n let formatter = new LocalizedStringFormatter(locale, strings);\n if (alpha < 1) {\n let percentTransparent = new NumberFormatter(locale, {style: 'percent'}).format(1 - alpha);\n return formatter.format('transparentColorName', {\n lightness,\n chroma,\n hue,\n percentTransparent\n }).replace(/\\s+/g, ' ').trim();\n } else {\n return formatter.format('colorName', {\n lightness,\n chroma,\n hue\n }).replace(/\\s+/g, ' ').trim();\n }\n }\n\n private getOklchHue(l: number, c: number, h: number, locale: string): [string, number] {\n let strings = LocalizedStringDictionary.getGlobalDictionaryForPackage('@react-stately/color') || dictionary;\n if (c < GRAY_THRESHOLD) {\n return [strings.getStringForLocale('gray', locale), l];\n }\n\n for (let i = 0; i < OKLCH_HUES.length; i++) {\n let [hue, hueName] = OKLCH_HUES[i];\n let [nextHue, nextHueName] = OKLCH_HUES[i + 1] || [360, 'pink'];\n if (h >= hue && h < nextHue) {\n // Split orange hue into brown/orange depending on lightness.\n if (hueName === 'orange') {\n if (l < ORANGE_LIGHTNESS_THRESHOLD) {\n hueName = 'brown';\n } else {\n // Adjust lightness.\n l = (l - ORANGE_LIGHTNESS_THRESHOLD) + MAX_DARK_LIGHTNESS;\n }\n }\n\n // If the hue is at least halfway to the next hue, add the next hue name as well.\n if (h > hue + (nextHue - hue) / 2 && hueName !== nextHueName) {\n hueName = `${hueName} ${nextHueName}`;\n } else if (hueName === 'yellow' && l < YELLOW_GREEN_LIGHTNESS_THRESHOLD) {\n // Yellow shifts toward green at lower lightnesses.\n hueName = 'yellow green';\n }\n\n let name = strings.getStringForLocale(hueName, locale).toLocaleLowerCase(locale);\n return [name, l];\n }\n }\n\n throw new Error('Unexpected hue');\n }\n\n getHueName(locale: string): string {\n let [l, c, h] = toOKLCH(this);\n let [name] = this.getOklchHue(l, c, h, locale);\n return name;\n }\n}\n\nclass RGBColor extends Color {\n constructor(private red: number, private green: number, private blue: number, private alpha: number) {\n super();\n }\n\n static parse(value: string) {\n let colors: Array<number | undefined> = [];\n // matching #rgb, #rgba, #rrggbb, #rrggbbaa\n if (/^#[\\da-f]+$/i.test(value) && [4, 5, 7, 9].includes(value.length)) {\n const values = (value.length < 6 ? value.replace(/[^#]/gi, '$&$&') : value).slice(1).split('');\n while (values.length > 0) {\n colors.push(parseInt(values.splice(0, 2).join(''), 16));\n }\n colors[3] = colors[3] !== undefined ? colors[3] / 255 : undefined;\n }\n\n // matching rgb(rrr, ggg, bbb), rgba(rrr, ggg, bbb, 0.a)\n const match = value.match(/^rgba?\\((.*)\\)$/);\n if (match?.[1]) {\n colors = match[1].split(',').map(value => Number(value.trim()));\n colors = colors.map((num, i) => {\n return clamp(num ?? 0, 0, i < 3 ? 255 : 1);\n });\n }\n if (colors[0] === undefined || colors[1] === undefined || colors[2] === undefined) {\n return undefined;\n }\n\n return colors.length < 3 ? undefined : new RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);\n }\n\n toString(format: ColorFormat | 'css' = 'css') {\n switch (format) {\n case 'hex':\n return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0')).toUpperCase();\n case 'hexa':\n return '#' + (this.red.toString(16).padStart(2, '0') + this.green.toString(16).padStart(2, '0') + this.blue.toString(16).padStart(2, '0') + Math.round(this.alpha * 255).toString(16).padStart(2, '0')).toUpperCase();\n case 'rgb':\n return `rgb(${this.red}, ${this.green}, ${this.blue})`;\n case 'css':\n case 'rgba':\n return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case 'hex':\n case 'hexa':\n case 'rgb':\n case 'rgba':\n return this;\n case 'hsb':\n case 'hsba':\n return this.toHSB();\n case 'hsl':\n case 'hsla':\n return this.toHSL();\n default:\n throw new Error('Unsupported color conversion: rgb -> ' + format);\n }\n }\n\n toHexInt(): number {\n return this.red << 16 | this.green << 8 | this.blue;\n }\n\n /**\n * Converts an RGB color value to HSB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.\n * @returns An HSBColor object.\n */\n private toHSB(): IColor {\n const red = this.red / 255;\n const green = this.green / 255;\n const blue = this.blue / 255;\n const min = Math.min(red, green, blue);\n const brightness = Math.max(red, green, blue);\n const chroma = brightness - min;\n const saturation = brightness === 0 ? 0 : chroma / brightness;\n let hue = 0; // achromatic\n\n if (chroma !== 0) {\n switch (brightness) {\n case red:\n hue = (green - blue) / chroma + (green < blue ? 6 : 0);\n break;\n case green:\n hue = (blue - red) / chroma + 2;\n break;\n case blue:\n hue = (red - green) / chroma + 4;\n break;\n }\n\n hue /= 6;\n }\n\n return new HSBColor(\n toFixedNumber(hue * 360, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(brightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts an RGB color value to HSL.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.\n * @returns An HSLColor object.\n */\n private toHSL(): IColor {\n const red = this.red / 255;\n const green = this.green / 255;\n const blue = this.blue / 255;\n const min = Math.min(red, green, blue);\n const max = Math.max(red, green, blue);\n const lightness = (max + min) / 2;\n const chroma = max - min;\n let hue: number;\n let saturation: number;\n\n if (chroma === 0) {\n hue = saturation = 0; // achromatic\n } else {\n saturation = chroma / (lightness < .5 ? max + min : 2 - max - min);\n\n switch (max) {\n case red:\n hue = (green - blue) / chroma + (green < blue ? 6 : 0);\n break;\n case green:\n hue = (blue - red) / chroma + 2;\n break;\n case blue:\n default:\n hue = (red - green) / chroma + 4;\n break;\n }\n\n hue /= 6;\n }\n\n return new HSLColor(\n toFixedNumber(hue * 360, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(lightness * 100, 2),\n this.alpha);\n }\n\n clone(): IColor {\n return new RGBColor(this.red, this.green, this.blue, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'red':\n case 'green':\n case 'blue':\n return {minValue: 0x0, maxValue: 0xFF, step: 0x1, pageSize: 0x11};\n case 'alpha':\n return {minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n switch (channel) {\n case 'red':\n case 'green':\n case 'blue':\n return {style: 'decimal'};\n case 'alpha':\n return {style: 'percent'};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n let options = this.getChannelFormatOptions(channel);\n let value = this.getChannelValue(channel);\n return new NumberFormatter(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'rgb';\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = ['red', 'green', 'blue'];\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return RGBColor.colorChannels;\n }\n}\n\n// X = <negative/positive number with/without decimal places>\n// before/after a comma, 0 or more whitespaces are allowed\n// - hsb(X, X%, X%)\n// - hsba(X, X%, X%, X)\nconst HSB_REGEX = /hsb\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%)\\)|hsba\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d(.\\d+)?)\\)/;\n\nclass HSBColor extends Color {\n constructor(private hue: number, private saturation: number, private brightness: number, private alpha: number) {\n super();\n }\n\n static parse(value: string): HSBColor | void {\n let m: RegExpMatchArray | null;\n if ((m = value.match(HSB_REGEX))) {\n const [h, s, b, a] = (m[1] ?? m[2]).split(',').map(n => Number(n.trim().replace('%', '')));\n return new HSBColor(normalizeHue(h), clamp(s, 0, 100), clamp(b, 0, 100), clamp(a ?? 1, 0, 1));\n }\n }\n\n toString(format: ColorFormat | 'css' = 'css') {\n switch (format) {\n case 'css':\n return this.toHSL().toString('css');\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n case 'hsb':\n return `hsb(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.brightness, 2)}%)`;\n case 'hsba':\n return `hsba(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.brightness, 2)}%, ${this.alpha})`;\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case 'hsb':\n case 'hsba':\n return this;\n case 'hsl':\n case 'hsla':\n return this.toHSL();\n case 'rgb':\n case 'rgba':\n return this.toRGB();\n default:\n throw new Error('Unsupported color conversion: hsb -> ' + format);\n }\n }\n\n /**\n * Converts a HSB color to HSL.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.\n * @returns An HSLColor object.\n */\n private toHSL(): IColor {\n let saturation = this.saturation / 100;\n let brightness = this.brightness / 100;\n let lightness = brightness * (1 - saturation / 2);\n saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);\n\n return new HSLColor(\n toFixedNumber(this.hue, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(lightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts a HSV color value to RGB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.\n * @returns An RGBColor object.\n */\n private toRGB(): IColor {\n let hue = this.hue;\n let saturation = this.saturation / 100;\n let brightness = this.brightness / 100;\n let fn = (n: number, k = (n + hue / 60) % 6) => brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0);\n return new RGBColor(\n Math.round(fn(5) * 255),\n Math.round(fn(3) * 255),\n Math.round(fn(1) * 255),\n this.alpha\n );\n }\n\n clone(): IColor {\n return new HSBColor(this.hue, this.saturation, this.brightness, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return {minValue: 0, maxValue: 360, step: 1, pageSize: 15};\n case 'saturation':\n case 'brightness':\n return {minValue: 0, maxValue: 100, step: 1, pageSize: 10};\n case 'alpha':\n return {minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n switch (channel) {\n case 'hue':\n return {style: 'unit', unit: 'degree', unitDisplay: 'narrow'};\n case 'saturation':\n case 'brightness':\n case 'alpha':\n return {style: 'percent'};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n let options = this.getChannelFormatOptions(channel);\n let value = this.getChannelValue(channel);\n if (channel === 'saturation' || channel === 'brightness') {\n value /= 100;\n }\n return new NumberFormatter(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'hsb';\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = ['hue', 'saturation', 'brightness'];\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return HSBColor.colorChannels;\n }\n}\n\n// X = <negative/positive number with/without decimal places>\n// before/after a comma, 0 or more whitespaces are allowed\n// - hsl(X, X%, X%)\n// - hsla(X, X%, X%, X)\nconst HSL_REGEX = /hsl\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%)\\)|hsla\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d(.\\d+)?)\\)/;\n\nclass HSLColor extends Color {\n constructor(private hue: number, private saturation: number, private lightness: number, private alpha: number) {\n super();\n }\n\n static parse(value: string): HSLColor | void {\n let m: RegExpMatchArray | null;\n if ((m = value.match(HSL_REGEX))) {\n const [h, s, l, a] = (m[1] ?? m[2]).split(',').map(n => Number(n.trim().replace('%', '')));\n return new HSLColor(normalizeHue(h), clamp(s, 0, 100), clamp(l, 0, 100), clamp(a ?? 1, 0, 1));\n }\n }\n\n toString(format: ColorFormat | 'css' = 'css') {\n switch (format) {\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n case 'hsl':\n return `hsl(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%)`;\n case 'css':\n case 'hsla':\n return `hsla(${this.hue}, ${toFixedNumber(this.saturation, 2)}%, ${toFixedNumber(this.lightness, 2)}%, ${this.alpha})`;\n default:\n return this.toFormat(format).toString(format);\n }\n }\n toFormat(format: ColorFormat): IColor {\n switch (format) {\n case 'hsl':\n case 'hsla':\n return this;\n case 'hsb':\n case 'hsba':\n return this.toHSB();\n case 'rgb':\n case 'rgba':\n return this.toRGB();\n default:\n throw new Error('Unsupported color conversion: hsl -> ' + format);\n }\n }\n\n /**\n * Converts a HSL color to HSB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.\n * @returns An HSBColor object.\n */\n private toHSB(): IColor {\n let saturation = this.saturation / 100;\n let lightness = this.lightness / 100;\n let brightness = lightness + saturation * Math.min(lightness, 1 - lightness);\n saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);\n return new HSBColor(\n toFixedNumber(this.hue, 2),\n toFixedNumber(saturation * 100, 2),\n toFixedNumber(brightness * 100, 2),\n this.alpha\n );\n }\n\n /**\n * Converts a HSL color to RGB.\n * Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.\n * @returns An RGBColor object.\n */\n private toRGB(): IColor {\n let hue = this.hue;\n let saturation = this.saturation / 100;\n let lightness = this.lightness / 100;\n let a = saturation * Math.min(lightness, 1 - lightness);\n let fn = (n: number, k = (n + hue / 30) % 12) => lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return new RGBColor(\n Math.round(fn(0) * 255),\n Math.round(fn(8) * 255),\n Math.round(fn(4) * 255),\n this.alpha\n );\n }\n\n clone(): IColor {\n return new HSLColor(this.hue, this.saturation, this.lightness, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return {minValue: 0, maxValue: 360, step: 1, pageSize: 15};\n case 'saturation':\n case 'lightness':\n return {minValue: 0, maxValue: 100, step: 1, pageSize: 10};\n case 'alpha':\n return {minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getChannelFormatOptions(channel: ColorChannel): Intl.NumberFormatOptions {\n switch (channel) {\n case 'hue':\n return {style: 'unit', unit: 'degree', unitDisplay: 'narrow'};\n case 'saturation':\n case 'lightness':\n case 'alpha':\n return {style: 'percent'};\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n formatChannelValue(channel: ColorChannel, locale: string) {\n let options = this.getChannelFormatOptions(channel);\n let value = this.getChannelValue(channel);\n if (channel === 'saturation' || channel === 'lightness') {\n value /= 100;\n }\n return new NumberFormatter(locale, options).format(value);\n }\n\n getColorSpace(): ColorSpace {\n return 'hsl';\n }\n\n static colorChannels: [ColorChannel, ColorChannel, ColorChannel] = ['hue', 'saturation', 'lightness'];\n getColorChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return HSLColor.colorChannels;\n }\n}\n\n// https://www.w3.org/TR/css-color-4/#color-conversion-code\nfunction toOKLCH(color: Color) {\n let rgb = color.toFormat('rgb');\n let red = rgb.getChannelValue('red') / 255;\n let green = rgb.getChannelValue('green') / 255;\n let blue = rgb.getChannelValue('blue') / 255;\n [red, green, blue] = lin_sRGB(red, green, blue);\n let [x, y, z] = lin_sRGB_to_XYZ(red, green, blue);\n let [l, a, b] = XYZ_to_OKLab(x, y, z);\n return OKLab_to_OKLCH(l, a, b);\n}\n\nfunction OKLab_to_OKLCH(l: number, a: number, b: number): [number, number, number] {\n var hue = Math.atan2(b, a) * 180 / Math.PI;\n return [\n l,\n Math.sqrt(a ** 2 + b ** 2), // Chroma\n hue >= 0 ? hue : hue + 360 // Hue, in degrees [0 to 360)\n ];\n}\n\nfunction lin_sRGB(r: number, g: number, b: number): [number, number, number] {\n // convert an array of sRGB values\n // where in-gamut values are in the range [0 - 1]\n // to linear light (un-companded) form.\n // https://en.wikipedia.org/wiki/SRGB\n // Extended transfer function:\n // for negative values, linear portion is extended on reflection of axis,\n // then reflected power function is used.\n return [lin_sRGB_component(r), lin_sRGB_component(g), lin_sRGB_component(b)];\n}\n\nfunction lin_sRGB_component(val: number) {\n let sign = val < 0 ? -1 : 1;\n let abs = Math.abs(val);\n\n if (abs <= 0.04045) {\n return val / 12.92;\n }\n\n return sign * (Math.pow((abs + 0.055) / 1.055, 2.4));\n}\n\nfunction lin_sRGB_to_XYZ(r: number, g: number, b: number) {\n // convert an array of linear-light sRGB values to CIE XYZ\n // using sRGB's own white, D65 (no chromatic adaptation)\n const M = [\n 506752 / 1228815, 87881 / 245763, 12673 / 70218,\n 87098 / 409605, 175762 / 245763, 12673 / 175545,\n 7918 / 409605, 87881 / 737289, 1001167 / 1053270\n ];\n return multiplyMatrix(M, r, g, b);\n}\n\nfunction XYZ_to_OKLab(x: number, y: number, z: number) {\n // Given XYZ relative to D65, convert to OKLab\n const XYZtoLMS = [\n 0.8190224379967030, 0.3619062600528904, -0.1288737815209879,\n 0.0329836539323885, 0.9292868615863434, 0.0361446663506424,\n 0.0481771893596242, 0.2642395317527308, 0.6335478284694309\n ];\n const LMStoOKLab = [\n 0.2104542683093140, 0.7936177747023054, -0.0040720430116193,\n 1.9779985324311684, -2.4285922420485799, 0.4505937096174110,\n 0.0259040424655478, 0.7827717124575296, -0.8086757549230774\n ];\n\n let [a, b, c] = multiplyMatrix(XYZtoLMS, x, y, z);\n return multiplyMatrix(LMStoOKLab, Math.cbrt(a), Math.cbrt(b), Math.cbrt(c));\n}\n\nfunction multiplyMatrix(m: number[], x: number, y: number, z: number): [number, number, number] {\n let a = m[0] * x + m[1] * y + m[2] * z;\n let b = m[3] * x + m[4] * y + m[5] * z;\n let c = m[6] * x + m[7] * y + m[8] * z;\n return [a, b, c];\n}\n"],"names":[],"version":3,"file":"Color.main.js.map"}
package/dist/Color.mjs CHANGED
@@ -379,11 +379,7 @@ class $799cddbef784668f$var$RGBColor extends $799cddbef784668f$var$Color {
379
379
  return $799cddbef784668f$var$RGBColor.colorChannels;
380
380
  }
381
381
  constructor(red, green, blue, alpha){
382
- super();
383
- this.red = red;
384
- this.green = green;
385
- this.blue = blue;
386
- this.alpha = alpha;
382
+ super(), this.red = red, this.green = green, this.blue = blue, this.alpha = alpha;
387
383
  }
388
384
  }
389
385
  $799cddbef784668f$var$RGBColor.colorChannels = [
@@ -520,11 +516,7 @@ class $799cddbef784668f$var$HSBColor extends $799cddbef784668f$var$Color {
520
516
  return $799cddbef784668f$var$HSBColor.colorChannels;
521
517
  }
522
518
  constructor(hue, saturation, brightness, alpha){
523
- super();
524
- this.hue = hue;
525
- this.saturation = saturation;
526
- this.brightness = brightness;
527
- this.alpha = alpha;
519
+ super(), this.hue = hue, this.saturation = saturation, this.brightness = brightness, this.alpha = alpha;
528
520
  }
529
521
  }
530
522
  $799cddbef784668f$var$HSBColor.colorChannels = [
@@ -661,11 +653,7 @@ class $799cddbef784668f$var$HSLColor extends $799cddbef784668f$var$Color {
661
653
  return $799cddbef784668f$var$HSLColor.colorChannels;
662
654
  }
663
655
  constructor(hue, saturation, lightness, alpha){
664
- super();
665
- this.hue = hue;
666
- this.saturation = saturation;
667
- this.lightness = lightness;
668
- this.alpha = alpha;
656
+ super(), this.hue = hue, this.saturation = saturation, this.lightness = lightness, this.alpha = alpha;
669
657
  }
670
658
  }
671
659
  $799cddbef784668f$var$HSLColor.colorChannels = [
@@ -379,11 +379,7 @@ class $799cddbef784668f$var$RGBColor extends $799cddbef784668f$var$Color {
379
379
  return $799cddbef784668f$var$RGBColor.colorChannels;
380
380
  }
381
381
  constructor(red, green, blue, alpha){
382
- super();
383
- this.red = red;
384
- this.green = green;
385
- this.blue = blue;
386
- this.alpha = alpha;
382
+ super(), this.red = red, this.green = green, this.blue = blue, this.alpha = alpha;
387
383
  }
388
384
  }
389
385
  $799cddbef784668f$var$RGBColor.colorChannels = [
@@ -520,11 +516,7 @@ class $799cddbef784668f$var$HSBColor extends $799cddbef784668f$var$Color {
520
516
  return $799cddbef784668f$var$HSBColor.colorChannels;
521
517
  }
522
518
  constructor(hue, saturation, brightness, alpha){
523
- super();
524
- this.hue = hue;
525
- this.saturation = saturation;
526
- this.brightness = brightness;
527
- this.alpha = alpha;
519
+ super(), this.hue = hue, this.saturation = saturation, this.brightness = brightness, this.alpha = alpha;
528
520
  }
529
521
  }
530
522
  $799cddbef784668f$var$HSBColor.colorChannels = [
@@ -661,11 +653,7 @@ class $799cddbef784668f$var$HSLColor extends $799cddbef784668f$var$Color {
661
653
  return $799cddbef784668f$var$HSLColor.colorChannels;
662
654
  }
663
655
  constructor(hue, saturation, lightness, alpha){
664
- super();
665
- this.hue = hue;
666
- this.saturation = saturation;
667
- this.lightness = lightness;
668
- this.alpha = alpha;
656
+ super(), this.hue = hue, this.saturation = saturation, this.lightness = lightness, this.alpha = alpha;
669
657
  }
670
658
  }
671
659
  $799cddbef784668f$var$HSLColor.colorChannels = [