@vitessce/description 3.4.9 → 3.4.11
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 +9931 -355
- package/dist-tsc/Description.d.ts.map +1 -1
- package/dist-tsc/Description.js +5 -2
- package/dist-tsc/DescriptionSubscriber.d.ts.map +1 -1
- package/dist-tsc/DescriptionSubscriber.js +3 -3
- package/package.json +4 -3
- package/src/Description.js +5 -3
- package/src/DescriptionSubscriber.js +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../src/Description.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../src/Description.js"],"names":[],"mappings":"AAyCA,6DA6BC"}
|
package/dist-tsc/Description.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { makeStyles } from '@material-ui/core';
|
|
4
|
+
import Markdown from 'react-markdown';
|
|
5
|
+
import { DescriptionType } from '@vitessce/constants-internal';
|
|
4
6
|
const useStyles = makeStyles(theme => ({
|
|
5
7
|
description: {
|
|
6
8
|
'& p, details, table': {
|
|
@@ -37,9 +39,10 @@ const useStyles = makeStyles(theme => ({
|
|
|
37
39
|
},
|
|
38
40
|
}));
|
|
39
41
|
export default function Description(props) {
|
|
40
|
-
const { description, metadata } = props;
|
|
42
|
+
const { description, metadata, descriptionType } = props;
|
|
41
43
|
const classes = useStyles();
|
|
42
|
-
return (_jsxs("div", { className: classes.description, children: [
|
|
44
|
+
return (_jsxs("div", { className: classes.description, children: [descriptionType && descriptionType === DescriptionType.MARKDOWN
|
|
45
|
+
? _jsx(Markdown, { children: description }) : _jsx("p", { children: description }), metadata && Array.from(metadata.entries())
|
|
43
46
|
.map(([layerIndex, { name: layerName, metadata: metadataRecord }]) => (metadataRecord && Object.entries(metadataRecord).length > 0 ? (_jsxs("details", { children: [_jsx("summary", { children: layerName }), _jsx("div", { className: classes.metadataContainer, children: _jsx("table", { children: _jsx("tbody", { children: Object.entries(metadataRecord)
|
|
44
47
|
.map(([key, value]) => (_jsxs("tr", { children: [_jsx("th", { title: key, children: key }), _jsx("td", { title: value, children: value })] }, key))) }) }) })] }, layerIndex)) : null))] }));
|
|
45
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionSubscriber.d.ts","sourceRoot":"","sources":["../src/DescriptionSubscriber.js"],"names":[],"mappings":"AAUA;;;;;;;;;;GAUG;AACH,6CAPG;IAAsB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;CAChB,
|
|
1
|
+
{"version":3,"file":"DescriptionSubscriber.d.ts","sourceRoot":"","sources":["../src/DescriptionSubscriber.js"],"names":[],"mappings":"AAUA;;;;;;;;;;GAUG;AACH,6CAPG;IAAsB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;CAChB,eAiEA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { TitleInfo, useReady, useCoordination, useLoaders, useDescription, useImageData, } from '@vitessce/vit-s';
|
|
4
|
-
import { ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-internal';
|
|
4
|
+
import { ViewType, COMPONENT_COORDINATION_TYPES, ViewHelpMapping } from '@vitessce/constants-internal';
|
|
5
5
|
import Description from './Description.js';
|
|
6
6
|
/**
|
|
7
7
|
* A subscriber component for a text description component.
|
|
@@ -15,7 +15,7 @@ import Description from './Description.js';
|
|
|
15
15
|
* @param {string} props.title The component title.
|
|
16
16
|
*/
|
|
17
17
|
export function DescriptionSubscriber(props) {
|
|
18
|
-
const { coordinationScopes, description: descriptionOverride, removeGridComponent, theme, title = 'Description', closeButtonVisible, } = props;
|
|
18
|
+
const { coordinationScopes, description: descriptionOverride, descriptionType, removeGridComponent, theme, title = 'Description', closeButtonVisible, helpText = ViewHelpMapping.DESCRIPTION, } = props;
|
|
19
19
|
const loaders = useLoaders();
|
|
20
20
|
// Get "props" from the coordination space.
|
|
21
21
|
const [{ dataset, spatialImageLayer: rasterLayers, }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.DESCRIPTION], coordinationScopes);
|
|
@@ -40,5 +40,5 @@ export function DescriptionSubscriber(props) {
|
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
}, [rasterLayers, imageLayerMeta, imageLayerLoaders]);
|
|
43
|
-
return (_jsx(TitleInfo, { title: title, closeButtonVisible: closeButtonVisible, removeGridComponent: removeGridComponent, isScroll: true, theme: theme, isReady: isReady, children: _jsx(Description, { description: descriptionOverride || description, metadata: metadata }) }));
|
|
43
|
+
return (_jsx(TitleInfo, { title: title, closeButtonVisible: closeButtonVisible, removeGridComponent: removeGridComponent, isScroll: true, theme: theme, isReady: isReady, helpText: helpText, children: _jsx(Description, { description: descriptionOverride || description, descriptionType: descriptionType, metadata: metadata }) }));
|
|
44
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/description",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.11",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@material-ui/core": "~4.12.3",
|
|
20
|
-
"
|
|
21
|
-
"@vitessce/
|
|
20
|
+
"react-markdown": "^9.0.1",
|
|
21
|
+
"@vitessce/constants-internal": "3.4.11",
|
|
22
|
+
"@vitessce/vit-s": "3.4.11"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@testing-library/jest-dom": "^5.16.4",
|
package/src/Description.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { makeStyles } from '@material-ui/core';
|
|
3
|
+
import Markdown from 'react-markdown';
|
|
4
|
+
import { DescriptionType } from '@vitessce/constants-internal';
|
|
3
5
|
|
|
4
6
|
const useStyles = makeStyles(theme => ({
|
|
5
7
|
description: {
|
|
@@ -38,12 +40,12 @@ const useStyles = makeStyles(theme => ({
|
|
|
38
40
|
}));
|
|
39
41
|
|
|
40
42
|
export default function Description(props) {
|
|
41
|
-
const { description, metadata } = props;
|
|
43
|
+
const { description, metadata, descriptionType } = props;
|
|
42
44
|
const classes = useStyles();
|
|
43
45
|
return (
|
|
44
46
|
<div className={classes.description}>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
{descriptionType && descriptionType === DescriptionType.MARKDOWN
|
|
48
|
+
? <Markdown>{description}</Markdown> : <p>{description}</p>}
|
|
47
49
|
{metadata && Array.from(metadata.entries())
|
|
48
50
|
.map(([layerIndex, { name: layerName, metadata: metadataRecord }]) => (
|
|
49
51
|
metadataRecord && Object.entries(metadataRecord).length > 0 ? (
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useCoordination, useLoaders,
|
|
6
6
|
useDescription, useImageData,
|
|
7
7
|
} from '@vitessce/vit-s';
|
|
8
|
-
import { ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-internal';
|
|
8
|
+
import { ViewType, COMPONENT_COORDINATION_TYPES, ViewHelpMapping } from '@vitessce/constants-internal';
|
|
9
9
|
import Description from './Description.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -23,10 +23,12 @@ export function DescriptionSubscriber(props) {
|
|
|
23
23
|
const {
|
|
24
24
|
coordinationScopes,
|
|
25
25
|
description: descriptionOverride,
|
|
26
|
+
descriptionType,
|
|
26
27
|
removeGridComponent,
|
|
27
28
|
theme,
|
|
28
29
|
title = 'Description',
|
|
29
30
|
closeButtonVisible,
|
|
31
|
+
helpText = ViewHelpMapping.DESCRIPTION,
|
|
30
32
|
} = props;
|
|
31
33
|
|
|
32
34
|
const loaders = useLoaders();
|
|
@@ -72,9 +74,11 @@ export function DescriptionSubscriber(props) {
|
|
|
72
74
|
isScroll
|
|
73
75
|
theme={theme}
|
|
74
76
|
isReady={isReady}
|
|
77
|
+
helpText={helpText}
|
|
75
78
|
>
|
|
76
79
|
<Description
|
|
77
80
|
description={descriptionOverride || description}
|
|
81
|
+
descriptionType={descriptionType}
|
|
78
82
|
metadata={metadata}
|
|
79
83
|
/>
|
|
80
84
|
</TitleInfo>
|