@vitessce/vega 3.5.12 → 3.6.1
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/dist/index.js +23761 -22185
- package/dist-tsc/VegaPlot.d.ts.map +1 -1
- package/dist-tsc/VegaPlot.js +8 -10
- package/dist-tsc/styles.d.ts +1 -1
- package/dist-tsc/styles.d.ts.map +1 -1
- package/dist-tsc/styles.js +19 -17
- package/package.json +7 -7
- package/src/VegaPlot.js +22 -21
- package/src/styles.js +24 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VegaPlot.d.ts","sourceRoot":"","sources":["../src/VegaPlot.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VegaPlot.d.ts","sourceRoot":"","sources":["../src/VegaPlot.js"],"names":[],"mappings":"AA0CA;;;;;;GAMG;AACH,gCALW,MAAM,sBAsFhB"}
|
package/dist-tsc/VegaPlot.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { Suspense, useMemo } from 'react';
|
|
3
3
|
import { Handler } from 'vega-tooltip';
|
|
4
4
|
import * as vegaImport from 'vega';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
5
|
import { useTooltipStyles } from '@vitessce/tooltip';
|
|
7
6
|
import { getInterpolateFunction } from '@vitessce/legend';
|
|
8
7
|
import ReactVega from './ReactVega.js';
|
|
9
8
|
import { DATASET_NAME } from './utils.js';
|
|
10
|
-
import {
|
|
9
|
+
import { VegaGlobalStyles } from './styles.js';
|
|
11
10
|
// Register additional colormaps using vega.scheme().
|
|
12
11
|
// Reference: https://vega.github.io/vega/docs/schemes/
|
|
13
12
|
vegaImport.scheme('jet', getInterpolateFunction('jet'));
|
|
@@ -42,8 +41,7 @@ function renderTooltipContents(tooltipText) {
|
|
|
42
41
|
export function VegaPlot(props) {
|
|
43
42
|
const { spec: partialSpec, data, getTooltipText, signalListeners, renderer = 'svg', onNewView, } = props;
|
|
44
43
|
// eslint-disable-next-line no-unused-vars
|
|
45
|
-
const classes =
|
|
46
|
-
const tooltipClasses = useTooltipStyles();
|
|
44
|
+
const { classes: tooltipClasses } = useTooltipStyles();
|
|
47
45
|
const tooltipHandler = useMemo(() => {
|
|
48
46
|
if (typeof getTooltipText === 'function') {
|
|
49
47
|
const tooltipConfig = {
|
|
@@ -52,7 +50,7 @@ export function VegaPlot(props) {
|
|
|
52
50
|
offsetY: 10,
|
|
53
51
|
// Use table element to match packages/tooltip/TooltipContent implementation.
|
|
54
52
|
formatTooltip: tooltipText => `
|
|
55
|
-
<div class="${
|
|
53
|
+
<div class="${tooltipClasses.tooltipContent}">
|
|
56
54
|
${renderTooltipContents(tooltipText)}
|
|
57
55
|
</div>
|
|
58
56
|
`,
|
|
@@ -71,7 +69,7 @@ export function VegaPlot(props) {
|
|
|
71
69
|
return handlerInstance.call;
|
|
72
70
|
}
|
|
73
71
|
return false;
|
|
74
|
-
}, [getTooltipText,
|
|
72
|
+
}, [getTooltipText, tooltipClasses.tooltipContent]);
|
|
75
73
|
const spec = useMemo(() => ({
|
|
76
74
|
...partialSpec,
|
|
77
75
|
data: (isVega(partialSpec)
|
|
@@ -81,8 +79,8 @@ export function VegaPlot(props) {
|
|
|
81
79
|
]
|
|
82
80
|
: { name: DATASET_NAME }),
|
|
83
81
|
}), [partialSpec]);
|
|
84
|
-
const vegaComponent = useMemo(() => (_jsx(ReactVega, { spec: spec, data: {
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const vegaComponent = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(VegaGlobalStyles, {}), _jsx(ReactVega, { spec: spec, data: {
|
|
83
|
+
[DATASET_NAME]: data,
|
|
84
|
+
}, signalListeners: signalListeners, tooltip: tooltipHandler, renderer: renderer, scaleFactor: 3, onNewView: onNewView }, JSON.stringify({ width: spec.width, height: spec.height }))] })), [spec, data, signalListeners, tooltipHandler, renderer, onNewView]);
|
|
87
85
|
return (spec && data && data.length > 0 ? (_jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: vegaComponent })) : null);
|
|
88
86
|
}
|
package/dist-tsc/styles.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function VegaGlobalStyles(): import(".pnpm/@types+react@19.1.6/node_modules/@types/react").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
package/dist-tsc/styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAEA,8GAsBC"}
|
package/dist-tsc/styles.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { GlobalStyles, useTheme } from '@vitessce/styles';
|
|
3
|
+
export function VegaGlobalStyles() {
|
|
4
|
+
const { theme } = useTheme();
|
|
5
|
+
return (_jsx(GlobalStyles, { styles: {
|
|
6
|
+
'#vg-tooltip-element.vg-tooltip.custom-theme': {
|
|
7
|
+
boxShadow: '0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)',
|
|
8
|
+
padding: '0px',
|
|
9
|
+
backgroundColor: theme.palette.gridLayoutBackground,
|
|
10
|
+
color: theme.palette.secondaryForeground,
|
|
11
|
+
border: 'none',
|
|
12
|
+
opacity: 0.9,
|
|
13
|
+
fontSize: '12px',
|
|
14
|
+
borderRadius: '4px',
|
|
15
|
+
'& > div': {
|
|
16
|
+
backgroundColor: 'transparent',
|
|
17
|
+
},
|
|
15
18
|
},
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}));
|
|
19
|
+
} }));
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/vega",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
"dist-tsc"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@material-ui/core": "~4.12.3",
|
|
20
19
|
"clsx": "^1.1.1",
|
|
21
20
|
"react-vega": "^7.4.4",
|
|
22
21
|
"vega": "^5.21.0",
|
|
23
22
|
"vega-lite": "^5.1.1",
|
|
24
23
|
"vega-tooltip": "^0.27.0",
|
|
25
|
-
"@vitessce/
|
|
26
|
-
"@vitessce/
|
|
24
|
+
"@vitessce/styles": "3.6.1",
|
|
25
|
+
"@vitessce/tooltip": "3.6.1",
|
|
26
|
+
"@vitessce/legend": "3.6.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"react": "^18.0.0",
|
|
30
|
-
"vite": "^
|
|
31
|
-
"vitest": "^
|
|
30
|
+
"vite": "^6.3.5",
|
|
31
|
+
"vitest": "^3.1.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
34
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
|
package/src/VegaPlot.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { Suspense, useMemo } from 'react';
|
|
2
2
|
import { Handler } from 'vega-tooltip';
|
|
3
3
|
import * as vegaImport from 'vega';
|
|
4
|
-
import clsx from 'clsx';
|
|
5
4
|
import { useTooltipStyles } from '@vitessce/tooltip';
|
|
6
5
|
import { getInterpolateFunction } from '@vitessce/legend';
|
|
7
6
|
import ReactVega from './ReactVega.js';
|
|
8
7
|
import { DATASET_NAME } from './utils.js';
|
|
9
|
-
import {
|
|
8
|
+
import { VegaGlobalStyles } from './styles.js';
|
|
10
9
|
|
|
11
10
|
// Register additional colormaps using vega.scheme().
|
|
12
11
|
// Reference: https://vega.github.io/vega/docs/schemes/
|
|
@@ -59,8 +58,7 @@ export function VegaPlot(props) {
|
|
|
59
58
|
} = props;
|
|
60
59
|
|
|
61
60
|
// eslint-disable-next-line no-unused-vars
|
|
62
|
-
const classes =
|
|
63
|
-
const tooltipClasses = useTooltipStyles();
|
|
61
|
+
const { classes: tooltipClasses } = useTooltipStyles();
|
|
64
62
|
|
|
65
63
|
const tooltipHandler = useMemo(() => {
|
|
66
64
|
if (typeof getTooltipText === 'function') {
|
|
@@ -70,7 +68,7 @@ export function VegaPlot(props) {
|
|
|
70
68
|
offsetY: 10,
|
|
71
69
|
// Use table element to match packages/tooltip/TooltipContent implementation.
|
|
72
70
|
formatTooltip: tooltipText => `
|
|
73
|
-
<div class="${
|
|
71
|
+
<div class="${tooltipClasses.tooltipContent}">
|
|
74
72
|
${renderTooltipContents(tooltipText)}
|
|
75
73
|
</div>
|
|
76
74
|
`,
|
|
@@ -89,7 +87,7 @@ export function VegaPlot(props) {
|
|
|
89
87
|
return handlerInstance.call;
|
|
90
88
|
}
|
|
91
89
|
return false;
|
|
92
|
-
}, [getTooltipText,
|
|
90
|
+
}, [getTooltipText, tooltipClasses.tooltipContent]);
|
|
93
91
|
|
|
94
92
|
const spec = useMemo(() => ({
|
|
95
93
|
...partialSpec,
|
|
@@ -103,21 +101,24 @@ export function VegaPlot(props) {
|
|
|
103
101
|
}), [partialSpec]);
|
|
104
102
|
|
|
105
103
|
const vegaComponent = useMemo(() => (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
104
|
+
<>
|
|
105
|
+
<VegaGlobalStyles />
|
|
106
|
+
<ReactVega
|
|
107
|
+
spec={spec}
|
|
108
|
+
data={{
|
|
109
|
+
[DATASET_NAME]: data,
|
|
110
|
+
}}
|
|
111
|
+
signalListeners={signalListeners}
|
|
112
|
+
tooltip={tooltipHandler}
|
|
113
|
+
renderer={renderer}
|
|
114
|
+
scaleFactor={3}
|
|
115
|
+
// We need to force a re-render when the spec
|
|
116
|
+
// is the same except for changed width/height
|
|
117
|
+
// (to support responsive plots).
|
|
118
|
+
key={JSON.stringify({ width: spec.width, height: spec.height })}
|
|
119
|
+
onNewView={onNewView}
|
|
120
|
+
/>
|
|
121
|
+
</>
|
|
121
122
|
), [spec, data, signalListeners, tooltipHandler, renderer, onNewView]);
|
|
122
123
|
|
|
123
124
|
return (
|
package/src/styles.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlobalStyles, useTheme } from '@vitessce/styles';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
export function VegaGlobalStyles() {
|
|
4
|
+
const { theme } = useTheme();
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<GlobalStyles
|
|
8
|
+
styles={{
|
|
9
|
+
'#vg-tooltip-element.vg-tooltip.custom-theme': {
|
|
10
|
+
boxShadow: '0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)',
|
|
11
|
+
padding: '0px',
|
|
12
|
+
backgroundColor: theme.palette.gridLayoutBackground,
|
|
13
|
+
color: theme.palette.secondaryForeground,
|
|
14
|
+
border: 'none',
|
|
15
|
+
opacity: 0.9,
|
|
16
|
+
fontSize: '12px',
|
|
17
|
+
borderRadius: '4px',
|
|
18
|
+
'& > div': {
|
|
19
|
+
backgroundColor: 'transparent',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|