@hpcc-js/other 2.16.2 → 2.17.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.
package/dist/index.js CHANGED
@@ -20,8 +20,8 @@
20
20
  }
21
21
 
22
22
  var PKG_NAME = "@hpcc-js/other";
23
- var PKG_VERSION = "2.16.2";
24
- var BUILD_VERSION = "2.106.4";
23
+ var PKG_VERSION = "2.17.1";
24
+ var BUILD_VERSION = "2.108.2";
25
25
 
26
26
  /******************************************************************************
27
27
  Copyright (c) Microsoft Corporation.
@@ -37,7 +37,7 @@
37
37
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38
38
  PERFORMANCE OF THIS SOFTWARE.
39
39
  ***************************************************************************** */
40
- /* global Reflect, Promise, SuppressedError, Symbol */
40
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
41
41
 
42
42
  var extendStatics = function(d, b) {
43
43
  extendStatics = Object.setPrototypeOf ||
@@ -253,247 +253,254 @@
253
253
  License: http://www.opensource.org/licenses/mit-license.php
254
254
  */
255
255
 
256
- (function (module) {
257
- var autoComplete = (function(){
258
- // "use strict";
259
- function autoComplete(options){
260
- if (!document.querySelector) return;
261
-
262
- // helpers
263
- function hasClass(el, className){ return el.classList ? el.classList.contains(className) : new RegExp('\\b'+ className+'\\b').test(el.className); }
264
-
265
- function addEvent(el, type, handler){
266
- if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
267
- }
268
- function removeEvent(el, type, handler){
269
- // if (el.removeEventListener) not working in IE11
270
- if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
271
- }
272
- function live(elClass, event, cb, context){
273
- addEvent(context || document, event, function(e){
274
- var found, el = e.target || e.srcElement;
275
- while (el && !(found = hasClass(el, elClass))) el = el.parentElement;
276
- if (found) cb.call(el, e);
277
- });
278
- }
279
-
280
- var o = {
281
- selector: 0,
282
- source: 0,
283
- minChars: 3,
284
- delay: 150,
285
- offsetLeft: 0,
286
- offsetTop: 1,
287
- cache: 1,
288
- menuClass: '',
289
- renderItem: function (item, search){
290
- // escape special characters
291
- search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
292
- var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
293
- return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
294
- },
295
- onSelect: function(e, term, item){}
296
- };
297
- for (var k in options) { if (options.hasOwnProperty(k)) o[k] = options[k]; }
298
-
299
- // init
300
- var elems = typeof o.selector == 'object' ? [o.selector] : document.querySelectorAll(o.selector);
301
- for (var i=0; i<elems.length; i++) {
302
- var that = elems[i];
303
-
304
- // create suggestions container "sc"
305
- that.sc = document.createElement('div');
306
- that.sc.className = 'autocomplete-suggestions '+o.menuClass;
307
-
308
- that.autocompleteAttr = that.getAttribute('autocomplete');
309
- that.setAttribute('autocomplete', 'off');
310
- that.cache = {};
311
- that.last_val = '';
312
-
313
- that.updateSC = function(resize, next){
314
- var rect = that.getBoundingClientRect();
315
- that.sc.style.left = Math.round(rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft) + 'px';
316
- that.sc.style.top = Math.round(rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + o.offsetTop) + 'px';
317
- that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
318
- if (!resize) {
319
- that.sc.style.display = 'block';
320
- that.sc.classList.remove('hide');
321
- if (!that.sc.maxHeight) { that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight); }
322
- if (!that.sc.suggestionHeight) that.sc.suggestionHeight = that.sc.querySelector('.autocomplete-suggestion').offsetHeight;
323
- if (that.sc.suggestionHeight)
324
- if (!next) that.sc.scrollTop = 0;
325
- else {
326
- var scrTop = that.sc.scrollTop, selTop = next.getBoundingClientRect().top - that.sc.getBoundingClientRect().top;
327
- if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0)
328
- that.sc.scrollTop = selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight;
329
- else if (selTop < 0)
330
- that.sc.scrollTop = selTop + scrTop;
331
- }
332
- }
333
- };
334
- addEvent(window, 'resize', that.updateSC);
335
- document.body.appendChild(that.sc);
336
-
337
- live('autocomplete-suggestion', 'mouseleave', function(e){
338
- var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
339
- if (sel) setTimeout(function(){ sel.className = sel.className.replace('selected', ''); }, 20);
340
- }, that.sc);
341
-
342
- live('autocomplete-suggestion', 'mouseover', function(e){
343
- var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
344
- if (sel) sel.className = sel.className.replace('selected', '');
345
- this.className += ' selected';
346
- }, that.sc);
347
-
348
- live('autocomplete-suggestion', 'mousedown', function(e){
349
- if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
350
- var v = this.getAttribute('data-val');
351
- that.value = v;
352
- o.onSelect(e, v, this);
353
- that.sc.style.display = 'none';
354
- that.sc.classList.add("hide");
355
-
356
- }
357
- }, that.sc);
358
-
359
- that.blurHandler = function(){
360
- try { var over_sb = document.querySelector('.autocomplete-suggestions:hover'); } catch(e){ var over_sb = 0; }
361
- if (!over_sb) {
362
- that.last_val = that.value;
363
- that.sc.style.display = 'none';
364
- that.sc.classList.add("hide");
365
- setTimeout(function(){
366
- that.sc.style.display = 'none';
367
- that.sc.classList.add("hide");
368
- }, 350); // hide suggestions on fast input
369
- } else if (that !== document.activeElement) setTimeout(function(){ that.focus(); }, 20);
370
- };
371
- addEvent(that, 'blur', that.blurHandler);
372
-
373
- var suggest = function(data, val){
374
- if (!val) {
375
- var val = that.value;
376
- }
377
- that.cache[val] = data;
378
- if (data.length && val.length >= o.minChars) {
379
- var s = '';
380
- for (var i=0;i<data.length;i++) s += o.renderItem(data[i], val);
381
- that.sc.innerHTML = s;
382
- that.updateSC(0);
383
- }
384
- else {
385
- that.sc.style.display = 'none';
386
- that.sc.classList.add("hide");
387
- }
388
- };
389
-
390
- that.keydownHandler = function(e){
391
- var key = window.event ? e.keyCode : e.which;
392
- // down (40), up (38)
393
- if ((key == 40 || key == 38) && that.sc.innerHTML) {
394
- var next, sel = that.sc.querySelector('.autocomplete-suggestion.selected');
395
- if (!sel) {
396
- next = (key == 40) ? that.sc.querySelector('.autocomplete-suggestion') : that.sc.childNodes[that.sc.childNodes.length - 1]; // first : last
397
- next.className += ' selected';
398
- that.value = next.getAttribute('data-val');
399
- } else {
400
- next = (key == 40) ? sel.nextSibling : sel.previousSibling;
401
- if (next) {
402
- sel.className = sel.className.replace('selected', '');
403
- next.className += ' selected';
404
- that.value = next.getAttribute('data-val');
405
- }
406
- else { sel.className = sel.className.replace('selected', ''); that.value = that.last_val; next = 0; }
407
- }
408
- that.updateSC(0, next);
409
- return false;
410
- }
411
- // esc
412
- else if (key == 27) {
413
- that.value = that.last_val;
414
- that.sc.style.display = 'none';
415
- that.sc.classList.add("hide");
416
- }
417
- // enter
418
- else if (key == 13 || key == 9) {
419
- if (that.sc.style.display !== 'none') {
420
- e.preventDefault();
421
- }
422
- var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
423
- if (sel && that.sc.style.display != 'none') {
424
- o.onSelect(e, sel.getAttribute('data-val'), sel);
425
- setTimeout(function(){
426
- that.sc.style.display = 'none';
427
- that.sc.classList.add("hide");
428
- }, 20); }
429
- }
430
- };
431
- addEvent(that, 'keydown', that.keydownHandler);
432
-
433
- that.keyupHandler = function(e){
434
- var key = window.event ? e.keyCode : e.which;
435
- if (!key || (key < 35 || key > 40) && key != 13 && key != 27) {
436
- var val = that.value;
437
- if (val.length >= o.minChars) {
438
- if (val != that.last_val) {
439
- that.last_val = val;
440
- clearTimeout(that.timer);
441
- if (o.cache) {
442
- if (val in that.cache) { suggest(that.cache[val]); return; }
443
- // no requests if previous suggestions were empty
444
- for (var i=1; i<val.length-o.minChars; i++) {
445
- var part = val.slice(0, val.length-i);
446
- if (part in that.cache && !that.cache[part].length) { suggest([]); return; }
447
- }
448
- }
449
- that.timer = setTimeout(function(){ o.source(val, suggest); }, o.delay);
450
- }
451
- } else {
452
- that.last_val = val;
453
- that.sc.style.display = 'none';
454
- that.sc.classList.add("hide");
455
- }
456
- }
457
- };
458
- addEvent(that, 'keyup', that.keyupHandler);
459
-
460
- that.focusHandler = function(e){
461
- that.last_val = '\n';
462
- that.keyupHandler(e);
463
- };
464
- if (!o.minChars) addEvent(that, 'focus', that.focusHandler);
465
- }
466
-
467
- // public destroy method
468
- this.destroy = function(){
469
- for (var i=0; i<elems.length; i++) {
470
- var that = elems[i];
471
- removeEvent(window, 'resize', that.updateSC);
472
- removeEvent(that, 'blur', that.blurHandler);
473
- removeEvent(that, 'focus', that.focusHandler);
474
- removeEvent(that, 'keydown', that.keydownHandler);
475
- removeEvent(that, 'keyup', that.keyupHandler);
476
- if (that.autocompleteAttr)
477
- that.setAttribute('autocomplete', that.autocompleteAttr);
478
- else
479
- that.removeAttribute('autocomplete');
480
- document.body.removeChild(that.sc);
481
- that = null;
482
- }
483
- };
484
- }
485
- return autoComplete;
486
- })();
487
-
488
- (function(){
489
- if (module.exports)
490
- module.exports = autoComplete;
491
- else
492
- window.autoComplete = autoComplete;
493
- })();
494
- } (autoComplete$1));
495
-
496
- var autoCompleteExports = autoComplete$1.exports;
256
+ var hasRequiredAutoComplete;
257
+
258
+ function requireAutoComplete () {
259
+ if (hasRequiredAutoComplete) return autoComplete$1.exports;
260
+ hasRequiredAutoComplete = 1;
261
+ (function (module) {
262
+ var autoComplete = (function(){
263
+ // "use strict";
264
+ function autoComplete(options){
265
+ if (!document.querySelector) return;
266
+
267
+ // helpers
268
+ function hasClass(el, className){ return el.classList ? el.classList.contains(className) : new RegExp('\\b'+ className+'\\b').test(el.className); }
269
+
270
+ function addEvent(el, type, handler){
271
+ if (el.attachEvent) el.attachEvent('on'+type, handler); else el.addEventListener(type, handler);
272
+ }
273
+ function removeEvent(el, type, handler){
274
+ // if (el.removeEventListener) not working in IE11
275
+ if (el.detachEvent) el.detachEvent('on'+type, handler); else el.removeEventListener(type, handler);
276
+ }
277
+ function live(elClass, event, cb, context){
278
+ addEvent(context || document, event, function(e){
279
+ var found, el = e.target || e.srcElement;
280
+ while (el && !(found = hasClass(el, elClass))) el = el.parentElement;
281
+ if (found) cb.call(el, e);
282
+ });
283
+ }
284
+
285
+ var o = {
286
+ selector: 0,
287
+ source: 0,
288
+ minChars: 3,
289
+ delay: 150,
290
+ offsetLeft: 0,
291
+ offsetTop: 1,
292
+ cache: 1,
293
+ menuClass: '',
294
+ renderItem: function (item, search){
295
+ // escape special characters
296
+ search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
297
+ var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
298
+ return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item.replace(re, "<b>$1</b>") + '</div>';
299
+ },
300
+ onSelect: function(e, term, item){}
301
+ };
302
+ for (var k in options) { if (options.hasOwnProperty(k)) o[k] = options[k]; }
303
+
304
+ // init
305
+ var elems = typeof o.selector == 'object' ? [o.selector] : document.querySelectorAll(o.selector);
306
+ for (var i=0; i<elems.length; i++) {
307
+ var that = elems[i];
308
+
309
+ // create suggestions container "sc"
310
+ that.sc = document.createElement('div');
311
+ that.sc.className = 'autocomplete-suggestions '+o.menuClass;
312
+
313
+ that.autocompleteAttr = that.getAttribute('autocomplete');
314
+ that.setAttribute('autocomplete', 'off');
315
+ that.cache = {};
316
+ that.last_val = '';
317
+
318
+ that.updateSC = function(resize, next){
319
+ var rect = that.getBoundingClientRect();
320
+ that.sc.style.left = Math.round(rect.left + (window.pageXOffset || document.documentElement.scrollLeft) + o.offsetLeft) + 'px';
321
+ that.sc.style.top = Math.round(rect.bottom + (window.pageYOffset || document.documentElement.scrollTop) + o.offsetTop) + 'px';
322
+ that.sc.style.width = Math.round(rect.right - rect.left) + 'px'; // outerWidth
323
+ if (!resize) {
324
+ that.sc.style.display = 'block';
325
+ that.sc.classList.remove('hide');
326
+ if (!that.sc.maxHeight) { that.sc.maxHeight = parseInt((window.getComputedStyle ? getComputedStyle(that.sc, null) : that.sc.currentStyle).maxHeight); }
327
+ if (!that.sc.suggestionHeight) that.sc.suggestionHeight = that.sc.querySelector('.autocomplete-suggestion').offsetHeight;
328
+ if (that.sc.suggestionHeight)
329
+ if (!next) that.sc.scrollTop = 0;
330
+ else {
331
+ var scrTop = that.sc.scrollTop, selTop = next.getBoundingClientRect().top - that.sc.getBoundingClientRect().top;
332
+ if (selTop + that.sc.suggestionHeight - that.sc.maxHeight > 0)
333
+ that.sc.scrollTop = selTop + that.sc.suggestionHeight + scrTop - that.sc.maxHeight;
334
+ else if (selTop < 0)
335
+ that.sc.scrollTop = selTop + scrTop;
336
+ }
337
+ }
338
+ };
339
+ addEvent(window, 'resize', that.updateSC);
340
+ document.body.appendChild(that.sc);
341
+
342
+ live('autocomplete-suggestion', 'mouseleave', function(e){
343
+ var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
344
+ if (sel) setTimeout(function(){ sel.className = sel.className.replace('selected', ''); }, 20);
345
+ }, that.sc);
346
+
347
+ live('autocomplete-suggestion', 'mouseover', function(e){
348
+ var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
349
+ if (sel) sel.className = sel.className.replace('selected', '');
350
+ this.className += ' selected';
351
+ }, that.sc);
352
+
353
+ live('autocomplete-suggestion', 'mousedown', function(e){
354
+ if (hasClass(this, 'autocomplete-suggestion')) { // else outside click
355
+ var v = this.getAttribute('data-val');
356
+ that.value = v;
357
+ o.onSelect(e, v, this);
358
+ that.sc.style.display = 'none';
359
+ that.sc.classList.add("hide");
360
+
361
+ }
362
+ }, that.sc);
363
+
364
+ that.blurHandler = function(){
365
+ try { var over_sb = document.querySelector('.autocomplete-suggestions:hover'); } catch(e){ var over_sb = 0; }
366
+ if (!over_sb) {
367
+ that.last_val = that.value;
368
+ that.sc.style.display = 'none';
369
+ that.sc.classList.add("hide");
370
+ setTimeout(function(){
371
+ that.sc.style.display = 'none';
372
+ that.sc.classList.add("hide");
373
+ }, 350); // hide suggestions on fast input
374
+ } else if (that !== document.activeElement) setTimeout(function(){ that.focus(); }, 20);
375
+ };
376
+ addEvent(that, 'blur', that.blurHandler);
377
+
378
+ var suggest = function(data, val){
379
+ if (!val) {
380
+ var val = that.value;
381
+ }
382
+ that.cache[val] = data;
383
+ if (data.length && val.length >= o.minChars) {
384
+ var s = '';
385
+ for (var i=0;i<data.length;i++) s += o.renderItem(data[i], val);
386
+ that.sc.innerHTML = s;
387
+ that.updateSC(0);
388
+ }
389
+ else {
390
+ that.sc.style.display = 'none';
391
+ that.sc.classList.add("hide");
392
+ }
393
+ };
394
+
395
+ that.keydownHandler = function(e){
396
+ var key = window.event ? e.keyCode : e.which;
397
+ // down (40), up (38)
398
+ if ((key == 40 || key == 38) && that.sc.innerHTML) {
399
+ var next, sel = that.sc.querySelector('.autocomplete-suggestion.selected');
400
+ if (!sel) {
401
+ next = (key == 40) ? that.sc.querySelector('.autocomplete-suggestion') : that.sc.childNodes[that.sc.childNodes.length - 1]; // first : last
402
+ next.className += ' selected';
403
+ that.value = next.getAttribute('data-val');
404
+ } else {
405
+ next = (key == 40) ? sel.nextSibling : sel.previousSibling;
406
+ if (next) {
407
+ sel.className = sel.className.replace('selected', '');
408
+ next.className += ' selected';
409
+ that.value = next.getAttribute('data-val');
410
+ }
411
+ else { sel.className = sel.className.replace('selected', ''); that.value = that.last_val; next = 0; }
412
+ }
413
+ that.updateSC(0, next);
414
+ return false;
415
+ }
416
+ // esc
417
+ else if (key == 27) {
418
+ that.value = that.last_val;
419
+ that.sc.style.display = 'none';
420
+ that.sc.classList.add("hide");
421
+ }
422
+ // enter
423
+ else if (key == 13 || key == 9) {
424
+ if (that.sc.style.display !== 'none') {
425
+ e.preventDefault();
426
+ }
427
+ var sel = that.sc.querySelector('.autocomplete-suggestion.selected');
428
+ if (sel && that.sc.style.display != 'none') {
429
+ o.onSelect(e, sel.getAttribute('data-val'), sel);
430
+ setTimeout(function(){
431
+ that.sc.style.display = 'none';
432
+ that.sc.classList.add("hide");
433
+ }, 20); }
434
+ }
435
+ };
436
+ addEvent(that, 'keydown', that.keydownHandler);
437
+
438
+ that.keyupHandler = function(e){
439
+ var key = window.event ? e.keyCode : e.which;
440
+ if (!key || (key < 35 || key > 40) && key != 13 && key != 27) {
441
+ var val = that.value;
442
+ if (val.length >= o.minChars) {
443
+ if (val != that.last_val) {
444
+ that.last_val = val;
445
+ clearTimeout(that.timer);
446
+ if (o.cache) {
447
+ if (val in that.cache) { suggest(that.cache[val]); return; }
448
+ // no requests if previous suggestions were empty
449
+ for (var i=1; i<val.length-o.minChars; i++) {
450
+ var part = val.slice(0, val.length-i);
451
+ if (part in that.cache && !that.cache[part].length) { suggest([]); return; }
452
+ }
453
+ }
454
+ that.timer = setTimeout(function(){ o.source(val, suggest); }, o.delay);
455
+ }
456
+ } else {
457
+ that.last_val = val;
458
+ that.sc.style.display = 'none';
459
+ that.sc.classList.add("hide");
460
+ }
461
+ }
462
+ };
463
+ addEvent(that, 'keyup', that.keyupHandler);
464
+
465
+ that.focusHandler = function(e){
466
+ that.last_val = '\n';
467
+ that.keyupHandler(e);
468
+ };
469
+ if (!o.minChars) addEvent(that, 'focus', that.focusHandler);
470
+ }
471
+
472
+ // public destroy method
473
+ this.destroy = function(){
474
+ for (var i=0; i<elems.length; i++) {
475
+ var that = elems[i];
476
+ removeEvent(window, 'resize', that.updateSC);
477
+ removeEvent(that, 'blur', that.blurHandler);
478
+ removeEvent(that, 'focus', that.focusHandler);
479
+ removeEvent(that, 'keydown', that.keydownHandler);
480
+ removeEvent(that, 'keyup', that.keyupHandler);
481
+ if (that.autocompleteAttr)
482
+ that.setAttribute('autocomplete', that.autocompleteAttr);
483
+ else
484
+ that.removeAttribute('autocomplete');
485
+ document.body.removeChild(that.sc);
486
+ that = null;
487
+ }
488
+ };
489
+ }
490
+ return autoComplete;
491
+ })();
492
+
493
+ (function(){
494
+ if (module.exports)
495
+ module.exports = autoComplete;
496
+ else
497
+ window.autoComplete = autoComplete;
498
+ })();
499
+ } (autoComplete$1));
500
+ return autoComplete$1.exports;
501
+ }
502
+
503
+ var autoCompleteExports = requireAutoComplete();
497
504
  var autoComplete = /*@__PURE__*/getDefaultExportFromCjs(autoCompleteExports);
