storybook 10.1.0-alpha.9 → 10.1.0-beta.0

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 (198) hide show
  1. package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
  2. package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
  3. package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
  4. package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-2XZMBGTA.js} +44 -109
  5. package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
  6. package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
  7. package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
  8. package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
  9. package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
  10. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  11. package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
  12. package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
  13. package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
  14. package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
  15. package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
  16. package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
  17. package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
  18. package/dist/_browser-chunks/chunk-FQ7SLVLR.js +66 -0
  19. package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
  20. package/dist/_browser-chunks/chunk-GFY5R5EY.js +47 -0
  21. package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
  22. package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
  23. package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
  24. package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
  25. package/dist/_browser-chunks/{chunk-OWPZQM2D.js → chunk-L4RMQ7D7.js} +60 -110
  26. package/dist/_browser-chunks/chunk-P4F4UVXX.js +951 -0
  27. package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
  28. package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
  29. package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
  30. package/dist/_browser-chunks/chunk-SS2NHR7W.js +2969 -0
  31. package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
  32. package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
  33. package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
  34. package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
  35. package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
  36. package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
  37. package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
  38. package/dist/_browser-chunks/{syntaxhighlighter-CAVLW7PM.js → syntaxhighlighter-IQDEPFLK.js} +704 -1848
  39. package/dist/_node-chunks/{builder-manager-SM3UWERX.js → builder-manager-BDAQHXFI.js} +510 -1019
  40. package/dist/_node-chunks/camelcase-3C7DZZPX.js +37 -0
  41. package/dist/_node-chunks/chunk-2IIQTGNE.js +6024 -0
  42. package/dist/_node-chunks/chunk-56U5LEMP.js +3043 -0
  43. package/dist/_node-chunks/chunk-7LIRCAQE.js +20 -0
  44. package/dist/_node-chunks/chunk-7RN6TXKP.js +603 -0
  45. package/dist/_node-chunks/chunk-7SJ7PZNL.js +4523 -0
  46. package/dist/_node-chunks/{chunk-HHSTA6QS.js → chunk-BG4RDXG7.js} +8 -10
  47. package/dist/_node-chunks/chunk-CBQKMXLQ.js +18 -0
  48. package/dist/_node-chunks/chunk-CN2IW2KQ.js +1564 -0
  49. package/dist/_node-chunks/chunk-CQMAU6UQ.js +943 -0
  50. package/dist/_node-chunks/{chunk-EBUEXRH5.js → chunk-D6ND3TVY.js} +116 -276
  51. package/dist/_node-chunks/chunk-DC355CYB.js +61 -0
  52. package/dist/_node-chunks/{chunk-SGM3ZCCT.js → chunk-EVK2SBW5.js} +292 -688
  53. package/dist/_node-chunks/chunk-IXWEUXJ2.js +119 -0
  54. package/dist/_node-chunks/{chunk-F6EFOEC7.js → chunk-KVRF22SH.js} +469 -983
  55. package/dist/_node-chunks/chunk-LEDP4QQW.js +919 -0
  56. package/dist/_node-chunks/{chunk-GHIBZRKD.js → chunk-MMVV6DGG.js} +8133 -8887
  57. package/dist/_node-chunks/chunk-O5CGEVRI.js +29 -0
  58. package/dist/_node-chunks/chunk-OZZO56XN.js +299 -0
  59. package/dist/_node-chunks/chunk-POT2EVGD.js +78 -0
  60. package/dist/_node-chunks/chunk-R5YGFSTV.js +3781 -0
  61. package/dist/_node-chunks/chunk-SQCTM2OS.js +23 -0
  62. package/dist/_node-chunks/chunk-UFOFO5H7.js +54 -0
  63. package/dist/_node-chunks/chunk-VBF7ALJF.js +72 -0
  64. package/dist/_node-chunks/chunk-W6MAMTUF.js +70 -0
  65. package/dist/_node-chunks/chunk-WURL4XOT.js +46662 -0
  66. package/dist/_node-chunks/chunk-XGK6MVKR.js +61 -0
  67. package/dist/_node-chunks/chunk-YV3GDSDT.js +765 -0
  68. package/dist/_node-chunks/{chunk-ATDHMMIZ.js → chunk-YWV55YW3.js} +15 -24
  69. package/dist/_node-chunks/dist-KEP4IFRN.js +121 -0
  70. package/dist/_node-chunks/globby-4WUBTDCN.js +3452 -0
  71. package/dist/_node-chunks/lib-JVOEKTYM.js +366 -0
  72. package/dist/_node-chunks/mdx-N42X6CFJ-C5WFYYXR.js +14329 -0
  73. package/dist/_node-chunks/p-limit-LDY632RS.js +116 -0
  74. package/dist/actions/decorator.js +21 -42
  75. package/dist/actions/index.js +3 -3
  76. package/dist/babel/index.d.ts +671 -335
  77. package/dist/babel/index.js +10 -11
  78. package/dist/bin/core.js +601 -1548
  79. package/dist/bin/dispatcher.js +36 -36
  80. package/dist/bin/loader.js +24 -38
  81. package/dist/channels/index.js +98 -234
  82. package/dist/cli/index.d.ts +1479 -133
  83. package/dist/cli/index.js +30 -8540
  84. package/dist/client-logger/index.js +31 -61
  85. package/dist/common/index.d.ts +139 -62
  86. package/dist/common/index.js +66 -51
  87. package/dist/components/index.d.ts +575 -273
  88. package/dist/components/index.js +14863 -4313
  89. package/dist/core-events/index.js +2 -66
  90. package/dist/core-server/index.d.ts +3 -2
  91. package/dist/core-server/index.js +2908 -8518
  92. package/dist/core-server/presets/common-manager.css +2 -2
  93. package/dist/core-server/presets/common-manager.js +2521 -5233
  94. package/dist/core-server/presets/common-override-preset.js +31 -60
  95. package/dist/core-server/presets/common-preset.js +663 -962
  96. package/dist/csf/index.js +534 -1179
  97. package/dist/csf-tools/index.js +9 -9
  98. package/dist/docs-tools/index.js +6 -6
  99. package/dist/highlight/index.js +2 -2
  100. package/dist/instrumenter/index.js +199 -415
  101. package/dist/manager/globals-runtime.js +59044 -67141
  102. package/dist/manager/globals.js +2 -3
  103. package/dist/manager/manager-stores.d.ts +1 -0
  104. package/dist/manager/manager-stores.js +23 -0
  105. package/dist/manager/runtime.js +11511 -10953
  106. package/dist/manager-api/index.d.ts +1811 -2
  107. package/dist/manager-api/index.js +1348 -2401
  108. package/dist/manager-errors.d.ts +9 -0
  109. package/dist/manager-errors.js +3 -3
  110. package/dist/mocking-utils/index.d.ts +1126 -0
  111. package/dist/mocking-utils/index.js +1181 -0
  112. package/dist/node-logger/index.d.ts +192 -24
  113. package/dist/node-logger/index.js +23 -4471
  114. package/dist/preview/globals.js +2 -3
  115. package/dist/preview/runtime.js +10799 -22393
  116. package/dist/preview-api/index.d.ts +68 -69
  117. package/dist/preview-api/index.js +13 -13
  118. package/dist/preview-errors.d.ts +9 -0
  119. package/dist/preview-errors.js +4 -4
  120. package/dist/router/index.js +347 -899
  121. package/dist/server-errors.d.ts +34 -1
  122. package/dist/server-errors.js +17 -10
  123. package/dist/telemetry/index.d.ts +24 -3
  124. package/dist/telemetry/index.js +25 -24
  125. package/dist/test/index.js +6131 -11916
  126. package/dist/theming/create.d.ts +1 -0
  127. package/dist/theming/create.js +4 -4
  128. package/dist/theming/index.d.ts +3366 -2599
  129. package/dist/theming/index.js +501 -1091
  130. package/dist/types/index.d.ts +72 -8
  131. package/dist/types/index.js +27 -12
  132. package/dist/viewport/index.js +3 -3
  133. package/package.json +26 -17
  134. package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
  135. package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
  136. package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
  137. package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
  138. package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
  139. package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
  140. package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
  141. package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
  142. package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
  143. package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
  144. package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
  145. package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
  146. package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
  147. package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
  148. package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
  149. package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
  150. package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
  151. package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
  152. package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
  153. package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
  154. package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
  155. package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
  156. package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
  157. package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
  158. package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
  159. package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
  160. package/dist/_node-chunks/camelcase-H5QSGQLK.js +0 -18
  161. package/dist/_node-chunks/chunk-3THWHQOC.js +0 -61
  162. package/dist/_node-chunks/chunk-45YUOLTU.js +0 -69
  163. package/dist/_node-chunks/chunk-4QSNCPAU.js +0 -64656
  164. package/dist/_node-chunks/chunk-744PQSOU.js +0 -79
  165. package/dist/_node-chunks/chunk-74Z2U7QG.js +0 -1544
  166. package/dist/_node-chunks/chunk-7MB7TFPO.js +0 -1198
  167. package/dist/_node-chunks/chunk-A7GS4RFT.js +0 -697
  168. package/dist/_node-chunks/chunk-BIA3A5UM.js +0 -61
  169. package/dist/_node-chunks/chunk-C5G7CLWX.js +0 -1657
  170. package/dist/_node-chunks/chunk-DLFUKMYJ.js +0 -1531
  171. package/dist/_node-chunks/chunk-EMRGRXKT.js +0 -111
  172. package/dist/_node-chunks/chunk-EX46EHHY.js +0 -420
  173. package/dist/_node-chunks/chunk-F76QKNOJ.js +0 -304
  174. package/dist/_node-chunks/chunk-HDCRUTEF.js +0 -220
  175. package/dist/_node-chunks/chunk-HUYAOIPH.js +0 -90
  176. package/dist/_node-chunks/chunk-IBJZQZJC.js +0 -101
  177. package/dist/_node-chunks/chunk-KZN2RDDT.js +0 -6712
  178. package/dist/_node-chunks/chunk-LYUNFU3F.js +0 -4741
  179. package/dist/_node-chunks/chunk-N44SIS6K.js +0 -28
  180. package/dist/_node-chunks/chunk-NILZM6KR.js +0 -18
  181. package/dist/_node-chunks/chunk-PC4ZRP6W.js +0 -34
  182. package/dist/_node-chunks/chunk-TJNGOQUH.js +0 -4272
  183. package/dist/_node-chunks/chunk-UBSYLHIL.js +0 -1250
  184. package/dist/_node-chunks/chunk-UTCLXPOC.js +0 -1518
  185. package/dist/_node-chunks/chunk-WOXXODXP.js +0 -5029
  186. package/dist/_node-chunks/chunk-XC4MEUA6.js +0 -1586
  187. package/dist/_node-chunks/chunk-YRXXMKRR.js +0 -2256
  188. package/dist/_node-chunks/dist-SL73W244.js +0 -175
  189. package/dist/_node-chunks/globby-ZSHAUQZ5.js +0 -5222
  190. package/dist/_node-chunks/lib-U2VIPUTI.js +0 -518
  191. package/dist/_node-chunks/mdx-N42X6CFJ-ZLHD33JK.js +0 -22017
  192. package/dist/_node-chunks/p-limit-K5BS5MSV.js +0 -168
  193. package/dist/_node-chunks/plugin-5PD4YIUH.js +0 -129
  194. package/dist/_node-chunks/plugin-MONDT2WL.js +0 -159
  195. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-EUZJRG3W.js +0 -69102
  196. package/dist/_node-chunks/webpack-mock-plugin-T4LDXEHE.js +0 -124
  197. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -36
  198. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -33
