Skip to content

Commit 3e9ff4c

Browse files
ryan-williamsclaude
andcommitted
convert sunburst/, treemap/, icicle/, table/, sankey/, indicator/, image/ to TypeScript
75 files with real types. Total: 513 .ts / 322 .js (61% converted). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 113a5ac commit 3e9ff4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+251
-191
lines changed

src/traces/icicle/base_plot.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/traces/icicle/base_plot.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { FullLayout, FullTrace, GraphDiv } from '../../../types/core';
2+
import plots from '../../plots/plots.js';
3+
export var name = 'icicle';
4+
5+
export var plot = function(gd: GraphDiv, traces: any[], transitionOpts: any, makeOnCompleteCallback: any) {
6+
plots.plotBasePlot(name, gd, traces, transitionOpts, makeOnCompleteCallback);
7+
};
8+
9+
export var clean = function(newFullData: FullTrace[], newFullLayout: FullLayout, oldFullData: FullTrace[], oldFullLayout: FullLayout) {
10+
plots.cleanBasePlot(name, newFullData, newFullLayout, oldFullData, oldFullLayout);
11+
};
12+
13+
export default { name, plot, clean };

src/traces/icicle/calc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/traces/icicle/calc.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { FullTrace, GraphDiv } from '../../../types/core';
2+
import sunburstCalc from '../sunburst/calc.js';
3+
4+
export var calc = function(gd: GraphDiv, trace: FullTrace) {
5+
return sunburstCalc.calc(gd, trace);
6+
};
7+
8+
export var crossTraceCalc = function(gd: GraphDiv) {
9+
return sunburstCalc._runCrossTraceCalc('icicle', gd);
10+
};
11+
12+
export default { calc, crossTraceCalc };
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { FullLayout, FullTrace, InputTrace } from '../../../types/core';
12
import Lib from '../../lib/index.js';
23
import attributes from './attributes.js';
34
import Color from '../../components/color/index.js';
@@ -12,8 +13,8 @@ import Colorscale from '../../components/colorscale/index.js';
1213
var hasColorscale = Colorscale.hasColorscale;
1314
var colorscaleDefaults = Colorscale.handleDefaults;
1415

15-
export default function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
16-
function coerce(attr, dflt) {
16+
export default function supplyDefaults(traceIn: InputTrace, traceOut: FullTrace, defaultColor: string, layout: FullLayout): void {
17+
function coerce(attr: string, dflt?: any) {
1718
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
1819
}
1920

@@ -62,6 +63,7 @@ export default function supplyDefaults(traceIn, traceOut, defaultColor, layout)
6263
});
6364
coerce('textposition');
6465

66+
// @ts-expect-error pie handleMarkerDefaults accepts variable args
6567
handleMarkerDefaults(traceIn, traceOut, layout, coerce);
6668

6769
var withColorscale = (traceOut._hasColorscale =
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { GraphDiv } from '../../../types/core';
12
import { select } from 'd3-selection';
23
import Lib from '../../lib/index.js';
34
import { font, bBox } from '../../components/drawing/index.js';
@@ -12,7 +13,7 @@ import { formatSliceLabel } from '../sunburst/plot.js';
1213

1314
var onPathbar = false; // for Descendants
1415

15-
export default function drawDescendants(gd, cd, entry, slices, opts) {
16+
export default function drawDescendants(gd: GraphDiv, cd: any[], entry: any, slices: any, opts: any) {
1617
var width = opts.width;
1718
var height = opts.height;
1819
var viewX = opts.viewX;
@@ -178,6 +179,7 @@ export default function drawDescendants(gd, cd, entry, slices, opts) {
178179
s.attr('data-notex', 1);
179180
});
180181

182+
// @ts-expect-error determineTextFont accepts optional 4th arg
181183
var font = Lib.ensureUniformFontSize(gd, helpers.determineTextFont(trace, pt, fullLayout.font));
182184

183185
sliceText.text(pt._text || ' ') // use one space character instead of a blank string to avoid jumps during transition
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import type { FullLayout } from '../../../types/core';
12
import Lib from '../../lib/index.js';
23
import layoutAttributes from './layout_attributes.js';
34

4-
export default function supplyLayoutDefaults(layoutIn, layoutOut) {
5-
function coerce(attr, dflt) {
5+
export default function supplyLayoutDefaults(layoutIn: any, layoutOut: FullLayout): void {
6+
function coerce(attr: string, dflt?: any) {
67
return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);
78
}
89
coerce('iciclecolorway', layoutOut.colorway);

0 commit comments

Comments
 (0)