plottable 3.13.0 → 4.1.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.
Files changed (140) hide show
  1. package/README.md +9 -2
  2. package/build/src/animators/easingAnimator.d.ts +2 -2
  3. package/build/src/animators/easingAnimator.js +1 -1
  4. package/build/src/animators/index.js +2 -2
  5. package/build/src/axes/axis.d.ts +1 -1
  6. package/build/src/axes/axis.js +5 -5
  7. package/build/src/axes/categoryAxis.js +8 -7
  8. package/build/src/axes/index.js +3 -3
  9. package/build/src/axes/numericAxis.js +1 -1
  10. package/build/src/axes/timeAxis.d.ts +5 -5
  11. package/build/src/axes/timeAxis.js +6 -6
  12. package/build/src/components/component.d.ts +4 -4
  13. package/build/src/components/component.js +4 -4
  14. package/build/src/components/componentContainer.js +1 -1
  15. package/build/src/components/dragBoxLayer.d.ts +1 -1
  16. package/build/src/components/dragBoxLayer.js +1 -1
  17. package/build/src/components/dragLineLayer.js +1 -1
  18. package/build/src/components/gridlines.js +1 -1
  19. package/build/src/components/group.js +1 -1
  20. package/build/src/components/guideLineLayer.js +1 -1
  21. package/build/src/components/index.js +14 -14
  22. package/build/src/components/interpolatedColorLegend.js +1 -1
  23. package/build/src/components/label.d.ts +1 -1
  24. package/build/src/components/label.js +3 -3
  25. package/build/src/components/legend.js +17 -9
  26. package/build/src/components/plotGroup.js +1 -1
  27. package/build/src/components/selectionBoxLayer.js +2 -2
  28. package/build/src/components/table.js +1 -1
  29. package/build/src/components/wrappedLabel.js +1 -1
  30. package/build/src/components/xDragBoxLayer.js +1 -1
  31. package/build/src/components/yDragBoxLayer.js +1 -1
  32. package/build/src/core/dataset.d.ts +1 -1
  33. package/build/src/core/formatters.d.ts +2 -2
  34. package/build/src/core/formatters.js +16 -13
  35. package/build/src/core/interfaces.d.ts +9 -9
  36. package/build/src/core/renderController.d.ts +1 -1
  37. package/build/src/core/renderController.js +6 -6
  38. package/build/src/core/symbolFactories.d.ts +2 -2
  39. package/build/src/core/symbolFactories.js +15 -15
  40. package/build/src/core/version.js +1 -1
  41. package/build/src/dispatchers/dispatcher.js +8 -1
  42. package/build/src/dispatchers/index.js +3 -3
  43. package/build/src/dispatchers/keyDispatcher.d.ts +1 -1
  44. package/build/src/dispatchers/keyDispatcher.js +1 -1
  45. package/build/src/dispatchers/mouseDispatcher.d.ts +1 -1
  46. package/build/src/dispatchers/mouseDispatcher.js +1 -1
  47. package/build/src/dispatchers/touchDispatcher.d.ts +1 -1
  48. package/build/src/dispatchers/touchDispatcher.js +1 -1
  49. package/build/src/drawers/arcDrawer.js +1 -1
  50. package/build/src/drawers/arcOutlineDrawer.js +1 -1
  51. package/build/src/drawers/areaDrawer.js +3 -3
  52. package/build/src/drawers/canvasBuffer.js +2 -2
  53. package/build/src/drawers/canvasDrawer.d.ts +1 -1
  54. package/build/src/drawers/canvasDrawer.js +8 -8
  55. package/build/src/drawers/drawStep.d.ts +2 -2
  56. package/build/src/drawers/index.js +11 -11
  57. package/build/src/drawers/lineDrawer.js +3 -3
  58. package/build/src/drawers/rectangleDrawer.js +2 -2
  59. package/build/src/drawers/segmentDrawer.js +1 -1
  60. package/build/src/drawers/symbolDrawer.js +3 -3
  61. package/build/src/index.js +14 -14
  62. package/build/src/interactions/clickInteraction.d.ts +1 -1
  63. package/build/src/interactions/clickInteraction.js +8 -1
  64. package/build/src/interactions/dragInteraction.d.ts +2 -2
  65. package/build/src/interactions/dragInteraction.js +7 -1
  66. package/build/src/interactions/index.js +5 -5
  67. package/build/src/interactions/interaction.d.ts +2 -1
  68. package/build/src/interactions/interaction.js +11 -1
  69. package/build/src/interactions/keyInteraction.d.ts +1 -1
  70. package/build/src/interactions/keyInteraction.js +8 -1
  71. package/build/src/interactions/panZoomConstraints.js +5 -6
  72. package/build/src/interactions/panZoomInteraction.d.ts +4 -4
  73. package/build/src/interactions/panZoomInteraction.js +15 -10
  74. package/build/src/interactions/pointerInteraction.d.ts +1 -1
  75. package/build/src/interactions/pointerInteraction.js +8 -1
  76. package/build/src/memoize/index.js +3 -3
  77. package/build/src/memoize/memThunk.d.ts +1 -1
  78. package/build/src/memoize/memThunk.js +1 -2
  79. package/build/src/memoize/memoize.d.ts +1 -1
  80. package/build/src/memoize/memoize.js +1 -2
  81. package/build/src/memoize/memoizeProjectors.js +2 -3
  82. package/build/src/memoize/signature.d.ts +1 -1
  83. package/build/src/memoize/signature.js +10 -10
  84. package/build/src/plots/areaPlot.js +4 -3
  85. package/build/src/plots/barPlot.d.ts +9 -3
  86. package/build/src/plots/barPlot.js +18 -6
  87. package/build/src/plots/clusteredBarPlot.js +1 -1
  88. package/build/src/plots/commons.js +1 -1
  89. package/build/src/plots/index.js +12 -12
  90. package/build/src/plots/linePlot.d.ts +2 -3
  91. package/build/src/plots/linePlot.js +3 -2
  92. package/build/src/plots/piePlot.js +4 -2
  93. package/build/src/plots/plot.d.ts +4 -2
  94. package/build/src/plots/plot.js +12 -10
  95. package/build/src/plots/rectanglePlot.d.ts +5 -0
  96. package/build/src/plots/rectanglePlot.js +14 -4
  97. package/build/src/plots/scatterPlot.d.ts +11 -0
  98. package/build/src/plots/scatterPlot.js +31 -4
  99. package/build/src/plots/segmentPlot.js +1 -1
  100. package/build/src/plots/stackedAreaPlot.js +5 -6
  101. package/build/src/plots/stackedBarPlot.js +4 -4
  102. package/build/src/plots/waterfallPlot.js +1 -1
  103. package/build/src/plots/xyPlot.js +4 -3
  104. package/build/src/scales/categoryScale.d.ts +1 -0
  105. package/build/src/scales/categoryScale.js +9 -6
  106. package/build/src/scales/colorScale.d.ts +4 -3
  107. package/build/src/scales/colorScale.js +50 -57
  108. package/build/src/scales/index.js +9 -9
  109. package/build/src/scales/interpolatedColorScale.js +11 -10
  110. package/build/src/scales/linearScale.js +3 -3
  111. package/build/src/scales/logScale.js +3 -3
  112. package/build/src/scales/modifiedLogScale.js +2 -2
  113. package/build/src/scales/quantitativeScale.js +1 -1
  114. package/build/src/scales/scale.d.ts +1 -1
  115. package/build/src/scales/tickGenerators.js +2 -3
  116. package/build/src/scales/timeScale.js +4 -4
  117. package/build/src/utils/arrayUtils.js +5 -7
  118. package/build/src/utils/callbackSet.js +1 -1
  119. package/build/src/utils/coerceD3.js +1 -2
  120. package/build/src/utils/colorUtils.js +3 -4
  121. package/build/src/utils/d3ShapeUtils.d.ts +11 -0
  122. package/build/src/utils/d3ShapeUtils.js +17 -0
  123. package/build/src/utils/domUtils.js +20 -20
  124. package/build/src/utils/entityStore.d.ts +6 -3
  125. package/build/src/utils/index.js +8 -8
  126. package/build/src/utils/makeEnum.js +1 -2
  127. package/build/src/utils/mathUtils.d.ts +2 -2
  128. package/build/src/utils/mathUtils.js +17 -18
  129. package/build/src/utils/objectUtils.js +1 -2
  130. package/build/src/utils/rTree.d.ts +12 -3
  131. package/build/src/utils/rTree.js +19 -7
  132. package/build/src/utils/rTreeSplitStrategies.d.ts +1 -1
  133. package/build/src/utils/stackingUtils.d.ts +6 -6
  134. package/build/src/utils/stackingUtils.js +40 -7
  135. package/build/src/utils/transformAwareTranslator.js +2 -2
  136. package/build/src/utils/windowUtils.js +4 -5
  137. package/package.json +15 -14
  138. package/plottable.css +4 -3
  139. package/plottable.js +18083 -18287
  140. package/plottable.js.map +1 -1