@@ -0,0 +1,836 @@
1
+ import {
2
+ _extends
3
+ } from "./chunk-CHUV5WSW.js";
4
+
5
+ // ../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
6
+ function _assertThisInitialized(e) {
7
+ if (e === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8
+ return e;
9
+ }
10
+
11
+ // ../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
12
+ function _setPrototypeOf(t, e) {
13
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
14
+ return t2.__proto__ = e2, t2;
15
+ }, _setPrototypeOf(t, e);
16
+ }
17
+
18
+ // ../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
19
+ function _inheritsLoose(t, o) {
20
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
21
+ }
22
+
23
+ // ../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
24
+ function _getPrototypeOf(t) {
25
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
26
+ return t2.__proto__ || Object.getPrototypeOf(t2);
27
+ }, _getPrototypeOf(t);
28
+ }
29
+
30
+ // ../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
31
+ function _isNativeFunction(t) {
32
+ try {
33
+ return Function.toString.call(t).indexOf("[native code]") !== -1;
34
+ } catch {
35
+ return typeof t == "function";
36
+ }
37
+ }
38
+
39
+ // ../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
40
+ function _isNativeReflectConstruct() {
41
+ try {
42
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
43
+ }));
44
+ } catch {
45
+ }
46
+ return (_isNativeReflectConstruct = function() {
47
+ return !!t;
48
+ })();
49
+ }
50
+
51
+ // ../node_modules/@babel/runtime/helpers/esm/construct.js
52
+ function _construct(t, e, r) {
53
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
54
+ var o = [null];
55
+ o.push.apply(o, e);
56
+ var p = new (t.bind.apply(t, o))();
57
+ return r && _setPrototypeOf(p, r.prototype), p;
58
+ }
59
+
60
+ // ../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
61
+ function _wrapNativeSuper(t) {
62
+ var r = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
63
+ return _wrapNativeSuper = function(t2) {
64
+ if (t2 === null || !_isNativeFunction(t2)) return t2;
65
+ if (typeof t2 != "function") throw new TypeError("Super expression must either be null or a function");
66
+ if (r !== void 0) {
67
+ if (r.has(t2)) return r.get(t2);
68
+ r.set(t2, Wrapper);
69
+ }
70
+ function Wrapper() {
71
+ return _construct(t2, arguments, _getPrototypeOf(this).constructor);
72
+ }
73
+ return Wrapper.prototype = Object.create(t2.prototype, {
74
+ constructor: {
75
+ value: Wrapper,
76
+ enumerable: !1,
77
+ writable: !0,
78
+ configurable: !0
79
+ }
80
+ }), _setPrototypeOf(Wrapper, t2);
81
+ }, _wrapNativeSuper(t);
82
+ }
83
+
84
+ // ../node_modules/polished/dist/polished.esm.js
85
+ var ERRORS = {
86
+ 1: `Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
87
+
88
+ `,
89
+ 2: `Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
90
+
91
+ `,
92
+ 3: `Passed an incorrect argument to a color function, please pass a string representation of a color.
93
+
94
+ `,
95
+ 4: `Couldn't generate valid rgb string from %s, it returned %s.
96
+
97
+ `,
98
+ 5: `Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.
99
+
100
+ `,
101
+ 6: `Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).
102
+
103
+ `,
104
+ 7: `Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).
105
+
106
+ `,
107
+ 8: `Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.
108
+
109
+ `,
110
+ 9: `Please provide a number of steps to the modularScale helper.
111
+
112
+ `,
113
+ 10: `Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
114
+
115
+ `,
116
+ 11: `Invalid value passed as base to modularScale, expected number or em string but got "%s"
117
+
118
+ `,
119
+ 12: `Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.
120
+
121
+ `,
122
+ 13: `Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.
123
+
124
+ `,
125
+ 14: `Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.
126
+
127
+ `,
128
+ 15: `Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.
129
+
130
+ `,
131
+ 16: `You must provide a template to this method.
132
+
133
+ `,
134
+ 17: `You passed an unsupported selector state to this method.
135
+
136
+ `,
137
+ 18: `minScreen and maxScreen must be provided as stringified numbers with the same units.
138
+
139
+ `,
140
+ 19: `fromSize and toSize must be provided as stringified numbers with the same units.
141
+
142
+ `,
143
+ 20: `expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
144
+
145
+ `,
146
+ 21: "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
147
+ 22: "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
148
+ 23: `fontFace expects a name of a font-family.
149
+
150
+ `,
151
+ 24: `fontFace expects either the path to the font file(s) or a name of a local copy.
152
+
153
+ `,
154
+ 25: `fontFace expects localFonts to be an array.
155
+
156
+ `,
157
+ 26: `fontFace expects fileFormats to be an array.
158
+
159
+ `,
160
+ 27: `radialGradient requries at least 2 color-stops to properly render.
161
+
162
+ `,
163
+ 28: `Please supply a filename to retinaImage() as the first argument.
164
+
165
+ `,
166
+ 29: `Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
167
+
168
+ `,
169
+ 30: "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
170
+ 31: `The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation
171
+
172
+ `,
173
+ 32: `To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])
174
+ To pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')
175
+
176
+ `,
177
+ 33: `The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation
178
+
179
+ `,
180
+ 34: `borderRadius expects a radius value as a string or number as the second argument.
181
+
182
+ `,
183
+ 35: `borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
184
+
185
+ `,
186
+ 36: `Property must be a string value.
187
+
188
+ `,
189
+ 37: `Syntax Error at %s.
190
+
191
+ `,
192
+ 38: `Formula contains a function that needs parentheses at %s.
193
+
194
+ `,
195
+ 39: `Formula is missing closing parenthesis at %s.
196
+
197
+ `,
198
+ 40: `Formula has too many closing parentheses at %s.
199
+
200
+ `,
201
+ 41: `All values in a formula must have the same unit or be unitless.
202
+
203
+ `,
204
+ 42: `Please provide a number of steps to the modularScale helper.
205
+
206
+ `,
207
+ 43: `Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
208
+
209
+ `,
210
+ 44: `Invalid value passed as base to modularScale, expected number or em/rem string but got %s.
211
+
212
+ `,
213
+ 45: `Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.
214
+
215
+ `,
216
+ 46: `Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.
217
+
218
+ `,
219
+ 47: `minScreen and maxScreen must be provided as stringified numbers with the same units.
220
+
221
+ `,
222
+ 48: `fromSize and toSize must be provided as stringified numbers with the same units.
223
+
224
+ `,
225
+ 49: `Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
226
+
227
+ `,
228
+ 50: `Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.
229
+
230
+ `,
231
+ 51: `Expects the first argument object to have the properties prop, fromSize, and toSize.
232
+
233
+ `,
234
+ 52: `fontFace expects either the path to the font file(s) or a name of a local copy.
235
+
236
+ `,
237
+ 53: `fontFace expects localFonts to be an array.
238
+
239
+ `,
240
+ 54: `fontFace expects fileFormats to be an array.
241
+
242
+ `,
243
+ 55: `fontFace expects a name of a font-family.
244
+
245
+ `,
246
+ 56: `linearGradient requries at least 2 color-stops to properly render.
247
+
248
+ `,
249
+ 57: `radialGradient requries at least 2 color-stops to properly render.
250
+
251
+ `,
252
+ 58: `Please supply a filename to retinaImage() as the first argument.
253
+
254
+ `,
255
+ 59: `Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
256
+
257
+ `,
258
+ 60: "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
259
+ 61: `Property must be a string value.
260
+
261
+ `,
262
+ 62: `borderRadius expects a radius value as a string or number as the second argument.
263
+
264
+ `,
265
+ 63: `borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
266
+
267
+ `,
268
+ 64: `The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.
269
+
270
+ `,
271
+ 65: `To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').
272
+
273
+ `,
274
+ 66: `The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.
275
+
276
+ `,
277
+ 67: `You must provide a template to this method.
278
+
279
+ `,
280
+ 68: `You passed an unsupported selector state to this method.
281
+
282
+ `,
283
+ 69: `Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.
284
+
285
+ `,
286
+ 70: `Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.
287
+
288
+ `,
289
+ 71: `Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.
290
+
291
+ `,
292
+ 72: `Passed invalid base value %s to %s(), please pass a value like "12px" or 12.
293
+
294
+ `,
295
+ 73: `Please provide a valid CSS variable.
296
+
297
+ `,
298
+ 74: `CSS variable not found and no default was provided.
299
+
300
+ `,
301
+ 75: `important requires a valid style object, got a %s instead.
302
+
303
+ `,
304
+ 76: `fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.
305
+
306
+ `,
307
+ 77: `remToPx expects a value in "rem" but you provided it in "%s".
308
+
309
+ `,
310
+ 78: `base must be set in "px" or "%" but you set it in "%s".
311
+ `
312
+ };
313
+ function format() {
314
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
315
+ args[_key] = arguments[_key];
316
+ var a = args[0], b = [], c;
317
+ for (c = 1; c < args.length; c += 1)
318
+ b.push(args[c]);
319
+ return b.forEach(function(d) {
320
+ a = a.replace(/%[a-z]/, d);
321
+ }), a;
322
+ }
323
+ var PolishedError = (function(_Error) {
324
+ _inheritsLoose(PolishedError2, _Error);
325
+ function PolishedError2(code) {
326
+ var _this;
327
+ if (process.env.NODE_ENV === "production")
328
+ _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
329
+ else {
330
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)
331
+ args[_key2 - 1] = arguments[_key2];
332
+ _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
333
+ }
334
+ return _assertThisInitialized(_this);
335
+ }
336
+ return PolishedError2;
337
+ })(_wrapNativeSuper(Error));
338
+ function endsWith(string, suffix) {
339
+ return string.substr(-suffix.length) === suffix;
340
+ }
341
+ var cssRegex$1 = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;
342
+ function stripUnit(value) {
343
+ if (typeof value != "string") return value;
344
+ var matchedValue = value.match(cssRegex$1);
345
+ return matchedValue ? parseFloat(value) : value;
346
+ }
347
+ var pxtoFactory = function(to) {
348
+ return function(pxval, base) {
349
+ base === void 0 && (base = "16px");
350
+ var newPxval = pxval, newBase = base;
351
+ if (typeof pxval == "string") {
352
+ if (!endsWith(pxval, "px"))
353
+ throw new PolishedError(69, to, pxval);
354
+ newPxval = stripUnit(pxval);
355
+ }
356
+ if (typeof base == "string") {
357
+ if (!endsWith(base, "px"))
358
+ throw new PolishedError(70, to, base);
359
+ newBase = stripUnit(base);
360
+ }
361
+ if (typeof newPxval == "string")
362
+ throw new PolishedError(71, pxval, to);
363
+ if (typeof newBase == "string")
364
+ throw new PolishedError(72, base, to);
365
+ return "" + newPxval / newBase + to;
366
+ };
367
+ }, pixelsto = pxtoFactory, em = pixelsto("em");
368
+ var rem = pixelsto("rem");
369
+ function colorToInt(color) {
370
+ return Math.round(color * 255);
371
+ }
372
+ function convertToInt(red, green, blue) {
373
+ return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
374
+ }
375
+ function hslToRgb(hue, saturation, lightness, convert) {
376
+ if (convert === void 0 && (convert = convertToInt), saturation === 0)
377
+ return convert(lightness, lightness, lightness);
378
+ var huePrime = (hue % 360 + 360) % 360 / 60, chroma = (1 - Math.abs(2 * lightness - 1)) * saturation, secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1)), red = 0, green = 0, blue = 0;
379
+ huePrime >= 0 && huePrime < 1 ? (red = chroma, green = secondComponent) : huePrime >= 1 && huePrime < 2 ? (red = secondComponent, green = chroma) : huePrime >= 2 && huePrime < 3 ? (green = chroma, blue = secondComponent) : huePrime >= 3 && huePrime < 4 ? (green = secondComponent, blue = chroma) : huePrime >= 4 && huePrime < 5 ? (red = secondComponent, blue = chroma) : huePrime >= 5 && huePrime < 6 && (red = chroma, blue = secondComponent);
380
+ var lightnessModification = lightness - chroma / 2, finalRed = red + lightnessModification, finalGreen = green + lightnessModification, finalBlue = blue + lightnessModification;
381
+ return convert(finalRed, finalGreen, finalBlue);
382
+ }
383
+ var namedColorMap = {
384
+ aliceblue: "f0f8ff",
385
+ antiquewhite: "faebd7",
386
+ aqua: "00ffff",
387
+ aquamarine: "7fffd4",
388
+ azure: "f0ffff",
389
+ beige: "f5f5dc",
390
+ bisque: "ffe4c4",
391
+ black: "000",
392
+ blanchedalmond: "ffebcd",
393
+ blue: "0000ff",
394
+ blueviolet: "8a2be2",
395
+ brown: "a52a2a",
396
+ burlywood: "deb887",
397
+ cadetblue: "5f9ea0",
398
+ chartreuse: "7fff00",
399
+ chocolate: "d2691e",
400
+ coral: "ff7f50",
401
+ cornflowerblue: "6495ed",
402
+ cornsilk: "fff8dc",
403
+ crimson: "dc143c",
404
+ cyan: "00ffff",
405
+ darkblue: "00008b",
406
+ darkcyan: "008b8b",
407
+ darkgoldenrod: "b8860b",
408
+ darkgray: "a9a9a9",
409
+ darkgreen: "006400",
410
+ darkgrey: "a9a9a9",
411
+ darkkhaki: "bdb76b",
412
+ darkmagenta: "8b008b",
413
+ darkolivegreen: "556b2f",
414
+ darkorange: "ff8c00",
415
+ darkorchid: "9932cc",
416
+ darkred: "8b0000",
417
+ darksalmon: "e9967a",
418
+ darkseagreen: "8fbc8f",
419
+ darkslateblue: "483d8b",
420
+ darkslategray: "2f4f4f",
421
+ darkslategrey: "2f4f4f",
422
+ darkturquoise: "00ced1",
423
+ darkviolet: "9400d3",
424
+ deeppink: "ff1493",
425
+ deepskyblue: "00bfff",
426
+ dimgray: "696969",
427
+ dimgrey: "696969",
428
+ dodgerblue: "1e90ff",
429
+ firebrick: "b22222",
430
+ floralwhite: "fffaf0",
431
+ forestgreen: "228b22",
432
+ fuchsia: "ff00ff",
433
+ gainsboro: "dcdcdc",
434
+ ghostwhite: "f8f8ff",
435
+ gold: "ffd700",
436
+ goldenrod: "daa520",
437
+ gray: "808080",
438
+ green: "008000",
439
+ greenyellow: "adff2f",
440
+ grey: "808080",
441
+ honeydew: "f0fff0",
442
+ hotpink: "ff69b4",
443
+ indianred: "cd5c5c",
444
+ indigo: "4b0082",
445
+ ivory: "fffff0",
446
+ khaki: "f0e68c",
447
+ lavender: "e6e6fa",
448
+ lavenderblush: "fff0f5",
449
+ lawngreen: "7cfc00",
450
+ lemonchiffon: "fffacd",
451
+ lightblue: "add8e6",
452
+ lightcoral: "f08080",
453
+ lightcyan: "e0ffff",
454
+ lightgoldenrodyellow: "fafad2",
455
+ lightgray: "d3d3d3",
456
+ lightgreen: "90ee90",
457
+ lightgrey: "d3d3d3",
458
+ lightpink: "ffb6c1",
459
+ lightsalmon: "ffa07a",
460
+ lightseagreen: "20b2aa",
461
+ lightskyblue: "87cefa",
462
+ lightslategray: "789",
463
+ lightslategrey: "789",
464
+ lightsteelblue: "b0c4de",
465
+ lightyellow: "ffffe0",
466
+ lime: "0f0",
467
+ limegreen: "32cd32",
468
+ linen: "faf0e6",
469
+ magenta: "f0f",
470
+ maroon: "800000",
471
+ mediumaquamarine: "66cdaa",
472
+ mediumblue: "0000cd",
473
+ mediumorchid: "ba55d3",
474
+ mediumpurple: "9370db",
475
+ mediumseagreen: "3cb371",
476
+ mediumslateblue: "7b68ee",
477
+ mediumspringgreen: "00fa9a",
478
+ mediumturquoise: "48d1cc",
479
+ mediumvioletred: "c71585",
480
+ midnightblue: "191970",
481
+ mintcream: "f5fffa",
482
+ mistyrose: "ffe4e1",
483
+ moccasin: "ffe4b5",
484
+ navajowhite: "ffdead",
485
+ navy: "000080",
486
+ oldlace: "fdf5e6",
487
+ olive: "808000",
488
+ olivedrab: "6b8e23",
489
+ orange: "ffa500",
490
+ orangered: "ff4500",
491
+ orchid: "da70d6",
492
+ palegoldenrod: "eee8aa",
493
+ palegreen: "98fb98",
494
+ paleturquoise: "afeeee",
495
+ palevioletred: "db7093",
496
+ papayawhip: "ffefd5",
497
+ peachpuff: "ffdab9",
498
+ peru: "cd853f",
499
+ pink: "ffc0cb",
500
+ plum: "dda0dd",
501
+ powderblue: "b0e0e6",
502
+ purple: "800080",
503
+ rebeccapurple: "639",
504
+ red: "f00",
505
+ rosybrown: "bc8f8f",
506
+ royalblue: "4169e1",
507
+ saddlebrown: "8b4513",
508
+ salmon: "fa8072",
509
+ sandybrown: "f4a460",
510
+ seagreen: "2e8b57",
511
+ seashell: "fff5ee",
512
+ sienna: "a0522d",
513
+ silver: "c0c0c0",
514
+ skyblue: "87ceeb",
515
+ slateblue: "6a5acd",
516
+ slategray: "708090",
517
+ slategrey: "708090",
518
+ snow: "fffafa",
519
+ springgreen: "00ff7f",
520
+ steelblue: "4682b4",
521
+ tan: "d2b48c",
522
+ teal: "008080",
523
+ thistle: "d8bfd8",
524
+ tomato: "ff6347",
525
+ turquoise: "40e0d0",
526
+ violet: "ee82ee",
527
+ wheat: "f5deb3",
528
+ white: "fff",
529
+ whitesmoke: "f5f5f5",
530
+ yellow: "ff0",
531
+ yellowgreen: "9acd32"
532
+ };
533
+ function nameToHex(color) {
534
+ if (typeof color != "string") return color;
535
+ var normalizedColorName = color.toLowerCase();
536
+ return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
537
+ }
538
+ var hexRegex = /^#[a-fA-F0-9]{6}$/, hexRgbaRegex = /^#[a-fA-F0-9]{8}$/, reducedHexRegex = /^#[a-fA-F0-9]{3}$/, reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/, rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i, rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i, hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
539
+ function parseToRgb(color) {
540
+ if (typeof color != "string")
541
+ throw new PolishedError(3);
542
+ var normalizedColor = nameToHex(color);
543
+ if (normalizedColor.match(hexRegex))
544
+ return {
545
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
546
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
547
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
548
+ };
549
+ if (normalizedColor.match(hexRgbaRegex)) {
550
+ var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
551
+ return {
552
+ red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
553
+ green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
554
+ blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
555
+ alpha
556
+ };
557
+ }
558
+ if (normalizedColor.match(reducedHexRegex))
559
+ return {
560
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
561
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
562
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
563
+ };
564
+ if (normalizedColor.match(reducedRgbaHexRegex)) {
565
+ var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
566
+ return {
567
+ red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
568
+ green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
569
+ blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
570
+ alpha: _alpha
571
+ };
572
+ }
573
+ var rgbMatched = rgbRegex.exec(normalizedColor);
574
+ if (rgbMatched)
575
+ return {
576
+ red: parseInt("" + rgbMatched[1], 10),
577
+ green: parseInt("" + rgbMatched[2], 10),
578
+ blue: parseInt("" + rgbMatched[3], 10)
579
+ };
580
+ var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
581
+ if (rgbaMatched)
582
+ return {
583
+ red: parseInt("" + rgbaMatched[1], 10),
584
+ green: parseInt("" + rgbaMatched[2], 10),
585
+ blue: parseInt("" + rgbaMatched[3], 10),
586
+ alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
587
+ };
588
+ var hslMatched = hslRegex.exec(normalizedColor);
589
+ if (hslMatched) {
590
+ var hue = parseInt("" + hslMatched[1], 10), saturation = parseInt("" + hslMatched[2], 10) / 100, lightness = parseInt("" + hslMatched[3], 10) / 100, rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")", hslRgbMatched = rgbRegex.exec(rgbColorString);
591
+ if (!hslRgbMatched)
592
+ throw new PolishedError(4, normalizedColor, rgbColorString);
593
+ return {
594
+ red: parseInt("" + hslRgbMatched[1], 10),
595
+ green: parseInt("" + hslRgbMatched[2], 10),
596
+ blue: parseInt("" + hslRgbMatched[3], 10)
597
+ };
598
+ }
599
+ var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
600
+ if (hslaMatched) {
601
+ var _hue = parseInt("" + hslaMatched[1], 10), _saturation = parseInt("" + hslaMatched[2], 10) / 100, _lightness = parseInt("" + hslaMatched[3], 10) / 100, _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")", _hslRgbMatched = rgbRegex.exec(_rgbColorString);
602
+ if (!_hslRgbMatched)
603
+ throw new PolishedError(4, normalizedColor, _rgbColorString);
604
+ return {
605
+ red: parseInt("" + _hslRgbMatched[1], 10),
606
+ green: parseInt("" + _hslRgbMatched[2], 10),
607
+ blue: parseInt("" + _hslRgbMatched[3], 10),
608
+ alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
609
+ };
610
+ }
611
+ throw new PolishedError(5);
612
+ }
613
+ function rgbToHsl(color) {
614
+ var red = color.red / 255, green = color.green / 255, blue = color.blue / 255, max = Math.max(red, green, blue), min = Math.min(red, green, blue), lightness = (max + min) / 2;
615
+ if (max === min)
616
+ return color.alpha !== void 0 ? {
617
+ hue: 0,
618
+ saturation: 0,
619
+ lightness,
620
+ alpha: color.alpha
621
+ } : {
622
+ hue: 0,
623
+ saturation: 0,
624
+ lightness
625
+ };
626
+ var hue, delta = max - min, saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
627
+ switch (max) {
628
+ case red:
629
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
630
+ break;
631
+ case green:
632
+ hue = (blue - red) / delta + 2;
633
+ break;
634
+ default:
635
+ hue = (red - green) / delta + 4;
636
+ break;
637
+ }
638
+ return hue *= 60, color.alpha !== void 0 ? {
639
+ hue,
640
+ saturation,
641
+ lightness,
642
+ alpha: color.alpha
643
+ } : {
644
+ hue,
645
+ saturation,
646
+ lightness
647
+ };
648
+ }
649
+ function parseToHsl(color) {
650
+ return rgbToHsl(parseToRgb(color));
651
+ }
652
+ var reduceHexValue = function(value) {
653
+ return value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6] ? "#" + value[1] + value[3] + value[5] : value;
654
+ }, reduceHexValue$1 = reduceHexValue;
655
+ function numberToHex(value) {
656
+ var hex = value.toString(16);
657
+ return hex.length === 1 ? "0" + hex : hex;
658
+ }
659
+ function colorToHex(color) {
660
+ return numberToHex(Math.round(color * 255));
661
+ }
662
+ function convertToHex(red, green, blue) {
663
+ return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
664
+ }
665
+ function hslToHex(hue, saturation, lightness) {
666
+ return hslToRgb(hue, saturation, lightness, convertToHex);
667
+ }
668
+ function hsl(value, saturation, lightness) {
669
+ if (typeof value == "number" && typeof saturation == "number" && typeof lightness == "number")
670
+ return hslToHex(value, saturation, lightness);
671
+ if (typeof value == "object" && saturation === void 0 && lightness === void 0)
672
+ return hslToHex(value.hue, value.saturation, value.lightness);
673
+ throw new PolishedError(1);
674
+ }
675
+ function hsla(value, saturation, lightness, alpha) {
676
+ if (typeof value == "number" && typeof saturation == "number" && typeof lightness == "number" && typeof alpha == "number")
677
+ return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
678
+ if (typeof value == "object" && saturation === void 0 && lightness === void 0 && alpha === void 0)
679
+ return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
680
+ throw new PolishedError(2);
681
+ }
682
+ function rgb(value, green, blue) {
683
+ if (typeof value == "number" && typeof green == "number" && typeof blue == "number")
684
+ return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
685
+ if (typeof value == "object" && green === void 0 && blue === void 0)
686
+ return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
687
+ throw new PolishedError(6);
688
+ }
689
+ function rgba(firstValue, secondValue, thirdValue, fourthValue) {
690
+ if (typeof firstValue == "string" && typeof secondValue == "number") {
691
+ var rgbValue = parseToRgb(firstValue);
692
+ return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
693
+ } else {
694
+ if (typeof firstValue == "number" && typeof secondValue == "number" && typeof thirdValue == "number" && typeof fourthValue == "number")
695
+ return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
696
+ if (typeof firstValue == "object" && secondValue === void 0 && thirdValue === void 0 && fourthValue === void 0)
697
+ return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
698
+ }
699
+ throw new PolishedError(7);
700
+ }
701
+ var isRgb = function(color) {
702
+ return typeof color.red == "number" && typeof color.green == "number" && typeof color.blue == "number" && (typeof color.alpha != "number" || typeof color.alpha > "u");
703
+ }, isRgba = function(color) {
704
+ return typeof color.red == "number" && typeof color.green == "number" && typeof color.blue == "number" && typeof color.alpha == "number";
705
+ }, isHsl = function(color) {
706
+ return typeof color.hue == "number" && typeof color.saturation == "number" && typeof color.lightness == "number" && (typeof color.alpha != "number" || typeof color.alpha > "u");
707
+ }, isHsla = function(color) {
708
+ return typeof color.hue == "number" && typeof color.saturation == "number" && typeof color.lightness == "number" && typeof color.alpha == "number";
709
+ };
710
+ function toColorString(color) {
711
+ if (typeof color != "object") throw new PolishedError(8);
712
+ if (isRgba(color)) return rgba(color);
713
+ if (isRgb(color)) return rgb(color);
714
+ if (isHsla(color)) return hsla(color);
715
+ if (isHsl(color)) return hsl(color);
716
+ throw new PolishedError(8);
717
+ }
718
+ function curried(f, length, acc) {
719
+ return function() {
720
+ var combined = acc.concat(Array.prototype.slice.call(arguments));
721
+ return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
722
+ };
723
+ }
724
+ function curry(f) {
725
+ return curried(f, f.length, []);
726
+ }
727
+ function adjustHue(degree, color) {
728
+ if (color === "transparent") return color;
729
+ var hslColor = parseToHsl(color);
730
+ return toColorString(_extends({}, hslColor, {
731
+ hue: hslColor.hue + parseFloat(degree)
732
+ }));
733
+ }
734
+ var curriedAdjustHue = curry(adjustHue);
735
+ function guard(lowerBoundary, upperBoundary, value) {
736
+ return Math.max(lowerBoundary, Math.min(upperBoundary, value));
737
+ }
738
+ function darken(amount, color) {
739
+ if (color === "transparent") return color;
740
+ var hslColor = parseToHsl(color);
741
+ return toColorString(_extends({}, hslColor, {
742
+ lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
743
+ }));
744
+ }
745
+ var curriedDarken = curry(darken), curriedDarken$1 = curriedDarken;
746
+ function desaturate(amount, color) {
747
+ if (color === "transparent") return color;
748
+ var hslColor = parseToHsl(color);
749
+ return toColorString(_extends({}, hslColor, {
750
+ saturation: guard(0, 1, hslColor.saturation - parseFloat(amount))
751
+ }));
752
+ }
753
+ var curriedDesaturate = curry(desaturate);
754
+ function lighten(amount, color) {
755
+ if (color === "transparent") return color;
756
+ var hslColor = parseToHsl(color);
757
+ return toColorString(_extends({}, hslColor, {
758
+ lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
759
+ }));
760
+ }
761
+ var curriedLighten = curry(lighten), curriedLighten$1 = curriedLighten;
762
+ function mix(weight, color, otherColor) {
763
+ if (color === "transparent") return otherColor;
764
+ if (otherColor === "transparent") return color;
765
+ if (weight === 0) return otherColor;
766
+ var parsedColor1 = parseToRgb(color), color1 = _extends({}, parsedColor1, {
767
+ alpha: typeof parsedColor1.alpha == "number" ? parsedColor1.alpha : 1
768
+ }), parsedColor2 = parseToRgb(otherColor), color2 = _extends({}, parsedColor2, {
769
+ alpha: typeof parsedColor2.alpha == "number" ? parsedColor2.alpha : 1
770
+ }), alphaDelta = color1.alpha - color2.alpha, x = parseFloat(weight) * 2 - 1, y = x * alphaDelta === -1 ? x : x + alphaDelta, z = 1 + x * alphaDelta, weight1 = (y / z + 1) / 2, weight2 = 1 - weight1, mixedColor = {
771
+ red: Math.floor(color1.red * weight1 + color2.red * weight2),
772
+ green: Math.floor(color1.green * weight1 + color2.green * weight2),
773
+ blue: Math.floor(color1.blue * weight1 + color2.blue * weight2),
774
+ alpha: color1.alpha * parseFloat(weight) + color2.alpha * (1 - parseFloat(weight))
775
+ };
776
+ return rgba(mixedColor);
777
+ }
778
+ var curriedMix = curry(mix), mix$1 = curriedMix;
779
+ function opacify(amount, color) {
780
+ if (color === "transparent") return color;
781
+ var parsedColor = parseToRgb(color), alpha = typeof parsedColor.alpha == "number" ? parsedColor.alpha : 1, colorWithAlpha = _extends({}, parsedColor, {
782
+ alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
783
+ });
784
+ return rgba(colorWithAlpha);
785
+ }
786
+ var curriedOpacify = curry(opacify), curriedOpacify$1 = curriedOpacify;
787
+ function saturate(amount, color) {
788
+ if (color === "transparent") return color;
789
+ var hslColor = parseToHsl(color);
790
+ return toColorString(_extends({}, hslColor, {
791
+ saturation: guard(0, 1, hslColor.saturation + parseFloat(amount))
792
+ }));
793
+ }
794
+ var curriedSaturate = curry(saturate);
795
+ function setHue(hue, color) {
796
+ return color === "transparent" ? color : toColorString(_extends({}, parseToHsl(color), {
797
+ hue: parseFloat(hue)
798
+ }));
799
+ }
800
+ var curriedSetHue = curry(setHue);
801
+ function setLightness(lightness, color) {
802
+ return color === "transparent" ? color : toColorString(_extends({}, parseToHsl(color), {
803
+ lightness: parseFloat(lightness)
804
+ }));
805
+ }
806
+ var curriedSetLightness = curry(setLightness);
807
+ function setSaturation(saturation, color) {
808
+ return color === "transparent" ? color : toColorString(_extends({}, parseToHsl(color), {
809
+ saturation: parseFloat(saturation)
810
+ }));
811
+ }
812
+ var curriedSetSaturation = curry(setSaturation);
813
+ function shade(percentage, color) {
814
+ return color === "transparent" ? color : mix$1(parseFloat(percentage), "rgb(0, 0, 0)", color);
815
+ }
816
+ var curriedShade = curry(shade);
817
+ function tint(percentage, color) {
818
+ return color === "transparent" ? color : mix$1(parseFloat(percentage), "rgb(255, 255, 255)", color);
819
+ }
820
+ var curriedTint = curry(tint);
821
+ function transparentize(amount, color) {
822
+ if (color === "transparent") return color;
823
+ var parsedColor = parseToRgb(color), alpha = typeof parsedColor.alpha == "number" ? parsedColor.alpha : 1, colorWithAlpha = _extends({}, parsedColor, {
824
+ alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
825
+ });
826
+ return rgba(colorWithAlpha);
827
+ }
828
+ var curriedTransparentize = curry(transparentize), curriedTransparentize$1 = curriedTransparentize;
829
+
830
+ export {
831
+ rgba,
832
+ curriedDarken$1,
833
+ curriedLighten$1,
834
+ curriedOpacify$1,
835
+ curriedTransparentize$1
836
+ };