x4js 1.5.18 → 1.5.20

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 (242) hide show
  1. package/lib/{README.md → README.txt} +0 -0
  2. package/lib/cjs/index.js +39 -103
  3. package/lib/cjs/index.js.map +7 -0
  4. package/lib/esm/index.mjs +39 -87
  5. package/lib/esm/index.mjs.map +7 -0
  6. package/lib/{license.md → licence.md} +0 -0
  7. package/lib/src/MIT-license.md +14 -0
  8. package/lib/{types/action.d.ts → src/action.ts} +64 -33
  9. package/lib/src/alpha.jpg +0 -0
  10. package/lib/src/app_sockets.ts +81 -0
  11. package/lib/src/application.ts +251 -0
  12. package/lib/src/autocomplete.ts +197 -0
  13. package/lib/src/base64.ts +166 -0
  14. package/lib/src/base_component.ts +152 -0
  15. package/lib/src/button.ts +355 -0
  16. package/lib/src/calendar.ts +328 -0
  17. package/lib/src/canvas.ts +505 -0
  18. package/lib/src/cardview.ts +227 -0
  19. package/lib/src/checkbox.ts +188 -0
  20. package/lib/src/color.ts +752 -0
  21. package/lib/src/colorpicker.ts +1639 -0
  22. package/lib/src/combobox.ts +465 -0
  23. package/lib/src/component.ts +2329 -0
  24. package/lib/{esm/dom_events.js → src/copyright.txt} +27 -29
  25. package/lib/src/datastore.ts +1322 -0
  26. package/lib/src/dialog.ts +656 -0
  27. package/lib/src/dom_events.ts +315 -0
  28. package/lib/src/drag_manager.ts +199 -0
  29. package/lib/src/drawtext.ts +355 -0
  30. package/lib/src/fileupload.ts +213 -0
  31. package/lib/src/form.ts +375 -0
  32. package/lib/src/formatters.ts +105 -0
  33. package/lib/src/gridview.ts +1185 -0
  34. package/lib/src/i18n.ts +346 -0
  35. package/lib/src/icon.ts +335 -0
  36. package/lib/src/image.ts +204 -0
  37. package/lib/src/index.ts +89 -0
  38. package/lib/src/input.ts +249 -0
  39. package/lib/src/label.ts +128 -0
  40. package/lib/src/layout.ts +430 -0
  41. package/lib/src/link.ts +86 -0
  42. package/lib/src/listview.ts +765 -0
  43. package/lib/{esm/md5.js → src/md5.ts} +438 -403
  44. package/lib/src/menu.ts +425 -0
  45. package/lib/src/messagebox.ts +224 -0
  46. package/lib/src/panel.ts +86 -0
  47. package/lib/src/popup.ts +494 -0
  48. package/lib/src/property_editor.ts +337 -0
  49. package/lib/src/radiobtn.ts +197 -0
  50. package/lib/src/rating.ts +135 -0
  51. package/lib/src/request.ts +300 -0
  52. package/lib/src/router.ts +185 -0
  53. package/lib/src/settings.ts +77 -0
  54. package/lib/src/sidebarview.ts +103 -0
  55. package/lib/src/spreadsheet.ts +1449 -0
  56. package/lib/src/styles.ts +343 -0
  57. package/lib/src/svgcomponent.ts +577 -0
  58. package/lib/src/tabbar.ts +151 -0
  59. package/lib/src/tabview.ts +110 -0
  60. package/lib/src/textarea.ts +235 -0
  61. package/lib/src/textedit.ts +544 -0
  62. package/lib/src/toaster.ts +80 -0
  63. package/lib/src/tools.ts +1473 -0
  64. package/lib/src/tooltips.ts +191 -0
  65. package/lib/src/treeview.ts +716 -0
  66. package/lib/{esm/version.js → src/version.ts} +30 -29
  67. package/lib/{styles → src}/x4.less +0 -0
  68. package/lib/src/x4dom.ts +57 -0
  69. package/lib/src/x4events.ts +585 -0
  70. package/lib/src/x4react.ts +90 -0
  71. package/package.json +52 -46
  72. package/lib/cjs/action.js +0 -58
  73. package/lib/cjs/app_sockets.js +0 -74
  74. package/lib/cjs/application.js +0 -182
  75. package/lib/cjs/autocomplete.js +0 -155
  76. package/lib/cjs/base_component.js +0 -124
  77. package/lib/cjs/button.js +0 -263
  78. package/lib/cjs/calendar.js +0 -254
  79. package/lib/cjs/canvas.js +0 -361
  80. package/lib/cjs/cardview.js +0 -161
  81. package/lib/cjs/checkbox.js +0 -139
  82. package/lib/cjs/color.js +0 -591
  83. package/lib/cjs/colorpicker.js +0 -1468
  84. package/lib/cjs/combobox.js +0 -349
  85. package/lib/cjs/component.js +0 -1719
  86. package/lib/cjs/datastore.js +0 -985
  87. package/lib/cjs/dialog.js +0 -478
  88. package/lib/cjs/dom_events.js +0 -30
  89. package/lib/cjs/drag_manager.js +0 -145
  90. package/lib/cjs/drawtext.js +0 -276
  91. package/lib/cjs/fileupload.js +0 -167
  92. package/lib/cjs/form.js +0 -304
  93. package/lib/cjs/formatters.js +0 -90
  94. package/lib/cjs/gridview.js +0 -881
  95. package/lib/cjs/i18n.js +0 -266
  96. package/lib/cjs/icon.js +0 -272
  97. package/lib/cjs/image.js +0 -157
  98. package/lib/cjs/input.js +0 -174
  99. package/lib/cjs/label.js +0 -95
  100. package/lib/cjs/layout.js +0 -322
  101. package/lib/cjs/link.js +0 -64
  102. package/lib/cjs/listview.js +0 -546
  103. package/lib/cjs/md5.js +0 -403
  104. package/lib/cjs/menu.js +0 -301
  105. package/lib/cjs/messagebox.js +0 -177
  106. package/lib/cjs/panel.js +0 -68
  107. package/lib/cjs/popup.js +0 -383
  108. package/lib/cjs/property_editor.js +0 -252
  109. package/lib/cjs/radiobtn.js +0 -140
  110. package/lib/cjs/rating.js +0 -102
  111. package/lib/cjs/request.js +0 -246
  112. package/lib/cjs/router.js +0 -139
  113. package/lib/cjs/settings.js +0 -69
  114. package/lib/cjs/sidebarview.js +0 -82
  115. package/lib/cjs/spreadsheet.js +0 -1084
  116. package/lib/cjs/styles.js +0 -275
  117. package/lib/cjs/svgcomponent.js +0 -447
  118. package/lib/cjs/tabbar.js +0 -111
  119. package/lib/cjs/tabview.js +0 -85
  120. package/lib/cjs/textarea.js +0 -165
  121. package/lib/cjs/textedit.js +0 -415
  122. package/lib/cjs/toaster.js +0 -64
  123. package/lib/cjs/tools.js +0 -1197
  124. package/lib/cjs/tooltips.js +0 -157
  125. package/lib/cjs/treeview.js +0 -535
  126. package/lib/cjs/version.js +0 -32
  127. package/lib/cjs/x4dom.js +0 -32
  128. package/lib/cjs/x4events.js +0 -384
  129. package/lib/cjs/x4react.js +0 -72
  130. package/lib/esm/action.js +0 -53
  131. package/lib/esm/app_sockets.js +0 -70
  132. package/lib/esm/application.js +0 -184
  133. package/lib/esm/autocomplete.js +0 -155
  134. package/lib/esm/base_component.js +0 -107
  135. package/lib/esm/button.js +0 -257
  136. package/lib/esm/calendar.js +0 -249
  137. package/lib/esm/canvas.js +0 -358
  138. package/lib/esm/cardview.js +0 -159
  139. package/lib/esm/checkbox.js +0 -134
  140. package/lib/esm/color.js +0 -588
  141. package/lib/esm/colorpicker.js +0 -1475
  142. package/lib/esm/combobox.js +0 -351
  143. package/lib/esm/component.js +0 -1711
  144. package/lib/esm/datastore.js +0 -990
  145. package/lib/esm/dialog.js +0 -490
  146. package/lib/esm/drag_manager.js +0 -147
  147. package/lib/esm/drawtext.js +0 -271
  148. package/lib/esm/fileupload.js +0 -163
  149. package/lib/esm/form.js +0 -304
  150. package/lib/esm/formatters.js +0 -81
  151. package/lib/esm/gridview.js +0 -889
  152. package/lib/esm/i18n.js +0 -257
  153. package/lib/esm/icon.js +0 -261
  154. package/lib/esm/image.js +0 -154
  155. package/lib/esm/input.js +0 -182
  156. package/lib/esm/label.js +0 -90
  157. package/lib/esm/layout.js +0 -310
  158. package/lib/esm/link.js +0 -59
  159. package/lib/esm/listview.js +0 -534
  160. package/lib/esm/menu.js +0 -300
  161. package/lib/esm/messagebox.js +0 -161
  162. package/lib/esm/panel.js +0 -65
  163. package/lib/esm/popup.js +0 -379
  164. package/lib/esm/property_editor.js +0 -251
  165. package/lib/esm/radiobtn.js +0 -136
  166. package/lib/esm/rating.js +0 -97
  167. package/lib/esm/request.js +0 -224
  168. package/lib/esm/router.js +0 -136
  169. package/lib/esm/settings.js +0 -66
  170. package/lib/esm/sidebarview.js +0 -79
  171. package/lib/esm/spreadsheet.js +0 -1097
  172. package/lib/esm/styles.js +0 -270
  173. package/lib/esm/svgcomponent.js +0 -450
  174. package/lib/esm/tabbar.js +0 -107
  175. package/lib/esm/tabview.js +0 -83
  176. package/lib/esm/textarea.js +0 -160
  177. package/lib/esm/textedit.js +0 -412
  178. package/lib/esm/toaster.js +0 -62
  179. package/lib/esm/tools.js +0 -1158
  180. package/lib/esm/tooltips.js +0 -153
  181. package/lib/esm/treeview.js +0 -527
  182. package/lib/esm/x4dom.js +0 -29
  183. package/lib/esm/x4events.js +0 -376
  184. package/lib/esm/x4react.js +0 -71
  185. package/lib/types/app_sockets.d.ts +0 -29
  186. package/lib/types/application.d.ts +0 -104
  187. package/lib/types/autocomplete.d.ts +0 -58
  188. package/lib/types/base_component.d.ts +0 -88
  189. package/lib/types/button.d.ts +0 -151
  190. package/lib/types/calendar.d.ts +0 -82
  191. package/lib/types/canvas.d.ts +0 -92
  192. package/lib/types/cardview.d.ts +0 -87
  193. package/lib/types/checkbox.d.ts +0 -77
  194. package/lib/types/color.d.ts +0 -148
  195. package/lib/types/colorpicker.d.ts +0 -107
  196. package/lib/types/combobox.d.ts +0 -107
  197. package/lib/types/component.d.ts +0 -601
  198. package/lib/types/datastore.d.ts +0 -396
  199. package/lib/types/dialog.d.ts +0 -175
  200. package/lib/types/dom_events.d.ts +0 -302
  201. package/lib/types/drag_manager.d.ts +0 -54
  202. package/lib/types/drawtext.d.ts +0 -48
  203. package/lib/types/fileupload.d.ts +0 -64
  204. package/lib/types/form.d.ts +0 -133
  205. package/lib/types/formatters.d.ts +0 -35
  206. package/lib/types/gridview.d.ts +0 -175
  207. package/lib/types/i18n.d.ts +0 -73
  208. package/lib/types/icon.d.ts +0 -64
  209. package/lib/types/image.d.ts +0 -55
  210. package/lib/types/index.d.ts +0 -84
  211. package/lib/types/input.d.ts +0 -91
  212. package/lib/types/label.d.ts +0 -58
  213. package/lib/types/layout.d.ts +0 -87
  214. package/lib/types/link.d.ts +0 -50
  215. package/lib/types/listview.d.ts +0 -178
  216. package/lib/types/md5.d.ts +0 -61
  217. package/lib/types/menu.d.ts +0 -130
  218. package/lib/types/messagebox.d.ts +0 -69
  219. package/lib/types/panel.d.ts +0 -47
  220. package/lib/types/popup.d.ts +0 -75
  221. package/lib/types/property_editor.d.ts +0 -71
  222. package/lib/types/radiobtn.d.ts +0 -73
  223. package/lib/types/rating.d.ts +0 -53
  224. package/lib/types/request.d.ts +0 -52
  225. package/lib/types/router.d.ts +0 -42
  226. package/lib/types/settings.d.ts +0 -37
  227. package/lib/types/sidebarview.d.ts +0 -49
  228. package/lib/types/spreadsheet.d.ts +0 -222
  229. package/lib/types/styles.d.ts +0 -85
  230. package/lib/types/svgcomponent.d.ts +0 -215
  231. package/lib/types/tabbar.d.ts +0 -58
  232. package/lib/types/tabview.d.ts +0 -49
  233. package/lib/types/textarea.d.ts +0 -77
  234. package/lib/types/textedit.d.ts +0 -123
  235. package/lib/types/toaster.d.ts +0 -42
  236. package/lib/types/tools.d.ts +0 -394
  237. package/lib/types/tooltips.d.ts +0 -46
  238. package/lib/types/treeview.d.ts +0 -144
  239. package/lib/types/version.d.ts +0 -29
  240. package/lib/types/x4dom.d.ts +0 -49
  241. package/lib/types/x4events.d.ts +0 -269
  242. package/lib/types/x4react.d.ts +0 -41
