plotly.js 2.6.4 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * plotly.js (cartesian) v2.6.4
2
+ * plotly.js (cartesian) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -16525,15 +16525,18 @@ var SIG_EXIF = str2arr('Exif\0\0');
16525
16525
  module.exports = function (data) {
16526
16526
  if (data.length < 2) return;
16527
16527
 
16528
- // first marker of the file MUST be 0xFFD8
16529
- if (data[0] !== 0xFF || data[1] !== 0xD8) return;
16528
+ // first marker of the file MUST be 0xFFD8,
16529
+ // following by either 0xFFE0, 0xFFE2 or 0xFFE3
16530
+ if (data[0] !== 0xFF || data[1] !== 0xD8 || data[2] !== 0xFF) return;
16530
16531
 
16531
16532
  var offset = 2;
16532
16533
 
16533
16534
  for (;;) {
16534
- if (data.length - offset < 2) return;
16535
- // not a JPEG marker
16536
- if (data[offset++] !== 0xFF) return;
16535
+ // skip until we see 0xFF, see https://github.com/nodeca/probe-image-size/issues/68
16536
+ for (;;) {
16537
+ if (data.length - offset < 2) return;
16538
+ if (data[offset++] === 0xFF) break;
16539
+ }
16537
16540
 
16538
16541
  var code = data[offset++];
16539
16542
  var length;
@@ -60316,7 +60319,8 @@ function findUIPattern(key, patternSpecs) {
60316
60319
  var spec = patternSpecs[i];
60317
60320
  var match = key.match(spec.pattern);
60318
60321
  if(match) {
60319
- return {head: match[1], attr: spec.attr};
60322
+ var head = match[1] || '';
60323
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
60320
60324
  }
60321
60325
  }
60322
60326
  }
@@ -60368,26 +60372,54 @@ function valsMatch(v1, v2) {
60368
60372
 
60369
60373
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
60370
60374
  var layoutPreGUI = oldFullLayout._preGUI;
60371
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
60375
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
60372
60376
  var bothInheritAutorange = [];
60377
+ var newAutorangeIn = {};
60373
60378
  var newRangeAccepted = {};
60374
60379
  for(key in layoutPreGUI) {
60375
60380
  match = findUIPattern(key, layoutUIControlPatterns);
60376
60381
  if(match) {
60377
- revAttr = match.attr || (match.head + '.uirevision');
60382
+ head = match.head;
60383
+ tail = match.tail;
60384
+ revAttr = match.attr || (head + '.uirevision');
60378
60385
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
60379
60386
  newRev = oldRev && getNewRev(revAttr, layout);
60387
+
60380
60388
  if(newRev && (newRev === oldRev)) {
60381
60389
  preGUIVal = layoutPreGUI[key];
60382
60390
  if(preGUIVal === null) preGUIVal = undefined;
60383
60391
  newNP = nestedProperty(layout, key);
60384
60392
  newVal = newNP.get();
60393
+
60385
60394
  if(valsMatch(newVal, preGUIVal)) {
60386
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
60387
- bothInheritAutorange.push(key.substr(0, key.length - 10));
60395
+ if(newVal === undefined && tail === 'autorange') {
60396
+ bothInheritAutorange.push(head);
60388
60397
  }
60389
60398
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
60390
60399
  continue;
60400
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
60401
+ // Special case for (auto)range since we push it back into the layout
60402
+ // so all null should be treated equivalently to autorange: true with any range
60403
+ var pre0 = layoutPreGUI[head + '.range[0]'];
60404
+ var pre1 = layoutPreGUI[head + '.range[1]'];
60405
+ var preAuto = layoutPreGUI[head + '.autorange'];
60406
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
60407
+ // Only read the input layout once and stash the result,
60408
+ // so we get it before we start modifying it
60409
+ if(!(head in newAutorangeIn)) {
60410
+ var newContainer = nestedProperty(layout, head).get();
60411
+ newAutorangeIn[head] = newContainer && (
60412
+ newContainer.autorange ||
60413
+ (newContainer.autorange !== false && (
60414
+ !newContainer.range || newContainer.range.length !== 2)
60415
+ )
60416
+ );
60417
+ }
60418
+ if(newAutorangeIn[head]) {
60419
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
60420
+ continue;
60421
+ }
60422
+ }
60391
60423
  }
60392
60424
  }
60393
60425
  } else {
@@ -60398,12 +60430,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
60398
60430
  // so remove it from _preGUI for next time.
60399
60431
  delete layoutPreGUI[key];
60400
60432
 
60401
- if(key.substr(key.length - 8, 6) === 'range[') {
60402
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
60433
+ if(match && match.tail.substr(0, 6) === 'range[') {
60434
+ newRangeAccepted[match.head] = 1;
60403
60435
  }
60404
60436
  }
60405
60437
 
60406
- // Special logic for `autorange`, since it interacts with `range`:
60438
+ // More special logic for `autorange`, since it interacts with `range`:
60407
60439
  // If the new figure's matching `range` was kept, and `autorange`
60408
60440
  // wasn't supplied explicitly in either the original or the new figure,
60409
60441
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -85882,7 +85914,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
85882
85914
  }
85883
85915
 
85884
85916
  transform.fontSize = font.size;
85885
- recordMinTextSize(trace.type, transform, fullLayout);
85917
+ recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
85886
85918
  calcBar.transform = transform;
85887
85919
 
85888
85920
  transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
@@ -92389,6 +92421,8 @@ function isValidZ(z) {
92389
92421
  var barAttrs = _dereq_('../bar/attributes');
92390
92422
  var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
92391
92423
  var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
92424
+ var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
92425
+ var fontAttrs = _dereq_('../../plots/font_attributes');
92392
92426
  var makeBinAttrs = _dereq_('./bin_attributes');
92393
92427
  var constants = _dereq_('./constants');
92394
92428
  var extendFlat = _dereq_('../../lib/extend').extendFlat;
@@ -92483,6 +92517,41 @@ module.exports = {
92483
92517
  keys: constants.eventDataKeys
92484
92518
  }),
92485
92519
 
92520
+ texttemplate: texttemplateAttrs({
92521
+ arrayOk: false,
92522
+ editType: 'plot'
92523
+ }, {
92524
+ keys: ['label', 'value']
92525
+ }),
92526
+
92527
+ textposition: extendFlat({}, barAttrs.textposition, {
92528
+ arrayOk: false
92529
+ }),
92530
+
92531
+ textfont: fontAttrs({
92532
+ arrayOk: false,
92533
+ editType: 'plot',
92534
+ colorEditType: 'style',
92535
+ }),
92536
+
92537
+ outsidetextfont: fontAttrs({
92538
+ arrayOk: false,
92539
+ editType: 'plot',
92540
+ colorEditType: 'style',
92541
+ }),
92542
+
92543
+ insidetextfont: fontAttrs({
92544
+ arrayOk: false,
92545
+ editType: 'plot',
92546
+ colorEditType: 'style',
92547
+ }),
92548
+
92549
+ insidetextanchor: barAttrs.insidetextanchor,
92550
+
92551
+ textangle: barAttrs.textangle,
92552
+ cliponaxis: barAttrs.cliponaxis,
92553
+ constraintext: barAttrs.constraintext,
92554
+
92486
92555
  marker: barAttrs.marker,
92487
92556
 
92488
92557
  offsetgroup: barAttrs.offsetgroup,
@@ -92496,7 +92565,7 @@ module.exports = {
92496
92565
  }
92497
92566
  };
92498
92567
 
92499
- },{"../../lib/extend":281,"../../plots/cartesian/axis_format_attributes":337,"../../plots/template_attributes":373,"../bar/attributes":388,"./bin_attributes":456,"./constants":460}],455:[function(_dereq_,module,exports){
92568
+ },{"../../lib/extend":281,"../../plots/cartesian/axis_format_attributes":337,"../../plots/font_attributes":365,"../../plots/template_attributes":373,"../bar/attributes":388,"./bin_attributes":456,"./constants":460}],455:[function(_dereq_,module,exports){
92500
92569
  'use strict';
92501
92570
 
92502
92571
 
@@ -93619,6 +93688,7 @@ var Registry = _dereq_('../../registry');
93619
93688
  var Lib = _dereq_('../../lib');
93620
93689
  var Color = _dereq_('../../components/color');
93621
93690
 
93691
+ var handleText = _dereq_('../bar/defaults').handleText;
93622
93692
  var handleStyleDefaults = _dereq_('../bar/style_defaults');
93623
93693
  var attributes = _dereq_('./attributes');
93624
93694
 
@@ -93637,6 +93707,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
93637
93707
  }
93638
93708
 
93639
93709
  coerce('text');
93710
+ var textposition = coerce('textposition');
93711
+ handleText(traceIn, traceOut, layout, coerce, textposition, {
93712
+ moduleHasSelected: true,
93713
+ moduleHasUnselected: true,
93714
+ moduleHasConstrain: true,
93715
+ moduleHasCliponaxis: true,
93716
+ moduleHasTextangle: true,
93717
+ moduleHasInsideanchor: true
93718
+ });
93719
+
93640
93720
  coerce('hovertext');
93641
93721
  coerce('hovertemplate');
93642
93722
  coerce('xhoverformat');
@@ -93680,7 +93760,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
93680
93760
  errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
93681
93761
  };
93682
93762
 
93683
- },{"../../components/color":157,"../../lib":287,"../../registry":378,"../bar/style_defaults":403,"./attributes":454}],463:[function(_dereq_,module,exports){
93763
+ },{"../../components/color":157,"../../lib":287,"../../registry":378,"../bar/defaults":392,"../bar/style_defaults":403,"./attributes":454}],463:[function(_dereq_,module,exports){
93684
93764
  'use strict';
93685
93765
 
93686
93766
  module.exports = function eventData(out, pt, trace, cd, pointNumber) {
@@ -102159,7 +102239,7 @@ function getSortFunc(opts, d2c) {
102159
102239
  'use strict';
102160
102240
 
102161
102241
  // package version injected by `npm run preprocess`
102162
- exports.version = '2.6.4';
102242
+ exports.version = '2.7.0';
102163
102243
 
102164
102244
  },{}]},{},[15])(15)
102165
102245
  });