Skip to content
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
18 changes: 0 additions & 18 deletions src/components/colorbar/constants.js

This file was deleted.

14 changes: 14 additions & 0 deletions src/components/colorbar/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const cn = {
colorbar: 'colorbar',
cbbg: 'cbbg',
cbfill: 'cbfill',
cbfills: 'cbfills',
cbline: 'cbline',
cblines: 'cblines',
cbaxis: 'cbaxis',
cbtitleunshift: 'cbtitleunshift',
cbtitle: 'cbtitle',
cboutline: 'cboutline',
crisp: 'crisp',
jsPlaceholder: 'js-placeholder'
} as const;
22 changes: 0 additions & 22 deletions src/components/fx/constants.js

This file was deleted.

18 changes: 18 additions & 0 deletions src/components/fx/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Hover labels for multiple horizontal bars get tilted by this angle
export const YANGLE = 60;

// Size and display constants for hover text

// Pixel size of hover arrows
export const HOVERARROWSIZE = 6;
// Pixels padding around text
export const HOVERTEXTPAD = 3;
// Hover font
export const HOVERFONTSIZE = 13;
export const HOVERFONT = 'Arial, sans-serif';

// Minimum time (msec) between hover calls
export const HOVERMINTIME = 50;

// ID suffix (with fullLayout._uid) for hover events in the throttle cache
export const HOVERID = '-hover';
14 changes: 0 additions & 14 deletions src/components/legend/constants.js

This file was deleted.

10 changes: 10 additions & 0 deletions src/components/legend/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const scrollBarWidth = 6;
export const scrollBarMinHeight = 20;
export const scrollBarColor = '#808BA4';
export const scrollBarMargin = 4;
export const scrollBarEnterAttrs = { rx: 20, ry: 3, width: 0, height: 0 } as const;

// Number of px between legend title and (left) side of legend (always in x direction and from inner border)
export const titlePad = 2;
// Number of px between each legend item (x and/or y direction)
export const itemGap = 5;
19 changes: 0 additions & 19 deletions src/components/rangeselector/constants.js

This file was deleted.

13 changes: 13 additions & 0 deletions src/components/rangeselector/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 'y' position pad above counter axis domain
export const yPad = 0.02;

// Minimum button width (regardless of text size)
export const minButtonWidth = 30;

// Buttons rect radii
export const rx = 3;
export const ry = 3;

// Light fraction used to compute the 'activecolor' default
export const lightAmount = 25;
export const darkAmount = 10;
46 changes: 0 additions & 46 deletions src/components/rangeslider/constants.js

This file was deleted.

41 changes: 41 additions & 0 deletions src/components/rangeslider/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Attribute container name
export const name = 'rangeslider';

// Class names

export const containerClassName = 'rangeslider-container';
export const bgClassName = 'rangeslider-bg';
export const rangePlotClassName = 'rangeslider-rangeplot';

export const maskMinClassName = 'rangeslider-mask-min';
export const maskMaxClassName = 'rangeslider-mask-max';
export const slideBoxClassName = 'rangeslider-slidebox';

export const grabberMinClassName = 'rangeslider-grabber-min';
export const grabAreaMinClassName = 'rangeslider-grabarea-min';
export const handleMinClassName = 'rangeslider-handle-min';

export const grabberMaxClassName = 'rangeslider-grabber-max';
export const grabAreaMaxClassName = 'rangeslider-grabarea-max';
export const handleMaxClassName = 'rangeslider-handle-max';

export const maskMinOppAxisClassName = 'rangeslider-mask-min-opp-axis';
export const maskMaxOppAxisClassName = 'rangeslider-mask-max-opp-axis';

// Style constants

export const maskColor = 'rgba(0,0,0,0.4)';
export const maskOppAxisColor = 'rgba(0,0,0,0.2)';

export const slideBoxFill = 'transparent';
export const slideBoxCursor = 'ew-resize';

export const grabAreaFill = 'transparent';
export const grabAreaCursor = 'col-resize';
export const grabAreaWidth = 10;

export const handleWidth = 4;
export const handleRadius = 1;
export const handleStrokeWidth = 1;

export const extraPad = 15;
15 changes: 0 additions & 15 deletions src/components/selections/constants.js

This file was deleted.

11 changes: 11 additions & 0 deletions src/components/selections/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Max pixels off straight before a lasso select line counts as bent
export const BENDPX = 1.5;

// Smallest dimension allowed for a select box
export const MINSELECT = 12;

// Throttling limit (ms) for selectPoints calls
export const SELECTDELAY = 100;

// Cache ID suffix for throttle
export const SELECTID = '-select';
53 changes: 0 additions & 53 deletions src/components/shapes/constants.js

This file was deleted.

57 changes: 57 additions & 0 deletions src/components/shapes/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export const segmentRE = /[MLHVQCTSZ][^MLHVQCTSZ]*/g;
export const paramRE = /[^\s,]+/g;

/**
* Flags for one SVG path command: which numeric params are coordinates, plus
* `drawn`, the index of the param that is a drawn point
*/
type PathParams = Record<string, number | boolean>;

// Which numbers in each path segment are x (or y) values
// drawn is which param is a drawn point, as opposed to a
// control point (which doesn't count toward autorange.
// TODO: this means curved paths could extend beyond the
// autorange bounds. This is a bit tricky to get right
// unless we revert to bounding boxes, but perhaps there's
// a calculation we could do...)
export const paramIsX = {
M: { 0: true, drawn: 0 },
L: { 0: true, drawn: 0 },
H: { 0: true, drawn: 0 },
V: {},
Q: { 0: true, 2: true, drawn: 2 },
C: { 0: true, 2: true, 4: true, drawn: 4 },
T: { 0: true, drawn: 0 },
S: { 0: true, 2: true, drawn: 2 },
// A: {0: true, 5: true},
Z: {}
} as const satisfies Record<PathCommand, PathParams>;

export const paramIsY = {
M: { 1: true, drawn: 1 },
L: { 1: true, drawn: 1 },
H: {},
V: { 0: true, drawn: 0 },
Q: { 1: true, 3: true, drawn: 3 },
C: { 1: true, 3: true, 5: true, drawn: 5 },
T: { 1: true, drawn: 1 },
S: { 1: true, 3: true, drawn: 3 },
// A: {1: true, 6: true},
Z: {}
} as const satisfies Record<PathCommand, PathParams>;

export const numParams = {
M: 2,
L: 2,
H: 1,
V: 1,
Q: 4,
C: 6,
T: 2,
S: 4,
// A: 7,
Z: 0
} as const;

/** One SVG path command letter, such as `M` or `C` */
export type PathCommand = keyof typeof numParams;
14 changes: 0 additions & 14 deletions src/components/shapes/draw_newshape/constants.js

This file was deleted.

10 changes: 10 additions & 0 deletions src/components/shapes/draw_newshape/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const CIRCLE_SIDES = 32; // Should be divisible by 4

export const i000 = 0;
export const i090 = CIRCLE_SIDES / 4;
export const i180 = CIRCLE_SIDES / 2;
export const i270 = (CIRCLE_SIDES / 4) * 3;

export const cos45 = Math.cos(Math.PI / 4);
export const sin45 = Math.sin(Math.PI / 4);
export const SQRT2 = Math.sqrt(2);
Loading
Loading