@design-edito/tools 0.2.15 → 0.2.16

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 (245) hide show
  1. package/agnostic/arrays/index.js +10 -10
  2. package/agnostic/arrays/random-pick/index.js +6 -6
  3. package/agnostic/colors/channels/index.d.ts +5 -0
  4. package/agnostic/colors/channels/index.js +18 -0
  5. package/agnostic/colors/contrast/index.d.ts +2 -0
  6. package/agnostic/colors/contrast/index.js +13 -0
  7. package/agnostic/colors/convert/index.d.ts +20 -0
  8. package/agnostic/colors/convert/index.js +45 -0
  9. package/agnostic/colors/distance/index.d.ts +2 -0
  10. package/agnostic/colors/distance/index.js +12 -0
  11. package/agnostic/colors/grayscale/index.d.ts +2 -0
  12. package/agnostic/colors/grayscale/index.js +12 -0
  13. package/agnostic/colors/index.d.ts +14 -16
  14. package/agnostic/colors/index.js +95 -27
  15. package/agnostic/colors/invert/index.d.ts +2 -0
  16. package/agnostic/colors/invert/index.js +12 -0
  17. package/agnostic/colors/lerp/index.d.ts +2 -0
  18. package/agnostic/colors/lerp/index.js +12 -0
  19. package/agnostic/colors/luminance/index.d.ts +2 -0
  20. package/agnostic/colors/luminance/index.js +12 -0
  21. package/agnostic/colors/palette/index.d.ts +2 -0
  22. package/agnostic/colors/palette/index.js +14 -0
  23. package/agnostic/colors/rotate/index.d.ts +2 -0
  24. package/agnostic/colors/rotate/index.js +13 -0
  25. package/agnostic/colors/tidy/index.d.ts +2 -0
  26. package/agnostic/colors/tidy/index.js +11 -0
  27. package/agnostic/colors/typechecks/index.d.ts +11 -0
  28. package/agnostic/colors/typechecks/index.js +26 -0
  29. package/agnostic/colors/types.d.ts +82 -0
  30. package/agnostic/css/index.js +10 -10
  31. package/agnostic/css/styles-set/index.js +8 -8
  32. package/agnostic/errors/index.js +2 -2
  33. package/agnostic/html/hyper-json/cast/index.js +6 -6
  34. package/agnostic/html/hyper-json/index.js +7 -7
  35. package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +6 -6
  36. package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +6 -6
  37. package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +6 -6
  38. package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +6 -6
  39. package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +6 -6
  40. package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +6 -6
  41. package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +6 -6
  42. package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +6 -6
  43. package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +6 -6
  44. package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +6 -6
  45. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +6 -6
  46. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +6 -6
  47. package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +6 -6
  48. package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +6 -6
  49. package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +6 -6
  50. package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +6 -6
  51. package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +6 -6
  52. package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +6 -6
  53. package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +6 -6
  54. package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +6 -6
  55. package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +6 -6
  56. package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +6 -6
  57. package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +6 -6
  58. package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +6 -6
  59. package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +6 -6
  60. package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +6 -6
  61. package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +6 -6
  62. package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +6 -6
  63. package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +6 -6
  64. package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +6 -6
  65. package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +6 -6
  66. package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +6 -6
  67. package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +6 -6
  68. package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +6 -6
  69. package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +6 -6
  70. package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +6 -6
  71. package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +6 -6
  72. package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +6 -6
  73. package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +6 -6
  74. package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +6 -6
  75. package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +6 -6
  76. package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +6 -6
  77. package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +6 -6
  78. package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +6 -6
  79. package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +6 -6
  80. package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +6 -6
  81. package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +6 -6
  82. package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +6 -6
  83. package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +6 -6
  84. package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +6 -6
  85. package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +6 -6
  86. package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +6 -6
  87. package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +6 -6
  88. package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +6 -6
  89. package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +6 -6
  90. package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +6 -6
  91. package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +6 -6
  92. package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +6 -6
  93. package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +6 -6
  94. package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +6 -6
  95. package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +6 -6
  96. package/agnostic/html/hyper-json/tree/index.js +6 -6
  97. package/agnostic/html/hyper-json/utils/index.js +6 -6
  98. package/agnostic/html/index.js +22 -22
  99. package/agnostic/html/sanitize/index.js +6 -6
  100. package/agnostic/html/selector-to-element/index.js +6 -6
  101. package/agnostic/html/string-to-nodes/index.js +7 -7
  102. package/agnostic/index.d.ts +1 -1
  103. package/agnostic/misc/assert/index.js +3 -3
  104. package/agnostic/misc/crossenv/index.js +2 -2
  105. package/agnostic/misc/index.js +25 -25
  106. package/agnostic/misc/lorem-ipsum/index.js +13 -13
  107. package/agnostic/numbers/index.js +6 -6
  108. package/agnostic/objects/index.js +15 -15
  109. package/agnostic/random/index.js +2 -2
  110. package/agnostic/strings/index.js +11 -11
  111. package/agnostic/time/index.js +6 -6
  112. package/chunks/chunk-2EHYEUX4.js +21 -0
  113. package/chunks/chunk-5LK2YLTK.js +21 -0
  114. package/chunks/chunk-65NTXENV.js +157 -0
  115. package/chunks/{chunk-XDITZ5QN.js → chunk-AF2NAJS2.js} +2 -2
  116. package/chunks/chunk-ALMK24GK.js +0 -0
  117. package/chunks/chunk-BKIF2ELV.js +47 -0
  118. package/chunks/{chunk-B446JIN3.js → chunk-C7SRAQMW.js} +1 -1
  119. package/chunks/{chunk-36CTYZYA.js → chunk-CQEDNACN.js} +2 -2
  120. package/chunks/chunk-D7SXHHU3.js +47 -0
  121. package/chunks/{chunk-IWDIKDYR.js → chunk-E33DCHHS.js} +13 -13
  122. package/chunks/{chunk-WAMSK4A3.js → chunk-E4FJHD5R.js} +1 -1
  123. package/chunks/chunk-GUBFCOBT.js +98 -0
  124. package/chunks/{chunk-Q6DUKZU6.js → chunk-I2HTBYNO.js} +6 -6
  125. package/chunks/chunk-IDXUS2IO.js +296 -0
  126. package/chunks/chunk-JHUOMGOX.js +81 -0
  127. package/chunks/{chunk-EDJ3TVNV.js → chunk-KDOMQ4LM.js} +15 -6
  128. package/chunks/chunk-MN4FVOU2.js +28 -0
  129. package/chunks/{chunk-2M33FCDG.js → chunk-O7VFJHQX.js} +11 -5
  130. package/chunks/{chunk-2UAVBQI5.js → chunk-OD2XVVE2.js} +4 -4
  131. package/chunks/{chunk-CHUOCTRP.js → chunk-P2H6PV4O.js} +2 -2
  132. package/chunks/chunk-P4YT4RBG.js +51 -0
  133. package/chunks/{chunk-CYUEPBUN.js → chunk-PX4DPCZM.js} +2 -2
  134. package/chunks/{chunk-YIZODJC7.js → chunk-QRS3G3YD.js} +5 -5
  135. package/chunks/{chunk-FQ4UTWMP.js → chunk-QTA7ZEVX.js} +3 -1
  136. package/chunks/chunk-QW34TQCS.js +48 -0
  137. package/chunks/{chunk-HMAK6VAF.js → chunk-RBCZWVQH.js} +11 -5
  138. package/chunks/{chunk-JWF5EKM2.js → chunk-RDQJSWRC.js} +1 -1
  139. package/chunks/{chunk-AI6AGF4I.js → chunk-S7637BQZ.js} +8 -5
  140. package/chunks/{chunk-GVQVGFAA.js → chunk-TQXFC6OS.js} +4 -4
  141. package/chunks/chunk-UG5EMKGN.js +265 -0
  142. package/chunks/chunk-VA67YLZL.js +26 -0
  143. package/chunks/{chunk-TSZAQ3RQ.js → chunk-VKNQ7MVZ.js} +86 -87
  144. package/chunks/{chunk-SA2IY5LN.js → chunk-X5HMM3LD.js} +1 -1
  145. package/chunks/chunk-XAYMIITK.js +103 -0
  146. package/chunks/chunk-YZVZKBVJ.js +631 -0
  147. package/chunks/chunk-ZJ63OCMA.js +207 -0
  148. package/node/@aws-s3/index.js +8 -8
  149. package/node/@aws-s3/storage/directory/index.js +7 -7
  150. package/node/@aws-s3/storage/file/index.js +10 -10
  151. package/node/@aws-s3/storage/index.js +10 -10
  152. package/node/@google-cloud/index.js +11 -11
  153. package/node/@google-cloud/storage/bucket/index.js +4 -4
  154. package/node/@google-cloud/storage/directory/index.js +7 -7
  155. package/node/@google-cloud/storage/file/index.js +14 -14
  156. package/node/@google-cloud/storage/file/revoke-signed-urls/index.js +2 -2
  157. package/node/@google-cloud/storage/index.js +13 -13
  158. package/node/cloud-storage/index.js +26 -26
  159. package/node/cloud-storage/operations/index.js +36 -36
  160. package/node/encryption/index.js +3 -3
  161. package/node/files/index.js +3 -3
  162. package/node/ftps/directory/index.js +7 -7
  163. package/node/ftps/file/index.js +10 -10
  164. package/node/ftps/index.js +9 -9
  165. package/node/images/create/index.d.ts +3 -0
  166. package/node/images/create/index.js +23 -0
  167. package/node/images/format/index.d.ts +17 -51
  168. package/node/images/format/index.js +30 -4
  169. package/node/images/index.d.ts +4 -2
  170. package/node/images/index.js +41 -21
  171. package/node/images/metadata/index.d.ts +3 -0
  172. package/node/images/metadata/index.js +23 -0
  173. package/node/images/transform/index.d.ts +2 -97
  174. package/node/images/transform/index.js +27 -16
  175. package/node/images/transform/operations/blur/index.d.ts +1 -3
  176. package/node/images/transform/operations/brighten/index.d.ts +1 -3
  177. package/node/images/transform/operations/extend/index.d.ts +1 -8
  178. package/node/images/transform/operations/extend/index.js +17 -2
  179. package/node/images/transform/operations/extract/index.d.ts +1 -6
  180. package/node/images/transform/operations/flatten/index.d.ts +1 -3
  181. package/node/images/transform/operations/flatten/index.js +17 -2
  182. package/node/images/transform/operations/hue/index.d.ts +1 -3
  183. package/node/images/transform/operations/level/index.d.ts +1 -4
  184. package/node/images/transform/operations/lighten/index.d.ts +1 -3
  185. package/node/images/transform/operations/normalize/index.d.ts +1 -4
  186. package/node/images/transform/operations/overlay/index.d.ts +5 -0
  187. package/node/images/transform/operations/overlay/index.js +27 -0
  188. package/node/images/transform/operations/resize/index.d.ts +1 -11
  189. package/node/images/transform/operations/resize/index.js +17 -2
  190. package/node/images/transform/operations/rotate/index.d.ts +1 -4
  191. package/node/images/transform/operations/rotate/index.js +17 -2
  192. package/node/images/transform/operations/saturate/index.d.ts +1 -3
  193. package/node/images/transform/operations/saturate/index.js +1 -1
  194. package/node/images/types.d.ts +252 -0
  195. package/node/images/utils/index.d.ts +7 -0
  196. package/node/images/utils/index.js +28 -0
  197. package/node/sftp/directory/index.js +7 -7
  198. package/node/sftp/file/index.js +10 -10
  199. package/node/sftp/index.js +9 -9
  200. package/package.json +1 -1
  201. package/agnostic/colors/complement-color/index.d.ts +0 -1
  202. package/agnostic/colors/complement-color/index.js +0 -7
  203. package/agnostic/colors/hex-to-rgb/index.d.ts +0 -1
  204. package/agnostic/colors/hex-to-rgb/index.js +0 -7
  205. package/agnostic/colors/hsl-to-rgb/index.d.ts +0 -1
  206. package/agnostic/colors/hsl-to-rgb/index.js +0 -7
  207. package/agnostic/colors/lighten-color/index.d.ts +0 -2
  208. package/agnostic/colors/lighten-color/index.js +0 -11
  209. package/agnostic/colors/rgb-to-hex/index.d.ts +0 -1
  210. package/agnostic/colors/rgb-to-hex/index.js +0 -7
  211. package/agnostic/colors/rgb-to-hsl/index.d.ts +0 -1
  212. package/agnostic/colors/rgb-to-hsl/index.js +0 -7
  213. package/agnostic/colors/saturate-color/index.d.ts +0 -2
  214. package/agnostic/colors/saturate-color/index.js +0 -11
  215. package/chunks/chunk-2POD3TAX.js +0 -11
  216. package/chunks/chunk-2TJCB6IM.js +0 -12
  217. package/chunks/chunk-7EDDWSWS.js +0 -123
  218. package/chunks/chunk-FAXNZG5C.js +0 -10
  219. package/chunks/chunk-IFQA5PWI.js +0 -112
  220. package/chunks/chunk-MB7HWF22.js +0 -23
  221. package/chunks/chunk-MFYNJMVM.js +0 -18
  222. package/chunks/chunk-NYVARFI7.js +0 -20
  223. package/chunks/chunk-QLC3A6PC.js +0 -17
  224. package/chunks/chunk-U57Q62IN.js +0 -23
  225. package/chunks/chunk-YVLJKJV2.js +0 -17
  226. package/node/images/get-metadata/index.d.ts +0 -4
  227. package/node/images/get-metadata/index.js +0 -7
  228. package/node/images/transform/operations/composite/index.d.ts +0 -7
  229. package/node/images/transform/operations/composite/index.js +0 -12
  230. package/node/images/transform/utils/index.d.ts +0 -2
  231. package/node/images/transform/utils/index.js +0 -8
  232. package/chunks/{chunk-WH6BPDAC.js → chunk-2KT7AKRW.js} +3 -3
  233. package/chunks/{chunk-JSW6R3ZH.js → chunk-6QFELK4E.js} +9 -9
  234. package/chunks/{chunk-LAVXHKKR.js → chunk-73FF7HWQ.js} +9 -9
  235. package/chunks/{chunk-74CFPDKM.js → chunk-A7K5DUP7.js} +6 -6
  236. package/chunks/{chunk-7KSMK42F.js → chunk-CNMP2GU4.js} +6 -6
  237. package/chunks/{chunk-DEQWCMAL.js → chunk-EXPVRDPR.js} +9 -9
  238. package/chunks/{chunk-UFKH5WD2.js → chunk-FR5H2OCV.js} +3 -3
  239. package/chunks/{chunk-G5RRNREY.js → chunk-LSZVKXDZ.js} +3 -3
  240. package/chunks/{chunk-QCMBG5LN.js → chunk-MLLP7YSK.js} +13 -13
  241. package/chunks/{chunk-IOJTC6CN.js → chunk-PJSPZGT2.js} +15 -15
  242. package/chunks/{chunk-OVG5RGI3.js → chunk-S32K7POB.js} +4 -4
  243. package/chunks/{chunk-UXEKCYL7.js → chunk-UEAMPAHK.js} +3 -3
  244. package/chunks/{chunk-AIC5YAJU.js → chunk-X5F6XGEP.js} +6 -6
  245. package/chunks/{chunk-4OK2UH4M.js → chunk-ZBAKY6DB.js} +6 -6
