@nebularstreams/libmui 3.1.1 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/libmui.esm.js +3 -0
  2. package/dist/libmui.esm.min.js +3 -0
  3. package/package.json +6 -2
  4. package/dist/libui.esm.js +0 -3
  5. package/rollup.config.js +0 -20
  6. package/src/app/MainState.js +0 -22
  7. package/src/app/app.js +0 -9
  8. package/src/css/a-measures.css +0 -6
  9. package/src/css/b-colors.css +0 -12
  10. package/src/css/b-root-bootstrap-ext.css +0 -81
  11. package/src/css/b-root-bootstrap.css +0 -178
  12. package/src/css/b-root-semantic-flex.css +0 -87
  13. package/src/css/b-root-semantic-size-new.css +0 -37
  14. package/src/css/b-root-semantic-size.css +0 -75
  15. package/src/css/b-root-semantic-skin.css +0 -48
  16. package/src/css/b-root-semantic.css +0 -111
  17. package/src/css/b-root.css +0 -3
  18. package/src/css/cardie.css +0 -6
  19. package/src/css/flex.css +0 -46
  20. package/src/css/fontawesome/brands.min.css +0 -16
  21. package/src/css/fontawesome/fontawesome-ext.css +0 -7
  22. package/src/css/fontawesome/fontawesome-solid.css +0 -17
  23. package/src/css/fontawesome/fontawesome.css +0 -4359
  24. package/src/css/ui.notifications.css +0 -23
  25. package/src/css/ui.popup.css +0 -127
  26. package/src/css/ui.witharia.css +0 -25
  27. package/src/index.js +0 -112
  28. package/src/meta/InputTemplates.js +0 -3
  29. package/src/style.js +0 -37
  30. package/src/util/colorjoe.js +0 -1370
  31. package/src/util/filepath.js +0 -10
  32. package/src/util/fuckingconfirm.js +0 -28
  33. package/src/util/mithril-range.js +0 -445
  34. package/src/util/tainter.js +0 -39
  35. package/src/util/util.clone.js +0 -8
  36. package/src/util/util.tokenizer.js +0 -266
  37. package/src/util/widgets.core.js +0 -314
  38. package/src/util/widgets.js +0 -79
  39. package/src/util/widgets.utils.js +0 -10
  40. package/src/widgets/Basic.js +0 -352
  41. package/src/widgets/ButtonChoiceWidget.js +0 -72
  42. package/src/widgets/CardieWidget.js +0 -168
  43. package/src/widgets/ColorJoePack.js +0 -108
  44. package/src/widgets/ColorJoeWidget.js +0 -140
  45. package/src/widgets/ComboPrompt.js +0 -112
  46. package/src/widgets/ComboWidget.js +0 -156
  47. package/src/widgets/CoolContentTicker.js +0 -244
  48. package/src/widgets/CoolerEmpty.js +0 -37
  49. package/src/widgets/EmptyButton.js +0 -36
  50. package/src/widgets/FontSelectorButton.js +0 -37
  51. package/src/widgets/InputWidget.js +0 -254
  52. package/src/widgets/NoticeWidget.js +0 -31
  53. package/src/widgets/OverflowUtils.js +0 -449
  54. package/src/widgets/PlusMinusWidget.js +0 -55
  55. package/src/widgets/RangeWidget.js +0 -200
  56. package/src/widgets/SelectFileMiniButton.js +0 -170
  57. package/src/widgets/Separator.js +0 -21
  58. package/src/widgets/SmileysButton.js +0 -19
  59. package/src/widgets/SwitchWidget.js +0 -42
  60. package/src/widgets/TemplatedInputWidget.js +0 -1395
  61. package/src/widgets/TitleBarWidget.js +0 -71
  62. package/src/widgets/css/buttonchoice.css +0 -62
  63. package/src/widgets/css/buttonchoice.toggle.css +0 -37
  64. package/src/widgets/css/choicer.css +0 -24
  65. package/src/widgets/css/colorjoe.css +0 -230
  66. package/src/widgets/css/colorjoewidget.css +0 -105
  67. package/src/widgets/css/combo-ellipsis.css +0 -29
  68. package/src/widgets/css/fileminibutton.css +0 -12
  69. package/src/widgets/css/input.css +0 -35
  70. package/src/widgets/css/mithril-range.css +0 -69
  71. package/src/widgets/css/progressstrip.css +0 -31
  72. package/src/widgets/css/range-anims.css +0 -23
  73. package/src/widgets/css/separator.css +0 -21
  74. package/src/widgets/css/smileys.css +0 -85
  75. package/src/widgets/css/templatedinput.css +0 -67
  76. package/src/widgets/css/ui.titlebar.css +0 -44
  77. package/src/widgets/css/uploadfile.css +0 -5
  78. /package/dist/{libui.css → libmui.css} +0 -0
