@jbrowse/core 2.3.3 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseFeatureWidget/BaseFeatureDetail.d.ts +18 -19
- package/BaseFeatureWidget/BaseFeatureDetail.js +64 -61
- package/BaseFeatureWidget/SequenceBox.js +9 -3
- package/BaseFeatureWidget/SequenceFeatureDetails.js +70 -52
- package/BaseFeatureWidget/SequencePanel.d.ts +3 -3
- package/BaseFeatureWidget/SequencePanel.js +8 -5
- package/CorePlugin.js +2 -7
- package/PluginLoader.d.ts +8 -9
- package/PluginLoader.js +35 -41
- package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +8 -0
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +40 -0
- package/data_adapters/CytobandAdapter/configSchema.d.ts +2 -0
- package/data_adapters/CytobandAdapter/configSchema.js +17 -0
- package/data_adapters/CytobandAdapter/index.d.ts +3 -0
- package/data_adapters/CytobandAdapter/index.js +37 -0
- package/package.json +5 -4
- package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
- package/pluggableElementTypes/PluggableElementBase.js +1 -2
- package/pluggableElementTypes/RpcMethodType.d.ts +5 -8
- package/pluggableElementTypes/RpcMethodType.js +22 -33
- package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +13 -2
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +10 -2
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +6 -0
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +9 -1
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +2 -34
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/App.js +3 -18
- package/ui/Dialog.js +8 -1
- package/ui/DropDownMenu.js +1 -4
- package/ui/EditableTypography.js +1 -1
- package/ui/LoadingEllipses.js +6 -6
- package/ui/Menu.js +11 -3
- package/ui/ResizeBar.d.ts +11 -0
- package/ui/ResizeBar.js +94 -0
- package/ui/ResizeHandle.d.ts +1 -1
- package/ui/ResizeHandle.js +1 -1
- package/ui/SanitizedHTML.js +3 -1
- package/ui/ViewContainer.js +3 -38
- package/ui/ViewMenu.d.ts +9 -0
- package/ui/ViewMenu.js +69 -0
- package/ui/ViewPanel.d.ts +19 -0
- package/ui/ViewPanel.js +49 -0
- package/ui/theme.d.ts +10 -156
- package/ui/theme.js +270 -48
- package/util/index.d.ts +16 -9
- package/util/index.js +30 -13
- package/util/map-obj.d.ts +3 -0
- package/util/map-obj.js +33 -0
- package/util/offscreenCanvasUtils.d.ts +18 -4
- package/util/offscreenCanvasUtils.js +48 -7
- package/data_adapters/CytobandAdapter.d.ts +0 -8
- package/data_adapters/CytobandAdapter.js +0 -49
package/ui/theme.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ThemeOptions } from '@mui/material/styles';
|
|
2
|
-
import type { PaletteOptions } from '@mui/material/styles/createPalette';
|
|
3
2
|
declare module '@mui/material/styles/createPalette' {
|
|
4
3
|
interface Palette {
|
|
5
4
|
tertiary: Palette['primary'];
|
|
6
5
|
quaternary: Palette['primary'];
|
|
6
|
+
stopCodon?: string;
|
|
7
|
+
startCodon?: string;
|
|
7
8
|
bases: {
|
|
8
9
|
A: Palette['primary'];
|
|
9
10
|
C: Palette['primary'];
|
|
@@ -14,6 +15,8 @@ declare module '@mui/material/styles/createPalette' {
|
|
|
14
15
|
interface PaletteOptions {
|
|
15
16
|
tertiary?: PaletteOptions['primary'];
|
|
16
17
|
quaternary?: PaletteOptions['primary'];
|
|
18
|
+
stopCodon?: string;
|
|
19
|
+
startCodon?: string;
|
|
17
20
|
bases?: {
|
|
18
21
|
A?: PaletteOptions['primary'];
|
|
19
22
|
C?: PaletteOptions['primary'];
|
|
@@ -22,159 +25,10 @@ declare module '@mui/material/styles/createPalette' {
|
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
export declare const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
secondary: {
|
|
30
|
-
main: string;
|
|
31
|
-
};
|
|
32
|
-
tertiary: import("@mui/material/styles").PaletteColor;
|
|
33
|
-
quaternary: import("@mui/material/styles").PaletteColor;
|
|
34
|
-
stopCodon: string;
|
|
35
|
-
startCodon: string;
|
|
36
|
-
bases: {
|
|
37
|
-
A: import("@mui/material/styles").PaletteColor;
|
|
38
|
-
C: import("@mui/material/styles").PaletteColor;
|
|
39
|
-
G: import("@mui/material/styles").PaletteColor;
|
|
40
|
-
T: import("@mui/material/styles").PaletteColor;
|
|
41
|
-
};
|
|
28
|
+
export declare const defaultThemes: ThemeMap;
|
|
29
|
+
export declare function createJBrowseBaseTheme(theme?: ThemeOptions): ThemeOptions;
|
|
30
|
+
type ThemeMap = {
|
|
31
|
+
[key: string]: ThemeOptions;
|
|
42
32
|
};
|
|
43
|
-
export declare function
|
|
44
|
-
|
|
45
|
-
MuiButton: {
|
|
46
|
-
defaultProps: {
|
|
47
|
-
size: "small";
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
MuiAccordion: {
|
|
51
|
-
defaultProps: {
|
|
52
|
-
disableGutters: boolean;
|
|
53
|
-
TransitionProps: {
|
|
54
|
-
timeout: number;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
MuiFilledInput: {
|
|
59
|
-
defaultProps: {
|
|
60
|
-
margin: "dense";
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
MuiFormControl: {
|
|
64
|
-
defaultProps: {
|
|
65
|
-
margin: "dense";
|
|
66
|
-
size: "small";
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
MuiFormHelperText: {
|
|
70
|
-
defaultProps: {
|
|
71
|
-
margin: "dense";
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
MuiIconButton: {
|
|
75
|
-
defaultProps: {
|
|
76
|
-
size: "small";
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
MuiInputBase: {
|
|
80
|
-
defaultProps: {
|
|
81
|
-
margin: "dense";
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
MuiAutocomplete: {
|
|
85
|
-
defaultProps: {
|
|
86
|
-
size: "small";
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
MuiInputLabel: {
|
|
90
|
-
defaultProps: {
|
|
91
|
-
margin: "dense";
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
MuiToolbar: {
|
|
95
|
-
defaultProps: {
|
|
96
|
-
variant: "dense";
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
MuiListItem: {
|
|
100
|
-
defaultProps: {
|
|
101
|
-
dense: boolean;
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
MuiOutlinedInput: {
|
|
105
|
-
defaultProps: {
|
|
106
|
-
margin: "dense";
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
MuiFab: {
|
|
110
|
-
defaultProps: {
|
|
111
|
-
size: "small";
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
MuiTable: {
|
|
115
|
-
defaultProps: {
|
|
116
|
-
size: "small";
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
MuiMenuList: {
|
|
120
|
-
defaultProps: {
|
|
121
|
-
dense: boolean;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
MuiMenuItem: {
|
|
125
|
-
defaultProps: {
|
|
126
|
-
dense: boolean;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
MuiTextField: {
|
|
130
|
-
defaultProps: {
|
|
131
|
-
margin: "dense";
|
|
132
|
-
variant: "standard";
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
export declare function createJBrowseDefaultOverrides(palette?: PaletteOptions): {
|
|
138
|
-
components: {
|
|
139
|
-
MuiIconButton: {
|
|
140
|
-
styleOverrides: {
|
|
141
|
-
colorSecondary: {
|
|
142
|
-
color: string;
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
MuiButton: {
|
|
147
|
-
styleOverrides: {
|
|
148
|
-
textSecondary: {
|
|
149
|
-
color: string;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
MuiFab: {
|
|
154
|
-
styleOverrides: {
|
|
155
|
-
secondary: {
|
|
156
|
-
backgroundColor: string;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
MuiLink: {
|
|
161
|
-
styleOverrides: {
|
|
162
|
-
root: {
|
|
163
|
-
color: string;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
};
|
|
167
|
-
MuiAccordionSummary: {
|
|
168
|
-
styleOverrides: {
|
|
169
|
-
root: {
|
|
170
|
-
backgroundColor: string;
|
|
171
|
-
};
|
|
172
|
-
content: {
|
|
173
|
-
color: string;
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
export declare function createJBrowseBaseTheme(palette?: PaletteOptions): ThemeOptions;
|
|
180
|
-
export declare function createJBrowseTheme(theme?: ThemeOptions): import("@mui/material/styles").Theme;
|
|
33
|
+
export declare function createJBrowseTheme(configTheme?: ThemeOptions, themes?: ThemeMap, themeName?: string): import("@mui/material/styles").Theme;
|
|
34
|
+
export {};
|
package/ui/theme.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createJBrowseTheme = exports.createJBrowseBaseTheme = exports.
|
|
6
|
+
exports.createJBrowseTheme = exports.createJBrowseBaseTheme = exports.defaultThemes = void 0;
|
|
7
7
|
const colors_1 = require("@mui/material/colors");
|
|
8
8
|
const styles_1 = require("@mui/material/styles");
|
|
9
9
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
@@ -12,28 +12,156 @@ const grape = '#721E63';
|
|
|
12
12
|
const forest = '#135560';
|
|
13
13
|
const mandarin = '#FFB11D';
|
|
14
14
|
const refTheme = (0, styles_1.createTheme)();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
function stockTheme() {
|
|
16
|
+
return {
|
|
17
|
+
palette: {
|
|
18
|
+
mode: undefined,
|
|
19
|
+
primary: { main: midnight },
|
|
20
|
+
secondary: { main: grape },
|
|
21
|
+
tertiary: refTheme.palette.augmentColor({ color: { main: forest } }),
|
|
22
|
+
quaternary: refTheme.palette.augmentColor({ color: { main: mandarin } }),
|
|
23
|
+
stopCodon: '#e22',
|
|
24
|
+
startCodon: '#3e3',
|
|
25
|
+
bases: {
|
|
26
|
+
A: refTheme.palette.augmentColor({ color: colors_1.green }),
|
|
27
|
+
C: refTheme.palette.augmentColor({ color: colors_1.blue }),
|
|
28
|
+
G: refTheme.palette.augmentColor({ color: colors_1.amber }),
|
|
29
|
+
T: refTheme.palette.augmentColor({ color: colors_1.red }),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
components: {
|
|
33
|
+
MuiLink: {
|
|
34
|
+
styleOverrides: {
|
|
35
|
+
// the default link color uses theme.palette.primary.main which is
|
|
36
|
+
// very bad with dark mode+midnight primary
|
|
37
|
+
//
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
root: ({ theme }) => ({
|
|
40
|
+
color: theme.palette.tertiary.main,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function getDefaultTheme() {
|
|
48
|
+
return {
|
|
49
|
+
name: 'Default (from config)',
|
|
50
|
+
...stockTheme(),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function getLightStockTheme() {
|
|
54
|
+
return {
|
|
55
|
+
name: 'Light (stock)',
|
|
56
|
+
...stockTheme(),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function getDarkStockTheme() {
|
|
60
|
+
return {
|
|
61
|
+
name: 'Dark (stock)',
|
|
62
|
+
palette: {
|
|
63
|
+
mode: 'dark',
|
|
64
|
+
primary: { main: midnight },
|
|
65
|
+
secondary: { main: grape },
|
|
66
|
+
tertiary: refTheme.palette.augmentColor({ color: { main: forest } }),
|
|
67
|
+
quaternary: refTheme.palette.augmentColor({ color: { main: mandarin } }),
|
|
68
|
+
stopCodon: '#e22',
|
|
69
|
+
startCodon: '#3e3',
|
|
70
|
+
bases: {
|
|
71
|
+
A: refTheme.palette.augmentColor({ color: colors_1.green }),
|
|
72
|
+
C: refTheme.palette.augmentColor({ color: colors_1.blue }),
|
|
73
|
+
G: refTheme.palette.augmentColor({ color: colors_1.amber }),
|
|
74
|
+
T: refTheme.palette.augmentColor({ color: colors_1.red }),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
components: {
|
|
78
|
+
MuiAppBar: {
|
|
79
|
+
defaultProps: {
|
|
80
|
+
enableColorOnDark: true,
|
|
81
|
+
},
|
|
82
|
+
styleOverrides: {
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
+
primary: (props) => {
|
|
85
|
+
return props.theme.palette.primary.main;
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function getDarkMinimalTheme() {
|
|
93
|
+
return {
|
|
94
|
+
name: 'Dark (minimal)',
|
|
95
|
+
palette: {
|
|
96
|
+
mode: 'dark',
|
|
97
|
+
primary: { main: colors_1.grey[700] },
|
|
98
|
+
secondary: { main: colors_1.grey[800] },
|
|
99
|
+
tertiary: refTheme.palette.augmentColor({ color: { main: colors_1.grey[900] } }),
|
|
100
|
+
quaternary: refTheme.palette.augmentColor({ color: { main: mandarin } }),
|
|
101
|
+
stopCodon: '#e22',
|
|
102
|
+
startCodon: '#3e3',
|
|
103
|
+
bases: {
|
|
104
|
+
A: refTheme.palette.augmentColor({ color: colors_1.green }),
|
|
105
|
+
C: refTheme.palette.augmentColor({ color: colors_1.blue }),
|
|
106
|
+
G: refTheme.palette.augmentColor({ color: colors_1.amber }),
|
|
107
|
+
T: refTheme.palette.augmentColor({ color: colors_1.red }),
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function getMinimalTheme() {
|
|
113
|
+
return {
|
|
114
|
+
name: 'Light (minimal)',
|
|
115
|
+
palette: {
|
|
116
|
+
primary: { main: colors_1.grey[900] },
|
|
117
|
+
secondary: { main: colors_1.grey[800] },
|
|
118
|
+
tertiary: refTheme.palette.augmentColor({ color: { main: colors_1.grey[900] } }),
|
|
119
|
+
quaternary: refTheme.palette.augmentColor({ color: { main: mandarin } }),
|
|
120
|
+
stopCodon: '#e22',
|
|
121
|
+
startCodon: '#3e3',
|
|
122
|
+
bases: {
|
|
123
|
+
A: refTheme.palette.augmentColor({ color: colors_1.green }),
|
|
124
|
+
C: refTheme.palette.augmentColor({ color: colors_1.blue }),
|
|
125
|
+
G: refTheme.palette.augmentColor({ color: colors_1.amber }),
|
|
126
|
+
T: refTheme.palette.augmentColor({ color: colors_1.red }),
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
exports.defaultThemes = {
|
|
132
|
+
default: getDefaultTheme(),
|
|
133
|
+
lightStock: getLightStockTheme(),
|
|
134
|
+
lightMinimal: getMinimalTheme(),
|
|
135
|
+
darkMinimal: getDarkMinimalTheme(),
|
|
136
|
+
darkStock: getDarkStockTheme(),
|
|
29
137
|
};
|
|
30
|
-
function
|
|
138
|
+
function createDefaultProps(theme) {
|
|
139
|
+
var _a, _b, _c, _d, _e, _f;
|
|
31
140
|
return {
|
|
32
141
|
components: {
|
|
33
142
|
MuiButton: {
|
|
34
143
|
defaultProps: {
|
|
35
144
|
size: 'small',
|
|
36
145
|
},
|
|
146
|
+
styleOverrides: {
|
|
147
|
+
// the default button, especially when not using variant=contained, uses
|
|
148
|
+
// theme.palette.primary.main for text which is very bad with dark
|
|
149
|
+
// mode+midnight primary
|
|
150
|
+
//
|
|
151
|
+
// keeps text secondary for darkmode, uses
|
|
152
|
+
// a text-like coloring to ensure contrast
|
|
153
|
+
// xref https://stackoverflow.com/a/72546130/2129219
|
|
154
|
+
//
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
|
+
root: (props) => {
|
|
157
|
+
const { theme } = props;
|
|
158
|
+
return theme.palette.mode === 'dark'
|
|
159
|
+
? {
|
|
160
|
+
color: theme.palette.text.primary,
|
|
161
|
+
}
|
|
162
|
+
: undefined;
|
|
163
|
+
},
|
|
164
|
+
},
|
|
37
165
|
},
|
|
38
166
|
MuiAccordion: {
|
|
39
167
|
defaultProps: {
|
|
@@ -96,12 +224,28 @@ function createJBrowseDefaultProps( /* palette: PaletteOptions = {} */) {
|
|
|
96
224
|
defaultProps: {
|
|
97
225
|
size: 'small',
|
|
98
226
|
},
|
|
227
|
+
styleOverrides: {
|
|
228
|
+
secondary: {
|
|
229
|
+
// @ts-ignore
|
|
230
|
+
backgroundColor: (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.quaternary) === null || _b === void 0 ? void 0 : _b.main,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
99
233
|
},
|
|
100
234
|
MuiTable: {
|
|
101
235
|
defaultProps: {
|
|
102
236
|
size: 'small',
|
|
103
237
|
},
|
|
104
238
|
},
|
|
239
|
+
MuiPopover: {
|
|
240
|
+
defaultProps: {
|
|
241
|
+
transitionDuration: 0,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
MuiMenu: {
|
|
245
|
+
defaultProps: {
|
|
246
|
+
transitionDuration: 0,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
105
249
|
MuiMenuList: {
|
|
106
250
|
defaultProps: {
|
|
107
251
|
dense: true,
|
|
@@ -118,66 +262,125 @@ function createJBrowseDefaultProps( /* palette: PaletteOptions = {} */) {
|
|
|
118
262
|
variant: 'standard',
|
|
119
263
|
},
|
|
120
264
|
},
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
exports.createJBrowseDefaultProps = createJBrowseDefaultProps;
|
|
125
|
-
function createJBrowseDefaultOverrides(palette = {}) {
|
|
126
|
-
const generatedPalette = (0, deepmerge_1.default)(exports.jbrowseDefaultPalette, palette);
|
|
127
|
-
return {
|
|
128
|
-
components: {
|
|
129
|
-
MuiIconButton: {
|
|
265
|
+
MuiLink: {
|
|
130
266
|
styleOverrides: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
267
|
+
// the default link color uses theme.palette.primary.main which is
|
|
268
|
+
// very bad with dark mode+midnight primary
|
|
269
|
+
//
|
|
270
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
271
|
+
root: ({ theme }) => ({
|
|
272
|
+
color: theme.palette.text.secondary,
|
|
273
|
+
}),
|
|
134
274
|
},
|
|
135
275
|
},
|
|
136
|
-
|
|
276
|
+
MuiCheckbox: {
|
|
137
277
|
styleOverrides: {
|
|
138
|
-
|
|
139
|
-
|
|
278
|
+
// the default checkbox-when-checked color uses
|
|
279
|
+
// theme.palette.primary.main which is very bad with dark
|
|
280
|
+
// mode+midnight primary
|
|
281
|
+
//
|
|
282
|
+
// keeps the forest-green checkbox by default but for darkmode, uses
|
|
283
|
+
// a text-like coloring to ensure contrast
|
|
284
|
+
// xref https://stackoverflow.com/a/72546130/2129219
|
|
285
|
+
//
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
|
+
root: (props) => {
|
|
288
|
+
const { theme } = props;
|
|
289
|
+
return theme.palette.mode === 'dark'
|
|
290
|
+
? {
|
|
291
|
+
color: theme.palette.text.secondary,
|
|
292
|
+
'&.Mui-checked': {
|
|
293
|
+
color: theme.palette.text.secondary,
|
|
294
|
+
},
|
|
295
|
+
}
|
|
296
|
+
: undefined;
|
|
140
297
|
},
|
|
141
298
|
},
|
|
142
299
|
},
|
|
143
|
-
|
|
300
|
+
MuiRadio: {
|
|
144
301
|
styleOverrides: {
|
|
145
|
-
|
|
146
|
-
|
|
302
|
+
// the default checkbox-when-checked color uses
|
|
303
|
+
// theme.palette.primary.main which is very bad with dark
|
|
304
|
+
// mode+midnight primary
|
|
305
|
+
//
|
|
306
|
+
// keeps the forest-green checkbox by default but for darkmode, uses
|
|
307
|
+
// a text-like coloring to ensure contrast
|
|
308
|
+
// xref https://stackoverflow.com/a/72546130/2129219
|
|
309
|
+
//
|
|
310
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
311
|
+
root: (props) => {
|
|
312
|
+
const { theme } = props;
|
|
313
|
+
return theme.palette.mode === 'dark'
|
|
314
|
+
? {
|
|
315
|
+
color: theme.palette.text.secondary,
|
|
316
|
+
'&.Mui-checked': {
|
|
317
|
+
color: theme.palette.text.secondary,
|
|
318
|
+
},
|
|
319
|
+
}
|
|
320
|
+
: undefined;
|
|
147
321
|
},
|
|
148
322
|
},
|
|
149
323
|
},
|
|
150
|
-
|
|
324
|
+
MuiFormLabel: {
|
|
151
325
|
styleOverrides: {
|
|
152
|
-
|
|
153
|
-
|
|
326
|
+
// the default checkbox-when-checked color uses
|
|
327
|
+
// theme.palette.primary.main which is very bad with dark
|
|
328
|
+
// mode+midnight primary
|
|
329
|
+
//
|
|
330
|
+
// keeps the forest-green checkbox by default but for darkmode, uses
|
|
331
|
+
// a text-like coloring to ensure contrast
|
|
332
|
+
// xref https://stackoverflow.com/a/72546130/2129219
|
|
333
|
+
//
|
|
334
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
|
+
root: (props) => {
|
|
336
|
+
const { theme } = props;
|
|
337
|
+
return theme.palette.mode === 'dark'
|
|
338
|
+
? {
|
|
339
|
+
color: theme.palette.text.secondary,
|
|
340
|
+
'&.Mui-focused': {
|
|
341
|
+
color: theme.palette.text.secondary,
|
|
342
|
+
},
|
|
343
|
+
}
|
|
344
|
+
: undefined;
|
|
154
345
|
},
|
|
155
346
|
},
|
|
156
347
|
},
|
|
157
348
|
MuiAccordionSummary: {
|
|
158
349
|
styleOverrides: {
|
|
159
350
|
root: {
|
|
160
|
-
|
|
351
|
+
// @ts-ignore
|
|
352
|
+
backgroundColor: (_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.tertiary) === null || _d === void 0 ? void 0 : _d.main,
|
|
161
353
|
},
|
|
162
354
|
content: {
|
|
163
|
-
|
|
355
|
+
// @ts-ignore
|
|
356
|
+
color: (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _e === void 0 ? void 0 : _e.tertiary) === null || _f === void 0 ? void 0 : _f.contrastText,
|
|
164
357
|
},
|
|
165
358
|
},
|
|
166
359
|
},
|
|
360
|
+
MuiToggleButtonGroup: {
|
|
361
|
+
defaultProps: {
|
|
362
|
+
size: 'small',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
167
365
|
},
|
|
168
366
|
};
|
|
169
367
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
palette: exports.jbrowseDefaultPalette,
|
|
368
|
+
function createJBrowseBaseTheme(theme) {
|
|
369
|
+
return (0, deepmerge_1.default)({
|
|
370
|
+
palette: theme === null || theme === void 0 ? void 0 : theme.palette,
|
|
174
371
|
typography: { fontSize: 12 },
|
|
175
372
|
spacing: 4,
|
|
176
|
-
...(
|
|
177
|
-
};
|
|
373
|
+
...createDefaultProps(theme),
|
|
374
|
+
}, theme || {});
|
|
178
375
|
}
|
|
179
376
|
exports.createJBrowseBaseTheme = createJBrowseBaseTheme;
|
|
180
|
-
function createJBrowseTheme(
|
|
377
|
+
function createJBrowseTheme(configTheme = {}, themes = exports.defaultThemes, themeName = 'default') {
|
|
378
|
+
return (0, styles_1.createTheme)(createJBrowseBaseTheme(themeName === 'default'
|
|
379
|
+
? (0, deepmerge_1.default)(themes['default'], augmentTheme(configTheme))
|
|
380
|
+
: augmentThemePlus(themes[themeName]) || themes['default']));
|
|
381
|
+
}
|
|
382
|
+
exports.createJBrowseTheme = createJBrowseTheme;
|
|
383
|
+
function augmentTheme(theme = {}) {
|
|
181
384
|
var _a, _b;
|
|
182
385
|
if ((_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.tertiary) {
|
|
183
386
|
theme = (0, deepmerge_1.default)(theme, {
|
|
@@ -197,6 +400,25 @@ function createJBrowseTheme(theme) {
|
|
|
197
400
|
},
|
|
198
401
|
});
|
|
199
402
|
}
|
|
200
|
-
return
|
|
403
|
+
return theme;
|
|
404
|
+
}
|
|
405
|
+
// creates some blank quaternary/tertiary colors if unsupplied by a user theme
|
|
406
|
+
function augmentThemePlus(theme = {}) {
|
|
407
|
+
var _a, _b;
|
|
408
|
+
theme = augmentTheme(theme);
|
|
409
|
+
if (!((_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.quaternary)) {
|
|
410
|
+
theme = (0, deepmerge_1.default)(theme, {
|
|
411
|
+
palette: {
|
|
412
|
+
quaternary: refTheme.palette.augmentColor({ color: { main: '#aaa' } }),
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (!((_b = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _b === void 0 ? void 0 : _b.tertiary)) {
|
|
417
|
+
theme = (0, deepmerge_1.default)(theme, {
|
|
418
|
+
palette: {
|
|
419
|
+
tertiary: refTheme.palette.augmentColor({ color: { main: '#aaa' } }),
|
|
420
|
+
},
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
return theme;
|
|
201
424
|
}
|
|
202
|
-
exports.createJBrowseTheme = createJBrowseTheme;
|
package/util/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import PluginManager from '../PluginManager';
|
|
2
2
|
import { IAnyStateTreeNode, IStateTreeNode } from 'mobx-state-tree';
|
|
3
3
|
import { IReactionPublic, IReactionOptions } from 'mobx';
|
|
4
|
-
import SimpleFeature, { Feature, isFeature } from './simpleFeature';
|
|
4
|
+
import SimpleFeature, { Feature, SimpleFeatureSerialized, isFeature } from './simpleFeature';
|
|
5
5
|
import { AssemblyManager, Region, TypeTestedByPredicate } from './types';
|
|
6
6
|
import { BaseBlock } from './blockTypes';
|
|
7
|
-
export type { Feature };
|
|
8
7
|
export * from './types';
|
|
9
8
|
export * from './aborting';
|
|
10
9
|
export * from './when';
|
|
11
10
|
export * from './range';
|
|
12
11
|
export * from './dedupe';
|
|
13
12
|
export { SimpleFeature, isFeature };
|
|
13
|
+
export type { Feature, SimpleFeatureSerialized };
|
|
14
14
|
export * from './offscreenCanvasPonyfill';
|
|
15
15
|
export * from './offscreenCanvasUtils';
|
|
16
16
|
export declare const inDevelopment: boolean;
|
|
17
17
|
export declare const inProduction: boolean;
|
|
18
18
|
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
19
|
-
export declare function useDebouncedCallback<
|
|
19
|
+
export declare function useDebouncedCallback<T>(callback: (...args: T[]) => void, wait?: number): (...args: T[]) => void;
|
|
20
20
|
/** find the first node in the hierarchy that matches the given predicate */
|
|
21
21
|
export declare function findParentThat(node: IAnyStateTreeNode, predicate: (thing: IAnyStateTreeNode) => boolean): IAnyStateTreeNode;
|
|
22
22
|
export declare function springAnimate(fromValue: number, toValue: number, setValue: (value: number) => void, onFinish?: () => void, precision?: number, tension?: number, friction?: number): (() => void)[];
|
|
@@ -153,7 +153,7 @@ export declare function bpSpanPx(leftBp: number, rightBp: number, region: {
|
|
|
153
153
|
end: number;
|
|
154
154
|
reversed?: boolean;
|
|
155
155
|
}, bpPerPx: number): [number, number];
|
|
156
|
-
export declare function iterMap<T, U>(
|
|
156
|
+
export declare function iterMap<T, U>(iter: Iterable<T>, func: (arg: T) => U, sizeHint?: number): U[];
|
|
157
157
|
/**
|
|
158
158
|
* Returns the index of the last element in the array where predicate is true,
|
|
159
159
|
* and -1 otherwise.
|
|
@@ -280,8 +280,8 @@ export declare const defaultCodonTable: {
|
|
|
280
280
|
GGT: string;
|
|
281
281
|
};
|
|
282
282
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
283
|
+
* take CodonTable above and generate larger codon table that includes all
|
|
284
|
+
* permutations of upper and lower case nucleotides
|
|
285
285
|
*/
|
|
286
286
|
export declare function generateCodonTable(table: any): {
|
|
287
287
|
[key: string]: string;
|
|
@@ -337,12 +337,19 @@ export declare function getUriLink(value: {
|
|
|
337
337
|
baseUri?: string;
|
|
338
338
|
}): string;
|
|
339
339
|
export declare function getStr(obj: unknown): string;
|
|
340
|
-
export declare function measureGridWidth(elements: string[]
|
|
340
|
+
export declare function measureGridWidth(elements: string[], args?: {
|
|
341
|
+
minWidth?: number;
|
|
342
|
+
fontSize?: number;
|
|
343
|
+
maxWidth?: number;
|
|
344
|
+
padding?: number;
|
|
345
|
+
stripHTML?: boolean;
|
|
346
|
+
}): number;
|
|
341
347
|
export declare function getEnv(obj: any): {
|
|
342
348
|
pluginManager: PluginManager;
|
|
343
349
|
};
|
|
344
350
|
export declare function localStorageGetItem(item: string): string | null | undefined;
|
|
345
|
-
export declare function
|
|
346
|
-
export declare function
|
|
351
|
+
export declare function localStorageSetItem(str: string, item: string): void;
|
|
352
|
+
export declare function max(arr: number[], init?: number): number;
|
|
353
|
+
export declare function min(arr: number[], init?: number): number;
|
|
347
354
|
export declare function sum(arr: number[]): number;
|
|
348
355
|
export declare function avg(arr: number[]): number;
|