@@ -0,0 +1,157 @@
1
+ import {
2
+ viaCmyk,
3
+ viaHsb,
4
+ viaHsl,
5
+ viaLab,
6
+ viaLch,
7
+ viaRgb,
8
+ viaXyz
9
+ } from "./chunk-YZVZKBVJ.js";
10
+
11
+ // src/agnostic/colors/grayscale/index.ts
12
+ function avgGrayscaleRgb(rgb) {
13
+ const { r, g, b } = rgb;
14
+ const avg = (r + g + b) / 3;
15
+ return { ...rgb, r: avg, g: avg, b: avg };
16
+ }
17
+ function weightedAvgGrayscaleRgb(rgb) {
18
+ const { r, g, b } = rgb;
19
+ const avg = r * 0.2126 + g * 0.7152 + b * 0.0722;
20
+ return { ...rgb, r: avg, g: avg, b: avg };
21
+ }
22
+ function minChannelGrayscaleRgb(rgb) {
23
+ const { r, g, b } = rgb;
24
+ const min = Math.min(r, g, b);
25
+ return { ...rgb, r: min, g: min, b: min };
26
+ }
27
+ function maxChannelGrayscaleRgb(rgb) {
28
+ const { r, g, b } = rgb;
29
+ const max = Math.max(r, g, b);
30
+ return { ...rgb, r: max, g: max, b: max };
31
+ }
32
+ function grayscaleRgbVia(rgb, channel) {
33
+ const { r, g, b } = rgb;
34
+ switch (channel) {
35
+ case "red":
36
+ return { ...rgb, r, g: r, b: r };
37
+ case "green":
38
+ return { ...rgb, r: g, g, b: g };
39
+ case "blue":
40
+ return { ...rgb, r: b, g: b, b };
41
+ }
42
+ }
43
+ function avgGrayscaleCmyk(cmyk) {
44
+ const { c, m, y, k } = cmyk;
45
+ const avg = (c + m + y + k) / 4;
46
+ return { ...cmyk, c: avg, m: avg, y: avg, k: avg };
47
+ }
48
+ function avgNoBlackGrayscaleCmyk(cmyk) {
49
+ const { c, m, y } = cmyk;
50
+ const avg = (c + m + y) / 3;
51
+ return { ...cmyk, c: avg, m: avg, y: avg, k: avg };
52
+ }
53
+ function minChannelGrayscaleCmyk(cmyk) {
54
+ const { c, m, y, k } = cmyk;
55
+ const min = Math.min(c, m, y, k);
56
+ return { ...cmyk, c: min, m: min, y: min, k: min };
57
+ }
58
+ function minNoBlackChannelGrayscaleCmyk(cmyk) {
59
+ const { c, m, y } = cmyk;
60
+ const min = Math.min(c, m, y);
61
+ return { ...cmyk, c: min, m: min, y: min, k: min };
62
+ }
63
+ function maxChannelGrayscaleCmyk(cmyk) {
64
+ const { c, m, y, k } = cmyk;
65
+ const max = Math.max(c, m, y, k);
66
+ return { ...cmyk, c: max, m: max, y: max, k: max };
67
+ }
68
+ function maxNoBlackChannelGrayscaleCmyk(cmyk) {
69
+ const { c, m, y } = cmyk;
70
+ const max = Math.max(c, m, y);
71
+ return { ...cmyk, c: max, m: max, y: max, k: max };
72
+ }
73
+ function grayscaleCmykVia(cmyk, channel) {
74
+ const { c, m, y, k } = cmyk;
75
+ switch (channel) {
76
+ case "cyan":
77
+ return { ...cmyk, c, m: c, y: c, k: c };
78
+ case "magenta":
79
+ return { ...cmyk, c: m, m, y: m, k: m };
80
+ case "yellow":
81
+ return { ...cmyk, c: y, m: y, y, k: y };
82
+ case "black":
83
+ return { ...cmyk, c: k, m: k, y: k, k };
84
+ }
85
+ }
86
+ function perceptualGrayscaleCmyk(cmyk) {
87
+ return { ...cmyk, c: 0, m: 0, y: 0 };
88
+ }
89
+ function grayscaleHsl(hsl) {
90
+ return { ...hsl, s: 0 };
91
+ }
92
+ function grayscaleHsb(hsb) {
93
+ return { ...hsb, s: 0 };
94
+ }
95
+ function grayscaleXyz(xyz) {
96
+ return { ...xyz, x: xyz.y, z: xyz.y };
97
+ }
98
+ function grayscaleLab(lab) {
99
+ return { ...lab, a: 0, b: 0 };
100
+ }
101
+ function grayscaleLch(lch) {
102
+ return { ...lch, c: 0 };
103
+ }
104
+ function grayscale(color, method = "lab") {
105
+ switch (method) {
106
+ case "rgb-avg":
107
+ return viaRgb(color, avgGrayscaleRgb);
108
+ case "rgb-weighted-avg":
109
+ return viaRgb(color, weightedAvgGrayscaleRgb);
110
+ case "rgb-min-channel":
111
+ return viaRgb(color, minChannelGrayscaleRgb);
112
+ case "rgb-max-channel":
113
+ return viaRgb(color, maxChannelGrayscaleRgb);
114
+ case "rgb-via-red":
115
+ return viaRgb(color, (rgb) => grayscaleRgbVia(rgb, "red"));
116
+ case "rgb-via-green":
117
+ return viaRgb(color, (rgb) => grayscaleRgbVia(rgb, "green"));
118
+ case "rgb-via-blue":
119
+ return viaRgb(color, (rgb) => grayscaleRgbVia(rgb, "blue"));
120
+ case "cmyk-avg":
121
+ return viaCmyk(color, avgGrayscaleCmyk);
122
+ case "cmyk-no-black-avg":
123
+ return viaCmyk(color, avgNoBlackGrayscaleCmyk);
124
+ case "cmyk-min-channel":
125
+ return viaCmyk(color, minChannelGrayscaleCmyk);
126
+ case "cmyk-min-no-black-channel":
127
+ return viaCmyk(color, minNoBlackChannelGrayscaleCmyk);
128
+ case "cmyk-max-channel":
129
+ return viaCmyk(color, maxChannelGrayscaleCmyk);
130
+ case "cmyk-max-no-black-channel":
131
+ return viaCmyk(color, maxNoBlackChannelGrayscaleCmyk);
132
+ case "cmyk-via-cyan":
133
+ return viaCmyk(color, (cmyk) => grayscaleCmykVia(cmyk, "cyan"));
134
+ case "cmyk-via-magenta":
135
+ return viaCmyk(color, (cmyk) => grayscaleCmykVia(cmyk, "magenta"));
136
+ case "cmyk-via-yellow":
137
+ return viaCmyk(color, (cmyk) => grayscaleCmykVia(cmyk, "yellow"));
138
+ case "cmyk-via-black":
139
+ return viaCmyk(color, (cmyk) => grayscaleCmykVia(cmyk, "black"));
140
+ case "cmyk-perceptual":
141
+ return viaCmyk(color, perceptualGrayscaleCmyk);
142
+ case "hsl":
143
+ return viaHsl(color, grayscaleHsl);
144
+ case "hsb":
145
+ return viaHsb(color, grayscaleHsb);
146
+ case "xyz":
147
+ return viaXyz(color, grayscaleXyz);
148
+ case "lab":
149
+ return viaLab(color, grayscaleLab);
150
+ case "lch":
151
+ return viaLch(color, grayscaleLch);
152
+ }
153
+ }
154
+
155
+ export {
156
+ grayscale
157
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Random
3
- } from "./chunk-OVG5RGI3.js";
3
+ } from "./chunk-S32K7POB.js";
4
4
  import {
5
5
  Arrays
6
- } from "./chunk-Q6DUKZU6.js";
6
+ } from "./chunk-I2HTBYNO.js";
7
7
 
