Skip to content

Commit 5e65ac6

Browse files
authored
d3 7.9.0 (#2020)
* d3 7.9.0 * fix circular imports * d3@^7.9.0 * fix yarn.lock * remove unused import
1 parent 41a63e3 commit 5e65ac6

16 files changed

+846
-1128
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,23 @@
5555
"@types/d3": "^7.4.0",
5656
"@types/mocha": "^10.0.1",
5757
"@types/node": "^20.5.0",
58-
"@typescript-eslint/eslint-plugin": "^6.0.0",
59-
"@typescript-eslint/parser": "^6.0.0",
60-
"c8": "^8.0.1",
58+
"@typescript-eslint/eslint-plugin": "^7.2.0",
59+
"@typescript-eslint/parser": "^7.2.0",
60+
"c8": "^9.1.0",
6161
"canvas": "^2.0.0",
6262
"d3-geo-projection": "^4.0.0",
6363
"eslint": "^8.16.0",
6464
"eslint-config-prettier": "^9.1.0",
6565
"htl": "^0.3.0",
6666
"js-beautify": "1",
67-
"jsdom": "^23.0.1",
67+
"jsdom": "^24.0.0",
6868
"markdown-it-container": "^4.0.0",
6969
"mocha": "^10.0.0",
7070
"module-alias": "^2.0.0",
7171
"prettier": "~3.0.0",
7272
"rollup": "^4.9.1",
7373
"topojson-client": "^3.1.0",
74-
"ts-morph": "^21.0.1",
74+
"ts-morph": "^22.0.0",
7575
"tsx": "^4.7.0",
7676
"typescript": "^5.0.2",
7777
"vite": "^5.0.10",
@@ -88,7 +88,7 @@
8888
]
8989
},
9090
"dependencies": {
91-
"d3": "^7.8.0",
91+
"d3": "^7.9.0",
9292
"interval-tree-1d": "^1.0.0",
9393
"isoformat": "^0.2.0"
9494
},

src/context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {creator, select} from "d3";
2-
import {maybeClip} from "./style.js";
2+
import {maybeClip} from "./options.js";
33

