Skip to content

Commit

Permalink
Upgrade all d3 depencencies (#1466)
Browse files Browse the repository at this point in the history
* upgrade all d3 dependencies

* update yarn.lock

* add transformIgnorePatterns

* add regenerator-runtime

* fix long dash in unit test

* fix contour

* fix sankey diagram
  • Loading branch information
kenns29 authored Dec 30, 2022
1 parent 6849e0b commit 0e11b3c
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 80 deletions.
4 changes: 3 additions & 1 deletion packages/react-vis/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ module.exports = {
},
setupFilesAfterEnv: ['./jest.setup.js'],
snapshotSerializers: ['enzyme-to-json/serializer'],
transformIgnorePatterns: ['/node_modules/(?!d3-color)']
transformIgnorePatterns: [
'/node_modules/(?!(d3-color|d3-scale|d3-interpolate|d3-hierarchy|d3-format|d3-shape|d3-array|d3-contour|d3-path|internmap|d3-time|d3-geo))'
]
};
1 change: 1 addition & 0 deletions packages/react-vis/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*eslint-env node*/
import 'regenerator-runtime/runtime';
import jsdom from 'jsdom';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Expand Down
23 changes: 12 additions & 11 deletions packages/react-vis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
"prettier": "prettier --write $(git ls-files | grep '.js$')"
},
"dependencies": {
"d3-array": "^1.2.0",
"d3-collection": "^1.0.3",
"d3-array": "^3.2.1",
"d3-collection": "^1.0.7",
"d3-color": "^3.1.0",
"d3-contour": "^1.1.0",
"d3-format": "^1.2.0",
"d3-geo": "^1.6.4",
"d3-contour": "^4.0.0",
"d3-format": "^3.1.0",
"d3-geo": "^3.1.0",
"d3-hexbin": "^0.2.2",
"d3-hierarchy": "^1.1.4",
"d3-interpolate": "^1.1.4",
"d3-sankey": "^0.7.1",
"d3-scale": "^1.0.5",
"d3-shape": "^1.1.0",
"d3-voronoi": "^1.1.2",
"d3-hierarchy": "^3.1.2",
"d3-interpolate": "^3.0.1",
"d3-sankey": "^0.12.3",
"d3-scale": "^4.0.2",
"d3-shape": "^3.2.0",
"d3-voronoi": "^1.1.4",
"deep-equal": "^1.0.1",
"global": "^4.3.1",
"prop-types": "^15.5.8",
Expand Down Expand Up @@ -81,6 +81,7 @@
"react-dom": "^16.0.0",
"react-test-renderer": "^16.13.1",
"react-vis-showcase": "^0.1.0",
"regenerator-runtime": "^0.13.11",
"stylelint": "^7.7.1",
"stylelint-config-standard": "^15.0.1",
"uglify-js": "^2.8.22"
Expand Down
11 changes: 11 additions & 0 deletions packages/react-vis/src/sankey/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ function Sankey(props) {
style,
width
} = props;
// d3-sankey sankeyInstance no longer accepts empty nodes array, return empty XYPlot by default
if (nodes.length === 0) {
return (
<XYPlot
{...props}
yType="literal"
className={getCombinedClassName('rv-sankey', className)}
/>
);
}

const nodesCopy = [...new Array(nodes.length)].map((e, i) => ({
...nodes[i]
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vis/tests/components/arc-series.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('ArcSeries', () => {
<ArcSeriesExample />
</svg>
);
expect($.text()).toBe('UPDATE-4-2024-4-2024');
expect($.text()).toBe('UPDATE−4−2024−4−2024');
// multiplied by two to account for shadow listeners
expect($.find('.rv-xy-plot__series--arc').length).toBe(4);
expect($.find('.rv-xy-plot__series--arc path').length).toBe(2 * 8);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vis/tests/components/bar-series.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('BarSeries', () => {

test('Showcase Example - DifferenceChart', () => {
const $ = mount(<DifferenceChart />);
expect($.text()).toBe('TOGGLE TO CANVAS02468101214-4-20246810');
expect($.text()).toBe('TOGGLE TO CANVAS02468101214−4−20246810');
expect($.find('.rv-xy-plot__series--bar rect').length).toBe(15);
expect($.find('.rv-xy-plot__series').length).toBe(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('CircularGridLines', () => {

test('Showcase Example - FauxRadialScatterplot', () => {
const $ = mount(<FauxRadialScatterplot />);
expect($.text()).toBe('-3-2-10123-3-2-10123');
expect($.text()).toBe('−3−2−10123−3−2−10123');
expect($.find('.rv-xy-plot__circular-grid-lines__line').length).toBe(7);
});
});
2 changes: 1 addition & 1 deletion packages/react-vis/tests/components/contour-series.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ describe('ContourSeries', () => {
const $ = mount(<ContourSeriesExample />);
expect($.text()).toBe('4045505560657075808590951002345678UPDATE');
expect($.find('.rv-xy-plot__series--contour').length).toBe(1);
expect($.find('.rv-xy-plot__series--contour-line').length).toBe(28);
expect($.find('.rv-xy-plot__series--contour-line').length).toBe(17);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('DecorativeAxis', () => {
test('Showcase Example - DecorativeAxisCrissCross', () => {
const $ = mount(<DecorativeAxisCrissCross />);
expect($.text()).toBe(
'-101.01223344556677889100¡1000!¡990!¡980!¡970!¡960!¡950!¡940!¡930!¡920!¡910!¡900!'
'101.01223344556677889100¡1000!¡990!¡980!¡970!¡960!¡950!¡940!¡930!¡920!¡910!¡900!'
);
expect($.find('.rv-xy-manipulable-axis').length).toBe(2);
expect($.find('.rv-xy-plot__axis__tick__line').length).toBe(22);
Expand Down
4 changes: 2 additions & 2 deletions packages/react-vis/tests/components/highlight.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Highlight', () => {
test('ZoomableChartExample', () => {
const $ = mount(<ZoomableChartExample />);
const initialText =
'-5051015200102030405060708090Reset ZoomLast Draw AreaN/A';
'5051015200102030405060708090Reset ZoomLast Draw AreaN/A';
expect($.text()).toBe(initialText);

// brush in a drag area
Expand All @@ -76,7 +76,7 @@ describe('Highlight', () => {
nativeEvent: {offsetX: 200, offsetY: 200}
});
expect($.text()).toBe(
'-5051015200102030405060708090Reset ZoomLast Draw AreaTop: 11.083578425950623Right: 34.98Bottom: -0.5863163548405383Left: 13.2'
'5051015200102030405060708090Reset ZoomLast Draw AreaTop: 11.083578425950623Right: 34.98Bottom: -0.5863163548405383Left: 13.2'
);
});

Expand Down
6 changes: 3 additions & 3 deletions packages/react-vis/tests/components/label-series.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ describe('LabelSeries', () => {
</svg>
);
expect($.text()).toBe(
'UPDATE-101234505101520WigglytuffPsyduckGeodudeDittoSnorlax'
'UPDATE101234505101520WigglytuffPsyduckGeodudeDittoSnorlax'
);
expect($.find('.rv-xy-plot__series--label text').length).toBe(5);

$.find('.showcase-button').simulate('click');
expect($.text()).toBe(
'UPDATE-101234505101520WigglytuffPsyduckGeoduderedblue'
'UPDATE101234505101520WigglytuffPsyduckGeoduderedblue'
);
$.find('.showcase-button').simulate('click');
expect($.text()).toBe(
'UPDATE-101234505101520WigglytuffPsyduckGeoduderedblue'
'UPDATE101234505101520WigglytuffPsyduckGeoduderedblue'
);
});

Expand Down
156 changes: 98 additions & 58 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5572,27 +5572,41 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=

d3-array@1, d3-array@^1.1.1, d3-array@^1.2.0:
version "1.2.4"
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f"
integrity sha1-Y1zk1e6nWfb2BYY9vPww7cc39x8=
"d3-array@1 - 2":
version "2.12.1"
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81"
integrity sha1-4gtBqvzf/fXVCSgATs7PgVpGXoE=
dependencies:
internmap "^1.0.0"

"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@^3.2.0, d3-array@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.1.tgz#39331ea706f5709417d31bbb6ec152e0328b39b3"
integrity sha1-OTMepwb1cJQX0xu7bsFS4DKLObM=
dependencies:
internmap "1 - 2"

d3-collection@1, d3-collection@^1.0.3:
d3-collection@1, d3-collection@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.7.tgz#349bd2aa9977db071091c13144d5e4f16b5b310e"
integrity sha1-NJvSqpl32wcQkcExRNXk8WtbMQ4=

d3-color@1, d3-color@3.1.0, d3-color@^1.0.3, d3-color@^3.1.0:
"d3-color@1 - 3", d3-color@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz#395b2833dfac71507f12ac2f7af23bf819de24e2"
integrity sha1-OVsoM9+scVB/EqwvevI7+BneJOI=

d3-contour@^1.1.0:
version "1.3.2"
resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-1.3.2.tgz#652aacd500d2264cb3423cee10db69f6f59bead3"
integrity sha1-ZSqs1QDSJkyzQjzuENtp9vWb6tM=
d3-color@^1.0.3:
version "1.4.1"
resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.4.1.tgz#c52002bf8846ada4424d55d97982fef26eb3bc8a"
integrity sha1-xSACv4hGraRCTVXZeYL+8m6zvIo=

d3-contour@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-4.0.0.tgz#5a1337c6da0d528479acdb5db54bc81a0ff2ec6b"
integrity sha1-WhM3xtoNUoR5rNtdtUvIGg/y7Gs=
dependencies:
d3-array "^1.1.1"
d3-array "^3.2.0"

d3-dispatch@1:
version "1.0.6"
Expand All @@ -5609,40 +5623,45 @@ d3-force@^1.0.6:
d3-quadtree "1"
d3-timer "1"

d3-format@1, d3-format@^1.2.0:
version "1.4.4"
resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.4.4.tgz#356925f28d0fd7c7983bfad593726fce46844030"
integrity sha1-NWkl8o0P18eYO/rVk3JvzkaEQDA=
"d3-format@1 - 3", d3-format@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-3.1.0.tgz#9260e23a28ea5cb109e93b21a06e24e2ebd55641"
integrity sha1-kmDiOijqXLEJ6TshoG4k4uvVVkE=

d3-geo@^1.6.4:
version "1.12.0"
resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.12.0.tgz#58ddbdf4d9db5f199db69d1b7c93dca6454a6f24"
integrity sha1-WN299NnbXxmdtp0bfJPcpkVKbyQ=
d3-geo@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-3.1.0.tgz#74fd54e1f4cebd5185ac2039217a98d39b0a4c0e"
integrity sha1-dP1U4fTOvVGFrCA5IXqY05sKTA4=
dependencies:
d3-array "1"
d3-array "2.5.0 - 3"

d3-hexbin@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/d3-hexbin/-/d3-hexbin-0.2.2.tgz#9c5837dacfd471ab05337a9e91ef10bfc4f98831"
integrity sha1-nFg32s/UcasFM3qeke8Qv8T5iDE=

d3-hierarchy@^1.1.4:
version "1.1.9"
resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-1.1.9.tgz#2f6bee24caaea43f8dc37545fa01628559647a83"
integrity sha1-L2vuJMqupD+Nw3VF+gFihVlkeoM=
d3-hierarchy@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz#b01cd42c1eed3d46db77a5966cf726f8c09160c6"
integrity sha1-sBzULB7tPUbbd6WWbPcm+MCRYMY=

d3-interpolate@1, d3-interpolate@^1.1.4:
version "1.4.0"
resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.4.0.tgz#526e79e2d80daa383f9e0c1c1c7dcc0f0583e987"
integrity sha1-Um554tgNqjg/ngwcHH3MDwWD6Yc=
"d3-interpolate@1.2.0 - 3", d3-interpolate@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-3.0.1.tgz#3c47aa5b32c5b3dfb56ef3fd4342078a632b400d"
integrity sha1-PEeqWzLFs9+1bvP9Q0IHimMrQA0=
dependencies:
d3-color "1"
d3-color "1 - 3"

d3-path@1:
version "1.0.9"
resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf"
integrity sha1-SMBQux/owmJJOoyvVSTj6VkXAc8=

d3-path@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-3.1.0.tgz#22df939032fb5a71ae8b1800d61ddb7851c42526"
integrity sha1-It+TkDL7WnGuixgA1h3beFHEJSY=

d3-quadtree@1:
version "1.0.7"
resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.7.tgz#ca8b84df7bb53763fe3c2f24bd435137f4e53135"
Expand All @@ -5653,53 +5672,59 @@ d3-random@^1.1.0:
resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.2.tgz#2833be7c124360bf9e2d3fd4f33847cfe6cab291"
integrity sha1-KDO+fBJDYL+eLT/U8zhHz+bKspE=

d3-sankey@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/d3-sankey/-/d3-sankey-0.7.1.tgz#d229832268fc69a7fec84803e96c2256a614c521"
integrity sha1-0imDImj8aaf+yEgD6WwiVqYUxSE=
d3-sankey@^0.12.3:
version "0.12.3"
resolved "https://registry.yarnpkg.com/d3-sankey/-/d3-sankey-0.12.3.tgz#b3c268627bd72e5d80336e8de6acbfec9d15d01d"
integrity sha1-s8JoYnvXLl2AM26N5qy/7J0V0B0=
dependencies:
d3-array "1"
d3-collection "1"
d3-array "1 - 2"
d3-shape "^1.2.0"

d3-scale@^1.0.5:
version "1.0.7"
resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-1.0.7.tgz#fa90324b3ea8a776422bd0472afab0b252a0945d"
integrity sha1-+pAySz6op3ZCK9BHKvqwslKglF0=
d3-scale@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-4.0.2.tgz#82b38e8e8ff7080764f8dcec77bd4be393689396"
integrity sha1-grOOjo/3CAdk+Nzsd71L45Nok5Y=
dependencies:
d3-array "^1.2.0"
d3-collection "1"
d3-color "1"
d3-format "1"
d3-interpolate "1"
d3-time "1"
d3-time-format "2"
d3-array "2.10.0 - 3"
d3-format "1 - 3"
d3-interpolate "1.2.0 - 3"
d3-time "2.1.1 - 3"
d3-time-format "2 - 4"

d3-shape@^1.1.0, d3-shape@^1.2.0:
d3-shape@^1.2.0:
version "1.3.7"
resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7"
integrity sha1-32OAG+B7yYa8VPY3ibT+UCmStdc=
dependencies:
d3-path "1"

d3-time-format@2:
version "2.2.3"
resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.2.3.tgz#0c9a12ee28342b2037e5ea1cf0b9eb4dd75f29cb"
integrity sha1-DJoS7ig0KyA35eoc8LnrTddfKcs=
d3-shape@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-3.2.0.tgz#a1a839cbd9ba45f28674c69d7f855bcf91dfc6a5"
integrity sha1-oag5y9m6RfKGdMadf4Vbz5HfxqU=
dependencies:
d3-time "1"
d3-path "^3.1.0"

d3-time@1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.1.0.tgz#b1e19d307dae9c900b7e5b25ffc5dcc249a8a0f1"
integrity sha1-seGdMH2unJALflsl/8XcwkmooPE=
"d3-time-format@2 - 4":
version "4.1.0"
resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-4.1.0.tgz#7ab5257a5041d11ecb4fe70a5c7d16a195bb408a"
integrity sha1-erUlelBB0R7LT+cKXH0WoZW7QIo=
dependencies:
d3-time "1 - 3"

"d3-time@1 - 3", "d3-time@2.1.1 - 3":
version "3.1.0"
resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-3.1.0.tgz#9310db56e992e3c0175e1ef385e545e48a9bb5c7"
integrity sha1-kxDbVumS48AXXh7zheVF5Iqbtcc=
dependencies:
d3-array "2 - 3"

d3-timer@1:
version "1.0.10"
resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.10.tgz#dfe76b8a91748831b13b6d9c793ffbd508dd9de5"
integrity sha1-3+dripF0iDGxO22ceT/71QjdneU=

d3-voronoi@^1.1.2:
d3-voronoi@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/d3-voronoi/-/d3-voronoi-1.1.4.tgz#dd3c78d7653d2bb359284ae478645d95944c8297"
integrity sha1-3Tx412U9K7NZKErkeGRdlZRMgpc=
Expand Down Expand Up @@ -8691,6 +8716,16 @@ internal-slot@^1.0.2:
has "^1.0.3"
side-channel "^1.0.2"

"internmap@1 - 2":
version "2.0.3"
resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009"
integrity sha1-ZoXyN1XkPFJOJR0py8lySOMGEAk=

internmap@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95"
integrity sha1-ABfMijuZYF8DAvKxmNJy4BXl35U=

interpret@1.2.0, interpret@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296"
Expand Down Expand Up @@ -9632,7 +9667,7 @@ js-base64@^2.1.8, js-base64@^2.1.9:
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.2.tgz#313b6274dda718f714d00b3330bbae6e38e90209"
integrity sha1-MTtidN2nGPcU0AszMLuubjjpAgk=

js-beautify@1.10.3, js-beautify@^1.8.8:
js-beautify@^1.8.8:
version "1.10.3"
resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.3.tgz#c73fa10cf69d3dfa52d8ed624f23c64c0a6a94c1"
integrity sha512-wfk/IAWobz1TfApSdivH5PJ0miIHgDoYb1ugSqHcODPmaYu46rYe5FVuIEkhjg8IQiv6rDNPyhsqbsohI/C2vQ==
Expand Down Expand Up @@ -13397,6 +13432,11 @@ regenerator-runtime@^0.11.0:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk=

regenerator-runtime@^0.13.11:
version "0.13.11"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
integrity sha1-9tyj587sIFkNB62nhWNqkM3KF/k=

regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.3, regenerator-runtime@^0.13.4:
version "0.13.5"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697"
Expand Down

0 comments on commit 0e11b3c

Please sign in to comment.