@@ -0,0 +1,1639 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file colorpicker.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * Copyright (c) 2019-2022 R-libre ingenierie
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
17
+ * of the Software, and to permit persons to whom the Software is furnished to do so,
18
+ * subject to the following conditions:
19
+ * The above copyright notice and this permission notice shall be included in all copies
20
+ * or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ **/
29
+
30
+ /**
31
+ * ARGH this code is awfull
32
+ */
33
+
34
+
35
+ import { Container, Component, ContainerProps, ContainerEventMap } from './component'
36
+ import { CheckBox } from './checkbox'
37
+ import { Dialog, DialogBoxEventMap, DialogProps } from './dialog'
38
+ import { EvChange, EventCallback } from './x4events'
39
+ import { VLayout, HLayout } from './layout'
40
+ import { Label } from './label'
41
+ import { Color } from './color'
42
+ import { isString, getMousePos, clamp, classNames } from './tools'
43
+ import { TextEdit } from './textedit'
44
+ import { Menu, MenuItem } from './menu'
45
+
46
+ interface ColorPickerEventMap extends ContainerEventMap {
47
+ change: EvChange;
48
+ }
49
+
50
+ export interface ColorPickerProps extends ContainerProps<ColorPickerEventMap> {
51
+ color: Color;
52
+ hasAlpha?: boolean;
53
+ }
54
+
55
+ const pal_colors = {
56
+ blue: [0x0e5a8a, 0x106ba3, 0x137cbd, 0x2b95d6, 0x48aff0,],
57
+ green: [0x0a6640, 0x0d8050, 0x0f9960, 0x15b371, 0x3dcc91,],
58
+ orange: [0xa66321, 0xbf7326, 0xd9822b, 0xf29d49, 0xffb366,],
59
+ red: [0xa82a2a, 0xc23030, 0xdb3737, 0xf55656, 0xff7373,],
60
+ vermilion: [0x9e2b0e, 0xb83211, 0xd13913, 0xeb532d, 0xff6e4a,],
61
+ rose: [0xa82255, 0xc22762, 0xdb2c6f, 0xf5498b, 0xff66a1,],
62
+ violet: [0x5c255c, 0x752f75, 0x8f398f, 0xa854a8, 0xc274c2,],
63
+ indigo: [0x5642a6, 0x634dbf, 0x7157d9, 0x9179f2, 0xad99ff,],
64
+ cobalt: [0x1f4b99, 0x2458b3, 0x2965cc, 0x4580e6, 0x669eff,],
65
+ turquoise: [0x008075, 0x00998c, 0x00b3a4, 0x14ccbd, 0x2ee6d6,],
66
+ forest: [0x1d7324, 0x238c2c, 0x29a634, 0x43bf4d, 0x62d96b,],
67
+ lime: [0x728c23, 0x87a629, 0x9bbf30, 0xb6d94c, 0xd1f26d,],
68
+ gold: [0xa67908, 0xbf8c0a, 0xd99e0b, 0xf2b824, 0xffc940,],
69
+ sepia: [0x63411e, 0x7d5125, 0x96622d, 0xb07b46, 0xc99765,],
70
+ bw: [0x000000, 0x444444, 0x666666, 0xcccccc, 0xffffff,],
71
+ };
72
+
73
+
74
+
75
+ export class ColorPicker extends Container<ColorPickerProps, ColorPickerEventMap> {
76
+
77
+ private m_colorSel: Component;
78
+ private m_colorHue: Component;
79
+ private m_colorAlpha: Component;
80
+ private m_sample: Component;
81
+ private m_selMark: Component;
82
+ private m_hueMark: Component;
83
+ private m_alphaMark: Component;
84
+
85
+ private m_baseHSV: { h: number, s: number, v: number, a: number };
86
+ private m_baseColor: Color;
87
+ private m_transpCk: CheckBox;
88
+ private m_colorEdit: TextEdit;
89
+
90
+ private m_palmode: boolean;
91
+
92
+ static last_palmode = false;
93
+
94
+ constructor(props: ColorPickerProps) {
95
+ super(props);
96
+ this.m_palmode = ColorPicker.last_palmode;
97
+ this.setDomEvent('contextmenu', (e) => this._showCtx(e));
98
+ }
99
+
100
+ private _showCtx(e: UIEvent) {
101
+ const menu = new Menu({
102
+ items: [
103
+ new MenuItem({
104
+ text: 'Palette', checked: this.m_palmode, click: () => {
105
+ this.m_palmode = !this.m_palmode;
106
+ ColorPicker.last_palmode = this.m_palmode;
107
+ this.update();
108
+ }
109
+ })
110
+ ]
111
+ })
112
+
113
+ let pt = getMousePos(e, true);
114
+ menu.displayAt(pt.x, pt.y);
115
+ }
116
+
117
+ render(props: ColorPickerProps) {
118
+
119
+ this.m_baseColor = props.color;
120
+ this.m_baseHSV = Color.toHSV(this.m_baseColor);
121
+
122
+ if (this.m_palmode) {
123
+
124
+ this.addClass("pal-mode");
125
+
126
+ let selector = null;
127
+ let cur = null;
128
+
129
+ let main_sel = [];
130
+ let sub_sel = [];
131
+
132
+ const ccolor = this.m_baseColor.value();
133
+
134
+ materialColors.forEach(mc => {
135
+ const color = mc.variations[4].hex;
136
+
137
+ let selected = color === ccolor;
138
+ if( !selected ) {
139
+ selected = mc.variations.some( c => {
140
+ const cc = new Color(c.hex).value();
141
+ if( cc===ccolor ) {
142
+ return true;
143
+ }
144
+ });
145
+ }
146
+
147
+ let cls = classNames('clr-box xbox', { selected });
148
+ let el = new Component({
149
+ cls,
150
+ style: { backgroundColor: new Color(color).toHex() },
151
+ data: { color, main: mc.variations }
152
+ });
153
+
154
+ if( selected ) {
155
+ fillSubs( mc.variations );
156
+ }
157
+
158
+ main_sel.push(el);
159
+ });
160
+
161
+ function fillSubs( colors ) {
162
+ sub_sel = [];
163
+ colors.forEach(mc => {
164
+ let clr = new Color(mc.hex);
165
+ const selected = clr.value() == ccolor;
166
+
167
+ let cls = classNames('hclr-box xbox', { selected });
168
+
169
+ let el = new Component({
170
+ cls,
171
+ style: { backgroundColor: clr.toHex(), color: Color.contrastColor(clr).toHex() },
172
+ data: { color: clr.value() } ,
173
+ content: clr.toHex()
174
+ });
175
+
176
+ sub_sel.push(el);
177
+
178
+ if( selected ) {
179
+ cur = el;
180
+ }
181
+ });
182
+
183
+ if( selector ) {
184
+ selector.itemWithId('vsel').setContent( sub_sel );
185
+ }
186
+ }
187
+
188
+ selector = new VLayout({
189
+ content: [
190
+ new HLayout({
191
+ id: 'hsel',
192
+ content: main_sel
193
+ }),
194
+ new VLayout({
195
+ id: 'vsel',
196
+ flex: 1,
197
+ content: sub_sel
198
+ })
199
+ ]
200
+ });
201
+
202
+
203
+ /*
204
+ let cur = null;
205
+ const buildCol = ( colors: number[] ) => {
206
+
207
+ const ccolor = this.m_baseColor.value();
208
+ const els = colors.map( x => {
209
+ const selected = x==ccolor;
210
+
211
+ let cls = classNames( 'clr-box', { selected } );
212
+ let el = new Component( { cls, style: { backgroundColor: new Color(x).toHex() }, data: { color: x } } );
213
+
214
+ if( selected ) {
215
+ cur = el;
216
+ }
217
+ return el;
218
+ });
219
+
220
+ return new VLayout( {
221
+ cls: 'vcol',
222
+ content: els
223
+ });
224
+ }
225
+
226
+ let rows = new HLayout( {
227
+ cls: 'hcol',
228
+ content: [
229
+ buildCol( pal_colors.blue ),
230
+ buildCol( pal_colors.green ),
231
+ buildCol( pal_colors.orange ),
232
+ buildCol( pal_colors.red ),
233
+ buildCol( pal_colors.vermilion ),
234
+ buildCol( pal_colors.rose ),
235
+ buildCol( pal_colors.violet ),
236
+ buildCol( pal_colors.indigo ),
237
+ buildCol( pal_colors.cobalt ),
238
+ buildCol( pal_colors.turquoise ),
239
+ buildCol( pal_colors.forest ),
240
+ buildCol( pal_colors.lime ),
241
+ buildCol( pal_colors.gold ),
242
+ buildCol( pal_colors.sepia ),
243
+ buildCol( pal_colors.bw ),
244
+ ]
245
+ });
246
+ */
247
+
248
+
249
+ this.m_colorEdit = new TextEdit({
250
+ cls: 'hexv',
251
+ value: '',
252
+ attrs: {
253
+ spellcheck: false,
254
+ },
255
+ change: (ev) => {
256
+ const clr = new Color(ev.value);
257
+ if (clr) {
258
+ this.m_baseColor = clr;
259
+ this.m_baseHSV = Color.toHSV(clr);
260
+ this._updateColor(false);
261
+ }
262
+ }
263
+ });
264
+
265
+ this.m_transpCk = new CheckBox({
266
+ cls: 'transp',
267
+ text: 'transparent',
268
+ change: (ev) => {
269
+ this.m_baseHSV.a = ev.value ? 0 : 1;
270
+ this._updateColor();
271
+ }
272
+ });
273
+
274
+ this.setContent([selector, this.m_transpCk, this.m_colorEdit]);
275
+
276
+ // globally handle click
277
+
278
+ selector.setDomEvent('click', (ev) => {
279
+
280
+ if (cur) {
281
+ cur.removeClass('selected');
282
+ cur = null;
283
+ }
284
+
285
+ let cell = Component.getElement(ev.target as HTMLElement, 'xbox');
286
+ if (cell) {
287
+ const subs = cell.getData('main');
288
+ if( subs ) {
289
+ fillSubs( subs );
290
+ }
291
+ else {
292
+ const clr = new Color(cell.getData('color'));
293
+ this.m_baseColor = clr;
294
+ this.m_baseHSV = Color.toHSV(clr);
295
+ this._updateColor();
296
+
297
+ cur = cell;
298
+ cell.addClass('selected');
299
+ }
300
+ }
301
+
302
+ });
303
+ }
304
+ else {
305
+ this.removeClass("pal-mode");
306
+
307
+ this.m_selMark = new Component({ cls: 'marker' });
308
+ this.m_colorSel = new Component({
309
+ cls: 'sel',
310
+ content: [
311
+ new Component({ cls: '@fit light' }),
312
+ new Component({ cls: '@fit dark' }),
313
+ this.m_selMark,
314
+ ]
315
+ });
316
+
317
+ this.m_hueMark = new Component({ cls: 'marker' });
318
+ this.m_colorHue = new Component({
319
+ cls: 'hue',
320
+ content: [
321
+ this.m_hueMark
322
+ ]
323
+ });
324
+ this.m_sample = new Component({ cls: 'sample' });
325
+
326
+ if (props.hasAlpha) {
327
+ this.addClass('with-alpha');
328
+ this.m_alphaMark = new Component({ cls: 'marker' });
329
+ this.m_colorAlpha = new Component({
330
+ cls: 'alpha',
331
+ content: [
332
+ new Component({ cls: 'bk @fit', ref: 'color' }),
333
+ this.m_alphaMark
334
+ ]
335
+ });
336
+ }
337
+ else {
338
+ this.removeClass('with-alpha');
339
+ this.m_transpCk = new CheckBox({
340
+ cls: 'transp',
341
+ text: 'transparent',
342
+ change: (ev) => {
343
+ this.m_baseHSV.a = ev.value ? 0 : 1;
344
+ this._updateColor();
345
+ }
346
+ });
347
+ }
348
+
349
+ this.m_colorEdit = new TextEdit({
350
+ cls: 'hexv',
351
+ value: '',
352
+ attrs: {
353
+ spellcheck: false,
354
+ },
355
+ change: (ev) => {
356
+ const clr = new Color(ev.value);
357
+ if (clr) {
358
+ this.m_baseColor = clr;
359
+ this.m_baseHSV = Color.toHSV(clr);
360
+ this._updateColor(false);
361
+ }
362
+ }
363
+ });
364
+
365
+ this.setContent([
366
+ this.m_colorSel,
367
+ this.m_colorHue,
368
+ this.m_colorAlpha,
369
+ this.m_transpCk,
370
+ this.m_colorEdit,
371
+ this.m_sample,
372
+ ]);
373
+
374
+ this.m_colorSel.setDomEvent('mousedown', (ev: MouseEvent) => {
375
+ Component.setCapture(this, (e) => this._selChange(e));
376
+ });
377
+
378
+ this.m_colorHue.setDomEvent('mousedown', (ev: MouseEvent) => {
379
+ Component.setCapture(this, (e) => this._hueChange(e));
380
+ });
381
+
382
+ if (props.hasAlpha) {
383
+ this.m_colorAlpha.setDomEvent('mousedown', (ev: MouseEvent) => {
384
+ Component.setCapture(this, (e) => this._alphaChange(e));
385
+ });
386
+ }
387
+
388
+ this._updateColor();
389
+ }
390
+ }
391
+
392
+ set color(clr: Color) {
393
+ this.m_baseColor = clr;
394
+ this.m_baseHSV = Color.toHSV(this.m_baseColor);
395
+
396
+ this._updateColor();
397
+ }
398
+
399
+ get color() {
400
+ return this.m_baseColor;
401
+ }
402
+
403
+ private _selChange(ev: UIEvent) {
404
+ let pt = getMousePos(ev, true);
405
+ console.log(pt);
406
+ let rc = this.m_colorSel.getBoundingRect();
407
+
408
+ if (!this.m_props.hasAlpha) {
409
+ this.m_baseHSV.a = 1;
410
+ }
411
+
412
+ this.m_baseHSV.s = clamp((pt.x - rc.left) / rc.width, 0, 1);
413
+ this.m_baseHSV.v = 1 - clamp((pt.y - rc.top) / rc.height, 0, 1);
414
+ this._updateColor();
415
+
416
+ if (ev.type == 'mouseup' || ev.type == 'touchend') {
417
+ Component.releaseCapture();
418
+ }
419
+ }
420
+
421
+ private _hueChange(ev: UIEvent) {
422
+ let pt = getMousePos(ev, true);
423
+ let rc = this.m_colorHue.getBoundingRect();
424
+
425
+ this.m_baseHSV.h = clamp((pt.y - rc.top) / rc.height, 0, 1);
426
+ this._updateColor();
427
+
428
+ if (ev.type == 'mouseup' || ev.type == 'touchend') {
429
+ Component.releaseCapture();
430
+ }
431
+ }
432
+
433
+ private _alphaChange(ev: UIEvent) {
434
+ let pt = getMousePos(ev, true);
435
+ let rc = this.m_colorAlpha.getBoundingRect();
436
+
437
+ this.m_baseHSV.a = clamp((pt.x - rc.left) / rc.width, 0, 1);
438
+ this._updateColor();
439
+
440
+ if (ev.type == 'mouseup' || ev.type == 'touchend') {
441
+ Component.releaseCapture();
442
+ }
443
+ }
444
+
445
+ private _updateColor(edit = true) {
446
+
447
+ let color: Color;
448
+
449
+ if (!this.m_palmode) {
450
+
451
+ color = Color.fromHSV(this.m_baseHSV.h, 1, 1, 1);
452
+ this.m_colorSel.setStyleValue('backgroundColor', color.toString());
453
+
454
+ color = Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, 1);
455
+ this.m_sample.setStyleValue('backgroundColor', color.toString());
456
+
457
+ if (this.m_props.hasAlpha) {
458
+ let gradient = `linear-gradient(to right, rgba(0,0,0,0) 0%, ${color.toString()} 100%)`;
459
+ this.m_colorAlpha.itemWithRef<Component>('color').setStyleValue('backgroundImage', gradient);
460
+ }
461
+
462
+ this.m_selMark.setStyle({
463
+ left: (this.m_baseHSV.s * 100) + '%',
464
+ top: (100 - this.m_baseHSV.v * 100) + '%',
465
+ });
466
+
467
+ this.m_hueMark.setStyle({
468
+ top: (this.m_baseHSV.h * 100) + '%',
469
+ });
470
+
471
+ if (this.m_props.hasAlpha) {
472
+ this.m_alphaMark.setStyle({
473
+ left: (this.m_baseHSV.a * 100) + '%',
474
+ });
475
+ }
476
+ else {
477
+ this.m_transpCk.check = this.m_baseHSV.a == 0;
478
+ }
479
+ }
480
+ else {
481
+ this.m_transpCk.check = this.m_baseHSV.a == 0;
482
+ }
483
+
484
+ color = Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, this.m_baseHSV.a);
485
+ this.m_baseColor = color;
486
+
487
+ if (edit) {
488
+ this.m_colorEdit.value = color.alpha() == 1 ? color.toHex() : color.toString() //color.toHex();
489
+ }
490
+
491
+ this._change();
492
+ }
493
+
494
+ private _change() {
495
+ this.emit('change', EvChange(this.m_baseColor));
496
+ }
497
+ }
498
+
499
+ // :: color dialog ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
500
+
501
+ interface ColorPickerBoxEventMap extends DialogBoxEventMap {
502
+ change: EvChange;
503
+ }
504
+
505
+ export interface ColorPickerBoxProps extends DialogProps<ColorPickerBoxEventMap> {
506
+ color: Color;
507
+ hasAlpha?: boolean;
508
+ cust_colors?: Color[];
509
+
510
+ change?: EventCallback<EvChange>; // shortcut to { event: change: ... }
511
+ }
512
+
513
+
514
+ export class ColorPickerBox extends Dialog<ColorPickerBoxProps, ColorPickerBoxEventMap>
515
+ {
516
+ private m_picker: ColorPicker;
517
+
518
+ constructor(props: ColorPickerBoxProps) {
519
+
520
+ props.icon = undefined;
521
+ props.buttons = undefined;
522
+
523
+ super(props);
524
+
525
+ this.mapPropEvents(props, 'change');
526
+
527
+ this.m_picker = new ColorPicker({
528
+ color: props.color,
529
+ hasAlpha: props.hasAlpha,
530
+ style: { padding: 8 },
531
+ width: 250,
532
+ height: 250,
533
+ });
534
+
535
+ let customs = this._makeCustoms(props.cust_colors);
536
+
537
+ this.form.updateContent([
538
+ new VLayout({
539
+ content: [
540
+ this.m_picker,
541
+ customs
542
+ ]
543
+ })
544
+ ], ['ok', 'cancel']);
545
+
546
+ this.on('btnClick', (ev) => {
547
+ if (ev.button == 'ok') {
548
+ this.emit('change', EvChange(this.m_picker.color));
549
+ }
550
+ });
551
+ }
552
+
553
+ private _makeCustoms(cc) {
554
+
555
+ let custom = null;
556
+
557
+ if (cc && cc.length > 0) {
558
+
559
+ let els = [];
560
+
561
+ for (let i = 0; i < cc.length; i += 8) {
562
+
563
+ let lne = [];
564
+
565
+ for (let j = 0; j < 8; j++) {
566
+
567
+ let idx = i + j,
568
+ clr = cc[idx];
569
+
570
+ lne.push(new Label({
571
+ cls: 'cust-cc',
572
+ text: '',
573
+ flex: 1,
574
+ style: {
575
+ backgroundColor: clr ? clr.toString() : 'transparent'
576
+ },
577
+ tooltip: clr ? clr.toString() : undefined,
578
+ dom_events: {
579
+ click: () => {
580
+ if (clr) {
581
+ this.m_picker.color = clr;
582
+ this.emit('change', EvChange(clr));
583
+ this.close();
584
+ }
585
+ }
586
+ }
587
+ }));
588
+ }
589
+
590
+ els.push(new HLayout({ cls: 'line', content: lne }));
591
+ }
592
+
593
+ custom = new VLayout({ cls: 'customs', content: els });
594
+ }
595
+
596
+ return custom;
597
+ }
598
+
599
+ set color(clr: Color) {
600
+ this.m_picker.color = clr;
601
+ }
602
+
603
+ get color() {
604
+ return this.m_picker.color;
605
+ }
606
+
607
+ /**
608
+ * display a messagebox
609
+ */
610
+
611
+ static show(props: string | ColorPickerBoxProps): ColorPickerBox {
612
+
613
+ let msg;
614
+
615
+ if (isString(props)) {
616
+ msg = new ColorPickerBox({ color: new Color(props) });
617
+ }
618
+ else {
619
+ msg = new ColorPickerBox(props);
620
+ }
621
+
622
+ msg.show();
623
+ return msg;
624
+ }
625
+ }
626
+
627
+ // :: PickerEditor ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
628
+
629
+ export interface ColorPickerEditorProps extends ColorPickerProps {
630
+ label?: string;
631
+ labelWidth?: number;
632
+ cust_colors?: Color[];
633
+ displayValue?: false,
634
+ change?: EventCallback<EvChange>;
635
+ name?: string;
636
+ }
637
+
638
+ export class ColorPickerEditor extends HLayout<ColorPickerEditorProps, ColorPickerEventMap> {
639
+
640
+ constructor(props: ColorPickerEditorProps) {
641
+ super(props);
642
+
643
+ this.mapPropEvents(props, 'change');
644
+ }
645
+
646
+ render(props: ColorPickerEditorProps) {
647
+
648
+ let color = props.color;
649
+ let tcolor: string;
650
+
651
+ if (this._isTransp(color)) {
652
+ color = Color.NONE;
653
+ tcolor = 'black';
654
+ }
655
+ else {
656
+ tcolor = Color.contrastColor(color).toString();
657
+ }
658
+
659
+ this.setContent([
660
+ props.label ? new Label({
661
+ cls: 'label',
662
+ text: props.label,
663
+ flex: props.labelWidth < 0 ? -props.labelWidth : undefined,
664
+ width: props.labelWidth >= 0 ? props.labelWidth : undefined,
665
+ }) : null,
666
+ new Component( {
667
+ flex: 1,
668
+ content: [
669
+ new Label({
670
+ cls: 'alpha @fit',
671
+ text: ''
672
+ }),
673
+ new Label({
674
+ cls: 'value @fit',
675
+ text: props.displayValue===false ? '' : color.toHex(),
676
+ style: {
677
+ backgroundColor: color.toString(),
678
+ color: tcolor
679
+ },
680
+ dom_events: {
681
+ click: () => this._showPicker()
682
+ }
683
+ })
684
+ ],
685
+ } )
686
+ ]);
687
+
688
+ if( props.displayValue===false ) {
689
+ this.setStyleValue( 'background-image', "url( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpQaXhlbFhEaW1lbnNpb249IjEwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMTAiCiAgIGV4aWY6Q29sb3JTcGFjZT0iMSIKICAgdGlmZjpJbWFnZVdpZHRoPSIxMCIKICAgdGlmZjpJbWFnZUxlbmd0aD0iMTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiCiAgIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIKICAgeG1wOk1vZGlmeURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiPgogICA8eG1wTU06SGlzdG9yeT4KICAgIDxyZGY6U2VxPgogICAgIDxyZGY6bGkKICAgICAgc3RFdnQ6YWN0aW9uPSJwcm9kdWNlZCIKICAgICAgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWZmaW5pdHkgRGVzaWduZXIgMS45LjAiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDMtMjJUMTU6NTE6NDkrMDE6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn8+b7YAAAGCaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWRy0tCQRSHv7Qwyh5gRIsWEtZKwwyiNi2UXlAt1CCrjV5fgdrlXiOibdBWKIja9FrUX1DboHUQFEUQ7YLWRW0qbueqoESe4cz55jdzDjNnwBLOKFm93gvZXF4LTvid85EFp+0FK5204sURVXR1JjQepqZ93lNnxluPWav2uX+tOZ7QFahrFB5VVC0vPCk8vZZXTd4R7lDS0bjwmbBbkwsK35l6rMSvJqdK/G2yFg4GwNIu7ExVcayKlbSWFZaX48pmVpXyfcyX2BO5uZDEHvFudIJM4MfJFGMEGGKAEZmH8OCjX1bUyPcW82dZkVxFZpV1NJZJkSaPW9RVqZ6QmBQ9ISPDutn/v33Vk4O+UnW7HxqeDeO9F2zb8FMwjK8jw/g5BusTXOYq+SuHMPwheqGiuQ6gbRPOrypabBcutqDrUY1q0aJkFbckk/B2Ci0RcNxA02KpZ+V9Th4gvCFfdQ17+9An59uWfgF7Hmfv4QYbGAAAAAlwSFlzAAALEwAACxMBAJqcGAAAACdJREFUGJVjbGhoYEAC9fX1yFwmBryAptKM////R+Y3NjbSzW4C0gAo9QeQBmhTIwAAAABJRU5ErkJggg=='" );
690
+ }
691
+
692
+ this._setTabIndex(props.tabIndex);
693
+ }
694
+
695
+ set value(color: Color) {
696
+ this.m_props.color = color;
697
+ this.update();
698
+ }
699
+
700
+ get value() {
701
+ return this.m_props.color;
702
+ }
703
+
704
+ set custom_colors(v: Color[]) {
705
+ this.m_props.cust_colors = v;
706
+ }
707
+
708
+ private _showPicker() {
709
+ let dlg = new ColorPickerBox({
710
+ color: this.m_props.color,
711
+ cust_colors: this.m_props.cust_colors,
712
+ hasAlpha: this.m_props.hasAlpha,
713
+ events: {
714
+ change: (e) => {
715
+ this.m_props.color = e.value as Color;
716
+ this._change();
717
+ this.update();
718
+ }
719
+ }
720
+ });
721
+
722
+ let rc = this.getBoundingRect();
723
+ dlg.displayAt(rc.left, rc.bottom, 'tl');
724
+ }
725
+
726
+ private _change() {
727
+ this.emit('change', EvChange(this.m_props.color));
728
+ }
729
+
730
+ private _isTransp(color: Color) {
731
+ return !color.alpha();
732
+ }
733
+ }
734
+
735
+
736
+ // :: Material colors scheme ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
737
+
738
+ const materialColors = [
739
+ {
740
+ color: "Red",
741
+ variations: [
742
+ {
743
+ weight: 50,
744
+ hex: 0xFFEBEE
745
+ },
746
+ {
747
+ weight: 100,
748
+ hex: 0xFFCDD2
749
+ },
750
+ {
751
+ weight: 200,
752
+ hex: 0xEF9A9A
753
+ },
754
+ {
755
+ weight: 300,
756
+ hex: 0xE57373
757
+ },
758
+ {
759
+ weight: 400,
760
+ hex: 0xEF5350
761
+ },
762
+ {
763
+ weight: 500,
764
+ hex: 0xF44336
765
+ },
766
+ {
767
+ weight: 600,
768
+ hex: 0xE53935
769
+ },
770
+ {
771
+ weight: 700,
772
+ hex: 0xD32F2F
773
+ },
774
+ {
775
+ weight: 800,
776
+ hex: 0xC62828
777
+ },
778
+ {
779
+ weight: 900,
780
+ hex: 0xB71C1C
781
+ }
782
+ ]
783
+ },
784
+ {
785
+ color: "Pink",
786
+ variations: [
787
+ {
788
+ weight: 50,
789
+ hex: 0xFCE4EC
790
+ },
791
+ {
792
+ weight: 100,
793
+ hex: 0xF8BBD0
794
+ },
795
+ {
796
+ weight: 200,
797
+ hex: 0xF48FB1
798
+ },
799
+ {
800
+ weight: 300,
801
+ hex: 0xF06292
802
+ },
803
+ {
804
+ weight: 400,
805
+ hex: 0xEC407A
806
+ },
807
+ {
808
+ weight: 500,
809
+ hex: 0xE91E63
810
+ },
811
+ {
812
+ weight: 600,
813
+ hex: 0xD81B60
814
+ },
815
+ {
816
+ weight: 700,
817
+ hex: 0xC2185B
818
+ },
819
+ {
820
+ weight: 800,
821
+ hex: 0xAD1457
822
+ },
823
+ {
824
+ weight: 900,
825
+ hex: 0x880E4F
826
+ }
827
+ ]
828
+ },
829
+ {
830
+ color: "Purple",
831
+ variations: [
832
+ {
833
+ weight: 50,
834
+ hex: 0xF3E5F5
835
+ },
836
+ {
837
+ weight: 100,
838
+ hex: 0xE1BEE7
839
+ },
840
+ {
841
+ weight: 200,
842
+ hex: 0xCE93D8
843
+ },
844
+ {
845
+ weight: 300,
846
+ hex: 0xBA68C8
847
+ },
848
+ {
849
+ weight: 400,
850
+ hex: 0xAB47BC
851
+ },
852
+ {
853
+ weight: 500,
854
+ hex: 0x9C27B0
855
+ },
856
+ {
857
+ weight: 600,
858
+ hex: 0x8E24AA
859
+ },
860
+ {
861
+ weight: 700,
862
+ hex: 0x7B1FA2
863
+ },
864
+ {
865
+ weight: 800,
866
+ hex: 0x6A1B9A
867
+ },
868
+ {
869
+ weight: 900,
870
+ hex: 0x4A148C
871
+ }
872
+ ]
873
+ },
874
+ {
875
+ color: "Deep Purple",
876
+ variations: [
877
+ {
878
+ weight: 50,
879
+ hex: 0xEDE7F6
880
+ },
881
+ {
882
+ weight: 100,
883
+ hex: 0xD1C4E9
884
+ },
885
+ {
886
+ weight: 200,
887
+ hex: 0xB39DDB
888
+ },
889
+ {
890
+ weight: 300,
891
+ hex: 0x9575CD
892
+ },
893
+ {
894
+ weight: 400,
895
+ hex: 0x7E57C2
896
+ },
897
+ {
898
+ weight: 500,
899
+ hex: 0x673AB7
900
+ },
901
+ {
902
+ weight: 600,
903
+ hex: 0x5E35B1
904
+ },
905
+ {
906
+ weight: 700,
907
+ hex: 0x512DA8
908
+ },
909
+ {
910
+ weight: 800,
911
+ hex: 0x4527A0
912
+ },
913
+ {
914
+ weight: 900,
915
+ hex: 0x311B92
916
+ }
917
+ ]
918
+ },
919
+ {
920
+ color: "Indigo",
921
+ variations: [
922
+ {
923
+ weight: 50,
924
+ hex: 0xE8EAF6
925
+ },
926
+ {
927
+ weight: 100,
928
+ hex: 0xC5CAE9
929
+ },
930
+ {
931
+ weight: 200,
932
+ hex: 0x9FA8DA
933
+ },
934
+ {
935
+ weight: 300,
936
+ hex: 0x7986CB
937
+ },
938
+ {
939
+ weight: 400,
940
+ hex: 0x5C6BC0
941
+ },
942
+ {
943
+ weight: 500,
944
+ hex: 0x3F51B5
945
+ },
946
+ {
947
+ weight: 600,
948
+ hex: 0x3949AB
949
+ },
950
+ {
951
+ weight: 700,
952
+ hex: 0x303F9F
953
+ },
954
+ {
955
+ weight: 800,
956
+ hex: 0x283593
957
+ },
958
+ {
959
+ weight: 900,
960
+ hex: 0x1A237E
961
+ }
962
+ ]
963
+ },
964
+ {
965
+ color: "Blue",
966
+ variations: [
967
+ {
968
+ weight: 50,
969
+ hex: 0xE3F2FD
970
+ },
971
+ {
972
+ weight: 100,
973
+ hex: 0xBBDEFB
974
+ },
975
+ {
976
+ weight: 200,
977
+ hex: 0x90CAF9
978
+ },
979
+ {
980
+ weight: 300,
981
+ hex: 0x64B5F6
982
+ },
983
+ {
984
+ weight: 400,
985
+ hex: 0x42A5F5
986
+ },
987
+ {
988
+ weight: 500,
989
+ hex: 0x2196F3
990
+ },
991
+ {
992
+ weight: 600,
993
+ hex: 0x1E88E5
994
+ },
995
+ {
996
+ weight: 700,
997
+ hex: 0x1976D2
998
+ },
999
+ {
1000
+ weight: 800,
1001
+ hex: 0x1565C0
1002
+ },
1003
+ {
1004
+ weight: 900,
1005
+ hex: 0x0D47A1
1006
+ }
1007
+ ]
1008
+ },
1009
+ {
1010
+ color: "Light Blue",
1011
+ variations: [
1012
+ {
1013
+ weight: 50,
1014
+ hex: 0xE1F5FE
1015
+ },
1016
+ {
1017
+ weight: 100,
1018
+ hex: 0xB3E5FC
1019
+ },
1020
+ {
1021
+ weight: 200,
1022
+ hex: 0x81D4FA
1023
+ },
1024
+ {
1025
+ weight: 300,
1026
+ hex: 0x4FC3F7
1027
+ },
1028
+ {
1029
+ weight: 400,
1030
+ hex: 0x29B6F6
1031
+ },
1032
+ {
1033
+ weight: 500,
1034
+ hex: 0x03A9F4
1035
+ },
1036
+ {
1037
+ weight: 600,
1038
+ hex: 0x039BE5
1039
+ },
1040
+ {
1041
+ weight: 700,
1042
+ hex: 0x0288D1
1043
+ },
1044
+ {
1045
+ weight: 800,
1046
+ hex: 0x0277BD
1047
+ },
1048
+ {
1049
+ weight: 900,
1050
+ hex: 0x01579B
1051
+ }
1052
+ ]
1053
+ },
1054
+ {
1055
+ color: "Cyan",
1056
+ variations: [
1057
+ {
1058
+ weight: 50,
1059
+ hex: 0xE0F7FA
1060
+ },
1061
+ {
1062
+ weight: 100,
1063
+ hex: 0xB2EBF2
1064
+ },
1065
+ {
1066
+ weight: 200,
1067
+ hex: 0x80DEEA
1068
+ },
1069
+ {
1070
+ weight: 300,
1071
+ hex: 0x4DD0E1
1072
+ },
1073
+ {
1074
+ weight: 400,
1075
+ hex: 0x26C6DA
1076
+ },
1077
+ {
1078
+ weight: 500,
1079
+ hex: 0x00BCD4
1080
+ },
1081
+ {
1082
+ weight: 600,
1083
+ hex: 0x00ACC1
1084
+ },
1085
+ {
1086
+ weight: 700,
1087
+ hex: 0x0097A7
1088
+ },
1089
+ {
1090
+ weight: 800,
1091
+ hex: 0x00838F
1092
+ },
1093
+ {
1094
+ weight: 900,
1095
+ hex: 0x006064
1096
+ }
1097
+ ]
1098
+ },
1099
+ {
1100
+ color: "Teal",
1101
+ variations: [
1102
+ {
1103
+ weight: 50,
1104
+ hex: 0xE0F2F1
1105
+ },
1106
+ {
1107
+ weight: 100,
1108
+ hex: 0xB2DFDB
1109
+ },
1110
+ {
1111
+ weight: 200,
1112
+ hex: 0x80CBC4
1113
+ },
1114
+ {
1115
+ weight: 300,
1116
+ hex: 0x4DB6AC
1117
+ },
1118
+ {
1119
+ weight: 400,
1120
+ hex: 0x26A69A
1121
+ },
1122
+ {
1123
+ weight: 500,
1124
+ hex: 0x009688
1125
+ },
1126
+ {
1127
+ weight: 600,
1128
+ hex: 0x00897B
1129
+ },
1130
+ {
1131
+ weight: 700,
1132
+ hex: 0x00796B
1133
+ },
1134
+ {
1135
+ weight: 800,
1136
+ hex: 0x00695C
1137
+ },
1138
+ {
1139
+ weight: 900,
1140
+ hex: 0x004D40
1141
+ }
1142
+ ]
1143
+ },
1144
+ {
1145
+ color: "Green",
1146
+ variations: [
1147
+ {
1148
+ weight: 50,
1149
+ hex: 0xE8F5E9
1150
+ },
1151
+ {
1152
+ weight: 100,
1153
+ hex: 0xC8E6C9
1154
+ },
1155
+ {
1156
+ weight: 200,
1157
+ hex: 0xA5D6A7
1158
+ },
1159
+ {
1160
+ weight: 300,
1161
+ hex: 0x81C784
1162
+ },
1163
+ {
1164
+ weight: 400,
1165
+ hex: 0x66BB6A
1166
+ },
1167
+ {
1168
+ weight: 500,
1169
+ hex: 0x4CAF50
1170
+ },
1171
+ {
1172
+ weight: 600,
1173
+ hex: 0x43A047
1174
+ },
1175
+ {
1176
+ weight: 700,
1177
+ hex: 0x388E3C
1178
+ },
1179
+ {
1180
+ weight: 800,
1181
+ hex: 0x2E7D32
1182
+ },
1183
+ {
1184
+ weight: 900,
1185
+ hex: 0x1B5E20
1186
+ }
1187
+ ]
1188
+ },
1189
+ {
1190
+ color: "Light Green",
1191
+ variations: [
1192
+ {
1193
+ weight: 50,
1194
+ hex: 0xF1F8E9
1195
+ },
1196
+ {
1197
+ weight: 100,
1198
+ hex: 0xDCEDC8
1199
+ },
1200
+ {
1201
+ weight: 200,
1202
+ hex: 0xC5E1A5
1203
+ },
1204
+ {
1205
+ weight: 300,
1206
+ hex: 0xAED581
1207
+ },
1208
+ {
1209
+ weight: 400,
1210
+ hex: 0x9CCC65
1211
+ },
1212
+ {
1213
+ weight: 500,
1214
+ hex: 0x8BC34A
1215
+ },
1216
+ {
1217
+ weight: 600,
1218
+ hex: 0x7CB342
1219
+ },
1220
+ {
1221
+ weight: 700,
1222
+ hex: 0x689F38
1223
+ },
1224
+ {
1225
+ weight: 800,
1226
+ hex: 0x558B2F
1227
+ },
1228
+ {
1229
+ weight: 900,
1230
+ hex: 0x33691E
1231
+ }
1232
+ ]
1233
+ },
1234
+ {
1235
+ color: "Lime",
1236
+ variations: [
1237
+ {
1238
+ weight: 50,
1239
+ hex: 0xF9FBE7
1240
+ },
1241
+ {
1242
+ weight: 100,
1243
+ hex: 0xF0F4C3
1244
+ },
1245
+ {
1246
+ weight: 200,
1247
+ hex: 0xE6EE9C
1248
+ },
1249
+ {
1250
+ weight: 300,
1251
+ hex: 0xDCE775
1252
+ },
1253
+ {
1254
+ weight: 400,
1255
+ hex: 0xD4E157
1256
+ },
1257
+ {
1258
+ weight: 500,
1259
+ hex: 0xCDDC39
1260
+ },
1261
+ {
1262
+ weight: 600,
1263
+ hex: 0xC0CA33
1264
+ },
1265
+ {
1266
+ weight: 700,
1267
+ hex: 0xAFB42B
1268
+ },
1269
+ {
1270
+ weight: 800,
1271
+ hex: 0x9E9D24
1272
+ },
1273
+ {
1274
+ weight: 900,
1275
+ hex: 0x827717
1276
+ }
1277
+ ]
1278
+ },
1279
+ {
1280
+ color: "Yellow",
1281
+ variations: [
1282
+ {
1283
+ weight: 50,
1284
+ hex: 0xFFFDE7
1285
+ },
1286
+ {
1287
+ weight: 100,
1288
+ hex: 0xFFF9C4
1289
+ },
1290
+ {
1291
+ weight: 200,
1292
+ hex: 0xFFF59D
1293
+ },
1294
+ {
1295
+ weight: 300,
1296
+ hex: 0xFFF176
1297
+ },
1298
+ {
1299
+ weight: 400,
1300
+ hex: 0xFFEE58
1301
+ },
1302
+ {
1303
+ weight: 500,
1304
+ hex: 0xFFEB3B
1305
+ },
1306
+ {
1307
+ weight: 600,
1308
+ hex: 0xFDD835
1309
+ },
1310
+ {
1311
+ weight: 700,
1312
+ hex: 0xFBC02D
1313
+ },
1314
+ {
1315
+ weight: 800,
1316
+ hex: 0xF9A825
1317
+ },
1318
+ {
1319
+ weight: 900,
1320
+ hex: 0xF57F17
1321
+ }
1322
+ ]
1323
+ },
1324
+ {
1325
+ color: "Amber",
1326
+ variations: [
1327
+ {
1328
+ weight: 50,
1329
+ hex: 0xFFF8E1
1330
+ },
1331
+ {
1332
+ weight: 100,
1333
+ hex: 0xFFECB3
1334
+ },
1335
+ {
1336
+ weight: 200,
1337
+ hex: 0xFFE082
1338
+ },
1339
+ {
1340
+ weight: 300,
1341
+ hex: 0xFFD54F
1342
+ },
1343
+ {
1344
+ weight: 400,
1345
+ hex: 0xFFCA28
1346
+ },
1347
+ {
1348
+ weight: 500,
1349
+ hex: 0xFFC107
1350
+ },
1351
+ {
1352
+ weight: 600,
1353
+ hex: 0xFFB300
1354
+ },
1355
+ {
1356
+ weight: 700,
1357
+ hex: 0xFFA000
1358
+ },
1359
+ {
1360
+ weight: 800,
1361
+ hex: 0xFF8F00
1362
+ },
1363
+ {
1364
+ weight: 900,
1365
+ hex: 0xFF6F00
1366
+ }
1367
+ ]
1368
+ },
1369
+ {
1370
+ color: "Orange",
1371
+ variations: [
1372
+ {
1373
+ weight: 50,
1374
+ hex: 0xFFF3E0
1375
+ },
1376
+ {
1377
+ weight: 100,
1378
+ hex: 0xFFE0B2
1379
+ },
1380
+ {
1381
+ weight: 200,
1382
+ hex: 0xFFCC80
1383
+ },
1384
+ {
1385
+ weight: 300,
1386
+ hex: 0xFFB74D
1387
+ },
1388
+ {
1389
+ weight: 400,
1390
+ hex: 0xFFA726
1391
+ },
1392
+ {
1393
+ weight: 500,
1394
+ hex: 0xFF9800
1395
+ },
1396
+ {
1397
+ weight: 600,
1398
+ hex: 0xFB8C00
1399
+ },
1400
+ {
1401
+ weight: 700,
1402
+ hex: 0xF57C00
1403
+ },
1404
+ {
1405
+ weight: 800,
1406
+ hex: 0xEF6C00
1407
+ },
1408
+ {
1409
+ weight: 900,
1410
+ hex: 0xE65100
1411
+ }
1412
+ ]
1413
+ },
1414
+ {
1415
+ color: "Deep Orange",
1416
+ variations: [
1417
+ {
1418
+ weight: 50,
1419
+ hex: 0xFBE9E7
1420
+ },
1421
+ {
1422
+ weight: 100,
1423
+ hex: 0xFFCCBC
1424
+ },
1425
+ {
1426
+ weight: 200,
1427
+ hex: 0xFFAB91
1428
+ },
1429
+ {
1430
+ weight: 300,
1431
+ hex: 0xFF8A65
1432
+ },
1433
+ {
1434
+ weight: 400,
1435
+ hex: 0xFF7043
1436
+ },
1437
+ {
1438
+ weight: 500,
1439
+ hex: 0xFF5722
1440
+ },
1441
+ {
1442
+ weight: 600,
1443
+ hex: 0xF4511E
1444
+ },
1445
+ {
1446
+ weight: 700,
1447
+ hex: 0xE64A19
1448
+ },
1449
+ {
1450
+ weight: 800,
1451
+ hex: 0xD84315
1452
+ },
1453
+ {
1454
+ weight: 900,
1455
+ hex: 0xBF360C
1456
+ }
1457
+ ]
1458
+ },
1459
+ {
1460
+ color: "Brown",
1461
+ variations: [
1462
+ {
1463
+ weight: 50,
1464
+ hex: 0xEFEBE9
1465
+ },
1466
+ {
1467
+ weight: 100,
1468
+ hex: 0xD7CCC8
1469
+ },
1470
+ {
1471
+ weight: 200,
1472
+ hex: 0xBCAAA4
1473
+ },
1474
+ {
1475
+ weight: 300,
1476
+ hex: 0xA1887F
1477
+ },
1478
+ {
1479
+ weight: 400,
1480
+ hex: 0x8D6E63
1481
+ },
1482
+ {
1483
+ weight: 500,
1484
+ hex: 0x795548
1485
+ },
1486
+ {
1487
+ weight: 600,
1488
+ hex: 0x6D4C41
1489
+ },
1490
+ {
1491
+ weight: 700,
1492
+ hex: 0x5D4037
1493
+ },
1494
+ {
1495
+ weight: 800,
1496
+ hex: 0x4E342E
1497
+ },
1498
+ {
1499
+ weight: 900,
1500
+ hex: 0x3E2723
1501
+ }
1502
+ ]
1503
+ },
1504
+ {
1505
+ color: "Grey",
1506
+ variations: [
1507
+ {
1508
+ weight: 50,
1509
+ hex: 0xFAFAFA
1510
+ },
1511
+ {
1512
+ weight: 100,
1513
+ hex: 0xF5F5F5
1514
+ },
1515
+ {
1516
+ weight: 200,
1517
+ hex: 0xEEEEEE
1518
+ },
1519
+ {
1520
+ weight: 300,
1521
+ hex: 0xE0E0E0
1522
+ },
1523
+ {
1524
+ weight: 400,
1525
+ hex: 0xBDBDBD
1526
+ },
1527
+ {
1528
+ weight: 500,
1529
+ hex: 0x9E9E9E
1530
+ },
1531
+ {
1532
+ weight: 600,
1533
+ hex: 0x757575
1534
+ },
1535
+ {
1536
+ weight: 700,
1537
+ hex: 0x616161
1538
+ },
1539
+ {
1540
+ weight: 800,
1541
+ hex: 0x424242
1542
+ },
1543
+ {
1544
+ weight: 900,
1545
+ hex: 0x212121
1546
+ }
1547
+ ]
1548
+ },
1549
+ {
1550
+ color: "Blue Grey",
1551
+ variations: [
1552
+ {
1553
+ weight: 50,
1554
+ hex: 0xECEFF1
1555
+ },
1556
+ {
1557
+ weight: 100,
1558
+ hex: 0xCFD8DC
1559
+ },
1560
+ {
1561
+ weight: 200,
1562
+ hex: 0xB0BEC5
1563
+ },
1564
+ {
1565
+ weight: 300,
1566
+ hex: 0x90A4AE
1567
+ },
1568
+ {
1569
+ weight: 400,
1570
+ hex: 0x78909C
1571
+ },
1572
+ {
1573
+ weight: 500,
1574
+ hex: 0x607D8B
1575
+ },
1576
+ {
1577
+ weight: 600,
1578
+ hex: 0x546E7A
1579
+ },
1580
+ {
1581
+ weight: 700,
1582
+ hex: 0x455A64
1583
+ },
1584
+ {
1585
+ weight: 800,
1586
+ hex: 0x37474F
1587
+ },
1588
+ {
1589
+ weight: 900,
1590
+ hex: 0x263238
1591
+ }
1592
+ ]
1593
+ },
1594
+ {
1595
+ color: "Grey",
1596
+ variations: [
1597
+ {
1598
+ weight: 50,
1599
+ hex: 0xFFFFFF
1600
+ },
1601
+ {
1602
+ weight: 100,
1603
+ hex: 0xe0e0e0
1604
+ },
1605
+ {
1606
+ weight: 200,
1607
+ hex: 0xc4c4c4
1608
+ },
1609
+ {
1610
+ weight: 300,
1611
+ hex: 0xa8a8a8
1612
+ },
1613
+ {
1614
+ weight: 400,
1615
+ hex: 0x8c8c8c
1616
+ },
1617
+ {
1618
+ weight: 500,
1619
+ hex: 0x707070
1620
+ },
1621
+ {
1622
+ weight: 600,
1623
+ hex: 0x545454
1624
+ },
1625
+ {
1626
+ weight: 700,
1627
+ hex: 0x383838
1628
+ },
1629
+ {
1630
+ weight: 800,
1631
+ hex: 0x1c1c1c
1632
+ },
1633
+ {
1634
+ weight: 900,
1635
+ hex: 0x00000
1636
+ }
1637
+ ]
1638
+ }
1639
+ ];