498
505
 
499
506
  var AutoComplete = /*#__PURE__*/_mergeNamespaces({
@@ -670,7 +677,7 @@
670
677
  if (step < 0) while (++step <= 0) {
671
678
  while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
672
679
  } else while (--step >= 0) {
673
- while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
680
+ while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty
674
681
  }
675
682
  }
676
683
  });
@@ -2390,151 +2397,158 @@
2390
2397
 
2391
2398
  var simpleheat$2 = {exports: {}};
2392
2399
 
2393
- (function (module) {
2394
-
2395
- module.exports = simpleheat;
2396
-
2397
- function simpleheat(canvas) {
2398
- if (!(this instanceof simpleheat)) return new simpleheat(canvas);
2399
-
2400
- this._canvas = canvas = typeof canvas === 'string' ? document.getElementById(canvas) : canvas;
2401
-
2402
- this._ctx = canvas.getContext('2d');
2403
- this._width = canvas.width;
2404
- this._height = canvas.height;
2405
-
2406
- this._max = 1;
2407
- this._data = [];
2408
- }
2409
-
2410
- simpleheat.prototype = {
2400
+ var hasRequiredSimpleheat;
2411
2401
 
2412
- defaultRadius: 25,
2402
+ function requireSimpleheat () {
2403
+ if (hasRequiredSimpleheat) return simpleheat$2.exports;
2404
+ hasRequiredSimpleheat = 1;
2405
+ (function (module) {
2413
2406
 
2414
- defaultGradient: {
2415
- 0.4: 'blue',
2416
- 0.6: 'cyan',
2417
- 0.7: 'lime',
2418
- 0.8: 'yellow',
2419
- 1.0: 'red'
2420
- },
2407
+ module.exports = simpleheat;
2421
2408
 
2422
- data: function (data) {
2423
- this._data = data;
2424
- return this;
2425
- },
2409
+ function simpleheat(canvas) {
2410
+ if (!(this instanceof simpleheat)) return new simpleheat(canvas);
2426
2411
 
2427
- max: function (max) {
2428
- this._max = max;
2429
- return this;
2430
- },
2412
+ this._canvas = canvas = typeof canvas === 'string' ? document.getElementById(canvas) : canvas;
2431
2413
 
2432
- add: function (point) {
2433
- this._data.push(point);
2434
- return this;
2435
- },
2414
+ this._ctx = canvas.getContext('2d');
2415
+ this._width = canvas.width;
2416
+ this._height = canvas.height;
2436
2417
 
2437
- clear: function () {
2438
- this._data = [];
2439
- return this;
2440
- },
2418
+ this._max = 1;
2419
+ this._data = [];
2420
+ }
2441
2421
 
2442
- radius: function (r, blur) {
2443
- blur = blur === undefined ? 15 : blur;
2422
+ simpleheat.prototype = {
2444
2423
 
2445
- // create a grayscale blurred circle image that we'll use for drawing points
2446
- var circle = this._circle = this._createCanvas(),
2447
- ctx = circle.getContext('2d'),
2448
- r2 = this._r = r + blur;
2424
+ defaultRadius: 25,
2449
2425
 
2450
- circle.width = circle.height = r2 * 2;
2426
+ defaultGradient: {
2427
+ 0.4: 'blue',
2428
+ 0.6: 'cyan',
2429
+ 0.7: 'lime',
2430
+ 0.8: 'yellow',
2431
+ 1.0: 'red'
2432
+ },
2451
2433
 
2452
- ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
2453
- ctx.shadowBlur = blur;
2454
- ctx.shadowColor = 'black';
2434
+ data: function (data) {
2435
+ this._data = data;
2436
+ return this;
2437
+ },
2455
2438
 
2456
- ctx.beginPath();
2457
- ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
2458
- ctx.closePath();
2459
- ctx.fill();
2439
+ max: function (max) {
2440
+ this._max = max;
2441
+ return this;
2442
+ },
2460
2443
 
2461
- return this;
2462
- },
2463
-
2464
- resize: function () {
2465
- this._width = this._canvas.width;
2466
- this._height = this._canvas.height;
2467
- },
2468
-
2469
- gradient: function (grad) {
2470
- // create a 256x1 gradient that we'll use to turn a grayscale heatmap into a colored one
2471
- var canvas = this._createCanvas(),
2472
- ctx = canvas.getContext('2d'),
2473
- gradient = ctx.createLinearGradient(0, 0, 0, 256);
2474
-
2475
- canvas.width = 1;
2476
- canvas.height = 256;
2477
-
2478
- for (var i in grad) {
2479
- gradient.addColorStop(+i, grad[i]);
2480
- }
2481
-
2482
- ctx.fillStyle = gradient;
2483
- ctx.fillRect(0, 0, 1, 256);
2484
-
2485
- this._grad = ctx.getImageData(0, 0, 1, 256).data;
2486
-
2487
- return this;
2488
- },
2444
+ add: function (point) {
2445
+ this._data.push(point);
2446
+ return this;
2447
+ },
2448
+
2449
+ clear: function () {
2450
+ this._data = [];
2451
+ return this;
2452
+ },
2453
+
2454
+ radius: function (r, blur) {
2455
+ blur = blur === undefined ? 15 : blur;
2456
+
2457
+ // create a grayscale blurred circle image that we'll use for drawing points
2458
+ var circle = this._circle = this._createCanvas(),
2459
+ ctx = circle.getContext('2d'),
2460
+ r2 = this._r = r + blur;
2461
+
2462
+ circle.width = circle.height = r2 * 2;
2463
+
2464
+ ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
2465
+ ctx.shadowBlur = blur;
2466
+ ctx.shadowColor = 'black';
2467
+
2468
+ ctx.beginPath();
2469
+ ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
2470
+ ctx.closePath();
2471
+ ctx.fill();
2472
+
2473
+ return this;
2474
+ },
2475
+
2476
+ resize: function () {
2477
+ this._width = this._canvas.width;
2478
+ this._height = this._canvas.height;
2479
+ },
2480
+
2481
+ gradient: function (grad) {
2482
+ // create a 256x1 gradient that we'll use to turn a grayscale heatmap into a colored one
2483
+ var canvas = this._createCanvas(),
2484
+ ctx = canvas.getContext('2d'),
2485
+ gradient = ctx.createLinearGradient(0, 0, 0, 256);
2486
+
2487
+ canvas.width = 1;
2488
+ canvas.height = 256;
2489
+
2490
+ for (var i in grad) {
2491
+ gradient.addColorStop(+i, grad[i]);
2492
+ }
2493
+
2494
+ ctx.fillStyle = gradient;
2495
+ ctx.fillRect(0, 0, 1, 256);
2496
+
2497
+ this._grad = ctx.getImageData(0, 0, 1, 256).data;
2498
+
2499
+ return this;
2500
+ },
2501
+
2502
+ draw: function (minOpacity) {
2503
+ if (!this._circle) this.radius(this.defaultRadius);
2504
+ if (!this._grad) this.gradient(this.defaultGradient);
2505
+
2506
+ var ctx = this._ctx;
2507
+
2508
+ ctx.clearRect(0, 0, this._width, this._height);
2509
+
2510
+ // draw a grayscale heatmap by putting a blurred circle at each data point
2511
+ for (var i = 0, len = this._data.length, p; i < len; i++) {
2512
+ p = this._data[i];
2513
+ ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
2514
+ ctx.drawImage(this._circle, p[0] - this._r, p[1] - this._r);
2515
+ }
2516
+
2517
+ // colorize the heatmap, using opacity value of each pixel to get the right color from our gradient
2518
+ var colored = ctx.getImageData(0, 0, this._width, this._height);
2519
+ this._colorize(colored.data, this._grad);
2520
+ ctx.putImageData(colored, 0, 0);
2521
+
2522
+ return this;
2523
+ },
2524
+
2525
+ _colorize: function (pixels, gradient) {
2526
+ for (var i = 0, len = pixels.length, j; i < len; i += 4) {
2527
+ j = pixels[i + 3] * 4; // get gradient color from opacity value
2528
+
2529
+ if (j) {
2530
+ pixels[i] = gradient[j];
2531
+ pixels[i + 1] = gradient[j + 1];
2532
+ pixels[i + 2] = gradient[j + 2];
2533
+ }
2534
+ }
2535
+ },
2536
+
2537
+ _createCanvas: function () {
2538
+ if (typeof document !== 'undefined') {
2539
+ return document.createElement('canvas');
2540
+ } else {
2541
+ // create a new canvas instance in node.js
2542
+ // the canvas class needs to have a default constructor without any parameter
2543
+ return new this._canvas.constructor();
2544
+ }
2545
+ }
2546
+ };
2547
+ } (simpleheat$2));
2548
+ return simpleheat$2.exports;
2549
+ }
2489
2550
 
2490
- draw: function (minOpacity) {
2491
- if (!this._circle) this.radius(this.defaultRadius);
2492
- if (!this._grad) this.gradient(this.defaultGradient);
2493
-
2494
- var ctx = this._ctx;
2495
-
2496
- ctx.clearRect(0, 0, this._width, this._height);
2497
-
2498
- // draw a grayscale heatmap by putting a blurred circle at each data point
2499
- for (var i = 0, len = this._data.length, p; i < len; i++) {
2500
- p = this._data[i];
2501
- ctx.globalAlpha = Math.max(p[2] / this._max, minOpacity === undefined ? 0.05 : minOpacity);
2502
- ctx.drawImage(this._circle, p[0] - this._r, p[1] - this._r);
2503
- }
2504
-
2505
- // colorize the heatmap, using opacity value of each pixel to get the right color from our gradient
2506
- var colored = ctx.getImageData(0, 0, this._width, this._height);
2507
- this._colorize(colored.data, this._grad);
2508
- ctx.putImageData(colored, 0, 0);
2509
-
2510
- return this;
2511
- },
2512
-
2513
- _colorize: function (pixels, gradient) {
2514
- for (var i = 0, len = pixels.length, j; i < len; i += 4) {
2515
- j = pixels[i + 3] * 4; // get gradient color from opacity value
2516
-
2517
- if (j) {
2518
- pixels[i] = gradient[j];
2519
- pixels[i + 1] = gradient[j + 1];
2520
- pixels[i + 2] = gradient[j + 2];
2521
- }
2522
- }
2523
- },
2524
-
2525
- _createCanvas: function () {
2526
- if (typeof document !== 'undefined') {
2527
- return document.createElement('canvas');
2528
- } else {
2529
- // create a new canvas instance in node.js
2530
- // the canvas class needs to have a default constructor without any parameter
2531
- return new this._canvas.constructor();
2532
- }
2533
- }
2534
- };
2535
- } (simpleheat$2));
2536
-
2537
- var simpleheatExports = simpleheat$2.exports;
2551
+ var simpleheatExports = requireSimpleheat();
2538
2552
  var simpleheat$1 = /*@__PURE__*/getDefaultExportFromCjs(simpleheatExports);
