ngx-color 7.0.1 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/alpha/alpha-picker.component.d.ts +8 -0
  2. package/alpha/esm2020/alpha-picker.component.mjs +116 -0
  3. package/alpha/{esm2015/ngx-color-alpha.js → esm2020/ngx-color-alpha.mjs} +2 -2
  4. package/alpha/esm2020/public_api.mjs +2 -0
  5. package/alpha/fesm2015/ngx-color-alpha.mjs +123 -0
  6. package/alpha/fesm2015/ngx-color-alpha.mjs.map +1 -0
  7. package/alpha/fesm2020/ngx-color-alpha.mjs +123 -0
  8. package/alpha/fesm2020/ngx-color-alpha.mjs.map +1 -0
  9. package/alpha/ngx-color-alpha.d.ts +2 -1
  10. package/alpha/package.json +19 -7
  11. package/alpha/public_api.d.ts +1 -0
  12. package/alpha.component.d.ts +9 -0
  13. package/block/block-swatches.component.d.ts +3 -0
  14. package/block/block.component.d.ts +9 -0
  15. package/block/esm2020/block-swatches.component.mjs +76 -0
  16. package/block/esm2020/block.component.mjs +199 -0
  17. package/block/esm2020/ngx-color-block.mjs +5 -0
  18. package/block/esm2020/public_api.mjs +3 -0
  19. package/block/fesm2015/ngx-color-block.mjs +277 -0
  20. package/block/fesm2015/ngx-color-block.mjs.map +1 -0
  21. package/block/fesm2020/ngx-color-block.mjs +277 -0
  22. package/block/fesm2020/ngx-color-block.mjs.map +1 -0
  23. package/block/ngx-color-block.d.ts +2 -2
  24. package/block/package.json +19 -7
  25. package/block/public_api.d.ts +2 -0
  26. package/checkboard.component.d.ts +7 -0
  27. package/chrome/chrome-fields.component.d.ts +3 -0
  28. package/chrome/chrome.component.d.ts +9 -0
  29. package/chrome/esm2020/chrome-fields.component.mjs +356 -0
  30. package/chrome/esm2020/chrome.component.mjs +249 -0
  31. package/chrome/esm2020/ngx-color-chrome.mjs +5 -0
  32. package/chrome/esm2020/public_api.mjs +3 -0
  33. package/chrome/fesm2015/ngx-color-chrome.mjs +606 -0
  34. package/chrome/fesm2015/ngx-color-chrome.mjs.map +1 -0
  35. package/chrome/fesm2020/ngx-color-chrome.mjs +606 -0
  36. package/chrome/fesm2020/ngx-color-chrome.mjs.map +1 -0
  37. package/chrome/ngx-color-chrome.d.ts +2 -2
  38. package/chrome/package.json +19 -7
  39. package/chrome/public_api.d.ts +2 -0
  40. package/circle/circle-swatch.component.d.ts +3 -0
  41. package/circle/circle.component.d.ts +9 -0
  42. package/circle/esm2020/circle-swatch.component.mjs +85 -0
  43. package/circle/esm2020/circle.component.mjs +148 -0
  44. package/circle/esm2020/ngx-color-circle.mjs +5 -0
  45. package/circle/esm2020/public_api.mjs +3 -0
  46. package/circle/fesm2015/ngx-color-circle.mjs +237 -0
  47. package/circle/fesm2015/ngx-color-circle.mjs.map +1 -0
  48. package/circle/fesm2020/ngx-color-circle.mjs +237 -0
  49. package/circle/fesm2020/ngx-color-circle.mjs.map +1 -0
  50. package/circle/ngx-color-circle.d.ts +2 -2
  51. package/circle/package.json +19 -7
  52. package/circle/public_api.d.ts +2 -0
  53. package/color-wrap.component.d.ts +27 -2
  54. package/compact/compact-color.component.d.ts +3 -0
  55. package/compact/compact-fields.component.d.ts +3 -0
  56. package/compact/compact.component.d.ts +10 -0
  57. package/compact/esm2020/compact-color.component.mjs +91 -0
  58. package/compact/esm2020/compact-fields.component.mjs +186 -0
  59. package/compact/esm2020/compact.component.mjs +177 -0
  60. package/compact/esm2020/ngx-color-compact.mjs +5 -0
  61. package/compact/esm2020/public_api.mjs +4 -0
  62. package/compact/fesm2015/ngx-color-compact.mjs +451 -0
  63. package/compact/fesm2015/ngx-color-compact.mjs.map +1 -0
  64. package/compact/fesm2020/ngx-color-compact.mjs +451 -0
  65. package/compact/fesm2020/ngx-color-compact.mjs.map +1 -0
  66. package/compact/ngx-color-compact.d.ts +2 -3
  67. package/compact/package.json +19 -7
  68. package/compact/public_api.d.ts +3 -0
  69. package/coordinates.directive.d.ts +6 -0
  70. package/editable-input.component.d.ts +8 -0
  71. package/esm2020/alpha.component.mjs +186 -0
  72. package/esm2020/checkboard.component.mjs +66 -0
  73. package/esm2020/color-wrap.component.mjs +163 -0
  74. package/esm2020/coordinates.directive.mjs +104 -0
  75. package/esm2020/editable-input.component.mjs +217 -0
  76. package/{esm2015/helpers/checkboard.js → esm2020/helpers/checkboard.mjs} +0 -0
  77. package/{esm2015/helpers/color.interfaces.js → esm2020/helpers/color.interfaces.mjs} +0 -0
  78. package/{esm2015/helpers/color.js → esm2020/helpers/color.mjs} +0 -0
  79. package/esm2020/hue.component.mjs +165 -0
  80. package/{esm2015/ngx-color.js → esm2020/ngx-color.mjs} +0 -0
  81. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  82. package/esm2020/raised.component.mjs +89 -0
  83. package/esm2020/saturation.component.mjs +136 -0
  84. package/esm2020/shade.component.mjs +165 -0
  85. package/esm2020/swatch.component.mjs +125 -0
  86. package/fesm2015/ngx-color.mjs +1461 -0
  87. package/fesm2015/ngx-color.mjs.map +1 -0
  88. package/fesm2020/ngx-color.mjs +1466 -0
  89. package/fesm2020/ngx-color.mjs.map +1 -0
  90. package/github/esm2020/github-swatch.component.mjs +67 -0
  91. package/github/esm2020/github.component.mjs +179 -0
  92. package/github/esm2020/ngx-color-github.mjs +5 -0
  93. package/github/esm2020/public_api.mjs +3 -0
  94. package/github/fesm2015/ngx-color-github.mjs +250 -0
  95. package/github/fesm2015/ngx-color-github.mjs.map +1 -0
  96. package/github/fesm2020/ngx-color-github.mjs +250 -0
  97. package/github/fesm2020/ngx-color-github.mjs.map +1 -0
  98. package/github/github-swatch.component.d.ts +3 -0
  99. package/github/github.component.d.ts +9 -0
  100. package/github/ngx-color-github.d.ts +2 -2
  101. package/github/package.json +19 -7
  102. package/github/public_api.d.ts +2 -0
  103. package/helpers/checkboard.d.ts +2 -2
  104. package/hue/esm2020/hue-picker.component.mjs +113 -0
  105. package/hue/{esm2015/ngx-color-hue.js → esm2020/ngx-color-hue.mjs} +2 -2
  106. package/hue/esm2020/public_api.mjs +2 -0
  107. package/hue/fesm2015/ngx-color-hue.mjs +120 -0
  108. package/hue/fesm2015/ngx-color-hue.mjs.map +1 -0
  109. package/hue/fesm2020/ngx-color-hue.mjs +120 -0
  110. package/hue/fesm2020/ngx-color-hue.mjs.map +1 -0
  111. package/hue/hue-picker.component.d.ts +8 -0
  112. package/hue/ngx-color-hue.d.ts +2 -1
  113. package/hue/package.json +19 -7
  114. package/hue/public_api.d.ts +1 -0
  115. package/hue.component.d.ts +8 -0
  116. package/material/esm2020/material.component.mjs +211 -0
  117. package/material/{esm2015/ngx-color-material.js → esm2020/ngx-color-material.mjs} +2 -2
  118. package/material/esm2020/public_api.mjs +2 -0
  119. package/material/fesm2015/ngx-color-material.mjs +218 -0
  120. package/material/fesm2015/ngx-color-material.mjs.map +1 -0
  121. package/material/fesm2020/ngx-color-material.mjs +218 -0
  122. package/material/fesm2020/ngx-color-material.mjs.map +1 -0
  123. package/material/material.component.d.ts +8 -0
  124. package/material/ngx-color-material.d.ts +2 -1
  125. package/material/package.json +19 -7
  126. package/material/public_api.d.ts +1 -0
  127. package/ngx-color.d.ts +1 -0
  128. package/package.json +20 -8
  129. package/photoshop/esm2020/ngx-color-photoshop.mjs +5 -0
  130. package/photoshop/esm2020/photoshop-button.component.mjs +63 -0
  131. package/photoshop/esm2020/photoshop-fields.component.mjs +241 -0
  132. package/photoshop/esm2020/photoshop-previews.component.mjs +68 -0
  133. package/photoshop/esm2020/photoshop.component.mjs +258 -0
  134. package/photoshop/esm2020/public_api.mjs +5 -0
  135. package/photoshop/fesm2015/ngx-color-photoshop.mjs +626 -0
  136. package/photoshop/fesm2015/ngx-color-photoshop.mjs.map +1 -0
  137. package/photoshop/fesm2020/ngx-color-photoshop.mjs +626 -0
  138. package/photoshop/fesm2020/ngx-color-photoshop.mjs.map +1 -0
  139. package/photoshop/ngx-color-photoshop.d.ts +2 -4
  140. package/photoshop/package.json +19 -7
  141. package/photoshop/photoshop-button.component.d.ts +3 -0
  142. package/photoshop/photoshop-fields.component.d.ts +3 -0
  143. package/photoshop/photoshop-previews.component.d.ts +3 -0
  144. package/photoshop/photoshop.component.d.ts +11 -0
  145. package/photoshop/public_api.d.ts +4 -0
  146. package/raised.component.d.ts +7 -0
  147. package/saturation.component.d.ts +8 -0
  148. package/shade/{esm2015/ngx-color-shade.js → esm2020/ngx-color-shade.mjs} +2 -2
  149. package/shade/esm2020/public_api.mjs +2 -0
  150. package/shade/esm2020/shade-picker.component.mjs +105 -0
  151. package/shade/fesm2015/ngx-color-shade.mjs +112 -0
  152. package/shade/fesm2015/ngx-color-shade.mjs.map +1 -0
  153. package/shade/fesm2020/ngx-color-shade.mjs +112 -0
  154. package/shade/fesm2020/ngx-color-shade.mjs.map +1 -0
  155. package/shade/ngx-color-shade.d.ts +2 -1
  156. package/shade/package.json +19 -7
  157. package/shade/public_api.d.ts +1 -0
  158. package/shade/shade-picker.component.d.ts +8 -0
  159. package/shade.component.d.ts +8 -0
  160. package/sketch/esm2020/ngx-color-sketch.mjs +5 -0
  161. package/sketch/esm2020/public_api.mjs +4 -0
  162. package/sketch/esm2020/sketch-fields.component.mjs +243 -0
  163. package/sketch/esm2020/sketch-preset-colors.component.mjs +98 -0
  164. package/sketch/esm2020/sketch.component.mjs +283 -0
  165. package/sketch/fesm2015/ngx-color-sketch.mjs +620 -0
  166. package/sketch/fesm2015/ngx-color-sketch.mjs.map +1 -0
  167. package/sketch/fesm2020/ngx-color-sketch.mjs +620 -0
  168. package/sketch/fesm2020/ngx-color-sketch.mjs.map +1 -0
  169. package/sketch/ngx-color-sketch.d.ts +2 -3
  170. package/sketch/package.json +19 -7
  171. package/sketch/public_api.d.ts +3 -0
  172. package/sketch/sketch-fields.component.d.ts +3 -0
  173. package/sketch/sketch-preset-colors.component.d.ts +3 -0
  174. package/sketch/sketch.component.d.ts +10 -0
  175. package/slider/esm2020/ngx-color-slider.mjs +5 -0
  176. package/slider/esm2020/public_api.mjs +4 -0
  177. package/slider/esm2020/slider-swatch.component.mjs +80 -0
  178. package/slider/esm2020/slider-swatches.component.mjs +135 -0
  179. package/slider/esm2020/slider.component.mjs +116 -0
  180. package/slider/fesm2015/ngx-color-slider.mjs +331 -0
  181. package/slider/fesm2015/ngx-color-slider.mjs.map +1 -0
  182. package/slider/fesm2020/ngx-color-slider.mjs +331 -0
  183. package/slider/fesm2020/ngx-color-slider.mjs.map +1 -0
  184. package/slider/ngx-color-slider.d.ts +2 -3
  185. package/slider/package.json +19 -7
  186. package/slider/public_api.d.ts +3 -0
  187. package/slider/slider-swatch.component.d.ts +3 -0
  188. package/slider/slider-swatches.component.d.ts +3 -0
  189. package/slider/slider.component.d.ts +10 -0
  190. package/swatch.component.d.ts +8 -0
  191. package/swatches/esm2020/ngx-color-swatches.mjs +5 -0
  192. package/swatches/esm2020/public_api.mjs +4 -0
  193. package/swatches/esm2020/swatches-color.component.mjs +123 -0
  194. package/swatches/esm2020/swatches-group.component.mjs +64 -0
  195. package/swatches/esm2020/swatches.component.mjs +258 -0
  196. package/swatches/fesm2015/ngx-color-swatches.mjs +441 -0
  197. package/swatches/fesm2015/ngx-color-swatches.mjs.map +1 -0
  198. package/swatches/fesm2020/ngx-color-swatches.mjs +441 -0
  199. package/swatches/fesm2020/ngx-color-swatches.mjs.map +1 -0
  200. package/swatches/ngx-color-swatches.d.ts +2 -3
  201. package/swatches/package.json +19 -7
  202. package/swatches/public_api.d.ts +3 -0
  203. package/swatches/swatches-color.component.d.ts +3 -0
  204. package/swatches/swatches-group.component.d.ts +3 -0
  205. package/swatches/swatches.component.d.ts +10 -0
  206. package/twitter/{esm2015/ngx-color-twitter.js → esm2020/ngx-color-twitter.mjs} +2 -2
  207. package/twitter/esm2020/public_api.mjs +2 -0
  208. package/twitter/esm2020/twitter.component.mjs +255 -0
  209. package/twitter/fesm2015/ngx-color-twitter.mjs +262 -0
  210. package/twitter/fesm2015/ngx-color-twitter.mjs.map +1 -0
  211. package/twitter/fesm2020/ngx-color-twitter.mjs +262 -0
  212. package/twitter/fesm2020/ngx-color-twitter.mjs.map +1 -0
  213. package/twitter/ngx-color-twitter.d.ts +2 -1
  214. package/twitter/package.json +19 -7
  215. package/twitter/public_api.d.ts +1 -0
  216. package/twitter/twitter.component.d.ts +8 -0
  217. package/alpha/bundles/ngx-color-alpha.umd.js +0 -387
  218. package/alpha/bundles/ngx-color-alpha.umd.js.map +0 -1
  219. package/alpha/esm2015/alpha-picker.component.js +0 -72
  220. package/alpha/fesm2015/ngx-color-alpha.js +0 -79
  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 -455
  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 -139
  227. package/block/esm2015/ngx-color-block.js +0 -6
  228. package/block/fesm2015/ngx-color-block.js +0 -202
  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 -951
  232. package/bundles/ngx-color.umd.js.map +0 -1
  233. package/chrome/bundles/ngx-color-chrome.umd.js +0 -526
  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/chrome.component.js +0 -161
  237. package/chrome/esm2015/ngx-color-chrome.js +0 -6
  238. package/chrome/fesm2015/ngx-color-chrome.js +0 -420
  239. package/chrome/fesm2015/ngx-color-chrome.js.map +0 -1
  240. package/chrome/ngx-color-chrome.metadata.json +0 -1
  241. package/circle/bundles/ngx-color-circle.umd.js +0 -452
  242. package/circle/bundles/ngx-color-circle.umd.js.map +0 -1
  243. package/circle/esm2015/circle-swatch.component.js +0 -63
  244. package/circle/esm2015/circle.component.js +0 -97
  245. package/circle/esm2015/ngx-color-circle.js +0 -6
  246. package/circle/fesm2015/ngx-color-circle.js +0 -165
  247. package/circle/fesm2015/ngx-color-circle.js.map +0 -1
  248. package/circle/ngx-color-circle.metadata.json +0 -1
  249. package/compact/bundles/ngx-color-compact.umd.js +0 -562
  250. package/compact/bundles/ngx-color-compact.umd.js.map +0 -1
  251. package/compact/esm2015/compact-color.component.js +0 -70
  252. package/compact/esm2015/compact-fields.component.js +0 -142
  253. package/compact/esm2015/compact.component.js +0 -123
  254. package/compact/esm2015/ngx-color-compact.js +0 -7
  255. package/compact/fesm2015/ngx-color-compact.js +0 -336
  256. package/compact/fesm2015/ngx-color-compact.js.map +0 -1
  257. package/compact/ngx-color-compact.metadata.json +0 -1
  258. package/esm2015/alpha.component.js +0 -156
  259. package/esm2015/checkboard.component.js +0 -52
  260. package/esm2015/color-wrap.component.js +0 -82
  261. package/esm2015/coordinates.directive.js +0 -85
  262. package/esm2015/editable-input.component.js +0 -181
  263. package/esm2015/hue.component.js +0 -140
  264. package/esm2015/raised.component.js +0 -73
  265. package/esm2015/saturation.component.js +0 -111
  266. package/esm2015/shade.component.js +0 -127
  267. package/esm2015/swatch.component.js +0 -85
  268. package/fesm2015/ngx-color.js +0 -1164
  269. package/fesm2015/ngx-color.js.map +0 -1
  270. package/github/bundles/ngx-color-github.umd.js +0 -430
  271. package/github/bundles/ngx-color-github.umd.js.map +0 -1
  272. package/github/esm2015/github-swatch.component.js +0 -48
  273. package/github/esm2015/github.component.js +0 -134
  274. package/github/esm2015/ngx-color-github.js +0 -6
  275. package/github/fesm2015/ngx-color-github.js +0 -187
  276. package/github/fesm2015/ngx-color-github.js.map +0 -1
  277. package/github/ngx-color-github.metadata.json +0 -1
  278. package/hue/bundles/ngx-color-hue.umd.js +0 -390
  279. package/hue/bundles/ngx-color-hue.umd.js.map +0 -1
  280. package/hue/esm2015/hue-picker.component.js +0 -70
  281. package/hue/fesm2015/ngx-color-hue.js +0 -77
  282. package/hue/fesm2015/ngx-color-hue.js.map +0 -1
  283. package/hue/ngx-color-hue.metadata.json +0 -1
  284. package/material/bundles/ngx-color-material.umd.js +0 -438
  285. package/material/bundles/ngx-color-material.umd.js.map +0 -1
  286. package/material/esm2015/material.component.js +0 -149
  287. package/material/fesm2015/ngx-color-material.js +0 -156
  288. package/material/fesm2015/ngx-color-material.js.map +0 -1
  289. package/material/ngx-color-material.metadata.json +0 -1
  290. package/ngx-color.metadata.json +0 -1
  291. package/photoshop/bundles/ngx-color-photoshop.umd.js +0 -554
  292. package/photoshop/bundles/ngx-color-photoshop.umd.js.map +0 -1
  293. package/photoshop/esm2015/ngx-color-photoshop.js +0 -8
  294. package/photoshop/esm2015/photoshop-button.component.js +0 -50
  295. package/photoshop/esm2015/photoshop-fields.component.js +0 -180
  296. package/photoshop/esm2015/photoshop-previews.component.js +0 -53
  297. package/photoshop/esm2015/photoshop.component.js +0 -169
  298. package/photoshop/fesm2015/ngx-color-photoshop.js +0 -452
  299. package/photoshop/fesm2015/ngx-color-photoshop.js.map +0 -1
  300. package/photoshop/ngx-color-photoshop.metadata.json +0 -1
  301. package/shade/bundles/ngx-color-shade.umd.js +0 -382
  302. package/shade/bundles/ngx-color-shade.umd.js.map +0 -1
  303. package/shade/esm2015/shade-picker.component.js +0 -63
  304. package/shade/fesm2015/ngx-color-shade.js +0 -70
  305. package/shade/fesm2015/ngx-color-shade.js.map +0 -1
  306. package/shade/ngx-color-shade.metadata.json +0 -1
  307. package/sketch/bundles/ngx-color-sketch.umd.js +0 -568
  308. package/sketch/bundles/ngx-color-sketch.umd.js.map +0 -1
  309. package/sketch/esm2015/ngx-color-sketch.js +0 -7
  310. package/sketch/esm2015/sketch-fields.component.js +0 -181
  311. package/sketch/esm2015/sketch-preset-colors.component.js +0 -76
  312. package/sketch/esm2015/sketch.component.js +0 -191
  313. package/sketch/fesm2015/ngx-color-sketch.js +0 -450
  314. package/sketch/fesm2015/ngx-color-sketch.js.map +0 -1
  315. package/sketch/ngx-color-sketch.metadata.json +0 -1
  316. package/slider/bundles/ngx-color-slider.umd.js +0 -453
  317. package/slider/bundles/ngx-color-slider.umd.js.map +0 -1
  318. package/slider/esm2015/ngx-color-slider.js +0 -7
  319. package/slider/esm2015/slider-swatch.component.js +0 -65
  320. package/slider/esm2015/slider-swatches.component.js +0 -84
  321. package/slider/esm2015/slider.component.js +0 -69
  322. package/slider/fesm2015/ngx-color-slider.js +0 -221
  323. package/slider/fesm2015/ngx-color-slider.js.map +0 -1
  324. package/slider/ngx-color-slider.metadata.json +0 -1
  325. package/swatches/bundles/ngx-color-swatches.umd.js +0 -595
  326. package/swatches/bundles/ngx-color-swatches.umd.js.map +0 -1
  327. package/swatches/esm2015/ngx-color-swatches.js +0 -7
  328. package/swatches/esm2015/swatches-color.component.js +0 -90
  329. package/swatches/esm2015/swatches-group.component.js +0 -42
  330. package/swatches/esm2015/swatches.component.js +0 -205
  331. package/swatches/fesm2015/ngx-color-swatches.js +0 -339
  332. package/swatches/fesm2015/ngx-color-swatches.js.map +0 -1
  333. package/swatches/ngx-color-swatches.metadata.json +0 -1
  334. package/twitter/bundles/ngx-color-twitter.umd.js +0 -416
  335. package/twitter/bundles/ngx-color-twitter.umd.js.map +0 -1
  336. package/twitter/esm2015/twitter.component.js +0 -195
  337. package/twitter/fesm2015/ngx-color-twitter.js +0 -202
  338. package/twitter/fesm2015/ngx-color-twitter.js.map +0 -1
  339. package/twitter/ngx-color-twitter.metadata.json +0 -1
