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 (strict) v2.6.4
2
+ * plotly.js (strict) v2.7.0
3
3
  * Copyright 2012-2021, Plotly, Inc.
4
4
  * All rights reserved.
5
5
  * Licensed under the MIT license
@@ -81841,15 +81841,18 @@ var SIG_EXIF = str2arr('Exif\0\0');
81841
81841
  module.exports = function (data) {
81842
81842
  if (data.length < 2) return;
81843
81843
 
81844
- // first marker of the file MUST be 0xFFD8
81845
- if (data[0] !== 0xFF || data[1] !== 0xD8) return;
81844
+ // first marker of the file MUST be 0xFFD8,
81845
+ // following by either 0xFFE0, 0xFFE2 or 0xFFE3
81846
+ if (data[0] !== 0xFF || data[1] !== 0xD8 || data[2] !== 0xFF) return;
81846
81847
 
81847
81848
  var offset = 2;
81848
81849
 
81849
81850
  for (;;) {
81850
- if (data.length - offset < 2) return;
81851
- // not a JPEG marker
81852
- if (data[offset++] !== 0xFF) return;
81851
+ // skip until we see 0xFF, see https://github.com/nodeca/probe-image-size/issues/68
81852
+ for (;;) {
81853
+ if (data.length - offset < 2) return;
81854
+ if (data[offset++] === 0xFF) break;
81855
+ }
81853
81856
 
81854
81857
  var code = data[offset++];
81855
81858
  var length;
@@ -127065,7 +127068,8 @@ function findUIPattern(key, patternSpecs) {
127065
127068
  var spec = patternSpecs[i];
127066
127069
  var match = key.match(spec.pattern);
127067
127070
  if(match) {
127068
- return {head: match[1], attr: spec.attr};
127071
+ var head = match[1] || '';
127072
+ return {head: head, tail: key.substr(head.length + 1), attr: spec.attr};
127069
127073
  }
127070
127074
  }
127071
127075
  }
@@ -127117,26 +127121,54 @@ function valsMatch(v1, v2) {
127117
127121
 
127118
127122
  function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
127119
127123
  var layoutPreGUI = oldFullLayout._preGUI;
127120
- var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal;
127124
+ var key, revAttr, oldRev, newRev, match, preGUIVal, newNP, newVal, head, tail;
127121
127125
  var bothInheritAutorange = [];
127126
+ var newAutorangeIn = {};
127122
127127
  var newRangeAccepted = {};
127123
127128
  for(key in layoutPreGUI) {
127124
127129
  match = findUIPattern(key, layoutUIControlPatterns);
127125
127130
  if(match) {
127126
- revAttr = match.attr || (match.head + '.uirevision');
127131
+ head = match.head;
127132
+ tail = match.tail;
127133
+ revAttr = match.attr || (head + '.uirevision');
127127
127134
  oldRev = nestedProperty(oldFullLayout, revAttr).get();
127128
127135
  newRev = oldRev && getNewRev(revAttr, layout);
127136
+
127129
127137
  if(newRev && (newRev === oldRev)) {
127130
127138
  preGUIVal = layoutPreGUI[key];
127131
127139
  if(preGUIVal === null) preGUIVal = undefined;
127132
127140
  newNP = nestedProperty(layout, key);
127133
127141
  newVal = newNP.get();
127142
+
127134
127143
  if(valsMatch(newVal, preGUIVal)) {
127135
- if(newVal === undefined && key.substr(key.length - 9) === 'autorange') {
127136
- bothInheritAutorange.push(key.substr(0, key.length - 10));
127144
+ if(newVal === undefined && tail === 'autorange') {
127145
+ bothInheritAutorange.push(head);
127137
127146
  }
127138
127147
  newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
127139
127148
  continue;
127149
+ } else if(tail === 'autorange' || tail.substr(0, 6) === 'range[') {
127150
+ // Special case for (auto)range since we push it back into the layout
127151
+ // so all null should be treated equivalently to autorange: true with any range
127152
+ var pre0 = layoutPreGUI[head + '.range[0]'];
127153
+ var pre1 = layoutPreGUI[head + '.range[1]'];
127154
+ var preAuto = layoutPreGUI[head + '.autorange'];
127155
+ if(preAuto || (preAuto === null && pre0 === null && pre1 === null)) {
127156
+ // Only read the input layout once and stash the result,
127157
+ // so we get it before we start modifying it
127158
+ if(!(head in newAutorangeIn)) {
127159
+ var newContainer = nestedProperty(layout, head).get();
127160
+ newAutorangeIn[head] = newContainer && (
127161
+ newContainer.autorange ||
127162
+ (newContainer.autorange !== false && (
127163
+ !newContainer.range || newContainer.range.length !== 2)
127164
+ )
127165
+ );
127166
+ }
127167
+ if(newAutorangeIn[head]) {
127168
+ newNP.set(undefinedToNull(nestedProperty(oldFullLayout, key).get()));
127169
+ continue;
127170
+ }
127171
+ }
127140
127172
  }
127141
127173
  }
127142
127174
  } else {
@@ -127147,12 +127179,12 @@ function applyUIRevisions(data, layout, oldFullData, oldFullLayout) {
127147
127179
  // so remove it from _preGUI for next time.
127148
127180
  delete layoutPreGUI[key];
127149
127181
 
127150
- if(key.substr(key.length - 8, 6) === 'range[') {
127151
- newRangeAccepted[key.substr(0, key.length - 9)] = 1;
127182
+ if(match && match.tail.substr(0, 6) === 'range[') {
127183
+ newRangeAccepted[match.head] = 1;
127152
127184
  }
127153
127185
  }
127154
127186
 
127155
- // Special logic for `autorange`, since it interacts with `range`:
127187
+ // More special logic for `autorange`, since it interacts with `range`:
127156
127188
  // If the new figure's matching `range` was kept, and `autorange`
127157
127189
  // wasn't supplied explicitly in either the original or the new figure,
127158
127190
  // we shouldn't alter that - but we may just have done that, so fix it.
@@ -152002,11 +152034,14 @@ proto.project = function(v) {
152002
152034
  proto.getView = function() {
152003
152035
  var map = this.map;
152004
152036
  var mapCenter = map.getCenter();
152005
- var center = { lon: mapCenter.lng, lat: mapCenter.lat };
152037
+ var lon = mapCenter.lng;
152038
+ var lat = mapCenter.lat;
152039
+ var center = { lon: lon, lat: lat };
152006
152040
 
152007
152041
  var canvas = map.getCanvas();
152008
- var w = canvas.width;
152009
- var h = canvas.height;
152042
+ var w = parseInt(canvas.style.width);
152043
+ var h = parseInt(canvas.style.height);
152044
+
152010
152045
  return {
152011
152046
  center: center,
152012
152047
  zoom: map.getZoom(),
@@ -162814,7 +162849,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
162814
162849
  }
162815
162850
 
162816
162851
  transform.fontSize = font.size;
162817
- recordMinTextSize(trace.type, transform, fullLayout);
162852
+ recordMinTextSize(trace.type === 'histogram' ? 'bar' : trace.type, transform, fullLayout);
162818
162853
  calcBar.transform = transform;
162819
162854
 
162820
162855
  transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
@@ -177146,6 +177181,8 @@ module.exports = {
177146
177181
  var barAttrs = _dereq_('../bar/attributes');
177147
177182
  var axisHoverFormat = _dereq_('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
177148
177183
  var hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;
177184
+ var texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;
177185
+ var fontAttrs = _dereq_('../../plots/font_attributes');
177149
177186
  var makeBinAttrs = _dereq_('./bin_attributes');
177150
177187
  var constants = _dereq_('./constants');
177151
177188
  var extendFlat = _dereq_('../../lib/extend').extendFlat;
@@ -177240,6 +177277,41 @@ module.exports = {
177240
177277
  keys: constants.eventDataKeys
177241
177278
  }),
177242
177279
 
177280
+ texttemplate: texttemplateAttrs({
177281
+ arrayOk: false,
177282
+ editType: 'plot'
177283
+ }, {
177284
+ keys: ['label', 'value']
177285
+ }),
177286
+
177287
+ textposition: extendFlat({}, barAttrs.textposition, {
177288
+ arrayOk: false
177289
+ }),
177290
+
177291
+ textfont: fontAttrs({
177292
+ arrayOk: false,
177293
+ editType: 'plot',
177294
+ colorEditType: 'style',
177295
+ }),
177296
+
177297
+ outsidetextfont: fontAttrs({
177298
+ arrayOk: false,
177299
+ editType: 'plot',
177300
+ colorEditType: 'style',
177301
+ }),
177302
+
177303
+ insidetextfont: fontAttrs({
177304
+ arrayOk: false,
177305
+ editType: 'plot',
177306
+ colorEditType: 'style',
177307
+ }),
177308
+
177309
+ insidetextanchor: barAttrs.insidetextanchor,
177310
+
177311
+ textangle: barAttrs.textangle,
177312
+ cliponaxis: barAttrs.cliponaxis,
177313
+ constraintext: barAttrs.constraintext,
177314
+
177243
177315
  marker: barAttrs.marker,
177244
177316
 
177245
177317
  offsetgroup: barAttrs.offsetgroup,
@@ -177253,7 +177325,7 @@ module.exports = {
177253
177325
  }
177254
177326
  };
177255
177327
 
177256
- },{"../../lib/extend":361,"../../plots/cartesian/axis_format_attributes":424,"../../plots/template_attributes":496,"../bar/attributes":511,"./bin_attributes":676,"./constants":680}],675:[function(_dereq_,module,exports){
177328
+ },{"../../lib/extend":361,"../../plots/cartesian/axis_format_attributes":424,"../../plots/font_attributes":452,"../../plots/template_attributes":496,"../bar/attributes":511,"./bin_attributes":676,"./constants":680}],675:[function(_dereq_,module,exports){
177257
177329
  'use strict';
177258
177330
 
177259
177331
 
@@ -178376,6 +178448,7 @@ var Registry = _dereq_('../../registry');
178376
178448
  var Lib = _dereq_('../../lib');
178377
178449
  var Color = _dereq_('../../components/color');
178378
178450
 
178451
+ var handleText = _dereq_('../bar/defaults').handleText;
178379
178452
  var handleStyleDefaults = _dereq_('../bar/style_defaults');
178380
178453
  var attributes = _dereq_('./attributes');
178381
178454
 
@@ -178394,6 +178467,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
178394
178467
  }
178395
178468
 
178396
178469
  coerce('text');
178470
+ var textposition = coerce('textposition');
178471
+ handleText(traceIn, traceOut, layout, coerce, textposition, {
178472
+ moduleHasSelected: true,
178473
+ moduleHasUnselected: true,
178474
+ moduleHasConstrain: true,
178475
+ moduleHasCliponaxis: true,
178476
+ moduleHasTextangle: true,
178477
+ moduleHasInsideanchor: true
178478
+ });
178479
+
178397
178480
  coerce('hovertext');
178398
178481
  coerce('hovertemplate');
178399
178482
  coerce('xhoverformat');
@@ -178437,7 +178520,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
178437
178520
  errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});
178438
178521
  };
178439
178522
 
178440
- },{"../../components/color":234,"../../lib":371,"../../registry":501,"../bar/style_defaults":526,"./attributes":674}],683:[function(_dereq_,module,exports){
178523
+ },{"../../components/color":234,"../../lib":371,"../../registry":501,"../bar/defaults":515,"../bar/style_defaults":526,"./attributes":674}],683:[function(_dereq_,module,exports){
178441
178524
  'use strict';
178442
178525
 
178443
178526
  module.exports = function eventData(out, pt, trace, cd, pointNumber) {
@@ -207706,7 +207789,7 @@ function getSortFunc(opts, d2c) {
207706
207789
  'use strict';
207707
207790
 
207708
207791
  // package version injected by `npm run preprocess`
207709
- exports.version = '2.6.4';
207792
+ exports.version = '2.7.0';
207710
207793
 
207711
207794
  },{}],933:[function(_dereq_,module,exports){
207712
207795
  (function (global){(function (){