44
export function createContext(options = {}) {
55
const {document = typeof window !== "undefined" ? window.document : undefined, clip} = options;

src/mark.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {channelDomain, createChannels, valueObject} from "./channel.js";
22
import {defined} from "./defined.js";
33
import {maybeFacetAnchor} from "./facet.js";
4-
import {maybeNamed, maybeValue} from "./options.js";
4+
import {maybeClip, maybeNamed, maybeValue} from "./options.js";
55
import {arrayify, isDomainSort, isObject, isOptions, keyword, range, singleton} from "./options.js";
66
import {project} from "./projection.js";
7-
import {maybeClip, styles} from "./style.js";
7+
import {styles} from "./style.js";
88
import {basic, initializer} from "./transforms/basic.js";
99

1010
export class Mark {

src/options.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {descending, quantile, range as rangei} from "d3";
1+
import {quantile, range as rangei} from "d3";
22
import {parse as isoParse} from "isoformat";
33
import {defined} from "./defined.js";
44
import {maybeTimeInterval, maybeUtcInterval} from "./time.js";
@@ -510,16 +510,6 @@ export function maybeFrameAnchor(value = "middle") {
510510
return maybeAnchor(value, "frameAnchor");
511511
}
512512

513-
// Like a sort comparator, returns a positive value if the given array of values
514-
// is in ascending order, a negative value if the values are in descending
515-
// order. Assumes monotonicity; only tests the first and last values.
516-
export function orderof(values) {
517-
if (values == null) return;
518-
const first = values[0];
519-
const last = values[values.length - 1];
520-
return descending(first, last);
521-
}
522-
523513
// Unlike {...defaults, ...options}, this ensures that any undefined (but
524514
// present) properties in options inherit the given default value.
525515
export function inherit(options = {}, ...rest) {
@@ -557,3 +547,12 @@ export function named(things) {
557547
export function maybeNamed(things) {
558548
return isIterable(things) ? named(things) : things;
559549
}
550+
551+
// TODO Accept other types of clips (paths, urls, x, y, other marks…)?
552+
// https://github.com/observablehq/plot/issues/181
553+
export function maybeClip(clip) {
554+
if (clip === true) clip = "frame";
555+
else if (clip === false) clip = null;
556+
else if (clip != null) clip = keyword(clip, "clip", ["frame", "sphere"]);
557+
return clip;
558+
}

src/order.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {descending} from "d3";
2+
3+
// Like a sort comparator, returns a positive value if the given array of values
4+
// is in ascending order, a negative value if the values are in descending
5+
// order. Assumes monotonicity; only tests the first and last values.
6+
export function orderof(values) {
7+
if (values == null) return;
8+
const first = values[0];
9+
const last = values[values.length - 1];
10+
return descending(first, last);
11+
}

src/scales.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
isNumericString,
66
isScaleOptions,
77
map,
8-
orderof,
98
slice,
109
coerceNumbers,
1110
coerceDates
1211
} from "./options.js";
12+
import {orderof} from "./order.js";
1313
import {registry, color, position, radius, opacity, symbol, length} from "./scales/index.js";
1414
import {
1515
createScaleLinear,

src/scales/quantitative.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import {
2424
ticks
2525
} from "d3";
2626
import {finite, negative, positive} from "../defined.js";
27-
import {arrayify, constant, maybeNiceInterval, maybeRangeInterval, orderof, slice} from "../options.js";
27+
import {arrayify, constant, maybeNiceInterval, maybeRangeInterval, slice} from "../options.js";
28+
import {orderof} from "../order.js";
2829
import {color, length, opacity, radius, registry, hasNumericRange} from "./index.js";
2930
import {ordinalRange, quantitativeScheme} from "./schemes.js";
3031

src/scales/schemes.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
schemeGnBu,
4949
schemeGreens,
5050
schemeGreys,
51+
schemeObservable10,
5152
schemeOranges,
5253
schemeOrRd,
5354
schemePaired,
@@ -77,20 +78,6 @@ import {
7778
schemeYlOrRd
7879
} from "d3";
7980

80-
// TODO https://github.com/d3/d3-scale-chromatic/pull/51
81-
const schemeObservable10 = [
82-
"#4269d0",
83-
"#efb118",
84-
"#ff725c",
85-
"#6cc5b0",
86-
"#3ca951",
87-
"#ff8ab7",
88-
"#a463f2",
89-
"#97bbf5",
90-
"#9c6b4e",
91-
"#9498a0"
92-
];
93-
9481
const categoricalSchemes = new Map([
9582
["accent", schemeAccent],
9683
["category10", schemeCategory10],

src/style.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {create} from "./context.js";
33
import {defined, nonempty} from "./defined.js";
44
import {formatDefault} from "./format.js";
55
import {isNone, isNoneish, isRound, maybeColorChannel, maybeNumberChannel} from "./options.js";
6-
import {keyof, keyword, number, string} from "./options.js";
6+
import {keyof, number, string} from "./options.js";
77
import {warn} from "./warnings.js";
88

99
export const offset = (typeof window !== "undefined" ? window.devicePixelRatio > 1 : typeof it === "undefined") ? 0 : 0.5; // prettier-ignore
@@ -297,15 +297,6 @@ export function* groupIndex(I, position, mark, channels) {
297297
}
298298
}
299299

300-
// TODO Accept other types of clips (paths, urls, x, y, other marks…)?
301-
// https://github.com/observablehq/plot/issues/181
302-
export function maybeClip(clip) {
303-
if (clip === true) clip = "frame";
304-
else if (clip === false) clip = null;
305-
else if (clip != null) clip = keyword(clip, "clip", ["frame", "sphere"]);
306-
return clip;
307-
}
308-
309300
// Note: may mutate selection.node!
310301
function applyClip(selection, mark, dimensions, context) {
311302
let clipUrl;

src/time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {utcSecond, utcMinute, utcHour, unixDay, utcWeek, utcMonth, utcYear} from
33
import {utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSunday} from "d3";
44
import {timeSecond, timeMinute, timeHour, timeDay, timeWeek, timeMonth, timeYear} from "d3";
55
import {timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSunday} from "d3";
6-
import {orderof} from "./options.js";
6+
import {orderof} from "./order.js";
77

88
const durationSecond = 1000;
99
const durationMinute = durationSecond * 60;

test/output/projectionBleedEdges.svg

Lines changed: 1 addition & 1 deletion
Loading

test/output/projectionClipAngle.svg

Lines changed: 1 addition & 1 deletion
Loading

test/output/projectionClipAngleFrame.svg

Lines changed: 3 additions & 3 deletions
Loading

test/output/projectionHeightOrthographic.svg

Lines changed: 8 additions & 8 deletions
Loading

test/output/usStateCapitalsVoronoi.svg

Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)