Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match d3 types to installed version per package #1913

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
575 changes: 139 additions & 436 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,19 @@
},
"devDependencies": {
"@playwright/test": "^1.48.2",
"@types/d3": "^7.4.3",
"@types/d3-array": "^2.2.0",
"@types/d3-axis": "^1.0.6",
"@types/d3-brush": "^1.0.4",
"@types/d3-color": "^1.0.3",
"@types/d3-ease": "^1.0.3",
"@types/d3-format": "^1.3.0",
"@types/d3-interpolate": "^1.1.5",
"@types/d3-scale": "^1.0.5",
"@types/d3-selection": "^1.1.0",
"@types/d3-shape": "^1.2.0",
"@types/d3-timer": "^1.0.7",
"@types/d3-transition": "^1.2.0",
"@types/d3-zoom": "^1.1.3",
"@types/leaflet": "^1.9.3",
"@types/node": "^18.15.11",
"@types/webpack-env": "^1.18.2",
Expand Down
3 changes: 2 additions & 1 deletion src/components/tree/phyloTree/change.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Selection, Transition } from "d3";
import { Selection } from "d3-selection";
import { Transition } from "d3-transition";
import { timerFlush } from "d3-timer";
import { calcConfidenceWidth } from "./confidence";
import { applyToChildren, setDisplayOrder } from "./helpers";
Expand Down
3 changes: 2 additions & 1 deletion src/components/tree/phyloTree/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NODE_VISIBLE } from "../../../util/globals";
import { timerStart, timerEnd } from "../../../util/perf";
import { ReduxNode } from "../../../reducers/tree/types";
import { Distance, PhyloNode } from "./types";
import { ScaleContinuousNumeric } from "d3-scale";

/** get a string to be used as the DOM element ID
* Note that this cannot have any "special" characters
Expand Down Expand Up @@ -253,7 +254,7 @@ function areNucleotideMutationsPresent(observedMutations) {
* removing the need to guess.
*/
export function guessAreMutationsPerSite(
scale: d3.ScaleContinuousNumeric<number, number>,
scale: ScaleContinuousNumeric<number, number>,
): boolean {
const maxDivergence = max(scale.domain());
return maxDivergence <= 5;
Expand Down
8 changes: 4 additions & 4 deletions src/components/tree/phyloTree/layouts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-multi-spaces */
/* eslint-disable space-infix-ops */
import { scaleLinear, scalePoint } from "d3-scale";
import { scaleLinear, ScalePoint, scalePoint } from "d3-scale";
import { timerStart, timerEnd } from "../../../util/perf";
import { getTraitFromNode, getDivFromNode } from "../../../util/treeMiscHelpers";
import { stemParent, nodeOrdering } from "./helpers";
Expand Down Expand Up @@ -523,8 +523,8 @@ const JITTER_MIN_STEP_SIZE = 50; // pixels

function padCategoricalScales(
domain: string[],
scale: d3.ScalePoint<string>,
): d3.ScalePoint<string> {
scale: ScalePoint<string>,
): ScalePoint<string> {
if (scale.step() > JITTER_MIN_STEP_SIZE) return scale.padding(0.5); // balanced padding when we can jitter
if (domain.length<=4) return scale.padding(0.4);
if (domain.length<=6) return scale.padding(0.3);
Expand All @@ -537,7 +537,7 @@ function padCategoricalScales(
*/
function jitter(
axis: "x" | "y",
scale: d3.ScalePoint<string>,
scale: ScalePoint<string>,
nodes: PhyloNode[],
): void {
const step = scale.step();
Expand Down
3 changes: 2 additions & 1 deletion src/components/tree/phyloTree/regression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { sum } from "d3-array";
import { formatDivergence, guessAreMutationsPerSite} from "./helpers";
import { NODE_VISIBLE } from "../../../util/globals";
import { PhyloNode, PhyloTreeType, Regression } from "./types";
import { ScaleContinuousNumeric } from "d3-scale";


/**
Expand Down Expand Up @@ -62,7 +63,7 @@ export function calculateRegression(this: PhyloTreeType) {
export function makeRegressionText(
regression: Regression,
layout: string,
yScale: d3.ScaleContinuousNumeric<number, number>,
yScale: ScaleContinuousNumeric<number, number>,
): string {
if (layout==="clock") {
if (guessAreMutationsPerSite(yScale)) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/tree/phyloTree/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getDomId, setDisplayOrder } from "./helpers";
import { makeRegressionText } from "./regression";
import { getEmphasizedColor } from "../../../util/colorHelpers";
import { Callbacks, Distance, Params, PhyloNode, PhyloTreeType } from "./types";
import { Selection } from "d3";
import { Selection } from "d3-selection";
import { Layout, ScatterVariables } from "../../../reducers/controls";
import { ReduxNode, Visibility } from "../../../reducers/tree/types";

Expand Down
2 changes: 1 addition & 1 deletion src/components/tree/phyloTree/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Selection } from "d3";
import { Selection } from "d3-selection";
import { Layout, PerformanceFlags, ScatterVariables } from "../../../reducers/controls";
import { ReduxNode, Visibility } from "../../../reducers/tree/types";
import { change, modifySVG, modifySVGInStages } from "./change";
Expand Down
Loading