ngx-color 7.2.0 → 7.3.3

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 (346) hide show
  1. package/alpha/alpha-picker.component.d.ts +8 -0
  2. package/alpha/ngx-color-alpha.d.ts +2 -1
  3. package/alpha/package.json +6 -10
  4. package/alpha/public_api.d.ts +1 -0
  5. package/alpha.component.d.ts +9 -0
  6. package/block/block-swatches.component.d.ts +13 -8
  7. package/block/block.component.d.ts +9 -0
  8. package/block/ngx-color-block.d.ts +2 -2
  9. package/block/package.json +6 -10
  10. package/block/public_api.d.ts +2 -0
  11. package/checkboard.component.d.ts +7 -0
  12. package/chrome/chrome-fields.component.d.ts +3 -0
  13. package/chrome/chrome.component.d.ts +9 -0
  14. package/chrome/ngx-color-chrome.d.ts +2 -2
  15. package/chrome/package.json +6 -10
  16. package/chrome/public_api.d.ts +2 -0
  17. package/circle/circle-swatch.component.d.ts +3 -0
  18. package/circle/circle.component.d.ts +9 -0
  19. package/circle/ngx-color-circle.d.ts +2 -2
  20. package/circle/package.json +9 -10
  21. package/circle/public_api.d.ts +2 -0
  22. package/color-wrap.component.d.ts +7 -0
  23. package/compact/compact-color.component.d.ts +3 -0
  24. package/compact/compact-fields.component.d.ts +3 -0
  25. package/compact/compact.component.d.ts +10 -0
  26. package/compact/ngx-color-compact.d.ts +2 -3
  27. package/compact/package.json +6 -10
  28. package/compact/public_api.d.ts +3 -0
  29. package/coordinates.directive.d.ts +6 -0
  30. package/editable-input.component.d.ts +7 -0
  31. package/esm2020/alpha/alpha-picker.component.mjs +116 -0
  32. package/esm2020/alpha/ngx-color-alpha.mjs +5 -0
  33. package/esm2020/alpha/public_api.mjs +2 -0
  34. package/esm2020/alpha.component.mjs +186 -0
  35. package/esm2020/block/block-swatches.component.mjs +74 -0
  36. package/esm2020/block/block.component.mjs +199 -0
  37. package/esm2020/block/ngx-color-block.mjs +5 -0
  38. package/esm2020/block/public_api.mjs +3 -0
  39. package/esm2020/checkboard.component.mjs +66 -0
  40. package/esm2020/chrome/chrome-fields.component.mjs +356 -0
  41. package/{chrome/esm2015/chrome.component.js → esm2020/chrome/chrome.component.mjs} +116 -40
  42. package/esm2020/chrome/ngx-color-chrome.mjs +5 -0
  43. package/esm2020/chrome/public_api.mjs +3 -0
  44. package/esm2020/circle/circle-swatch.component.mjs +85 -0
  45. package/esm2020/circle/circle.component.mjs +148 -0
  46. package/esm2020/circle/ngx-color-circle.mjs +5 -0
  47. package/esm2020/circle/public_api.mjs +3 -0
  48. package/esm2020/color-wrap.component.mjs +163 -0
  49. package/esm2020/compact/compact-color.component.mjs +91 -0
  50. package/esm2020/compact/compact-fields.component.mjs +186 -0
  51. package/esm2020/compact/compact.component.mjs +177 -0
  52. package/esm2020/compact/ngx-color-compact.mjs +5 -0
  53. package/esm2020/compact/public_api.mjs +4 -0
  54. package/esm2020/coordinates.directive.mjs +104 -0
  55. package/esm2020/editable-input.component.mjs +217 -0
  56. package/esm2020/github/github-swatch.component.mjs +67 -0
  57. package/esm2020/github/github.component.mjs +179 -0
  58. package/esm2020/github/ngx-color-github.mjs +5 -0
  59. package/esm2020/github/public_api.mjs +3 -0
  60. package/esm2020/helpers/checkboard.mjs +33 -0
  61. package/esm2020/helpers/color.interfaces.mjs +2 -0
  62. package/esm2020/helpers/color.mjs +60 -0
  63. package/esm2020/hue/hue-picker.component.mjs +113 -0
  64. package/esm2020/hue/ngx-color-hue.mjs +5 -0
  65. package/esm2020/hue/public_api.mjs +2 -0
  66. package/esm2020/hue.component.mjs +165 -0
  67. package/esm2020/material/material.component.mjs +211 -0
  68. package/esm2020/material/ngx-color-material.mjs +5 -0
  69. package/esm2020/material/public_api.mjs +2 -0
  70. package/esm2020/ngx-color.mjs +5 -0
  71. package/esm2020/photoshop/ngx-color-photoshop.mjs +5 -0
  72. package/esm2020/photoshop/photoshop-button.component.mjs +63 -0
  73. package/esm2020/photoshop/photoshop-fields.component.mjs +241 -0
  74. package/esm2020/photoshop/photoshop-previews.component.mjs +68 -0
  75. package/esm2020/photoshop/photoshop.component.mjs +258 -0
  76. package/esm2020/photoshop/public_api.mjs +5 -0
  77. package/esm2020/public_api.mjs +14 -0
  78. package/esm2020/raised.component.mjs +89 -0
  79. package/esm2020/saturation.component.mjs +136 -0
  80. package/esm2020/shade/ngx-color-shade.mjs +5 -0
  81. package/esm2020/shade/public_api.mjs +2 -0
  82. package/esm2020/shade/shade-picker.component.mjs +105 -0
  83. package/esm2020/shade.component.mjs +165 -0
  84. package/esm2020/sketch/ngx-color-sketch.mjs +5 -0
  85. package/esm2020/sketch/public_api.mjs +4 -0
  86. package/esm2020/sketch/sketch-fields.component.mjs +243 -0
  87. package/esm2020/sketch/sketch-preset-colors.component.mjs +98 -0
  88. package/esm2020/sketch/sketch.component.mjs +283 -0
  89. package/esm2020/slider/ngx-color-slider.mjs +5 -0
  90. package/esm2020/slider/public_api.mjs +4 -0
  91. package/esm2020/slider/slider-swatch.component.mjs +80 -0
  92. package/esm2020/slider/slider-swatches.component.mjs +135 -0
  93. package/esm2020/slider/slider.component.mjs +116 -0
  94. package/esm2020/swatch.component.mjs +125 -0
  95. package/esm2020/swatches/ngx-color-swatches.mjs +5 -0
  96. package/esm2020/swatches/public_api.mjs +4 -0
  97. package/esm2020/swatches/swatches-color.component.mjs +123 -0
  98. package/esm2020/swatches/swatches-group.component.mjs +64 -0
  99. package/esm2020/swatches/swatches.component.mjs +258 -0
  100. package/esm2020/twitter/ngx-color-twitter.mjs +5 -0
  101. package/esm2020/twitter/public_api.mjs +2 -0
  102. package/{twitter/esm2015/twitter.component.js → esm2020/twitter/twitter.component.mjs} +83 -35
  103. package/fesm2015/ngx-color-alpha.mjs +123 -0
  104. package/fesm2015/ngx-color-alpha.mjs.map +1 -0
  105. package/fesm2015/ngx-color-block.mjs +275 -0
  106. package/fesm2015/ngx-color-block.mjs.map +1 -0
  107. package/fesm2015/ngx-color-chrome.mjs +606 -0
  108. package/fesm2015/ngx-color-chrome.mjs.map +1 -0
  109. package/fesm2015/ngx-color-circle.mjs +237 -0
  110. package/fesm2015/ngx-color-circle.mjs.map +1 -0
  111. package/fesm2015/ngx-color-compact.mjs +451 -0
  112. package/fesm2015/ngx-color-compact.mjs.map +1 -0
  113. package/fesm2015/ngx-color-github.mjs +250 -0
  114. package/fesm2015/ngx-color-github.mjs.map +1 -0
  115. package/fesm2015/ngx-color-hue.mjs +120 -0
  116. package/fesm2015/ngx-color-hue.mjs.map +1 -0
  117. package/fesm2015/ngx-color-material.mjs +218 -0
  118. package/fesm2015/ngx-color-material.mjs.map +1 -0
  119. package/fesm2015/ngx-color-photoshop.mjs +626 -0
  120. package/fesm2015/ngx-color-photoshop.mjs.map +1 -0
  121. package/fesm2015/ngx-color-shade.mjs +112 -0
  122. package/fesm2015/ngx-color-shade.mjs.map +1 -0
  123. package/fesm2015/ngx-color-sketch.mjs +620 -0
  124. package/fesm2015/ngx-color-sketch.mjs.map +1 -0
  125. package/fesm2015/ngx-color-slider.mjs +331 -0
  126. package/fesm2015/ngx-color-slider.mjs.map +1 -0
  127. package/fesm2015/ngx-color-swatches.mjs +441 -0
  128. package/fesm2015/ngx-color-swatches.mjs.map +1 -0
  129. package/fesm2015/ngx-color-twitter.mjs +262 -0
  130. package/fesm2015/ngx-color-twitter.mjs.map +1 -0
  131. package/fesm2015/ngx-color.mjs +1461 -0
  132. package/fesm2015/ngx-color.mjs.map +1 -0
  133. package/fesm2020/ngx-color-alpha.mjs +123 -0
  134. package/fesm2020/ngx-color-alpha.mjs.map +1 -0
  135. package/fesm2020/ngx-color-block.mjs +275 -0
  136. package/fesm2020/ngx-color-block.mjs.map +1 -0
  137. package/fesm2020/ngx-color-chrome.mjs +606 -0
  138. package/fesm2020/ngx-color-chrome.mjs.map +1 -0
  139. package/fesm2020/ngx-color-circle.mjs +237 -0
  140. package/fesm2020/ngx-color-circle.mjs.map +1 -0
  141. package/fesm2020/ngx-color-compact.mjs +451 -0
  142. package/fesm2020/ngx-color-compact.mjs.map +1 -0
  143. package/fesm2020/ngx-color-github.mjs +250 -0
  144. package/fesm2020/ngx-color-github.mjs.map +1 -0
  145. package/fesm2020/ngx-color-hue.mjs +120 -0
  146. package/fesm2020/ngx-color-hue.mjs.map +1 -0
  147. package/fesm2020/ngx-color-material.mjs +218 -0
  148. package/fesm2020/ngx-color-material.mjs.map +1 -0
  149. package/fesm2020/ngx-color-photoshop.mjs +626 -0
  150. package/fesm2020/ngx-color-photoshop.mjs.map +1 -0
  151. package/fesm2020/ngx-color-shade.mjs +112 -0
  152. package/fesm2020/ngx-color-shade.mjs.map +1 -0
  153. package/fesm2020/ngx-color-sketch.mjs +620 -0
  154. package/fesm2020/ngx-color-sketch.mjs.map +1 -0
  155. package/fesm2020/ngx-color-slider.mjs +331 -0
  156. package/fesm2020/ngx-color-slider.mjs.map +1 -0
  157. package/fesm2020/ngx-color-swatches.mjs +441 -0
  158. package/fesm2020/ngx-color-swatches.mjs.map +1 -0
  159. package/fesm2020/ngx-color-twitter.mjs +262 -0
  160. package/fesm2020/ngx-color-twitter.mjs.map +1 -0
  161. package/fesm2020/ngx-color.mjs +1466 -0
  162. package/fesm2020/ngx-color.mjs.map +1 -0
  163. package/github/github-swatch.component.d.ts +3 -0
  164. package/github/github.component.d.ts +9 -0
  165. package/github/ngx-color-github.d.ts +2 -2
  166. package/github/package.json +6 -10
  167. package/github/public_api.d.ts +2 -0
  168. package/hue/hue-picker.component.d.ts +8 -0
  169. package/hue/ngx-color-hue.d.ts +2 -1
  170. package/hue/package.json +6 -10
  171. package/hue/public_api.d.ts +1 -0
  172. package/hue.component.d.ts +8 -0
  173. package/material/material.component.d.ts +8 -0
  174. package/material/ngx-color-material.d.ts +2 -1
  175. package/material/package.json +6 -10
  176. package/material/public_api.d.ts +1 -0
  177. package/ngx-color.d.ts +1 -0
  178. package/package.json +133 -9
  179. package/photoshop/ngx-color-photoshop.d.ts +2 -4
  180. package/photoshop/package.json +6 -10
  181. package/photoshop/photoshop-button.component.d.ts +3 -0
  182. package/photoshop/photoshop-fields.component.d.ts +3 -0
  183. package/photoshop/photoshop-previews.component.d.ts +3 -0
  184. package/photoshop/photoshop.component.d.ts +11 -0
  185. package/photoshop/public_api.d.ts +4 -0
  186. package/raised.component.d.ts +7 -0
  187. package/saturation.component.d.ts +8 -0
  188. package/shade/ngx-color-shade.d.ts +2 -1
  189. package/shade/package.json +6 -10
  190. package/shade/public_api.d.ts +1 -0
  191. package/shade/shade-picker.component.d.ts +8 -0
  192. package/shade.component.d.ts +8 -0
  193. package/sketch/ngx-color-sketch.d.ts +2 -3
  194. package/sketch/package.json +6 -10
  195. package/sketch/public_api.d.ts +3 -0
  196. package/sketch/sketch-fields.component.d.ts +3 -0
  197. package/sketch/sketch-preset-colors.component.d.ts +3 -0
  198. package/sketch/sketch.component.d.ts +10 -0
  199. package/slider/ngx-color-slider.d.ts +2 -3
  200. package/slider/package.json +6 -10
  201. package/slider/public_api.d.ts +3 -0
  202. package/slider/slider-swatch.component.d.ts +3 -0
  203. package/slider/slider-swatches.component.d.ts +3 -0
  204. package/slider/slider.component.d.ts +10 -0
  205. package/swatch.component.d.ts +8 -0
  206. package/swatches/ngx-color-swatches.d.ts +2 -3
  207. package/swatches/package.json +9 -10
  208. package/swatches/public_api.d.ts +3 -0
  209. package/swatches/swatches-color.component.d.ts +3 -0
  210. package/swatches/swatches-group.component.d.ts +3 -0
  211. package/swatches/swatches.component.d.ts +10 -0
  212. package/twitter/ngx-color-twitter.d.ts +2 -1
  213. package/twitter/package.json +6 -10
  214. package/twitter/public_api.d.ts +1 -0
  215. package/twitter/twitter.component.d.ts +8 -0
  216. package/alpha/bundles/ngx-color-alpha.umd.js +0 -404
  217. package/alpha/bundles/ngx-color-alpha.umd.js.map +0 -1
  218. package/alpha/esm2015/alpha-picker.component.js +0 -84
  219. package/alpha/esm2015/ngx-color-alpha.js +0 -5
  220. package/alpha/fesm2015/ngx-color-alpha.js +0 -91
  221. package/alpha/fesm2015/ngx-color-alpha.js.map +0 -1
  222. package/alpha/ngx-color-alpha.metadata.json +0 -1
  223. package/block/bundles/ngx-color-block.umd.js +0 -472
  224. package/block/bundles/ngx-color-block.umd.js.map +0 -1
  225. package/block/esm2015/block-swatches.component.js +0 -58
  226. package/block/esm2015/block.component.js +0 -151
  227. package/block/esm2015/ngx-color-block.js +0 -6
  228. package/block/fesm2015/ngx-color-block.js +0 -214
  229. package/block/fesm2015/ngx-color-block.js.map +0 -1
  230. package/block/ngx-color-block.metadata.json +0 -1
  231. package/bundles/ngx-color.umd.js +0 -1014
  232. package/bundles/ngx-color.umd.js.map +0 -1
  233. package/chrome/bundles/ngx-color-chrome.umd.js +0 -543
  234. package/chrome/bundles/ngx-color-chrome.umd.js.map +0 -1
  235. package/chrome/esm2015/chrome-fields.component.js +0 -255
  236. package/chrome/esm2015/ngx-color-chrome.js +0 -6
  237. package/chrome/fesm2015/ngx-color-chrome.js +0 -432
  238. package/chrome/fesm2015/ngx-color-chrome.js.map +0 -1
  239. package/chrome/ngx-color-chrome.metadata.json +0 -1
  240. package/circle/bundles/ngx-color-circle.umd.js +0 -469
  241. package/circle/bundles/ngx-color-circle.umd.js.map +0 -1
  242. package/circle/esm2015/circle-swatch.component.js +0 -63
  243. package/circle/esm2015/circle.component.js +0 -109
  244. package/circle/esm2015/ngx-color-circle.js +0 -6
  245. package/circle/fesm2015/ngx-color-circle.js +0 -177
  246. package/circle/fesm2015/ngx-color-circle.js.map +0 -1
  247. package/circle/ngx-color-circle.metadata.json +0 -1
  248. package/compact/bundles/ngx-color-compact.umd.js +0 -579
  249. package/compact/bundles/ngx-color-compact.umd.js.map +0 -1
  250. package/compact/esm2015/compact-color.component.js +0 -70
  251. package/compact/esm2015/compact-fields.component.js +0 -142
  252. package/compact/esm2015/compact.component.js +0 -135
  253. package/compact/esm2015/ngx-color-compact.js +0 -7
  254. package/compact/fesm2015/ngx-color-compact.js +0 -348
  255. package/compact/fesm2015/ngx-color-compact.js.map +0 -1
  256. package/compact/ngx-color-compact.metadata.json +0 -1
  257. package/esm2015/alpha.component.js +0 -156
  258. package/esm2015/checkboard.component.js +0 -52
  259. package/esm2015/color-wrap.component.js +0 -145
  260. package/esm2015/coordinates.directive.js +0 -85
  261. package/esm2015/editable-input.component.js +0 -183
  262. package/esm2015/helpers/checkboard.js +0 -33
  263. package/esm2015/helpers/color.interfaces.js +0 -2
  264. package/esm2015/helpers/color.js +0 -60
  265. package/esm2015/hue.component.js +0 -140
  266. package/esm2015/ngx-color.js +0 -5
  267. package/esm2015/public_api.js +0 -14
  268. package/esm2015/raised.component.js +0 -73
  269. package/esm2015/saturation.component.js +0 -111
  270. package/esm2015/shade.component.js +0 -127
  271. package/esm2015/swatch.component.js +0 -85
  272. package/fesm2015/ngx-color.js +0 -1228
  273. package/fesm2015/ngx-color.js.map +0 -1
  274. package/github/bundles/ngx-color-github.umd.js +0 -447
  275. package/github/bundles/ngx-color-github.umd.js.map +0 -1
  276. package/github/esm2015/github-swatch.component.js +0 -48
  277. package/github/esm2015/github.component.js +0 -146
  278. package/github/esm2015/ngx-color-github.js +0 -6
  279. package/github/fesm2015/ngx-color-github.js +0 -199
  280. package/github/fesm2015/ngx-color-github.js.map +0 -1
  281. package/github/ngx-color-github.metadata.json +0 -1
  282. package/hue/bundles/ngx-color-hue.umd.js +0 -407
  283. package/hue/bundles/ngx-color-hue.umd.js.map +0 -1
  284. package/hue/esm2015/hue-picker.component.js +0 -82
  285. package/hue/esm2015/ngx-color-hue.js +0 -5
  286. package/hue/fesm2015/ngx-color-hue.js +0 -89
  287. package/hue/fesm2015/ngx-color-hue.js.map +0 -1
  288. package/hue/ngx-color-hue.metadata.json +0 -1
  289. package/material/bundles/ngx-color-material.umd.js +0 -455
  290. package/material/bundles/ngx-color-material.umd.js.map +0 -1
  291. package/material/esm2015/material.component.js +0 -161
  292. package/material/esm2015/ngx-color-material.js +0 -5
  293. package/material/fesm2015/ngx-color-material.js +0 -168
  294. package/material/fesm2015/ngx-color-material.js.map +0 -1
  295. package/material/ngx-color-material.metadata.json +0 -1
  296. package/ngx-color.metadata.json +0 -1
  297. package/photoshop/bundles/ngx-color-photoshop.umd.js +0 -571
  298. package/photoshop/bundles/ngx-color-photoshop.umd.js.map +0 -1
  299. package/photoshop/esm2015/ngx-color-photoshop.js +0 -8
  300. package/photoshop/esm2015/photoshop-button.component.js +0 -50
  301. package/photoshop/esm2015/photoshop-fields.component.js +0 -180
  302. package/photoshop/esm2015/photoshop-previews.component.js +0 -53
  303. package/photoshop/esm2015/photoshop.component.js +0 -181
  304. package/photoshop/fesm2015/ngx-color-photoshop.js +0 -464
  305. package/photoshop/fesm2015/ngx-color-photoshop.js.map +0 -1
  306. package/photoshop/ngx-color-photoshop.metadata.json +0 -1
  307. package/shade/bundles/ngx-color-shade.umd.js +0 -399
  308. package/shade/bundles/ngx-color-shade.umd.js.map +0 -1
  309. package/shade/esm2015/ngx-color-shade.js +0 -5
  310. package/shade/esm2015/shade-picker.component.js +0 -75
  311. package/shade/fesm2015/ngx-color-shade.js +0 -82
  312. package/shade/fesm2015/ngx-color-shade.js.map +0 -1
  313. package/shade/ngx-color-shade.metadata.json +0 -1
  314. package/sketch/bundles/ngx-color-sketch.umd.js +0 -585
  315. package/sketch/bundles/ngx-color-sketch.umd.js.map +0 -1
  316. package/sketch/esm2015/ngx-color-sketch.js +0 -7
  317. package/sketch/esm2015/sketch-fields.component.js +0 -181
  318. package/sketch/esm2015/sketch-preset-colors.component.js +0 -76
  319. package/sketch/esm2015/sketch.component.js +0 -203
  320. package/sketch/fesm2015/ngx-color-sketch.js +0 -462
  321. package/sketch/fesm2015/ngx-color-sketch.js.map +0 -1
  322. package/sketch/ngx-color-sketch.metadata.json +0 -1
  323. package/slider/bundles/ngx-color-slider.umd.js +0 -470
  324. package/slider/bundles/ngx-color-slider.umd.js.map +0 -1
  325. package/slider/esm2015/ngx-color-slider.js +0 -7
  326. package/slider/esm2015/slider-swatch.component.js +0 -65
  327. package/slider/esm2015/slider-swatches.component.js +0 -84
  328. package/slider/esm2015/slider.component.js +0 -81
  329. package/slider/fesm2015/ngx-color-slider.js +0 -233
  330. package/slider/fesm2015/ngx-color-slider.js.map +0 -1
  331. package/slider/ngx-color-slider.metadata.json +0 -1
  332. package/swatches/bundles/ngx-color-swatches.umd.js +0 -612
  333. package/swatches/bundles/ngx-color-swatches.umd.js.map +0 -1
  334. package/swatches/esm2015/ngx-color-swatches.js +0 -7
  335. package/swatches/esm2015/swatches-color.component.js +0 -90
  336. package/swatches/esm2015/swatches-group.component.js +0 -42
  337. package/swatches/esm2015/swatches.component.js +0 -217
  338. package/swatches/fesm2015/ngx-color-swatches.js +0 -351
  339. package/swatches/fesm2015/ngx-color-swatches.js.map +0 -1
  340. package/swatches/ngx-color-swatches.metadata.json +0 -1
  341. package/twitter/bundles/ngx-color-twitter.umd.js +0 -433
  342. package/twitter/bundles/ngx-color-twitter.umd.js.map +0 -1
  343. package/twitter/esm2015/ngx-color-twitter.js +0 -5
  344. package/twitter/fesm2015/ngx-color-twitter.js +0 -214
  345. package/twitter/fesm2015/ngx-color-twitter.js.map +0 -1
  346. package/twitter/ngx-color-twitter.metadata.json +0 -1
