ngx-color 7.0.2 → 7.3.1

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 (350) 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 +27 -2
  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/esm2020/chrome/chrome.component.mjs +249 -0
  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/esm2020/twitter/twitter.component.mjs +255 -0
  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 +137 -14
  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/LICENSE +0 -21
  217. package/README.md +0 -280
  218. package/alpha/bundles/ngx-color-alpha.umd.js +0 -387
  219. package/alpha/bundles/ngx-color-alpha.umd.js.map +0 -1
  220. package/alpha/esm2015/alpha-picker.component.js +0 -72
  221. package/alpha/esm2015/ngx-color-alpha.js +0 -5
  222. package/alpha/fesm2015/ngx-color-alpha.js +0 -79
  223. package/alpha/fesm2015/ngx-color-alpha.js.map +0 -1
  224. package/alpha/ngx-color-alpha.metadata.json +0 -1
  225. package/block/bundles/ngx-color-block.umd.js +0 -455
  226. package/block/bundles/ngx-color-block.umd.js.map +0 -1
  227. package/block/esm2015/block-swatches.component.js +0 -58
  228. package/block/esm2015/block.component.js +0 -139
  229. package/block/esm2015/ngx-color-block.js +0 -6
  230. package/block/fesm2015/ngx-color-block.js +0 -202
  231. package/block/fesm2015/ngx-color-block.js.map +0 -1
  232. package/block/ngx-color-block.metadata.json +0 -1
  233. package/bundles/ngx-color.umd.js +0 -953
  234. package/bundles/ngx-color.umd.js.map +0 -1
  235. package/chrome/bundles/ngx-color-chrome.umd.js +0 -526
  236. package/chrome/bundles/ngx-color-chrome.umd.js.map +0 -1
  237. package/chrome/esm2015/chrome-fields.component.js +0 -255
  238. package/chrome/esm2015/chrome.component.js +0 -161
  239. package/chrome/esm2015/ngx-color-chrome.js +0 -6
  240. package/chrome/fesm2015/ngx-color-chrome.js +0 -420
  241. package/chrome/fesm2015/ngx-color-chrome.js.map +0 -1
  242. package/chrome/ngx-color-chrome.metadata.json +0 -1
  243. package/circle/bundles/ngx-color-circle.umd.js +0 -452
  244. package/circle/bundles/ngx-color-circle.umd.js.map +0 -1
  245. package/circle/esm2015/circle-swatch.component.js +0 -63
  246. package/circle/esm2015/circle.component.js +0 -97
  247. package/circle/esm2015/ngx-color-circle.js +0 -6
  248. package/circle/fesm2015/ngx-color-circle.js +0 -165
  249. package/circle/fesm2015/ngx-color-circle.js.map +0 -1
  250. package/circle/ngx-color-circle.metadata.json +0 -1
  251. package/compact/bundles/ngx-color-compact.umd.js +0 -562
  252. package/compact/bundles/ngx-color-compact.umd.js.map +0 -1
  253. package/compact/esm2015/compact-color.component.js +0 -70
  254. package/compact/esm2015/compact-fields.component.js +0 -142
  255. package/compact/esm2015/compact.component.js +0 -123
  256. package/compact/esm2015/ngx-color-compact.js +0 -7
  257. package/compact/fesm2015/ngx-color-compact.js +0 -336
  258. package/compact/fesm2015/ngx-color-compact.js.map +0 -1
  259. package/compact/ngx-color-compact.metadata.json +0 -1
  260. package/esm2015/alpha.component.js +0 -156
  261. package/esm2015/checkboard.component.js +0 -52
  262. package/esm2015/color-wrap.component.js +0 -82
  263. package/esm2015/coordinates.directive.js +0 -85
  264. package/esm2015/editable-input.component.js +0 -183
  265. package/esm2015/helpers/checkboard.js +0 -33
  266. package/esm2015/helpers/color.interfaces.js +0 -2
  267. package/esm2015/helpers/color.js +0 -60
  268. package/esm2015/hue.component.js +0 -140
  269. package/esm2015/ngx-color.js +0 -5
  270. package/esm2015/public_api.js +0 -14
  271. package/esm2015/raised.component.js +0 -73
  272. package/esm2015/saturation.component.js +0 -111
  273. package/esm2015/shade.component.js +0 -127
  274. package/esm2015/swatch.component.js +0 -85
  275. package/fesm2015/ngx-color.js +0 -1166
  276. package/fesm2015/ngx-color.js.map +0 -1
  277. package/github/bundles/ngx-color-github.umd.js +0 -430
  278. package/github/bundles/ngx-color-github.umd.js.map +0 -1
  279. package/github/esm2015/github-swatch.component.js +0 -48
  280. package/github/esm2015/github.component.js +0 -134
  281. package/github/esm2015/ngx-color-github.js +0 -6
  282. package/github/fesm2015/ngx-color-github.js +0 -187
  283. package/github/fesm2015/ngx-color-github.js.map +0 -1
  284. package/github/ngx-color-github.metadata.json +0 -1
  285. package/hue/bundles/ngx-color-hue.umd.js +0 -390
  286. package/hue/bundles/ngx-color-hue.umd.js.map +0 -1
  287. package/hue/esm2015/hue-picker.component.js +0 -70
  288. package/hue/esm2015/ngx-color-hue.js +0 -5
  289. package/hue/fesm2015/ngx-color-hue.js +0 -77
  290. package/hue/fesm2015/ngx-color-hue.js.map +0 -1
  291. package/hue/ngx-color-hue.metadata.json +0 -1
  292. package/material/bundles/ngx-color-material.umd.js +0 -438
  293. package/material/bundles/ngx-color-material.umd.js.map +0 -1
  294. package/material/esm2015/material.component.js +0 -149
  295. package/material/esm2015/ngx-color-material.js +0 -5
  296. package/material/fesm2015/ngx-color-material.js +0 -156
  297. package/material/fesm2015/ngx-color-material.js.map +0 -1
  298. package/material/ngx-color-material.metadata.json +0 -1
  299. package/ngx-color.metadata.json +0 -1
  300. package/photoshop/bundles/ngx-color-photoshop.umd.js +0 -554
  301. package/photoshop/bundles/ngx-color-photoshop.umd.js.map +0 -1
  302. package/photoshop/esm2015/ngx-color-photoshop.js +0 -8
  303. package/photoshop/esm2015/photoshop-button.component.js +0 -50
  304. package/photoshop/esm2015/photoshop-fields.component.js +0 -180
  305. package/photoshop/esm2015/photoshop-previews.component.js +0 -53
  306. package/photoshop/esm2015/photoshop.component.js +0 -169
  307. package/photoshop/fesm2015/ngx-color-photoshop.js +0 -452
  308. package/photoshop/fesm2015/ngx-color-photoshop.js.map +0 -1
  309. package/photoshop/ngx-color-photoshop.metadata.json +0 -1
  310. package/shade/bundles/ngx-color-shade.umd.js +0 -382
  311. package/shade/bundles/ngx-color-shade.umd.js.map +0 -1
  312. package/shade/esm2015/ngx-color-shade.js +0 -5
  313. package/shade/esm2015/shade-picker.component.js +0 -63
  314. package/shade/fesm2015/ngx-color-shade.js +0 -70
  315. package/shade/fesm2015/ngx-color-shade.js.map +0 -1
  316. package/shade/ngx-color-shade.metadata.json +0 -1
  317. package/sketch/bundles/ngx-color-sketch.umd.js +0 -568
  318. package/sketch/bundles/ngx-color-sketch.umd.js.map +0 -1
  319. package/sketch/esm2015/ngx-color-sketch.js +0 -7
  320. package/sketch/esm2015/sketch-fields.component.js +0 -181
  321. package/sketch/esm2015/sketch-preset-colors.component.js +0 -76
  322. package/sketch/esm2015/sketch.component.js +0 -191
  323. package/sketch/fesm2015/ngx-color-sketch.js +0 -450
  324. package/sketch/fesm2015/ngx-color-sketch.js.map +0 -1
  325. package/sketch/ngx-color-sketch.metadata.json +0 -1
  326. package/slider/bundles/ngx-color-slider.umd.js +0 -453
  327. package/slider/bundles/ngx-color-slider.umd.js.map +0 -1
  328. package/slider/esm2015/ngx-color-slider.js +0 -7
  329. package/slider/esm2015/slider-swatch.component.js +0 -65
  330. package/slider/esm2015/slider-swatches.component.js +0 -84
  331. package/slider/esm2015/slider.component.js +0 -69
  332. package/slider/fesm2015/ngx-color-slider.js +0 -221
  333. package/slider/fesm2015/ngx-color-slider.js.map +0 -1
  334. package/slider/ngx-color-slider.metadata.json +0 -1
  335. package/swatches/bundles/ngx-color-swatches.umd.js +0 -595
  336. package/swatches/bundles/ngx-color-swatches.umd.js.map +0 -1
  337. package/swatches/esm2015/ngx-color-swatches.js +0 -7
  338. package/swatches/esm2015/swatches-color.component.js +0 -90
  339. package/swatches/esm2015/swatches-group.component.js +0 -42
  340. package/swatches/esm2015/swatches.component.js +0 -205
  341. package/swatches/fesm2015/ngx-color-swatches.js +0 -339
  342. package/swatches/fesm2015/ngx-color-swatches.js.map +0 -1
  343. package/swatches/ngx-color-swatches.metadata.json +0 -1
  344. package/twitter/bundles/ngx-color-twitter.umd.js +0 -416
  345. package/twitter/bundles/ngx-color-twitter.umd.js.map +0 -1
  346. package/twitter/esm2015/ngx-color-twitter.js +0 -5
  347. package/twitter/esm2015/twitter.component.js +0 -195
  348. package/twitter/fesm2015/ngx-color-twitter.js +0 -202
  349. package/twitter/fesm2015/ngx-color-twitter.js.map +0 -1
  350. package/twitter/ngx-color-twitter.metadata.json +0 -1
