victory-vendor 36.4.0 → 36.6.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # victory-vendor
2
+
3
+ ## 36.6.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Update source code with minor lint-based improvements (see [#2236](https://github.com/FormidableLabs/victory/issues/2236)). ([#2403](https://github.com/FormidableLabs/victory/pull/2403))
8
+
9
+ ## 36.5.3 and earlier
10
+
11
+ Change history for version 36.5.3 and earlier can be found in our root [CHANGELOG.md](https://github.com/FormidableLabs/victory/blob/main/CHANGELOG.md).
package/d3-array.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-array` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-array";
package/d3-ease.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-ease` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-ease";
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-interpolate` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-interpolate";
package/d3-scale.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-scale` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-scale";
package/d3-shape.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-shape` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-shape";
package/d3-time.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-time` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-time";
package/d3-timer.d.ts ADDED
@@ -0,0 +1,5 @@
1
+
2
+ // `victory-vendor/d3-timer` (TypeScript)
3
+ //
4
+ // Export the type definitions for this package:
5
+ export * from "@types/d3-timer";
@@ -0,0 +1,6 @@
1
+
2
+ // `victory-vendor/d3-voronoi` (ESM)
3
+ // See upstream license: https://github.com/d3/d3-voronoi/blob/main/LICENSE
4
+ //
5
+ // Our ESM package uses the underlying installed dependencies of `node_modules/d3-voronoi`
6
+ export * from "d3-voronoi";
@@ -0,0 +1,6 @@
1
+
2
+ // `victory-vendor/d3-voronoi` (CommonJS)
3
+ // See upstream license: https://github.com/d3/d3-voronoi/blob/main/LICENSE
4
+ //
5
+ // Our CommonJS package relies on transpiled vendor files in `lib-vendor/d3-voronoi`
6
+ module.exports = require("../lib-vendor/d3-voronoi/src/index.js");
@@ -0,0 +1,50 @@
1
+ Copyright 2010-2016 Mike Bostock
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * Neither the name of the author nor the names of contributors may be used to
15
+ endorse or promote products derived from this software without specific prior
16
+ written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ Copyright (C) 2010-2013 Raymond Hill
30
+ https://github.com/gorhill/Javascript-Voronoi
31
+
32
+ Licensed under The MIT License
33
+ http://en.wikipedia.org/wiki/MIT_License
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
36
+ this software and associated documentation files (the "Software"), to deal in
37
+ the Software without restriction, including without limitation the rights to
38
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
39
+ the Software, and to permit persons to whom the Software is furnished to do so,
40
+ subject to the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be included in all
43
+ copies or substantial portions of the Software.
44
+
45
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
47
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
48
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
49
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
50
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addBeach = addBeach;
7
+ exports.removeBeach = removeBeach;
8
+
9
+ var _RedBlackTree = require("./RedBlackTree");
10
+
11
+ var _Cell = require("./Cell");
12
+
13
+ var _Circle = require("./Circle");
14
+
15
+ var _Edge = require("./Edge");
16
+
17
+ var _Diagram = require("./Diagram");
18
+
19
+ var beachPool = [];
20
+
21
+ function Beach() {
22
+ (0, _RedBlackTree.RedBlackNode)(this);
23
+ this.edge = this.site = this.circle = null;
24
+ }
25
+
26
+ function createBeach(site) {
27
+ var beach = beachPool.pop() || new Beach();
28
+ beach.site = site;
29
+ return beach;
30
+ }
31
+
32
+ function detachBeach(beach) {
33
+ (0, _Circle.detachCircle)(beach);
34
+
35
+ _Diagram.beaches.remove(beach);
36
+
37
+ beachPool.push(beach);
38
+ (0, _RedBlackTree.RedBlackNode)(beach);
39
+ }
40
+
41
+ function removeBeach(beach) {
42
+ var circle = beach.circle,
43
+ x = circle.x,
44
+ y = circle.cy,
45
+ vertex = [x, y],
46
+ previous = beach.P,
47
+ next = beach.N,
48
+ disappearing = [beach];
49
+ detachBeach(beach);
50
+ var lArc = previous;
51
+
52
+ while (lArc.circle && Math.abs(x - lArc.circle.x) < _Diagram.epsilon && Math.abs(y - lArc.circle.cy) < _Diagram.epsilon) {
53
+ previous = lArc.P;
54
+ disappearing.unshift(lArc);
55
+ detachBeach(lArc);
56
+ lArc = previous;
57
+ }
58
+
59
+ disappearing.unshift(lArc);
60
+ (0, _Circle.detachCircle)(lArc);
61
+ var rArc = next;
62
+
63
+ while (rArc.circle && Math.abs(x - rArc.circle.x) < _Diagram.epsilon && Math.abs(y - rArc.circle.cy) < _Diagram.epsilon) {
64
+ next = rArc.N;
65
+ disappearing.push(rArc);
66
+ detachBeach(rArc);
67
+ rArc = next;
68
+ }
69
+
70
+ disappearing.push(rArc);
71
+ (0, _Circle.detachCircle)(rArc);
72
+ var nArcs = disappearing.length,
73
+ iArc;
74
+
75
+ for (iArc = 1; iArc < nArcs; ++iArc) {
76
+ rArc = disappearing[iArc];
77
+ lArc = disappearing[iArc - 1];
78
+ (0, _Edge.setEdgeEnd)(rArc.edge, lArc.site, rArc.site, vertex);
79
+ }
80
+
81
+ lArc = disappearing[0];
82
+ rArc = disappearing[nArcs - 1];
83
+ rArc.edge = (0, _Edge.createEdge)(lArc.site, rArc.site, null, vertex);
84
+ (0, _Circle.attachCircle)(lArc);
85
+ (0, _Circle.attachCircle)(rArc);
86
+ }
87
+
88
+ function addBeach(site) {
89
+ var x = site[0],
90
+ directrix = site[1],
91
+ lArc,
92
+ rArc,
93
+ dxl,
94
+ dxr,
95
+ node = _Diagram.beaches._;
96
+
97
+ while (node) {
98
+ dxl = leftBreakPoint(node, directrix) - x;
99
+ if (dxl > _Diagram.epsilon) node = node.L;else {
100
+ dxr = x - rightBreakPoint(node, directrix);
101
+
102
+ if (dxr > _Diagram.epsilon) {
103
+ if (!node.R) {
104
+ lArc = node;
105
+ break;
106
+ }
107
+
108
+ node = node.R;
109
+ } else {
110
+ if (dxl > -_Diagram.epsilon) {
111
+ lArc = node.P;
112
+ rArc = node;
113
+ } else if (dxr > -_Diagram.epsilon) {
114
+ lArc = node;
115
+ rArc = node.N;
116
+ } else {
117
+ lArc = rArc = node;
118
+ }
119
+
120
+ break;
121
+ }
122
+ }
123
+ }
124
+
125
+ (0, _Cell.createCell)(site);
126
+ var newArc = createBeach(site);
127
+
128
+ _Diagram.beaches.insert(lArc, newArc);
129
+
130
+ if (!lArc && !rArc) return;
131
+
132
+ if (lArc === rArc) {
133
+ (0, _Circle.detachCircle)(lArc);
134
+ rArc = createBeach(lArc.site);
135
+
136
+ _Diagram.beaches.insert(newArc, rArc);
137
+
138
+ newArc.edge = rArc.edge = (0, _Edge.createEdge)(lArc.site, newArc.site);
139
+ (0, _Circle.attachCircle)(lArc);
140
+ (0, _Circle.attachCircle)(rArc);
141
+ return;
142
+ }
143
+
144
+ if (!rArc) {
145
+ // && lArc
146
+ newArc.edge = (0, _Edge.createEdge)(lArc.site, newArc.site);
147
+ return;
148
+ } // else lArc !== rArc
149
+
150
+
151
+ (0, _Circle.detachCircle)(lArc);
152
+ (0, _Circle.detachCircle)(rArc);
153
+ var lSite = lArc.site,
154
+ ax = lSite[0],
155
+ ay = lSite[1],
156
+ bx = site[0] - ax,
157
+ by = site[1] - ay,
158
+ rSite = rArc.site,
159
+ cx = rSite[0] - ax,
160
+ cy = rSite[1] - ay,
161
+ d = 2 * (bx * cy - by * cx),
162
+ hb = bx * bx + by * by,
163
+ hc = cx * cx + cy * cy,
164
+ vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay];
165
+ (0, _Edge.setEdgeEnd)(rArc.edge, lSite, rSite, vertex);
166
+ newArc.edge = (0, _Edge.createEdge)(lSite, site, null, vertex);
167
+ rArc.edge = (0, _Edge.createEdge)(site, rSite, null, vertex);
168
+ (0, _Circle.attachCircle)(lArc);
169
+ (0, _Circle.attachCircle)(rArc);
170
+ }
171
+
172
+ function leftBreakPoint(arc, directrix) {
173
+ var site = arc.site,
174
+ rfocx = site[0],
175
+ rfocy = site[1],
176
+ pby2 = rfocy - directrix;
177
+ if (!pby2) return rfocx;
178
+ var lArc = arc.P;
179
+ if (!lArc) return -Infinity;
180
+ site = lArc.site;
181
+ var lfocx = site[0],
182
+ lfocy = site[1],
183
+ plby2 = lfocy - directrix;
184
+ if (!plby2) return lfocx;
185
+ var hl = lfocx - rfocx,
186
+ aby2 = 1 / pby2 - 1 / plby2,
187
+ b = hl / plby2;
188
+ if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;
189
+ return (rfocx + lfocx) / 2;
190
+ }
191
+
192
+ function rightBreakPoint(arc, directrix) {
193
+ var rArc = arc.N;
194
+ if (rArc) return leftBreakPoint(rArc, directrix);
195
+ var site = arc.site;
196
+ return site[1] === directrix ? site[0] : Infinity;
197
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cellHalfedgeEnd = cellHalfedgeEnd;
7
+ exports.cellHalfedgeStart = cellHalfedgeStart;
8
+ exports.clipCells = clipCells;
9
+ exports.createCell = createCell;
10
+ exports.sortCellHalfedges = sortCellHalfedges;
11
+
12
+ var _Edge = require("./Edge");
13
+
14
+ var _Diagram = require("./Diagram");
15
+
16
+ function createCell(site) {
17
+ return _Diagram.cells[site.index] = {
18
+ site: site,
19
+ halfedges: []
20
+ };
21
+ }
22
+
23
+ function cellHalfedgeAngle(cell, edge) {
24
+ var site = cell.site,
25
+ va = edge.left,
26
+ vb = edge.right;
27
+ if (site === vb) vb = va, va = site;
28
+ if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]);
29
+ if (site === va) va = edge[1], vb = edge[0];else va = edge[0], vb = edge[1];
30
+ return Math.atan2(va[0] - vb[0], vb[1] - va[1]);
31
+ }
32
+
33
+ function cellHalfedgeStart(cell, edge) {
34
+ return edge[+(edge.left !== cell.site)];
35
+ }
36
+
37
+ function cellHalfedgeEnd(cell, edge) {
38
+ return edge[+(edge.left === cell.site)];
39
+ }
40
+
41
+ function sortCellHalfedges() {
42
+ for (var i = 0, n = _Diagram.cells.length, cell, halfedges, j, m; i < n; ++i) {
43
+ if ((cell = _Diagram.cells[i]) && (m = (halfedges = cell.halfedges).length)) {
44
+ var index = new Array(m),
45
+ array = new Array(m);
46
+
47
+ for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, _Diagram.edges[halfedges[j]]);
48
+
49
+ index.sort(function (i, j) {
50
+ return array[j] - array[i];
51
+ });
52
+
53
+ for (j = 0; j < m; ++j) array[j] = halfedges[index[j]];
54
+
55
+ for (j = 0; j < m; ++j) halfedges[j] = array[j];
56
+ }
57
+ }
58
+ }
59
+
60
+ function clipCells(x0, y0, x1, y1) {
61
+ var nCells = _Diagram.cells.length,
62
+ iCell,
63
+ cell,
64
+ site,
65
+ iHalfedge,
66
+ halfedges,
67
+ nHalfedges,
68
+ start,
69
+ startX,
70
+ startY,
71
+ end,
72
+ endX,
73
+ endY,
74
+ cover = true;
75
+
76
+ for (iCell = 0; iCell < nCells; ++iCell) {
77
+ if (cell = _Diagram.cells[iCell]) {
78
+ site = cell.site;
79
+ halfedges = cell.halfedges;
80
+ iHalfedge = halfedges.length; // Remove any dangling clipped edges.
81
+
82
+ while (iHalfedge--) {
83
+ if (!_Diagram.edges[halfedges[iHalfedge]]) {
84
+ halfedges.splice(iHalfedge, 1);
85
+ }
86
+ } // Insert any border edges as necessary.
87
+
88
+
89
+ iHalfedge = 0, nHalfedges = halfedges.length;
90
+
91
+ while (iHalfedge < nHalfedges) {
92
+ end = cellHalfedgeEnd(cell, _Diagram.edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1];
93
+ start = cellHalfedgeStart(cell, _Diagram.edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1];
94
+
95
+ if (Math.abs(endX - startX) > _Diagram.epsilon || Math.abs(endY - startY) > _Diagram.epsilon) {
96
+ halfedges.splice(iHalfedge, 0, _Diagram.edges.push((0, _Edge.createBorderEdge)(site, end, Math.abs(endX - x0) < _Diagram.epsilon && y1 - endY > _Diagram.epsilon ? [x0, Math.abs(startX - x0) < _Diagram.epsilon ? startY : y1] : Math.abs(endY - y1) < _Diagram.epsilon && x1 - endX > _Diagram.epsilon ? [Math.abs(startY - y1) < _Diagram.epsilon ? startX : x1, y1] : Math.abs(endX - x1) < _Diagram.epsilon && endY - y0 > _Diagram.epsilon ? [x1, Math.abs(startX - x1) < _Diagram.epsilon ? startY : y0] : Math.abs(endY - y0) < _Diagram.epsilon && endX - x0 > _Diagram.epsilon ? [Math.abs(startY - y0) < _Diagram.epsilon ? startX : x0, y0] : null)) - 1);
97
+ ++nHalfedges;
98
+ }
99
+ }
100
+
101
+ if (nHalfedges) cover = false;
102
+ }
103
+ } // If there weren’t any edges, have the closest site cover the extent.
104
+ // It doesn’t matter which corner of the extent we measure!
105
+
106
+
107
+ if (cover) {
108
+ var dx,
109
+ dy,
110
+ d2,
111
+ dc = Infinity;
112
+
113
+ for (iCell = 0, cover = null; iCell < nCells; ++iCell) {
114
+ if (cell = _Diagram.cells[iCell]) {
115
+ site = cell.site;
116
+ dx = site[0] - x0;
117
+ dy = site[1] - y0;
118
+ d2 = dx * dx + dy * dy;
119
+ if (d2 < dc) dc = d2, cover = cell;
120
+ }
121
+ }
122
+
123
+ if (cover) {
124
+ var v00 = [x0, y0],
125
+ v01 = [x0, y1],
126
+ v11 = [x1, y1],
127
+ v10 = [x1, y0];
128
+ cover.halfedges.push(_Diagram.edges.push((0, _Edge.createBorderEdge)(site = cover.site, v00, v01)) - 1, _Diagram.edges.push((0, _Edge.createBorderEdge)(site, v01, v11)) - 1, _Diagram.edges.push((0, _Edge.createBorderEdge)(site, v11, v10)) - 1, _Diagram.edges.push((0, _Edge.createBorderEdge)(site, v10, v00)) - 1);
129
+ }
130
+ } // Lastly delete any cells with no edges; these were entirely clipped.
131
+
132
+
133
+ for (iCell = 0; iCell < nCells; ++iCell) {
134
+ if (cell = _Diagram.cells[iCell]) {
135
+ if (!cell.halfedges.length) {
136
+ delete _Diagram.cells[iCell];
137
+ }
138
+ }
139
+ }
140
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attachCircle = attachCircle;
7
+ exports.detachCircle = detachCircle;
8
+ exports.firstCircle = void 0;
9
+
10
+ var _RedBlackTree = require("./RedBlackTree");
11
+
12
+ var _Diagram = require("./Diagram");
13
+
14
+ var circlePool = [];
15
+ var firstCircle;
16
+ exports.firstCircle = firstCircle;
17
+
18
+ function Circle() {
19
+ (0, _RedBlackTree.RedBlackNode)(this);
20
+ this.x = this.y = this.arc = this.site = this.cy = null;
21
+ }
22
+
23
+ function attachCircle(arc) {
24
+ var lArc = arc.P,
25
+ rArc = arc.N;
26
+ if (!lArc || !rArc) return;
27
+ var lSite = lArc.site,
28
+ cSite = arc.site,
29
+ rSite = rArc.site;
30
+ if (lSite === rSite) return;
31
+ var bx = cSite[0],
32
+ by = cSite[1],
33
+ ax = lSite[0] - bx,
34
+ ay = lSite[1] - by,
35
+ cx = rSite[0] - bx,
36
+ cy = rSite[1] - by;
37
+ var d = 2 * (ax * cy - ay * cx);
38
+ if (d >= -_Diagram.epsilon2) return;
39
+ var ha = ax * ax + ay * ay,
40
+ hc = cx * cx + cy * cy,
41
+ x = (cy * ha - ay * hc) / d,
42
+ y = (ax * hc - cx * ha) / d;
43
+ var circle = circlePool.pop() || new Circle();
44
+ circle.arc = arc;
45
+ circle.site = cSite;
46
+ circle.x = x + bx;
47
+ circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom
48
+
49
+ arc.circle = circle;
50
+ var before = null,
51
+ node = _Diagram.circles._;
52
+
53
+ while (node) {
54
+ if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {
55
+ if (node.L) node = node.L;else {
56
+ before = node.P;
57
+ break;
58
+ }
59
+ } else {
60
+ if (node.R) node = node.R;else {
61
+ before = node;
62
+ break;
63
+ }
64
+ }
65
+ }
66
+
67
+ _Diagram.circles.insert(before, circle);
68
+
69
+ if (!before) exports.firstCircle = firstCircle = circle;
70
+ }
71
+
72
+ function detachCircle(arc) {
73
+ var circle = arc.circle;
74
+
75
+ if (circle) {
76
+ if (!circle.P) exports.firstCircle = firstCircle = circle.N;
77
+
78
+ _Diagram.circles.remove(circle);
79
+
80
+ circlePool.push(circle);
81
+ (0, _RedBlackTree.RedBlackNode)(circle);
82
+ arc.circle = null;
83
+ }
84
+ }