@vitessce/vit-s 3.2.2 → 3.3.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 CHANGED
@@ -32233,9 +32233,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
32233
32233
  function rgbSpline(spline) {
32234
32234
  return (colors2) => {
32235
32235
  const n = colors2.length;
32236
- let r2 = new Array(n);
32237
- let g = new Array(n);
32238
- let b = new Array(n);
32236
+ const r2 = new Array(n);
32237
+ const g = new Array(n);
32238
+ const b = new Array(n);
32239
32239
  let i;
32240
32240
  let color2;
32241
32241
  for (i = 0; i < n; ++i) {
@@ -32244,10 +32244,10 @@ function rgbSpline(spline) {
32244
32244
  g[i] = color2[1] || 0;
32245
32245
  b[i] = color2[2] || 0;
32246
32246
  }
32247
- r2 = spline(r2);
32248
- g = spline(g);
32249
- b = spline(b);
32250
- return (t2) => [r2(t2), g(t2), b(t2)];
32247
+ const rFunc = spline(r2);
32248
+ const gFunc = spline(g);
32249
+ const bFunc = spline(b);
32250
+ return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
32251
32251
  };
32252
32252
  }
32253
32253
  function basis(values2) {
@@ -35149,6 +35149,7 @@ const DataType$1 = {
35149
35149
  const FileType$1 = {
35150
35150
  // Joint file types
35151
35151
  ANNDATA_ZARR: "anndata.zarr",
35152
+ SPATIALDATA_ZARR: "spatialdata.zarr",
35152
35153
  // Atomic file types
35153
35154
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
35154
35155
  OBS_SPOTS_CSV: "obsSpots.csv",
@@ -35171,6 +35172,16 @@ const FileType$1 = {
35171
35172
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
35172
35173
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
35173
35174
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
35175
+ // SpatialData
35176
+ IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
35177
+ LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
35178
+ SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
35179
+ OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
35180
+ OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
35181
+ OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
35182
+ // TODO:
35183
+ // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
35184
+ // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
35174
35185
  // MuData
35175
35186
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
35176
35187
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
@@ -35383,10 +35394,10 @@ const AUTO_INDEPENDENT_COORDINATION_TYPES = [
35383
35394
  CoordinationType$1.EMBEDDING_OBS_OPACITY
35384
35395
  ];
35385
35396
  const note = "This file is autogenerated by .changeset/post-changelog.mjs.";
35386
- const version = "3.2.2";
35387
- const date = "2023-09-20";
35397
+ const version = "3.3.1";
35398
+ const date = "2023-11-08";
35388
35399
  const branch = "changeset-release/main";
35389
- const hash = "715881ca";
35400
+ const hash = "8e897a20";
35390
35401
  const META_VERSION = {
35391
35402
  note,
35392
35403
  version,
@@ -35746,9 +35757,30 @@ z.object({
35746
35757
  offsetsUrl: z.string().optional(),
35747
35758
  coordinateTransformations: omeCoordinateTransformations.optional()
35748
35759
  });
35749
- z.object({
35760
+ const imageOmeZarrSchema = z.object({
35750
35761
  coordinateTransformations: omeCoordinateTransformations.optional()
35751
35762
  });
35763
+ imageOmeZarrSchema.extend({
35764
+ path: z.string()
35765
+ });
35766
+ z.object({
35767
+ path: z.string()
35768
+ });
35769
+ z.object({
35770
+ path: z.string()
35771
+ });
35772
+ z.object({
35773
+ path: z.string(),
35774
+ tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
35775
+ });
35776
+ annDataObsFeatureMatrix.extend({
35777
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
35778
+ });
35779
+ z.object({
35780
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
35781
+ tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
35782
+ obsSets: annDataObsSets
35783
+ });
35752
35784
  z.object({
35753
35785
  obsIndex: z.string(),
35754
35786
  obsEmbedding: z.array(z.string()).length(2)
@@ -43136,9 +43168,9 @@ After: ${JSON.stringify(coordinationValuesWithDefaults)}`);
43136
43168
  }
43137
43169
  return coordinationValuesWithDefaults;
43138
43170
  }
43139
- function createLoaders(datasets, configDescription, fileTypes, coordinationTypes) {
43171
+ function createLoaders(datasets, configDescription, fileTypes, coordinationTypes, stores) {
43140
43172
  const result = {};
43141
- const dataSources = {};
43173
+ const dataSources = new InternMap([], JSON.stringify);
43142
43174
  const defaultCoordinationValues = fromEntries(
43143
43175
  coordinationTypes.map((ct) => [ct.name, ct.defaultValue])
43144
43176
  );
@@ -43166,10 +43198,18 @@ function createLoaders(datasets, configDescription, fileTypes, coordinationTypes
43166
43198
  );
43167
43199
  const [DataSourceClass, LoaderClass] = getSourceAndLoaderFromFileType(fileType, fileTypes);
43168
43200
  const fileId = url || JSON.stringify(options);
43169
- if (!(fileId in dataSources)) {
43170
- dataSources[fileId] = new DataSourceClass({ url, requestInit: requestInit2 });
43201
+ const dataSourceName = DataSourceClass.prototype.constructor.name;
43202
+ const dataSourceKey = [fileId, dataSourceName];
43203
+ if (!dataSources.has(dataSourceKey)) {
43204
+ dataSources.set(dataSourceKey, new DataSourceClass({
43205
+ url,
43206
+ requestInit: requestInit2,
43207
+ // Optionally, pass a Zarrita store to the data source,
43208
+ // if one was mapped to this URL.
43209
+ store: stores == null ? void 0 : stores[url]
43210
+ }));
43171
43211
  }
43172
- const loader = new LoaderClass(dataSources[fileId], file);
43212
+ const loader = new LoaderClass(dataSources.get(dataSourceKey), file);
43173
43213
  if (datasetLoaders.loaders[dataType]) {
43174
43214
  datasetLoaders.loaders[dataType].set(coordinationValuesWithDefaults, loader);
43175
43215
  } else {
@@ -44121,6 +44161,7 @@ function createGenerateClassName(customPrefix) {
44121
44161
  function VitS(props) {
44122
44162
  const {
44123
44163
  config: config2,
44164
+ stores,
44124
44165
  rowHeight,
44125
44166
  height: height2,
44126
44167
  theme,
@@ -44228,7 +44269,8 @@ function VitS(props) {
44228
44269
  configOrWarning.datasets,
44229
44270
  configOrWarning.description,
44230
44271
  fileTypes,
44231
- coordinationTypes
44272
+ coordinationTypes,
44273
+ stores
44232
44274
  );
44233
44275
  return createViewConfigStore(loaders, configOrWarning);
44234
44276
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VitS.d.ts","sourceRoot":"","sources":["../src/VitS.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IA7ByB,MAAM,EAApB,MAAM;IAGkB,SAAS,EAAjC,SAAS,GAAC,MAAM;IACF,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IAEU,MAAM;IACN,cAAc;IAEd,cAAc;IAEf,cAAc,EAA7B,OAAO;IAIQ,sBAAsB,EAArC,OAAO;IAGY,GAAG,EAAtB,IAAI,GAAC,MAAM;IAGE,SAAS;IACT,SAAS;IACT,cAAc;IACd,iBAAiB;IACX,OAAO,EAA1B,IAAI,GAAC,MAAM;gBAyLrB"}
1
+ {"version":3,"file":"VitS.d.ts","sourceRoot":"","sources":["../src/VitS.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IA7ByB,MAAM,EAApB,MAAM;IAGkB,SAAS,EAAjC,SAAS,GAAC,MAAM;IACF,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IAEU,MAAM;IACN,cAAc;IAEd,cAAc;IAEf,cAAc,EAA7B,OAAO;IAIQ,sBAAsB,EAArC,OAAO;IAGY,GAAG,EAAtB,IAAI,GAAC,MAAM;IAGE,SAAS;IACT,SAAS;IACT,cAAc;IACd,iBAAiB;IACX,OAAO,EAA1B,IAAI,GAAC,MAAM;gBA2LrB"}
package/dist-tsc/VitS.js CHANGED
@@ -45,7 +45,7 @@ import { createGenerateClassName } from './mui-utils.js';
45
45
  * provided by the parent.
46
46
  */
47
47
  export function VitS(props) {
48
- const { config, rowHeight, height, theme, onWarn, onConfigChange, onLoaderChange, validateConfig = true, validateOnConfigChange = false, isBounded = false, uid = null, viewTypes: viewTypesProp, fileTypes: fileTypesProp, jointFileTypes: jointFileTypesProp, coordinationTypes: coordinationTypesProp, warning, } = props;
48
+ const { config, stores, rowHeight, height, theme, onWarn, onConfigChange, onLoaderChange, validateConfig = true, validateOnConfigChange = false, isBounded = false, uid = null, viewTypes: viewTypesProp, fileTypes: fileTypesProp, jointFileTypes: jointFileTypesProp, coordinationTypes: coordinationTypesProp, warning, } = props;
49
49
  const viewTypes = useMemo(() => (viewTypesProp || []), [viewTypesProp]);
50
50
  const fileTypes = useMemo(() => (fileTypesProp || []), [fileTypesProp]);
51
51
  const jointFileTypes = useMemo(() => (jointFileTypesProp || []), [jointFileTypesProp]);
@@ -135,7 +135,7 @@ export function VitS(props) {
135
135
  // Initialize the view config and loaders in the global state.
136
136
  const createViewConfigStoreClosure = useCallback(() => {
137
137
  if (success) {
138
- const loaders = createLoaders(configOrWarning.datasets, configOrWarning.description, fileTypes, coordinationTypes);
138
+ const loaders = createLoaders(configOrWarning.datasets, configOrWarning.description, fileTypes, coordinationTypes, stores);
139
139
  return createViewConfigStore(loaders, configOrWarning);
140
140
  }
141
141
  // No config found, so clear the loaders.
@@ -62,7 +62,9 @@ export function useMultiCoordinationScopes(parameter: any, coordinationScopes: a
62
62
  export function useMultiCoordinationScopesNonNull(parameter: any, coordinationScopes: any): any;
63
63
  export function useMultiCoordinationScopesSecondary(parameter: any, byType: any, coordinationScopes: any, coordinationScopesBy: any): any;
64
64
  export function useMultiCoordinationScopesSecondaryNonNull(parameter: any, byType: any, coordinationScopes: any, coordinationScopesBy: any): any;
65
- export function useMultiCoordinationValues(parameter: any, coordinationScopes: any): any;
65
+ export function useMultiCoordinationValues(parameter: any, coordinationScopes: any): {
66
+ [key: string]: any;
67
+ };
66
68
  /**
67
69
  * Get a mapping from dataset coordination scopes to dataset UIDs.
68
70
  * @param {object} coordinationScopes The coordination scope mapping object for a view.
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AACH,oEAFa,MAAM,GAAC,SAAS,CAoB5B;AAED;;;;;;;GAOG;AACH,mGAFa,MAAM,GAAC,SAAS,CAoB5B;AAED;;;;;GAKG;AACH,6CAJW,MAAM,4BAEJ,MAAM,GAAC,SAAS,CAI5B;AAED;;;;;;GAMG;AACH,+CALW,MAAM,oFAGJ,MAAM,GAAC,SAAS,CAc5B;AA2MD;;;;;;;;;GASG;AACH,mDALW,MAAM,EAAE,sBACR,MAAM,GAEJ,MAAM,CAclB;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CATW,MAAM,EAAE,sBACR,MAAM,SAqChB;AAED,yFAKC;AAED,gGAqBC;AAED,0IA4BC;AAED,iJAkEC;AAED,yFAmBC;AAED;;;;GAIG;AACH,mDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,UAEN,MAAM,SA6EhB;AAED;;;;;GAKG;AACH,0DAHW,MAAM,GACJ,MAAM,CAiBlB;AAED;;;;;;GAMG;AACH,4DAJW,MAAM,wBACN,MAAM,GACJ,MAAM,CAgBlB;AAED;;;;;;;GAOG;AACH,4DANW,MAAM,EAAE,iDACR,MAAM,eACN,MAAM,iBACN,MAAM,SAuEhB;AAGD;;;;;;;;;;;GAWG;AACH,wDATW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,SAYhB;AA6BD;;;;;;;;;;;;;;;GAeG;AACH,qDATW,MAAM,EAAE,sBACR,MAAM,SAkChB;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAGD;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAoBhB;AAED;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAShB;AAED;;;;;GAKG;AACH,6BAHa,MAAM,EAAE,CAKpB;AAED;;;;;GAKG;AACH,+CAEC;AAED;;;;;GAKG;AACH,0EAEC;AAED;;;;;GAKG;AACH,uEAEC;AAED;;;;;GAKG;AACH,4CAEC;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,oEAIC;AAED;;;;;GAKG;AACH,qCAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,iDAEC;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,iDAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,6DAOC;AAED;;;;GAIG;AACH,iCAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,8CAEC;AAnhCD;;;;+QAA0D;AAC1D,sFAA0D;AAC1D;;;;;EAAgE;AAOhE;;;;+QAAwD;AACxD,qFAAwD;AAmGjD,yFA8FJ;AAOI,0FAFM,MAAM,CAOlB;AAcM,iDAUJ"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AACH,oEAFa,MAAM,GAAC,SAAS,CAoB5B;AAED;;;;;;;GAOG;AACH,mGAFa,MAAM,GAAC,SAAS,CAoB5B;AAED;;;;;GAKG;AACH,6CAJW,MAAM,4BAEJ,MAAM,GAAC,SAAS,CAI5B;AAED;;;;;;GAMG;AACH,+CALW,MAAM,oFAGJ,MAAM,GAAC,SAAS,CAc5B;AA2MD;;;;;;;;;GASG;AACH,mDALW,MAAM,EAAE,sBACR,MAAM,GAEJ,MAAM,CAclB;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CATW,MAAM,EAAE,sBACR,MAAM,SAqChB;AAED,yFAKC;AAED,gGAqBC;AAED,0IA4BC;AAED,iJAkEC;AAED;;EAmBC;AAED;;;;GAIG;AACH,mDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,UAEN,MAAM,SA6EhB;AAED;;;;;GAKG;AACH,0DAHW,MAAM,GACJ,MAAM,CAiBlB;AAED;;;;;;GAMG;AACH,4DAJW,MAAM,wBACN,MAAM,GACJ,MAAM,CAgBlB;AAED;;;;;;;GAOG;AACH,4DANW,MAAM,EAAE,iDACR,MAAM,eACN,MAAM,iBACN,MAAM,SAuEhB;AAGD;;;;;;;;;;;GAWG;AACH,wDATW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,SAYhB;AA6BD;;;;;;;;;;;;;;;GAeG;AACH,qDATW,MAAM,EAAE,sBACR,MAAM,SAkChB;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAGD;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAoBhB;AAED;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAShB;AAED;;;;;GAKG;AACH,6BAHa,MAAM,EAAE,CAKpB;AAED;;;;;GAKG;AACH,+CAEC;AAED;;;;;GAKG;AACH,0EAEC;AAED;;;;;GAKG;AACH,uEAEC;AAED;;;;;GAKG;AACH,4CAEC;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,oEAIC;AAED;;;;;GAKG;AACH,qCAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,iDAEC;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,iDAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,6DAOC;AAED;;;;GAIG;AACH,iCAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,8CAEC;AAnhCD;;;;+QAA0D;AAC1D,sFAA0D;AAC1D;;;;;EAAgE;AAOhE;;;;+QAAwD;AACxD,qFAAwD;AAmGjD,yFA8FJ;AAOI,0FAFM,MAAM,CAOlB;AAcM,iDAUJ"}
@@ -3,11 +3,12 @@ export function useRowHeight(config: any, initialRowHeight: any, height: any, ma
3
3
  * Create a mapping from dataset ID to loader objects by data type.
4
4
  * @param {object[]} datasets The datasets array from the view config.
5
5
  * @param {string} configDescription The top-level description in the
6
+ * view config.
6
7
  * @param {PluginFileType[]} fileTypes
7
8
  * @param {PluginCoordinationType[]} coordinationTypes
8
- * view config.
9
+ * @param {object} stores Optional mapping from URLs to Zarrita stores.
9
10
  * @returns {object} Mapping from dataset ID to data type to loader
10
11
  * instance.
11
12
  */
12
- export function createLoaders(datasets: object[], configDescription: string, fileTypes: PluginFileType[], coordinationTypes: PluginCoordinationType[]): object;
13
+ export function createLoaders(datasets: object[], configDescription: string, fileTypes: PluginFileType[], coordinationTypes: PluginCoordinationType[], stores: object): object;
13
14
  //# sourceMappingURL=vitessce-grid-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitessce-grid-utils.d.ts","sourceRoot":"","sources":["../src/vitessce-grid-utils.js"],"names":[],"mappings":"AA0CA,gHA6CC;AA4BD;;;;;;;;;GASG;AACH,wCARW,MAAM,EAAE,qBACR,MAAM,aACN,gBAAgB,qBAChB,wBAAwB,GAEtB,MAAM,CAiDlB"}
1
+ {"version":3,"file":"vitessce-grid-utils.d.ts","sourceRoot":"","sources":["../src/vitessce-grid-utils.js"],"names":[],"mappings":"AA0CA,gHA6CC;AA4BD;;;;;;;;;;GAUG;AACH,wCATW,MAAM,EAAE,qBACR,MAAM,aAEN,gBAAgB,qBAChB,wBAAwB,UACxB,MAAM,GACJ,MAAM,CA4DlB"}
@@ -99,15 +99,16 @@ function withDefaults(coordinationValues, dataType, fileType, datasetUid, defaul
99
99
  * Create a mapping from dataset ID to loader objects by data type.
100
100
  * @param {object[]} datasets The datasets array from the view config.
101
101
  * @param {string} configDescription The top-level description in the
102
+ * view config.
102
103
  * @param {PluginFileType[]} fileTypes
103
104
  * @param {PluginCoordinationType[]} coordinationTypes
104
- * view config.
105
+ * @param {object} stores Optional mapping from URLs to Zarrita stores.
105
106
  * @returns {object} Mapping from dataset ID to data type to loader
106
107
  * instance.
107
108
  */
108
- export function createLoaders(datasets, configDescription, fileTypes, coordinationTypes) {
109
+ export function createLoaders(datasets, configDescription, fileTypes, coordinationTypes, stores) {
109
110
  const result = {};
110
- const dataSources = {};
111
+ const dataSources = new InternMap([], JSON.stringify);
111
112
  const defaultCoordinationValues = fromEntries(coordinationTypes.map(ct => ([ct.name, ct.defaultValue])));
112
113
  datasets.forEach((dataset) => {
113
114
  const datasetLoaders = {
@@ -120,12 +121,23 @@ export function createLoaders(datasets, configDescription, fileTypes, coordinati
120
121
  const dataType = getDataTypeFromFileType(fileType, fileTypes);
121
122
  const coordinationValuesWithDefaults = withDefaults(coordinationValues, dataType, fileType, dataset.uid, defaultCoordinationValues);
122
123
  const [DataSourceClass, LoaderClass] = getSourceAndLoaderFromFileType(fileType, fileTypes);
123
- // Create _one_ DataSourceClass instance per URL. Derived loaders share this object.
124
+ // Create _one_ DataSourceClass instance per (URL, DataSource class name) pair.
125
+ // Derived loaders share this object.
124
126
  const fileId = url || JSON.stringify(options);
125
- if (!(fileId in dataSources)) {
126
- dataSources[fileId] = new DataSourceClass({ url, requestInit });
127
+ // The class name might be minified but that should not matter;
128
+ // we just need a string that is unique to the class for the key.
129
+ const dataSourceName = DataSourceClass.prototype.constructor.name;
130
+ const dataSourceKey = [fileId, dataSourceName];
131
+ if (!dataSources.has(dataSourceKey)) {
132
+ dataSources.set(dataSourceKey, new DataSourceClass({
133
+ url,
134
+ requestInit,
135
+ // Optionally, pass a Zarrita store to the data source,
136
+ // if one was mapped to this URL.
137
+ store: stores?.[url],
138
+ }));
127
139
  }
128
- const loader = new LoaderClass(dataSources[fileId], file);
140
+ const loader = new LoaderClass(dataSources.get(dataSourceKey), file);
129
141
  if (datasetLoaders.loaders[dataType]) {
130
142
  datasetLoaders.loaders[dataType].set(coordinationValuesWithDefaults, loader);
131
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vit-s",
3
- "version": "3.2.2",
3
+ "version": "3.3.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -29,10 +29,10 @@
29
29
  "uuid": "^9.0.0",
30
30
  "zustand": "^3.5.10",
31
31
  "react-aria": "^3.28.0",
32
- "@vitessce/constants-internal": "3.2.2",
33
- "@vitessce/plugins": "3.2.2",
34
- "@vitessce/schemas": "3.2.2",
35
- "@vitessce/utils": "3.2.2"
32
+ "@vitessce/constants-internal": "3.3.1",
33
+ "@vitessce/plugins": "3.3.1",
34
+ "@vitessce/schemas": "3.3.1",
35
+ "@vitessce/utils": "3.3.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@testing-library/jest-dom": "^5.16.4",
package/src/VitS.js CHANGED
@@ -63,6 +63,7 @@ import { createGenerateClassName } from './mui-utils.js';
63
63
  export function VitS(props) {
64
64
  const {
65
65
  config,
66
+ stores,
66
67
  rowHeight,
67
68
  height,
68
69
  theme,
@@ -197,6 +198,7 @@ export function VitS(props) {
197
198
  configOrWarning.description,
198
199
  fileTypes,
199
200
  coordinationTypes,
201
+ stores,
200
202
  );
201
203
  return createViewConfigStore(loaders, configOrWarning);
202
204
  }
@@ -117,15 +117,16 @@ function withDefaults(
117
117
  * Create a mapping from dataset ID to loader objects by data type.
118
118
  * @param {object[]} datasets The datasets array from the view config.
119
119
  * @param {string} configDescription The top-level description in the
120
+ * view config.
120
121
  * @param {PluginFileType[]} fileTypes
121
122
  * @param {PluginCoordinationType[]} coordinationTypes
122
- * view config.
123
+ * @param {object} stores Optional mapping from URLs to Zarrita stores.
123
124
  * @returns {object} Mapping from dataset ID to data type to loader
124
125
  * instance.
125
126
  */
126
- export function createLoaders(datasets, configDescription, fileTypes, coordinationTypes) {
127
+ export function createLoaders(datasets, configDescription, fileTypes, coordinationTypes, stores) {
127
128
  const result = {};
128
- const dataSources = {};
129
+ const dataSources = new InternMap([], JSON.stringify);
129
130
  const defaultCoordinationValues = fromEntries(
130
131
  coordinationTypes.map(ct => ([ct.name, ct.defaultValue])),
131
132
  );
@@ -152,12 +153,23 @@ export function createLoaders(datasets, configDescription, fileTypes, coordinati
152
153
  defaultCoordinationValues,
153
154
  );
154
155
  const [DataSourceClass, LoaderClass] = getSourceAndLoaderFromFileType(fileType, fileTypes);
155
- // Create _one_ DataSourceClass instance per URL. Derived loaders share this object.
156
+ // Create _one_ DataSourceClass instance per (URL, DataSource class name) pair.
157
+ // Derived loaders share this object.
156
158
  const fileId = url || JSON.stringify(options);
157
- if (!(fileId in dataSources)) {
158
- dataSources[fileId] = new DataSourceClass({ url, requestInit });
159
+ // The class name might be minified but that should not matter;
160
+ // we just need a string that is unique to the class for the key.
161
+ const dataSourceName = DataSourceClass.prototype.constructor.name;
162
+ const dataSourceKey = [fileId, dataSourceName];
163
+ if (!dataSources.has(dataSourceKey)) {
164
+ dataSources.set(dataSourceKey, new DataSourceClass({
165
+ url,
166
+ requestInit,
167
+ // Optionally, pass a Zarrita store to the data source,
168
+ // if one was mapped to this URL.
169
+ store: stores?.[url],
170
+ }));
159
171
  }
160
- const loader = new LoaderClass(dataSources[fileId], file);
172
+ const loader = new LoaderClass(dataSources.get(dataSourceKey), file);
161
173
  if (datasetLoaders.loaders[dataType]) {
162
174
  datasetLoaders.loaders[dataType].set(coordinationValuesWithDefaults, loader);
163
175
  } else {