@@ -1,953 +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')) :
3
- typeof define === 'function' && define.amd ? define('ngx-color', ['exports', '@angular/common', '@angular/core', 'rxjs', 'rxjs/operators', '@ctrl/tinycolor'], 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']));
5
- }(this, (function (exports, common, core, rxjs, operators, tinycolor) { '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
- var ColorWrap = /** @class */ (function () {
337
- function ColorWrap() {
338
- this.color = {
339
- h: 250,
340
- s: 0.5,
341
- l: 0.2,
342
- a: 1,
343
- };
344
- this.onChange = new core.EventEmitter();
345
- this.onChangeComplete = new core.EventEmitter();
346
- this.onSwatchHover = new core.EventEmitter();
347
- }
348
- ColorWrap.prototype.ngOnInit = function () {
349
- var _this = this;
350
- this.changes = this.onChange
351
- .pipe(operators.debounceTime(100))
352
- .subscribe(function (x) { return _this.onChangeComplete.emit(x); });
353
- this.setState(toState(this.color, 0));
354
- this.currentColor = this.hex;
355
- };
356
- ColorWrap.prototype.ngOnChanges = function () {
357
- this.setState(toState(this.color, this.oldHue));
358
- };
359
- ColorWrap.prototype.ngOnDestroy = function () {
360
- this.changes.unsubscribe();
361
- };
362
- ColorWrap.prototype.setState = function (data) {
363
- this.oldHue = data.oldHue;
364
- this.hsl = data.hsl;
365
- this.hsv = data.hsv;
366
- this.rgb = data.rgb;
367
- this.hex = data.hex;
368
- this.source = data.source;
369
- this.afterValidChange();
370
- };
371
- ColorWrap.prototype.handleChange = function (data, $event) {
372
- var isValidColor = simpleCheckForValidColor(data);
373
- if (isValidColor) {
374
- var color = toState(data, data.h || this.oldHue, this.disableAlpha);
375
- this.setState(color);
376
- this.onChange.emit({ color: color, $event: $event });
377
- this.afterValidChange();
378
- }
379
- };
380
- /** hook for components after a complete change */
381
- ColorWrap.prototype.afterValidChange = function () { };
382
- ColorWrap.prototype.handleSwatchHover = function (data, $event) {
383
- var isValidColor = simpleCheckForValidColor(data);
384
- if (isValidColor) {
385
- var color = toState(data, data.h || this.oldHue);
386
- this.setState(color);
387
- this.onSwatchHover.emit({ color: color, $event: $event });
388
- }
389
- };
390
- return ColorWrap;
391
- }());
392
- ColorWrap.decorators = [
393
- { type: core.Component, args: [{
394
- // create seletor base for test override property
395
- selector: 'color-wrap',
396
- template: ""
397
- },] }
398
- ];
399
- ColorWrap.propDecorators = {
400
- className: [{ type: core.Input }],
401
- color: [{ type: core.Input }],
402
- onChange: [{ type: core.Output }],
403
- onChangeComplete: [{ type: core.Output }],
404
- onSwatchHover: [{ type: core.Output }]
405
- };
406
- var ColorWrapModule = /** @class */ (function () {
407
- function ColorWrapModule() {
408
- }
409
- return ColorWrapModule;
410
- }());
411
- ColorWrapModule.decorators = [
412
- { type: core.NgModule, args: [{
413
- declarations: [ColorWrap],
414
- exports: [ColorWrap],
415
- imports: [common.CommonModule],
416
- },] }
417
- ];
418
-
419
- var nextUniqueId = 0;
420
- var EditableInputComponent = /** @class */ (function () {
421
- function EditableInputComponent() {
422
- this.placeholder = '';
423
- this.onChange = new core.EventEmitter();
424
- this.focus = false;
425
- this.uniqueId = "editableInput-" + ++nextUniqueId;
426
- }
427
- EditableInputComponent.prototype.ngOnInit = function () {
428
- this.wrapStyle = this.style && this.style.wrap ? this.style.wrap : {};
429
- this.inputStyle = this.style && this.style.input ? this.style.input : {};
430
- this.labelStyle = this.style && this.style.label ? this.style.label : {};
431
- if (this.dragLabel) {
432
- this.labelStyle.cursor = 'ew-resize';
433
- }
434
- };
435
- EditableInputComponent.prototype.handleFocus = function ($event) {
436
- this.focus = true;
437
- };
438
- EditableInputComponent.prototype.handleFocusOut = function ($event) {
439
- this.focus = false;
440
- this.currentValue = this.blurValue;
441
- };
442
- EditableInputComponent.prototype.handleKeydown = function ($event) {
443
- var _a, _b;
444
- // In case `e.target.value` is a percentage remove the `%` character
445
- // and update accordingly with a percentage
446
- // https://github.com/casesandberg/react-color/issues/383
447
- var stringValue = String($event.target.value);
448
- var isPercentage = stringValue.indexOf('%') > -1;
449
- var num = Number(stringValue.replace(/%/g, ''));
450
- if (isNaN(num)) {
451
- return;
452
- }
453
- var amount = this.arrowOffset || 1;
454
- // Up
455
- if ($event.keyCode === 38) {
456
- if (this.label) {
457
- this.onChange.emit({
458
- data: (_a = {}, _a[this.label] = num + amount, _a),
459
- $event: $event,
460
- });
461
- }
462
- else {
463
- this.onChange.emit({ data: num + amount, $event: $event });
464
- }
465
- if (isPercentage) {
466
- this.currentValue = num + amount + "%";
467
- }
468
- else {
469
- this.currentValue = num + amount;
470
- }
471
- }
472
- // Down
473
- if ($event.keyCode === 40) {
474
- if (this.label) {
475
- this.onChange.emit({
476
- data: (_b = {}, _b[this.label] = num - amount, _b),
477
- $event: $event,
478
- });
479
- }
480
- else {
481
- this.onChange.emit({ data: num - amount, $event: $event });
482
- }
483
- if (isPercentage) {
484
- this.currentValue = num - amount + "%";
485
- }
486
- else {
487
- this.currentValue = num - amount;
488
- }
489
- }
490
- };
491
- EditableInputComponent.prototype.handleKeyup = function ($event) {
492
- var _a;
493
- if ($event.keyCode === 40 || $event.keyCode === 38) {
494
- return;
495
- }
496
- if ("" + this.currentValue === $event.target.value) {
497
- return;
498
- }
499
- if (this.label) {
500
- this.onChange.emit({
501
- data: (_a = {}, _a[this.label] = $event.target.value, _a),
502
- $event: $event,
503
- });
504
- }
505
- else {
506
- this.onChange.emit({ data: $event.target.value, $event: $event });
507
- }
508
- };
509
- EditableInputComponent.prototype.ngOnChanges = function () {
510
- if (!this.focus) {
511
- this.currentValue = String(this.value).toUpperCase();
512
- this.blurValue = String(this.value).toUpperCase();
513
- }
514
- else {
515
- this.blurValue = String(this.value).toUpperCase();
516
- }
517
- };
518
- EditableInputComponent.prototype.ngOnDestroy = function () {
519
- this.unsubscribe();
520
- };
521
- EditableInputComponent.prototype.subscribe = function () {
522
- var _this = this;
523
- this.mousemove = rxjs.fromEvent(document, 'mousemove').subscribe(function (ev) { return _this.handleDrag(ev); });
524
- this.mouseup = rxjs.fromEvent(document, 'mouseup').subscribe(function () { return _this.unsubscribe(); });
525
- };
526
- EditableInputComponent.prototype.unsubscribe = function () {
527
- if (this.mousemove) {
528
- this.mousemove.unsubscribe();
529
- }
530
- if (this.mouseup) {
531
- this.mouseup.unsubscribe();
532
- }
533
- };
534
- EditableInputComponent.prototype.handleMousedown = function ($event) {
535
- if (this.dragLabel) {
536
- $event.preventDefault();
537
- this.handleDrag($event);
538
- this.subscribe();
539
- }
540
- };
541
- EditableInputComponent.prototype.handleDrag = function ($event) {
542
- var _a;
543
- if (this.dragLabel) {
544
- var newValue = Math.round(this.value + $event.movementX);
545
- if (newValue >= 0 && newValue <= this.dragMax) {
546
- this.onChange.emit({ data: (_a = {}, _a[this.label] = newValue, _a), $event: $event });
547
- }
548
- }
549
- };
550
- return EditableInputComponent;
551
- }());
552
- EditableInputComponent.decorators = [
553
- { type: core.Component, args: [{
554
- selector: 'color-editable-input',
555
- 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 ",
556
- changeDetection: core.ChangeDetectionStrategy.OnPush,
557
- styles: ["\n :host {\n display: flex;\n }\n .wrap {\n position: relative;\n }\n "]
558
- },] }
559
- ];
560
- EditableInputComponent.propDecorators = {
561
- style: [{ type: core.Input }],
562
- label: [{ type: core.Input }],
563
- value: [{ type: core.Input }],
564
- arrowOffset: [{ type: core.Input }],
565
- dragLabel: [{ type: core.Input }],
566
- dragMax: [{ type: core.Input }],
567
- placeholder: [{ type: core.Input }],
568
- onChange: [{ type: core.Output }]
569
- };
570
- var EditableInputModule = /** @class */ (function () {
571
- function EditableInputModule() {
572
- }
573
- return EditableInputModule;
574
- }());
575
- EditableInputModule.decorators = [
576
- { type: core.NgModule, args: [{
577
- declarations: [EditableInputComponent],
578
- exports: [EditableInputComponent],
579
- imports: [common.CommonModule],
580
- },] }
581
- ];
582
-
583
- var HueComponent = /** @class */ (function () {
584
- function HueComponent() {
585
- this.hidePointer = false;
586
- this.direction = 'horizontal';
587
- this.onChange = new core.EventEmitter();
588
- this.left = '0px';
589
- this.top = '';
590
- }
591
- HueComponent.prototype.ngOnChanges = function () {
592
- if (this.direction === 'horizontal') {
593
- this.left = this.hsl.h * 100 / 360 + "%";
594
- }
595
- else {
596
- this.top = -(this.hsl.h * 100 / 360) + 100 + "%";
597
- }
598
- };
599
- HueComponent.prototype.handleChange = function (_a) {
600
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
601
- var data;
602
- if (this.direction === 'vertical') {
603
- var h = void 0;
604
- if (top < 0) {
605
- h = 359;
606
- }
607
- else if (top > containerHeight) {
608
- h = 0;
609
- }
610
- else {
611
- var percent = -(top * 100 / containerHeight) + 100;
612
- h = 360 * percent / 100;
613
- }
614
- if (this.hsl.h !== h) {
615
- data = {
616
- h: h,
617
- s: this.hsl.s,
618
- l: this.hsl.l,
619
- a: this.hsl.a,
620
- source: 'rgb',
621
- };
622
- }
623
- }
624
- else {
625
- var h = void 0;
626
- if (left < 0) {
627
- h = 0;
628
- }
629
- else if (left > containerWidth) {
630
- h = 359;
631
- }
632
- else {
633
- var percent = left * 100 / containerWidth;
634
- h = 360 * percent / 100;
635
- }
636
- if (this.hsl.h !== h) {
637
- data = {
638
- h: h,
639
- s: this.hsl.s,
640
- l: this.hsl.l,
641
- a: this.hsl.a,
642
- source: 'rgb',
643
- };
644
- }
645
- }
646
- if (!data) {
647
- return;
648
- }
649
- this.onChange.emit({ data: data, $event: $event });
650
- };
651
- return HueComponent;
652
- }());
653
- HueComponent.decorators = [
654
- { type: core.Component, args: [{
655
- selector: 'color-hue',
656
- 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 ",
657
- preserveWhitespaces: false,
658
- changeDetection: core.ChangeDetectionStrategy.OnPush,
659
- 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 "]
660
- },] }
661
- ];
662
- HueComponent.propDecorators = {
663
- hsl: [{ type: core.Input }],
664
- pointer: [{ type: core.Input }],
665
- radius: [{ type: core.Input }],
666
- shadow: [{ type: core.Input }],
667
- hidePointer: [{ type: core.Input }],
668
- direction: [{ type: core.Input }],
669
- onChange: [{ type: core.Output }]
670
- };
671
- var HueModule = /** @class */ (function () {
672
- function HueModule() {
673
- }
674
- return HueModule;
675
- }());
676
- HueModule.decorators = [
677
- { type: core.NgModule, args: [{
678
- declarations: [HueComponent],
679
- exports: [HueComponent],
680
- imports: [common.CommonModule, CoordinatesModule],
681
- },] }
682
- ];
683
-
684
- var RaisedComponent = /** @class */ (function () {
685
- function RaisedComponent() {
686
- this.zDepth = 1;
687
- this.radius = 1;
688
- this.background = '#fff';
689
- }
690
- return RaisedComponent;
691
- }());
692
- RaisedComponent.decorators = [
693
- { type: core.Component, args: [{
694
- selector: 'color-raised',
695
- 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 ",
696
- preserveWhitespaces: false,
697
- changeDetection: core.ChangeDetectionStrategy.OnPush,
698
- 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 "]
699
- },] }
700
- ];
701
- RaisedComponent.propDecorators = {
702
- zDepth: [{ type: core.Input }],
703
- radius: [{ type: core.Input }],
704
- background: [{ type: core.Input }]
705
- };
706
- var RaisedModule = /** @class */ (function () {
707
- function RaisedModule() {
708
- }
709
- return RaisedModule;
710
- }());
711
- RaisedModule.decorators = [
712
- { type: core.NgModule, args: [{
713
- declarations: [RaisedComponent],
714
- exports: [RaisedComponent],
715
- imports: [common.CommonModule],
716
- },] }
717
- ];
718
-
719
- var SaturationComponent = /** @class */ (function () {
720
- function SaturationComponent() {
721
- this.onChange = new core.EventEmitter();
722
- }
723
- SaturationComponent.prototype.ngOnChanges = function () {
724
- this.background = "hsl(" + this.hsl.h + ", 100%, 50%)";
725
- this.pointerTop = -(this.hsv.v * 100) + 1 + 100 + '%';
726
- this.pointerLeft = this.hsv.s * 100 + '%';
727
- };
728
- SaturationComponent.prototype.handleChange = function (_a) {
729
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
730
- if (left < 0) {
731
- left = 0;
732
- }
733
- else if (left > containerWidth) {
734
- left = containerWidth;
735
- }
736
- else if (top < 0) {
737
- top = 0;
738
- }
739
- else if (top > containerHeight) {
740
- top = containerHeight;
741
- }
742
- var saturation = left / containerWidth;
743
- var bright = -(top / containerHeight) + 1;
744
- bright = bright > 0 ? bright : 0;
745
- bright = bright > 1 ? 1 : bright;
746
- var data = {
747
- h: this.hsl.h,
748
- s: saturation,
749
- v: bright,
750
- a: this.hsl.a,
751
- source: 'hsva',
752
- };
753
- this.onChange.emit({ data: data, $event: $event });
754
- };
755
- return SaturationComponent;
756
- }());
757
- SaturationComponent.decorators = [
758
- { type: core.Component, args: [{
759
- selector: 'color-saturation',
760
- 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 ",
761
- preserveWhitespaces: false,
762
- changeDetection: core.ChangeDetectionStrategy.OnPush,
763
- 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 "]
764
- },] }
765
- ];
766
- SaturationComponent.propDecorators = {
767
- hsl: [{ type: core.Input }],
768
- hsv: [{ type: core.Input }],
769
- radius: [{ type: core.Input }],
770
- pointer: [{ type: core.Input }],
771
- circle: [{ type: core.Input }],
772
- onChange: [{ type: core.Output }]
773
- };
774
- var SaturationModule = /** @class */ (function () {
775
- function SaturationModule() {
776
- }
777
- return SaturationModule;
778
- }());
779
- SaturationModule.decorators = [
780
- { type: core.NgModule, args: [{
781
- declarations: [SaturationComponent],
782
- exports: [SaturationComponent],
783
- imports: [common.CommonModule, CoordinatesModule],
784
- },] }
785
- ];
786
-
787
- var SwatchComponent = /** @class */ (function () {
788
- function SwatchComponent() {
789
- this.style = {};
790
- this.focusStyle = {};
791
- this.onClick = new core.EventEmitter();
792
- this.onHover = new core.EventEmitter();
793
- this.divStyles = {};
794
- this.focusStyles = {};
795
- this.inFocus = false;
796
- }
797
- SwatchComponent.prototype.ngOnInit = function () {
798
- this.divStyles = Object.assign({ background: this.color }, this.style);
799
- };
800
- SwatchComponent.prototype.currentStyles = function () {
801
- this.focusStyles = Object.assign(Object.assign({}, this.divStyles), this.focusStyle);
802
- return this.focus || this.inFocus ? this.focusStyles : this.divStyles;
803
- };
804
- SwatchComponent.prototype.handleFocusOut = function () {
805
- this.inFocus = false;
806
- };
807
- SwatchComponent.prototype.handleFocus = function () {
808
- this.inFocus = true;
809
- };
810
- SwatchComponent.prototype.handleHover = function (hex, $event) {
811
- this.onHover.emit({ hex: hex, $event: $event });
812
- };
813
- SwatchComponent.prototype.handleClick = function (hex, $event) {
814
- this.onClick.emit({ hex: hex, $event: $event });
815
- };
816
- return SwatchComponent;
817
- }());
818
- SwatchComponent.decorators = [
819
- { type: core.Component, args: [{
820
- selector: 'color-swatch',
821
- 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 ",
822
- changeDetection: core.ChangeDetectionStrategy.OnPush,
823
- styles: ["\n .swatch {\n outline: none;\n height: 100%;\n width: 100%;\n cursor: pointer;\n position: relative;\n }\n "]
824
- },] }
825
- ];
826
- SwatchComponent.propDecorators = {
827
- color: [{ type: core.Input }],
828
- style: [{ type: core.Input }],
829
- focusStyle: [{ type: core.Input }],
830
- focus: [{ type: core.Input }],
831
- onClick: [{ type: core.Output }],
832
- onHover: [{ type: core.Output }]
833
- };
834
- var SwatchModule = /** @class */ (function () {
835
- function SwatchModule() {
836
- }
837
- return SwatchModule;
838
- }());
839
- SwatchModule.decorators = [
840
- { type: core.NgModule, args: [{
841
- declarations: [SwatchComponent],
842
- exports: [SwatchComponent],
843
- imports: [common.CommonModule, CheckboardModule],
844
- },] }
845
- ];
846
-
847
- var ShadeComponent = /** @class */ (function () {
848
- function ShadeComponent() {
849
- this.onChange = new core.EventEmitter();
850
- }
851
- ShadeComponent.prototype.ngOnChanges = function () {
852
- this.gradient = {
853
- background: "linear-gradient(to right,\n hsl(" + this.hsl.h + ", 90%, 55%),\n #000)",
854
- };
855
- var hsv = new tinycolor.TinyColor(this.hsl).toHsv();
856
- this.pointerLeft = 100 - (hsv.v * 100);
857
- };
858
- ShadeComponent.prototype.handleChange = function (_a) {
859
- var left = _a.left, containerWidth = _a.containerWidth, $event = _a.$event;
860
- var data;
861
- var v;
862
- if (left < 0) {
863
- v = 0;
864
- }
865
- else if (left > containerWidth) {
866
- v = 1;
867
- }
868
- else {
869
- v = Math.round((left * 100) / containerWidth) / 100;
870
- }
871
- var hsv = new tinycolor.TinyColor(this.hsl).toHsv();
872
- if (hsv.v !== v) {
873
- data = {
874
- h: this.hsl.h,
875
- s: 100,
876
- v: 1 - v,
877
- l: this.hsl.l,
878
- a: this.hsl.a,
879
- source: 'rgb',
880
- };
881
- }
882
- if (!data) {
883
- return;
884
- }
885
- this.onChange.emit({ data: data, $event: $event });
886
- };
887
- return ShadeComponent;
888
- }());
889
- ShadeComponent.decorators = [
890
- { type: core.Component, args: [{
891
- selector: 'color-shade',
892
- 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 ",
893
- changeDetection: core.ChangeDetectionStrategy.OnPush,
894
- preserveWhitespaces: false,
895
- 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 "]
896
- },] }
897
- ];
898
- ShadeComponent.propDecorators = {
899
- hsl: [{ type: core.Input }],
900
- rgb: [{ type: core.Input }],
901
- pointer: [{ type: core.Input }],
902
- shadow: [{ type: core.Input }],
903
- radius: [{ type: core.Input }],
904
- onChange: [{ type: core.Output }]
905
- };
906
- var ShadeModule = /** @class */ (function () {
907
- function ShadeModule() {
908
- }
909
- return ShadeModule;
910
- }());
911
- ShadeModule.decorators = [
912
- { type: core.NgModule, args: [{
913
- declarations: [ShadeComponent],
914
- exports: [ShadeComponent],
915
- imports: [common.CommonModule, CoordinatesModule],
916
- },] }
917
- ];
918
-
919
- /**
920
- * Generated bundle index. Do not edit.
921
- */
922
-
923
- exports.AlphaComponent = AlphaComponent;
924
- exports.AlphaModule = AlphaModule;
925
- exports.CheckboardComponent = CheckboardComponent;
926
- exports.CheckboardModule = CheckboardModule;
927
- exports.ColorWrap = ColorWrap;
928
- exports.ColorWrapModule = ColorWrapModule;
929
- exports.CoordinatesDirective = CoordinatesDirective;
930
- exports.CoordinatesModule = CoordinatesModule;
931
- exports.EditableInputComponent = EditableInputComponent;
932
- exports.EditableInputModule = EditableInputModule;
933
- exports.HueComponent = HueComponent;
934
- exports.HueModule = HueModule;
935
- exports.RaisedComponent = RaisedComponent;
936
- exports.RaisedModule = RaisedModule;
937
- exports.SaturationComponent = SaturationComponent;
938
- exports.SaturationModule = SaturationModule;
939
- exports.ShadeComponent = ShadeComponent;
940
- exports.ShadeModule = ShadeModule;
941
- exports.SwatchComponent = SwatchComponent;
942
- exports.SwatchModule = SwatchModule;
943
- exports.getCheckerboard = getCheckerboard;
944
- exports.getContrastingColor = getContrastingColor;
945
- exports.isValidHex = isValidHex;
946
- exports.render = render;
947
- exports.simpleCheckForValidColor = simpleCheckForValidColor;
948
- exports.toState = toState;
949
-
950
- Object.defineProperty(exports, '__esModule', { value: true });
951
-
952
- })));
953
- //# sourceMappingURL=ngx-color.umd.js.map