ace-colorpicker-rpk 0.0.12

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 (238) hide show
  1. package/.babelrc +30 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. package/ChangeLogs.md +22 -0
  5. package/LICENSE +21 -0
  6. package/README.md +117 -0
  7. package/addon/ace-colorpicker.css +1074 -0
  8. package/addon/ace-colorpicker.js +9602 -0
  9. package/addon/sample/colorpicker.html +199 -0
  10. package/config/rollup.config.dev.js +52 -0
  11. package/config/rollup.config.prod.js +53 -0
  12. package/dist/ace-colorpicker.css +1074 -0
  13. package/dist/ace-colorpicker.js +9736 -0
  14. package/dist/ace-colorpicker.min.js +1 -0
  15. package/gl.html +56 -0
  16. package/index.html +172 -0
  17. package/package.json +87 -0
  18. package/resources/image/ace-editor.png +0 -0
  19. package/resources/image/colorpaletts.png +0 -0
  20. package/resources/image/colorpicker.png +0 -0
  21. package/resources/image/grapes.jpg +0 -0
  22. package/resources/image/palette-type.png +0 -0
  23. package/resources/image/scalecolors-title.png +0 -0
  24. package/resources/image/scalecolors.png +0 -0
  25. package/resources/image/screen-shot.png +0 -0
  26. package/resources/image/sketch-type.png +0 -0
  27. package/src/colorpicker/BaseBox.js +94 -0
  28. package/src/colorpicker/BaseColorPicker.js +404 -0
  29. package/src/colorpicker/BaseModule.js +19 -0
  30. package/src/colorpicker/BaseSlider.js +97 -0
  31. package/src/colorpicker/BaseStore.js +71 -0
  32. package/src/colorpicker/UIElement.js +46 -0
  33. package/src/colorpicker/VerticalSlider.js +57 -0
  34. package/src/colorpicker/chromedevtool/ColorControl.js +47 -0
  35. package/src/colorpicker/chromedevtool/index.js +36 -0
  36. package/src/colorpicker/index.js +37 -0
  37. package/src/colorpicker/macos/ColorControl.js +47 -0
  38. package/src/colorpicker/macos/index.js +38 -0
  39. package/src/colorpicker/mini/ColorControl.js +40 -0
  40. package/src/colorpicker/mini/index.js +24 -0
  41. package/src/colorpicker/mini-vertical/ColorControl.js +35 -0
  42. package/src/colorpicker/mini-vertical/index.js +23 -0
  43. package/src/colorpicker/module/ColorManager.js +111 -0
  44. package/src/colorpicker/module/ColorSetsList.js +132 -0
  45. package/src/colorpicker/ring/ColorControl.js +47 -0
  46. package/src/colorpicker/ring/index.js +42 -0
  47. package/src/colorpicker/ui/ColorInformation.js +216 -0
  48. package/src/colorpicker/ui/ColorPalette.js +130 -0
  49. package/src/colorpicker/ui/ColorRing.js +68 -0
  50. package/src/colorpicker/ui/ColorSetsChooser.js +96 -0
  51. package/src/colorpicker/ui/ColorWheel.js +257 -0
  52. package/src/colorpicker/ui/CurrentColorSets.js +81 -0
  53. package/src/colorpicker/ui/CurrentColorSetsContextMenu.js +63 -0
  54. package/src/colorpicker/ui/control/Hue.js +40 -0
  55. package/src/colorpicker/ui/control/Opacity.js +65 -0
  56. package/src/colorpicker/ui/control/Value.js +50 -0
  57. package/src/colorpicker/ui/control/VerticalHue.js +39 -0
  58. package/src/colorpicker/ui/control/VerticalOpacity.js +55 -0
  59. package/src/colorpicker/vscode/ColorControl.js +40 -0
  60. package/src/colorpicker/vscode/index.js +82 -0
  61. package/src/colorpicker/xd/ColorControl.js +36 -0
  62. package/src/colorpicker/xd/index.js +36 -0
  63. package/src/extension/ace/colorview.js +198 -0
  64. package/src/extension/ace/index.js +11 -0
  65. package/src/index.js +12 -0
  66. package/src/scss/colorpicker.scss +65 -0
  67. package/src/scss/colorview.scss +32 -0
  68. package/src/scss/component/button.scss +33 -0
  69. package/src/scss/component/colorchooser.scss +141 -0
  70. package/src/scss/component/colorsets-contextmenu.scss +33 -0
  71. package/src/scss/component/colorsets.scss +89 -0
  72. package/src/scss/component/control.scss +93 -0
  73. package/src/scss/component/gradient-editor.scss +260 -0
  74. package/src/scss/component/gradient-picker.scss +241 -0
  75. package/src/scss/component/information.scss +141 -0
  76. package/src/scss/component/palette.scss +45 -0
  77. package/src/scss/index.scss +5 -0
  78. package/src/scss/mixins.scss +21 -0
  79. package/src/scss/themes/macos.scss +71 -0
  80. package/src/scss/themes/mini-vertical.scss +94 -0
  81. package/src/scss/themes/mini.scss +76 -0
  82. package/src/scss/themes/palette.scss +85 -0
  83. package/src/scss/themes/ring.scss +57 -0
  84. package/src/scss/themes/sketch.scss +172 -0
  85. package/src/scss/themes/vscode.scss +93 -0
  86. package/src/scss/themes/xd.scss +88 -0
  87. package/src/util/Blender.js +29 -0
  88. package/src/util/Canvas.js +128 -0
  89. package/src/util/Color.js +27 -0
  90. package/src/util/ColorNames.js +14 -0
  91. package/src/util/Dom.js +361 -0
  92. package/src/util/Event.js +30 -0
  93. package/src/util/EventMachin.js +349 -0
  94. package/src/util/GL.js +8 -0
  95. package/src/util/HueColor.js +49 -0
  96. package/src/util/ImageFilter.js +9 -0
  97. package/src/util/ImageLoader.js +137 -0
  98. package/src/util/Kmeans.js +237 -0
  99. package/src/util/Matrix.js +196 -0
  100. package/src/util/State.js +42 -0
  101. package/src/util/blend/composite.js +124 -0
  102. package/src/util/blend/non-separable.js +118 -0
  103. package/src/util/blend/separable.js +76 -0
  104. package/src/util/filter/StackBlur.js +517 -0
  105. package/src/util/filter/functions.js +829 -0
  106. package/src/util/filter/image/crop.js +16 -0
  107. package/src/util/filter/image/flipH.js +23 -0
  108. package/src/util/filter/image/flipV.js +25 -0
  109. package/src/util/filter/image/histogram.js +45 -0
  110. package/src/util/filter/image/index.js +18 -0
  111. package/src/util/filter/image/resize.js +18 -0
  112. package/src/util/filter/image/rotate.js +39 -0
  113. package/src/util/filter/image/rotateDegree.js +53 -0
  114. package/src/util/filter/index.js +11 -0
  115. package/src/util/filter/matrix/blur.js +12 -0
  116. package/src/util/filter/matrix/emboss.js +17 -0
  117. package/src/util/filter/matrix/gaussian-blur-5x.js +17 -0
  118. package/src/util/filter/matrix/gaussian-blur.js +16 -0
  119. package/src/util/filter/matrix/grayscale2.js +16 -0
  120. package/src/util/filter/matrix/index.js +58 -0
  121. package/src/util/filter/matrix/kirsch-horizontal.js +13 -0
  122. package/src/util/filter/matrix/kirsch-vertical.js +13 -0
  123. package/src/util/filter/matrix/laplacian-5x.js +16 -0
  124. package/src/util/filter/matrix/laplacian.js +14 -0
  125. package/src/util/filter/matrix/motion-blur-2.js +18 -0
  126. package/src/util/filter/matrix/motion-blur-3.js +19 -0
  127. package/src/util/filter/matrix/motion-blur.js +18 -0
  128. package/src/util/filter/matrix/negative.js +16 -0
  129. package/src/util/filter/matrix/normal.js +11 -0
  130. package/src/util/filter/matrix/sepia2.js +16 -0
  131. package/src/util/filter/matrix/sharpen.js +14 -0
  132. package/src/util/filter/matrix/sobel-horizontal.js +11 -0
  133. package/src/util/filter/matrix/sobel-vertical.js +11 -0
  134. package/src/util/filter/matrix/stack-blur.js +15 -0
  135. package/src/util/filter/matrix/transparency.js +16 -0
  136. package/src/util/filter/matrix/unsharp-masking.js +16 -0
  137. package/src/util/filter/multi/index.js +9 -0
  138. package/src/util/filter/multi/kirsch.js +7 -0
  139. package/src/util/filter/multi/sobel.js +7 -0
  140. package/src/util/filter/multi/vintage.js +7 -0
  141. package/src/util/filter/pixel/bitonal.js +24 -0
  142. package/src/util/filter/pixel/brightness.js +19 -0
  143. package/src/util/filter/pixel/brownie.js +23 -0
  144. package/src/util/filter/pixel/clip.js +21 -0
  145. package/src/util/filter/pixel/contrast.js +18 -0
  146. package/src/util/filter/pixel/gamma.js +13 -0
  147. package/src/util/filter/pixel/gradient.js +52 -0
  148. package/src/util/filter/pixel/grayscale.js +27 -0
  149. package/src/util/filter/pixel/hue.js +28 -0
  150. package/src/util/filter/pixel/index.js +52 -0
  151. package/src/util/filter/pixel/invert.js +16 -0
  152. package/src/util/filter/pixel/kodachrome.js +23 -0
  153. package/src/util/filter/pixel/matrix.js +28 -0
  154. package/src/util/filter/pixel/noise.js +24 -0
  155. package/src/util/filter/pixel/opacity.js +14 -0
  156. package/src/util/filter/pixel/polaroid.js +23 -0
  157. package/src/util/filter/pixel/saturation.js +30 -0
  158. package/src/util/filter/pixel/sepia.js +28 -0
  159. package/src/util/filter/pixel/shade.js +21 -0
  160. package/src/util/filter/pixel/shift.js +23 -0
  161. package/src/util/filter/pixel/solarize.js +23 -0
  162. package/src/util/filter/pixel/technicolor.js +23 -0
  163. package/src/util/filter/pixel/threshold-color.js +35 -0
  164. package/src/util/filter/pixel/threshold.js +7 -0
  165. package/src/util/filter/pixel/tint.js +20 -0
  166. package/src/util/functions/formatter.js +99 -0
  167. package/src/util/functions/fromCMYK.js +17 -0
  168. package/src/util/functions/fromHSL.js +52 -0
  169. package/src/util/functions/fromHSV.js +64 -0
  170. package/src/util/functions/fromLAB.js +99 -0
  171. package/src/util/functions/fromRGB.js +220 -0
  172. package/src/util/functions/fromYCrCb.js +16 -0
  173. package/src/util/functions/func.js +194 -0
  174. package/src/util/functions/image.js +145 -0
  175. package/src/util/functions/math.js +56 -0
  176. package/src/util/functions/mixin.js +164 -0
  177. package/src/util/functions/parser.js +294 -0
  178. package/src/util/gl/filter/index.js +9 -0
  179. package/src/util/gl/filter/matrix/blur.js +9 -0
  180. package/src/util/gl/filter/matrix/emboss.js +17 -0
  181. package/src/util/gl/filter/matrix/gaussian-blur-5x.js +15 -0
  182. package/src/util/gl/filter/matrix/gaussian-blur.js +19 -0
  183. package/src/util/gl/filter/matrix/grayscale2.js +13 -0
  184. package/src/util/gl/filter/matrix/index.js +55 -0
  185. package/src/util/gl/filter/matrix/kirsch-horizontal.js +11 -0
  186. package/src/util/gl/filter/matrix/kirsch-vertical.js +11 -0
  187. package/src/util/gl/filter/matrix/laplacian-5x.js +13 -0
  188. package/src/util/gl/filter/matrix/laplacian.js +11 -0
  189. package/src/util/gl/filter/matrix/motion-blur-2.js +17 -0
  190. package/src/util/gl/filter/matrix/motion-blur-3.js +17 -0
  191. package/src/util/gl/filter/matrix/motion-blur.js +17 -0
  192. package/src/util/gl/filter/matrix/negative.js +13 -0
  193. package/src/util/gl/filter/matrix/normal.js +8 -0
  194. package/src/util/gl/filter/matrix/sepia2.js +13 -0
  195. package/src/util/gl/filter/matrix/sharpen.js +11 -0
  196. package/src/util/gl/filter/matrix/sobel-horizontal.js +11 -0
  197. package/src/util/gl/filter/matrix/sobel-vertical.js +11 -0
  198. package/src/util/gl/filter/matrix/transparency.js +13 -0
  199. package/src/util/gl/filter/matrix/unsharp-masking.js +14 -0
  200. package/src/util/gl/filter/multi/index.js +9 -0
  201. package/src/util/gl/filter/multi/kirsch.js +7 -0
  202. package/src/util/gl/filter/multi/sobel.js +7 -0
  203. package/src/util/gl/filter/multi/vintage.js +7 -0
  204. package/src/util/gl/filter/pixel/bitonal.js +22 -0
  205. package/src/util/gl/filter/pixel/brightness.js +14 -0
  206. package/src/util/gl/filter/pixel/brownie.js +11 -0
  207. package/src/util/gl/filter/pixel/chaos.js +20 -0
  208. package/src/util/gl/filter/pixel/clip.js +20 -0
  209. package/src/util/gl/filter/pixel/contrast.js +16 -0
  210. package/src/util/gl/filter/pixel/gamma.js +16 -0
  211. package/src/util/gl/filter/pixel/gradient.js +59 -0
  212. package/src/util/gl/filter/pixel/grayscale.js +22 -0
  213. package/src/util/gl/filter/pixel/hue.js +19 -0
  214. package/src/util/gl/filter/pixel/index.js +54 -0
  215. package/src/util/gl/filter/pixel/invert.js +18 -0
  216. package/src/util/gl/filter/pixel/kodachrome.js +11 -0
  217. package/src/util/gl/filter/pixel/matrix.js +29 -0
  218. package/src/util/gl/filter/pixel/noise.js +18 -0
  219. package/src/util/gl/filter/pixel/opacity.js +17 -0
  220. package/src/util/gl/filter/pixel/polaroid.js +11 -0
  221. package/src/util/gl/filter/pixel/saturation.js +20 -0
  222. package/src/util/gl/filter/pixel/sepia.js +19 -0
  223. package/src/util/gl/filter/pixel/shade.js +20 -0
  224. package/src/util/gl/filter/pixel/shift.js +11 -0
  225. package/src/util/gl/filter/pixel/solarize.js +21 -0
  226. package/src/util/gl/filter/pixel/technicolor.js +11 -0
  227. package/src/util/gl/filter/pixel/threshold-color.js +15 -0
  228. package/src/util/gl/filter/pixel/threshold.js +7 -0
  229. package/src/util/gl/filter/pixel/tint.js +25 -0
  230. package/src/util/gl/filter/util.js +185 -0
  231. package/src/util/gl/functions.js +158 -0
  232. package/src/util/gl/index.js +543 -0
  233. package/src/util/index.js +17 -0
  234. package/stand.html +975 -0
  235. package/test/util.Blend.spec.js +15 -0
  236. package/test/util.Color.spec.js +200 -0
  237. package/test/util.Filter.spec.js +12 -0
  238. package/test/util.ImageFilter.spec.js +16 -0