@@ -1,1014 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@ctrl/tinycolor'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('ngx-color', ['exports', '@angular/common', '@angular/core', 'rxjs', 'rxjs/operators', '@ctrl/tinycolor', '@angular/forms'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-color'] = {}, global.ng.common, global.ng.core, global.rxjs, global.rxjs.operators, global['@ctrl/tinycolor'], global.ng.forms));
5
- }(this, (function (exports, common, core, rxjs, operators, tinycolor, forms) { 'use strict';
6
-
7
- var checkboardCache = {};
8
- function render(c1, c2, size) {
9
- if (typeof document === 'undefined') {
10
- return null;
11
- }
12
- var canvas = document.createElement('canvas');
13
- canvas.width = size * 2;
14
- canvas.height = size * 2;
15
- var ctx = canvas.getContext('2d');
16
- if (!ctx) {
17
- return null;
18
- } // If no context can be found, return early.
19
- ctx.fillStyle = c1;
20
- ctx.fillRect(0, 0, canvas.width, canvas.height);
21
- ctx.fillStyle = c2;
22
- ctx.fillRect(0, 0, size, size);
23
- ctx.translate(size, size);
24
- ctx.fillRect(0, 0, size, size);
25
- return canvas.toDataURL();
26
- }
27
- function getCheckerboard(c1, c2, size) {
28
- var key = c1 + "-" + c2 + "-" + size;
29
- if (checkboardCache[key]) {
30
- return checkboardCache[key];
31
- }
32
- var checkboard = render(c1, c2, size);
33
- if (!checkboard) {
34
- return null;
35
- }
36
- checkboardCache[key] = checkboard;
37
- return checkboard;
38
- }
39
-
40
- var CheckboardComponent = /** @class */ (function () {
41
- function CheckboardComponent() {
42
- this.white = 'transparent';
43
- this.size = 8;
44
- this.grey = 'rgba(0,0,0,.08)';
45
- }
46
- CheckboardComponent.prototype.ngOnInit = function () {
47
- var background = getCheckerboard(this.white, this.grey, this.size);
48
- this.gridStyles = {
49
- borderRadius: this.borderRadius,
50
- boxShadow: this.boxShadow,
51
- background: "url(" + background + ") center left",
52
- };
53
- };
54
- return CheckboardComponent;
55
- }());
56
- CheckboardComponent.decorators = [
57
- { type: core.Component, args: [{
58
- selector: 'color-checkboard',
59
- template: "<div class=\"grid\" [ngStyle]=\"gridStyles\"></div>",
60
- preserveWhitespaces: false,
61
- changeDetection: core.ChangeDetectionStrategy.OnPush,
62
- styles: ["\n .grid {\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n position: absolute;\n }\n "]
63
- },] }
64
- ];
65
- CheckboardComponent.propDecorators = {
66
- white: [{ type: core.Input }],
67
- size: [{ type: core.Input }],
68
- grey: [{ type: core.Input }],
69
- boxShadow: [{ type: core.Input }],
70
- borderRadius: [{ type: core.Input }]
71
- };
72
- var CheckboardModule = /** @class */ (function () {
73
- function CheckboardModule() {
74
- }
75
- return CheckboardModule;
76
- }());
77
- CheckboardModule.decorators = [
78
- { type: core.NgModule, args: [{
79
- declarations: [CheckboardComponent],
80
- exports: [CheckboardComponent],
81
- imports: [common.CommonModule],
82
- },] }
83
- ];
84
-
85
- var CoordinatesDirective = /** @class */ (function () {
86
- function CoordinatesDirective(el) {
87
- this.el = el;
88
- this.coordinatesChange = new rxjs.Subject();
89
- this.mousechange = new rxjs.Subject();
90
- this.mouseListening = false;
91
- }
92
- CoordinatesDirective.prototype.mousemove = function ($event, x, y, isTouch) {
93
- if (isTouch === void 0) { isTouch = false; }
94
- if (this.mouseListening) {
95
- $event.preventDefault();
96
- this.mousechange.next({ $event: $event, x: x, y: y, isTouch: isTouch });
97
- }
98
- };
99
- CoordinatesDirective.prototype.mouseup = function () {
100
- this.mouseListening = false;
101
- };
102
- CoordinatesDirective.prototype.mousedown = function ($event, x, y, isTouch) {
103
- if (isTouch === void 0) { isTouch = false; }
104
- $event.preventDefault();
105
- this.mouseListening = true;
106
- this.mousechange.next({ $event: $event, x: x, y: y, isTouch: isTouch });
107
- };
108
- CoordinatesDirective.prototype.ngOnInit = function () {
109
- var _this = this;
110
- this.sub = this.mousechange
111
- .pipe(
112
- // limit times it is updated for the same area
113
- operators.distinctUntilChanged(function (p, q) { return p.x === q.x && p.y === q.y; }))
114
- .subscribe(function (n) { return _this.handleChange(n.x, n.y, n.$event, n.isTouch); });
115
- };
116
- CoordinatesDirective.prototype.ngOnDestroy = function () {
117
- this.sub.unsubscribe();
118
- };
119
- CoordinatesDirective.prototype.handleChange = function (x, y, $event, isTouch) {
120
- var containerWidth = this.el.nativeElement.clientWidth;
121
- var containerHeight = this.el.nativeElement.clientHeight;
122
- var left = x -
123
- (this.el.nativeElement.getBoundingClientRect().left + window.pageXOffset);
124
- var top = y - this.el.nativeElement.getBoundingClientRect().top;
125
- if (!isTouch) {
126
- top = top - window.pageYOffset;
127
- }
128
- this.coordinatesChange.next({
129
- x: x,
130
- y: y,
131
- top: top,
132
- left: left,
133
- containerWidth: containerWidth,
134
- containerHeight: containerHeight,
135
- $event: $event,
136
- });
137
- };
138
- return CoordinatesDirective;
139
- }());
140
- CoordinatesDirective.decorators = [
141
- { type: core.Directive, args: [{ selector: '[ngx-color-coordinates]' },] }
142
- ];
143
- CoordinatesDirective.ctorParameters = function () { return [
144
- { type: core.ElementRef }
145
- ]; };
146
- CoordinatesDirective.propDecorators = {
147
- coordinatesChange: [{ type: core.Output }],
148
- mousemove: [{ type: core.HostListener, args: ['window:mousemove', ['$event', '$event.pageX', '$event.pageY'],] }, { type: core.HostListener, args: ['window:touchmove', [
149
- '$event',
150
- '$event.touches[0].clientX',
151
- '$event.touches[0].clientY',
152
- 'true',
153
- ],] }],
154
- mouseup: [{ type: core.HostListener, args: ['window:mouseup',] }, { type: core.HostListener, args: ['window:touchend',] }],
155
- mousedown: [{ type: core.HostListener, args: ['mousedown', ['$event', '$event.pageX', '$event.pageY'],] }, { type: core.HostListener, args: ['touchstart', [
156
- '$event',
157
- '$event.touches[0].clientX',
158
- '$event.touches[0].clientY',
159
- 'true',
160
- ],] }]
161
- };
162
- var CoordinatesModule = /** @class */ (function () {
163
- function CoordinatesModule() {
164
- }
165
- return CoordinatesModule;
166
- }());
167
- CoordinatesModule.decorators = [
168
- { type: core.NgModule, args: [{
169
- declarations: [CoordinatesDirective],
170
- exports: [CoordinatesDirective],
171
- },] }
172
- ];
173
-
174
- var AlphaComponent = /** @class */ (function () {
175
- function AlphaComponent() {
176
- this.direction = 'horizontal';
177
- this.onChange = new core.EventEmitter();
178
- }
179
- AlphaComponent.prototype.ngOnChanges = function () {
180
- if (this.direction === 'vertical') {
181
- this.pointerLeft = 0;
182
- this.pointerTop = this.rgb.a * 100;
183
- this.gradient = {
184
- background: "linear-gradient(to bottom, rgba(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ", 0) 0%,\n rgba(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ", 1) 100%)",
185
- };
186
- }
187
- else {
188
- this.gradient = {
189
- background: "linear-gradient(to right, rgba(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ", 0) 0%,\n rgba(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ", 1) 100%)",
190
- };
191
- this.pointerLeft = this.rgb.a * 100;
192
- }
193
- };
194
- AlphaComponent.prototype.handleChange = function (_a) {
195
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
196
- var data;
197
- if (this.direction === 'vertical') {
198
- var a = void 0;
199
- if (top < 0) {
200
- a = 0;
201
- }
202
- else if (top > containerHeight) {
203
- a = 1;
204
- }
205
- else {
206
- a = Math.round(top * 100 / containerHeight) / 100;
207
- }
208
- if (this.hsl.a !== a) {
209
- data = {
210
- h: this.hsl.h,
211
- s: this.hsl.s,
212
- l: this.hsl.l,
213
- a: a,
214
- source: 'rgb',
215
- };
216
- }
217
- }
218
- else {
219
- var a = void 0;
220
- if (left < 0) {
221
- a = 0;
222
- }
223
- else if (left > containerWidth) {
224
- a = 1;
225
- }
226
- else {
227
- a = Math.round(left * 100 / containerWidth) / 100;
228
- }
229
- if (this.hsl.a !== a) {
230
- data = {
231
- h: this.hsl.h,
232
- s: this.hsl.s,
233
- l: this.hsl.l,
234
- a: a,
235
- source: 'rgb',
236
- };
237
- }
238
- }
239
- if (!data) {
240
- return;
241
- }
242
- this.onChange.emit({ data: data, $event: $event });
243
- };
244
- return AlphaComponent;
245
- }());
246
- AlphaComponent.decorators = [
247
- { type: core.Component, args: [{
248
- selector: 'color-alpha',
249
- template: "\n <div class=\"alpha\" [style.border-radius]=\"radius\">\n <div class=\"alpha-checkboard\">\n <color-checkboard></color-checkboard>\n </div>\n <div class=\"alpha-gradient\" [ngStyle]=\"gradient\" [style.box-shadow]=\"shadow\" [style.border-radius]=\"radius\"></div>\n <div ngx-color-coordinates (coordinatesChange)=\"handleChange($event)\" class=\"alpha-container color-alpha-{{direction}}\">\n <div class=\"alpha-pointer\" [style.left.%]=\"pointerLeft\" [style.top.%]=\"pointerTop\">\n <div class=\"alpha-slider\" [ngStyle]=\"pointer\"></div>\n </div>\n </div>\n </div>\n ",
250
- changeDetection: core.ChangeDetectionStrategy.OnPush,
251
- preserveWhitespaces: false,
252
- styles: ["\n .alpha {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .alpha-checkboard {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n overflow: hidden;\n }\n .alpha-gradient {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .alpha-container {\n position: relative;\n height: 100%;\n margin: 0 3px;\n }\n .alpha-pointer {\n position: absolute;\n }\n .alpha-slider {\n width: 4px;\n border-radius: 1px;\n height: 8px;\n box-shadow: 0 0 2px rgba(0, 0, 0, .6);\n background: #fff;\n margin-top: 1px;\n transform: translateX(-2px);\n }\n "]
253
- },] }
254
- ];
255
- AlphaComponent.propDecorators = {
256
- hsl: [{ type: core.Input }],
257
- rgb: [{ type: core.Input }],
258
- pointer: [{ type: core.Input }],
259
- shadow: [{ type: core.Input }],
260
- radius: [{ type: core.Input }],
261
- direction: [{ type: core.Input }],
262
- onChange: [{ type: core.Output }]
263
- };
264
- var AlphaModule = /** @class */ (function () {
265
- function AlphaModule() {
266
- }
267
- return AlphaModule;
268
- }());
269
- AlphaModule.decorators = [
270
- { type: core.NgModule, args: [{
271
- declarations: [AlphaComponent],
272
- exports: [AlphaComponent],
273
- imports: [common.CommonModule, CheckboardModule, CoordinatesModule],
274
- },] }
275
- ];
276
-
277
- function simpleCheckForValidColor(data) {
278
- var keysToCheck = ['r', 'g', 'b', 'a', 'h', 's', 'l', 'v'];
279
- var checked = 0;
280
- var passed = 0;
281
- keysToCheck.forEach(function (letter) {
282
- if (!data[letter]) {
283
- return;
284
- }
285
- checked += 1;
286
- if (!isNaN(data[letter])) {
287
- passed += 1;
288
- }
289
- if (letter === 's' || letter === 'l') {
290
- var percentPatt = /^\d+%$/;
291
- if (percentPatt.test(data[letter])) {
292
- passed += 1;
293
- }
294
- }
295
- });
296
- return checked === passed ? data : false;
297
- }
298
- function toState(data, oldHue, disableAlpha) {
299
- var color = data.hex ? new tinycolor.TinyColor(data.hex) : new tinycolor.TinyColor(data);
300
- if (disableAlpha) {
301
- color.setAlpha(1);
302
- }
303
- var hsl = color.toHsl();
304
- var hsv = color.toHsv();
305
- var rgb = color.toRgb();
306
- var hex = color.toHex();
307
- if (hsl.s === 0) {
308
- hsl.h = oldHue || 0;
309
- hsv.h = oldHue || 0;
310
- }
311
- var transparent = hex === '000000' && rgb.a === 0;
312
- return {
313
- hsl: hsl,
314
- hex: transparent ? 'transparent' : color.toHexString(),
315
- rgb: rgb,
316
- hsv: hsv,
317
- oldHue: data.h || oldHue || hsl.h,
318
- source: data.source,
319
- };
320
- }
321
- function isValidHex(hex) {
322
- return new tinycolor.TinyColor(hex).isValid;
323
- }
324
- function getContrastingColor(data) {
325
- if (!data) {
326
- return '#fff';
327
- }
328
- var col = toState(data);
329
- if (col.hex === 'transparent') {
330
- return 'rgba(0,0,0,0.4)';
331
- }
332
- var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1000;
333
- return yiq >= 128 ? '#000' : '#fff';
334
- }
335
-
336
- exports.ColorMode = void 0;
337
- (function (ColorMode) {
338
- ColorMode["HEX"] = "hex";
339
- ColorMode["HSL"] = "hsl";
340
- ColorMode["HSV"] = "hsv";
341
- ColorMode["RGB"] = "rgb";
342
- })(exports.ColorMode || (exports.ColorMode = {}));
343
- var ColorWrap = /** @class */ (function () {
344
- function ColorWrap() {
345
- /**
346
- * Descriptors the return color format if the component is used with two-way binding
347
- */
348
- this.mode = exports.ColorMode.HEX;
349
- this.color = {
350
- h: 250,
351
- s: 0.5,
352
- l: 0.2,
353
- a: 1,
354
- };
355
- this.colorChange = new core.EventEmitter();
356
- this.onChange = new core.EventEmitter();
357
- this.onChangeComplete = new core.EventEmitter();
358
- this.onSwatchHover = new core.EventEmitter();
359
- this._onChangeCompleteSubscription = new rxjs.Subscription();
360
- this._onSwatchHoverSubscription = new rxjs.Subscription();
361
- }
362
- ColorWrap.prototype.ngOnInit = function () {
363
- var _this = this;
364
- this.changes = this.onChange
365
- .pipe(operators.debounceTime(100), operators.tap(function (event) {
366
- _this.onChangeComplete.emit(event);
367
- switch (_this.mode) {
368
- case exports.ColorMode.HEX:
369
- _this.colorChange.emit(event.color.hex);
370
- break;
371
- case exports.ColorMode.HSL:
372
- _this.colorChange.emit(event.color.hsl);
373
- break;
374
- case exports.ColorMode.HSV:
375
- _this.colorChange.emit(event.color.hsv);
376
- break;
377
- case exports.ColorMode.RGB:
378
- _this.colorChange.emit(event.color.rgb);
379
- break;
380
- default:
381
- var msg = "The mode '" + _this.mode + "' is not supported";
382
- if (core.isDevMode()) {
383
- throw new Error(msg);
384
- }
385
- else {
386
- console.warn(msg);
387
- }
388
- break;
389
- }
390
- }))
391
- .subscribe();
392
- this.setState(toState(this.color, 0));
393
- this.currentColor = this.hex;
394
- };
395
- ColorWrap.prototype.ngOnChanges = function () {
396
- this.setState(toState(this.color, this.oldHue));
397
- };
398
- ColorWrap.prototype.ngOnDestroy = function () {
399
- var _a;
400
- (_a = this.changes) === null || _a === void 0 ? void 0 : _a.unsubscribe();
401
- this._onChangeCompleteSubscription.unsubscribe();
402
- this._onSwatchHoverSubscription.unsubscribe();
403
- };
404
- ColorWrap.prototype.setState = function (data) {
405
- this.oldHue = data.oldHue;
406
- this.hsl = data.hsl;
407
- this.hsv = data.hsv;
408
- this.rgb = data.rgb;
409
- this.hex = data.hex;
410
- this.source = data.source;
411
- this.afterValidChange();
412
- };
413
- ColorWrap.prototype.handleChange = function (data, $event) {
414
- var isValidColor = simpleCheckForValidColor(data);
415
- if (isValidColor) {
416
- var color = toState(data, data.h || this.oldHue, this.disableAlpha);
417
- this.setState(color);
418
- this.onChange.emit({ color: color, $event: $event });
419
- this.afterValidChange();
420
- }
421
- };
422
- /** hook for components after a complete change */
423
- ColorWrap.prototype.afterValidChange = function () { };
424
- ColorWrap.prototype.handleSwatchHover = function (data, $event) {
425
- var isValidColor = simpleCheckForValidColor(data);
426
- if (isValidColor) {
427
- var color = toState(data, data.h || this.oldHue);
428
- this.setState(color);
429
- this.onSwatchHover.emit({ color: color, $event: $event });
430
- }
431
- };
432
- ColorWrap.prototype.registerOnChange = function (fn) {
433
- this._onChangeCompleteSubscription.add(this.onChangeComplete.pipe(operators.tap(function (event) { return fn(event.color.hex); })).subscribe());
434
- };
435
- ColorWrap.prototype.registerOnTouched = function (fn) {
436
- this._onSwatchHoverSubscription.add(this.onSwatchHover.pipe(operators.tap(function () { return fn(); })).subscribe());
437
- };
438
- ColorWrap.prototype.setDisabledState = function (isDisabled) { };
439
- ColorWrap.prototype.writeValue = function (hex) {
440
- this.color = hex;
441
- };
442
- return ColorWrap;
443
- }());
444
- ColorWrap.decorators = [
445
- { type: core.Component, args: [{
446
- // create seletor base for test override property
447
- selector: 'color-wrap',
448
- template: "",
449
- providers: [
450
- {
451
- provide: forms.NG_VALUE_ACCESSOR,
452
- useExisting: core.forwardRef(function () { return ColorWrap; }),
453
- multi: true,
454
- }
455
- ]
456
- },] }
457
- ];
458
- ColorWrap.propDecorators = {
459
- className: [{ type: core.Input }],
460
- mode: [{ type: core.Input }],
461
- color: [{ type: core.Input }],
462
- colorChange: [{ type: core.Output }],
463
- onChange: [{ type: core.Output }],
464
- onChangeComplete: [{ type: core.Output }],
465
- onSwatchHover: [{ type: core.Output }]
466
- };
467
- var ColorWrapModule = /** @class */ (function () {
468
- function ColorWrapModule() {
469
- }
470
- return ColorWrapModule;
471
- }());
472
- ColorWrapModule.decorators = [
473
- { type: core.NgModule, args: [{
474
- declarations: [ColorWrap],
475
- exports: [ColorWrap],
476
- imports: [common.CommonModule],
477
- },] }
478
- ];
479
-
480
- var nextUniqueId = 0;
481
- var EditableInputComponent = /** @class */ (function () {
482
- function EditableInputComponent() {
483
- this.placeholder = '';
484
- this.onChange = new core.EventEmitter();
485
- this.focus = false;
486
- this.uniqueId = "editableInput-" + ++nextUniqueId;
487
- }
488
- EditableInputComponent.prototype.ngOnInit = function () {
489
- this.wrapStyle = this.style && this.style.wrap ? this.style.wrap : {};
490
- this.inputStyle = this.style && this.style.input ? this.style.input : {};
491
- this.labelStyle = this.style && this.style.label ? this.style.label : {};
492
- if (this.dragLabel) {
493
- this.labelStyle.cursor = 'ew-resize';
494
- }
495
- };
496
- EditableInputComponent.prototype.handleFocus = function ($event) {
497
- this.focus = true;
498
- };
499
- EditableInputComponent.prototype.handleFocusOut = function ($event) {
500
- this.focus = false;
501
- this.currentValue = this.blurValue;
502
- };
503
- EditableInputComponent.prototype.handleKeydown = function ($event) {
504
- var _a, _b;
505
- // In case `e.target.value` is a percentage remove the `%` character
506
- // and update accordingly with a percentage
507
- // https://github.com/casesandberg/react-color/issues/383
508
- var stringValue = String($event.target.value);
509
- var isPercentage = stringValue.indexOf('%') > -1;
510
- var num = Number(stringValue.replace(/%/g, ''));
511
- if (isNaN(num)) {
512
- return;
513
- }
514
- var amount = this.arrowOffset || 1;
515
- // Up
516
- if ($event.keyCode === 38) {
517
- if (this.label) {
518
- this.onChange.emit({
519
- data: (_a = {}, _a[this.label] = num + amount, _a),
520
- $event: $event,
521
- });
522
- }
523
- else {
524
- this.onChange.emit({ data: num + amount, $event: $event });
525
- }
526
- if (isPercentage) {
527
- this.currentValue = num + amount + "%";
528
- }
529
- else {
530
- this.currentValue = num + amount;
531
- }
532
- }
533
- // Down
534
- if ($event.keyCode === 40) {
535
- if (this.label) {
536
- this.onChange.emit({
537
- data: (_b = {}, _b[this.label] = num - amount, _b),
538
- $event: $event,
539
- });
540
- }
541
- else {
542
- this.onChange.emit({ data: num - amount, $event: $event });
543
- }
544
- if (isPercentage) {
545
- this.currentValue = num - amount + "%";
546
- }
547
- else {
548
- this.currentValue = num - amount;
549
- }
550
- }
551
- };
552
- EditableInputComponent.prototype.handleKeyup = function ($event) {
553
- var _a;
554
- if ($event.keyCode === 40 || $event.keyCode === 38) {
555
- return;
556
- }
557
- if ("" + this.currentValue === $event.target.value) {
558
- return;
559
- }
560
- if (this.label) {
561
- this.onChange.emit({
562
- data: (_a = {}, _a[this.label] = $event.target.value, _a),
563
- $event: $event,
564
- });
565
- }
566
- else {
567
- this.onChange.emit({ data: $event.target.value, $event: $event });
568
- }
569
- };
570
- EditableInputComponent.prototype.ngOnChanges = function () {
571
- if (!this.focus) {
572
- this.currentValue = String(this.value).toUpperCase();
573
- this.blurValue = String(this.value).toUpperCase();
574
- }
575
- else {
576
- this.blurValue = String(this.value).toUpperCase();
577
- }
578
- };
579
- EditableInputComponent.prototype.ngOnDestroy = function () {
580
- this.unsubscribe();
581
- };
582
- EditableInputComponent.prototype.subscribe = function () {
583
- var _this = this;
584
- this.mousemove = rxjs.fromEvent(document, 'mousemove').subscribe(function (ev) { return _this.handleDrag(ev); });
585
- this.mouseup = rxjs.fromEvent(document, 'mouseup').subscribe(function () { return _this.unsubscribe(); });
586
- };
587
- EditableInputComponent.prototype.unsubscribe = function () {
588
- if (this.mousemove) {
589
- this.mousemove.unsubscribe();
590
- }
591
- if (this.mouseup) {
592
- this.mouseup.unsubscribe();
593
- }
594
- };
595
- EditableInputComponent.prototype.handleMousedown = function ($event) {
596
- if (this.dragLabel) {
597
- $event.preventDefault();
598
- this.handleDrag($event);
599
- this.subscribe();
600
- }
601
- };
602
- EditableInputComponent.prototype.handleDrag = function ($event) {
603
- var _a;
604
- if (this.dragLabel) {
605
- var newValue = Math.round(this.value + $event.movementX);
606
- if (newValue >= 0 && newValue <= this.dragMax) {
607
- this.onChange.emit({ data: (_a = {}, _a[this.label] = newValue, _a), $event: $event });
608
- }
609
- }
610
- };
611
- return EditableInputComponent;
612
- }());
613
- EditableInputComponent.decorators = [
614
- { type: core.Component, args: [{
615
- selector: 'color-editable-input',
616
- template: "\n <div class=\"wrap\" [ngStyle]=\"wrapStyle\">\n <input\n [ngStyle]=\"inputStyle\"\n spellCheck=\"false\"\n [value]=\"currentValue\"\n [placeholder]=\"placeholder\"\n (keydown)=\"handleKeydown($event)\"\n (keyup)=\"handleKeyup($event)\"\n (focus)=\"handleFocus($event)\"\n (focusout)=\"handleFocusOut($event)\"\n [attr.aria-labelledby]=\"uniqueId\"\n />\n <span [id]=\"uniqueId\" *ngIf=\"label\" [ngStyle]=\"labelStyle\" (mousedown)=\"handleMousedown($event)\">\n {{ label }}\n </span>\n </div>\n ",
617
- changeDetection: core.ChangeDetectionStrategy.OnPush,
618
- styles: ["\n :host {\n display: flex;\n }\n .wrap {\n position: relative;\n }\n "]
619
- },] }
620
- ];
621
- EditableInputComponent.propDecorators = {
622
- style: [{ type: core.Input }],
623
- label: [{ type: core.Input }],
624
- value: [{ type: core.Input }],
625
- arrowOffset: [{ type: core.Input }],
626
- dragLabel: [{ type: core.Input }],
627
- dragMax: [{ type: core.Input }],
628
- placeholder: [{ type: core.Input }],
629
- onChange: [{ type: core.Output }]
630
- };
631
- var EditableInputModule = /** @class */ (function () {
632
- function EditableInputModule() {
633
- }
634
- return EditableInputModule;
635
- }());
636
- EditableInputModule.decorators = [
637
- { type: core.NgModule, args: [{
638
- declarations: [EditableInputComponent],
639
- exports: [EditableInputComponent],
640
- imports: [common.CommonModule],
641
- },] }
642
- ];
643
-
644
- var HueComponent = /** @class */ (function () {
645
- function HueComponent() {
646
- this.hidePointer = false;
647
- this.direction = 'horizontal';
648
- this.onChange = new core.EventEmitter();
649
- this.left = '0px';
650
- this.top = '';
651
- }
652
- HueComponent.prototype.ngOnChanges = function () {
653
- if (this.direction === 'horizontal') {
654
- this.left = this.hsl.h * 100 / 360 + "%";
655
- }
656
- else {
657
- this.top = -(this.hsl.h * 100 / 360) + 100 + "%";
658
- }
659
- };
660
- HueComponent.prototype.handleChange = function (_a) {
661
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
662
- var data;
663
- if (this.direction === 'vertical') {
664
- var h = void 0;
665
- if (top < 0) {
666
- h = 359;
667
- }
668
- else if (top > containerHeight) {
669
- h = 0;
670
- }
671
- else {
672
- var percent = -(top * 100 / containerHeight) + 100;
673
- h = 360 * percent / 100;
674
- }
675
- if (this.hsl.h !== h) {
676
- data = {
677
- h: h,
678
- s: this.hsl.s,
679
- l: this.hsl.l,
680
- a: this.hsl.a,
681
- source: 'rgb',
682
- };
683
- }
684
- }
685
- else {
686
- var h = void 0;
687
- if (left < 0) {
688
- h = 0;
689
- }
690
- else if (left > containerWidth) {
691
- h = 359;
692
- }
693
- else {
694
- var percent = left * 100 / containerWidth;
695
- h = 360 * percent / 100;
696
- }
697
- if (this.hsl.h !== h) {
698
- data = {
699
- h: h,
700
- s: this.hsl.s,
701
- l: this.hsl.l,
702
- a: this.hsl.a,
703
- source: 'rgb',
704
- };
705
- }
706
- }
707
- if (!data) {
708
- return;
709
- }
710
- this.onChange.emit({ data: data, $event: $event });
711
- };
712
- return HueComponent;
713
- }());
714
- HueComponent.decorators = [
715
- { type: core.Component, args: [{
716
- selector: 'color-hue',
717
- template: "\n <div class=\"color-hue color-hue-{{direction}}\" [style.border-radius.px]=\"radius\" [style.box-shadow]=\"shadow\">\n <div ngx-color-coordinates (coordinatesChange)=\"handleChange($event)\" class=\"color-hue-container\">\n <div class=\"color-hue-pointer\" [style.left]=\"left\" [style.top]=\"top\" *ngIf=\"!hidePointer\">\n <div class=\"color-hue-slider\" [ngStyle]=\"pointer\"></div>\n </div>\n </div>\n </div>\n ",
718
- preserveWhitespaces: false,
719
- changeDetection: core.ChangeDetectionStrategy.OnPush,
720
- styles: ["\n .color-hue {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .color-hue-container {\n margin: 0 2px;\n position: relative;\n height: 100%;\n }\n .color-hue-pointer {\n position: absolute;\n }\n .color-hue-slider {\n margin-top: 1px;\n width: 4px;\n border-radius: 1px;\n height: 8px;\n box-shadow: 0 0 2px rgba(0, 0, 0, .6);\n background: #fff;\n transform: translateX(-2px);\n }\n .color-hue-horizontal {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0\n 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n .color-hue-vertical {\n background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,\n #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n "]
721
- },] }
722
- ];
723
- HueComponent.propDecorators = {
724
- hsl: [{ type: core.Input }],
725
- pointer: [{ type: core.Input }],
726
- radius: [{ type: core.Input }],
727
- shadow: [{ type: core.Input }],
728
- hidePointer: [{ type: core.Input }],
729
- direction: [{ type: core.Input }],
730
- onChange: [{ type: core.Output }]
731
- };
732
- var HueModule = /** @class */ (function () {
733
- function HueModule() {
734
- }
735
- return HueModule;
736
- }());
737
- HueModule.decorators = [
738
- { type: core.NgModule, args: [{
739
- declarations: [HueComponent],
740
- exports: [HueComponent],
741
- imports: [common.CommonModule, CoordinatesModule],
742
- },] }
743
- ];
744
-
745
- var RaisedComponent = /** @class */ (function () {
746
- function RaisedComponent() {
747
- this.zDepth = 1;
748
- this.radius = 1;
749
- this.background = '#fff';
750
- }
751
- return RaisedComponent;
752
- }());
753
- RaisedComponent.decorators = [
754
- { type: core.Component, args: [{
755
- selector: 'color-raised',
756
- template: "\n <div class=\"raised-wrap\">\n <div class=\"raised-bg zDepth-{{zDepth}}\" [style.background]=\"background\"></div>\n <div class=\"raised-content\">\n <ng-content></ng-content>\n </div>\n </div>\n ",
757
- preserveWhitespaces: false,
758
- changeDetection: core.ChangeDetectionStrategy.OnPush,
759
- styles: ["\n .raised-wrap {\n position: relative;\n display: inline-block;\n }\n .raised-bg {\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n }\n .raised-content {\n position: relative;\n }\n .zDepth-0 {\n box-shadow: none;\n }\n .zDepth-1 {\n box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16);\n }\n .zDepth-2 {\n box-shadow: 0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2);\n }\n .zDepth-3 {\n box-shadow: 0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24);\n }\n .zDepth-4 {\n box-shadow: 0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22);\n }\n .zDepth-5 {\n box-shadow: 0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2);\n }\n "]
760
- },] }
761
- ];
762
- RaisedComponent.propDecorators = {
763
- zDepth: [{ type: core.Input }],
764
- radius: [{ type: core.Input }],
765
- background: [{ type: core.Input }]
766
- };
767
- var RaisedModule = /** @class */ (function () {
768
- function RaisedModule() {
769
- }
770
- return RaisedModule;
771
- }());
772
- RaisedModule.decorators = [
773
- { type: core.NgModule, args: [{
774
- declarations: [RaisedComponent],
775
- exports: [RaisedComponent],
776
- imports: [common.CommonModule],
777
- },] }
778
- ];
779
-
780
- var SaturationComponent = /** @class */ (function () {
781
- function SaturationComponent() {
782
- this.onChange = new core.EventEmitter();
783
- }
784
- SaturationComponent.prototype.ngOnChanges = function () {
785
- this.background = "hsl(" + this.hsl.h + ", 100%, 50%)";
786
- this.pointerTop = -(this.hsv.v * 100) + 1 + 100 + '%';
787
- this.pointerLeft = this.hsv.s * 100 + '%';
788
- };
789
- SaturationComponent.prototype.handleChange = function (_a) {
790
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
791
- if (left < 0) {
792
- left = 0;
793
- }
794
- else if (left > containerWidth) {
795
- left = containerWidth;
796
- }
797
- else if (top < 0) {
798
- top = 0;
799
- }
800
- else if (top > containerHeight) {
801
- top = containerHeight;
802
- }
803
- var saturation = left / containerWidth;
804
- var bright = -(top / containerHeight) + 1;
805
- bright = bright > 0 ? bright : 0;
806
- bright = bright > 1 ? 1 : bright;
807
- var data = {
808
- h: this.hsl.h,
809
- s: saturation,
810
- v: bright,
811
- a: this.hsl.a,
812
- source: 'hsva',
813
- };
814
- this.onChange.emit({ data: data, $event: $event });
815
- };
816
- return SaturationComponent;
817
- }());
818
- SaturationComponent.decorators = [
819
- { type: core.Component, args: [{
820
- selector: 'color-saturation',
821
- template: "\n <div class=\"color-saturation\" ngx-color-coordinates (coordinatesChange)=\"handleChange($event)\" [style.background]=\"background\">\n <div class=\"saturation-white\">\n <div class=\"saturation-black\"></div>\n <div class=\"saturation-pointer\" [ngStyle]=\"pointer\" [style.top]=\"pointerTop\" [style.left]=\"pointerLeft\">\n <div class=\"saturation-circle\" [ngStyle]=\"circle\"></div>\n </div>\n </div>\n </div>\n ",
822
- preserveWhitespaces: false,
823
- changeDetection: core.ChangeDetectionStrategy.OnPush,
824
- styles: ["\n .saturation-white {\n background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .saturation-black {\n background: linear-gradient(to top, #000, rgba(0,0,0,0));\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .color-saturation {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .saturation-pointer {\n position: absolute;\n cursor: default;\n }\n .saturation-circle {\n width: 4px;\n height: 4px;\n box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3), 0 0 1px 2px rgba(0,0,0,.4);\n border-radius: 50%;\n cursor: hand;\n transform: translate(-2px, -4px);\n }\n "]
825
- },] }
826
- ];
827
- SaturationComponent.propDecorators = {
828
- hsl: [{ type: core.Input }],
829
- hsv: [{ type: core.Input }],
830
- radius: [{ type: core.Input }],
831
- pointer: [{ type: core.Input }],
832
- circle: [{ type: core.Input }],
833
- onChange: [{ type: core.Output }]
834
- };
835
- var SaturationModule = /** @class */ (function () {
836
- function SaturationModule() {
837
- }
838
- return SaturationModule;
839
- }());
840
- SaturationModule.decorators = [
841
- { type: core.NgModule, args: [{
842
- declarations: [SaturationComponent],
843
- exports: [SaturationComponent],
844
- imports: [common.CommonModule, CoordinatesModule],
845
- },] }
846
- ];
847
-
848
- var SwatchComponent = /** @class */ (function () {
849
- function SwatchComponent() {
850
- this.style = {};
851
- this.focusStyle = {};
852
- this.onClick = new core.EventEmitter();
853
- this.onHover = new core.EventEmitter();
854
- this.divStyles = {};
855
- this.focusStyles = {};
856
- this.inFocus = false;
857
- }
858
- SwatchComponent.prototype.ngOnInit = function () {
859
- this.divStyles = Object.assign({ background: this.color }, this.style);
860
- };
861
- SwatchComponent.prototype.currentStyles = function () {
862
- this.focusStyles = Object.assign(Object.assign({}, this.divStyles), this.focusStyle);
863
- return this.focus || this.inFocus ? this.focusStyles : this.divStyles;
864
- };
865
- SwatchComponent.prototype.handleFocusOut = function () {
866
- this.inFocus = false;
867
- };
868
- SwatchComponent.prototype.handleFocus = function () {
869
- this.inFocus = true;
870
- };
871
- SwatchComponent.prototype.handleHover = function (hex, $event) {
872
- this.onHover.emit({ hex: hex, $event: $event });
873
- };
874
- SwatchComponent.prototype.handleClick = function (hex, $event) {
875
- this.onClick.emit({ hex: hex, $event: $event });
876
- };
877
- return SwatchComponent;
878
- }());
879
- SwatchComponent.decorators = [
880
- { type: core.Component, args: [{
881
- selector: 'color-swatch',
882
- template: "\n <div\n class=\"swatch\"\n [ngStyle]=\"currentStyles()\"\n [attr.title]=\"color\"\n (click)=\"handleClick(color, $event)\"\n (keydown.enter)=\"handleClick(color, $event)\"\n (focus)=\"handleFocus()\"\n (blur)=\"handleFocusOut()\"\n (mouseover)=\"handleHover(color, $event)\"\n tabindex=\"0\"\n >\n <ng-content></ng-content>\n <color-checkboard\n *ngIf=\"color === 'transparent'\"\n boxShadow=\"inset 0 0 0 1px rgba(0,0,0,0.1)\"\n ></color-checkboard>\n </div>\n ",
883
- changeDetection: core.ChangeDetectionStrategy.OnPush,
884
- styles: ["\n .swatch {\n outline: none;\n height: 100%;\n width: 100%;\n cursor: pointer;\n position: relative;\n }\n "]
885
- },] }
886
- ];
887
- SwatchComponent.propDecorators = {
888
- color: [{ type: core.Input }],
889
- style: [{ type: core.Input }],
890
- focusStyle: [{ type: core.Input }],
891
- focus: [{ type: core.Input }],
892
- onClick: [{ type: core.Output }],
893
- onHover: [{ type: core.Output }]
894
- };
895
- var SwatchModule = /** @class */ (function () {
896
- function SwatchModule() {
897
- }
898
- return SwatchModule;
899
- }());
900
- SwatchModule.decorators = [
901
- { type: core.NgModule, args: [{
902
- declarations: [SwatchComponent],
903
- exports: [SwatchComponent],
904
- imports: [common.CommonModule, CheckboardModule],
905
- },] }
906
- ];
907
-
908
- var ShadeComponent = /** @class */ (function () {
909
- function ShadeComponent() {
910
- this.onChange = new core.EventEmitter();
911
- }
912
- ShadeComponent.prototype.ngOnChanges = function () {
913
- this.gradient = {
914
- background: "linear-gradient(to right,\n hsl(" + this.hsl.h + ", 90%, 55%),\n #000)",
915
- };
916
- var hsv = new tinycolor.TinyColor(this.hsl).toHsv();
917
- this.pointerLeft = 100 - (hsv.v * 100);
918
- };
919
- ShadeComponent.prototype.handleChange = function (_a) {
920
- var left = _a.left, containerWidth = _a.containerWidth, $event = _a.$event;
921
- var data;
922
- var v;
923
- if (left < 0) {
924
- v = 0;
925
- }
926
- else if (left > containerWidth) {
927
- v = 1;
928
- }
929
- else {
930
- v = Math.round((left * 100) / containerWidth) / 100;
931
- }
932
- var hsv = new tinycolor.TinyColor(this.hsl).toHsv();
933
- if (hsv.v !== v) {
934
- data = {
935
- h: this.hsl.h,
936
- s: 100,
937
- v: 1 - v,
938
- l: this.hsl.l,
939
- a: this.hsl.a,
940
- source: 'rgb',
941
- };
942
- }
943
- if (!data) {
944
- return;
945
- }
946
- this.onChange.emit({ data: data, $event: $event });
947
- };
948
- return ShadeComponent;
949
- }());
950
- ShadeComponent.decorators = [
951
- { type: core.Component, args: [{
952
- selector: 'color-shade',
953
- template: "\n <div class=\"shade\" [style.border-radius]=\"radius\">\n <div\n class=\"shade-gradient\"\n [ngStyle]=\"gradient\"\n [style.box-shadow]=\"shadow\"\n [style.border-radius]=\"radius\"\n ></div>\n <div\n ngx-color-coordinates\n (coordinatesChange)=\"handleChange($event)\"\n class=\"shade-container\"\n >\n <div\n class=\"shade-pointer\"\n [style.left.%]=\"pointerLeft\"\n [style.top.%]=\"pointerTop\"\n >\n <div class=\"shade-slider\" [ngStyle]=\"pointer\"></div>\n </div>\n </div>\n </div>\n ",
954
- changeDetection: core.ChangeDetectionStrategy.OnPush,
955
- preserveWhitespaces: false,
956
- styles: ["\n .shade {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .shade-gradient {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n .shade-container {\n position: relative;\n height: 100%;\n margin: 0 3px;\n }\n .shade-pointer {\n position: absolute;\n }\n .shade-slider {\n width: 4px;\n border-radius: 1px;\n height: 8px;\n box-shadow: 0 0 2px rgba(0, 0, 0, .6);\n background: #fff;\n margin-top: 1px;\n transform: translateX(-2px);\n }\n "]
957
- },] }
958
- ];
959
- ShadeComponent.propDecorators = {
960
- hsl: [{ type: core.Input }],
961
- rgb: [{ type: core.Input }],
962
- pointer: [{ type: core.Input }],
963
- shadow: [{ type: core.Input }],
964
- radius: [{ type: core.Input }],
965
- onChange: [{ type: core.Output }]
966
- };
967
- var ShadeModule = /** @class */ (function () {
968
- function ShadeModule() {
969
- }
970
- return ShadeModule;
971
- }());
972
- ShadeModule.decorators = [
973
- { type: core.NgModule, args: [{
974
- declarations: [ShadeComponent],
975
- exports: [ShadeComponent],
976
- imports: [common.CommonModule, CoordinatesModule],
977
- },] }
978
- ];
979
-
980
- /**
981
- * Generated bundle index. Do not edit.
982
- */
983
-
984
- exports.AlphaComponent = AlphaComponent;
985
- exports.AlphaModule = AlphaModule;
986
- exports.CheckboardComponent = CheckboardComponent;
987
- exports.CheckboardModule = CheckboardModule;
988
- exports.ColorWrap = ColorWrap;
989
- exports.ColorWrapModule = ColorWrapModule;
990
- exports.CoordinatesDirective = CoordinatesDirective;
991
- exports.CoordinatesModule = CoordinatesModule;
992
- exports.EditableInputComponent = EditableInputComponent;
993
- exports.EditableInputModule = EditableInputModule;
994
- exports.HueComponent = HueComponent;
995
- exports.HueModule = HueModule;
996
- exports.RaisedComponent = RaisedComponent;
997
- exports.RaisedModule = RaisedModule;
998
- exports.SaturationComponent = SaturationComponent;
999
- exports.SaturationModule = SaturationModule;
1000
- exports.ShadeComponent = ShadeComponent;
1001
- exports.ShadeModule = ShadeModule;
1002
- exports.SwatchComponent = SwatchComponent;
1003
- exports.SwatchModule = SwatchModule;
1004
- exports.getCheckerboard = getCheckerboard;
1005
- exports.getContrastingColor = getContrastingColor;
1006
- exports.isValidHex = isValidHex;
1007
- exports.render = render;
1008
- exports.simpleCheckForValidColor = simpleCheckForValidColor;
1009
- exports.toState = toState;
1010
-
1011
- Object.defineProperty(exports, '__esModule', { value: true });
1012
-
1013
- })));
1014
- //# sourceMappingURL=ngx-color.umd.js.map