8
8
  // src/agnostic/misc/lorem-ipsum/index.ts
9
9
  var LoremIpsum;
File without changes
@@ -0,0 +1,47 @@
1
+ import {
2
+ tidy,
3
+ toRgb
4
+ } from "./chunk-YZVZKBVJ.js";
5
+ import {
6
+ isNonNullObject
7
+ } from "./chunk-HQLRJ7XW.js";
8
+
9
+ // src/node/images/utils/index.ts
10
+ import { readFile } from "node:fs/promises";
11
+ import sharp from "sharp";
12
+ function toSharpColor(color) {
13
+ const rgb = tidy(toRgb(color));
14
+ return {
15
+ r: rgb.r,
16
+ g: rgb.g,
17
+ b: rgb.b,
18
+ alpha: rgb.a
19
+ };
20
+ }
21
+ function isDuckTypedSharpInstance(obj) {
22
+ if (!isNonNullObject(obj)) return false;
23
+ return "avif" in obj && "clone" in obj && "gif" in obj && "heif" in obj && "jpeg" in obj && "heif" in obj && "metadata" in obj && "png" in obj && "resize" in obj && "tiff" in obj && "webp" in obj && typeof obj.avif === "function" && typeof obj.clone === "function" && typeof obj.gif === "function" && typeof obj.heif === "function" && typeof obj.jpeg === "function" && typeof obj.heif === "function" && typeof obj.metadata === "function" && typeof obj.png === "function" && typeof obj.resize === "function" && typeof obj.tiff === "function" && typeof obj.webp === "function";
24
+ }
25
+ function toCreateOptions(options) {
26
+ return {
27
+ width: options.width ?? 100,
28
+ height: options.height ?? 100,
29
+ channels: options.channels ?? 4,
30
+ background: options.background !== void 0 ? toSharpColor(options.background) : toSharpColor("white"),
31
+ noise: options.noise !== void 0 ? { ...options.noise, type: "gaussian" } : void 0,
32
+ pageHeight: options.pageHeight
33
+ };
34
+ }
35
+ async function toSharpInstance(imageLike, clone = false) {
36
+ if (typeof imageLike === "string") return sharp(await readFile(imageLike));
37
+ if (Buffer.isBuffer(imageLike)) return sharp(imageLike);
38
+ if (isDuckTypedSharpInstance(imageLike)) return clone ? imageLike.clone() : imageLike;
39
+ return sharp({ create: toCreateOptions(imageLike) });
40
+ }
41
+
42
+ export {
43
+ toSharpColor,
44
+ isDuckTypedSharpInstance,
45
+ toCreateOptions,
46
+ toSharpInstance
47
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  register
3
- } from "./chunk-CHUOCTRP.js";
3
+ } from "./chunk-P2H6PV4O.js";
4
4
 