@@ -0,0 +1,47 @@
1
+ import Hue from '../ui/control/Hue';
2
+ import Opacity from '../ui/control/Opacity'
3
+ import UIElement from '../UIElement';
4
+
5
+ const source = 'chromedevtool-control';
6
+
7
+ export default class ColorControl extends UIElement {
8
+
9
+ components () {
10
+ return { Hue, Opacity }
11
+ }
12
+
13
+ template () {
14
+ return `
15
+ <div class="control">
16
+ <div target="Hue" ></div>
17
+ <div target="Opacity" ></div>
18
+ <div ref="$controlPattern" class="empty"></div>
19
+ <div ref="$controlColor" class="color"></div>
20
+ </div>
21
+ `
22
+ }
23
+
24
+ setBackgroundColor () {
25
+ this.refs.$controlColor.css("background-color", this.$store.dispatch('/toRGB'));
26
+ }
27
+
28
+ refresh () {
29
+ this.setColorUI();
30
+ this.setBackgroundColor()
31
+ }
32
+
33
+ setColorUI() {
34
+ this.Hue.setColorUI()
35
+ this.Opacity.setColorUI()
36
+ }
37
+
38
+ '@changeColor' (sourceType) {
39
+ if (source != sourceType) {
40
+ this.refresh()
41
+ }
42
+ }
43
+
44
+ '@initColor' () { this.refresh() }
45
+
46
+ }
47
+
@@ -0,0 +1,36 @@
1
+ import BaseColorPicker from '../BaseColorPicker'
2
+
3
+ import ColorControl from './ColorControl'
4
+ import ColorInformation from '../ui/ColorInformation'
5
+ import ColorPalette from '../ui/ColorPalette'
6
+ import ColorSetsChooser from '../ui/ColorSetsChooser'
7
+ import CurrentColorSets from '../ui/CurrentColorSets'
8
+ import CurrentColorSetsContextMenu from '../ui/CurrentColorSetsContextMenu'
9
+
10
+ export default class ChromeDevToolColorPicker extends BaseColorPicker {
11
+
12
+ template () {
13
+ return `
14
+ <div class='colorpicker-body'>
15
+ <div target="palette"></div>
16
+ <div target="control"></div>
17
+ <div target="information"></div>
18
+ <div target="currentColorSets"></div>
19
+ <div target="colorSetsChooser"></div>
20
+ <div target="contextMenu"></div>
21
+ </div>
22
+ `
23
+ }
24
+
25
+ components() {
26
+ return {
27
+ palette: ColorPalette,
28
+ control: ColorControl,
29
+ information: ColorInformation,
30
+ currentColorSets: CurrentColorSets,
31
+ colorSetsChooser: ColorSetsChooser,
32
+ contextMenu: CurrentColorSetsContextMenu
33
+ }
34
+ }
35
+
36
+ }
@@ -0,0 +1,37 @@
1
+ import MacOSColorPicker from './macos/index'
2
+ import ChromeDevToolColorPicker from './chromedevtool/index'
3
+ import MiniColorPicker from './mini/index'
4
+ import MiniVerticalColorPicker from './mini-vertical/index'
5
+ import RingColorPicker from './ring/index'
6
+ import XDColorPicker from './xd/index'
7
+ import VSCodePicker from './vscode/index'
8
+
9
+ export default {
10
+ create (opts) {
11
+ switch(opts.type) {
12
+ case 'macos':
13
+ return new MacOSColorPicker(opts);
14
+ case 'xd':
15
+ return new XDColorPicker(opts);
16
+ case 'ring':
17
+ return new RingColorPicker(opts);
18
+ case 'mini':
19
+ return new MiniColorPicker(opts);
20
+ case 'vscode':
21
+ return new VSCodePicker(opts);
22
+ case 'mini-vertical':
23
+ return new MiniVerticalColorPicker(opts);
24
+ case 'sketch':
25
+ case 'palette':
26
+ default:
27
+ return new ChromeDevToolColorPicker(opts);
28
+ }
29
+ },
30
+ ColorPicker: ChromeDevToolColorPicker,
31
+ ChromeDevToolColorPicker,
32
+ MacOSColorPicker,
33
+ RingColorPicker,
34
+ MiniColorPicker,
35
+ VSCodePicker,
36
+ MiniVerticalColorPicker
37
+ }
@@ -0,0 +1,47 @@
1
+ import Value from '../ui/control/Value';
2
+ import UIElement from '../UIElement';
3
+ import Opacity from '../ui/control/Opacity'
4
+
5
+ const source = 'macos-control';
6
+
7
+ export default class ColorControl extends UIElement {
8
+
9
+ components () {
10
+ return { Value, Opacity }
11
+ }
12
+
13
+ template () {
14
+ return `
15
+ <div class="control">
16
+ <div target="Value" ></div>
17
+ <div target="Opacity" ></div>
18
+ <div ref="$controlPattern" class="empty"></div>
19
+ <div ref="$controlColor" class="color"></div>
20
+ </div>
21
+ `
22
+ }
23
+
24
+ setBackgroundColor () {
25
+ this.refs.$controlColor.css("background-color", this.$store.dispatch('/toRGB'));
26
+ }
27
+
28
+ refresh () {
29
+ this.setColorUI();
30
+ this.setBackgroundColor()
31
+ }
32
+
33
+ setColorUI() {
34
+ this.Value.setColorUI()
35
+ this.Opacity.setColorUI()
36
+ }
37
+
38
+ '@changeColor' (sourceType) {
39
+ if (source != sourceType) {
40
+ this.refresh()
41
+ }
42
+ }
43
+
44
+ '@initColor' () { this.refresh() }
45
+
46
+ }
47
+
@@ -0,0 +1,38 @@
1
+ import BaseColorPicker from '../BaseColorPicker'
2
+
3
+ import ColorControl from './ColorControl'
4
+
5
+ import ColorWheel from '../ui/ColorWheel'
6
+ import ColorInformation from '../ui/ColorInformation'
7
+ import ColorSetsChooser from '../ui/ColorSetsChooser'
8
+ import CurrentColorSets from '../ui/CurrentColorSets'
9
+ import CurrentColorSetsContextMenu from '../ui/CurrentColorSetsContextMenu'
10
+
11
+ export default class MacOSColorPicker extends BaseColorPicker {
12
+
13
+ template () {
14
+ return `
15
+ <div class='colorpicker-body'>
16
+ <div target="colorwheel"></div>
17
+ <div target="control"></div>
18
+ <div target="information"></div>
19
+ <div target="currentColorSets"></div>
20
+ <div target="colorSetsChooser"></div>
21
+ <div target="contextMenu"></div>
22
+ </div>
23
+ `
24
+ }
25
+
26
+ components() {
27
+ return {
28
+ colorwheel: ColorWheel,
29
+ control: ColorControl,
30
+ information: ColorInformation,
31
+ currentColorSets: CurrentColorSets,
32
+ colorSetsChooser: ColorSetsChooser,
33
+ contextMenu: CurrentColorSetsContextMenu
34
+ }
35
+ }
36
+
37
+
38
+ }
@@ -0,0 +1,40 @@
1
+ import Hue from '../ui/control/Hue';
2
+ import Opacity from '../ui/control/Opacity'
3
+ import UIElement from '../UIElement';
4
+
5
+ const source = 'mini-control';
6
+
7
+ export default class ColorControl extends UIElement {
8
+
9
+ components () {
10
+ return { Hue, Opacity }
11
+ }
12
+
13
+ template () {
14
+ return `
15
+ <div class="control">
16
+ <div target="Hue" ></div>
17
+ <div target="Opacity" ></div>
18
+ </div>
19
+ `
20
+ }
21
+
22
+ refresh () {
23
+ this.setColorUI();
24
+ }
25
+
26
+ setColorUI() {
27
+ this.Hue.setColorUI()
28
+ this.Opacity.setColorUI()
29
+ }
30
+
31
+ '@changeColor' (sourceType) {
32
+ if (source != sourceType) {
33
+ this.refresh()
34
+ }
35
+ }
36
+
37
+ '@initColor' () { this.refresh() }
38
+
39
+ }
40
+
@@ -0,0 +1,24 @@
1
+ import BaseColorPicker from '../BaseColorPicker'
2
+
3
+ import ColorControl from './ColorControl'
4
+ import ColorPalette from '../ui/ColorPalette'
5
+
6
+ export default class MiniColorPicker extends BaseColorPicker {
7
+
8
+ template () {
9
+ return `
10
+ <div class='colorpicker-body'>
11
+ <div target="palette"></div>
12
+ <div target="control"></div>
13
+ </div>
14
+ `
15
+ }
16
+
17
+ components() {
18
+ return {
19
+ palette: ColorPalette,
20
+ control: ColorControl
21
+ }
22
+ }
23
+
24
+ }
@@ -0,0 +1,35 @@
1
+ import Hue from '../ui/control/VerticalHue';
2
+ import Opacity from '../ui/control/VerticalOpacity'
3
+ import UIElement from '../UIElement';
4
+
5
+ const source = 'mini-control';
6
+
7
+ export default class ColorControl extends UIElement {
8
+
9
+ components () {
10
+ return { Hue, Opacity }
11
+ }
12
+
13
+ template () {
14
+ return `<div class="control"><div target="Hue" ></div><div target="Opacity" ></div></div>`
15
+ }
16
+
17
+ refresh () {
18
+ this.setColorUI();
19
+ }
20
+
21
+ setColorUI() {
22
+ this.Hue.setColorUI()
23
+ this.Opacity.setColorUI()
24
+ }
25
+
26
+ '@changeColor' (sourceType) {
27
+ if (source != sourceType) {
28
+ this.refresh()
29
+ }
30
+ }
31
+
32
+ '@initColor' () { this.refresh() }
33
+
34
+ }
35
+
@@ -0,0 +1,23 @@
1
+ import BaseColorPicker from '../BaseColorPicker'
2
+
3
+ import ColorControl from './ColorControl'
4
+ import ColorPalette from '../ui/ColorPalette'
5
+
6
+ export default class MiniColorPicker extends BaseColorPicker {
7
+
8
+ template () {
9
+ return `
10
+ <div class='colorpicker-body'>
11
+ <div target="palette"></div><div target="control"></div>
12
+ </div>
13
+ `
14
+ }
15
+
16
+ components() {
17
+ return {
18
+ palette: ColorPalette,
19
+ control: ColorControl
20
+ }
21
+ }
22
+
23
+ }
@@ -0,0 +1,111 @@
1
+ import Color from '../../util/Color'
2
+ import HueColor from '../../util/HueColor'
3
+ import BaseModule from '../BaseModule';
4
+
5
+
6
+ function isUndefined (v) {
7
+ return typeof v == 'undefined' || v == null;
8
+ }
9
+
10
+ export default class ColorManager extends BaseModule {
11
+
12
+ initialize () {
13
+ super.initialize()
14
+
15
+ this.$store.rgb = {}
16
+ this.$store.hsl = {}
17
+ this.$store.hsv = {}
18
+ this.$store.alpha = 1
19
+ this.$store.format = 'hex'
20
+
21
+ // this.$store.dispatch('/changeColor');
22
+ }
23
+
24
+ '/changeFormat' ($store, format) {
25
+ $store.format = format;
26
+
27
+ $store.emit('changeFormat');
28
+ }
29
+
30
+ '/initColor' ($store, colorObj, source) {
31
+ $store.dispatch('/changeColor', colorObj, source, true);
32
+ $store.emit('initColor')
33
+ }
34
+
35
+ '/changeColor' ($store, colorObj, source, isNotEmit) {
36
+
37
+ colorObj = colorObj || '#FF0000'
38
+
39
+ if (typeof colorObj == 'string') {
40
+ colorObj = Color.parse(colorObj);
41
+ }
42
+
43
+ colorObj.source = colorObj.source || source
44
+
45
+ $store.alpha = isUndefined(colorObj.a) ? $store.alpha : colorObj.a;
46
+ $store.format = colorObj.type != 'hsv' ? (colorObj.type || $store.format) : $store.format;
47
+
48
+ if (colorObj.type == 'hsl') {
49
+ $store.hsl = Object.assign($store.hsl, colorObj);
50
+ $store.rgb = Color.HSLtoRGB($store.hsl);
51
+ $store.hsv = Color.HSLtoHSV(colorObj);
52
+ } else if (colorObj.type == 'hex') {
53
+ $store.rgb = Object.assign($store.rgb, colorObj);
54
+ $store.hsl = Color.RGBtoHSL($store.rgb);
55
+ $store.hsv = Color.RGBtoHSV(colorObj);
56
+ } else if (colorObj.type == 'rgb') {
57
+ $store.rgb = Object.assign($store.rgb, colorObj);
58
+ $store.hsl = Color.RGBtoHSL($store.rgb);
59
+ $store.hsv = Color.RGBtoHSV(colorObj);
60
+ } else if (colorObj.type == 'hsv') {
61
+ $store.hsv = Object.assign($store.hsv, colorObj);
62
+ $store.rgb = Color.HSVtoRGB($store.hsv);
63
+ $store.hsl = Color.HSVtoHSL($store.hsv);
64
+ }
65
+
66
+ if (!isNotEmit) {
67
+ $store.emit('changeColor', colorObj.source);
68
+ }
69
+
70
+ }
71
+
72
+ '/getHueColor' ($store) {
73
+ return HueColor.checkHueColor($store.hsv.h/360);
74
+ }
75
+
76
+ '/toString' ($store, type) {
77
+ type = type || $store.format
78
+ var colorObj = $store[type] || $store.rgb
79
+ return Color.format({
80
+ ...colorObj,
81
+ a: $store.alpha
82
+ }, type);
83
+ }
84
+
85
+ '/toColor' ($store, type) {
86
+ type = type || $store.format;
87
+
88
+ if (type == 'rgb') {
89
+ return $store.dispatch('/toRGB')
90
+ } else if (type == 'hsl') {
91
+ return $store.dispatch('/toHSL')
92
+ } else if (type == 'hex') {
93
+ return $store.dispatch('/toHEX')
94
+ }
95
+
96
+ return $store.dispatch('/toString', type);
97
+ }
98
+
99
+ '/toRGB' ($store) {
100
+ return $store.dispatch('/toString', 'rgb')
101
+ }
102
+
103
+ '/toHSL' ($store) {
104
+ return $store.dispatch('/toString', 'hsl')
105
+ }
106
+
107
+ '/toHEX' ($store) {
108
+ return $store.dispatch('/toString', 'hex').toUpperCase()
109
+ }
110
+
111
+ }
@@ -0,0 +1,132 @@
1
+ import Color from '../../util/Color'
2
+ import BaseModule from '../BaseModule';
3
+
4
+ export default class ColorSetsList extends BaseModule {
5
+ initialize () {
6
+ super.initialize();
7
+
8
+ // set property
9
+ this.$store.colorSetsList = [
10
+ { name : "Material",
11
+ colors: [
12
+ '#F44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5',
13
+ '#2196F3', '#03A9F4', '#00BCD4', '#009688', '#4CAF50',
14
+ '#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800',
15
+ '#FF5722', '#795548', '#9E9E9E', '#607D8B'
16
+ ]
17
+ },
18
+ { name : "Custom", "edit" : true, "colors" : [] },
19
+ { name: "Color Scale", "scale" : ['red', 'yellow', 'black' ], count : 5 }
20
+ ]
21
+ this.$store.currentColorSets = {}
22
+ }
23
+
24
+ '/list' ($store) {
25
+ return Array.isArray($store.userList) && $store.userList.length ? $store.userList : $store.colorSetsList;
26
+ }
27
+
28
+ '/setUserPalette' ($store, list) {
29
+ $store.userList = list;
30
+
31
+ $store.dispatch('/resetUserPalette');
32
+ $store.dispatch('/setCurrentColorSets');
33
+ }
34
+
35
+ '/resetUserPalette' ($store) {
36
+ if ($store.userList && $store.userList.length) {
37
+ $store.userList = $store.userList.map( (element, index) => {
38
+
39
+ if (typeof element.colors == 'function') {
40
+ const makeCallback = element.colors;
41
+
42
+ element.colors = makeCallback($store);
43
+ element._colors = makeCallback;
44
+ }
45
+
46
+ return Object.assign({
47
+ name: `color-${index}`,
48
+ colors : []
49
+ }, element)
50
+ })
51
+
52
+ $store.emit('changeUserList');
53
+ }
54
+ }
55
+
56
+ '/setCurrentColorSets' ($store, nameOrIndex) {
57
+
58
+ const _list = $store.dispatch('/list');
59
+
60
+ if (typeof nameOrIndex == 'undefined') {
61
+ $store.currentColorSets = _list[0];
62
+ } else if (typeof nameOrIndex == 'number') {
63
+ $store.currentColorSets = _list[nameOrIndex];
64
+ } else {
65
+ $store.currentColorSets = _list.filter(function (obj) {
66
+ return obj.name == nameOrIndex;
67
+ })[0];
68
+ }
69
+
70
+ $store.emit('changeCurrentColorSets');
71
+ }
72
+
73
+ '/getCurrentColorSets' ($store) {
74
+ return $store.currentColorSets;
75
+ }
76
+
77
+ '/addCurrentColor' ($store, color) {
78
+ if (Array.isArray($store.currentColorSets.colors)) {
79
+ $store.currentColorSets.colors.push(color);
80
+ $store.emit('changeCurrentColorSets');
81
+ }
82
+ }
83
+
84
+ '/setCurrentColorAll' ($store, colors = []) {
85
+ $store.currentColorSets.colors = colors;
86
+ $store.emit('changeCurrentColorSets');
87
+ }
88
+
89
+ '/removeCurrentColor' ($store, index) {
90
+ if ($store.currentColorSets.colors[index]) {
91
+ $store.currentColorSets.colors.splice(index, 1);
92
+ $store.emit('changeCurrentColorSets');
93
+ }
94
+ }
95
+
96
+ '/removeCurrentColorToTheRight' ($store, index) {
97
+ if ($store.currentColorSets.colors[index]) {
98
+ $store.currentColorSets.colors.splice(index, Number.MAX_VALUE);
99
+ $store.emit('changeCurrentColorSets');
100
+ }
101
+ }
102
+
103
+ '/clearPalette' ($store) {
104
+ if ($store.currentColorSets.colors) {
105
+ $store.currentColorSets.colors = [];
106
+ $store.emit('changeCurrentColorSets');
107
+ }
108
+ }
109
+
110
+ '/getCurrentColors' ($store ) {
111
+ return $store.dispatch('/getColors', $store.currentColorSets);
112
+ }
113
+
114
+ '/getColors' ($store, element) {
115
+ if (element.scale) {
116
+ return Color.scale(element.scale, element.count);
117
+ }
118
+
119
+ return element.colors || [];
120
+ }
121
+
122
+ '/getColorSetsList' ($store) {
123
+ return $store.dispatch('/list').map(element => {
124
+ return {
125
+ name : element.name,
126
+ edit : element.edit,
127
+ colors : $store.dispatch('/getColors', element)
128
+ }
129
+ });
130
+ }
131
+
132
+ }
@@ -0,0 +1,47 @@
1
+ import Value from '../ui/control/Value';
2
+ import UIElement from '../UIElement';
3
+ import Opacity from '../ui/control/Opacity'
4
+
5
+ const source = 'macos-control';
6
+
7
+ export default class ColorControl extends UIElement {
8
+
9
+ components () {
10
+ return { Value, Opacity }
11
+ }
12
+
13
+ template () {
14
+ return `
15
+ <div class="control">
16
+ <div target="Value" ></div>
17
+ <div target="Opacity" ></div>
18
+ <div ref="$controlPattern" class="empty"></div>
19
+ <div ref="$controlColor" class="color"></div>
20
+ </div>
21
+ `
22
+ }
23
+
24
+ setBackgroundColor () {
25
+ this.refs.$controlColor.css("background-color", this.$store.dispatch('/toRGB'));
26
+ }
27
+
28
+ refresh () {
29
+ this.setColorUI();
30
+ this.setBackgroundColor()
31
+ }
32
+
33
+ setColorUI() {
34
+ this.Value.setColorUI()
35
+ this.Opacity.setColorUI()
36
+ }
37
+
38
+ '@changeColor' (sourceType) {
39
+ if (source != sourceType) {
40
+ this.refresh()
41
+ }
42
+ }
43
+
44
+ '@initColor' () { this.refresh() }
45
+
46
+ }
47
+
@@ -0,0 +1,42 @@
1
+ import BaseColorPicker from '../BaseColorPicker'
2
+
3
+ import ColorControl from './ColorControl'
4
+
5
+ // import ColorWheel from '../ui/ColorWheel'
6
+ import ColorInformation from '../ui/ColorInformation'
7
+ import ColorSetsChooser from '../ui/ColorSetsChooser'
8
+ import CurrentColorSets from '../ui/CurrentColorSets'
9
+ import CurrentColorSetsContextMenu from '../ui/CurrentColorSetsContextMenu'
10
+ import ColorRing from '../ui/ColorRing';
11
+ import ColorPalette from '../ui/ColorPalette';
12
+
13
+ export default class RingColorPicker extends BaseColorPicker {
14
+
15
+ template () {
16
+ return `
17
+ <div class='colorpicker-body'>
18
+ <div target="colorring"></div>
19
+ <div target="palette"></div>
20
+ <div target="control"></div>
21
+ <div target="information"></div>
22
+ <div target="currentColorSets"></div>
23
+ <div target="colorSetsChooser"></div>
24
+ <div target="contextMenu"></div>
25
+ </div>
26
+ `
27
+ }
28
+
29
+ components() {
30
+ return {
31
+ colorring: ColorRing,
32
+ palette: ColorPalette,
33
+ control: ColorControl,
34
+ information: ColorInformation,
35
+ currentColorSets: CurrentColorSets,
36
+ colorSetsChooser: ColorSetsChooser,
37
+ contextMenu: CurrentColorSetsContextMenu
38
+ }
39
+ }
40
+
41
+
42
+ }