2539
2553
 
2540
2554
  var _simpleheat = /*#__PURE__*/_mergeNamespaces({
@@ -4081,7 +4095,7 @@
4081
4095
  .attr("class", "enter")
4082
4096
  .attr("font-size", this.fontSize())
4083
4097
  .attr("dy", ".35em")
4084
- .attr("y", (this.reverse() ? +1 : -1) * this._fontWidth * 2)
4098
+ .attr("y", (this.reverse() ? 1 : -1) * this._fontWidth * 2)
4085
4099
  .attr("x", function (d, i) { return (-context.data().length / 2 + i) * context._fontWidth + context._fontWidth / 2; })
4086
4100
  .style("fill-opacity", 1e-6)
4087
4101
  .style("text-anchor", this.anchor())
@@ -4092,7 +4106,7 @@
4092
4106
  text.exit()
4093
4107
  .attr("class", "exit");
4094
4108
  this.transition.apply(text.exit())
4095
- .attr("y", (this.reverse() ? -1 : +1) * this._fontWidth * 2)
4109
+ .attr("y", (this.reverse() ? -1 : 1) * this._fontWidth * 2)
4096
4110
  .style("fill-opacity", 1e-6)
4097
4111
  .remove();
4098
4112
  };
@@ -4416,7 +4430,7 @@
4416
4430
  })
4417
4431
  .attr("y1", nodeRectHeight / 2)
4418
4432
  .attr("x2", function (d2) {
4419
- return (d2.delta > 0) ? (nodeRectWidth + nodeRectWidthPadding - 4) + ((Math.abs(d2.delta) - 1)) * (w / context.groupCount) : ((-nodeRectWidthPadding - ((Math.abs(d2.delta) - 1)) * (w / context.groupCount)) + 4);
4433
+ return (d2.delta > 0) ? (nodeRectWidth + nodeRectWidthPadding - 4) + ((Math.abs(d2.delta) - 1)) * (w / context.groupCount) : ((-30 - ((Math.abs(d2.delta) - 1)) * (w / context.groupCount)) + 4);
4420
4434
  })
4421
4435
  .attr("y2", nodeRectHeight / 2)
4422
4436
  .style("stroke-dasharray", ("3, 3"))