@@ -4,13 +4,14 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.makeSymbolCanvasDrawStep = exports.SymbolSVGDrawer = void 0;
7
+ exports.SymbolSVGDrawer = void 0;
8
+ exports.makeSymbolCanvasDrawStep = makeSymbolCanvasDrawStep;
8
9
  var tslib_1 = require("tslib");
9
10
  var canvasDrawer_1 = require("./canvasDrawer");
10
11
  var canvasBuffer_1 = require("./canvasBuffer");
11
12
  var svgDrawer_1 = require("./svgDrawer");
12
13
  var SymbolSVGDrawer = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(SymbolSVGDrawer, _super);
14
+ tslib_1.__extends(SymbolSVGDrawer, _super);
14
15
  function SymbolSVGDrawer() {
15
16
  return _super.call(this, "path", "symbol") || this;
16
17
  }
@@ -69,7 +70,6 @@ function makeSymbolCanvasDrawStep(dataset, symbolProjector, sizeProjector, stepB
69
70
  }
70
71
  };
71
72
  }
72
- exports.makeSymbolCanvasDrawStep = makeSymbolCanvasDrawStep;
73
73
  function squareOverlapsBounds(width, height, x, y, size) {
74
74
  return (x + size >= 0 && x - size <= width &&
75
75
  y + size >= 0 && y - size <= height);
@@ -34,21 +34,21 @@ var Scales = require("./scales");
34
34
  exports.Scales = Scales;
35
35
  var Utils = require("./utils");
36
36
  exports.Utils = Utils;
37
- (0, tslib_1.__exportStar)(require("./animators/animator"), exports);
38
- (0, tslib_1.__exportStar)(require("./axes/axis"), exports);
37
+ tslib_1.__exportStar(require("./animators/animator"), exports);
38
+ tslib_1.__exportStar(require("./axes/axis"), exports);
39
39
  var timeAxis_1 = require("./axes/timeAxis");
40
40
  Object.defineProperty(exports, "TimeInterval", { enumerable: true, get: function () { return timeAxis_1.TimeInterval; } });
41
- (0, tslib_1.__exportStar)(require("./components/component"), exports);
42
- (0, tslib_1.__exportStar)(require("./components/componentContainer"), exports);
43
- (0, tslib_1.__exportStar)(require("./core/dataset"), exports);
44
- (0, tslib_1.__exportStar)(require("./core/interfaces"), exports);
41
+ tslib_1.__exportStar(require("./components/component"), exports);
42
+ tslib_1.__exportStar(require("./components/componentContainer"), exports);
43
+ tslib_1.__exportStar(require("./core/dataset"), exports);
44
+ tslib_1.__exportStar(require("./core/interfaces"), exports);
45
45
  var version_1 = require("./core/version");
46
46
  Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
47
- (0, tslib_1.__exportStar)(require("./dispatchers/dispatcher"), exports);
48
- (0, tslib_1.__exportStar)(require("./drawers/drawer"), exports);
49
- (0, tslib_1.__exportStar)(require("./interactions/interaction"), exports);
50
- (0, tslib_1.__exportStar)(require("./interactions/keyInteraction"), exports);
51
- (0, tslib_1.__exportStar)(require("./plots/xyPlot"), exports);
52
- (0, tslib_1.__exportStar)(require("./plots/plot"), exports);
53
- (0, tslib_1.__exportStar)(require("./scales/quantitativeScale"), exports);
54
- (0, tslib_1.__exportStar)(require("./scales/scale"), exports);
47
+ tslib_1.__exportStar(require("./dispatchers/dispatcher"), exports);
48
+ tslib_1.__exportStar(require("./drawers/drawer"), exports);
49
+ tslib_1.__exportStar(require("./interactions/interaction"), exports);
50
+ tslib_1.__exportStar(require("./interactions/keyInteraction"), exports);
51
+ tslib_1.__exportStar(require("./plots/xyPlot"), exports);
52
+ tslib_1.__exportStar(require("./plots/plot"), exports);
53
+ tslib_1.__exportStar(require("./scales/quantitativeScale"), exports);
54
+ tslib_1.__exportStar(require("./scales/scale"), exports);
@@ -5,7 +5,7 @@
5
5
  import { Component } from "../components/component";
6
6
  import { Point } from "../core/interfaces";
7
7
  import { Interaction } from "./interaction";
8
- export declare type ClickCallback = (point: Point, event: MouseEvent | TouchEvent) => void;
8
+ export type ClickCallback = (point: Point, event: MouseEvent | TouchEvent) => void;
9
9
  export declare class Click extends Interaction {
10
10
  private _mouseDispatcher;
11
11
  private _touchDispatcher;
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
10
10
  var Utils = require("../utils");
11
11
  var interaction_1 = require("./interaction");
12
12
  var Click = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(Click, _super);
13
+ tslib_1.__extends(Click, _super);
14
14
  function Click() {
15
15
  var _this = _super !== null && _super.apply(this, arguments) || this;
16
16
  _this._clickedDown = false;
@@ -41,7 +41,14 @@ var Click = /** @class */ (function (_super) {
41
41
  this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
42
42
  };
43
43
  Click.prototype._unanchor = function () {
44
+ var _this = this;
44
45
  _super.prototype._unanchor.call(this);
46
+ // Preserve a press through synchronous renderTo(), but discard it if its release can be missed.
47
+ Promise.resolve().then(function () {
48
+ if (!_this._isAnchored) {
49
+ _this._clickedDown = false;
50
+ }
51
+ });
45
52
  this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
46
53
  this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
47
54
  this._mouseDispatcher.offDblClick(this._dblClickCallback);
@@ -5,8 +5,8 @@
5
5
  import { Component } from "../components/component";
6
6
  import { Point } from "../core/interfaces";
7
7
  import { Interaction } from "./interaction";
8
- export declare type DragCallback = (start: Point, end: Point) => void;
9
- export declare type MouseFilter = (e: MouseEvent) => boolean;
8
+ export type DragCallback = (start: Point, end: Point) => void;
9
+ export type MouseFilter = (e: MouseEvent) => boolean;
10
10
  export declare class Drag extends Interaction {
11
11
  private static _DEFAULT_MOUSE_FILTER;
12
12
  private _dragging;
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
10
10
  var Utils = require("../utils");
11
11
  var interaction_1 = require("./interaction");
12
12
  var Drag = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(Drag, _super);
13
+ tslib_1.__extends(Drag, _super);
14
14
  function Drag(mouseButton) {
15
15
  var _this = _super.call(this) || this;
16
16
  _this._dragging = false;
@@ -45,7 +45,13 @@ var Drag = /** @class */ (function (_super) {
45
45
  this._touchDispatcher.onTouchEnd(this._touchEndCallback);
46
46
  };
47
47
  Drag.prototype._unanchor = function () {
48
+ var _this = this;
48
49
  _super.prototype._unanchor.call(this);
50
+ Promise.resolve().then(function () {
51
+ if (!_this._isAnchored) {
52
+ _this._dragging = false;
53
+ }
54
+ });
49
55
  this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
50
56
  this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);
51
57
  this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
@@ -6,10 +6,10 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.zoomOut = void 0;
8
8
  var tslib_1 = require("tslib");
9
- (0, tslib_1.__exportStar)(require("./clickInteraction"), exports);
10
- (0, tslib_1.__exportStar)(require("./dragInteraction"), exports);
11
- (0, tslib_1.__exportStar)(require("./keyInteraction"), exports);
12
- (0, tslib_1.__exportStar)(require("./panZoomInteraction"), exports);
13
- (0, tslib_1.__exportStar)(require("./pointerInteraction"), exports);
9
+ tslib_1.__exportStar(require("./clickInteraction"), exports);
10
+ tslib_1.__exportStar(require("./dragInteraction"), exports);
11
+ tslib_1.__exportStar(require("./keyInteraction"), exports);
12
+ tslib_1.__exportStar(require("./panZoomInteraction"), exports);
13
+ tslib_1.__exportStar(require("./pointerInteraction"), exports);
14
14
  var panZoomConstraints_1 = require("./panZoomConstraints");
15
15
  Object.defineProperty(exports, "zoomOut", { enumerable: true, get: function () { return panZoomConstraints_1.zoomOut; } });
@@ -6,7 +6,8 @@ import { Component } from "../components/component";
6
6
  import { Point } from "../core/interfaces";
7
7
  export declare class Interaction {
8
8
  private _anchorCallback;
9
- private _isAnchored;
9
+ private _detachCallback;
10
+ protected _isAnchored: boolean;
10
11
  private _enabled;
11
12
  protected _componentAttachedTo: Component;
12
13
  /**
@@ -8,7 +8,15 @@ exports.Interaction = void 0;
8
8
  var Interaction = /** @class */ (function () {
9
9
  function Interaction() {
10
10
  var _this = this;
11
- this._anchorCallback = function (component) { return _this._anchor(component); };
11
+ this._anchorCallback = function (component) {
12
+ _this._detachCallback();
13
+ _this._anchor(component);
14
+ };
15
+ this._detachCallback = function () {
16
+ if (_this._isAnchored) {
17
+ _this._unanchor();
18
+ }
19
+ };
12
20
  this._enabled = true;
13
21
  }
14
22
  /**
@@ -87,6 +95,7 @@ var Interaction = /** @class */ (function () {
87
95
  Interaction.prototype._connect = function () {
88
96
  if (this.enabled() && this._componentAttachedTo != null && !this._isAnchored) {
89
97
  this._componentAttachedTo.onAnchor(this._anchorCallback);
98
+ this._componentAttachedTo.onDetach(this._detachCallback);
90
99
  }
91
100
  };
92
101
  Interaction.prototype._disconnect = function () {
@@ -95,6 +104,7 @@ var Interaction = /** @class */ (function () {
95
104
  }
96
105
  if (this._componentAttachedTo != null) {
97
106
  this._componentAttachedTo.offAnchor(this._anchorCallback);
107
+ this._componentAttachedTo.offDetach(this._detachCallback);
98
108
  }
99
109
  };
100
110
  return Interaction;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { Component } from "../components/component";
6
6
  import { Interaction } from "./interaction";
7
- export declare type KeyCallback = (keyCode: number) => void;
7
+ export type KeyCallback = (keyCode: number) => void;
8
8
  export declare class Key extends Interaction {
9
9
  /**
10
10
  * A Key Interaction listens to key events that occur while the Component is
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
10
10
  var Utils = require("../utils");
11
11
  var interaction_1 = require("./interaction");
12
12
  var Key = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(Key, _super);
13
+ tslib_1.__extends(Key, _super);
14
14
  function Key() {
15
15
  var _this = _super !== null && _super.apply(this, arguments) || this;
16
16
  _this._keyPressCallbacks = {};
@@ -30,7 +30,14 @@ var Key = /** @class */ (function (_super) {
30
30
  this._keyDispatcher.onKeyUp(this._keyUpCallback);
31
31
  };
32
32
  Key.prototype._unanchor = function () {
33
+ var _this = this;
33
34
  _super.prototype._unanchor.call(this);
35
+ // Preserve held keys through synchronous renderTo(), but discard them if keyup can be missed.
36
+ Promise.resolve().then(function () {
37
+ if (!_this._isAnchored) {
38
+ _this._downedKeys = new Utils.Set();
39
+ }
40
+ });
34
41
  this._positionDispatcher.offMouseMove(this._mouseMoveCallback);
35
42
  this._positionDispatcher = null;
36
43
  this._keyDispatcher.offKeyDown(this._keyDownCallback);
@@ -4,7 +4,11 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.constrainedTranslation = exports.constrainZoomValues = exports.constrainZoomExtents = exports.constrainedZoom = exports.zoomOut = void 0;
7
+ exports.zoomOut = zoomOut;
8
+ exports.constrainedZoom = constrainedZoom;
9
+ exports.constrainZoomExtents = constrainZoomExtents;
10
+ exports.constrainZoomValues = constrainZoomValues;
11
+ exports.constrainedTranslation = constrainedTranslation;
8
12
  /**
9
13
  * Return `value` if its distance to `center` was scaled by `zoom`.
10
14
  *
@@ -16,7 +20,6 @@ exports.constrainedTranslation = exports.constrainZoomValues = exports.constrain
16
20
  function zoomOut(value, zoom, center) {
17
21
  return center - (center - value) * zoom;
18
22
  }
19
- exports.zoomOut = zoomOut;
20
23
  /**
21
24
  * This is the zoomOut method algebra-ed to solve for the `center` value
22
25
  * given the other three. The "target" is the return value of zoomOut.
@@ -32,7 +35,6 @@ function constrainedZoom(scale, zoomAmount, centerPoint, minDomainExtent, maxDom
32
35
  zoomAmount = constrainZoomExtents(scale, zoomAmount, minDomainExtent, maxDomainExtent);
33
36
  return constrainZoomValues(scale, zoomAmount, centerPoint, minDomainValue, maxDomainValue);
34
37
  }
35
- exports.constrainedZoom = constrainedZoom;
36
38
  function constrainZoomExtents(scale, zoomAmount, minDomainExtent, maxDomainExtent) {
37
39
  var extentIncreasing = zoomAmount > 1;
38
40
  var boundingDomainExtent = extentIncreasing ? maxDomainExtent : minDomainExtent;
@@ -44,7 +46,6 @@ function constrainZoomExtents(scale, zoomAmount, minDomainExtent, maxDomainExten
44
46
  var compareF = extentIncreasing ? Math.min : Math.max;
45
47
  return compareF(zoomAmount, boundingDomainExtent / domainExtent);
46
48
  }
47
- exports.constrainZoomExtents = constrainZoomExtents;
48
49
  /**
49
50
  * Modify zoomAmount and centerPoint such that a panzoom will stay inside
50
51
  * the bounds defined by minDomainValue and maxDomainValue.
@@ -113,7 +114,6 @@ function constrainZoomValues(scale, zoomAmount, centerPoint, minDomainValue, max
113
114
  }
114
115
  }
115
116
  }
116
- exports.constrainZoomValues = constrainZoomValues;
117
117
  /**
118
118
  * Returns a new translation value that respects domain min/max value
119
119
  * constraints.
@@ -139,7 +139,6 @@ function constrainedTranslation(scale, translation, minDomainValue, maxDomainVal
139
139
  }
140
140
  return translation;
141
141
  }
142
- exports.constrainedTranslation = constrainedTranslation;
143
142
  /**
144
143
  * Returns true iff the scale.range[1] < scale.range[0].
145
144
  */
@@ -7,10 +7,10 @@ import { Point } from "../core/interfaces";
7
7
  import { TransformableScale } from "../scales/scale";
8
8
  import * as Interactions from "./";
9
9
  import { Interaction } from "./interaction";
10
- export declare type PanCallback = () => void;
11
- export declare type ZoomCallback = () => void;
12
- export declare type PanZoomUpdateCallback = () => void;
13
- export declare type WheelFilter = (wheelEvent: WheelEvent) => boolean;
10
+ export type PanCallback = () => void;
11
+ export type ZoomCallback = () => void;
12
+ export type PanZoomUpdateCallback = () => void;
13
+ export type WheelFilter = (wheelEvent: WheelEvent) => boolean;
14
14
  export declare class PanZoom extends Interaction {
15
15
  /**
16
16
  * The number of pixels occupied in a line.
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.PanZoom = void 0;
8
8
  var tslib_1 = require("tslib");
9
- var d3 = require("d3");
10
9
  var Dispatchers = require("../dispatchers");
11
10
  var Scales = require("../scales");
12
11
  var Utils = require("../utils");
@@ -14,7 +13,7 @@ var Interactions = require("./");
14
13
  var interaction_1 = require("./interaction");
15
14
  var panZoomConstraints_1 = require("./panZoomConstraints");
16
15
  var PanZoom = /** @class */ (function (_super) {
17
- (0, tslib_1.__extends)(PanZoom, _super);
16
+ tslib_1.__extends(PanZoom, _super);
18
17
  /**
19
18
  * A PanZoom Interaction updates the domains of an x-scale and/or a y-scale
20
19
  * in response to the user panning or zooming.
@@ -38,7 +37,7 @@ var PanZoom = /** @class */ (function (_super) {
38
37
  _this._yScales = new Utils.Set();
39
38
  _this._dragInteraction = new Interactions.Drag();
40
39
  _this._setupDragInteraction();
41
- _this._touchIds = d3.map();
40
+ _this._touchIds = new Map();
42
41
  _this._minDomainExtents = new Utils.Map();
43
42
  _this._maxDomainExtents = new Utils.Map();
44
43
  _this._minDomainValues = new Utils.Map();
@@ -141,7 +140,13 @@ var PanZoom = /** @class */ (function (_super) {
141
140
  this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
142
141
  };
143
142
  PanZoom.prototype._unanchor = function () {
143
+ var _this = this;
144
144
  _super.prototype._unanchor.call(this);
145
+ Promise.resolve().then(function () {
146
+ if (!_this._isAnchored) {
147
+ _this._touchIds.clear();
148
+ }
149
+ });
145
150
  this._mouseDispatcher.offWheel(this._wheelCallback);
146
151
  this._mouseDispatcher = null;
147
152
  this._touchDispatcher.offTouchStart(this._touchStartCallback);
@@ -152,17 +157,17 @@ var PanZoom = /** @class */ (function (_super) {
152
157
  this._dragInteraction.detach();
153
158
  };
154
159
  PanZoom.prototype._handleTouchStart = function (ids, idToPoint, e) {
155
- for (var i = 0; i < ids.length && this._touchIds.size() < 2; i++) {
160
+ for (var i = 0; i < ids.length && this._touchIds.size < 2; i++) {
156
161
  var id = ids[i];
157
162
  this._touchIds.set(id.toString(), this._translateToComponentSpace(idToPoint[id]));
158
163
  }
159
164
  };
160
165
  PanZoom.prototype._handlePinch = function (ids, idToPoint, e) {
161
166
  var _this = this;
162
- if (this._touchIds.size() < 2) {
167
+ if (this._touchIds.size < 2) {
163
168
  return;
164
169
  }
165
- var oldPoints = this._touchIds.values();
170
+ var oldPoints = Array.from(this._touchIds.values());
166
171
  if (!this._isInsideComponent(this._translateToComponentSpace(oldPoints[0])) || !this._isInsideComponent(this._translateToComponentSpace(oldPoints[1]))) {
167
172
  return;
168
173
  }
@@ -175,7 +180,7 @@ var PanZoom = /** @class */ (function (_super) {
175
180
  _this._touchIds.set(id.toString(), _this._translateToComponentSpace(idToPoint[id]));
176
181
  }
177
182
  });
178
- var points = this._touchIds.values();
183
+ var points = Array.from(this._touchIds.values());
179
184
  var newCornerDistance = PanZoom._pointDistance(points[0], points[1]);
180
185
  if (newCornerDistance === 0) {
181
186
  return;
@@ -219,9 +224,9 @@ var PanZoom = /** @class */ (function (_super) {
219
224
  PanZoom.prototype._handleTouchEnd = function (ids, idToPoint, e) {
220
225
  var _this = this;
221
226
  ids.forEach(function (id) {
222
- _this._touchIds.remove(id.toString());
227
+ _this._touchIds.delete(id.toString());
223
228
  });
224
- if (this._touchIds.size() > 0) {
229
+ if (this._touchIds.size > 0) {
225
230
  this._zoomEndCallbacks.callCallbacks();
226
231
  }
227
232
  };
@@ -252,7 +257,7 @@ var PanZoom = /** @class */ (function (_super) {
252
257
  var lastDragPoint;
253
258
  this._dragInteraction.onDragStart(function () { return lastDragPoint = null; });
254
259
  this._dragInteraction.onDrag(function (startPoint, endPoint) {
255
- if (_this._touchIds.size() >= 2) {
260
+ if (_this._touchIds.size >= 2) {
256
261
  return;
257
262
  }
258
263
  var translateAmount = {
@@ -5,7 +5,7 @@
5
5
  import { Component } from "../components/component";
6
6
  import { Point } from "../core/interfaces";
7
7
  import { Interaction } from "./interaction";
8
- export declare type PointerCallback = (point: Point) => void;
8
+ export type PointerCallback = (point: Point) => void;
9
9
  export declare class Pointer extends Interaction {
10
10
  private _mouseDispatcher;
11
11
  private _touchDispatcher;
@@ -10,7 +10,7 @@ var Dispatchers = require("../dispatchers");
10
10
  var Utils = require("../utils");
11
11
  var interaction_1 = require("./interaction");
12
12
  var Pointer = /** @class */ (function (_super) {
13
- (0, tslib_1.__extends)(Pointer, _super);
13
+ tslib_1.__extends(Pointer, _super);
14
14
  function Pointer() {
15
15
  var _this = _super !== null && _super.apply(this, arguments) || this;
16
16
  _this._overComponent = false;
@@ -29,7 +29,14 @@ var Pointer = /** @class */ (function (_super) {
29
29
  this._touchDispatcher.onTouchStart(this._touchStartCallback);
30
30
  };
31
31
  Pointer.prototype._unanchor = function () {
32
+ var _this = this;
32
33
  _super.prototype._unanchor.call(this);
34
+ // Preserve hover through synchronous renderTo(), but discard state if pointer events can be missed.
35
+ Promise.resolve().then(function () {
36
+ if (!_this._isAnchored) {
37
+ _this._overComponent = false;
38
+ }
39
+ });
33
40
  this._mouseDispatcher.offMouseMove(this._mouseMoveCallback);
34
41
  this._mouseDispatcher = null;
35
42
  this._touchDispatcher.offTouchStart(this._touchStartCallback);
@@ -6,8 +6,8 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.sign = void 0;
8
8
  var tslib_1 = require("tslib");
9
- (0, tslib_1.__exportStar)(require("./memoize"), exports);
10
- (0, tslib_1.__exportStar)(require("./memoizeProjectors"), exports);
11
- (0, tslib_1.__exportStar)(require("./memThunk"), exports);
9
+ tslib_1.__exportStar(require("./memoize"), exports);
10
+ tslib_1.__exportStar(require("./memoizeProjectors"), exports);
11
+ tslib_1.__exportStar(require("./memThunk"), exports);
12
12
  var signature_1 = require("./signature");
13
13
  Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return signature_1.sign; } });
@@ -5,7 +5,7 @@
5
5
  * of creating a memoized function that takes its inputs from mutable class properties.
6
6
  */
7
7
  import { MemoizedFunction } from "./index";
8
- export declare type Thunk<R> = () => R;
8
+ export type Thunk<R> = () => R;
9
9
  export declare function memThunk<I1, O>(arg1: Thunk<I1>, compute: (this: void, arg1: I1) => O): MemoizedFunction<Thunk<O>>;
10
10
  export declare function memThunk<I1, I2, O>(arg1: Thunk<I1>, arg2: Thunk<I2>, compute: (this: void, arg1: I1, arg2: I2) => O): MemoizedFunction<Thunk<O>>;
11
11
  export declare function memThunk<I1, I2, I3, O>(arg1: Thunk<I1>, arg2: Thunk<I2>, arg3: Thunk<I3>, compute: (this: void, arg1: I1, arg2: I2, arg3: I3) => O): MemoizedFunction<Thunk<O>>;
@@ -6,7 +6,7 @@
6
6
  * of creating a memoized function that takes its inputs from mutable class properties.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.memThunk = void 0;
9
+ exports.memThunk = memThunk;
10
10
  var index_1 = require("./index");
11
11
  /**
12
12
  * First pass argument thunks that will be evaluated whenever the memThunk
@@ -35,4 +35,3 @@ function memThunk() {
35
35
  };
36
36
  return memoizedThunk;
37
37
  }
38
- exports.memThunk = memThunk;
@@ -21,7 +21,7 @@ export interface IMemoizedFunctionMethods {
21
21
  */
22
22
  logPerformance(): this;
23
23
  }
24
- export declare type MemoizedFunction<F extends Function> = F & IMemoizedFunctionMethods;
24
+ export type MemoizedFunction<F extends Function> = F & IMemoizedFunctionMethods;
25
25
  /**
26
26
  * Return a memoized version of the input function. The memoized function
27
27
  * reduces unnecessary invocations of the input by keeping a cache of the
@@ -5,7 +5,7 @@
5
5
  * @fileoverview Implements a function memoizer using the Signature API.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.memoize = void 0;
8
+ exports.memoize = memoize;
9
9
  var signature_1 = require("./signature");
10
10
  /**
11
11
  * Return a memoized version of the input function. The memoized function
@@ -76,4 +76,3 @@ function memoize(compute) {
76
76
  };
77
77
  return memoizeFn;
78
78
  }
79
- exports.memoize = memoize;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.memoizeProjectors = exports.memoizeProjector = void 0;
3
+ exports.memoizeProjector = memoizeProjector;
4
+ exports.memoizeProjectors = memoizeProjectors;
4
5
  var memoize_1 = require("lodash-es/memoize");
5
6
  /**
6
7
  * An index that stores values by numeric key.
@@ -68,11 +69,9 @@ function memoizeProjector(projector) {
68
69
  memo.cache = new DatasetIndexCache();
69
70
  return memo;
70
71
  }
71
- exports.memoizeProjector = memoizeProjector;
72
72
  function memoizeProjectors(attrToProjector) {
73
73
  Object.keys(attrToProjector).forEach(function (key) {
74
74
  attrToProjector[key] = memoizeProjector(attrToProjector[key]);
75
75
  });
76
76
  return attrToProjector;
77
77
  }
78
- exports.memoizeProjectors = memoizeProjectors;
@@ -58,7 +58,7 @@ export declare class ReferenceSignature extends Signature {
58
58
  constructor(ref: any);
59
59
  isSignatureDifferent(other: ReferenceSignature): boolean;
60
60
  }
61
- export declare type ISignatureRecord = Record<string, Signature>;
61
+ export type ISignatureRecord = Record<string, Signature>;
62
62
  /**
63
63
  * A signature for a plain js object.
64
64
  */
@@ -14,7 +14,13 @@
14
14
  * We must hand-write a signature for each custom class we wish to support.
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ObjectSignature = exports.ReferenceSignature = exports.ArraySignature = exports.Signature = exports.signObj = exports.signArray = exports.signRef = exports.signDataset = exports.signScale = exports.sign = void 0;
17
+ exports.ObjectSignature = exports.ReferenceSignature = exports.ArraySignature = exports.Signature = void 0;
18
+ exports.sign = sign;
19
+ exports.signScale = signScale;
20
+ exports.signDataset = signDataset;
21
+ exports.signRef = signRef;
22
+ exports.signArray = signArray;
23
+ exports.signObj = signObj;
18
24
  var tslib_1 = require("tslib");
19
25
  var isPlainObject = require("is-plain-object");
20
26
  var dataset_1 = require("../core/dataset");
@@ -52,7 +58,6 @@ function sign(a) {
52
58
  return signRef(a);
53
59
  }
54
60
  }
55
- exports.sign = sign;
56
61
  function signScale(scale) {
57
62
  var scaleObj = {
58
63
  // required in case the domain has changed without the updateId changing
@@ -67,7 +72,6 @@ function signScale(scale) {
67
72
  };
68
73
  return signObj(scaleObj);
69
74
  }
70
- exports.signScale = signScale;
71
75
  function signDataset(dataset) {
72
76
  var datasetObj = {
73
77
  ref: signRef(dataset),
@@ -77,15 +81,12 @@ function signDataset(dataset) {
77
81
  };
78
82
  return signObj(datasetObj);
79
83
  }
80
- exports.signDataset = signDataset;
81
84
  function signRef(a) {
82
85
  return new ReferenceSignature(a);
83
86
  }
84
- exports.signRef = signRef;
85
87
  function signArray(a) {
86
88
  return new ArraySignature(a.map(function (element) { return sign(element); }));
87
89
  }
88
- exports.signArray = signArray;
89
90
  function signObj(obj) {
90
91
  var signatureRecord = {};
91
92
  for (var key in obj) {
@@ -95,7 +96,6 @@ function signObj(obj) {
95
96
  }
96
97
  return new ObjectSignature(signatureRecord);
97
98
  }
98
- exports.signObj = signObj;
99
99
  /**
100
100
  * Base signature. Subclasses should implement isSignatureDifferent. All classes
101
101
  * should be immutable.
@@ -120,7 +120,7 @@ exports.Signature = Signature;
120
120
  * A signature for an array.
121
121
  */
122
122
  var ArraySignature = /** @class */ (function (_super) {
123
- (0, tslib_1.__extends)(ArraySignature, _super);
123
+ tslib_1.__extends(ArraySignature, _super);
124
124
  function ArraySignature(array) {
125
125
  var _this = _super.call(this) || this;
126
126
  _this.array = array;
@@ -146,7 +146,7 @@ var ArraySignature = /** @class */ (function (_super) {
146
146
  }(Signature));
147
147
  exports.ArraySignature = ArraySignature;
148
148
  var ReferenceSignature = /** @class */ (function (_super) {
149
- (0, tslib_1.__extends)(ReferenceSignature, _super);
149
+ tslib_1.__extends(ReferenceSignature, _super);
150
150
  function ReferenceSignature(ref) {
151
151
  var _this = _super.call(this) || this;
152
152
  _this.ref = ref;
@@ -162,7 +162,7 @@ exports.ReferenceSignature = ReferenceSignature;
162
162
  * A signature for a plain js object.
163
163
  */
164
164
  var ObjectSignature = /** @class */ (function (_super) {
165
- (0, tslib_1.__extends)(ObjectSignature, _super);
165
+ tslib_1.__extends(ObjectSignature, _super);
166
166
  function ObjectSignature(obj) {
167
167
  var _this = _super.call(this) || this;
168
168
  _this.obj = obj;
@@ -9,6 +9,7 @@ var tslib_1 = require("tslib");
9
9
  var d3 = require("d3");
10
10
  var Scales = require("../scales");
11
11
  var Utils = require("../utils");
12
+ var d3ShapeUtils_1 = require("../utils/d3ShapeUtils");
12
13
  var Drawers = require("../drawers");
13
14
  var areaDrawer_1 = require("../drawers/areaDrawer");
14
15
  var drawer_1 = require("../drawers/drawer");
@@ -17,7 +18,7 @@ var Plots = require("./");
17
18
  var linePlot_1 = require("./linePlot");
18
19
  var plot_1 = require("./plot");
19
20
  var Area = /** @class */ (function (_super) {
20
- (0, tslib_1.__extends)(Area, _super);
21
+ tslib_1.__extends(Area, _super);
21
22
  /**
22
23
  * An Area Plot draws a filled region (area) between Y and Y0.
23
24
  *
@@ -210,7 +211,7 @@ var Area = /** @class */ (function (_super) {
210
211
  Area.prototype._createAreaGenerator = function (xProjector, yProjector, y0Projector, definedProjector, dataset) {
211
212
  // just runtime error if user passes curveBundle to area plot
212
213
  var curveFactory = this._getCurveFactory();
213
- var areaGenerator = d3.area()
214
+ var areaGenerator = (0, d3ShapeUtils_1.withFullPrecision)(d3.area())
214
215
  .x(function (innerDatum, innerIndex) { return xProjector(innerDatum, innerIndex, dataset); })
215
216
  .y1(function (innerDatum, innerIndex) { return yProjector(innerDatum, innerIndex, dataset); })
216
217
  .y0(function (innerDatum, innerIndex) { return y0Projector(innerDatum, innerIndex, dataset); })
@@ -220,7 +221,7 @@ var Area = /** @class */ (function (_super) {
220
221
  };
221
222
  Area.prototype._createTopLineGenerator = function (xProjector, yProjector, definedProjector, dataset) {
222
223
  var curveFactory = this._getCurveFactory();
223
- var areaGenerator = d3.line()
224
+ var areaGenerator = (0, d3ShapeUtils_1.withFullPrecision)(d3.line())
224
225
  .x(function (innerDatum, innerIndex) { return xProjector(innerDatum, innerIndex, dataset); })
225
226
  .y(function (innerDatum, innerIndex) { return yProjector(innerDatum, innerIndex, dataset); })
226
227
  .curve(curveFactory)