5
5
  // src/agnostic/arrays/random-pick/index.ts
6
6
  function randomPick(arr, exclude = []) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Sanitize
3
- } from "./chunk-JWF5EKM2.js";
3
+ } from "./chunk-RDQJSWRC.js";
4
4
  import {
5
5
  register
6
- } from "./chunk-CHUOCTRP.js";
6
+ } from "./chunk-P2H6PV4O.js";
7
7
 
8
8
  // src/agnostic/html/string-to-nodes/index.ts
9
9
  function stringToNodes(dirtyStr, options) {
@@ -0,0 +1,47 @@
1
+ import {
2
+ viaLab,
3
+ viaLch,
4
+ viaRgb
5
+ } from "./chunk-YZVZKBVJ.js";
6
+ import {
7
+ absoluteModulo
8
+ } from "./chunk-DNIOWD7K.js";
9
+
10
+ // src/agnostic/colors/invert/index.ts
11
+ function invertRgb(color) {
12
+ return viaRgb(color, (rgb) => ({
13
+ ...rgb,
14
+ r: 255 - rgb.r,
15
+ g: 255 - rgb.g,
16
+ b: 255 - rgb.b
17
+ }));
18
+ }
19
+ function invertLab(color) {
20
+ return viaLab(color, (lab) => ({
21
+ ...lab,
22
+ l: 100 - lab.l,
23
+ a: -1 * lab.a,
24
+ b: -1 * lab.b
25
+ }));
26
+ }
27
+ function invertLch(color) {
28
+ return viaLch(color, (lch) => ({
29
+ ...lch,
30
+ l: 100 - lch.l,
31
+ h: absoluteModulo(lch.h + 180, 360)
32
+ }));
33
+ }
34
+ function invert(color, method = "lch") {
35
+ switch (method) {
36
+ case "rgb":
37
+ return invertRgb(color);
38
+ case "lab":
39
+ return invertLab(color);
40
+ case "lch":
41
+ return invertLch(color);
42
+ }
43
+ }
44
+
45
+ export {
46
+ invert
47
+ };
@@ -1,12 +1,6 @@
1
- import {
2
- revoke_signed_urls_exports
3
- } from "./chunk-G5RRNREY.js";
4
1
  import {
5
2
  update_metadata_exports
6
3
  } from "./chunk-HWVEI3RH.js";
7
- import {
8
- generate_signed_url_exports
9
- } from "./chunk-PAIUCLVK.js";
10
4
  import {
11
5
  get_metadata_exports
12
6
  } from "./chunk-42K3MQQ5.js";
@@ -14,26 +8,32 @@ import {
14
8
  get_permissions_exports
15
9
  } from "./chunk-YKPA3MQL.js";
16
10
  import {
17
- remove_exports
18
- } from "./chunk-7J7CYOXU.js";
11
+ generate_signed_url_exports
12
+ } from "./chunk-PAIUCLVK.js";
19
13
  import {
20
- stat_exports
21
- } from "./chunk-W3RXHN5I.js";
14
+ revoke_signed_urls_exports
15
+ } from "./chunk-LSZVKXDZ.js";
22
16
  import {
23
17
  upload_exports
24
18
  } from "./chunk-FB3GNE2B.js";
