@vitessce/vit-s 2.0.3 → 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.
Files changed (216) hide show
  1. package/dist/index.js +41348 -0
  2. package/dist-tsc/CallbackPublisher.d.ts +18 -0
  3. package/dist-tsc/CallbackPublisher.d.ts.map +1 -0
  4. package/dist-tsc/CallbackPublisher.js +62 -0
  5. package/dist-tsc/LoadingIndicator.d.ts +2 -0
  6. package/dist-tsc/LoadingIndicator.d.ts.map +1 -0
  7. package/dist-tsc/LoadingIndicator.js +26 -0
  8. package/dist-tsc/TitleInfo.d.ts +2 -0
  9. package/dist-tsc/TitleInfo.d.ts.map +1 -0
  10. package/dist-tsc/TitleInfo.js +74 -0
  11. package/dist-tsc/VitS.d.ts +45 -0
  12. package/dist-tsc/VitS.d.ts.map +1 -0
  13. package/dist-tsc/VitS.js +119 -0
  14. package/dist-tsc/VitessceGrid.d.ts +23 -0
  15. package/dist-tsc/VitessceGrid.d.ts.map +1 -0
  16. package/dist-tsc/VitessceGrid.js +60 -0
  17. package/dist-tsc/VitessceGrid.test.d.ts +2 -0
  18. package/dist-tsc/VitessceGrid.test.d.ts.map +1 -0
  19. package/dist-tsc/VitessceGrid.test.js +40 -0
  20. package/dist-tsc/Warning.d.ts +2 -0
  21. package/dist-tsc/Warning.d.ts.map +1 -0
  22. package/dist-tsc/Warning.js +45 -0
  23. package/dist-tsc/classNames.d.ts +8 -0
  24. package/dist-tsc/classNames.d.ts.map +1 -0
  25. package/dist-tsc/classNames.js +8 -0
  26. package/dist-tsc/data/AbstractLoader.d.ts +22 -0
  27. package/dist-tsc/data/AbstractLoader.d.ts.map +1 -0
  28. package/dist-tsc/data/AbstractLoader.js +18 -0
  29. package/dist-tsc/data/AbstractTwoStepLoader.d.ts +6 -0
  30. package/dist-tsc/data/AbstractTwoStepLoader.d.ts.map +1 -0
  31. package/dist-tsc/data/AbstractTwoStepLoader.js +7 -0
  32. package/dist-tsc/data/LoaderResult.d.ts +7 -0
  33. package/dist-tsc/data/LoaderResult.d.ts.map +1 -0
  34. package/dist-tsc/data/LoaderResult.js +7 -0
  35. package/dist-tsc/data/index.d.ts +4 -0
  36. package/dist-tsc/data/index.d.ts.map +1 -0
  37. package/dist-tsc/data/index.js +3 -0
  38. package/dist-tsc/data/loader-registry.d.ts +9 -0
  39. package/dist-tsc/data/loader-registry.d.ts.map +1 -0
  40. package/dist-tsc/data/loader-registry.js +27 -0
  41. package/dist-tsc/data-hook-utils.d.ts +69 -0
  42. package/dist-tsc/data-hook-utils.d.ts.map +1 -0
  43. package/dist-tsc/data-hook-utils.js +173 -0
  44. package/dist-tsc/data-hooks.d.ts +77 -0
  45. package/dist-tsc/data-hooks.d.ts.map +1 -0
  46. package/dist-tsc/data-hooks.js +241 -0
  47. package/dist-tsc/errors/AbstractLoaderError.d.ts +10 -0
  48. package/dist-tsc/errors/AbstractLoaderError.d.ts.map +1 -0
  49. package/dist-tsc/errors/AbstractLoaderError.js +13 -0
  50. package/dist-tsc/errors/DataSourceFetchError.d.ts +8 -0
  51. package/dist-tsc/errors/DataSourceFetchError.d.ts.map +1 -0
  52. package/dist-tsc/errors/DataSourceFetchError.js +13 -0
  53. package/dist-tsc/errors/DatasetNotFoundError.d.ts +6 -0
  54. package/dist-tsc/errors/DatasetNotFoundError.d.ts.map +1 -0
  55. package/dist-tsc/errors/DatasetNotFoundError.js +17 -0
  56. package/dist-tsc/errors/LoaderNotFoundError.d.ts +10 -0
  57. package/dist-tsc/errors/LoaderNotFoundError.d.ts.map +1 -0
  58. package/dist-tsc/errors/LoaderNotFoundError.js +17 -0
  59. package/dist-tsc/errors/LoaderValidationError.d.ts +10 -0
  60. package/dist-tsc/errors/LoaderValidationError.d.ts.map +1 -0
  61. package/dist-tsc/errors/LoaderValidationError.js +15 -0
  62. package/dist-tsc/errors/index.d.ts +6 -0
  63. package/dist-tsc/errors/index.d.ts.map +1 -0
  64. package/dist-tsc/errors/index.js +5 -0
  65. package/dist-tsc/hooks.d.ts +80 -0
  66. package/dist-tsc/hooks.d.ts.map +1 -0
  67. package/dist-tsc/hooks.js +271 -0
  68. package/dist-tsc/index.d.ts +11 -0
  69. package/dist-tsc/index.d.ts.map +1 -0
  70. package/dist-tsc/index.js +10 -17
  71. package/dist-tsc/plugins.test.fixtures.d.ts +61 -0
  72. package/dist-tsc/plugins.test.fixtures.d.ts.map +1 -0
  73. package/dist-tsc/plugins.test.fixtures.js +76 -0
  74. package/dist-tsc/schemas/config-0.1.0.schema.json +84 -0
  75. package/dist-tsc/schemas/config-1.0.0.schema.json +733 -0
  76. package/dist-tsc/schemas/config-1.0.1.schema.json +909 -0
  77. package/dist-tsc/schemas/config-1.0.10.schema.json +969 -0
  78. package/dist-tsc/schemas/config-1.0.11.schema.json +990 -0
  79. package/dist-tsc/schemas/config-1.0.12.schema.json +997 -0
  80. package/dist-tsc/schemas/config-1.0.13.schema.json +1013 -0
  81. package/dist-tsc/schemas/config-1.0.14.schema.json +1048 -0
  82. package/dist-tsc/schemas/config-1.0.15.schema.json +1048 -0
  83. package/dist-tsc/schemas/config-1.0.16.schema.json +1089 -0
  84. package/dist-tsc/schemas/config-1.0.2.schema.json +910 -0
  85. package/dist-tsc/schemas/config-1.0.3.schema.json +910 -0
  86. package/dist-tsc/schemas/config-1.0.4.schema.json +949 -0
  87. package/dist-tsc/schemas/config-1.0.5.schema.json +949 -0
  88. package/dist-tsc/schemas/config-1.0.6.schema.json +949 -0
  89. package/dist-tsc/schemas/config-1.0.7.schema.json +949 -0
  90. package/dist-tsc/schemas/config-1.0.8.schema.json +965 -0
  91. package/dist-tsc/schemas/config-1.0.9.schema.json +965 -0
  92. package/dist-tsc/schemas/obsSets.schema.d.ts +179 -0
  93. package/dist-tsc/schemas/obsSets.schema.d.ts.map +1 -0
  94. package/dist-tsc/schemas/obsSets.schema.js +195 -0
  95. package/dist-tsc/schemas/obsSetsTabular.schema.d.ts +57 -0
  96. package/dist-tsc/schemas/obsSetsTabular.schema.d.ts.map +1 -0
  97. package/dist-tsc/schemas/obsSetsTabular.schema.js +38 -0
  98. package/dist-tsc/schemas/raster.schema.d.ts +239 -0
  99. package/dist-tsc/schemas/raster.schema.d.ts.map +1 -0
  100. package/dist-tsc/schemas/raster.schema.js +120 -0
  101. package/dist-tsc/shared-mui/components.d.ts +2 -0
  102. package/dist-tsc/shared-mui/components.d.ts.map +1 -0
  103. package/dist-tsc/shared-mui/components.js +29 -0
  104. package/dist-tsc/shared-mui/container.d.ts +2 -0
  105. package/dist-tsc/shared-mui/container.d.ts.map +1 -0
  106. package/dist-tsc/shared-mui/container.js +211 -0
  107. package/dist-tsc/shared-mui/styles.d.ts +5 -0
  108. package/dist-tsc/shared-mui/styles.d.ts.map +1 -0
  109. package/dist-tsc/shared-mui/styles.js +109 -0
  110. package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts +2 -0
  111. package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts.map +1 -0
  112. package/dist-tsc/shared-plot-options/CellColorEncodingOption.js +17 -0
  113. package/dist-tsc/shared-plot-options/OptionSelect.d.ts +2 -0
  114. package/dist-tsc/shared-plot-options/OptionSelect.d.ts.map +1 -0
  115. package/dist-tsc/shared-plot-options/OptionSelect.js +12 -0
  116. package/dist-tsc/shared-plot-options/OptionsContainer.d.ts +2 -0
  117. package/dist-tsc/shared-plot-options/OptionsContainer.d.ts.map +1 -0
  118. package/dist-tsc/shared-plot-options/OptionsContainer.js +9 -0
  119. package/dist-tsc/shared-plot-options/index.d.ts +5 -0
  120. package/dist-tsc/shared-plot-options/index.d.ts.map +1 -0
  121. package/dist-tsc/shared-plot-options/index.js +4 -0
  122. package/dist-tsc/shared-plot-options/styles.d.ts +2 -0
  123. package/dist-tsc/shared-plot-options/styles.d.ts.map +1 -0
  124. package/dist-tsc/shared-plot-options/styles.js +48 -0
  125. package/dist-tsc/state/hooks.d.ts +216 -0
  126. package/dist-tsc/state/hooks.d.ts.map +1 -0
  127. package/dist-tsc/state/hooks.js +575 -0
  128. package/dist-tsc/title-styles.d.ts +2 -0
  129. package/dist-tsc/title-styles.d.ts.map +1 -0
  130. package/dist-tsc/title-styles.js +72 -0
  131. package/dist-tsc/view-config-utils.d.ts +30 -0
  132. package/dist-tsc/view-config-utils.d.ts.map +1 -0
  133. package/dist-tsc/view-config-utils.js +234 -0
  134. package/dist-tsc/view-config-utils.test.d.ts +2 -0
  135. package/dist-tsc/view-config-utils.test.d.ts.map +1 -0
  136. package/dist-tsc/view-config-utils.test.fixtures.d.ts +1049 -0
  137. package/dist-tsc/view-config-utils.test.fixtures.d.ts.map +1 -0
  138. package/dist-tsc/view-config-utils.test.fixtures.js +883 -0
  139. package/dist-tsc/view-config-utils.test.js +209 -0
  140. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts +8 -0
  141. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts.map +1 -0
  142. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.js +114 -0
  143. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts +2 -0
  144. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts.map +1 -0
  145. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.js +48 -0
  146. package/dist-tsc/vitessce-grid-layout/index.d.ts +2 -0
  147. package/dist-tsc/vitessce-grid-layout/index.d.ts.map +1 -0
  148. package/dist-tsc/vitessce-grid-layout/index.js +1 -0
  149. package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts +15 -0
  150. package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts.map +1 -0
  151. package/dist-tsc/vitessce-grid-layout/layout-utils.js +61 -0
  152. package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts +2 -0
  153. package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts.map +1 -0
  154. package/dist-tsc/vitessce-grid-layout/layout-utils.test.js +148 -0
  155. package/dist-tsc/vitessce-grid-utils.d.ts +13 -0
  156. package/dist-tsc/vitessce-grid-utils.d.ts.map +1 -0
  157. package/dist-tsc/vitessce-grid-utils.js +141 -0
  158. package/package.json +23 -10
  159. package/src/CallbackPublisher.js +7 -11
  160. package/src/LoadingIndicator.js +1 -2
  161. package/src/TitleInfo.js +12 -85
  162. package/src/VitS.js +72 -50
  163. package/src/VitessceGrid.js +21 -13
  164. package/src/VitessceGrid.test.jsx +16 -7
  165. package/src/Warning.js +2 -2
  166. package/src/data/AbstractLoader.js +2 -25
  167. package/src/data/AbstractTwoStepLoader.js +1 -1
  168. package/src/data/index.js +3 -3
  169. package/src/data/loader-registry.js +22 -13
  170. package/src/data-hook-utils.js +4 -6
  171. package/src/data-hooks.js +4 -4
  172. package/src/errors/DataSourceFetchError.js +1 -1
  173. package/src/errors/DatasetNotFoundError.js +1 -1
  174. package/src/errors/LoaderNotFoundError.js +1 -1
  175. package/src/errors/LoaderValidationError.js +1 -1
  176. package/src/errors/index.js +5 -6
  177. package/src/hooks.js +70 -5
  178. package/src/index.js +21 -46
  179. package/src/schemas/config-1.0.16.schema.json +21 -1
  180. package/src/shared-mui/components.js +10 -8
  181. package/src/shared-mui/container.js +1 -1
  182. package/src/shared-mui/styles.js +5 -2
  183. package/src/shared-plot-options/CellColorEncodingOption.js +3 -4
  184. package/src/shared-plot-options/OptionSelect.js +2 -2
  185. package/src/shared-plot-options/OptionsContainer.js +2 -5
  186. package/src/shared-plot-options/index.js +4 -4
  187. package/src/shared-plot-options/styles.js +1 -1
  188. package/src/state/hooks.js +10 -3
  189. package/src/title-styles.js +73 -0
  190. package/src/view-config-utils.js +46 -98
  191. package/src/view-config-utils.test.jsx +222 -0
  192. package/src/vitessce-grid-layout/VitessceGridLayout.js +51 -30
  193. package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +17 -9
  194. package/src/vitessce-grid-layout/index.js +1 -1
  195. package/src/vitessce-grid-layout/layout-utils.js +1 -1
  196. package/src/vitessce-grid-layout/layout-utils.test.js +1 -1
  197. package/src/vitessce-grid-utils.js +27 -15
  198. package/dist/index.mjs +0 -84801
  199. package/src/component-registry.js +0 -21
  200. package/src/errors/OptionsValidationError.js +0 -25
  201. package/src/file-options-schemas-legacy.js +0 -139
  202. package/src/file-options-schemas-legacy.test.js +0 -138
  203. package/src/file-options-schemas.js +0 -327
  204. package/src/file-options-schemas.test.js +0 -26
  205. package/src/joint-file-types-legacy.js +0 -298
  206. package/src/joint-file-types-legacy.test.js +0 -412
  207. package/src/joint-file-types.js +0 -171
  208. package/src/joint-file-types.test.js +0 -144
  209. package/src/json-schemas.js +0 -9
  210. package/src/plugins.js +0 -186
  211. package/src/plugins.test.js +0 -42
  212. package/src/schemas/config-1.0.16.schema.test.js +0 -32
  213. package/src/schemas/schema.test-old.js +0 -49
  214. package/src/view-config-upgraders.js +0 -628
  215. package/src/view-config-utils.test.js +0 -95
  216. package/src/view-config-versions.js +0 -68