@@ -1,951 +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 EditableInputComponent = /** @class */ (function () {
420
- function EditableInputComponent() {
421
- this.placeholder = '';
422
- this.onChange = new core.EventEmitter();
423
- this.focus = false;
424
- }
425
- EditableInputComponent.prototype.ngOnInit = function () {
426
- this.wrapStyle = this.style && this.style.wrap ? this.style.wrap : {};
427
- this.inputStyle = this.style && this.style.input ? this.style.input : {};
428
- this.labelStyle = this.style && this.style.label ? this.style.label : {};
429
- if (this.dragLabel) {
430
- this.labelStyle.cursor = 'ew-resize';
431
- }
432
- };
433
- EditableInputComponent.prototype.handleFocus = function ($event) {
434
- this.focus = true;
435
- };
436
- EditableInputComponent.prototype.handleFocusOut = function ($event) {
437
- this.focus = false;
438
- this.currentValue = this.blurValue;
439
- };
440
- EditableInputComponent.prototype.handleKeydown = function ($event) {
441
- var _a, _b;
442
- // In case `e.target.value` is a percentage remove the `%` character
443
- // and update accordingly with a percentage
444
- // https://github.com/casesandberg/react-color/issues/383
445
- var stringValue = String($event.target.value);
446
- var isPercentage = stringValue.indexOf('%') > -1;
447
- var num = Number(stringValue.replace(/%/g, ''));
448
- if (isNaN(num)) {
449
- return;
450
- }
451
- var amount = this.arrowOffset || 1;
452
- // Up
453
- if ($event.keyCode === 38) {
454
- if (this.label) {
455
- this.onChange.emit({
456
- data: (_a = {}, _a[this.label] = num + amount, _a),
457
- $event: $event,
458
- });
459
- }
460
- else {
461
- this.onChange.emit({ data: num + amount, $event: $event });
462
- }
463
- if (isPercentage) {
464
- this.currentValue = num + amount + "%";
465
- }
466
- else {
467
- this.currentValue = num + amount;
468
- }
469
- }
470
- // Down
471
- if ($event.keyCode === 40) {
472
- if (this.label) {
473
- this.onChange.emit({
474
- data: (_b = {}, _b[this.label] = num - amount, _b),
475
- $event: $event,
476
- });
477
- }
478
- else {
479
- this.onChange.emit({ data: num - amount, $event: $event });
480
- }
481
- if (isPercentage) {
482
- this.currentValue = num - amount + "%";
483
- }
484
- else {
485
- this.currentValue = num - amount;
486
- }
487
- }
488
- };
489
- EditableInputComponent.prototype.handleKeyup = function ($event) {
490
- var _a;
491
- if ($event.keyCode === 40 || $event.keyCode === 38) {
492
- return;
493
- }
494
- if ("" + this.currentValue === $event.target.value) {
495
- return;
496
- }
497
- if (this.label) {
498
- this.onChange.emit({
499
- data: (_a = {}, _a[this.label] = $event.target.value, _a),
500
- $event: $event,
501
- });
502
- }
503
- else {
504
- this.onChange.emit({ data: $event.target.value, $event: $event });
505
- }
506
- };
507
- EditableInputComponent.prototype.ngOnChanges = function () {
508
- if (!this.focus) {
509
- this.currentValue = String(this.value).toUpperCase();
510
- this.blurValue = String(this.value).toUpperCase();
511
- }
512
- else {
513
- this.blurValue = String(this.value).toUpperCase();
514
- }
515
- };
516
- EditableInputComponent.prototype.ngOnDestroy = function () {
517
- this.unsubscribe();
518
- };
519
- EditableInputComponent.prototype.subscribe = function () {
520
- var _this = this;
521
- this.mousemove = rxjs.fromEvent(document, 'mousemove').subscribe(function (ev) { return _this.handleDrag(ev); });
522
- this.mouseup = rxjs.fromEvent(document, 'mouseup').subscribe(function () { return _this.unsubscribe(); });
523
- };
524
- EditableInputComponent.prototype.unsubscribe = function () {
525
- if (this.mousemove) {
526
- this.mousemove.unsubscribe();
527
- }
528
- if (this.mouseup) {
529
- this.mouseup.unsubscribe();
530
- }
531
- };
532
- EditableInputComponent.prototype.handleMousedown = function ($event) {
533
- if (this.dragLabel) {
534
- $event.preventDefault();
535
- this.handleDrag($event);
536
- this.subscribe();
537
- }
538
- };
539
- EditableInputComponent.prototype.handleDrag = function ($event) {
540
- var _a;
541
- if (this.dragLabel) {
542
- var newValue = Math.round(this.value + $event.movementX);
543
- if (newValue >= 0 && newValue <= this.dragMax) {
544
- this.onChange.emit({ data: (_a = {}, _a[this.label] = newValue, _a), $event: $event });
545
- }
546
- }
547
- };
548
- return EditableInputComponent;
549
- }());
550
- EditableInputComponent.decorators = [
551
- { type: core.Component, args: [{
552
- selector: 'color-editable-input',
553
- 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 aria-labelledby=\"colorEditableInputLabel\"\n />\n <span id=\"colorEditableInputLabel\" *ngIf=\"label\" [ngStyle]=\"labelStyle\" (mousedown)=\"handleMousedown($event)\">\n {{ label }}\n </span>\n </div>\n ",
554
- changeDetection: core.ChangeDetectionStrategy.OnPush,
555
- styles: ["\n :host {\n display: flex;\n }\n .wrap {\n position: relative;\n }\n "]
556
- },] }
557
- ];
558
- EditableInputComponent.propDecorators = {
559
- style: [{ type: core.Input }],
560
- label: [{ type: core.Input }],
561
- value: [{ type: core.Input }],
562
- arrowOffset: [{ type: core.Input }],
563
- dragLabel: [{ type: core.Input }],
564
- dragMax: [{ type: core.Input }],
565
- placeholder: [{ type: core.Input }],
566
- onChange: [{ type: core.Output }]
567
- };
568
- var EditableInputModule = /** @class */ (function () {
569
- function EditableInputModule() {
570
- }
571
- return EditableInputModule;
572
- }());
573
- EditableInputModule.decorators = [
574
- { type: core.NgModule, args: [{
575
- declarations: [EditableInputComponent],
576
- exports: [EditableInputComponent],
577
- imports: [common.CommonModule],
578
- },] }
579
- ];
580
-
581
- var HueComponent = /** @class */ (function () {
582
- function HueComponent() {
583
- this.hidePointer = false;
584
- this.direction = 'horizontal';
585
- this.onChange = new core.EventEmitter();
586
- this.left = '0px';
587
- this.top = '';
588
- }
589
- HueComponent.prototype.ngOnChanges = function () {
590
- if (this.direction === 'horizontal') {
591
- this.left = this.hsl.h * 100 / 360 + "%";
592
- }
593
- else {
594
- this.top = -(this.hsl.h * 100 / 360) + 100 + "%";
595
- }
596
- };
597
- HueComponent.prototype.handleChange = function (_a) {
598
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
599
- var data;
600
- if (this.direction === 'vertical') {
601
- var h = void 0;
602
- if (top < 0) {
603
- h = 359;
604
- }
605
- else if (top > containerHeight) {
606
- h = 0;
607
- }
608
- else {
609
- var percent = -(top * 100 / containerHeight) + 100;
610
- h = 360 * percent / 100;
611
- }
612
- if (this.hsl.h !== h) {
613
- data = {
614
- h: h,
615
- s: this.hsl.s,
616
- l: this.hsl.l,
617
- a: this.hsl.a,
618
- source: 'rgb',
619
- };
620
- }
621
- }
622
- else {
623
- var h = void 0;
624
- if (left < 0) {
625
- h = 0;
626
- }
627
- else if (left > containerWidth) {
628
- h = 359;
629
- }
630
- else {
631
- var percent = left * 100 / containerWidth;
632
- h = 360 * percent / 100;
633
- }
634
- if (this.hsl.h !== h) {
635
- data = {
636
- h: h,
637
- s: this.hsl.s,
638
- l: this.hsl.l,
639
- a: this.hsl.a,
640
- source: 'rgb',
641
- };
642
- }
643
- }
644
- if (!data) {
645
- return;
646
- }
647
- this.onChange.emit({ data: data, $event: $event });
648
- };
649
- return HueComponent;
650
- }());
651
- HueComponent.decorators = [
652
- { type: core.Component, args: [{
653
- selector: 'color-hue',
654
- 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 ",
655
- preserveWhitespaces: false,
656
- changeDetection: core.ChangeDetectionStrategy.OnPush,
657
- 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 "]
658
- },] }
659
- ];
660
- HueComponent.propDecorators = {
661
- hsl: [{ type: core.Input }],
662
- pointer: [{ type: core.Input }],
663
- radius: [{ type: core.Input }],
664
- shadow: [{ type: core.Input }],
665
- hidePointer: [{ type: core.Input }],
666
- direction: [{ type: core.Input }],
667
- onChange: [{ type: core.Output }]
668
- };
669
- var HueModule = /** @class */ (function () {
670
- function HueModule() {
671
- }
672
- return HueModule;
673
- }());
674
- HueModule.decorators = [
675
- { type: core.NgModule, args: [{
676
- declarations: [HueComponent],
677
- exports: [HueComponent],
678
- imports: [common.CommonModule, CoordinatesModule],
679
- },] }
680
- ];
681
-
682
- var RaisedComponent = /** @class */ (function () {
683
- function RaisedComponent() {
684
- this.zDepth = 1;
685
- this.radius = 1;
686
- this.background = '#fff';
687
- }
688
- return RaisedComponent;
689
- }());
690
- RaisedComponent.decorators = [
691
- { type: core.Component, args: [{
692
- selector: 'color-raised',
693
- 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 ",
694
- preserveWhitespaces: false,
695
- changeDetection: core.ChangeDetectionStrategy.OnPush,
696
- 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 "]
697
- },] }
698
- ];
699
- RaisedComponent.propDecorators = {
700
- zDepth: [{ type: core.Input }],
701
- radius: [{ type: core.Input }],
702
- background: [{ type: core.Input }]
703
- };
704
- var RaisedModule = /** @class */ (function () {
705
- function RaisedModule() {
706
- }
707
- return RaisedModule;
708
- }());
709
- RaisedModule.decorators = [
710
- { type: core.NgModule, args: [{
711
- declarations: [RaisedComponent],
712
- exports: [RaisedComponent],
713
- imports: [common.CommonModule],
714
- },] }
715
- ];
716
-
717
- var SaturationComponent = /** @class */ (function () {
718
- function SaturationComponent() {
719
- this.onChange = new core.EventEmitter();
720
- }
721
- SaturationComponent.prototype.ngOnChanges = function () {
722
- this.background = "hsl(" + this.hsl.h + ", 100%, 50%)";
723
- this.pointerTop = -(this.hsv.v * 100) + 1 + 100 + '%';
724
- this.pointerLeft = this.hsv.s * 100 + '%';
725
- };
726
- SaturationComponent.prototype.handleChange = function (_a) {
727
- var top = _a.top, left = _a.left, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth, $event = _a.$event;
728
- if (left < 0) {
729
- left = 0;
730
- }
731
- else if (left > containerWidth) {
732
- left = containerWidth;
733
- }
734
- else if (top < 0) {
735
- top = 0;
736
- }
737
- else if (top > containerHeight) {
738
- top = containerHeight;
739
- }
740
- var saturation = left / containerWidth;
741
- var bright = -(top / containerHeight) + 1;
742
- bright = bright > 0 ? bright : 0;
743
- bright = bright > 1 ? 1 : bright;
744
- var data = {
745
- h: this.hsl.h,
746
- s: saturation,
747
- v: bright,
748
- a: this.hsl.a,
749
- source: 'hsva',
750
- };
751
- this.onChange.emit({ data: data, $event: $event });
752
- };
753
- return SaturationComponent;
754
- }());
755
- SaturationComponent.decorators = [
756
- { type: core.Component, args: [{
757
- selector: 'color-saturation',
758
- 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 ",
759
- preserveWhitespaces: false,
760
- changeDetection: core.ChangeDetectionStrategy.OnPush,
761
- 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 "]
762
- },] }
763
- ];
764
- SaturationComponent.propDecorators = {
765
- hsl: [{ type: core.Input }],
766
- hsv: [{ type: core.Input }],
767
- radius: [{ type: core.Input }],
768
- pointer: [{ type: core.Input }],
769
- circle: [{ type: core.Input }],
770
- onChange: [{ type: core.Output }]
771
- };
772
- var SaturationModule = /** @class */ (function () {
773
- function SaturationModule() {
774
- }
775
- return SaturationModule;
776
- }());
777
- SaturationModule.decorators = [
778
- { type: core.NgModule, args: [{
779
- declarations: [SaturationComponent],
780
- exports: [SaturationComponent],
781
- imports: [common.CommonModule, CoordinatesModule],
782
- },] }
783
- ];
784
-
785
- var SwatchComponent = /** @class */ (function () {
786
- function SwatchComponent() {
787
- this.style = {};
788
- this.focusStyle = {};
789
- this.onClick = new core.EventEmitter();
790
- this.onHover = new core.EventEmitter();
791
- this.divStyles = {};
792
- this.focusStyles = {};
793
- this.inFocus = false;
794
- }
795
- SwatchComponent.prototype.ngOnInit = function () {
796
- this.divStyles = Object.assign({ background: this.color }, this.style);
797
- };
798
- SwatchComponent.prototype.currentStyles = function () {
799
- this.focusStyles = Object.assign(Object.assign({}, this.divStyles), this.focusStyle);
800
- return this.focus || this.inFocus ? this.focusStyles : this.divStyles;
801
- };
802
- SwatchComponent.prototype.handleFocusOut = function () {
803
- this.inFocus = false;
804
- };
805
- SwatchComponent.prototype.handleFocus = function () {
806
- this.inFocus = true;
807
- };
808
- SwatchComponent.prototype.handleHover = function (hex, $event) {
809
- this.onHover.emit({ hex: hex, $event: $event });
810
- };
811
- SwatchComponent.prototype.handleClick = function (hex, $event) {
812
- this.onClick.emit({ hex: hex, $event: $event });
813
- };
814
- return SwatchComponent;
815
- }());
816
- SwatchComponent.decorators = [
817
- { type: core.Component, args: [{
818
- selector: 'color-swatch',
819
- 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 ",
820
- changeDetection: core.ChangeDetectionStrategy.OnPush,
821
- styles: ["\n .swatch {\n outline: none;\n height: 100%;\n width: 100%;\n cursor: pointer;\n position: relative;\n }\n "]
822
- },] }
823
- ];
824
- SwatchComponent.propDecorators = {
825
- color: [{ type: core.Input }],
826
- style: [{ type: core.Input }],
827
- focusStyle: [{ type: core.Input }],
828
- focus: [{ type: core.Input }],
829
- onClick: [{ type: core.Output }],
830
- onHover: [{ type: core.Output }]
831
- };
832
- var SwatchModule = /** @class */ (function () {
833
- function SwatchModule() {
834
- }
835
- return SwatchModule;
836
- }());
837
- SwatchModule.decorators = [
838
- { type: core.NgModule, args: [{
839
- declarations: [SwatchComponent],
840
- exports: [SwatchComponent],
841
- imports: [common.CommonModule, CheckboardModule],
842
- },] }
843
- ];
844
-
845
- var ShadeComponent = /** @class */ (function () {
846
- function ShadeComponent() {
847
- this.onChange = new core.EventEmitter();
848
- }
849
- ShadeComponent.prototype.ngOnChanges = function () {
850
- this.gradient = {
851
- background: "linear-gradient(to right,\n hsl(" + this.hsl.h + ", 90%, 55%),\n #000)",
852
- };
853
- var hsv = new tinycolor.TinyColor(this.hsl).toHsv();
854
- this.pointerLeft = 100 - (hsv.v * 100);
855
- };
856
- ShadeComponent.prototype.handleChange = function (_a) {
857
- var left = _a.left, containerWidth = _a.containerWidth, $event = _a.$event;
858
- var data;
859
- var v;
860
- if (left < 0) {
861
- v = 0;
862
- }
863
- else if (left > containerWidth) {
864
- v = 1;
865
- }
866
- else {
867
- v = Math.round((left * 100) / containerWidth) / 100;
868
- }
869
- var hsv = new tinycolor.TinyColor(this.hsl).toHsv();
870
- if (hsv.v !== v) {
871
- data = {
872
- h: this.hsl.h,
873
- s: 100,
874
- v: 1 - v,
875
- l: this.hsl.l,
876
- a: this.hsl.a,
877
- source: 'rgb',
878
- };
879
- }
880
- if (!data) {
881
- return;
882
- }
883
- this.onChange.emit({ data: data, $event: $event });
884
- };
885
- return ShadeComponent;
886
- }());
887
- ShadeComponent.decorators = [
888
- { type: core.Component, args: [{
889
- selector: 'color-shade',
890
- 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 ",
891
- changeDetection: core.ChangeDetectionStrategy.OnPush,
892
- preserveWhitespaces: false,
893
- 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 "]
894
- },] }
895
- ];
896
- ShadeComponent.propDecorators = {
897
- hsl: [{ type: core.Input }],
898
- rgb: [{ type: core.Input }],
899
- pointer: [{ type: core.Input }],
900
- shadow: [{ type: core.Input }],
901
- radius: [{ type: core.Input }],
902
- onChange: [{ type: core.Output }]
903
- };
904
- var ShadeModule = /** @class */ (function () {
905
- function ShadeModule() {
906
- }
907
- return ShadeModule;
908
- }());
909
- ShadeModule.decorators = [
910
- { type: core.NgModule, args: [{
911
- declarations: [ShadeComponent],
912
- exports: [ShadeComponent],
913
- imports: [common.CommonModule, CoordinatesModule],
914
- },] }
915
- ];
916
-
917
- /**
918
- * Generated bundle index. Do not edit.
919
- */
920
-
921
- exports.AlphaComponent = AlphaComponent;
922
- exports.AlphaModule = AlphaModule;
923
- exports.CheckboardComponent = CheckboardComponent;
924
- exports.CheckboardModule = CheckboardModule;
925
- exports.ColorWrap = ColorWrap;
926
- exports.ColorWrapModule = ColorWrapModule;
927
- exports.CoordinatesDirective = CoordinatesDirective;
928
- exports.CoordinatesModule = CoordinatesModule;
929
- exports.EditableInputComponent = EditableInputComponent;
930
- exports.EditableInputModule = EditableInputModule;
931
- exports.HueComponent = HueComponent;
932
- exports.HueModule = HueModule;
933
- exports.RaisedComponent = RaisedComponent;
934
- exports.RaisedModule = RaisedModule;
935
- exports.SaturationComponent = SaturationComponent;
936
- exports.SaturationModule = SaturationModule;
937
- exports.ShadeComponent = ShadeComponent;
938
- exports.ShadeModule = ShadeModule;
939
- exports.SwatchComponent = SwatchComponent;
940
- exports.SwatchModule = SwatchModule;
941
- exports.getCheckerboard = getCheckerboard;
942
- exports.getContrastingColor = getContrastingColor;
943
- exports.isValidHex = isValidHex;
944
- exports.render = render;
945
- exports.simpleCheckForValidColor = simpleCheckForValidColor;
946
- exports.toState = toState;
947
-
948
- Object.defineProperty(exports, '__esModule', { value: true });
949
-
950
- })));
951
- //# sourceMappingURL=ngx-color.umd.js.map