25
19
  import {
26
20
  download_exports
27
21
  } from "./chunk-2JH4TCT2.js";
28
- import {
29
- copy_exports
30
- } from "./chunk-CWZFRUBS.js";
31
22
  import {
32
23
  exists_exports
33
24
  } from "./chunk-5VHFXWFM.js";
25
+ import {
26
+ remove_exports
27
+ } from "./chunk-7J7CYOXU.js";
34
28
  import {
35
29
  move_exports
36
30
  } from "./chunk-6IYUA43Q.js";
31
+ import {
32
+ stat_exports
33
+ } from "./chunk-W3RXHN5I.js";
34
+ import {
35
+ copy_exports
36
+ } from "./chunk-CWZFRUBS.js";
37
37
  import {
38
38
  __export
39
39
  } from "./chunk-WSFCRVEQ.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JMU5PDBD.js";
4
4
  import {
5
5
  Errors
6
- } from "./chunk-WH6BPDAC.js";
6
+ } from "./chunk-2KT7AKRW.js";
7
7
 
8
8
  // src/agnostic/misc/assert/index.ts
9
9
  var Assert;
@@ -0,0 +1,98 @@
1
+ import {
2
+ toHsb,
3
+ toHsl,
4
+ toLab,
5
+ toLch,
6
+ toRgb,
7
+ toXyz,
8
+ viaHsb,
9
+ viaHsl,
10
+ viaLab,
11
+ viaLch,
12
+ viaRgb,
13
+ viaXyz
14
+ } from "./chunk-YZVZKBVJ.js";
15
+
16
+ // src/agnostic/colors/lerp/index.ts
17
+ function lerpRgb(rgb1, rgb2, amount) {
18
+ const r = rgb1.r + (rgb2.r - rgb1.r) * amount;
19
+ const g = rgb1.g + (rgb2.g - rgb1.g) * amount;
20
+ const b = rgb1.b + (rgb2.b - rgb1.b) * amount;
21
+ const a = (rgb1.a ?? 1) + ((rgb2.a ?? 1) - (rgb1.a ?? 1)) * amount;
22
+ return { r, g, b, a };
23
+ }
24
+ function lerpLab(lab1, lab2, amount) {
25
+ const l = lab1.l + (lab2.l - lab1.l) * amount;
26
+ const a = lab1.a + (lab2.a - lab1.a) * amount;
27
+ const b = lab1.b + (lab2.b - lab1.b) * amount;
28
+ const al = (lab1.al ?? 1) + ((lab2.al ?? 1) - (lab1.al ?? 1)) * amount;
29
+ return { l, a, b, al };
30
+ }
31
+ function lerpLch(lch1, lch2, amount) {
32
+ const l = lch1.l + (lch2.l - lch1.l) * amount;
33
+ const c = lch1.c + (lch2.c - lch1.c) * amount;
34
+ let hDiff = lch2.h - lch1.h;
35
+ if (hDiff > 180) hDiff -= 360;
36
+ if (hDiff < -180) hDiff += 360;
37
+ const h = (lch1.h + hDiff * amount + 360) % 360;
38
+ const a = (lch1.a ?? 1) + ((lch2.a ?? 1) - (lch1.a ?? 1)) * amount;
39
+ return { l, c, h, a };
40
+ }
41
+ function lerpHsl(hsl1, hsl2, amount) {
42
+ const l = hsl1.l + (hsl2.l - hsl1.l) * amount;
43
+ const s = hsl1.s + (hsl2.s - hsl1.s) * amount;
44
+ let hDiff = hsl2.h - hsl1.h;
45
+ if (hDiff > 180) hDiff -= 360;
46
+ if (hDiff < -180) hDiff += 360;
47
+ const h = (hsl1.h + hDiff * amount + 360) % 360;
48
+ const a = (hsl1.a ?? 1) + ((hsl2.a ?? 1) - (hsl1.a ?? 1)) * amount;
49
+ return { h, s, l, a };
50
+ }
51
+ function lerpHsb(hsb1, hsb2, amount) {
52
+ const b = hsb1.b + (hsb2.b - hsb1.b) * amount;
53
+ const s = hsb1.s + (hsb2.s - hsb1.s) * amount;
54
+ let hDiff = hsb2.h - hsb1.h;
55
+ if (hDiff > 180) hDiff -= 360;
56
+ if (hDiff < -180) hDiff += 360;
57
+ const h = (hsb1.h + hDiff * amount + 360) % 360;
58
+ const a = (hsb1.a ?? 1) + ((hsb2.a ?? 1) - (hsb1.a ?? 1)) * amount;
59
+ return { h, s, b, a };
60
+ }
61
+ function lerpLinearRgb(rgb1, rgb2, amount) {
62
+ const linearChannel = (v) => v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
63
+ const delinearize = (v) => v <= 31308e-7 ? v * 12.92 : 1.055 * Math.pow(v, 1 / 2.4) - 0.055;
64
+ const r = delinearize(linearChannel(rgb1.r) + (linearChannel(rgb2.r) - linearChannel(rgb1.r)) * amount);
65
+ const g = delinearize(linearChannel(rgb1.g) + (linearChannel(rgb2.g) - linearChannel(rgb1.g)) * amount);
66
+ const b = delinearize(linearChannel(rgb1.b) + (linearChannel(rgb2.b) - linearChannel(rgb1.b)) * amount);
67
+ const a = (rgb1.a ?? 1) + ((rgb2.a ?? 1) - (rgb1.a ?? 1)) * amount;
68
+ return { r, g, b, a };
69
+ }
70
+ function lerpXyz(xyz1, xyz2, amount) {
71
+ const x = xyz1.x + (xyz2.x - xyz1.x) * amount;
72
+ const y = xyz1.y + (xyz2.y - xyz1.y) * amount;
73
+ const z = xyz1.z + (xyz2.z - xyz1.z) * amount;
74
+ const a = (xyz1.a ?? 1) + ((xyz2.a ?? 1) - (xyz1.a ?? 1)) * amount;
75
+ return { x, y, z, a };
76
+ }
77
+ function lerp(c1, c2, amount, method = "rgb") {
78
+ switch (method) {
79
+ case "rgb":
80
+ return viaRgb(c1, (rgb1) => lerpRgb(rgb1, toRgb(c2), amount));
81
+ case "lab":
82
+ return viaLab(c1, (lab1) => lerpLab(lab1, toLab(c2), amount));
83
+ case "lch":
84
+ return viaLch(c1, (lch1) => lerpLch(lch1, toLch(c2), amount));
85
+ case "hsl":
86
+ return viaHsl(c1, (hsl1) => lerpHsl(hsl1, toHsl(c2), amount));
87
+ case "hsb":
88
+ return viaHsb(c1, (hsb1) => lerpHsb(hsb1, toHsb(c2), amount));
89
+ case "rgb-linear":
90
+ return viaRgb(c1, (rgb1) => lerpLinearRgb(rgb1, toRgb(c2), amount));
91
+ case "xyz":
92
+ return viaXyz(c1, (xyz1) => lerpXyz(xyz1, toXyz(c2), amount));
93
+ }
94
+ }
95
+
96
+ export {
97
+ lerp
98
+ };
@@ -1,10 +1,10 @@
1
- import {
2
- isArrayOf
3
- } from "./chunk-6RGDWX4A.js";
4
1
  import {
5
2
  randomPick,
6
3
  randomPickMany
7
- } from "./chunk-B446JIN3.js";
4
+ } from "./chunk-C7SRAQMW.js";
5
+ import {
6
+ make
7
+ } from "./chunk-RLAZR3NL.js";
8
8
  import {
9
9
  shuffle
10
10
  } from "./chunk-VJJIYJMY.js";
@@ -12,8 +12,8 @@ import {
12
12
  findDuplicates
13
13
  } from "./chunk-YS6WMSWC.js";
14
14
  import {
15
- make
16
- } from "./chunk-RLAZR3NL.js";
15
+ isArrayOf
16
+ } from "./chunk-6RGDWX4A.js";
17
17
 
18
18
  // src/agnostic/arrays/index.tsx
19
19
  var Arrays;