@vitessce/vit-s 2.0.3-beta.0 → 3.0.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/dist/index.js +41348 -18
- package/dist-tsc/CallbackPublisher.d.ts +18 -0
- package/dist-tsc/CallbackPublisher.d.ts.map +1 -0
- package/{dist → dist-tsc}/CallbackPublisher.js +6 -12
- package/dist-tsc/LoadingIndicator.d.ts +2 -0
- package/dist-tsc/LoadingIndicator.d.ts.map +1 -0
- package/{dist → dist-tsc}/LoadingIndicator.js +1 -2
- package/dist-tsc/TitleInfo.d.ts +2 -0
- package/dist-tsc/TitleInfo.d.ts.map +1 -0
- package/{dist → dist-tsc}/TitleInfo.js +6 -83
- package/dist-tsc/VitS.d.ts +45 -0
- package/dist-tsc/VitS.d.ts.map +1 -0
- package/dist-tsc/VitS.js +119 -0
- package/dist-tsc/VitessceGrid.d.ts +23 -0
- package/dist-tsc/VitessceGrid.d.ts.map +1 -0
- package/{dist → dist-tsc}/VitessceGrid.js +14 -13
- package/dist-tsc/VitessceGrid.test.d.ts +2 -0
- package/dist-tsc/VitessceGrid.test.d.ts.map +1 -0
- package/{dist → dist-tsc}/VitessceGrid.test.js +8 -4
- package/dist-tsc/Warning.d.ts +2 -0
- package/dist-tsc/Warning.d.ts.map +1 -0
- package/{dist → dist-tsc}/Warning.js +2 -2
- package/dist-tsc/classNames.d.ts +8 -0
- package/dist-tsc/classNames.d.ts.map +1 -0
- package/dist-tsc/data/AbstractLoader.d.ts +22 -0
- package/dist-tsc/data/AbstractLoader.d.ts.map +1 -0
- package/dist-tsc/data/AbstractLoader.js +18 -0
- package/dist-tsc/data/AbstractTwoStepLoader.d.ts +6 -0
- package/dist-tsc/data/AbstractTwoStepLoader.d.ts.map +1 -0
- package/{dist → dist-tsc}/data/AbstractTwoStepLoader.js +1 -1
- package/dist-tsc/data/LoaderResult.d.ts +7 -0
- package/dist-tsc/data/LoaderResult.d.ts.map +1 -0
- package/dist-tsc/data/index.d.ts +4 -0
- package/dist-tsc/data/index.d.ts.map +1 -0
- package/dist-tsc/data/index.js +3 -0
- package/dist-tsc/data/loader-registry.d.ts +9 -0
- package/dist-tsc/data/loader-registry.d.ts.map +1 -0
- package/dist-tsc/data/loader-registry.js +27 -0
- package/dist-tsc/data-hook-utils.d.ts +69 -0
- package/dist-tsc/data-hook-utils.d.ts.map +1 -0
- package/{dist → dist-tsc}/data-hook-utils.js +4 -6
- package/dist-tsc/data-hooks.d.ts +77 -0
- package/dist-tsc/data-hooks.d.ts.map +1 -0
- package/{dist → dist-tsc}/data-hooks.js +4 -4
- package/dist-tsc/errors/AbstractLoaderError.d.ts +10 -0
- package/dist-tsc/errors/AbstractLoaderError.d.ts.map +1 -0
- package/dist-tsc/errors/DataSourceFetchError.d.ts +8 -0
- package/dist-tsc/errors/DataSourceFetchError.d.ts.map +1 -0
- package/{dist → dist-tsc}/errors/DataSourceFetchError.js +1 -1
- package/dist-tsc/errors/DatasetNotFoundError.d.ts +6 -0
- package/dist-tsc/errors/DatasetNotFoundError.d.ts.map +1 -0
- package/{dist → dist-tsc}/errors/DatasetNotFoundError.js +1 -1
- package/dist-tsc/errors/LoaderNotFoundError.d.ts +10 -0
- package/dist-tsc/errors/LoaderNotFoundError.d.ts.map +1 -0
- package/{dist → dist-tsc}/errors/LoaderNotFoundError.js +1 -1
- package/dist-tsc/errors/LoaderValidationError.d.ts +10 -0
- package/dist-tsc/errors/LoaderValidationError.d.ts.map +1 -0
- package/{dist → dist-tsc}/errors/LoaderValidationError.js +1 -1
- package/dist-tsc/errors/index.d.ts +6 -0
- package/dist-tsc/errors/index.d.ts.map +1 -0
- package/{dist → dist-tsc}/errors/index.js +5 -6
- package/dist-tsc/hooks.d.ts +80 -0
- package/dist-tsc/hooks.d.ts.map +1 -0
- package/{dist → dist-tsc}/hooks.js +60 -4
- package/dist-tsc/index.d.ts +11 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +11 -0
- package/dist-tsc/plugins.test.fixtures.d.ts +61 -0
- package/dist-tsc/plugins.test.fixtures.d.ts.map +1 -0
- package/{dist → dist-tsc}/schemas/config-1.0.16.schema.json +21 -41
- package/dist-tsc/schemas/obsSets.schema.d.ts +179 -0
- package/dist-tsc/schemas/obsSets.schema.d.ts.map +1 -0
- package/dist-tsc/schemas/obsSetsTabular.schema.d.ts +57 -0
- package/dist-tsc/schemas/obsSetsTabular.schema.d.ts.map +1 -0
- package/dist-tsc/schemas/raster.schema.d.ts +239 -0
- package/dist-tsc/schemas/raster.schema.d.ts.map +1 -0
- package/dist-tsc/shared-mui/components.d.ts +2 -0
- package/dist-tsc/shared-mui/components.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-mui/components.js +2 -8
- package/dist-tsc/shared-mui/container.d.ts +2 -0
- package/dist-tsc/shared-mui/container.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-mui/container.js +1 -1
- package/dist-tsc/shared-mui/styles.d.ts +5 -0
- package/dist-tsc/shared-mui/styles.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-mui/styles.js +4 -2
- package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts +2 -0
- package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-plot-options/CellColorEncodingOption.js +3 -4
- package/dist-tsc/shared-plot-options/OptionSelect.d.ts +2 -0
- package/dist-tsc/shared-plot-options/OptionSelect.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-plot-options/OptionSelect.js +2 -2
- package/dist-tsc/shared-plot-options/OptionsContainer.d.ts +2 -0
- package/dist-tsc/shared-plot-options/OptionsContainer.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-plot-options/OptionsContainer.js +2 -5
- package/dist-tsc/shared-plot-options/index.d.ts +5 -0
- package/dist-tsc/shared-plot-options/index.d.ts.map +1 -0
- package/dist-tsc/shared-plot-options/index.js +4 -0
- package/dist-tsc/shared-plot-options/styles.d.ts +2 -0
- package/dist-tsc/shared-plot-options/styles.d.ts.map +1 -0
- package/{dist → dist-tsc}/shared-plot-options/styles.js +1 -1
- package/dist-tsc/state/hooks.d.ts +216 -0
- package/dist-tsc/state/hooks.d.ts.map +1 -0
- package/{dist → dist-tsc}/state/hooks.js +47 -21
- package/dist-tsc/title-styles.d.ts +2 -0
- package/dist-tsc/title-styles.d.ts.map +1 -0
- package/dist-tsc/title-styles.js +72 -0
- package/dist-tsc/view-config-utils.d.ts +30 -0
- package/dist-tsc/view-config-utils.d.ts.map +1 -0
- package/{dist → dist-tsc}/view-config-utils.js +32 -84
- package/dist-tsc/view-config-utils.test.d.ts +2 -0
- package/dist-tsc/view-config-utils.test.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.test.fixtures.d.ts +1049 -0
- package/dist-tsc/view-config-utils.test.fixtures.d.ts.map +1 -0
- package/{dist → dist-tsc}/view-config-utils.test.fixtures.js +118 -0
- package/dist-tsc/view-config-utils.test.js +209 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts +8 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts.map +1 -0
- package/{dist → dist-tsc}/vitessce-grid-layout/VitessceGridLayout.js +47 -28
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts +2 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts.map +1 -0
- package/{dist → dist-tsc}/vitessce-grid-layout/VitessceGridLayout.test.js +13 -5
- package/dist-tsc/vitessce-grid-layout/index.d.ts +2 -0
- package/dist-tsc/vitessce-grid-layout/index.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-layout/index.js +1 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts +15 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts.map +1 -0
- package/{dist → dist-tsc}/vitessce-grid-layout/layout-utils.js +2 -1
- package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts +2 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts.map +1 -0
- package/{dist → dist-tsc}/vitessce-grid-layout/layout-utils.test.js +3 -1
- package/dist-tsc/vitessce-grid-utils.d.ts +13 -0
- package/dist-tsc/vitessce-grid-utils.d.ts.map +1 -0
- package/{dist → dist-tsc}/vitessce-grid-utils.js +15 -14
- package/package.json +24 -11
- package/src/CallbackPublisher.js +77 -0
- package/src/LoadingIndicator.js +33 -0
- package/src/TitleInfo.js +167 -0
- package/src/VitS.js +202 -0
- package/src/VitessceGrid.js +118 -0
- package/src/VitessceGrid.test.jsx +57 -0
- package/src/Warning.js +62 -0
- package/src/classNames.js +8 -0
- package/src/data/AbstractLoader.js +23 -0
- package/src/data/AbstractTwoStepLoader.js +8 -0
- package/src/data/LoaderResult.js +8 -0
- package/src/data/index.js +3 -0
- package/src/data/loader-registry.js +28 -0
- package/src/data-hook-utils.js +195 -0
- package/src/data-hooks.js +354 -0
- package/src/errors/AbstractLoaderError.js +14 -0
- package/src/errors/DataSourceFetchError.js +15 -0
- package/src/errors/DatasetNotFoundError.js +23 -0
- package/src/errors/LoaderNotFoundError.js +24 -0
- package/src/errors/LoaderValidationError.js +23 -0
- package/src/errors/index.js +5 -0
- package/src/hooks.js +317 -0
- package/src/index.js +76 -0
- package/src/plugins.test.fixtures.js +78 -0
- package/src/schemas/config-0.1.0.schema.json +85 -0
- package/src/schemas/config-1.0.0.schema.json +733 -0
- package/src/schemas/config-1.0.1.schema.json +909 -0
- package/src/schemas/config-1.0.10.schema.json +969 -0
- package/src/schemas/config-1.0.11.schema.json +990 -0
- package/src/schemas/config-1.0.12.schema.json +997 -0
- package/src/schemas/config-1.0.13.schema.json +1013 -0
- package/src/schemas/config-1.0.14.schema.json +1048 -0
- package/src/schemas/config-1.0.15.schema.json +1048 -0
- package/src/schemas/config-1.0.16.schema.json +1089 -0
- package/src/schemas/config-1.0.2.schema.json +911 -0
- package/src/schemas/config-1.0.3.schema.json +911 -0
- package/src/schemas/config-1.0.4.schema.json +949 -0
- package/src/schemas/config-1.0.5.schema.json +949 -0
- package/src/schemas/config-1.0.6.schema.json +950 -0
- package/src/schemas/config-1.0.7.schema.json +950 -0
- package/src/schemas/config-1.0.8.schema.json +966 -0
- package/src/schemas/config-1.0.9.schema.json +965 -0
- package/src/schemas/fixtures/cellSets.good.json +16 -0
- package/src/schemas/fixtures/config-1.0.1.bad.json +1 -0
- package/src/schemas/fixtures/config-1.0.1.bad.message.json +11 -0
- package/src/schemas/fixtures/config-1.0.1.good.json +37 -0
- package/src/schemas/fixtures/config-1.0.2.bad.json +1 -0
- package/src/schemas/fixtures/config-1.0.2.bad.message.json +11 -0
- package/src/schemas/fixtures/config-1.0.2.good.json +38 -0
- package/src/schemas/fixtures/config-1.0.3.bad.json +1 -0
- package/src/schemas/fixtures/config-1.0.3.bad.message.json +11 -0
- package/src/schemas/fixtures/config-1.0.3.good.json +38 -0
- package/src/schemas/fixtures/obsSets.bad.json +1 -0
- package/src/schemas/fixtures/obsSets.bad.message.json +11 -0
- package/src/schemas/fixtures/obsSets.good.json +16 -0
- package/src/schemas/fixtures/obsSetsTabular.bad.json +1 -0
- package/src/schemas/fixtures/obsSetsTabular.bad.message.json +11 -0
- package/src/schemas/fixtures/obsSetsTabular.good.json +26 -0
- package/src/schemas/fixtures/raster.bad.json +1 -0
- package/src/schemas/fixtures/raster.bad.message.json +11 -0
- package/src/schemas/fixtures/raster.good.json +39 -0
- package/src/schemas/obsSets.schema.js +195 -0
- package/src/schemas/obsSetsTabular.schema.js +39 -0
- package/src/schemas/raster.schema.js +121 -0
- package/src/schemas/schema-schema.sh +34 -0
- package/src/shared-mui/components.js +81 -0
- package/src/shared-mui/container.js +212 -0
- package/src/shared-mui/styles.js +113 -0
- package/src/shared-plot-options/CellColorEncodingOption.js +42 -0
- package/src/shared-plot-options/OptionSelect.js +19 -0
- package/src/shared-plot-options/OptionsContainer.js +23 -0
- package/src/shared-plot-options/index.js +4 -0
- package/src/shared-plot-options/styles.js +49 -0
- package/src/state/hooks.js +640 -0
- package/src/title-styles.js +73 -0
- package/src/view-config-utils.js +263 -0
- package/src/view-config-utils.test.fixtures.js +893 -0
- package/src/view-config-utils.test.jsx +222 -0
- package/src/vitessce-grid-layout/VitessceGridLayout.js +179 -0
- package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +64 -0
- package/src/vitessce-grid-layout/index.js +1 -0
- package/src/vitessce-grid-layout/layout-utils.js +76 -0
- package/src/vitessce-grid-layout/layout-utils.test.js +167 -0
- package/src/vitessce-grid-utils.js +172 -0
- package/dist/VitS.js +0 -117
- package/dist/Vitessce.integration.test.js +0 -36
- package/dist/Vitessce.js +0 -101
- package/dist/component-registry.js +0 -16
- package/dist/data/AbstractLoader.js +0 -35
- package/dist/data/index.js +0 -3
- package/dist/data/loader-registry.js +0 -15
- package/dist/errors/OptionsValidationError.js +0 -15
- package/dist/export-utils.js +0 -70
- package/dist/export-utils.test.js +0 -66
- package/dist/file-options-schemas-legacy.js +0 -136
- package/dist/file-options-schemas-legacy.test.js +0 -126
- package/dist/file-options-schemas.js +0 -322
- package/dist/file-options-schemas.test.js +0 -23
- package/dist/joint-file-types-legacy.js +0 -278
- package/dist/joint-file-types-legacy.test.js +0 -400
- package/dist/joint-file-types.js +0 -148
- package/dist/joint-file-types.test.js +0 -139
- package/dist/loader-registry.js +0 -98
- package/dist/plugins.js +0 -154
- package/dist/plugins.test.js +0 -30
- package/dist/schemas/PrettyJsonSchema.js +0 -34
- package/dist/schemas/config-1.0.15.schema.test.js +0 -22
- package/dist/schemas/config-1.0.16.schema.test.js +0 -22
- package/dist/schemas/obs-sets-tabular.schema.js +0 -37
- package/dist/schemas/obs-sets.schema.js +0 -194
- package/dist/schemas/schema.test-old.js +0 -50
- package/dist/schemas/schema.test.js +0 -46
- package/dist/schemas-extra.js +0 -3
- package/dist/schemas.js +0 -4
- package/dist/shared-plot-options/index.js +0 -4
- package/dist/view-config-upgraders.js +0 -525
- package/dist/view-config-utils.test.js +0 -66
- package/dist/view-config-versions.js +0 -47
- package/dist/vitessce-grid-layout/index.js +0 -1
- /package/{dist → dist-tsc}/classNames.js +0 -0
- /package/{dist → dist-tsc}/data/LoaderResult.js +0 -0
- /package/{dist → dist-tsc}/errors/AbstractLoaderError.js +0 -0
- /package/{dist → dist-tsc}/plugins.test.fixtures.js +0 -0
- /package/{dist → dist-tsc}/schemas/config-0.1.0.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.0.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.1.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.10.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.11.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.12.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.13.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.14.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.15.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.2.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.3.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.4.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.5.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.6.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.7.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.8.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/config-1.0.9.schema.json +0 -0
- /package/{dist → dist-tsc}/schemas/obsSets.schema.js +0 -0
- /package/{dist → dist-tsc}/schemas/obsSetsTabular.schema.js +0 -0
- /package/{dist → dist-tsc}/schemas/raster.schema.js +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useState, useEffect, useRef, } from 'react';
|
|
2
2
|
import { InternMap } from 'internmap';
|
|
3
|
-
import isEqual from 'lodash
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { getSourceAndLoaderFromFileType } from './data/loader-registry';
|
|
7
|
-
import { getFileTypeDataTypeMapping } from './plugins';
|
|
3
|
+
import { isEqual, pick } from 'lodash-es';
|
|
4
|
+
import { fromEntries } from '@vitessce/utils';
|
|
5
|
+
import { DATA_TYPE_COORDINATION_VALUE_USAGE } from '@vitessce/constants-internal';
|
|
6
|
+
import { getSourceAndLoaderFromFileType, getDataTypeFromFileType } from './data/loader-registry.js';
|
|
8
7
|
/**
|
|
9
8
|
* Return the bottom coordinate of the layout.
|
|
10
9
|
* https://github.com/STRML/react-grid-layout/blob/20dac73f91274526034c00968b5bedb9c2ed36b9/lib/utils.js#L82
|
|
@@ -79,12 +78,12 @@ export function useRowHeight(config, initialRowHeight, height, margin, padding)
|
|
|
79
78
|
}, [containerRef, height]);
|
|
80
79
|
return [rowHeight, containerRef];
|
|
81
80
|
}
|
|
82
|
-
function withDefaults(coordinationValues, dataType, fileType, datasetUid) {
|
|
81
|
+
function withDefaults(coordinationValues, dataType, fileType, datasetUid, defaultCoordinationValues) {
|
|
83
82
|
const defaultKeys = DATA_TYPE_COORDINATION_VALUE_USAGE[dataType]
|
|
84
|
-
.filter(k => (Object.keys(
|
|
85
|
-
&&
|
|
83
|
+
.filter(k => (Object.keys(defaultCoordinationValues).includes(k)
|
|
84
|
+
&& defaultCoordinationValues[k]
|
|
86
85
|
&& !Object.keys(coordinationValues).includes(k)));
|
|
87
|
-
const defaultValues = pick(
|
|
86
|
+
const defaultValues = pick(defaultCoordinationValues, defaultKeys);
|
|
88
87
|
const coordinationValuesWithDefaults = {
|
|
89
88
|
...defaultValues,
|
|
90
89
|
// The user-provided values should take precedence.
|
|
@@ -100,14 +99,16 @@ function withDefaults(coordinationValues, dataType, fileType, datasetUid) {
|
|
|
100
99
|
* Create a mapping from dataset ID to loader objects by data type.
|
|
101
100
|
* @param {object[]} datasets The datasets array from the view config.
|
|
102
101
|
* @param {string} configDescription The top-level description in the
|
|
102
|
+
* @param {PluginFileType[]} fileTypes
|
|
103
|
+
* @param {PluginCoordinationType[]} coordinationTypes
|
|
103
104
|
* view config.
|
|
104
105
|
* @returns {object} Mapping from dataset ID to data type to loader
|
|
105
106
|
* instance.
|
|
106
107
|
*/
|
|
107
|
-
export function createLoaders(datasets, configDescription) {
|
|
108
|
+
export function createLoaders(datasets, configDescription, fileTypes, coordinationTypes) {
|
|
108
109
|
const result = {};
|
|
109
110
|
const dataSources = {};
|
|
110
|
-
const
|
|
111
|
+
const defaultCoordinationValues = fromEntries(coordinationTypes.map(ct => ([ct.name, ct.defaultValue])));
|
|
111
112
|
datasets.forEach((dataset) => {
|
|
112
113
|
const datasetLoaders = {
|
|
113
114
|
name: dataset.name,
|
|
@@ -116,9 +117,9 @@ export function createLoaders(datasets, configDescription) {
|
|
|
116
117
|
};
|
|
117
118
|
dataset.files.forEach((file) => {
|
|
118
119
|
const { url, options, requestInit, fileType, coordinationValues = {}, } = file;
|
|
119
|
-
const dataType =
|
|
120
|
-
const coordinationValuesWithDefaults = withDefaults(coordinationValues, dataType, fileType, dataset.uid);
|
|
121
|
-
const [DataSourceClass, LoaderClass] = getSourceAndLoaderFromFileType(fileType);
|
|
120
|
+
const dataType = getDataTypeFromFileType(fileType, fileTypes);
|
|
121
|
+
const coordinationValuesWithDefaults = withDefaults(coordinationValues, dataType, fileType, dataset.uid, defaultCoordinationValues);
|
|
122
|
+
const [DataSourceClass, LoaderClass] = getSourceAndLoaderFromFileType(fileType, fileTypes);
|
|
122
123
|
// Create _one_ DataSourceClass instance per URL. Derived loaders share this object.
|
|
123
124
|
const fileId = url || JSON.stringify(options);
|
|
124
125
|
if (!(fileId in dataSources)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/vit-s",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -8,36 +8,49 @@
|
|
|
8
8
|
"url": "git+https://github.com/vitessce/vitessce.git"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
11
12
|
"main": "dist/index.js",
|
|
12
13
|
"files": [
|
|
13
|
-
"
|
|
14
|
+
"src",
|
|
15
|
+
"dist",
|
|
16
|
+
"dist-tsc"
|
|
14
17
|
],
|
|
15
18
|
"dependencies": {
|
|
16
19
|
"@material-ui/core": "~4.12.3",
|
|
17
20
|
"@material-ui/icons": "~4.11.2",
|
|
18
|
-
"ajv": "^6.10.0",
|
|
19
21
|
"clsx": "^1.1.1",
|
|
22
|
+
"d3-array": "^2.4.0",
|
|
20
23
|
"fast-deep-equal": "^3.1.3",
|
|
21
24
|
"internmap": "^2.0.3",
|
|
22
25
|
"jss-plugin-global": "^10.9.2",
|
|
23
|
-
"lodash": "^4.17.21",
|
|
26
|
+
"lodash-es": "^4.17.21",
|
|
24
27
|
"react-grid-layout-with-lodash": "^1.3.5",
|
|
25
|
-
"uuid": "^
|
|
28
|
+
"uuid": "^9.0.0",
|
|
26
29
|
"zustand": "^3.5.10",
|
|
27
|
-
"@vitessce/constants-internal": "
|
|
28
|
-
"@vitessce/
|
|
30
|
+
"@vitessce/constants-internal": "3.0.0",
|
|
31
|
+
"@vitessce/plugins": "3.0.0",
|
|
32
|
+
"@vitessce/schemas": "3.0.0",
|
|
33
|
+
"@vitessce/utils": "3.0.0"
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
31
36
|
"react": "^18.0.0",
|
|
32
|
-
"vite": "^3.0
|
|
33
|
-
"vitest": "^0.23.4"
|
|
37
|
+
"vite": "^4.3.0",
|
|
38
|
+
"vitest": "^0.23.4",
|
|
39
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
40
|
+
"@testing-library/react": "^13.3.0"
|
|
34
41
|
},
|
|
35
42
|
"peerDependencies": {
|
|
36
43
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
37
44
|
},
|
|
38
45
|
"scripts": {
|
|
39
|
-
"
|
|
40
|
-
"build": "tsc",
|
|
46
|
+
"bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
|
|
41
47
|
"test": "pnpm exec vitest --run -r ../../ --dir ."
|
|
48
|
+
},
|
|
49
|
+
"module": "dist/index.js",
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./dist-tsc/index.d.ts",
|
|
53
|
+
"import": "./dist/index.js"
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
56
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useViewConfigStoreApi, useLoaders, useWarning } from './state/hooks.js';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
function validateViewConfig(viewConfig, pluginSpecificConfigSchema) {
|
|
6
|
+
// Need the try-catch here since Zustand will actually
|
|
7
|
+
// just catch and ignore errors in its subscription callbacks.
|
|
8
|
+
try {
|
|
9
|
+
pluginSpecificConfigSchema.parse(viewConfig);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.error(e);
|
|
12
|
+
}
|
|
13
|
+
// Do nothing if successful.
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is a dummy component which handles
|
|
18
|
+
* publishing new view configs and loaders to
|
|
19
|
+
* the provided callbacks on changes.
|
|
20
|
+
* @param {object} props
|
|
21
|
+
* @param {function} props.onConfigChange A callback function
|
|
22
|
+
* to execute on each change of the Vitessce view config.
|
|
23
|
+
* @param {function} props.onLoaderChange A callback function
|
|
24
|
+
* to execute on each change of the loaders object.
|
|
25
|
+
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
26
|
+
* against the view config schema when publishing changes.
|
|
27
|
+
*/
|
|
28
|
+
export default function CallbackPublisher(props) {
|
|
29
|
+
const {
|
|
30
|
+
onWarn,
|
|
31
|
+
onConfigChange,
|
|
32
|
+
onLoaderChange,
|
|
33
|
+
validateOnConfigChange,
|
|
34
|
+
pluginSpecificConfigSchema,
|
|
35
|
+
} = props;
|
|
36
|
+
|
|
37
|
+
const warning = useWarning();
|
|
38
|
+
const loaders = useLoaders();
|
|
39
|
+
|
|
40
|
+
const viewConfigStoreApi = useViewConfigStoreApi();
|
|
41
|
+
|
|
42
|
+
// View config updates are often-occurring, so
|
|
43
|
+
// we want to use the "transient update" approach
|
|
44
|
+
// to subscribe to view config changes.
|
|
45
|
+
// Reference: https://github.com/react-spring/zustand#transient-updates-for-often-occuring-state-changes
|
|
46
|
+
useEffect(() => viewConfigStoreApi.subscribe(
|
|
47
|
+
// The function to run on each publish.
|
|
48
|
+
(viewConfig) => {
|
|
49
|
+
if (validateOnConfigChange && viewConfig) {
|
|
50
|
+
validateViewConfig(viewConfig, pluginSpecificConfigSchema);
|
|
51
|
+
}
|
|
52
|
+
if (onConfigChange && viewConfig) {
|
|
53
|
+
onConfigChange(viewConfig);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
// The function to specify which part of the store
|
|
57
|
+
// we want to subscribe to.
|
|
58
|
+
state => state.viewConfig,
|
|
59
|
+
), [onConfigChange, validateOnConfigChange, viewConfigStoreApi, pluginSpecificConfigSchema]);
|
|
60
|
+
|
|
61
|
+
// Emit updates to the warning message.
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (onWarn && warning) {
|
|
64
|
+
onWarn(warning);
|
|
65
|
+
}
|
|
66
|
+
}, [warning, onWarn]);
|
|
67
|
+
|
|
68
|
+
// Emit updates to the loaders.
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (onLoaderChange && loaders) {
|
|
71
|
+
onLoaderChange(loaders);
|
|
72
|
+
}
|
|
73
|
+
}, [loaders, onLoaderChange]);
|
|
74
|
+
|
|
75
|
+
// Render nothing.
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { makeStyles, CircularProgress } from '@material-ui/core';
|
|
3
|
+
|
|
4
|
+
const useStyles = makeStyles(() => ({
|
|
5
|
+
loadingIndicatorBackdrop: {
|
|
6
|
+
position: 'absolute',
|
|
7
|
+
top: '0',
|
|
8
|
+
left: '0',
|
|
9
|
+
zIndex: '1040',
|
|
10
|
+
width: '100%',
|
|
11
|
+
height: '100%',
|
|
12
|
+
borderRadius: '4px',
|
|
13
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
14
|
+
},
|
|
15
|
+
loadingIndicatorContainer: {
|
|
16
|
+
display: 'grid',
|
|
17
|
+
placeItems: 'center',
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: '100%',
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export default function LoadingIndicator() {
|
|
25
|
+
const classes = useStyles();
|
|
26
|
+
return (
|
|
27
|
+
<div className={classes.loadingIndicatorBackdrop}>
|
|
28
|
+
<div className={classes.loadingIndicatorContainer}>
|
|
29
|
+
<CircularProgress />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
package/src/TitleInfo.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { makeStyles, MenuItem, IconButton, Link } from '@material-ui/core';
|
|
4
|
+
import {
|
|
5
|
+
CloudDownload as CloudDownloadIcon,
|
|
6
|
+
ArrowDropDown as ArrowDropDownIcon,
|
|
7
|
+
ArrowDropUp as ArrowDropUpIcon,
|
|
8
|
+
Settings as SettingsIcon,
|
|
9
|
+
Close as CloseIcon,
|
|
10
|
+
} from '@material-ui/icons';
|
|
11
|
+
|
|
12
|
+
import { TOOLTIP_ANCESTOR } from './classNames.js';
|
|
13
|
+
import LoadingIndicator from './LoadingIndicator.js';
|
|
14
|
+
import { PopperMenu } from './shared-mui/components.js';
|
|
15
|
+
import { useTitleStyles } from './title-styles.js';
|
|
16
|
+
|
|
17
|
+
const useStyles = makeStyles(theme => ({
|
|
18
|
+
iconButton: {
|
|
19
|
+
border: 'none',
|
|
20
|
+
marginLeft: 0,
|
|
21
|
+
background: 'none',
|
|
22
|
+
color: theme.palette.primaryForeground,
|
|
23
|
+
paddingLeft: '0.25em',
|
|
24
|
+
paddingRight: '0.25em',
|
|
25
|
+
borderRadius: '2px',
|
|
26
|
+
'&:hover': {
|
|
27
|
+
backgroundColor: theme.palette.primaryBackgroundLight,
|
|
28
|
+
},
|
|
29
|
+
'&:first-child': {
|
|
30
|
+
marginLeft: '0.25em',
|
|
31
|
+
},
|
|
32
|
+
'&:last-child': {
|
|
33
|
+
marginRight: '0.25em',
|
|
34
|
+
},
|
|
35
|
+
'& svg': {
|
|
36
|
+
width: '0.7em',
|
|
37
|
+
height: '0.7em',
|
|
38
|
+
verticalAlign: 'middle',
|
|
39
|
+
overflow: 'visible',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
downloadLink: {
|
|
43
|
+
color: theme.palette.primaryForeground,
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
function SettingsIconWithArrow({ open }) {
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<SettingsIcon />
|
|
51
|
+
{open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function PlotOptions(props) {
|
|
57
|
+
const { options } = props;
|
|
58
|
+
const [open, setOpen] = useState(false);
|
|
59
|
+
const classes = useStyles();
|
|
60
|
+
return (options ? (
|
|
61
|
+
<PopperMenu
|
|
62
|
+
open={open}
|
|
63
|
+
setOpen={setOpen}
|
|
64
|
+
buttonIcon={<SettingsIconWithArrow open={open} />}
|
|
65
|
+
buttonClassName={classes.iconButton}
|
|
66
|
+
placement="bottom-end"
|
|
67
|
+
>
|
|
68
|
+
{options}
|
|
69
|
+
</PopperMenu>
|
|
70
|
+
) : null);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function CloudDownloadIconWithArrow({ open }) {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<CloudDownloadIcon />
|
|
77
|
+
{open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function DownloadOptions(props) {
|
|
83
|
+
const { urls } = props;
|
|
84
|
+
const [open, setOpen] = useState(false);
|
|
85
|
+
const classes = useStyles();
|
|
86
|
+
return (urls && urls.length ? (
|
|
87
|
+
<PopperMenu
|
|
88
|
+
open={open}
|
|
89
|
+
setOpen={setOpen}
|
|
90
|
+
buttonIcon={<CloudDownloadIconWithArrow open={open} />}
|
|
91
|
+
buttonClassName={classes.iconButton}
|
|
92
|
+
placement="bottom-end"
|
|
93
|
+
>
|
|
94
|
+
{urls.map(({ url, name }) => (
|
|
95
|
+
<MenuItem dense key={`${url}_${name}`}>
|
|
96
|
+
<Link underline="none" href={url} target="_blank" rel="noopener" className={classes.downloadLink}>
|
|
97
|
+
Download {name}
|
|
98
|
+
</Link>
|
|
99
|
+
</MenuItem>
|
|
100
|
+
))}
|
|
101
|
+
</PopperMenu>
|
|
102
|
+
) : null);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function ClosePaneButton(props) {
|
|
106
|
+
const { removeGridComponent } = props;
|
|
107
|
+
const classes = useStyles();
|
|
108
|
+
return (
|
|
109
|
+
<IconButton
|
|
110
|
+
onClick={removeGridComponent}
|
|
111
|
+
size="small"
|
|
112
|
+
className={classes.iconButton}
|
|
113
|
+
title="close"
|
|
114
|
+
>
|
|
115
|
+
<CloseIcon />
|
|
116
|
+
</IconButton>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function TitleInfo(props) {
|
|
121
|
+
const {
|
|
122
|
+
title, info, children, isScroll, isSpatial, removeGridComponent, urls,
|
|
123
|
+
isReady, options,
|
|
124
|
+
} = props;
|
|
125
|
+
|
|
126
|
+
const classes = useTitleStyles();
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
// d-flex without wrapping div is not always full height; I don't understand the root cause.
|
|
130
|
+
<>
|
|
131
|
+
<div className={classes.title}>
|
|
132
|
+
<div className={classes.titleLeft}>
|
|
133
|
+
{title}
|
|
134
|
+
</div>
|
|
135
|
+
<div className={classes.titleInfo} title={info}>
|
|
136
|
+
{info}
|
|
137
|
+
</div>
|
|
138
|
+
<div className={classes.titleButtons}>
|
|
139
|
+
<PlotOptions
|
|
140
|
+
options={options}
|
|
141
|
+
/>
|
|
142
|
+
<DownloadOptions
|
|
143
|
+
urls={urls}
|
|
144
|
+
/>
|
|
145
|
+
<ClosePaneButton
|
|
146
|
+
removeGridComponent={removeGridComponent}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div
|
|
151
|
+
className={clsx(
|
|
152
|
+
TOOLTIP_ANCESTOR,
|
|
153
|
+
classes.card,
|
|
154
|
+
{
|
|
155
|
+
[classes.scrollCard]: isScroll,
|
|
156
|
+
[classes.spatialCard]: isSpatial,
|
|
157
|
+
[classes.noScrollCard]: !isScroll && !isSpatial,
|
|
158
|
+
},
|
|
159
|
+
)}
|
|
160
|
+
>
|
|
161
|
+
{ !isReady && <LoadingIndicator /> }
|
|
162
|
+
{children}
|
|
163
|
+
</div>
|
|
164
|
+
</>
|
|
165
|
+
// "pl-2" only matters when the window is very narrow.
|
|
166
|
+
);
|
|
167
|
+
}
|
package/src/VitS.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ThemeProvider,
|
|
4
|
+
StylesProvider,
|
|
5
|
+
createGenerateClassName,
|
|
6
|
+
} from '@material-ui/core/es/styles/index.js';
|
|
7
|
+
import { isEqual } from 'lodash-es';
|
|
8
|
+
import { META_VERSION } from '@vitessce/constants-internal';
|
|
9
|
+
import { buildConfigSchema, latestConfigSchema } from '@vitessce/schemas';
|
|
10
|
+
import { muiTheme } from './shared-mui/styles.js';
|
|
11
|
+
import {
|
|
12
|
+
ViewConfigProvider,
|
|
13
|
+
createViewConfigStore,
|
|
14
|
+
AuxiliaryProvider,
|
|
15
|
+
createAuxiliaryStore,
|
|
16
|
+
} from './state/hooks.js';
|
|
17
|
+
|
|
18
|
+
import VitessceGrid from './VitessceGrid.js';
|
|
19
|
+
import { Warning } from './Warning.js';
|
|
20
|
+
import CallbackPublisher from './CallbackPublisher.js';
|
|
21
|
+
import {
|
|
22
|
+
initialize,
|
|
23
|
+
} from './view-config-utils.js';
|
|
24
|
+
|
|
25
|
+
function logConfig(config, name) {
|
|
26
|
+
console.groupCollapsed(`🚄 Vitessce (${META_VERSION.version}) ${name}`);
|
|
27
|
+
console.info(`data:,${JSON.stringify(config)}`);
|
|
28
|
+
console.info(JSON.stringify(config, null, 2));
|
|
29
|
+
console.groupEnd();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The Vitessce component.
|
|
34
|
+
* @param {object} props
|
|
35
|
+
* @param {object} props.config A Vitessce view config.
|
|
36
|
+
* If the config is valid, the VitessceGrid will be rendered as a child.
|
|
37
|
+
* If the config is invalid, a Warning will be rendered instead.
|
|
38
|
+
* @param {undefined|number} props.rowHeight Row height for grid layout. Optional.
|
|
39
|
+
* @param {number} props.height Total height for grid layout. Optional.
|
|
40
|
+
* @param {string} props.theme The theme, used for styling as
|
|
41
|
+
* light or dark. Optional. By default, "dark"
|
|
42
|
+
* @param {function} props.onWarn A callback for warning messages. Optional.
|
|
43
|
+
* @param {function} props.onConfigChange A callback for view config
|
|
44
|
+
* updates. Optional.
|
|
45
|
+
* @param {function} props.onLoaderChange A callback for loader
|
|
46
|
+
* updates. Optional.
|
|
47
|
+
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
48
|
+
* against the view config schema when publishing changes. Use for debugging
|
|
49
|
+
* purposes, as this may have a performance impact. By default, false.
|
|
50
|
+
* @param {undefined|string} props.uid A unique identifier for this Vitessce instance,
|
|
51
|
+
* for the purpose of avoiding CSS autogenerated class name conflicts. Must be valid as part
|
|
52
|
+
* of a CSS class name string.
|
|
53
|
+
* @param {array} props.viewTypes Plugin view types.
|
|
54
|
+
* @param {array} props.fileTypes Plugin file types.
|
|
55
|
+
* @param {array} props.jointFileTypes Plugin joint file types.
|
|
56
|
+
* @param {array} props.coordinationTypes Plugin coordination types.
|
|
57
|
+
* @param {null|object} props.warning A warning to render within the Vitessce grid,
|
|
58
|
+
* provided by the parent.
|
|
59
|
+
*/
|
|
60
|
+
export function VitS(props) {
|
|
61
|
+
const {
|
|
62
|
+
config,
|
|
63
|
+
rowHeight,
|
|
64
|
+
height,
|
|
65
|
+
theme,
|
|
66
|
+
onWarn,
|
|
67
|
+
onConfigChange,
|
|
68
|
+
onLoaderChange,
|
|
69
|
+
validateOnConfigChange = false,
|
|
70
|
+
isBounded = false,
|
|
71
|
+
uid,
|
|
72
|
+
viewTypes: viewTypesProp,
|
|
73
|
+
fileTypes: fileTypesProp,
|
|
74
|
+
jointFileTypes: jointFileTypesProp,
|
|
75
|
+
coordinationTypes: coordinationTypesProp,
|
|
76
|
+
warning,
|
|
77
|
+
} = props;
|
|
78
|
+
|
|
79
|
+
const viewTypes = useMemo(() => (viewTypesProp || []), [viewTypesProp]);
|
|
80
|
+
const fileTypes = useMemo(() => (fileTypesProp || []), [fileTypesProp]);
|
|
81
|
+
const jointFileTypes = useMemo(
|
|
82
|
+
() => (jointFileTypesProp || []),
|
|
83
|
+
[jointFileTypesProp],
|
|
84
|
+
);
|
|
85
|
+
const coordinationTypes = useMemo(
|
|
86
|
+
() => (coordinationTypesProp || []),
|
|
87
|
+
[coordinationTypesProp],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const generateClassName = useMemo(() => createGenerateClassName({
|
|
91
|
+
disableGlobal: false, // Class names need to be deterministic
|
|
92
|
+
// Avoid conflicts with portal-ui MUI class names,
|
|
93
|
+
// and allow setting a UID.
|
|
94
|
+
productionPrefix: (uid ? `vit${uid}` : 'vit'),
|
|
95
|
+
}), [uid]);
|
|
96
|
+
|
|
97
|
+
const configUid = config?.uid;
|
|
98
|
+
const configVersion = config?.version;
|
|
99
|
+
|
|
100
|
+
const pluginSpecificConfigSchema = useMemo(() => buildConfigSchema(
|
|
101
|
+
fileTypes,
|
|
102
|
+
jointFileTypes,
|
|
103
|
+
coordinationTypes,
|
|
104
|
+
viewTypes,
|
|
105
|
+
), [viewTypes, fileTypes, jointFileTypes, coordinationTypes]);
|
|
106
|
+
|
|
107
|
+
// Process the view config and memoize the result:
|
|
108
|
+
// - Validate.
|
|
109
|
+
// - Upgrade, if legacy schema.
|
|
110
|
+
// - Validate after upgrade, if legacy schema.
|
|
111
|
+
// - Initialize (based on initStrategy).
|
|
112
|
+
const [configOrWarning, success] = useMemo(() => {
|
|
113
|
+
if (warning) {
|
|
114
|
+
return [warning, false];
|
|
115
|
+
}
|
|
116
|
+
logConfig(config, 'input view config');
|
|
117
|
+
const result = latestConfigSchema.safeParse(config);
|
|
118
|
+
if (result.success) {
|
|
119
|
+
const upgradedConfig = result.data;
|
|
120
|
+
logConfig(upgradedConfig, 'upgraded view config');
|
|
121
|
+
// Perform second round of parsing against plugin-specific config schema.
|
|
122
|
+
const pluginSpecificResult = pluginSpecificConfigSchema.safeParse(upgradedConfig);
|
|
123
|
+
// Initialize the view config according to the initStrategy.
|
|
124
|
+
if (pluginSpecificResult.success) {
|
|
125
|
+
try {
|
|
126
|
+
const upgradedConfigWithValidPlugins = pluginSpecificResult.data;
|
|
127
|
+
const initializedConfig = initialize(
|
|
128
|
+
upgradedConfigWithValidPlugins,
|
|
129
|
+
jointFileTypes,
|
|
130
|
+
coordinationTypes,
|
|
131
|
+
viewTypes,
|
|
132
|
+
);
|
|
133
|
+
logConfig(initializedConfig, 'initialized view config');
|
|
134
|
+
return [initializedConfig, true];
|
|
135
|
+
} catch (e) {
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
title: 'Config initialization failed.',
|
|
139
|
+
unformatted: e.message,
|
|
140
|
+
},
|
|
141
|
+
false,
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return [
|
|
146
|
+
{
|
|
147
|
+
title: 'Config validation failed on second pass.',
|
|
148
|
+
unformatted: pluginSpecificResult.error.message,
|
|
149
|
+
},
|
|
150
|
+
false,
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
return [{
|
|
154
|
+
title: 'Config validation failed on first pass.',
|
|
155
|
+
unformatted: result.error.message,
|
|
156
|
+
}, result.success];
|
|
157
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
158
|
+
}, [configUid, configVersion, pluginSpecificConfigSchema, warning]);
|
|
159
|
+
|
|
160
|
+
// Emit the upgraded/initialized view config
|
|
161
|
+
// to onConfigChange if necessary.
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (success && !isEqual(configOrWarning, config) && onConfigChange) {
|
|
164
|
+
onConfigChange(configOrWarning);
|
|
165
|
+
}
|
|
166
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
167
|
+
}, [success, configUid, configOrWarning, onConfigChange]);
|
|
168
|
+
|
|
169
|
+
return success ? (
|
|
170
|
+
<StylesProvider generateClassName={generateClassName}>
|
|
171
|
+
<ThemeProvider theme={muiTheme[theme]}>
|
|
172
|
+
<ViewConfigProvider createStore={createViewConfigStore}>
|
|
173
|
+
<AuxiliaryProvider createStore={createAuxiliaryStore}>
|
|
174
|
+
<VitessceGrid
|
|
175
|
+
viewTypes={viewTypes}
|
|
176
|
+
fileTypes={fileTypes}
|
|
177
|
+
coordinationTypes={coordinationTypes}
|
|
178
|
+
config={configOrWarning}
|
|
179
|
+
rowHeight={rowHeight}
|
|
180
|
+
height={height}
|
|
181
|
+
theme={theme}
|
|
182
|
+
isBounded={isBounded}
|
|
183
|
+
/>
|
|
184
|
+
<CallbackPublisher
|
|
185
|
+
onWarn={onWarn}
|
|
186
|
+
onConfigChange={onConfigChange}
|
|
187
|
+
onLoaderChange={onLoaderChange}
|
|
188
|
+
validateOnConfigChange={validateOnConfigChange}
|
|
189
|
+
pluginSpecificConfigSchema={pluginSpecificConfigSchema}
|
|
190
|
+
/>
|
|
191
|
+
</AuxiliaryProvider>
|
|
192
|
+
</ViewConfigProvider>
|
|
193
|
+
</ThemeProvider>
|
|
194
|
+
</StylesProvider>
|
|
195
|
+
) : (
|
|
196
|
+
<StylesProvider generateClassName={generateClassName}>
|
|
197
|
+
<ThemeProvider theme={muiTheme[theme]}>
|
|
198
|
+
<Warning {...configOrWarning} />
|
|
199
|
+
</ThemeProvider>
|
|
200
|
+
</StylesProvider>
|
|
201
|
+
);
|
|
202
|
+
}
|