@mui/x-charts-vendor 8.19.0 → 8.22.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/d3-path.d.ts +5 -0
- package/d3-path.js +7 -0
- package/d3-sankey.d.ts +0 -5
- package/es/flatqueue.mjs +8 -0
- package/lib/flatqueue.js +6 -0
- package/lib-vendor/flatqueue/LICENSE +15 -0
- package/lib-vendor/flatqueue/index.js +102 -0
- package/package.json +7 -7
- package/es/d3-sankey.mjs +0 -6
- package/lib/d3-sankey.js +0 -6
- package/lib-vendor/d3-sankey/LICENSE +0 -27
- package/lib-vendor/d3-sankey/dist/d3-sankey.js +0 -438
- package/lib-vendor/d3-sankey/dist/d3-sankey.min.js +0 -329
- package/lib-vendor/d3-sankey/src/align.js +0 -25
- package/lib-vendor/d3-sankey/src/constant.js +0 -11
- package/lib-vendor/d3-sankey/src/index.js +0 -45
- package/lib-vendor/d3-sankey/src/sankey.js +0 -401
- package/lib-vendor/d3-sankey/src/sankeyLinkHorizontal.js +0 -16
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = Sankey;
|
|
8
|
-
var _index = require("../../../lib-vendor/d3-array/src/index.js");
|
|
9
|
-
var _align = require("./align.js");
|
|
10
|
-
var _constant = _interopRequireDefault(require("./constant.js"));
|
|
11
|
-
function ascendingSourceBreadth(a, b) {
|
|
12
|
-
return ascendingBreadth(a.source, b.source) || a.index - b.index;
|
|
13
|
-
}
|
|
14
|
-
function ascendingTargetBreadth(a, b) {
|
|
15
|
-
return ascendingBreadth(a.target, b.target) || a.index - b.index;
|
|
16
|
-
}
|
|
17
|
-
function ascendingBreadth(a, b) {
|
|
18
|
-
return a.y0 - b.y0;
|
|
19
|
-
}
|
|
20
|
-
function value(d) {
|
|
21
|
-
return d.value;
|
|
22
|
-
}
|
|
23
|
-
function defaultId(d) {
|
|
24
|
-
return d.index;
|
|
25
|
-
}
|
|
26
|
-
function defaultNodes(graph) {
|
|
27
|
-
return graph.nodes;
|
|
28
|
-
}
|
|
29
|
-
function defaultLinks(graph) {
|
|
30
|
-
return graph.links;
|
|
31
|
-
}
|
|
32
|
-
function find(nodeById, id) {
|
|
33
|
-
const node = nodeById.get(id);
|
|
34
|
-
if (!node) throw new Error("missing: " + id);
|
|
35
|
-
return node;
|
|
36
|
-
}
|
|
37
|
-
function computeLinkBreadths({
|
|
38
|
-
nodes
|
|
39
|
-
}) {
|
|
40
|
-
for (const node of nodes) {
|
|
41
|
-
let y0 = node.y0;
|
|
42
|
-
let y1 = y0;
|
|
43
|
-
for (const link of node.sourceLinks) {
|
|
44
|
-
link.y0 = y0 + link.width / 2;
|
|
45
|
-
y0 += link.width;
|
|
46
|
-
}
|
|
47
|
-
for (const link of node.targetLinks) {
|
|
48
|
-
link.y1 = y1 + link.width / 2;
|
|
49
|
-
y1 += link.width;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function Sankey() {
|
|
54
|
-
let x0 = 0,
|
|
55
|
-
y0 = 0,
|
|
56
|
-
x1 = 1,
|
|
57
|
-
y1 = 1; // extent
|
|
58
|
-
let dx = 24; // nodeWidth
|
|
59
|
-
let dy = 8,
|
|
60
|
-
py; // nodePadding
|
|
61
|
-
let id = defaultId;
|
|
62
|
-
let align = _align.justify;
|
|
63
|
-
let sort;
|
|
64
|
-
let linkSort;
|
|
65
|
-
let nodes = defaultNodes;
|
|
66
|
-
let links = defaultLinks;
|
|
67
|
-
let iterations = 6;
|
|
68
|
-
function sankey() {
|
|
69
|
-
const graph = {
|
|
70
|
-
nodes: nodes.apply(null, arguments),
|
|
71
|
-
links: links.apply(null, arguments)
|
|
72
|
-
};
|
|
73
|
-
computeNodeLinks(graph);
|
|
74
|
-
computeNodeValues(graph);
|
|
75
|
-
computeNodeDepths(graph);
|
|
76
|
-
computeNodeHeights(graph);
|
|
77
|
-
computeNodeBreadths(graph);
|
|
78
|
-
computeLinkBreadths(graph);
|
|
79
|
-
return graph;
|
|
80
|
-
}
|
|
81
|
-
sankey.update = function (graph) {
|
|
82
|
-
computeLinkBreadths(graph);
|
|
83
|
-
return graph;
|
|
84
|
-
};
|
|
85
|
-
sankey.nodeId = function (_) {
|
|
86
|
-
return arguments.length ? (id = typeof _ === "function" ? _ : (0, _constant.default)(_), sankey) : id;
|
|
87
|
-
};
|
|
88
|
-
sankey.nodeAlign = function (_) {
|
|
89
|
-
return arguments.length ? (align = typeof _ === "function" ? _ : (0, _constant.default)(_), sankey) : align;
|
|
90
|
-
};
|
|
91
|
-
sankey.nodeSort = function (_) {
|
|
92
|
-
return arguments.length ? (sort = _, sankey) : sort;
|
|
93
|
-
};
|
|
94
|
-
sankey.nodeWidth = function (_) {
|
|
95
|
-
return arguments.length ? (dx = +_, sankey) : dx;
|
|
96
|
-
};
|
|
97
|
-
sankey.nodePadding = function (_) {
|
|
98
|
-
return arguments.length ? (dy = py = +_, sankey) : dy;
|
|
99
|
-
};
|
|
100
|
-
sankey.nodes = function (_) {
|
|
101
|
-
return arguments.length ? (nodes = typeof _ === "function" ? _ : (0, _constant.default)(_), sankey) : nodes;
|
|
102
|
-
};
|
|
103
|
-
sankey.links = function (_) {
|
|
104
|
-
return arguments.length ? (links = typeof _ === "function" ? _ : (0, _constant.default)(_), sankey) : links;
|
|
105
|
-
};
|
|
106
|
-
sankey.linkSort = function (_) {
|
|
107
|
-
return arguments.length ? (linkSort = _, sankey) : linkSort;
|
|
108
|
-
};
|
|
109
|
-
sankey.size = function (_) {
|
|
110
|
-
return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];
|
|
111
|
-
};
|
|
112
|
-
sankey.extent = function (_) {
|
|
113
|
-
return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];
|
|
114
|
-
};
|
|
115
|
-
sankey.iterations = function (_) {
|
|
116
|
-
return arguments.length ? (iterations = +_, sankey) : iterations;
|
|
117
|
-
};
|
|
118
|
-
function computeNodeLinks({
|
|
119
|
-
nodes,
|
|
120
|
-
links
|
|
121
|
-
}) {
|
|
122
|
-
for (const [i, node] of nodes.entries()) {
|
|
123
|
-
node.index = i;
|
|
124
|
-
node.sourceLinks = [];
|
|
125
|
-
node.targetLinks = [];
|
|
126
|
-
}
|
|
127
|
-
const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));
|
|
128
|
-
for (const [i, link] of links.entries()) {
|
|
129
|
-
link.index = i;
|
|
130
|
-
let {
|
|
131
|
-
source,
|
|
132
|
-
target
|
|
133
|
-
} = link;
|
|
134
|
-
if (typeof source !== "object") source = link.source = find(nodeById, source);
|
|
135
|
-
if (typeof target !== "object") target = link.target = find(nodeById, target);
|
|
136
|
-
source.sourceLinks.push(link);
|
|
137
|
-
target.targetLinks.push(link);
|
|
138
|
-
}
|
|
139
|
-
if (linkSort != null) {
|
|
140
|
-
for (const {
|
|
141
|
-
sourceLinks,
|
|
142
|
-
targetLinks
|
|
143
|
-
} of nodes) {
|
|
144
|
-
sourceLinks.sort(linkSort);
|
|
145
|
-
targetLinks.sort(linkSort);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function computeNodeValues({
|
|
150
|
-
nodes
|
|
151
|
-
}) {
|
|
152
|
-
for (const node of nodes) {
|
|
153
|
-
node.value = node.fixedValue === undefined ? Math.max((0, _index.sum)(node.sourceLinks, value), (0, _index.sum)(node.targetLinks, value)) : node.fixedValue;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function computeNodeDepths({
|
|
157
|
-
nodes
|
|
158
|
-
}) {
|
|
159
|
-
const n = nodes.length;
|
|
160
|
-
let current = new Set(nodes);
|
|
161
|
-
let next = new Set();
|
|
162
|
-
let x = 0;
|
|
163
|
-
while (current.size) {
|
|
164
|
-
for (const node of current) {
|
|
165
|
-
node.depth = x;
|
|
166
|
-
for (const {
|
|
167
|
-
target
|
|
168
|
-
} of node.sourceLinks) {
|
|
169
|
-
next.add(target);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (++x > n) throw new Error("circular link");
|
|
173
|
-
current = next;
|
|
174
|
-
next = new Set();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function computeNodeHeights({
|
|
178
|
-
nodes
|
|
179
|
-
}) {
|
|
180
|
-
const n = nodes.length;
|
|
181
|
-
let current = new Set(nodes);
|
|
182
|
-
let next = new Set();
|
|
183
|
-
let x = 0;
|
|
184
|
-
while (current.size) {
|
|
185
|
-
for (const node of current) {
|
|
186
|
-
node.height = x;
|
|
187
|
-
for (const {
|
|
188
|
-
source
|
|
189
|
-
} of node.targetLinks) {
|
|
190
|
-
next.add(source);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (++x > n) throw new Error("circular link");
|
|
194
|
-
current = next;
|
|
195
|
-
next = new Set();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function computeNodeLayers({
|
|
199
|
-
nodes
|
|
200
|
-
}) {
|
|
201
|
-
const x = (0, _index.max)(nodes, d => d.depth) + 1;
|
|
202
|
-
const kx = (x1 - x0 - dx) / (x - 1);
|
|
203
|
-
const columns = new Array(x);
|
|
204
|
-
for (const node of nodes) {
|
|
205
|
-
const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));
|
|
206
|
-
node.layer = i;
|
|
207
|
-
node.x0 = x0 + i * kx;
|
|
208
|
-
node.x1 = node.x0 + dx;
|
|
209
|
-
if (columns[i]) columns[i].push(node);else columns[i] = [node];
|
|
210
|
-
}
|
|
211
|
-
if (sort) for (const column of columns) {
|
|
212
|
-
column.sort(sort);
|
|
213
|
-
}
|
|
214
|
-
return columns;
|
|
215
|
-
}
|
|
216
|
-
function initializeNodeBreadths(columns) {
|
|
217
|
-
const ky = (0, _index.min)(columns, c => (y1 - y0 - (c.length - 1) * py) / (0, _index.sum)(c, value));
|
|
218
|
-
for (const nodes of columns) {
|
|
219
|
-
let y = y0;
|
|
220
|
-
for (const node of nodes) {
|
|
221
|
-
node.y0 = y;
|
|
222
|
-
node.y1 = y + node.value * ky;
|
|
223
|
-
y = node.y1 + py;
|
|
224
|
-
for (const link of node.sourceLinks) {
|
|
225
|
-
link.width = link.value * ky;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
y = (y1 - y + py) / (nodes.length + 1);
|
|
229
|
-
for (let i = 0; i < nodes.length; ++i) {
|
|
230
|
-
const node = nodes[i];
|
|
231
|
-
node.y0 += y * (i + 1);
|
|
232
|
-
node.y1 += y * (i + 1);
|
|
233
|
-
}
|
|
234
|
-
reorderLinks(nodes);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
function computeNodeBreadths(graph) {
|
|
238
|
-
const columns = computeNodeLayers(graph);
|
|
239
|
-
py = Math.min(dy, (y1 - y0) / ((0, _index.max)(columns, c => c.length) - 1));
|
|
240
|
-
initializeNodeBreadths(columns);
|
|
241
|
-
for (let i = 0; i < iterations; ++i) {
|
|
242
|
-
const alpha = Math.pow(0.99, i);
|
|
243
|
-
const beta = Math.max(1 - alpha, (i + 1) / iterations);
|
|
244
|
-
relaxRightToLeft(columns, alpha, beta);
|
|
245
|
-
relaxLeftToRight(columns, alpha, beta);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Reposition each node based on its incoming (target) links.
|
|
250
|
-
function relaxLeftToRight(columns, alpha, beta) {
|
|
251
|
-
for (let i = 1, n = columns.length; i < n; ++i) {
|
|
252
|
-
const column = columns[i];
|
|
253
|
-
for (const target of column) {
|
|
254
|
-
let y = 0;
|
|
255
|
-
let w = 0;
|
|
256
|
-
for (const {
|
|
257
|
-
source,
|
|
258
|
-
value
|
|
259
|
-
} of target.targetLinks) {
|
|
260
|
-
let v = value * (target.layer - source.layer);
|
|
261
|
-
y += targetTop(source, target) * v;
|
|
262
|
-
w += v;
|
|
263
|
-
}
|
|
264
|
-
if (!(w > 0)) continue;
|
|
265
|
-
let dy = (y / w - target.y0) * alpha;
|
|
266
|
-
target.y0 += dy;
|
|
267
|
-
target.y1 += dy;
|
|
268
|
-
reorderNodeLinks(target);
|
|
269
|
-
}
|
|
270
|
-
if (sort === undefined) column.sort(ascendingBreadth);
|
|
271
|
-
resolveCollisions(column, beta);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Reposition each node based on its outgoing (source) links.
|
|
276
|
-
function relaxRightToLeft(columns, alpha, beta) {
|
|
277
|
-
for (let n = columns.length, i = n - 2; i >= 0; --i) {
|
|
278
|
-
const column = columns[i];
|
|
279
|
-
for (const source of column) {
|
|
280
|
-
let y = 0;
|
|
281
|
-
let w = 0;
|
|
282
|
-
for (const {
|
|
283
|
-
target,
|
|
284
|
-
value
|
|
285
|
-
} of source.sourceLinks) {
|
|
286
|
-
let v = value * (target.layer - source.layer);
|
|
287
|
-
y += sourceTop(source, target) * v;
|
|
288
|
-
w += v;
|
|
289
|
-
}
|
|
290
|
-
if (!(w > 0)) continue;
|
|
291
|
-
let dy = (y / w - source.y0) * alpha;
|
|
292
|
-
source.y0 += dy;
|
|
293
|
-
source.y1 += dy;
|
|
294
|
-
reorderNodeLinks(source);
|
|
295
|
-
}
|
|
296
|
-
if (sort === undefined) column.sort(ascendingBreadth);
|
|
297
|
-
resolveCollisions(column, beta);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
function resolveCollisions(nodes, alpha) {
|
|
301
|
-
const i = nodes.length >> 1;
|
|
302
|
-
const subject = nodes[i];
|
|
303
|
-
resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);
|
|
304
|
-
resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);
|
|
305
|
-
resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);
|
|
306
|
-
resolveCollisionsTopToBottom(nodes, y0, 0, alpha);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// Push any overlapping nodes down.
|
|
310
|
-
function resolveCollisionsTopToBottom(nodes, y, i, alpha) {
|
|
311
|
-
for (; i < nodes.length; ++i) {
|
|
312
|
-
const node = nodes[i];
|
|
313
|
-
const dy = (y - node.y0) * alpha;
|
|
314
|
-
if (dy > 1e-6) node.y0 += dy, node.y1 += dy;
|
|
315
|
-
y = node.y1 + py;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Push any overlapping nodes up.
|
|
320
|
-
function resolveCollisionsBottomToTop(nodes, y, i, alpha) {
|
|
321
|
-
for (; i >= 0; --i) {
|
|
322
|
-
const node = nodes[i];
|
|
323
|
-
const dy = (node.y1 - y) * alpha;
|
|
324
|
-
if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;
|
|
325
|
-
y = node.y0 - py;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
function reorderNodeLinks({
|
|
329
|
-
sourceLinks,
|
|
330
|
-
targetLinks
|
|
331
|
-
}) {
|
|
332
|
-
if (linkSort === undefined) {
|
|
333
|
-
for (const {
|
|
334
|
-
source: {
|
|
335
|
-
sourceLinks
|
|
336
|
-
}
|
|
337
|
-
} of targetLinks) {
|
|
338
|
-
sourceLinks.sort(ascendingTargetBreadth);
|
|
339
|
-
}
|
|
340
|
-
for (const {
|
|
341
|
-
target: {
|
|
342
|
-
targetLinks
|
|
343
|
-
}
|
|
344
|
-
} of sourceLinks) {
|
|
345
|
-
targetLinks.sort(ascendingSourceBreadth);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
function reorderLinks(nodes) {
|
|
350
|
-
if (linkSort === undefined) {
|
|
351
|
-
for (const {
|
|
352
|
-
sourceLinks,
|
|
353
|
-
targetLinks
|
|
354
|
-
} of nodes) {
|
|
355
|
-
sourceLinks.sort(ascendingTargetBreadth);
|
|
356
|
-
targetLinks.sort(ascendingSourceBreadth);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// Returns the target.y0 that would produce an ideal link from source to target.
|
|
362
|
-
function targetTop(source, target) {
|
|
363
|
-
let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
|
|
364
|
-
for (const {
|
|
365
|
-
target: node,
|
|
366
|
-
width
|
|
367
|
-
} of source.sourceLinks) {
|
|
368
|
-
if (node === target) break;
|
|
369
|
-
y += width + py;
|
|
370
|
-
}
|
|
371
|
-
for (const {
|
|
372
|
-
source: node,
|
|
373
|
-
width
|
|
374
|
-
} of target.targetLinks) {
|
|
375
|
-
if (node === source) break;
|
|
376
|
-
y -= width;
|
|
377
|
-
}
|
|
378
|
-
return y;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// Returns the source.y0 that would produce an ideal link from source to target.
|
|
382
|
-
function sourceTop(source, target) {
|
|
383
|
-
let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
|
|
384
|
-
for (const {
|
|
385
|
-
source: node,
|
|
386
|
-
width
|
|
387
|
-
} of target.targetLinks) {
|
|
388
|
-
if (node === source) break;
|
|
389
|
-
y += width + py;
|
|
390
|
-
}
|
|
391
|
-
for (const {
|
|
392
|
-
target: node,
|
|
393
|
-
width
|
|
394
|
-
} of source.sourceLinks) {
|
|
395
|
-
if (node === target) break;
|
|
396
|
-
y -= width;
|
|
397
|
-
}
|
|
398
|
-
return y;
|
|
399
|
-
}
|
|
400
|
-
return sankey;
|
|
401
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
var _index = require("../../../lib-vendor/d3-shape/src/index.js");
|
|
8
|
-
function horizontalSource(d) {
|
|
9
|
-
return [d.source.x1, d.y0];
|
|
10
|
-
}
|
|
11
|
-
function horizontalTarget(d) {
|
|
12
|
-
return [d.target.x0, d.y1];
|
|
13
|
-
}
|
|
14
|
-
function _default() {
|
|
15
|
-
return (0, _index.linkHorizontal)().source(horizontalSource).target(horizontalTarget);
|
|
16
|
-
}
|