@jesscss/fns 1.0.8-alpha.8 → 2.0.0-alpha.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 (625) hide show
  1. package/README.md +15 -5
  2. package/lib/__tests__/color-adjustments.test.d.ts +1 -0
  3. package/lib/__tests__/color-adjustments.test.js +137 -0
  4. package/lib/__tests__/color-adjustments.test.js.map +1 -0
  5. package/lib/__tests__/color-components.test.d.ts +1 -0
  6. package/lib/__tests__/color-components.test.js +76 -0
  7. package/lib/__tests__/color-components.test.js.map +1 -0
  8. package/lib/__tests__/color.test.d.ts +1 -0
  9. package/lib/__tests__/color.test.js +41 -0
  10. package/lib/__tests__/color.test.js.map +1 -0
  11. package/lib/__tests__/floor.test.d.ts +1 -0
  12. package/lib/__tests__/floor.test.js +38 -0
  13. package/lib/__tests__/floor.test.js.map +1 -0
  14. package/lib/__tests__/iif.d.ts +1 -0
  15. package/lib/__tests__/iif.js +38 -0
  16. package/lib/__tests__/iif.test.d.ts +1 -0
  17. package/lib/__tests__/iif.test.js +34 -0
  18. package/lib/__tests__/iif.test.js.map +1 -0
  19. package/lib/__tests__/math.d.ts +1 -0
  20. package/lib/__tests__/math.js +45 -0
  21. package/lib/__tests__/math.test.d.ts +1 -0
  22. package/lib/__tests__/math.test.js +46 -0
  23. package/lib/__tests__/math.test.js.map +1 -0
  24. package/lib/conversions.d.ts +46 -0
  25. package/lib/conversions.js +142 -0
  26. package/lib/conversions.js.map +1 -0
  27. package/lib/index.d.ts +1 -5
  28. package/lib/index.js +3 -17
  29. package/lib/index.js.map +1 -0
  30. package/lib/less/__tests__/advanced-blend-modes.test.d.ts +1 -0
  31. package/lib/less/__tests__/advanced-blend-modes.test.js +29 -0
  32. package/lib/less/__tests__/advanced-blend-modes.test.js.map +1 -0
  33. package/lib/less/__tests__/alpha-adjustments.test.d.ts +1 -0
  34. package/lib/less/__tests__/alpha-adjustments.test.js +36 -0
  35. package/lib/less/__tests__/alpha-adjustments.test.js.map +1 -0
  36. package/lib/less/__tests__/argb.test.d.ts +1 -0
  37. package/lib/less/__tests__/argb.test.js +15 -0
  38. package/lib/less/__tests__/argb.test.js.map +1 -0
  39. package/lib/less/__tests__/blend-modes.test.d.ts +1 -0
  40. package/lib/less/__tests__/blend-modes.test.js +27 -0
  41. package/lib/less/__tests__/blend-modes.test.js.map +1 -0
  42. package/lib/less/__tests__/contrast.test.d.ts +1 -0
  43. package/lib/less/__tests__/contrast.test.js +29 -0
  44. package/lib/less/__tests__/contrast.test.js.map +1 -0
  45. package/lib/less/__tests__/convert.test.d.ts +1 -0
  46. package/lib/less/__tests__/convert.test.js +25 -0
  47. package/lib/less/__tests__/convert.test.js.map +1 -0
  48. package/lib/less/__tests__/e.test.d.ts +1 -0
  49. package/lib/less/__tests__/e.test.js +12 -0
  50. package/lib/less/__tests__/e.test.js.map +1 -0
  51. package/lib/less/__tests__/extract.test.d.ts +1 -0
  52. package/lib/less/__tests__/extract.test.js +32 -0
  53. package/lib/less/__tests__/extract.test.js.map +1 -0
  54. package/lib/less/__tests__/format.test.d.ts +1 -0
  55. package/lib/less/__tests__/format.test.js +20 -0
  56. package/lib/less/__tests__/format.test.js.map +1 -0
  57. package/lib/less/__tests__/get-unit.test.d.ts +1 -0
  58. package/lib/less/__tests__/get-unit.test.js +15 -0
  59. package/lib/less/__tests__/get-unit.test.js.map +1 -0
  60. package/lib/less/__tests__/hsl-branches.test.d.ts +1 -0
  61. package/lib/less/__tests__/hsl-branches.test.js +27 -0
  62. package/lib/less/__tests__/hsl-branches.test.js.map +1 -0
  63. package/lib/less/__tests__/hsl-relative-errors.test.d.ts +1 -0
  64. package/lib/less/__tests__/hsl-relative-errors.test.js +97 -0
  65. package/lib/less/__tests__/hsl-relative-errors.test.js.map +1 -0
  66. package/lib/less/__tests__/hsla-fallback.test.d.ts +1 -0
  67. package/lib/less/__tests__/hsla-fallback.test.js +29 -0
  68. package/lib/less/__tests__/hsla-fallback.test.js.map +1 -0
  69. package/lib/less/__tests__/hsv-family.test.d.ts +1 -0
  70. package/lib/less/__tests__/hsv-family.test.js +43 -0
  71. package/lib/less/__tests__/hsv-family.test.js.map +1 -0
  72. package/lib/less/__tests__/isdefined.test.d.ts +1 -0
  73. package/lib/less/__tests__/isdefined.test.js +18 -0
  74. package/lib/less/__tests__/isdefined.test.js.map +1 -0
  75. package/lib/less/__tests__/isruleset.test.d.ts +1 -0
  76. package/lib/less/__tests__/isruleset.test.js +22 -0
  77. package/lib/less/__tests__/isruleset.test.js.map +1 -0
  78. package/lib/less/__tests__/length.test.d.ts +1 -0
  79. package/lib/less/__tests__/length.test.js +16 -0
  80. package/lib/less/__tests__/length.test.js.map +1 -0
  81. package/lib/less/__tests__/luma-luminance-hsv-channels.test.d.ts +1 -0
  82. package/lib/less/__tests__/luma-luminance-hsv-channels.test.js +35 -0
  83. package/lib/less/__tests__/luma-luminance-hsv-channels.test.js.map +1 -0
  84. package/lib/less/__tests__/max.test.d.ts +1 -0
  85. package/lib/less/__tests__/max.test.js +35 -0
  86. package/lib/less/__tests__/max.test.js.map +1 -0
  87. package/lib/less/__tests__/min.test.d.ts +1 -0
  88. package/lib/less/__tests__/min.test.js +37 -0
  89. package/lib/less/__tests__/min.test.js.map +1 -0
  90. package/lib/less/__tests__/mix.test.d.ts +1 -0
  91. package/lib/less/__tests__/mix.test.js +25 -0
  92. package/lib/less/__tests__/mix.test.js.map +1 -0
  93. package/lib/less/__tests__/mod.test.d.ts +1 -0
  94. package/lib/less/__tests__/mod.test.js +11 -0
  95. package/lib/less/__tests__/mod.test.js.map +1 -0
  96. package/lib/less/__tests__/percentage.test.d.ts +1 -0
  97. package/lib/less/__tests__/percentage.test.js +12 -0
  98. package/lib/less/__tests__/percentage.test.js.map +1 -0
  99. package/lib/less/__tests__/pow.test.d.ts +1 -0
  100. package/lib/less/__tests__/pow.test.js +11 -0
  101. package/lib/less/__tests__/pow.test.js.map +1 -0
  102. package/lib/less/__tests__/reexports-smoke.test.d.ts +1 -0
  103. package/lib/less/__tests__/reexports-smoke.test.js +26 -0
  104. package/lib/less/__tests__/reexports-smoke.test.js.map +1 -0
  105. package/lib/less/__tests__/replace.test.d.ts +1 -0
  106. package/lib/less/__tests__/replace.test.js +22 -0
  107. package/lib/less/__tests__/replace.test.js.map +1 -0
  108. package/lib/less/__tests__/rgb-relative-errors.test.d.ts +1 -0
  109. package/lib/less/__tests__/rgb-relative-errors.test.js +98 -0
  110. package/lib/less/__tests__/rgb-relative-errors.test.js.map +1 -0
  111. package/lib/less/__tests__/rgb-rgba-branches.test.d.ts +1 -0
  112. package/lib/less/__tests__/rgb-rgba-branches.test.js +49 -0
  113. package/lib/less/__tests__/rgb-rgba-branches.test.js.map +1 -0
  114. package/lib/less/__tests__/rgba-fallback.test.d.ts +1 -0
  115. package/lib/less/__tests__/rgba-fallback.test.js +29 -0
  116. package/lib/less/__tests__/rgba-fallback.test.js.map +1 -0
  117. package/lib/less/__tests__/shade.test.d.ts +1 -0
  118. package/lib/less/__tests__/shade.test.js +19 -0
  119. package/lib/less/__tests__/shade.test.js.map +1 -0
  120. package/lib/less/__tests__/spin.test.d.ts +1 -0
  121. package/lib/less/__tests__/spin.test.js +26 -0
  122. package/lib/less/__tests__/spin.test.js.map +1 -0
  123. package/lib/less/__tests__/tint.test.d.ts +1 -0
  124. package/lib/less/__tests__/tint.test.js +19 -0
  125. package/lib/less/__tests__/tint.test.js.map +1 -0
  126. package/lib/less/__tests__/types.test.d.ts +1 -0
  127. package/lib/less/__tests__/types.test.js +28 -0
  128. package/lib/less/__tests__/types.test.js.map +1 -0
  129. package/lib/less/__tests__/unit.test.d.ts +1 -0
  130. package/lib/less/__tests__/unit.test.js +17 -0
  131. package/lib/less/__tests__/unit.test.js.map +1 -0
  132. package/lib/less/abs.d.ts +7 -0
  133. package/lib/less/abs.js +8 -0
  134. package/lib/less/abs.js.map +1 -0
  135. package/lib/less/acos.d.ts +440 -0
  136. package/lib/less/acos.js +3 -0
  137. package/lib/less/acos.js.map +1 -0
  138. package/lib/less/alpha.d.ts +7 -0
  139. package/lib/less/alpha.js +8 -0
  140. package/lib/less/alpha.js.map +1 -0
  141. package/lib/less/argb.d.ts +441 -0
  142. package/lib/less/argb.js +17 -0
  143. package/lib/less/argb.js.map +1 -0
  144. package/lib/less/asin.d.ts +440 -0
  145. package/lib/less/asin.js +3 -0
  146. package/lib/less/asin.js.map +1 -0
  147. package/lib/less/atan.d.ts +440 -0
  148. package/lib/less/atan.js +3 -0
  149. package/lib/less/atan.js.map +1 -0
  150. package/lib/less/average.d.ts +601 -0
  151. package/lib/less/average.js +17 -0
  152. package/lib/less/average.js.map +1 -0
  153. package/lib/less/blue.d.ts +7 -0
  154. package/lib/less/blue.js +8 -0
  155. package/lib/less/blue.js.map +1 -0
  156. package/lib/less/ceil.d.ts +7 -0
  157. package/lib/less/ceil.js +8 -0
  158. package/lib/less/ceil.js.map +1 -0
  159. package/lib/less/color.d.ts +441 -0
  160. package/lib/less/color.js +33 -0
  161. package/lib/less/color.js.map +1 -0
  162. package/lib/less/contrast.d.ts +1427 -0
  163. package/lib/less/contrast.js +57 -0
  164. package/lib/less/contrast.js.map +1 -0
  165. package/lib/less/convert.d.ts +600 -0
  166. package/lib/less/convert.js +45 -0
  167. package/lib/less/convert.js.map +1 -0
  168. package/lib/less/cos.d.ts +440 -0
  169. package/lib/less/cos.js +3 -0
  170. package/lib/less/cos.js.map +1 -0
  171. package/lib/less/darken.d.ts +980 -0
  172. package/lib/less/darken.js +29 -0
  173. package/lib/less/darken.js.map +1 -0
  174. package/lib/less/desaturate.d.ts +980 -0
  175. package/lib/less/desaturate.js +29 -0
  176. package/lib/less/desaturate.js.map +1 -0
  177. package/lib/less/difference.d.ts +601 -0
  178. package/lib/less/difference.js +18 -0
  179. package/lib/less/difference.js.map +1 -0
  180. package/lib/less/e.d.ts +444 -0
  181. package/lib/less/e.js +17 -0
  182. package/lib/less/e.js.map +1 -0
  183. package/lib/less/each.d.ts +615 -0
  184. package/lib/less/each.js +64 -0
  185. package/lib/less/each.js.map +1 -0
  186. package/lib/less/exclusion.d.ts +601 -0
  187. package/lib/less/exclusion.js +18 -0
  188. package/lib/less/exclusion.js.map +1 -0
  189. package/lib/less/extract.d.ts +625 -0
  190. package/lib/less/extract.js +43 -0
  191. package/lib/less/extract.js.map +1 -0
  192. package/lib/less/fade.d.ts +600 -0
  193. package/lib/less/fade.js +28 -0
  194. package/lib/less/fade.js.map +1 -0
  195. package/lib/less/fadein.d.ts +980 -0
  196. package/lib/less/fadein.js +37 -0
  197. package/lib/less/fadein.js.map +1 -0
  198. package/lib/less/fadeout.d.ts +980 -0
  199. package/lib/less/fadeout.js +36 -0
  200. package/lib/less/fadeout.js.map +1 -0
  201. package/lib/less/floor.d.ts +7 -0
  202. package/lib/less/floor.js +8 -0
  203. package/lib/less/floor.js.map +1 -0
  204. package/lib/less/format.d.ts +1821 -0
  205. package/lib/less/format.js +44 -0
  206. package/lib/less/format.js.map +1 -0
  207. package/lib/less/get-unit.d.ts +441 -0
  208. package/lib/less/get-unit.js +11 -0
  209. package/lib/less/get-unit.js.map +1 -0
  210. package/lib/less/green.d.ts +7 -0
  211. package/lib/less/green.js +8 -0
  212. package/lib/less/green.js.map +1 -0
  213. package/lib/less/greyscale.d.ts +441 -0
  214. package/lib/less/greyscale.js +18 -0
  215. package/lib/less/greyscale.js.map +1 -0
  216. package/lib/less/hardlight.d.ts +601 -0
  217. package/lib/less/hardlight.js +19 -0
  218. package/lib/less/hardlight.js.map +1 -0
  219. package/lib/less/hsl.d.ts +1063 -0
  220. package/lib/less/hsl.js +257 -0
  221. package/lib/less/hsl.js.map +1 -0
  222. package/lib/less/hsla.d.ts +354 -0
  223. package/lib/less/hsla.js +31 -0
  224. package/lib/less/hsla.js.map +1 -0
  225. package/lib/less/hsv.d.ts +723 -0
  226. package/lib/less/hsv.js +20 -0
  227. package/lib/less/hsv.js.map +1 -0
  228. package/lib/less/hsva.d.ts +991 -0
  229. package/lib/less/hsva.js +53 -0
  230. package/lib/less/hsva.js.map +1 -0
  231. package/lib/less/hsvhue.d.ts +441 -0
  232. package/lib/less/hsvhue.js +11 -0
  233. package/lib/less/hsvhue.js.map +1 -0
  234. package/lib/less/hsvsaturation.d.ts +441 -0
  235. package/lib/less/hsvsaturation.js +12 -0
  236. package/lib/less/hsvsaturation.js.map +1 -0
  237. package/lib/less/hsvvalue.d.ts +441 -0
  238. package/lib/less/hsvvalue.js +11 -0
  239. package/lib/less/hsvvalue.js.map +1 -0
  240. package/lib/less/hue.d.ts +441 -0
  241. package/lib/less/hue.js +11 -0
  242. package/lib/less/hue.js.map +1 -0
  243. package/lib/less/iif.d.ts +1033 -0
  244. package/lib/less/iif.js +30 -0
  245. package/lib/less/iif.js.map +1 -0
  246. package/lib/less/index.d.ts +75 -0
  247. package/lib/less/index.js +76 -0
  248. package/lib/less/index.js.map +1 -0
  249. package/lib/less/isdefined.d.ts +466 -0
  250. package/lib/less/isdefined.js +21 -0
  251. package/lib/less/isdefined.js.map +1 -0
  252. package/lib/less/isruleset.d.ts +466 -0
  253. package/lib/less/isruleset.js +24 -0
  254. package/lib/less/isruleset.js.map +1 -0
  255. package/lib/less/length.d.ts +441 -0
  256. package/lib/less/length.js +21 -0
  257. package/lib/less/length.js.map +1 -0
  258. package/lib/less/lighten.d.ts +980 -0
  259. package/lib/less/lighten.js +29 -0
  260. package/lib/less/lighten.js.map +1 -0
  261. package/lib/less/lightness.d.ts +441 -0
  262. package/lib/less/lightness.js +11 -0
  263. package/lib/less/lightness.js.map +1 -0
  264. package/lib/less/luma.d.ts +441 -0
  265. package/lib/less/luma.js +14 -0
  266. package/lib/less/luma.js.map +1 -0
  267. package/lib/less/luminance.d.ts +441 -0
  268. package/lib/less/luminance.js +16 -0
  269. package/lib/less/luminance.js.map +1 -0
  270. package/lib/less/math-factory.d.ts +774 -0
  271. package/lib/less/math-factory.js +18 -0
  272. package/lib/less/math-factory.js.map +1 -0
  273. package/lib/less/mathv1.d.ts +0 -0
  274. package/lib/less/mathv1.js +209 -0
  275. package/lib/less/mathv1.js.map +1 -0
  276. package/lib/less/max.d.ts +466 -0
  277. package/lib/less/max.js +85 -0
  278. package/lib/less/max.js.map +1 -0
  279. package/lib/less/min.d.ts +466 -0
  280. package/lib/less/min.js +85 -0
  281. package/lib/less/min.js.map +1 -0
  282. package/lib/less/mix.d.ts +980 -0
  283. package/lib/less/mix.js +39 -0
  284. package/lib/less/mix.js.map +1 -0
  285. package/lib/less/mod.d.ts +600 -0
  286. package/lib/less/mod.js +16 -0
  287. package/lib/less/mod.js.map +1 -0
  288. package/lib/less/multiply.d.ts +601 -0
  289. package/lib/less/multiply.js +18 -0
  290. package/lib/less/multiply.js.map +1 -0
  291. package/lib/less/negation.d.ts +601 -0
  292. package/lib/less/negation.js +18 -0
  293. package/lib/less/negation.js.map +1 -0
  294. package/lib/less/overlay.d.ts +601 -0
  295. package/lib/less/overlay.js +23 -0
  296. package/lib/less/overlay.js.map +1 -0
  297. package/lib/less/percentage.d.ts +441 -0
  298. package/lib/less/percentage.js +11 -0
  299. package/lib/less/percentage.js.map +1 -0
  300. package/lib/less/pi.d.ts +332 -0
  301. package/lib/less/pi.js +3 -0
  302. package/lib/less/pi.js.map +1 -0
  303. package/lib/less/pow.d.ts +600 -0
  304. package/lib/less/pow.js +16 -0
  305. package/lib/less/pow.js.map +1 -0
  306. package/lib/less/range.d.ts +1038 -0
  307. package/lib/less/range.js +40 -0
  308. package/lib/less/range.js.map +1 -0
  309. package/lib/less/red.d.ts +7 -0
  310. package/lib/less/red.js +8 -0
  311. package/lib/less/red.js.map +1 -0
  312. package/lib/less/replace.d.ts +1264 -0
  313. package/lib/less/replace.js +32 -0
  314. package/lib/less/replace.js.map +1 -0
  315. package/lib/less/rgb.d.ts +1063 -0
  316. package/lib/less/rgb.js +266 -0
  317. package/lib/less/rgb.js.map +1 -0
  318. package/lib/less/rgba.d.ts +354 -0
  319. package/lib/less/rgba.js +31 -0
  320. package/lib/less/rgba.js.map +1 -0
  321. package/lib/less/round.d.ts +7 -0
  322. package/lib/less/round.js +8 -0
  323. package/lib/less/round.js.map +1 -0
  324. package/lib/less/saturate.d.ts +980 -0
  325. package/lib/less/saturate.js +29 -0
  326. package/lib/less/saturate.js.map +1 -0
  327. package/lib/less/saturation.d.ts +441 -0
  328. package/lib/less/saturation.js +12 -0
  329. package/lib/less/saturation.js.map +1 -0
  330. package/lib/less/screen.d.ts +601 -0
  331. package/lib/less/screen.js +18 -0
  332. package/lib/less/screen.js.map +1 -0
  333. package/lib/less/shade.d.ts +600 -0
  334. package/lib/less/shade.js +26 -0
  335. package/lib/less/shade.js.map +1 -0
  336. package/lib/less/sin.d.ts +440 -0
  337. package/lib/less/sin.js +3 -0
  338. package/lib/less/sin.js.map +1 -0
  339. package/lib/less/softlight.d.ts +601 -0
  340. package/lib/less/softlight.js +25 -0
  341. package/lib/less/softlight.js.map +1 -0
  342. package/lib/less/spin.d.ts +600 -0
  343. package/lib/less/spin.js +22 -0
  344. package/lib/less/spin.js.map +1 -0
  345. package/lib/less/sqrt.d.ts +440 -0
  346. package/lib/less/sqrt.js +3 -0
  347. package/lib/less/sqrt.js.map +1 -0
  348. package/lib/less/tan.d.ts +440 -0
  349. package/lib/less/tan.js +3 -0
  350. package/lib/less/tan.js.map +1 -0
  351. package/lib/less/tint.d.ts +600 -0
  352. package/lib/less/tint.js +26 -0
  353. package/lib/less/tint.js.map +1 -0
  354. package/lib/less/types.d.ts +4112 -0
  355. package/lib/less/types.js +53 -0
  356. package/lib/less/types.js.map +1 -0
  357. package/lib/less/unit.d.ts +753 -0
  358. package/lib/less/unit.js +20 -0
  359. package/lib/less/unit.js.map +1 -0
  360. package/lib/sass/__tests__/hsl-channels.test.d.ts +1 -0
  361. package/lib/sass/__tests__/hsl-channels.test.js +85 -0
  362. package/lib/sass/__tests__/hsl-channels.test.js.map +1 -0
  363. package/lib/sass/__tests__/list-advanced.test.d.ts +1 -0
  364. package/lib/sass/__tests__/list-advanced.test.js +157 -0
  365. package/lib/sass/__tests__/list-advanced.test.js.map +1 -0
  366. package/lib/sass/__tests__/list-functions.test.d.ts +1 -0
  367. package/lib/sass/__tests__/list-functions.test.js +153 -0
  368. package/lib/sass/__tests__/list-functions.test.js.map +1 -0
  369. package/lib/sass/__tests__/map-functions.test.d.ts +1 -0
  370. package/lib/sass/__tests__/map-functions.test.js +208 -0
  371. package/lib/sass/__tests__/map-functions.test.js.map +1 -0
  372. package/lib/sass/__tests__/math-functions.test.d.ts +1 -0
  373. package/lib/sass/__tests__/math-functions.test.js +73 -0
  374. package/lib/sass/__tests__/math-functions.test.js.map +1 -0
  375. package/lib/sass/__tests__/math-remaining.test.d.ts +1 -0
  376. package/lib/sass/__tests__/math-remaining.test.js +113 -0
  377. package/lib/sass/__tests__/math-remaining.test.js.map +1 -0
  378. package/lib/sass/__tests__/opacity.test.d.ts +1 -0
  379. package/lib/sass/__tests__/opacity.test.js +53 -0
  380. package/lib/sass/__tests__/opacity.test.js.map +1 -0
  381. package/lib/sass/__tests__/string-functions.test.d.ts +1 -0
  382. package/lib/sass/__tests__/string-functions.test.js +109 -0
  383. package/lib/sass/__tests__/string-functions.test.js.map +1 -0
  384. package/lib/sass/__tests__/string-remaining.test.d.ts +1 -0
  385. package/lib/sass/__tests__/string-remaining.test.js +131 -0
  386. package/lib/sass/__tests__/string-remaining.test.js.map +1 -0
  387. package/lib/sass/adjust-hue.d.ts +10 -0
  388. package/lib/sass/adjust-hue.js +11 -0
  389. package/lib/sass/adjust-hue.js.map +1 -0
  390. package/lib/sass/color/index.d.ts +22 -0
  391. package/lib/sass/color/index.js +43 -0
  392. package/lib/sass/color/index.js.map +1 -0
  393. package/lib/sass/color/red.d.ts +7 -0
  394. package/lib/sass/color/red.js +8 -0
  395. package/lib/sass/color/red.js.map +1 -0
  396. package/lib/sass/compatible.d.ts +610 -0
  397. package/lib/sass/compatible.js +62 -0
  398. package/lib/sass/compatible.js.map +1 -0
  399. package/lib/sass/complement.d.ts +450 -0
  400. package/lib/sass/complement.js +28 -0
  401. package/lib/sass/complement.js.map +1 -0
  402. package/lib/sass/fade-in.d.ts +10 -0
  403. package/lib/sass/fade-in.js +11 -0
  404. package/lib/sass/fade-in.js.map +1 -0
  405. package/lib/sass/fade-out.d.ts +10 -0
  406. package/lib/sass/fade-out.js +11 -0
  407. package/lib/sass/fade-out.js.map +1 -0
  408. package/lib/sass/grayscale.d.ts +10 -0
  409. package/lib/sass/grayscale.js +11 -0
  410. package/lib/sass/grayscale.js.map +1 -0
  411. package/lib/sass/hue.d.ts +450 -0
  412. package/lib/sass/hue.js +24 -0
  413. package/lib/sass/hue.js.map +1 -0
  414. package/lib/sass/ie-hex-str.d.ts +10 -0
  415. package/lib/sass/ie-hex-str.js +11 -0
  416. package/lib/sass/ie-hex-str.js.map +1 -0
  417. package/lib/sass/index.d.ts +64 -0
  418. package/lib/sass/index.js +90 -0
  419. package/lib/sass/index.js.map +1 -0
  420. package/lib/sass/invert.d.ts +813 -0
  421. package/lib/sass/invert.js +36 -0
  422. package/lib/sass/invert.js.map +1 -0
  423. package/lib/sass/lightness.d.ts +450 -0
  424. package/lib/sass/lightness.js +24 -0
  425. package/lib/sass/lightness.js.map +1 -0
  426. package/lib/sass/list/append.d.ts +989 -0
  427. package/lib/sass/list/append.js +54 -0
  428. package/lib/sass/list/append.js.map +1 -0
  429. package/lib/sass/list/index.d.ts +21 -0
  430. package/lib/sass/list/index.js +24 -0
  431. package/lib/sass/list/index.js.map +1 -0
  432. package/lib/sass/list/is-bracketed.d.ts +450 -0
  433. package/lib/sass/list/is-bracketed.js +30 -0
  434. package/lib/sass/list/is-bracketed.js.map +1 -0
  435. package/lib/sass/list/join.d.ts +1354 -0
  436. package/lib/sass/list/join.js +66 -0
  437. package/lib/sass/list/join.js.map +1 -0
  438. package/lib/sass/list/length.d.ts +450 -0
  439. package/lib/sass/list/length.js +22 -0
  440. package/lib/sass/list/length.js.map +1 -0
  441. package/lib/sass/list/list-index.d.ts +609 -0
  442. package/lib/sass/list/list-index.js +49 -0
  443. package/lib/sass/list/list-index.js.map +1 -0
  444. package/lib/sass/list/nth.d.ts +634 -0
  445. package/lib/sass/list/nth.js +36 -0
  446. package/lib/sass/list/nth.js.map +1 -0
  447. package/lib/sass/list/separator.d.ts +451 -0
  448. package/lib/sass/list/separator.js +36 -0
  449. package/lib/sass/list/separator.js.map +1 -0
  450. package/lib/sass/list/set-nth.d.ts +756 -0
  451. package/lib/sass/list/set-nth.js +42 -0
  452. package/lib/sass/list/set-nth.js.map +1 -0
  453. package/lib/sass/list/zip.d.ts +474 -0
  454. package/lib/sass/list/zip.js +46 -0
  455. package/lib/sass/list/zip.js.map +1 -0
  456. package/lib/sass/map/get.d.ts +757 -0
  457. package/lib/sass/map/get.js +79 -0
  458. package/lib/sass/map/get.js.map +1 -0
  459. package/lib/sass/map/has-key.d.ts +757 -0
  460. package/lib/sass/map/has-key.js +76 -0
  461. package/lib/sass/map/has-key.js.map +1 -0
  462. package/lib/sass/map/index.d.ts +19 -0
  463. package/lib/sass/map/index.js +23 -0
  464. package/lib/sass/map/index.js.map +1 -0
  465. package/lib/sass/map/keys.d.ts +449 -0
  466. package/lib/sass/map/keys.js +39 -0
  467. package/lib/sass/map/keys.js.map +1 -0
  468. package/lib/sass/map/merge.d.ts +608 -0
  469. package/lib/sass/map/merge.js +54 -0
  470. package/lib/sass/map/merge.js.map +1 -0
  471. package/lib/sass/map/remove.d.ts +633 -0
  472. package/lib/sass/map/remove.js +41 -0
  473. package/lib/sass/map/remove.js.map +1 -0
  474. package/lib/sass/map/set.d.ts +731 -0
  475. package/lib/sass/map/set.js +72 -0
  476. package/lib/sass/map/set.js.map +1 -0
  477. package/lib/sass/map/values.d.ts +449 -0
  478. package/lib/sass/map/values.js +30 -0
  479. package/lib/sass/map/values.js.map +1 -0
  480. package/lib/sass/math/abs.d.ts +7 -0
  481. package/lib/sass/math/abs.js +8 -0
  482. package/lib/sass/math/abs.js.map +1 -0
  483. package/lib/sass/math/index.d.ts +18 -0
  484. package/lib/sass/math/index.js +43 -0
  485. package/lib/sass/math/index.js.map +1 -0
  486. package/lib/sass/opacify.d.ts +11 -0
  487. package/lib/sass/opacify.js +12 -0
  488. package/lib/sass/opacify.js.map +1 -0
  489. package/lib/sass/opacity.d.ts +451 -0
  490. package/lib/sass/opacity.js +33 -0
  491. package/lib/sass/opacity.js.map +1 -0
  492. package/lib/sass/percentage.d.ts +449 -0
  493. package/lib/sass/percentage.js +26 -0
  494. package/lib/sass/percentage.js.map +1 -0
  495. package/lib/sass/quote.d.ts +449 -0
  496. package/lib/sass/quote.js +27 -0
  497. package/lib/sass/quote.js.map +1 -0
  498. package/lib/sass/random.d.ts +534 -0
  499. package/lib/sass/random.js +37 -0
  500. package/lib/sass/random.js.map +1 -0
  501. package/lib/sass/saturation.d.ts +450 -0
  502. package/lib/sass/saturation.js +24 -0
  503. package/lib/sass/saturation.js.map +1 -0
  504. package/lib/sass/str-index.d.ts +609 -0
  505. package/lib/sass/str-index.js +34 -0
  506. package/lib/sass/str-index.js.map +1 -0
  507. package/lib/sass/str-insert.d.ts +756 -0
  508. package/lib/sass/str-insert.js +61 -0
  509. package/lib/sass/str-insert.js.map +1 -0
  510. package/lib/sass/str-slice.d.ts +1039 -0
  511. package/lib/sass/str-slice.js +95 -0
  512. package/lib/sass/str-slice.js.map +1 -0
  513. package/lib/sass/string/index.d.ts +18 -0
  514. package/lib/sass/string/index.js +25 -0
  515. package/lib/sass/string/index.js.map +1 -0
  516. package/lib/sass/string/length.d.ts +450 -0
  517. package/lib/sass/string/length.js +32 -0
  518. package/lib/sass/string/length.js.map +1 -0
  519. package/lib/sass/to-lower-case.d.ts +449 -0
  520. package/lib/sass/to-lower-case.js +23 -0
  521. package/lib/sass/to-lower-case.js.map +1 -0
  522. package/lib/sass/to-upper-case.d.ts +449 -0
  523. package/lib/sass/to-upper-case.js +23 -0
  524. package/lib/sass/to-upper-case.js.map +1 -0
  525. package/lib/sass/transparentize.d.ts +11 -0
  526. package/lib/sass/transparentize.js +12 -0
  527. package/lib/sass/transparentize.js.map +1 -0
  528. package/lib/sass/unique-id.d.ts +341 -0
  529. package/lib/sass/unique-id.js +23 -0
  530. package/lib/sass/unique-id.js.map +1 -0
  531. package/lib/sass/unit.d.ts +762 -0
  532. package/lib/sass/unit.js +37 -0
  533. package/lib/sass/unit.js.map +1 -0
  534. package/lib/sass/unitless.d.ts +450 -0
  535. package/lib/sass/unitless.js +23 -0
  536. package/lib/sass/unitless.js.map +1 -0
  537. package/lib/sass/unquote.d.ts +449 -0
  538. package/lib/sass/unquote.js +27 -0
  539. package/lib/sass/unquote.js.map +1 -0
  540. package/lib/shared/color/alpha.d.ts +441 -0
  541. package/lib/shared/color/alpha.js +10 -0
  542. package/lib/shared/color/alpha.js.map +1 -0
  543. package/lib/shared/color/blue.d.ts +441 -0
  544. package/lib/shared/color/blue.js +10 -0
  545. package/lib/shared/color/blue.js.map +1 -0
  546. package/lib/shared/color/green.d.ts +441 -0
  547. package/lib/shared/color/green.js +10 -0
  548. package/lib/shared/color/green.js.map +1 -0
  549. package/lib/shared/color/red.d.ts +441 -0
  550. package/lib/shared/color/red.js +10 -0
  551. package/lib/shared/color/red.js.map +1 -0
  552. package/lib/shared/index.d.ts +16 -0
  553. package/lib/shared/index.js +19 -0
  554. package/lib/shared/index.js.map +1 -0
  555. package/lib/shared/math/__tests__/max.test.d.ts +1 -0
  556. package/lib/shared/math/__tests__/max.test.js +12 -0
  557. package/lib/shared/math/__tests__/max.test.js.map +1 -0
  558. package/lib/shared/math/__tests__/min.test.d.ts +1 -0
  559. package/lib/shared/math/__tests__/min.test.js +12 -0
  560. package/lib/shared/math/__tests__/min.test.js.map +1 -0
  561. package/lib/shared/math/__tests__/round.test.d.ts +1 -0
  562. package/lib/shared/math/__tests__/round.test.js +10 -0
  563. package/lib/shared/math/__tests__/round.test.js.map +1 -0
  564. package/lib/shared/math/abs.d.ts +441 -0
  565. package/lib/shared/math/abs.js +11 -0
  566. package/lib/shared/math/abs.js.map +1 -0
  567. package/lib/shared/math/ceil.d.ts +441 -0
  568. package/lib/shared/math/ceil.js +11 -0
  569. package/lib/shared/math/ceil.js.map +1 -0
  570. package/lib/shared/math/floor.d.ts +441 -0
  571. package/lib/shared/math/floor.js +11 -0
  572. package/lib/shared/math/floor.js.map +1 -0
  573. package/lib/shared/math/max.d.ts +469 -0
  574. package/lib/shared/math/max.js +22 -0
  575. package/lib/shared/math/max.js.map +1 -0
  576. package/lib/shared/math/min.d.ts +469 -0
  577. package/lib/shared/math/min.js +22 -0
  578. package/lib/shared/math/min.js.map +1 -0
  579. package/lib/shared/math/round.d.ts +778 -0
  580. package/lib/shared/math/round.js +17 -0
  581. package/lib/shared/math/round.js.map +1 -0
  582. package/lib/util/colorHelper.d.ts +2 -0
  583. package/lib/util/colorHelper.js +32 -0
  584. package/lib/util/colorHelper.js.map +1 -0
  585. package/lib/util/get-color-func-values.d.ts +5 -0
  586. package/lib/util/get-color-func-values.js +28 -0
  587. package/lib/util/get-color-func-values.js.map +1 -0
  588. package/lib/util/get-hsla.d.ts +10 -0
  589. package/lib/util/get-hsla.js +38 -0
  590. package/lib/util/get-hsla.js.map +1 -0
  591. package/lib/util/get-luma.d.ts +2 -0
  592. package/lib/util/get-luma.js +10 -0
  593. package/lib/util/get-luma.js.map +1 -0
  594. package/lib/util/index.d.ts +5 -0
  595. package/lib/util/index.js +17 -0
  596. package/lib/util/index.js.map +1 -0
  597. package/lib/util/mathHelper.d.ts +4 -0
  598. package/lib/util/mathHelper.js +45 -0
  599. package/lib/util/mathHelper.js.map +1 -0
  600. package/lib/util/number.d.ts +4 -0
  601. package/lib/util/number.js +23 -0
  602. package/lib/util/number.js.map +1 -0
  603. package/lib/util/relative-color.d.ts +54 -0
  604. package/lib/util/relative-color.js +268 -0
  605. package/lib/util/relative-color.js.map +1 -0
  606. package/lib/util/serialize-node.d.ts +2 -0
  607. package/lib/util/serialize-node.js +8 -0
  608. package/lib/util/serialize-node.js.map +1 -0
  609. package/lib/util/to-hsl.d.ts +7 -0
  610. package/lib/util/to-hsl.js +6 -0
  611. package/lib/util/to-hsl.js.map +1 -0
  612. package/lib/util/to-hsv.d.ts +7 -0
  613. package/lib/util/to-hsv.js +73 -0
  614. package/lib/util/to-hsv.js.map +1 -0
  615. package/package.json +39 -16
  616. package/lib/color-blending.d.ts +0 -9
  617. package/lib/color-blending.js +0 -83
  618. package/lib/color.d.ts +0 -42
  619. package/lib/color.js +0 -407
  620. package/lib/each.d.ts +0 -14
  621. package/lib/each.js +0 -35
  622. package/lib/iif.d.ts +0 -4
  623. package/lib/iif.js +0 -10
  624. package/lib/math.d.ts +0 -13
  625. package/lib/math.js +0 -199