@@ -0,0 +1,7 @@
1
+ import AbstractLoader from './AbstractLoader.js';
2
+ export default class AbstractTwoStepLoader extends AbstractLoader {
3
+ constructor(dataSource, params) {
4
+ super(params);
5
+ this.dataSource = dataSource;
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ export default class LoaderResult {
2
+ constructor(data: any, url: any, coordinationValues?: null);
3
+ data: any;
4
+ url: any;
5
+ coordinationValues: any;
6
+ }
7
+ //# sourceMappingURL=LoaderResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoaderResult.d.ts","sourceRoot":"","sources":["../../src/data/LoaderResult.js"],"names":[],"mappings":"AACA;IACE,4DAIC;IAHC,UAAgB;IAChB,SAAc;IACd,wBAA4C;CAE/C"}
@@ -0,0 +1,7 @@
1
+ export default class LoaderResult {
2
+ constructor(data, url, coordinationValues = null) {
3
+ this.data = data;
4
+ this.url = url;
5
+ this.coordinationValues = coordinationValues;
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ export { default as AbstractLoader } from "./AbstractLoader.js";
2
+ export { default as AbstractTwoStepLoader } from "./AbstractTwoStepLoader.js";
3
+ export { default as LoaderResult } from "./LoaderResult.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export { default as AbstractLoader } from './AbstractLoader.js';
2
+ export { default as AbstractTwoStepLoader } from './AbstractTwoStepLoader.js';
3
+ export { default as LoaderResult } from './LoaderResult.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Get the data source and data loader class.
3
+ * @param {string} type The fileType name.
4
+ * @param {PluginFileType[]} fileTypes The array of file types.
5
+ * @returns {array} [dataSourceClass, dataLoaderClass].
6
+ */
7
+ export function getSourceAndLoaderFromFileType(type: string, fileTypes: PluginFileType[]): array;
8
+ export function getDataTypeFromFileType(type: any, fileTypes: any): any;
9
+ //# sourceMappingURL=loader-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-registry.d.ts","sourceRoot":"","sources":["../../src/data/loader-registry.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qDAJW,MAAM,aACN,gBAAgB,SAc1B;AAED,wEAQC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Get the data source and data loader class.
3
+ * @param {string} type The fileType name.
4
+ * @param {PluginFileType[]} fileTypes The array of file types.
5
+ * @returns {array} [dataSourceClass, dataLoaderClass].
6
+ */
7
+ export function getSourceAndLoaderFromFileType(type, fileTypes) {
8
+ if (Array.isArray(fileTypes)) {
9
+ const matchingFileType = fileTypes.find(ft => ft.name === type);
10
+ if (matchingFileType) {
11
+ return matchingFileType.getSourceAndLoader();
12
+ }
13
+ }
14
+ // Fallback to JSON.
15
+ // TODO(monorepo)
16
+ // return [JsonSource, JsonLoader];
17
+ return [null, null];
18
+ }
19
+ export function getDataTypeFromFileType(type, fileTypes) {
20
+ if (Array.isArray(fileTypes)) {
21
+ const matchingFileType = fileTypes.find(ft => ft.name === type);
22
+ if (matchingFileType) {
23
+ return matchingFileType.dataType;
24
+ }
25
+ }
26
+ return null;
27
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Warn via publishing to the console
3
+ * and to the global warning store.
4
+ * @param {AbstractLoaderError} error An error instance.
5
+ */
6
+ export function warn(error: AbstractLoaderError, setWarning: any): void;
7
+ /**
8
+ * Initialize values in the coordination space.
9
+ * @param {object} values Object where
10
+ * keys are coordination type names,
11
+ * values are initial coordination values.
12
+ * @param {object} setters Object where
13
+ * keys are coordination type names with the prefix 'set',
14
+ * values are coordination setter functions.
15
+ * @param {object} initialValues Object where
16
+ * keys are coordination type names and keys are values.
17
+ */
18
+ export function initCoordinationSpace(values: object, setters: object, initialValues: object): void;
19
+ /**
20
+ * Get data from a cells data type loader,
21
+ * updating "ready" and URL state appropriately.
22
+ * Throw warnings if the data is marked as required.
23
+ * Subscribe to loader updates.
24
+ * @param {object} loaders The object mapping
25
+ * datasets and data types to loader instances.
26
+ * @param {string} dataset The key for a dataset,
27
+ * used to identify which loader to use.
28
+ * @param {function} addUrl A function to call to update
29
+ * the URL list.
30
+ * @param {boolean} isRequired Should a warning be thrown if
31
+ * loading is unsuccessful?
32
+ * @param {object} coordinationSetters Object where
33
+ * keys are coordination type names with the prefix 'set',
34
+ * values are coordination setter functions.
35
+ * @param {object} initialCoordinationValues Object where
36
+ * keys are coordination type names with the prefix 'initialize',
37
+ * values are initialization preferences as boolean values.
38
+ * @returns {array} [cells, cellsCount] where
39
+ * cells is an object and cellsCount is the
40
+ * number of items in the cells object.
41
+ */
42
+ export function useDataType(dataType: any, loaders: object, dataset: string, addUrl: Function, isRequired: boolean, coordinationSetters: object, initialCoordinationValues: object, matchOn: any): array;
43
+ /**
44
+ * Get data from a cells data type loader,
45
+ * updating "ready" and URL state appropriately.
46
+ * Throw warnings if the data is marked as required.
47
+ * Subscribe to loader updates.
48
+ * @param {object} loaders The object mapping
49
+ * datasets and data types to loader instances.
50
+ * @param {string} dataset The key for a dataset,
51
+ * used to identify which loader to use.
52
+ * @param {function} addUrl A function to call to update
53
+ * the URL list.
54
+ * @param {boolean} isRequired Should a warning be thrown if
55
+ * loading is unsuccessful?
56
+ * @param {object} coordinationSetters Object where
57
+ * keys are coordination type names with the prefix 'set',
58
+ * values are coordination setter functions.
59
+ * @param {object} initialCoordinationValues Object where
60
+ * keys are coordination type names with the prefix 'initialize',
61
+ * values are initialization preferences as boolean values.
62
+ * @returns {array} [cells, cellsCount] where
63
+ * cells is an object and cellsCount is the
64
+ * number of items in the cells object.
65
+ */
66
+ export function useDataTypeMulti(dataType: any, loaders: object, dataset: string, addUrl: Function, isRequired: boolean, coordinationSetters: object, initialCoordinationValues: object, matchOnObj: any): array;
67
+ export function useHasLoader(loaders: any, dataset: any, dataType: any, matchOn: any): boolean;
68
+ import { AbstractLoaderError } from "./errors/index.js";
69
+ //# sourceMappingURL=data-hook-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-hook-utils.d.ts","sourceRoot":"","sources":["../src/data-hook-utils.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH,4BAFW,mBAAmB,yBAS7B;AAED;;;;;;;;;;GAUG;AACH,8CATW,MAAM,WAGN,MAAM,iBAGN,MAAM,QAiBhB;AAGD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oDAlBW,MAAM,WAEN,MAAM,gCAIN,OAAO,uBAEP,MAAM,6BAGN,MAAM,uBAmDhB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yDAlBW,MAAM,WAEN,MAAM,gCAIN,OAAO,uBAEP,MAAM,6BAGN,MAAM,0BAqDhB;AAED,+FAGC"}
@@ -0,0 +1,173 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { capitalize } from '@vitessce/utils';
3
+ import { STATUS } from '@vitessce/constants-internal';
4
+ import { useMatchingLoader, useMatchingLoaders, useSetWarning } from './state/hooks.js';
5
+ import { AbstractLoaderError, LoaderNotFoundError, } from './errors/index.js';
6
+ /**
7
+ * Warn via publishing to the console
8
+ * and to the global warning store.
9
+ * @param {AbstractLoaderError} error An error instance.
10
+ */
11
+ export function warn(error, setWarning) {
12
+ setWarning(error.message);
13
+ console.warn(error.message);
14
+ console.error(error.stack);
15
+ if (error instanceof AbstractLoaderError) {
16
+ error.warnInConsole();
17
+ }
18
+ }
19
+ /**
20
+ * Initialize values in the coordination space.
21
+ * @param {object} values Object where
22
+ * keys are coordination type names,
23
+ * values are initial coordination values.
24
+ * @param {object} setters Object where
25
+ * keys are coordination type names with the prefix 'set',
26
+ * values are coordination setter functions.
27
+ * @param {object} initialValues Object where
28
+ * keys are coordination type names and keys are values.
29
+ */
30
+ export function initCoordinationSpace(values, setters, initialValues) {
31
+ if (!values || !setters) {
32
+ return;
33
+ }
34
+ Object.entries(values).forEach(([coordinationType, value]) => {
35
+ const setterName = `set${capitalize(coordinationType)}`;
36
+ const setterFunc = setters[setterName];
37
+ const initialValue = initialValues && initialValues[coordinationType];
38
+ // Interpret null as "uninitialized" and therefore needing initialization.
39
+ const shouldInit = initialValue === null;
40
+ if (shouldInit && setterFunc) {
41
+ setterFunc(value);
42
+ }
43
+ });
44
+ }
45
+ /**
46
+ * Get data from a cells data type loader,
47
+ * updating "ready" and URL state appropriately.
48
+ * Throw warnings if the data is marked as required.
49
+ * Subscribe to loader updates.
50
+ * @param {object} loaders The object mapping
51
+ * datasets and data types to loader instances.
52
+ * @param {string} dataset The key for a dataset,
53
+ * used to identify which loader to use.
54
+ * @param {function} addUrl A function to call to update
55
+ * the URL list.
56
+ * @param {boolean} isRequired Should a warning be thrown if
57
+ * loading is unsuccessful?
58
+ * @param {object} coordinationSetters Object where
59
+ * keys are coordination type names with the prefix 'set',
60
+ * values are coordination setter functions.
61
+ * @param {object} initialCoordinationValues Object where
62
+ * keys are coordination type names with the prefix 'initialize',
63
+ * values are initialization preferences as boolean values.
64
+ * @returns {array} [cells, cellsCount] where
65
+ * cells is an object and cellsCount is the
66
+ * number of items in the cells object.
67
+ */
68
+ export function useDataType(dataType, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
69
+ const [data, setData] = useState({});
70
+ const [status, setStatus] = useState(STATUS.LOADING);
71
+ const setWarning = useSetWarning();
72
+ const loader = useMatchingLoader(loaders, dataset, dataType, matchOn);
73
+ useEffect(() => {
74
+ if (loader) {
75
+ setStatus(STATUS.LOADING);
76
+ loader.load().catch(e => warn(e, setWarning)).then((payload) => {
77
+ if (!payload)
78
+ return;
79
+ const { data: payloadData, url, coordinationValues } = payload;
80
+ setData(payloadData);
81
+ if (Array.isArray(url)) {
82
+ url.forEach(([val, name]) => {
83
+ addUrl(val, name);
84
+ });
85
+ }
86
+ else if (url) {
87
+ addUrl(url, dataType);
88
+ }
89
+ initCoordinationSpace(coordinationValues, coordinationSetters, initialCoordinationValues);
90
+ setStatus(STATUS.SUCCESS);
91
+ });
92
+ }
93
+ else {
94
+ setData({});
95
+ if (isRequired) {
96
+ warn(new LoaderNotFoundError(loaders, dataset, dataType, matchOn), setWarning);
97
+ setStatus(STATUS.ERROR);
98
+ }
99
+ else {
100
+ setStatus(STATUS.SUCCESS);
101
+ }
102
+ }
103
+ // eslint-disable-next-line react-hooks/exhaustive-deps
104
+ }, [loader]);
105
+ return [data, status];
106
+ }
107
+ /**
108
+ * Get data from a cells data type loader,
109
+ * updating "ready" and URL state appropriately.
110
+ * Throw warnings if the data is marked as required.
111
+ * Subscribe to loader updates.
112
+ * @param {object} loaders The object mapping
113
+ * datasets and data types to loader instances.
114
+ * @param {string} dataset The key for a dataset,
115
+ * used to identify which loader to use.
116
+ * @param {function} addUrl A function to call to update
117
+ * the URL list.
118
+ * @param {boolean} isRequired Should a warning be thrown if
119
+ * loading is unsuccessful?
120
+ * @param {object} coordinationSetters Object where
121
+ * keys are coordination type names with the prefix 'set',
122
+ * values are coordination setter functions.
123
+ * @param {object} initialCoordinationValues Object where
124
+ * keys are coordination type names with the prefix 'initialize',
125
+ * values are initialization preferences as boolean values.
126
+ * @returns {array} [cells, cellsCount] where
127
+ * cells is an object and cellsCount is the
128
+ * number of items in the cells object.
129
+ */
130
+ export function useDataTypeMulti(dataType, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOnObj) {
131
+ const [data, setData] = useState({});
132
+ const [status, setStatus] = useState(STATUS.LOADING);
133
+ const setWarning = useSetWarning();
134
+ const matchingLoaders = useMatchingLoaders(loaders, dataset, dataType, matchOnObj);
135
+ useEffect(() => {
136
+ if (matchingLoaders) {
137
+ setStatus(STATUS.LOADING);
138
+ Object.entries(matchingLoaders).forEach(([scopeKey, loader]) => {
139
+ if (loader) {
140
+ loader.load().catch(e => warn(e, setWarning)).then((payload) => {
141
+ if (!payload)
142
+ return;
143
+ const { data: payloadData, url, coordinationValues } = payload;
144
+ setData((prev) => {
145
+ // eslint-disable-next-line no-param-reassign
146
+ prev[scopeKey] = payloadData;
147
+ return prev;
148
+ });
149
+ addUrl(url, dataType);
150
+ initCoordinationSpace(coordinationValues, coordinationSetters, initialCoordinationValues);
151
+ setStatus(STATUS.SUCCESS);
152
+ });
153
+ }
154
+ });
155
+ }
156
+ else {
157
+ setData({});
158
+ if (isRequired) {
159
+ warn(new LoaderNotFoundError(loaders, dataset, dataType, matchOnObj), setWarning);
160
+ setStatus(STATUS.ERROR);
161
+ }
162
+ else {
163
+ setStatus(STATUS.SUCCESS);
164
+ }
165
+ }
166
+ // eslint-disable-next-line react-hooks/exhaustive-deps
167
+ }, [matchingLoaders]);
168
+ return [data, status];
169
+ }
170
+ export function useHasLoader(loaders, dataset, dataType, matchOn) {
171
+ const loader = useMatchingLoader(loaders, dataset, dataType, matchOn);
172
+ return loader !== null;
173
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Get the dataset description string.
3
+ * @param {object} loaders The object mapping
4
+ * datasets and data types to loader instances.
5
+ * @param {string} dataset The key for a dataset,
6
+ * used to identify which loader to use.
7
+ * @returns {array} [description] where
8
+ * description is a string.
9
+ */
10
+ export function useDescription(loaders: object, dataset: string): array;
11
+ /**
12
+ * Get data from a cells data type loader,
13
+ * updating "ready" and URL state appropriately.
14
+ * Throw warnings if the data is marked as required.
15
+ * Subscribe to loader updates.
16
+ * @param {object} loaders The object mapping
17
+ * datasets and data types to loader instances.
18
+ * @param {string} dataset The key for a dataset,
19
+ * used to identify which loader to use.
20
+ * @param {function} addUrl A function to call to update
21
+ * the URL list.
22
+ * @param {boolean} isRequired Should a warning be thrown if
23
+ * loading is unsuccessful?
24
+ * @param {object} coordinationSetters Object where
25
+ * keys are coordination type names with the prefix 'set',
26
+ * values are coordination setter functions.
27
+ * @param {object} initialCoordinationValues Object where
28
+ * keys are coordination type names with the prefix 'initialize',
29
+ * values are initialization preferences as boolean values.
30
+ * @returns {array} [cells, cellsCount] where
31
+ * cells is an object and cellsCount is the
32
+ * number of items in the cells object.
33
+ */
34
+ export function useObsEmbeddingData(loaders: object, dataset: string, addUrl: Function, isRequired: boolean, coordinationSetters: object, initialCoordinationValues: object, matchOn: any): array;
35
+ export function useObsLocationsData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
36
+ export function useObsLabelsData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
37
+ export function useObsSegmentationsData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
38
+ export function useObsSetsData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
39
+ export function useObsFeatureMatrixData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
40
+ export function useFeatureLabelsData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
41
+ export function useImageData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
42
+ export function useGenomicProfilesData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
43
+ export function useNeighborhoodsData(loaders: any, dataset: any, addUrl: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
44
+ /**
45
+ * Get data from the expression matrix data type loader for a given gene selection.
46
+ * Throw warnings if the data is marked as required.
47
+ * Subscribe to loader updates.
48
+ * @param {object} loaders The object mapping
49
+ * datasets and data types to loader instances.
50
+ * @param {string} dataset The key for a dataset,
51
+ * used to identify which loader to use.
52
+ * @param {boolean} isRequired Should a warning be thrown if
53
+ * loading is unsuccessful?
54
+ * @param {boolean} selection A list of gene names to get expression data for.
55
+ * @returns {array} [geneData] where geneData is an array [Uint8Array, ..., Uint8Array]
56
+ * for however many genes are in the selection.
57
+ */
58
+ export function useFeatureSelection(loaders: object, dataset: string, isRequired: boolean, selection: boolean, matchOn: any): array;
59
+ /**
60
+ * Get the attributes for the expression matrix data type loader,
61
+ * i.e names of cells and genes.
62
+ * Throw warnings if the data is marked as required.
63
+ * Subscribe to loader updates. Should not be used in conjunction (called in the same component)
64
+ * with useExpressionMatrixData.
65
+ * @param {object} loaders The object mapping
66
+ * datasets and data types to loader instances.
67
+ * @param {string} dataset The key for a dataset,
68
+ * used to identify which loader to use.
69
+ * @param {function} addUrl A function to call to update
70
+ * the URL list.
71
+ * @param {boolean} isRequired Should a warning be thrown if
72
+ * loading is unsuccessful?
73
+ * @returns {object} [attrs] { rows, cols } object containing cell and gene names.
74
+ */
75
+ export function useObsFeatureMatrixIndices(loaders: object, dataset: string, addUrl: Function, isRequired: boolean, matchOn: any): object;
76
+ export function useMultiObsLabels(coordinationScopes: any, obsType: any, loaders: any, dataset: any, addUrl: any): any[];
77
+ //# sourceMappingURL=data-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-hooks.d.ts","sourceRoot":"","sources":["../src/data-hooks.js"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH,wCAPW,MAAM,WAEN,MAAM,SAsBhB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,6CAlBW,MAAM,WAEN,MAAM,gCAIN,OAAO,uBAEP,MAAM,6BAGN,MAAM,uBAgBhB;AAED,6KASC;AAED,0KASC;AAED,iLASC;AAED,wKASC;AAED,iLASC;AAED,8KASC;AAED,sKASC;AAED,gLASC;AAED,8KASC;AAED;;;;;;;;;;;;;GAaG;AACH,6CAVW,MAAM,WAEN,MAAM,cAEN,OAAO,aAEP,OAAO,uBA8EjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,oDAVW,MAAM,WAEN,MAAM,gCAIN,OAAO,iBAEL,MAAM,CAsDlB;AAED,yHAmBC"}
@@ -0,0 +1,241 @@
1
+ import { useState, useEffect, useMemo } from 'react';
2
+ import { CoordinationType, DataType, STATUS } from '@vitessce/constants-internal';
3
+ import { fromEntries } from '@vitessce/utils';
4
+ import { useMatchingLoader, useMultiCoordinationValues, useSetWarning } from './state/hooks.js';
5
+ import { LoaderNotFoundError, } from './errors/index.js';
6
+ import { warn, useDataType, useDataTypeMulti, } from './data-hook-utils.js';
7
+ /**
8
+ * Get the dataset description string.
9
+ * @param {object} loaders The object mapping
10
+ * datasets and data types to loader instances.
11
+ * @param {string} dataset The key for a dataset,
12
+ * used to identify which loader to use.
13
+ * @returns {array} [description] where
14
+ * description is a string.
15
+ */
16
+ export function useDescription(loaders, dataset) {
17
+ const [description, setDescription] = useState();
18
+ useEffect(() => {
19
+ if (!loaders[dataset]) {
20
+ return;
21
+ }
22
+ if (loaders[dataset].description) {
23
+ setDescription(loaders[dataset].description);
24
+ }
25
+ else {
26
+ setDescription(null);
27
+ }
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
+ }, [loaders, dataset]);
30
+ return [description];
31
+ }
32
+ /**
33
+ * Get data from a cells data type loader,
34
+ * updating "ready" and URL state appropriately.
35
+ * Throw warnings if the data is marked as required.
36
+ * Subscribe to loader updates.
37
+ * @param {object} loaders The object mapping
38
+ * datasets and data types to loader instances.
39
+ * @param {string} dataset The key for a dataset,
40
+ * used to identify which loader to use.
41
+ * @param {function} addUrl A function to call to update
42
+ * the URL list.
43
+ * @param {boolean} isRequired Should a warning be thrown if
44
+ * loading is unsuccessful?
45
+ * @param {object} coordinationSetters Object where
46
+ * keys are coordination type names with the prefix 'set',
47
+ * values are coordination setter functions.
48
+ * @param {object} initialCoordinationValues Object where
49
+ * keys are coordination type names with the prefix 'initialize',
50
+ * values are initialization preferences as boolean values.
51
+ * @returns {array} [cells, cellsCount] where
52
+ * cells is an object and cellsCount is the
53
+ * number of items in the cells object.
54
+ */
55
+ export function useObsEmbeddingData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
56
+ return useDataType(DataType.OBS_EMBEDDING, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
57
+ }
58
+ export function useObsLocationsData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
59
+ return useDataType(DataType.OBS_LOCATIONS, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
60
+ }
61
+ export function useObsLabelsData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
62
+ return useDataType(DataType.OBS_LABELS, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
63
+ }
64
+ export function useObsSegmentationsData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
65
+ return useDataType(DataType.OBS_SEGMENTATIONS, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
66
+ }
67
+ export function useObsSetsData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
68
+ return useDataType(DataType.OBS_SETS, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
69
+ }
70
+ export function useObsFeatureMatrixData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
71
+ return useDataType(DataType.OBS_FEATURE_MATRIX, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
72
+ }
73
+ export function useFeatureLabelsData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
74
+ return useDataType(DataType.FEATURE_LABELS, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
75
+ }
76
+ export function useImageData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
77
+ return useDataType(DataType.IMAGE, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
78
+ }
79
+ export function useGenomicProfilesData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
80
+ return useDataType(DataType.GENOMIC_PROFILES, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
81
+ }
82
+ export function useNeighborhoodsData(loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
83
+ return useDataType(DataType.NEIGHBORHOODS, loaders, dataset, addUrl, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
84
+ }
85
+ /**
86
+ * Get data from the expression matrix data type loader for a given gene selection.
87
+ * Throw warnings if the data is marked as required.
88
+ * Subscribe to loader updates.
89
+ * @param {object} loaders The object mapping
90
+ * datasets and data types to loader instances.
91
+ * @param {string} dataset The key for a dataset,
92
+ * used to identify which loader to use.
93
+ * @param {boolean} isRequired Should a warning be thrown if
94
+ * loading is unsuccessful?
95
+ * @param {boolean} selection A list of gene names to get expression data for.
96
+ * @returns {array} [geneData] where geneData is an array [Uint8Array, ..., Uint8Array]
97
+ * for however many genes are in the selection.
98
+ */
99
+ export function useFeatureSelection(loaders, dataset, isRequired, selection, matchOn) {
100
+ const [geneData, setGeneData] = useState();
101
+ const [status, setStatus] = useState(STATUS.LOADING);
102
+ const [loadedGeneName, setLoadedGeneName] = useState(null);
103
+ const setWarning = useSetWarning();
104
+ const loader = useMatchingLoader(loaders, dataset, DataType.OBS_FEATURE_MATRIX, matchOn);
105
+ useEffect(() => {
106
+ if (!selection) {
107
+ setGeneData(null);
108
+ setLoadedGeneName(null);
109
+ setStatus(STATUS.SUCCESS);
110
+ return;
111
+ }
112
+ if (loader) {
113
+ setGeneData(null);
114
+ setLoadedGeneName(null);
115
+ setStatus(STATUS.LOADING);
116
+ const implementsGeneSelection = typeof loader.loadGeneSelection === 'function';
117
+ if (implementsGeneSelection) {
118
+ loader
119
+ .loadGeneSelection({ selection })
120
+ .catch(e => warn(e, setWarning))
121
+ .then((payload) => {
122
+ if (!payload)
123
+ return;
124
+ const { data } = payload;
125
+ setGeneData(data);
126
+ setStatus(STATUS.SUCCESS);
127
+ setLoadedGeneName(selection);
128
+ });
129
+ }
130
+ else {
131
+ loader.load().catch(e => warn(e, setWarning)).then((payload) => {
132
+ if (!payload)
133
+ return;
134
+ const { data } = payload;
135
+ const { obsIndex, featureIndex, obsFeatureMatrix } = data;
136
+ const expressionDataForSelection = selection.map((sel) => {
137
+ const geneIndex = featureIndex.indexOf(sel);
138
+ const numGenes = featureIndex.length;
139
+ const numCells = obsIndex.length;
140
+ const expressionData = new Float32Array(numCells);
141
+ for (let cellIndex = 0; cellIndex < numCells; cellIndex += 1) {
142
+ expressionData[cellIndex] = obsFeatureMatrix.data[cellIndex * numGenes + geneIndex];
143
+ }
144
+ return expressionData;
145
+ });
146
+ setGeneData(expressionDataForSelection);
147
+ setStatus(STATUS.SUCCESS);
148
+ setLoadedGeneName(selection);
149
+ });
150
+ }
151
+ }
152
+ else {
153
+ setGeneData(null);
154
+ setLoadedGeneName(null);
155
+ if (isRequired) {
156
+ warn(new LoaderNotFoundError(loaders, dataset, DataType.OBS_FEATURE_MATRIX, matchOn), setWarning);
157
+ setStatus(STATUS.ERROR);
158
+ }
159
+ else {
160
+ setStatus(STATUS.SUCCESS);
161
+ }
162
+ }
163
+ // eslint-disable-next-line react-hooks/exhaustive-deps
164
+ }, [loader, selection]);
165
+ return [geneData, loadedGeneName, status];
166
+ }
167
+ /**
168
+ * Get the attributes for the expression matrix data type loader,
169
+ * i.e names of cells and genes.
170
+ * Throw warnings if the data is marked as required.
171
+ * Subscribe to loader updates. Should not be used in conjunction (called in the same component)
172
+ * with useExpressionMatrixData.
173
+ * @param {object} loaders The object mapping
174
+ * datasets and data types to loader instances.
175
+ * @param {string} dataset The key for a dataset,
176
+ * used to identify which loader to use.
177
+ * @param {function} addUrl A function to call to update
178
+ * the URL list.
179
+ * @param {boolean} isRequired Should a warning be thrown if
180
+ * loading is unsuccessful?
181
+ * @returns {object} [attrs] { rows, cols } object containing cell and gene names.
182
+ */
183
+ export function useObsFeatureMatrixIndices(loaders, dataset, addUrl, isRequired, matchOn) {
184
+ const [data, setData] = useState({});
185
+ const [status, setStatus] = useState(STATUS.LOADING);
186
+ const setWarning = useSetWarning();
187
+ const loader = useMatchingLoader(loaders, dataset, DataType.OBS_FEATURE_MATRIX, matchOn);
188
+ useEffect(() => {
189
+ if (loader) {
190
+ setStatus(STATUS.LOADING);
191
+ const implementsLoadAttrs = typeof loader.loadAttrs === 'function';
192
+ if (implementsLoadAttrs) {
193
+ loader.loadAttrs().catch(e => warn(e, setWarning)).then((payload) => {
194
+ if (!payload)
195
+ return;
196
+ const { data: payloadData, url } = payload;
197
+ setData({
198
+ obsIndex: payloadData.rows,
199
+ featureIndex: payloadData.cols,
200
+ });
201
+ addUrl(url, DataType.OBS_FEATURE_MATRIX);
202
+ setStatus(STATUS.SUCCESS);
203
+ });
204
+ }
205
+ else {
206
+ loader.load().catch(e => warn(e, setWarning)).then((payload) => {
207
+ if (!payload)
208
+ return;
209
+ const { data: payloadData, url } = payload;
210
+ setData({
211
+ obsIndex: payloadData.obsIndex,
212
+ featureIndex: payloadData.featureIndex,
213
+ });
214
+ addUrl(url, DataType.OBS_FEATURE_MATRIX);
215
+ setStatus(STATUS.SUCCESS);
216
+ });
217
+ }
218
+ }
219
+ else {
220
+ setData({});
221
+ if (isRequired) {
222
+ warn(new LoaderNotFoundError(loaders, dataset, DataType.OBS_FEATURE_MATRIX, matchOn), setWarning);
223
+ setStatus(STATUS.ERROR);
224
+ }
225
+ else {
226
+ setStatus(STATUS.SUCCESS);
227
+ }
228
+ }
229
+ // eslint-disable-next-line react-hooks/exhaustive-deps
230
+ }, [loader]);
231
+ return [data, status];
232
+ }
233
+ export function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset, addUrl) {
234
+ const obsLabelsTypes = useMultiCoordinationValues(CoordinationType.OBS_LABELS_TYPE, coordinationScopes);
235
+ const obsLabelsMatchOnObj = useMemo(() => fromEntries(Object.entries(obsLabelsTypes).map(([scope, obsLabelsType]) => ([
236
+ scope,
237
+ { obsLabelsType, obsType },
238
+ ]))), [obsLabelsTypes, obsType]);
239
+ const [obsLabelsData, obsLabelsDataStatus] = useDataTypeMulti(DataType.OBS_LABELS, loaders, dataset, addUrl, false, {}, {}, obsLabelsMatchOnObj);
240
+ return [obsLabelsTypes, obsLabelsData, obsLabelsDataStatus];
241
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A loader error ancestor class containing a default constructor
3
+ * and a stub for the required warnInConsole() method.
4
+ */
5
+ export default class AbstractLoaderError {
6
+ constructor(message: any);
7
+ message: any;
8
+ warnInConsole(): void;
9
+ }
10
+ //# sourceMappingURL=AbstractLoaderError.d.ts.map