@@ -1,1370 +0,0 @@
1
- /*! colorjoe - v4.1.1 - Juho Vepsalainen <bebraw@gmail.com> - MIT
2
- https://bebraw.github.com/colorjoe - 2020-01-27 */
3
- const
4
- factory = (function () {
5
- "use strict";
6
-
7
- var commonjsGlobal = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
8
-
9
- function createCommonjsModule(fn, module) {
10
- return module = {exports: {}}, fn(module, module.exports), module.exports;
11
- }
12
-
13
- var dragjs_umd = createCommonjsModule(function (module, exports) {
14
- (function (root, factory) {
15
-
16
- {
17
- module.exports = factory();
18
- }
19
-
20
- }(commonjsGlobal, function () {
21
-
22
- /*! dragjs - v0.8.0 - Juho Vepsalainen <bebraw@gmail.com> - MIT
23
- https://bebraw.github.com/dragjs - 2018-07-03 */
24
- var drag = (function () {
25
- function drag(elem, cbs) {
26
- if (!elem) {
27
- console.warn("drag is missing elem!");
28
- return;
29
- }
30
-
31
- dragTemplate(elem, cbs, "touchstart", "touchmove", "touchend");
32
- dragTemplate(elem, cbs, "mousedown", "mousemove", "mouseup");
33
- }
34
-
35
- function xyslider(o) {
36
- var twod = div(o["class"] || "", o.parent);
37
- var pointer = div("pointer", twod);
38
- div("shape shape1", pointer);
39
- div("shape shape2", pointer);
40
- div("bg bg1", twod);
41
- div("bg bg2", twod);
42
-
43
- drag(twod, attachPointer(o.cbs, pointer));
44
-
45
- return {
46
- background: twod,
47
- pointer: pointer
48
- };
49
- }
50
-
51
- function slider(o) {
52
- var oned = div(o["class"], o.parent);
53
- var pointer = div("pointer", oned);
54
- div("shape", pointer);
55
- div("bg", oned);
56
-
57
- drag(oned, attachPointer(o.cbs, pointer));
58
-
59
- return {
60
- background: oned,
61
- pointer: pointer
62
- };
63
- }
64
-
65
- drag.xyslider = xyslider;
66
- drag.slider = slider;
67
-
68
- return drag;
69
-
70
- function attachPointer(cbs, pointer) {
71
- var ret = {};
72
-
73
- for (var n in cbs) {
74
- ret[n] = wrap(cbs[n]);
75
- }
76
-
77
- function wrap(fn) {
78
- return function (p) {
79
- p.pointer = pointer;
80
- fn(p);
81
- };
82
- }
83
-
84
- return ret;
85
- }
86
-
87
- // move to elemutils lib?
88
- function div(klass, p) {
89
- return e("div", klass, p);
90
- }
91
-
92
- function e(type, klass, p) {
93
- var elem = document.createElement(type);
94
- if (klass) {
95
- elem.className = klass;
96
- }
97
- p.appendChild(elem);
98
-
99
- return elem;
100
- }
101
-
102
- function dragTemplate(elem, cbs, down, move, up) {
103
-
104
- cbs = getCbs(cbs);
105
-
106
- var beginCb = cbs.begin;
107
- var changeCb = cbs.change;
108
- var endCb = cbs.end;
109
-
110
- on(elem, down, function (e) {
111
-
112
- var moveHandler = partial(callCb, changeCb, elem);
113
-
114
- function upHandler() {
115
-
116
- off(document, move, moveHandler);
117
- off(document, up, upHandler);
118
-
119
- callCb(endCb, elem, e);
120
- }
121
-
122
- on(document, move, moveHandler);
123
- on(document, up, upHandler);
124
-
125
- callCb(beginCb, elem, e);
126
- });
127
- }
128
-
129
- // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
130
- function on(elem, evt, handler) {
131
- // Test via a getter in the options object to see if the passive property is accessed
132
- var supportsPassive = false;
133
- try {
134
- var opts = Object.defineProperty({}, "passive", {
135
- get: function () {
136
- supportsPassive = true;
137
- }
138
- });
139
- window.addEventListener("testPassive", null, opts);
140
- window.removeEventListener("testPassive", null, opts);
141
- } catch (e) {
142
- }
143
-
144
- elem.addEventListener(evt, handler, supportsPassive ? {passive: false} : false);
145
- }
146
-
147
- function off(elem, evt, handler) {
148
- elem.removeEventListener(evt, handler, false);
149
- }
150
-
151
- function getCbs(cbs) {
152
- if (!cbs) {
153
- var initialOffset;
154
- var initialPos;
155
-
156
- return {
157
- begin: function (c) {
158
- initialOffset = {x: c.elem.offsetLeft, y: c.elem.offsetTop};
159
- initialPos = c.cursor;
160
- },
161
- change: function (c) {
162
- style(c.elem, "left", (initialOffset.x + c.cursor.x - initialPos.x) + "px");
163
- style(c.elem, "top", (initialOffset.y + c.cursor.y - initialPos.y) + "px");
164
- },
165
- end: empty
166
- };
167
- } else {
168
- return {
169
- begin: cbs.begin || empty,
170
- change: cbs.change || empty,
171
- end: cbs.end || empty
172
- };
173
- }
174
- }
175
-
176
- // TODO: set draggable class (handy for fx)
177
- function style(e, prop, value) {
178
- e.style[prop] = value;
179
- }
180
-
181
- function empty() {
182
- }
183
-
184
- function callCb(cb, elem, e) {
185
- e.preventDefault();
186
-
187
- var offset = findPos(elem);
188
- var width = elem.clientWidth * (window.SCALE || 1);
189
- var height = elem.clientHeight * (window.SCALE || 1);
190
- var cursor = {
191
- x: cursorX(elem, e),
192
- y: cursorY(elem, e)
193
- };
194
- var x = (cursor.x - offset.x) / width;
195
- var y = (cursor.y - offset.y) / height;
196
-
197
- cb({
198
- x: isNaN(x) ? 0 : x,
199
- y: isNaN(y) ? 0 : y,
200
- cursor: cursor,
201
- elem: elem,
202
- e: e
203
- });
204
- }
205
-
206
- // http://stackoverflow.com/questions/4394747/javascript-curry-function
207
- function partial(fn) {
208
- var slice = Array.prototype.slice;
209
- var args = slice.apply(arguments, [1]);
210
-
211
- return function () {
212
- return fn.apply(null, args.concat(slice.apply(arguments)));
213
- };
214
- }
215
-
216
- // http://www.quirksmode.org/js/findpos.html
217
- function findPos(e) {
218
- var r = e.getBoundingClientRect();
219
-
220
- return {
221
- x: r.left,
222
- y: r.top
223
- };
224
- }
225
-
226
- // http://javascript.about.com/library/blmousepos.htm
227
- function cursorX(elem, evt) {
228
- var evtPos = evt.touches ? evt.touches[evt.touches.length - 1] : evt;
229
- return Math.floor(evtPos.clientX);
230
- }
231
-
232
- function cursorY(elem, evt) {
233
- var evtPos = evt.touches ? evt.touches[evt.touches.length - 1] : evt;
234
- return Math.floor(evtPos.clientY);
235
- }
236
- })();
237
- return drag;
238
-
239
- }));
240
- });
241
-
242
- var oneColorAll = createCommonjsModule(function (module, exports) {
243
- !function (e, a) {
244
- module.exports = a();
245
- }(commonjsGlobal,
246
- function () {
247
- function e(a) {
248
- if (Array.isArray(a)) {
249
- if ("string" == typeof a[0] && "function" == typeof e[a[0]]) return new e[a[0]](a.slice(1, a.length));
250
- if (4 === a.length) return new e.RGB(a[0] / 255, a[1] / 255, a[2] / 255, a[3] / 255);
251
- } else if ("string" == typeof a) {
252
- var r = a.toLowerCase();
253
- e.namedColors[r] && (a = "#" + e.namedColors[r]), "transparent" === r && (a = "rgba(0,0,0,0)");
254
- var o = a.match(i);
255
- if (o) {
256
- var s = o[1].toUpperCase(),
257
- f = t(o[8]) ? o[8] : parseFloat(o[8]),
258
- u = "H" === s[0],
259
- l = o[3] ? 100 : u ? 360 : 255,
260
- h = o[5] || u ? 100 : 255,
261
- c = o[7] || u ? 100 : 255;
262
- if (t(e[s])) throw new Error("color." + s + " is not installed.");
263
- return new e[s](parseFloat(o[2]) / l, parseFloat(o[4]) / h, parseFloat(o[6]) / c, f);
264
- }
265
- a.length < 6 && (a = a.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i, "$1$1$2$2$3$3"));
266
- var d = a.match(/^#?([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/i);
267
- if (d) return new e.RGB(parseInt(d[1], 16) / 255, parseInt(d[2], 16) / 255, parseInt(d[3], 16) / 255);
268
- if (e.CMYK) {
269
- var b = a.match(new RegExp("^cmyk\\(" + n.source + "," + n.source + "," + n.source + "," + n.source + "\\)$", "i"));
270
- if (b) return new e.CMYK(parseFloat(b[1]) / 100, parseFloat(b[2]) / 100, parseFloat(b[3]) / 100, parseFloat(b[4]) / 100);
271
- }
272
- } else if ("object" == typeof a && a.isColor) return a;
273
- return !1;
274
- }
275
-
276
- var a = [],
277
- t = function (e) {
278
- return void 0 === e;
279
- },
280
- r = /\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,
281
- n = /\s*(\.\d+|100|\d?\d(?:\.\d+)?)%\s*/,
282
- i = new RegExp("^(rgb|hsl|hsv)a?\\(" + r.source + "," + r.source + "," + r.source + "(?:," + /\s*(\.\d+|\d+(?:\.\d+)?)\s*/.source + ")?\\)$", "i");
283
- e.namedColors = {}, e.installColorSpace = function (r, n, i) {
284
- function o(a, t) {
285
- var r = {};
286
- r[t.toLowerCase()] = function () {
287
- return this.rgb()[t.toLowerCase()]();
288
- }, e[t].propertyNames.forEach(function (e) {
289
- var a = "black" === e ? "k" : e.charAt(0);
290
- r[e] = r[a] = function (a, r) {
291
- return this[t.toLowerCase()]()[e](a, r);
292
- };
293
- });
294
- for (var n in r) r.hasOwnProperty(n) && void 0 === e[a].prototype[n] && (e[a].prototype[n] = r[n]);
295
- }
296
-
297
- e[r] = function (e) {
298
- var a = Array.isArray(e) ? e : arguments;
299
- n.forEach(function (e, t) {
300
- var i = a[t];
301
- if ("alpha" === e) {
302
- this._alpha = isNaN(i) || i > 1 ? 1 : i < 0 ? 0 : i;
303
- } else {
304
- if (isNaN(i)) throw new Error("[" + r + "]: Invalid color: (" + n.join(",") + ")");
305
- "hue" === e ? this._hue = i < 0 ? i - Math.floor(i) : i % 1 : this["_" + e] = i < 0 ? 0 : i > 1 ? 1 : i;
306
- }
307
- }, this);
308
- }, e[r].propertyNames = n;
309
- var s = e[r].prototype;
310
- ["valueOf", "hex", "hexa", "css", "cssa"].forEach(function (e) {
311
- s[e] = s[e] || ("RGB" === r ? s.hex : function () {
312
- return this.rgb()[e]();
313
- });
314
- }), s.isColor = !0, s.equals = function (e, a) {
315
- t(a) && (a = 1e-10), e = e[r.toLowerCase()]();
316
- for (var i = 0; i < n.length; i += 1) if (Math.abs(this["_" + n[i]] - e["_" + n[i]]) > a) return !1;
317
- return !0;
318
- }, s.toJSON = function () {
319
- return [r].concat(n.map(function (e) {
320
- return this["_" + e];
321
- }, this));
322
- };
323
- for (var f in i) {
324
- if (i.hasOwnProperty(f)) {
325
- var u = f.match(/^from(.*)$/);
326
- u ? e[u[1].toUpperCase()].prototype[r.toLowerCase()] = i[f] : s[f] = i[f];
327
- }
328
- }
329
- return s[r.toLowerCase()] = function () {
330
- return this;
331
- }, s.toString = function () {
332
- return "[" + r + " " + n.map(function (e) {
333
- return this["_" + e];
334
- }, this)
335
- .join(", ") + "]";
336
- }, n.forEach(function (e) {
337
- var a = "black" === e ? "k" : e.charAt(0);
338
- s[e] = s[a] = function (a, t) {
339
- return void 0 === a ? this["_" + e] : t ? new this.constructor(n.map(function (t) {
340
- return this["_" + t] + (e === t ? a : 0);
341
- }, this)) : new this.constructor(n.map(function (t) {
342
- return e === t ? a : this["_" + t];
343
- }, this));
344
- };
345
- }), a.forEach(function (e) {
346
- o(r, e), o(e, r);
347
- }), a.push(r), e;
348
- }, e.pluginList = [], e.use = function (a) {
349
- return -1 === e.pluginList.indexOf(a) && (this.pluginList.push(a), a(e)), e;
350
- }, e.installMethod = function (t, r) {
351
- return a.forEach(function (a) {
352
- e[a].prototype[t] = r;
353
- }), this;
354
- }, e.installColorSpace("RGB", ["red", "green", "blue", "alpha"], {
355
- hex: function () {
356
- var e = (65536 * Math.round(255 * this._red) + 256 * Math.round(255 * this._green) + Math.round(255 * this._blue)).toString(16);
357
- return "#" + "00000".substr(0, 6 - e.length) + e;
358
- }, hexa: function () {
359
- var e = Math.round(255 * this._alpha)
360
- .toString(16);
361
- return "#" + "00".substr(0, 2 - e.length) + e + this.hex()
362
- .substr(1, 6);
363
- }, css: function () {
364
- return "rgb(" + Math.round(255 * this._red) + "," + Math.round(255 * this._green) + "," + Math.round(255 * this._blue) + ")";
365
- }, cssa: function () {
366
- return "rgba(" + Math.round(255 * this._red) + "," + Math.round(255 * this._green) + "," + Math.round(255 * this._blue) + "," + this._alpha + ")";
367
- }
368
- });
369
- var o = e,
370
- s = function (e) {
371
- e.installColorSpace("XYZ", ["x", "y", "z", "alpha"], {
372
- fromRgb: function () {
373
- var a = function (e) {
374
- return e > .04045 ? Math.pow((e + .055) / 1.055, 2.4) : e / 12.92;
375
- },
376
- t = a(this._red),
377
- r = a(this._green),
378
- n = a(this._blue);
379
- return new e.XYZ(.4124564 * t + .3575761 * r + .1804375 * n, .2126729 * t + .7151522 * r + .072175 * n, .0193339 * t + .119192 * r + .9503041 * n,
380
- this._alpha);
381
- }, rgb: function () {
382
- var a = this._x,
383
- t = this._y,
384
- r = this._z,
385
- n = function (e) {
386
- return e > .0031308 ? 1.055 * Math.pow(e, 1 / 2.4) - .055 : 12.92 * e;
387
- };
388
- return new e.RGB(n(3.2404542 * a + -1.5371385 * t + -.4985314 * r), n(-.969266 * a + 1.8760108 * t + .041556 * r),
389
- n(.0556434 * a + -.2040259 * t + 1.0572252 * r), this._alpha);
390
- }, lab: function () {
391
- var a = function (e) {
392
- return e > .008856 ? Math.pow(e, 1 / 3) : 7.787037 * e + 4 / 29;
393
- },
394
- t = a(this._x / 95.047),
395
- r = a(this._y / 100),
396
- n = a(this._z / 108.883);
397
- return new e.LAB(116 * r - 16, 500 * (t - r), 200 * (r - n), this._alpha);
398
- }
399
- });
400
- },
401
- f = function (e) {
402
- e.use(s), e.installColorSpace("LAB", ["l", "a", "b", "alpha"], {
403
- fromRgb: function () {
404
- return this.xyz()
405
- .lab();
406
- }, rgb: function () {
407
- return this.xyz()
408
- .rgb();
409
- }, xyz: function () {
410
- var a = function (e) {
411
- var a = Math.pow(e, 3);
412
- return a > .008856 ? a : (e - 16 / 116) / 7.87;
413
- },
414
- t = (this._l + 16) / 116,
415
- r = this._a / 500 + t,
416
- n = t - this._b / 200;
417
- return new e.XYZ(95.047 * a(r), 100 * a(t), 108.883 * a(n), this._alpha);
418
- }
419
- });
420
- },
421
- u = function (e) {
422
- e.installColorSpace("HSV", ["hue", "saturation", "value", "alpha"], {
423
- rgb: function () {
424
- var a,
425
- t,
426
- r,
427
- n = this._hue,
428
- i = this._saturation,
429
- o = this._value,
430
- s = Math.min(5, Math.floor(6 * n)),
431
- f = 6 * n - s,
432
- u = o * (1 - i),
433
- l = o * (1 - f * i),
434
- h = o * (1 - (1 - f) * i);
435
- switch (s) {
436
- case 0:
437
- a = o, t = h, r = u;
438
- break;
439
- case 1:
440
- a = l, t = o, r = u;
441
- break;
442
- case 2:
443
- a = u, t = o, r = h;
444
- break;
445
- case 3:
446
- a = u, t = l, r = o;
447
- break;
448
- case 4:
449
- a = h, t = u, r = o;
450
- break;
451
- case 5:
452
- a = o, t = u, r = l;
453
- }
454
- return new e.RGB(a, t, r, this._alpha);
455
- }, hsl: function () {
456
- var a,
457
- t = (2 - this._saturation) * this._value,
458
- r = this._saturation * this._value,
459
- n = t <= 1 ? t : 2 - t;
460
- return a = n < 1e-9 ? 0 : r / n, new e.HSL(this._hue, a, t / 2, this._alpha);
461
- }, fromRgb: function () {
462
- var a,
463
- t = this._red,
464
- r = this._green,
465
- n = this._blue,
466
- i = Math.max(t, r, n),
467
- o = Math.min(t, r, n),
468
- s = i - o,
469
- f = 0 === i ? 0 : s / i,
470
- u = i;
471
- if (0 === s) {
472
- a = 0;
473
- } else {
474
- switch (i) {
475
- case t:
476
- a = (r - n) / s / 6 + (r < n ? 1 : 0);
477
- break;
478
- case r:
479
- a = (n - t) / s / 6 + 1 / 3;
480
- break;
481
- case n:
482
- a = (t - r) / s / 6 + 2 / 3;
483
- }
484
- }
485
- return new e.HSV(a, f, u, this._alpha);
486
- }
487
- });
488
- },
489
- l = function (e) {
490
- e.use(u), e.installColorSpace("HSL", ["hue", "saturation", "lightness", "alpha"], {
491
- hsv: function () {
492
- var a,
493
- t = 2 * this._lightness,
494
- r = this._saturation * (t <= 1 ? t : 2 - t);
495
- return a = t + r < 1e-9 ? 0 : 2 * r / (t + r), new e.HSV(this._hue, a, (t + r) / 2, this._alpha);
496
- }, rgb: function () {
497
- return this.hsv()
498
- .rgb();
499
- }, fromRgb: function () {
500
- return this.hsv()
501
- .hsl();
502
- }
503
- });
504
- },
505
- h = function (e) {
506
- e.installColorSpace("CMYK", ["cyan", "magenta", "yellow", "black", "alpha"], {
507
- rgb: function () {
508
- return new e.RGB(1 - this._cyan * (1 - this._black) - this._black, 1 - this._magenta * (1 - this._black) - this._black,
509
- 1 - this._yellow * (1 - this._black) - this._black, this._alpha);
510
- }, fromRgb: function () {
511
- var a = this._red,
512
- t = this._green,
513
- r = this._blue,
514
- n = 1 - a,
515
- i = 1 - t,
516
- o = 1 - r,
517
- s = 1;
518
- return a || t || r ? (s = Math.min(n, Math.min(i, o)), n = (n - s) / (1 - s), i = (i - s) / (1 - s), o = (o - s) / (1 - s)) : s = 1, new e.CMYK(n, i, o,
519
- s, this._alpha);
520
- }
521
- });
522
- },
523
- c = function (e) {
524
- e.namedColors = {
525
- aliceblue: "f0f8ff",
526
- antiquewhite: "faebd7",
527
- aqua: "0ff",
528
- aquamarine: "7fffd4",
529
- azure: "f0ffff",
530
- beige: "f5f5dc",
531
- bisque: "ffe4c4",
532
- black: "000",
533
- blanchedalmond: "ffebcd",
534
- blue: "00f",
535
- blueviolet: "8a2be2",
536
- brown: "a52a2a",
537
- burlywood: "deb887",
538
- cadetblue: "5f9ea0",
539
- chartreuse: "7fff00",
540
- chocolate: "d2691e",
541
- coral: "ff7f50",
542
- cornflowerblue: "6495ed",
543
- cornsilk: "fff8dc",
544
- crimson: "dc143c",
545
- cyan: "0ff",
546
- darkblue: "00008b",
547
- darkcyan: "008b8b",
548
- darkgoldenrod: "b8860b",
549
- darkgray: "a9a9a9",
550
- darkgrey: "a9a9a9",
551
- darkgreen: "006400",
552
- darkkhaki: "bdb76b",
553
- darkmagenta: "8b008b",
554
- darkolivegreen: "556b2f",
555
- darkorange: "ff8c00",
556
- darkorchid: "9932cc",
557
- darkred: "8b0000",
558
- darksalmon: "e9967a",
559
- darkseagreen: "8fbc8f",
560
- darkslateblue: "483d8b",
561
- darkslategray: "2f4f4f",
562
- darkslategrey: "2f4f4f",
563
- darkturquoise: "00ced1",
564
- darkviolet: "9400d3",
565
- deeppink: "ff1493",
566
- deepskyblue: "00bfff",
567
- dimgray: "696969",
568
- dimgrey: "696969",
569
- dodgerblue: "1e90ff",
570
- firebrick: "b22222",
571
- floralwhite: "fffaf0",
572
- forestgreen: "228b22",
573
- fuchsia: "f0f",
574
- gainsboro: "dcdcdc",
575
- ghostwhite: "f8f8ff",
576
- gold: "ffd700",
577
- goldenrod: "daa520",
578
- gray: "808080",
579
- grey: "808080",
580
- green: "008000",
581
- greenyellow: "adff2f",
582
- honeydew: "f0fff0",
583
- hotpink: "ff69b4",
584
- indianred: "cd5c5c",
585
- indigo: "4b0082",
586
- ivory: "fffff0",
587
- khaki: "f0e68c",
588
- lavender: "e6e6fa",
589
- lavenderblush: "fff0f5",
590
- lawngreen: "7cfc00",
591
- lemonchiffon: "fffacd",
592
- lightblue: "add8e6",
593
- lightcoral: "f08080",
594
- lightcyan: "e0ffff",
595
- lightgoldenrodyellow: "fafad2",
596
- lightgray: "d3d3d3",
597
- lightgrey: "d3d3d3",
598
- lightgreen: "90ee90",
599
- lightpink: "ffb6c1",
600
- lightsalmon: "ffa07a",
601
- lightseagreen: "20b2aa",
602
- lightskyblue: "87cefa",
603
- lightslategray: "789",
604
- lightslategrey: "789",
605
- lightsteelblue: "b0c4de",
606
- lightyellow: "ffffe0",
607
- lime: "0f0",
608
- limegreen: "32cd32",
609
- linen: "faf0e6",
610
- magenta: "f0f",
611
- maroon: "800000",
612
- mediumaquamarine: "66cdaa",
613
- mediumblue: "0000cd",
614
- mediumorchid: "ba55d3",
615
- mediumpurple: "9370d8",
616
- mediumseagreen: "3cb371",
617
- mediumslateblue: "7b68ee",
618
- mediumspringgreen: "00fa9a",
619
- mediumturquoise: "48d1cc",
620
- mediumvioletred: "c71585",
621
- midnightblue: "191970",
622
- mintcream: "f5fffa",
623
- mistyrose: "ffe4e1",
624
- moccasin: "ffe4b5",
625
- navajowhite: "ffdead",
626
- navy: "000080",
627
- oldlace: "fdf5e6",
628
- olive: "808000",
629
- olivedrab: "6b8e23",
630
- orange: "ffa500",
631
- orangered: "ff4500",
632
- orchid: "da70d6",
633
- palegoldenrod: "eee8aa",
634
- palegreen: "98fb98",
635
- paleturquoise: "afeeee",
636
- palevioletred: "d87093",
637
- papayawhip: "ffefd5",
638
- peachpuff: "ffdab9",
639
- peru: "cd853f",
640
- pink: "ffc0cb",
641
- plum: "dda0dd",
642
- powderblue: "b0e0e6",
643
- purple: "800080",
644
- rebeccapurple: "639",
645
- red: "f00",
646
- rosybrown: "bc8f8f",
647
- royalblue: "4169e1",
648
- saddlebrown: "8b4513",
649
- salmon: "fa8072",
650
- sandybrown: "f4a460",
651
- seagreen: "2e8b57",
652
- seashell: "fff5ee",
653
- sienna: "a0522d",
654
- silver: "c0c0c0",
655
- skyblue: "87ceeb",
656
- slateblue: "6a5acd",
657
- slategray: "708090",
658
- slategrey: "708090",
659
- snow: "fffafa",
660
- springgreen: "00ff7f",
661
- steelblue: "4682b4",
662
- tan: "d2b48c",
663
- teal: "008080",
664
- thistle: "d8bfd8",
665
- tomato: "ff6347",
666
- turquoise: "40e0d0",
667
- violet: "ee82ee",
668
- wheat: "f5deb3",
669
- white: "fff",
670
- whitesmoke: "f5f5f5",
671
- yellow: "ff0",
672
- yellowgreen: "9acd32"
673
- };
674
- },
675
- d = function (e) {
676
- e.installMethod("clearer", function (e) {
677
- return this.alpha(isNaN(e) ? -.1 : -e, !0);
678
- });
679
- },
680
- b = function (e) {
681
- e.use(l), e.installMethod("darken", function (e) {
682
- return this.lightness(isNaN(e) ? -.1 : -e, !0);
683
- });
684
- },
685
- p = function (e) {
686
- e.use(l), e.installMethod("desaturate", function (e) {
687
- return this.saturation(isNaN(e) ? -.1 : -e, !0);
688
- });
689
- },
690
- g = function (e) {
691
- function a() {
692
- var a = this.rgb(),
693
- t = .3 * a._red + .59 * a._green + .11 * a._blue;
694
- return new e.RGB(t, t, t, a._alpha);
695
- }
696
-
697
- e.installMethod("greyscale", a)
698
- .installMethod("grayscale", a);
699
- },
700
- _ = function (e) {
701
- e.use(l), e.installMethod("lighten", function (e) {
702
- return this.lightness(isNaN(e) ? .1 : e, !0);
703
- });
704
- },
705
- m = function (e) {
706
- e.installMethod("mix", function (a, t) {
707
- a = e(a)
708
- .rgb(), t = 1 - (isNaN(t) ? .5 : t);
709
- var r = 2 * t - 1,
710
- n = this._alpha - a._alpha,
711
- i = ((r * n == -1 ? r : (r + n) / (1 + r * n)) + 1) / 2,
712
- o = 1 - i,
713
- s = this.rgb();
714
- return new e.RGB(s._red * i + a._red * o, s._green * i + a._green * o, s._blue * i + a._blue * o, s._alpha * t + a._alpha * (1 - t));
715
- });
716
- },
717
- w = function (e) {
718
- e.installMethod("negate", function () {
719
- var a = this.rgb();
720
- return new e.RGB(1 - a._red, 1 - a._green, 1 - a._blue, this._alpha);
721
- });
722
- },
723
- y = function (e) {
724
- e.installMethod("opaquer", function (e) {
725
- return this.alpha(isNaN(e) ? .1 : e, !0);
726
- });
727
- },
728
- v = function (e) {
729
- e.use(l), e.installMethod("rotate", function (e) {
730
- return this.hue((e || 0) / 360, !0);
731
- });
732
- },
733
- k = function (e) {
734
- e.use(l), e.installMethod("saturate", function (e) {
735
- return this.saturation(isNaN(e) ? .1 : e, !0);
736
- });
737
- },
738
- M = function (e) {
739
- e.installMethod("toAlpha", function (e) {
740
- var a = this.rgb(),
741
- t = e(e)
742
- .rgb(),
743
- r = new e.RGB(0, 0, 0, a._alpha),
744
- n = ["_red", "_green", "_blue"];
745
- return n.forEach(function (e) {
746
- a[e] < 1e-10 ? r[e] = a[e] : a[e] > t[e] ? r[e] = (a[e] - t[e]) / (1 - t[e]) : a[e] > t[e] ? r[e] = (t[e] - a[e]) / t[e] : r[e] = 0;
747
- }), r._red > r._green ? r._red > r._blue ? a._alpha = r._red : a._alpha = r._blue : r._green > r._blue ? a._alpha = r._green : a._alpha = r._blue, a._alpha < 1e-10 ? a : (n.forEach(
748
- function (e) {
749
- a[e] = (a[e] - t[e]) / a._alpha + t[e];
750
- }), a._alpha *= r._alpha, a);
751
- });
752
- };
753
- return o.use(s)
754
- .use(f)
755
- .use(u)
756
- .use(l)
757
- .use(h)
758
- .use(c)
759
- .use(d)
760
- .use(b)
761
- .use(p)
762
- .use(g)
763
- .use(_)
764
- .use(m)
765
- .use(w)
766
- .use(y)
767
- .use(v)
768
- .use(k)
769
- .use(M);
770
- }
771
- );
772
-
773
- });
774
-
775
- var div = partial(e, "div");
776
-
777
- function e(type, klass, p) {
778
- var elem = document.createElement(type);
779
- elem.className = klass;
780
- p.appendChild(elem);
781
-
782
- return elem;
783
- }
784
-
785
- // http://stackoverflow.com/questions/4394747/javascript-curry-function
786
- function partial(fn) {
787
- var slice = Array.prototype.slice;
788
- var args = slice.apply(arguments, [1]);
789
-
790
- return function () {
791
- return fn.apply(null, args.concat(slice.apply(arguments)));
792
- };
793
- }
794
-
795
- function labelInput(klass, n, p, maxLen) {
796
- var id = "colorPickerInput" + Math.floor(Math.random() * 1001);
797
- var d = div(klass, p);
798
- var l = label(n, d, id);
799
- var i = input("text", d, maxLen, id);
800
-
801
- return {
802
- label: l,
803
- input: i
804
- };
805
- }
806
-
807
- function label(c, p, id) {
808
- var elem = e("label", "", p);
809
- elem.innerHTML = c;
810
-
811
- if (id) {
812
- elem.setAttribute("for", id);
813
- }
814
-
815
- return elem;
816
- }
817
-
818
- function input(t, p, maxLen, id) {
819
- var elem = e("input", "", p);
820
- elem.type = t;
821
-
822
- if (maxLen) {
823
- elem.maxLength = maxLen;
824
- }
825
-
826
- if (id) {
827
- elem.setAttribute("id", id);
828
- }
829
-
830
- if (maxLen) {
831
- elem.maxLength = maxLen;
832
- }
833
-
834
- return elem;
835
- }
836
-
837
- function X(p, a) {
838
- p.style.left = clamp(a * 100, 0, 100) + "%";
839
- }
840
-
841
- function Y(p, a) {
842
- p.style.top = clamp(a * 100, 0, 100) + "%";
843
- }
844
-
845
- function BG(e, c) {
846
- e.style.background = c;
847
- }
848
-
849
- function clamp(a, minValue, maxValue) {
850
- return Math.min(Math.max(a, minValue), maxValue);
851
- }
852
-
853
- var utils = {
854
- clamp: clamp,
855
- e: e,
856
- div: div,
857
- partial: partial,
858
- labelInput: labelInput,
859
- X: X,
860
- Y: Y,
861
- BG: BG
862
- };
863
-
864
- function currentColor(p) {
865
- var e1 = utils.div("currentColorContainer", p);
866
- var e = utils.div("currentColor", e1);
867
-
868
- return {
869
- change: function (col) {
870
- utils.BG(e, col.cssa());
871
- }
872
- };
873
- }
874
-
875
- function fields(p, joe, o) {
876
- var cs = o.space;
877
- var fac = o.limit || 255;
878
- var fix = o.fix >= 0 ? o.fix : 0;
879
- var inputLen = ("" + fac).length + fix;
880
- inputLen = fix ? inputLen + 1 : inputLen;
881
-
882
- var initials = cs.split("");
883
- var useAlpha = cs[cs.length - 1] == "A";
884
- cs = useAlpha ? cs.slice(0, -1) : cs;
885
-
886
- if (["RGB", "HSL", "HSV", "CMYK"].indexOf(cs) < 0) {
887
- return console.warn("Invalid field names", cs);
888
- }
889
-
890
- var c = utils.div("colorFields", p);
891
- var elems = initials.map(function (n) {
892
- n = n.toLowerCase();
893
-
894
- var e = utils.labelInput("color " + n, n, c, inputLen);
895
- e.input.onblur = done;
896
- e.input.onkeydown = validate;
897
- e.input.onkeyup = update;
898
-
899
- return {
900
- name: n,
901
- e: e
902
- };
903
- });
904
-
905
- function done() {
906
- joe.done();
907
- }
908
-
909
- function validate(e) {
910
- if (!(e.ctrlKey || e.altKey) && /^[a-zA-Z]$/.test(e.key)) {
911
- e.preventDefault();
912
- }
913
- }
914
-
915
- function update() {
916
- var col = [cs];
917
-
918
- elems.forEach(function (o) {
919
- col.push(o.e.input.value / fac);
920
- });
921
-
922
- if (!useAlpha) {
923
- col.push(joe.getAlpha());
924
- }
925
-
926
- joe.set(col);
927
- }
928
-
929
- return {
930
- change: function (col) {
931
- elems.forEach(function (o) {
932
- o.e.input.value = (col[o.name]() * fac).toFixed(fix);
933
- });
934
- }
935
- };
936
- }
937
-
938
- function alpha(p, joe) {
939
- var e = dragjs_umd.slider({
940
- parent: p,
941
- "class": "oned alpha chequered",
942
- cbs: {
943
- begin: change,
944
- change: change,
945
- end: done
946
- }
947
- });
948
-
949
- function done() {
950
- joe.done();
951
- }
952
-
953
- function change(p) {
954
- var val = utils.clamp(p.y, 0, 1);
955
-
956
- utils.Y(p.pointer, val);
957
- joe.setAlpha(1 - val);
958
- }
959
-
960
- return {
961
- change: function (col) {
962
- utils.Y(e.pointer, 1 - col.alpha());
963
- }
964
- };
965
- }
966
-
967
- function hex(p, joe, o) {
968
- var e = utils.labelInput("hex", o.label || "", p, 7);
969
- e.input.value = "#";
970
-
971
- e.input.onkeyup = function (elem) {
972
- var key = elem.keyCode || elem.which;
973
- var val = elem.target.value;
974
- val = val[0] == "#" ? val : "#" + val;
975
- val = pad(val, 7, "0");
976
-
977
- if (key == 13) {
978
- joe.set(val);
979
- }
980
- };
981
-
982
- e.input.onblur = function (elem) {
983
- joe.set(elem.target.value);
984
- joe.done();
985
- };
986
-
987
- return {
988
- change: function (col) {
989
- e.input.value = e.input.value[0] == "#" ? "#" : "";
990
- e.input.value += col.hex()
991
- .slice(1);
992
- }
993
- };
994
- }
995
-
996
- function close(p, joe, o) {
997
- var elem = utils.e("a", o["class"] || "close", p);
998
- elem.href = "#";
999
- elem.innerHTML = o.label || "Close";
1000
-
1001
- elem.onclick = function (e) {
1002
- e.preventDefault();
1003
-
1004
- joe.hide();
1005
- };
1006
- }
1007
-
1008
- function pad(a, n, c) {
1009
- var ret = a;
1010
-
1011
- for (var i = a.length; i < n; i++) {
1012
- ret += c;
1013
- }
1014
-
1015
- return ret;
1016
- }
1017
-
1018
- var extras = {
1019
- currentColor: currentColor,
1020
- fields: fields,
1021
- hex: hex,
1022
- alpha: alpha,
1023
- close: close
1024
- };
1025
-
1026
- // Use the all build with cmyk and everything
1027
-
1028
- var colorjoe = function (cbs) {
1029
- if (!all(isFunction, [cbs.init, cbs.xy, cbs.z])) {
1030
- return console.warn("colorjoe: missing cb");
1031
- }
1032
-
1033
- return function (element, initialColor, extras$$1) {
1034
- return setup({
1035
- e: element,
1036
- color: initialColor,
1037
- cbs: cbs,
1038
- extras: extras$$1
1039
- });
1040
- };
1041
- };
1042
-
1043
- /* pickers */
1044
- colorjoe.rgb = colorjoe({
1045
- init: function (col, xy, z) {
1046
- var ret = oneColorAll(col)
1047
- .hsv();
1048
-
1049
- this.xy(ret, {x: ret.saturation(), y: 1 - ret.value()}, xy, z);
1050
- this.z(ret, ret.hue(), xy, z);
1051
-
1052
- return ret;
1053
- },
1054
- xy: function (col, p, xy) {
1055
- utils.X(xy.pointer, p.x);
1056
- utils.Y(xy.pointer, p.y);
1057
-
1058
- return col.saturation(p.x)
1059
- .value(1 - p.y);
1060
- },
1061
- z: function (col, v, xy, z) {
1062
- utils.Y(z.pointer, v);
1063
- RGB_BG(xy.background, v);
1064
-
1065
- return col.hue(v);
1066
- }
1067
- });
1068
-
1069
- colorjoe.hsl = colorjoe({
1070
- init: function (col, xy, z) {
1071
- var ret = oneColorAll(col)
1072
- .hsl();
1073
-
1074
- this.xy(ret, {x: ret.hue(), y: 1 - ret.saturation()}, xy, z);
1075
- this.z(ret, 1 - ret.lightness(), xy, z);
1076
-
1077
- return ret;
1078
- },
1079
- xy: function (col, p, xy, z) {
1080
- utils.X(xy.pointer, p.x);
1081
- utils.Y(xy.pointer, p.y);
1082
- RGB_BG(z.background, p.x);
1083
-
1084
- return col.hue(p.x)
1085
- .saturation(1 - p.y);
1086
- },
1087
- z: function (col, v, xy, z) {
1088
- utils.Y(z.pointer, v);
1089
-
1090
- return col.lightness(1 - v);
1091
- }
1092
- });
1093
-
1094
- colorjoe.extras = {};
1095
-
1096
- colorjoe.registerExtra = function (name, fn) {
1097
- if (name in colorjoe.extras) {
1098
- console.warn("Extra \"" + name + "\"has been registered already!");
1099
- }
1100
-
1101
- colorjoe.extras[name] = fn;
1102
- };
1103
-
1104
- for (var k in extras) {
1105
- colorjoe.registerExtra(k, extras[k]);
1106
- }
1107
-
1108
- function RGB_BG(e, h) {
1109
- utils.BG(e, new oneColorAll.HSV(h, 1, 1).cssa());
1110
- }
1111
-
1112
- function setup(o) {
1113
- if (!o.e) {
1114
- return console.warn("colorjoe: missing element");
1115
- }
1116
-
1117
- var e = isString(o.e) ? document.getElementById(o.e) : o.e;
1118
- e.className = "colorPicker";
1119
-
1120
- var cbs = o.cbs;
1121
-
1122
- var xy = dragjs_umd.xyslider({
1123
- parent: e,
1124
- class: "twod",
1125
- cbs: {
1126
- begin: changeXY,
1127
- change: changeXY,
1128
- end: done
1129
- }
1130
- });
1131
-
1132
- function changeXY(p) {
1133
- col = cbs.xy(
1134
- col,
1135
- {
1136
- x: utils.clamp(p.x, 0, 1),
1137
- y: utils.clamp(p.y, 0, 1)
1138
- },
1139
- xy,
1140
- z
1141
- );
1142
- changed();
1143
- }
1144
-
1145
- var z = dragjs_umd.slider({
1146
- parent: e,
1147
- class: "oned",
1148
- cbs: {
1149
- begin: changeZ,
1150
- change: changeZ,
1151
- end: done
1152
- }
1153
- });
1154
-
1155
- function changeZ(p) {
1156
- col = cbs.z(col, utils.clamp(p.y, 0, 1), xy, z);
1157
- changed();
1158
- }
1159
-
1160
- // Initial color
1161
- var previous = getColor(o.color);
1162
- var col = cbs.init(previous, xy, z);
1163
- var listeners = {change: [], done: []};
1164
-
1165
- function changed(skip) {
1166
- skip = isArray(skip) ? skip : [];
1167
-
1168
- var li = listeners.change;
1169
- var v;
1170
-
1171
- for (var i = 0, len = li.length; i < len; i++) {
1172
- v = li[i];
1173
- if (skip.indexOf(v.name) == -1) {
1174
- v.fn(col);
1175
- }
1176
- }
1177
- }
1178
-
1179
- function done() {
1180
- // Do not call done callback if the color did not change
1181
- if (previous.equals(col)) {
1182
- return;
1183
- }
1184
-
1185
- for (var i = 0, len = listeners.done.length; i < len; i++) {
1186
- listeners.done[i].fn(col);
1187
- }
1188
-
1189
- previous = col;
1190
- }
1191
-
1192
- var ob = {
1193
- e: e,
1194
- done: function () {
1195
- done();
1196
-
1197
- return this;
1198
- },
1199
- update: function (skip) {
1200
- changed(skip);
1201
-
1202
- return this;
1203
- },
1204
- hide: function () {
1205
- e.style.display = "none";
1206
-
1207
- return this;
1208
- },
1209
- show: function () {
1210
- e.style.display = "";
1211
-
1212
- return this;
1213
- },
1214
- get: function () {
1215
- return col;
1216
- },
1217
- set: function (c) {
1218
- var oldCol = this.get();
1219
- col = cbs.init(getColor(c), xy, z);
1220
-
1221
- if (!oldCol.equals(col)) {
1222
- this.update();
1223
- }
1224
-
1225
- return this;
1226
- },
1227
- getAlpha: function () {
1228
- return col.alpha();
1229
- },
1230
- setAlpha: function (v) {
1231
- col = col.alpha(v);
1232
-
1233
- this.update();
1234
-
1235
- return this;
1236
- },
1237
- on: function (evt, cb, name) {
1238
- if (evt == "change" || evt == "done") {
1239
- listeners[evt].push({name: name, fn: cb});
1240
- } else {
1241
- console.warn(
1242
- "Passed invalid evt name \"" + evt + "\" to colorjoe.on"
1243
- );
1244
- }
1245
-
1246
- return this;
1247
- },
1248
- removeAllListeners: function (evt) {
1249
- if (evt) {
1250
- listeners[evt] = [];
1251
- } else {
1252
- for (var key in listeners) {
1253
- listeners[key] = [];
1254
- }
1255
- }
1256
-
1257
- return this;
1258
- }
1259
- };
1260
-
1261
- setupExtras(e, ob, o.extras);
1262
- changed();
1263
-
1264
- return ob;
1265
- }
1266
-
1267
- function getColor(c) {
1268
- if (!isDefined(c)) {
1269
- return oneColorAll("#000");
1270
- }
1271
- if (c.isColor) {
1272
- return c;
1273
- }
1274
-
1275
- var ret = oneColorAll(c);
1276
-
1277
- if (ret) {
1278
- return ret;
1279
- }
1280
-
1281
- if (isDefined(c)) {
1282
- console.warn("Passed invalid color to colorjoe, using black instead");
1283
- }
1284
-
1285
- return oneColorAll("#000");
1286
- }
1287
-
1288
- function setupExtras(p, joe, extras$$1) {
1289
- if (!extras$$1) {
1290
- return;
1291
- }
1292
-
1293
- var c = utils.div("extras", p);
1294
- var cbs;
1295
- var name;
1296
- var params;
1297
-
1298
- extras$$1.forEach(function (e, i) {
1299
- if (isArray(e)) {
1300
- name = e[0];
1301
- params = e.length > 1 ? e[1] : {};
1302
- } else {
1303
- name = e;
1304
- params = {};
1305
- }
1306
- var extra = name in colorjoe.extras ? colorjoe.extras[name] : null;
1307
-
1308
- if (extra) {
1309
- cbs = extra(c, extraProxy(joe, name + i), params);
1310
- for (var k in cbs) {
1311
- joe.on(k, cbs[k], name);
1312
- }
1313
- }
1314
- });
1315
- }
1316
-
1317
- function extraProxy(joe, name) {
1318
- var ret = copy(joe);
1319
-
1320
- ret.update = function () {
1321
- joe.update([name]);
1322
- };
1323
-
1324
- return ret;
1325
- }
1326
-
1327
- function copy(o) {
1328
- // returns a shallow copy
1329
- var ret = {};
1330
-
1331
- for (var k in o) {
1332
- ret[k] = o[k];
1333
- }
1334
-
1335
- return ret;
1336
- }
1337
-
1338
- function all(cb, a) {
1339
- return a.map(cb)
1340
- .filter(id).length == a.length;
1341
- }
1342
-
1343
- function isArray(o) {
1344
- return Object.prototype.toString.call(o) === "[object Array]";
1345
- }
1346
-
1347
- function isString(o) {
1348
- return typeof o === "string";
1349
- }
1350
-
1351
- function isDefined(input) {
1352
- return typeof input !== "undefined";
1353
- }
1354
-
1355
- function isFunction(input) {
1356
- return typeof input === "function";
1357
- }
1358
-
1359
- function id(a) {
1360
- return a;
1361
- }
1362
-
1363
- var colorjoe_1 = colorjoe;
1364
- window.OneColor = oneColorAll;
1365
- return colorjoe_1;
1366
-
1367
- }),
1368
- colorjoe = factory();
1369
-
1370
- export default colorjoe;