package/lib/color.js DELETED
@@ -1,407 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shade = exports.tint = exports.contrast = exports.greyscale = exports.mix = exports.spin = exports.fade = exports.fadeout = exports.fadein = exports.darken = exports.lighten = exports.desaturate = exports.saturate = exports.luminance = exports.luma = exports.alpha = exports.blue = exports.green = exports.red = exports.hsvvalue = exports.hsvsaturation = exports.hsvhue = exports.lightness = exports.saturation = exports.hue = exports.hsv = exports.hsva = exports.hsl = exports.hsla = exports.rgb = exports.rgba = void 0;
4
- const jess_1 = require("jess");
5
- /**
6
- * Color functions, imported from Less
7
- */
8
- function rgba(...values) {
9
- const rgba = values.map(v => Number(v));
10
- return new jess_1.Color({ value: 'rgba', rgba });
11
- }
12
- exports.rgba = rgba;
13
- function rgb(...values) {
14
- const rgb = values.map(v => Number(v));
15
- rgb.push(1);
16
- const color = rgba(rgb[0], rgb[1], rgb[2], rgb[3]);
17
- color.value = 'rgb';
18
- return color;
19
- }
20
- exports.rgb = rgb;
21
- function getHue(h, m1, m2) {
22
- h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
23
- if (h * 6 < 1) {
24
- return m1 + (m2 - m1) * h * 6;
25
- }
26
- else if (h * 2 < 1) {
27
- return m2;
28
- }
29
- else if (h * 3 < 2) {
30
- return m1 + (m2 - m1) * (2 / 3 - h) * 6;
31
- }
32
- else {
33
- return m1;
34
- }
35
- }
36
- function clamp(val) {
37
- return Math.min(1, Math.max(0, val));
38
- }
39
- function number(n) {
40
- if (n instanceof jess_1.Dimension) {
41
- return n.unit === '%' ? n.value / 100 : n.value;
42
- }
43
- else if (n.constructor === Number) {
44
- return n;
45
- }
46
- else {
47
- throw {
48
- type: 'Argument',
49
- message: 'color functions take numbers as parameters'
50
- };
51
- }
52
- }
53
- function toHSL(color) {
54
- if (color instanceof jess_1.Color) {
55
- return color.toHSL();
56
- }
57
- else {
58
- throw new Error('Argument cannot be evaluated to a color');
59
- }
60
- }
61
- // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
62
- function toHSV(color) {
63
- if (!(color instanceof jess_1.Color)) {
64
- throw new Error('Argument cannot be evaluated to a color');
65
- }
66
- const r = color.rgb[0] / 255;
67
- const g = color.rgb[1] / 255;
68
- const b = color.rgb[2] / 255;
69
- const a = color.alpha;
70
- const max = Math.max(r, g, b);
71
- const min = Math.min(r, g, b);
72
- let h;
73
- let s;
74
- const v = max;
75
- const d = max - min;
76
- if (max === 0) {
77
- s = 0;
78
- }
79
- else {
80
- s = d / max;
81
- }
82
- if (max === min) {
83
- h = 0;
84
- }
85
- else {
86
- switch (max) {
87
- case r:
88
- h = (g - b) / d + (g < b ? 6 : 0);
89
- break;
90
- case g:
91
- h = (b - r) / d + 2;
92
- break;
93
- case b:
94
- h = (r - g) / d + 4;
95
- break;
96
- }
97
- h /= 6;
98
- }
99
- return { h: h * 360, s, v, a };
100
- }
101
- function hsla(h, s, l, a) {
102
- let m1;
103
- let m2;
104
- const value = `hsla`;
105
- h = (number(h) % 360) / 360;
106
- s = clamp(number(s));
107
- l = clamp(number(l));
108
- a = clamp(number(a));
109
- m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
110
- m1 = l * 2 - m2;
111
- const rgba = [
112
- getHue(h + 1 / 3, m1, m2) * 255,
113
- getHue(h, m1, m2) * 255,
114
- getHue(h - 1 / 3, m1, m2) * 255,
115
- a
116
- ];
117
- return new jess_1.Color({
118
- value,
119
- rgba
120
- });
121
- }
122
- exports.hsla = hsla;
123
- function hsl(h, s, l) {
124
- const value = `hsl`;
125
- h = number(h);
126
- s = number(s);
127
- l = number(l);
128
- const color = hsla(h, s, l, 1);
129
- color.value = value;
130
- return color;
131
- }
132
- exports.hsl = hsl;
133
- function hsva(h, s, v, a) {
134
- h = ((number(h) % 360) / 360) * 360;
135
- s = number(s);
136
- v = number(v);
137
- a = number(a);
138
- let i = Math.floor((h / 60) % 6);
139
- let f = (h / 60) - i;
140
- const vs = [
141
- v,
142
- v * (1 - s),
143
- v * (1 - f * s),
144
- v * (1 - (1 - f) * s)
145
- ];
146
- const perm = [
147
- [0, 3, 1],
148
- [2, 0, 1],
149
- [1, 0, 3],
150
- [1, 2, 0],
151
- [3, 1, 0],
152
- [0, 1, 2]
153
- ];
154
- return rgba(vs[perm[i][0]] * 255, vs[perm[i][1]] * 255, vs[perm[i][2]] * 255, a);
155
- }
156
- exports.hsva = hsva;
157
- function hsv(h, s, v) {
158
- return hsva(h, s, v, 1.0);
159
- }
160
- exports.hsv = hsv;
161
- function hue(color) {
162
- return new jess_1.Dimension(toHSL(color).h);
163
- }
164
- exports.hue = hue;
165
- function saturation(color) {
166
- return new jess_1.Dimension({
167
- value: toHSL(color).s * 100,
168
- unit: '%'
169
- });
170
- }
171
- exports.saturation = saturation;
172
- function lightness(color) {
173
- return new jess_1.Dimension({
174
- value: toHSL(color).l * 100,
175
- unit: '%'
176
- });
177
- }
178
- exports.lightness = lightness;
179
- function hsvhue(color) {
180
- return new jess_1.Dimension(toHSV(color).h);
181
- }
182
- exports.hsvhue = hsvhue;
183
- function hsvsaturation(color) {
184
- return new jess_1.Dimension({
185
- value: toHSV(color).s * 100,
186
- unit: '%'
187
- });
188
- }
189
- exports.hsvsaturation = hsvsaturation;
190
- function hsvvalue(color) {
191
- return new jess_1.Dimension({
192
- value: toHSV(color).v * 100,
193
- unit: '%'
194
- });
195
- }
196
- exports.hsvvalue = hsvvalue;
197
- function red(color) {
198
- return new jess_1.Dimension(color.rgb[0]);
199
- }
200
- exports.red = red;
201
- function green(color) {
202
- return new jess_1.Dimension(color.rgb[1]);
203
- }
204
- exports.green = green;
205
- function blue(color) {
206
- return new jess_1.Dimension(color.rgb[2]);
207
- }
208
- exports.blue = blue;
209
- function alpha(color) {
210
- return new jess_1.Dimension(toHSL(color).a);
211
- }
212
- exports.alpha = alpha;
213
- function getLuma(color) {
214
- let r = color.rgb[0] / 255;
215
- let g = color.rgb[1] / 255;
216
- let b = color.rgb[2] / 255;
217
- r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4);
218
- g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4);
219
- b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4);
220
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
221
- }
222
- function luma(color) {
223
- return new jess_1.Dimension({
224
- value: getLuma(color) * color.alpha * 100,
225
- unit: '%'
226
- });
227
- }
228
- exports.luma = luma;
229
- function luminance(color) {
230
- const luminance = (0.2126 * color.rgb[0] / 255) +
231
- (0.7152 * color.rgb[1] / 255) +
232
- (0.0722 * color.rgb[2] / 255);
233
- return new jess_1.Dimension({
234
- value: luminance * color.alpha * 100,
235
- unit: '%'
236
- });
237
- }
238
- exports.luminance = luminance;
239
- function getHsla(origColor, hsl) {
240
- const color = hsla(hsl.h, hsl.s, hsl.l, hsl.a);
241
- if (color) {
242
- if (origColor.value &&
243
- /^(rgb|hsl)/.test(origColor.value)) {
244
- color.value = origColor.value;
245
- }
246
- else {
247
- color.value = 'rgb';
248
- }
249
- return color;
250
- }
251
- }
252
- /**
253
- * @note
254
- * There's a lot of boilerplate code in the following functions. Could
255
- * they be abstracted / have a generator function?
256
- */
257
- function saturate(color, amount, method) {
258
- const hsl = toHSL(color);
259
- if (method && method.value === 'relative') {
260
- hsl.s += hsl.s * amount.value / 100;
261
- }
262
- else {
263
- hsl.s += amount.value / 100;
264
- }
265
- hsl.s = clamp(hsl.s);
266
- return getHsla(color, hsl);
267
- }
268
- exports.saturate = saturate;
269
- function desaturate(color, amount, method) {
270
- const hsl = toHSL(color);
271
- if (method && method.value === 'relative') {
272
- hsl.s -= hsl.s * amount.value / 100;
273
- }
274
- else {
275
- hsl.s -= amount.value / 100;
276
- }
277
- hsl.s = clamp(hsl.s);
278
- return getHsla(color, hsl);
279
- }
280
- exports.desaturate = desaturate;
281
- function lighten(color, amount, method) {
282
- const hsl = toHSL(color);
283
- if (method && method.value === 'relative') {
284
- hsl.l += hsl.l * amount.value / 100;
285
- }
286
- else {
287
- hsl.l += amount.value / 100;
288
- }
289
- hsl.l = clamp(hsl.l);
290
- return getHsla(color, hsl);
291
- }
292
- exports.lighten = lighten;
293
- function darken(color, amount, method) {
294
- const hsl = toHSL(color);
295
- if (method && method.value === 'relative') {
296
- hsl.l -= hsl.l * amount.value / 100;
297
- }
298
- else {
299
- hsl.l -= amount.value / 100;
300
- }
301
- hsl.l = clamp(hsl.l);
302
- return getHsla(color, hsl);
303
- }
304
- exports.darken = darken;
305
- function fadein(color, amount, method) {
306
- const hsl = toHSL(color);
307
- if (method && method.value === 'relative') {
308
- hsl.a += hsl.a * amount.value / 100;
309
- }
310
- else {
311
- hsl.a += amount.value / 100;
312
- }
313
- hsl.a = clamp(hsl.a);
314
- return getHsla(color, hsl);
315
- }
316
- exports.fadein = fadein;
317
- function fadeout(color, amount, method) {
318
- const hsl = toHSL(color);
319
- if (method && method.value === 'relative') {
320
- hsl.a -= hsl.a * amount.value / 100;
321
- }
322
- else {
323
- hsl.a -= amount.value / 100;
324
- }
325
- hsl.a = clamp(hsl.a);
326
- return getHsla(color, hsl);
327
- }
328
- exports.fadeout = fadeout;
329
- function fade(color, amount) {
330
- const hsl = toHSL(color);
331
- hsl.a = amount.value / 100;
332
- hsl.a = clamp(hsl.a);
333
- return getHsla(color, hsl);
334
- }
335
- exports.fade = fade;
336
- function spin(color, amount) {
337
- const hsl = toHSL(color);
338
- const hue = (hsl.h + amount.value) % 360;
339
- hsl.h = hue < 0 ? 360 + hue : hue;
340
- return getHsla(color, hsl);
341
- }
342
- exports.spin = spin;
343
- //
344
- // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein
345
- // http://sass-lang.com
346
- //
347
- function mix(color1, color2, weight) {
348
- if (!weight) {
349
- weight = new jess_1.Dimension(50);
350
- }
351
- const p = weight.value / 100.0;
352
- const w = p * 2 - 1;
353
- const a = toHSL(color1).a - toHSL(color2).a;
354
- const w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
355
- const w2 = 1 - w1;
356
- const rgba = [
357
- color1.rgb[0] * w1 + color2.rgb[0] * w2,
358
- color1.rgb[1] * w1 + color2.rgb[1] * w2,
359
- color1.rgb[2] * w1 + color2.rgb[2] * w2,
360
- color1.alpha * p + color2.alpha * (1 - p)
361
- ];
362
- return new jess_1.Color({
363
- value: '',
364
- rgba
365
- });
366
- }
367
- exports.mix = mix;
368
- function greyscale(color) {
369
- return desaturate(color, new jess_1.Dimension(100));
370
- }
371
- exports.greyscale = greyscale;
372
- function contrast(color, dark, light, threshold) {
373
- if (!light) {
374
- light = rgba(255, 255, 255, 1.0);
375
- }
376
- if (!dark) {
377
- dark = rgba(0, 0, 0, 1.0);
378
- }
379
- // Figure out which is actually light and dark:
380
- if (getLuma(dark) > getLuma(light)) {
381
- const t = light;
382
- light = dark;
383
- dark = t;
384
- }
385
- let thresholdNum;
386
- if (!threshold) {
387
- thresholdNum = 0.43;
388
- }
389
- else {
390
- thresholdNum = number(threshold);
391
- }
392
- if (getLuma(color) < thresholdNum) {
393
- return light;
394
- }
395
- else {
396
- return dark;
397
- }
398
- }
399
- exports.contrast = contrast;
400
- function tint(color, amount) {
401
- return mix(rgb(255, 255, 255), color, amount);
402
- }
403
- exports.tint = tint;
404
- function shade(color, amount) {
405
- return mix(rgb(0, 0, 0), color, amount);
406
- }
407
- exports.shade = shade;
package/lib/each.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { List, Expression, Ruleset } from 'jess';
2
- /**
3
- * @example
4
- * @import { each } from '@jesscss/fns';
5
- * @let list: 1, 2, 3;
6
- * @mixin iterate (value, key) {
7
- * .icon-$(value) {
8
- * width: $value;
9
- * height: $key;
10
- * }
11
- * }
12
- * @include $each(list, iterate);
13
- */
14
- export declare function each(list: List | Expression | unknown, mixin: Function): Ruleset;
package/lib/each.js DELETED
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.each = void 0;
7
- const jess_1 = require("jess");
8
- const forEach_1 = __importDefault(require("lodash/forEach"));
9
- /**
10
- * @example
11
- * @import { each } from '@jesscss/fns';
12
- * @let list: 1, 2, 3;
13
- * @mixin iterate (value, key) {
14
- * .icon-$(value) {
15
- * width: $value;
16
- * height: $key;
17
- * }
18
- * }
19
- * @include $each(list, iterate);
20
- */
21
- function each(list, mixin) {
22
- let collection;
23
- let rules = new jess_1.Ruleset([]);
24
- if (list instanceof jess_1.List || list instanceof jess_1.Expression) {
25
- collection = list.toArray();
26
- }
27
- else {
28
- collection = list;
29
- }
30
- forEach_1.default(collection, (value, key) => {
31
- rules.value.push(mixin(value, key));
32
- });
33
- return rules;
34
- }
35
- exports.each = each;
package/lib/iif.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * if condition, return ifValue, else return elseValue
3
- */
4
- export declare function iif(condition: boolean, ifValue: any, elseValue: any): any;
package/lib/iif.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.iif = void 0;
4
- /**
5
- * if condition, return ifValue, else return elseValue
6
- */
7
- function iif(condition, ifValue, elseValue) {
8
- return condition ? ifValue : elseValue;
9
- }
10
- exports.iif = iif;
package/lib/math.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { Dimension, Color, Expression } from 'jess';
2
- /**
3
- * This mimics Less's operations, preserving units and types
4
- * as output.
5
- *
6
- * The only export here is the `op` function
7
- */
8
- declare type NumericNode = Dimension | Color;
9
- /**
10
- * An operation like `2px * (3 + 1)`
11
- */
12
- export declare function op(expr: NumericNode | Expression | any[]): NumericNode;
13
- export {};
package/lib/math.js DELETED
@@ -1,199 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.op = void 0;
4
- const jess_1 = require("jess");
5
- /** Turn a value into a Numeric Node */
6
- function normalize(val) {
7
- return val.constructor === Number ? new jess_1.Dimension(val) : val;
8
- }
9
- function doMath(op, left, right) {
10
- switch (op) {
11
- case '*':
12
- return left * right;
13
- case '/':
14
- return left / right;
15
- case '+':
16
- return left + right;
17
- case '-':
18
- return left - right;
19
- }
20
- }
21
- function toColor(node) {
22
- if (node instanceof jess_1.Color) {
23
- return node;
24
- }
25
- const value = node.value;
26
- return new jess_1.Color({
27
- value: '',
28
- rgba: [value, value, value, 1]
29
- });
30
- }
31
- function colorOp(op, a, b) {
32
- let left = toColor(a).rgba;
33
- let right = toColor(b).rgba;
34
- const rgba = new Array(4);
35
- for (let i = 0; i < 3; i++) {
36
- rgba[i] = doMath(op, left[i], right[i]);
37
- }
38
- rgba[3] = left[3] * (1 - right[3]) + right[3];
39
- return new jess_1.Color({
40
- value: '',
41
- rgba
42
- });
43
- }
44
- /**
45
- * Math multiply
46
- */
47
- function multiply(left, right) {
48
- if (left.unit && right.unit) {
49
- throw { message: 'Can\'t multiply a unit by a unit.' };
50
- }
51
- for (let i = 0; i < 2; i++) {
52
- const a = i === 0 ? left : right;
53
- const b = i === 0 ? right : left;
54
- if (a instanceof jess_1.Color) {
55
- if (b instanceof jess_1.Color) {
56
- throw { message: 'Can\'t multiply colors. Use a color blending function.' };
57
- }
58
- if (b.unit) {
59
- throw { message: 'Can\'t multiply a unit and a color.' };
60
- }
61
- return colorOp('*', a, b);
62
- }
63
- }
64
- const aDim = left;
65
- const bDim = right;
66
- return new jess_1.Dimension({
67
- value: aDim.value * bDim.value,
68
- unit: aDim.unit || bDim.unit
69
- });
70
- }
71
- /**
72
- * Math divide
73
- */
74
- function divide(left, right) {
75
- if (left instanceof jess_1.Color) {
76
- if (right instanceof jess_1.Color) {
77
- throw { message: 'Can\'t divide colors. Use a color blending function.' };
78
- }
79
- if (right.unit) {
80
- throw { message: 'Can\'t divide a color by a unit.' };
81
- }
82
- return colorOp('/', left, right);
83
- }
84
- if (right instanceof jess_1.Color) {
85
- throw { message: 'Can\'t divide a dimension by a color.' };
86
- }
87
- if (right.unit && left.unit !== right.unit) {
88
- throw { message: 'Can\'t divide mixed units.' };
89
- }
90
- const value = left.value / right.value;
91
- if (left.unit && left.unit === right.unit) {
92
- /** Cancel units */
93
- return new jess_1.Dimension({ value });
94
- }
95
- return new jess_1.Dimension({
96
- value,
97
- unit: left.unit
98
- });
99
- }
100
- /**
101
- * Math add & subtract
102
- */
103
- function add(op, left, right) {
104
- if (left instanceof jess_1.Color || right instanceof jess_1.Color) {
105
- return colorOp(op, left, right);
106
- }
107
- return new jess_1.Dimension({
108
- value: doMath(op, left.value, right.value),
109
- unit: left.unit || right.unit
110
- });
111
- }
112
- function operate(operator, a, b) {
113
- const getValue = (node) => {
114
- const value = node.value;
115
- if (!(value instanceof jess_1.Expression) &&
116
- !(value instanceof jess_1.Dimension) &&
117
- !(value instanceof jess_1.Color)) {
118
- throw { message: 'Not a valid math expression.' };
119
- }
120
- return op(value);
121
- };
122
- if (a instanceof jess_1.Paren) {
123
- a = getValue(a);
124
- }
125
- if (b instanceof jess_1.Paren) {
126
- b = getValue(b);
127
- }
128
- switch (operator) {
129
- case '*':
130
- return multiply(a, b);
131
- case '/':
132
- return divide(a, b);
133
- case '+':
134
- case '-':
135
- return add(operator, a, b);
136
- }
137
- }
138
- /**
139
- * An operation like `2px * (3 + 1)`
140
- */
141
- function op(expr) {
142
- let values;
143
- if (expr instanceof jess_1.Expression) {
144
- values = expr.toArray();
145
- }
146
- else if (expr instanceof jess_1.Node) {
147
- return expr;
148
- }
149
- else {
150
- values = expr;
151
- }
152
- /**
153
- * Convert values to Nodes w/ string operators
154
- */
155
- values = values.map((v, i) => {
156
- if (i % 2 === 0) {
157
- return normalize(v);
158
- }
159
- let op;
160
- if (v instanceof jess_1.Anonymous) {
161
- op = v.value;
162
- }
163
- else if (v.constructor === String) {
164
- op = v;
165
- }
166
- if (!op || !/[+\-*\/]/.test(op)) {
167
- throw { message: 'Not a valid math expression.' };
168
- }
169
- return op;
170
- });
171
- if (values.length === 1) {
172
- return values[0];
173
- }
174
- let a = values[0];
175
- let additionValues = [];
176
- /** Order of operations */
177
- for (let i = 1; i < values.length; i += 2) {
178
- let op = values[i];
179
- let b = values[i + 1];
180
- if (op === '*' || op === '/') {
181
- a = operate(op, a, b);
182
- }
183
- else {
184
- additionValues.push(a, op);
185
- a = b;
186
- }
187
- }
188
- if (additionValues.length) {
189
- additionValues.push(a);
190
- a = values[0];
191
- for (let i = 1; i < values.length; i += 2) {
192
- let op = values[i];
193
- let b = values[i + 1];
194
- a = operate(op, a, b);
195
- }
196
- }
197
- return a;
198
- }
199
- exports.op = op;