@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.
Files changed (277) hide show
  1. package/dist/index.js +41348 -18
  2. package/dist-tsc/CallbackPublisher.d.ts +18 -0
  3. package/dist-tsc/CallbackPublisher.d.ts.map +1 -0
  4. package/{dist → dist-tsc}/CallbackPublisher.js +6 -12
  5. package/dist-tsc/LoadingIndicator.d.ts +2 -0
  6. package/dist-tsc/LoadingIndicator.d.ts.map +1 -0
  7. package/{dist → dist-tsc}/LoadingIndicator.js +1 -2
  8. package/dist-tsc/TitleInfo.d.ts +2 -0
  9. package/dist-tsc/TitleInfo.d.ts.map +1 -0
  10. package/{dist → dist-tsc}/TitleInfo.js +6 -83
  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 → dist-tsc}/VitessceGrid.js +14 -13
  17. package/dist-tsc/VitessceGrid.test.d.ts +2 -0
  18. package/dist-tsc/VitessceGrid.test.d.ts.map +1 -0
  19. package/{dist → dist-tsc}/VitessceGrid.test.js +8 -4
  20. package/dist-tsc/Warning.d.ts +2 -0
  21. package/dist-tsc/Warning.d.ts.map +1 -0
  22. package/{dist → dist-tsc}/Warning.js +2 -2
  23. package/dist-tsc/classNames.d.ts +8 -0
  24. package/dist-tsc/classNames.d.ts.map +1 -0
  25. package/dist-tsc/data/AbstractLoader.d.ts +22 -0
  26. package/dist-tsc/data/AbstractLoader.d.ts.map +1 -0
  27. package/dist-tsc/data/AbstractLoader.js +18 -0
  28. package/dist-tsc/data/AbstractTwoStepLoader.d.ts +6 -0
  29. package/dist-tsc/data/AbstractTwoStepLoader.d.ts.map +1 -0
  30. package/{dist → dist-tsc}/data/AbstractTwoStepLoader.js +1 -1
  31. package/dist-tsc/data/LoaderResult.d.ts +7 -0
  32. package/dist-tsc/data/LoaderResult.d.ts.map +1 -0
  33. package/dist-tsc/data/index.d.ts +4 -0
  34. package/dist-tsc/data/index.d.ts.map +1 -0
  35. package/dist-tsc/data/index.js +3 -0
  36. package/dist-tsc/data/loader-registry.d.ts +9 -0
  37. package/dist-tsc/data/loader-registry.d.ts.map +1 -0
  38. package/dist-tsc/data/loader-registry.js +27 -0
  39. package/dist-tsc/data-hook-utils.d.ts +69 -0
  40. package/dist-tsc/data-hook-utils.d.ts.map +1 -0
  41. package/{dist → dist-tsc}/data-hook-utils.js +4 -6
  42. package/dist-tsc/data-hooks.d.ts +77 -0
  43. package/dist-tsc/data-hooks.d.ts.map +1 -0
  44. package/{dist → dist-tsc}/data-hooks.js +4 -4
  45. package/dist-tsc/errors/AbstractLoaderError.d.ts +10 -0
  46. package/dist-tsc/errors/AbstractLoaderError.d.ts.map +1 -0
  47. package/dist-tsc/errors/DataSourceFetchError.d.ts +8 -0
  48. package/dist-tsc/errors/DataSourceFetchError.d.ts.map +1 -0
  49. package/{dist → dist-tsc}/errors/DataSourceFetchError.js +1 -1
  50. package/dist-tsc/errors/DatasetNotFoundError.d.ts +6 -0
  51. package/dist-tsc/errors/DatasetNotFoundError.d.ts.map +1 -0
  52. package/{dist → dist-tsc}/errors/DatasetNotFoundError.js +1 -1
  53. package/dist-tsc/errors/LoaderNotFoundError.d.ts +10 -0
  54. package/dist-tsc/errors/LoaderNotFoundError.d.ts.map +1 -0
  55. package/{dist → dist-tsc}/errors/LoaderNotFoundError.js +1 -1
  56. package/dist-tsc/errors/LoaderValidationError.d.ts +10 -0
  57. package/dist-tsc/errors/LoaderValidationError.d.ts.map +1 -0
  58. package/{dist → dist-tsc}/errors/LoaderValidationError.js +1 -1
  59. package/dist-tsc/errors/index.d.ts +6 -0
  60. package/dist-tsc/errors/index.d.ts.map +1 -0
  61. package/{dist → dist-tsc}/errors/index.js +5 -6
  62. package/dist-tsc/hooks.d.ts +80 -0
  63. package/dist-tsc/hooks.d.ts.map +1 -0
  64. package/{dist → dist-tsc}/hooks.js +60 -4
  65. package/dist-tsc/index.d.ts +11 -0
  66. package/dist-tsc/index.d.ts.map +1 -0
  67. package/dist-tsc/index.js +11 -0
  68. package/dist-tsc/plugins.test.fixtures.d.ts +61 -0
  69. package/dist-tsc/plugins.test.fixtures.d.ts.map +1 -0
  70. package/{dist → dist-tsc}/schemas/config-1.0.16.schema.json +21 -41
  71. package/dist-tsc/schemas/obsSets.schema.d.ts +179 -0
  72. package/dist-tsc/schemas/obsSets.schema.d.ts.map +1 -0
  73. package/dist-tsc/schemas/obsSetsTabular.schema.d.ts +57 -0
  74. package/dist-tsc/schemas/obsSetsTabular.schema.d.ts.map +1 -0
  75. package/dist-tsc/schemas/raster.schema.d.ts +239 -0
  76. package/dist-tsc/schemas/raster.schema.d.ts.map +1 -0
  77. package/dist-tsc/shared-mui/components.d.ts +2 -0
  78. package/dist-tsc/shared-mui/components.d.ts.map +1 -0
  79. package/{dist → dist-tsc}/shared-mui/components.js +2 -8
  80. package/dist-tsc/shared-mui/container.d.ts +2 -0
  81. package/dist-tsc/shared-mui/container.d.ts.map +1 -0
  82. package/{dist → dist-tsc}/shared-mui/container.js +1 -1
  83. package/dist-tsc/shared-mui/styles.d.ts +5 -0
  84. package/dist-tsc/shared-mui/styles.d.ts.map +1 -0
  85. package/{dist → dist-tsc}/shared-mui/styles.js +4 -2
  86. package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts +2 -0
  87. package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts.map +1 -0
  88. package/{dist → dist-tsc}/shared-plot-options/CellColorEncodingOption.js +3 -4
  89. package/dist-tsc/shared-plot-options/OptionSelect.d.ts +2 -0
  90. package/dist-tsc/shared-plot-options/OptionSelect.d.ts.map +1 -0
  91. package/{dist → dist-tsc}/shared-plot-options/OptionSelect.js +2 -2
  92. package/dist-tsc/shared-plot-options/OptionsContainer.d.ts +2 -0
  93. package/dist-tsc/shared-plot-options/OptionsContainer.d.ts.map +1 -0
  94. package/{dist → dist-tsc}/shared-plot-options/OptionsContainer.js +2 -5
  95. package/dist-tsc/shared-plot-options/index.d.ts +5 -0
  96. package/dist-tsc/shared-plot-options/index.d.ts.map +1 -0
  97. package/dist-tsc/shared-plot-options/index.js +4 -0
  98. package/dist-tsc/shared-plot-options/styles.d.ts +2 -0
  99. package/dist-tsc/shared-plot-options/styles.d.ts.map +1 -0
  100. package/{dist → dist-tsc}/shared-plot-options/styles.js +1 -1
  101. package/dist-tsc/state/hooks.d.ts +216 -0
  102. package/dist-tsc/state/hooks.d.ts.map +1 -0
  103. package/{dist → dist-tsc}/state/hooks.js +47 -21
  104. package/dist-tsc/title-styles.d.ts +2 -0
  105. package/dist-tsc/title-styles.d.ts.map +1 -0
  106. package/dist-tsc/title-styles.js +72 -0
  107. package/dist-tsc/view-config-utils.d.ts +30 -0
  108. package/dist-tsc/view-config-utils.d.ts.map +1 -0
  109. package/{dist → dist-tsc}/view-config-utils.js +32 -84
  110. package/dist-tsc/view-config-utils.test.d.ts +2 -0
  111. package/dist-tsc/view-config-utils.test.d.ts.map +1 -0
  112. package/dist-tsc/view-config-utils.test.fixtures.d.ts +1049 -0
  113. package/dist-tsc/view-config-utils.test.fixtures.d.ts.map +1 -0
  114. package/{dist → dist-tsc}/view-config-utils.test.fixtures.js +118 -0
  115. package/dist-tsc/view-config-utils.test.js +209 -0
  116. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts +8 -0
  117. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts.map +1 -0
  118. package/{dist → dist-tsc}/vitessce-grid-layout/VitessceGridLayout.js +47 -28
  119. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts +2 -0
  120. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts.map +1 -0
  121. package/{dist → dist-tsc}/vitessce-grid-layout/VitessceGridLayout.test.js +13 -5
  122. package/dist-tsc/vitessce-grid-layout/index.d.ts +2 -0
  123. package/dist-tsc/vitessce-grid-layout/index.d.ts.map +1 -0
  124. package/dist-tsc/vitessce-grid-layout/index.js +1 -0
  125. package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts +15 -0
  126. package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts.map +1 -0
  127. package/{dist → dist-tsc}/vitessce-grid-layout/layout-utils.js +2 -1
  128. package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts +2 -0
  129. package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts.map +1 -0
  130. package/{dist → dist-tsc}/vitessce-grid-layout/layout-utils.test.js +3 -1
  131. package/dist-tsc/vitessce-grid-utils.d.ts +13 -0
  132. package/dist-tsc/vitessce-grid-utils.d.ts.map +1 -0
  133. package/{dist → dist-tsc}/vitessce-grid-utils.js +15 -14
  134. package/package.json +24 -11
  135. package/src/CallbackPublisher.js +77 -0
  136. package/src/LoadingIndicator.js +33 -0
  137. package/src/TitleInfo.js +167 -0
  138. package/src/VitS.js +202 -0
  139. package/src/VitessceGrid.js +118 -0
  140. package/src/VitessceGrid.test.jsx +57 -0
  141. package/src/Warning.js +62 -0
  142. package/src/classNames.js +8 -0
  143. package/src/data/AbstractLoader.js +23 -0
  144. package/src/data/AbstractTwoStepLoader.js +8 -0
  145. package/src/data/LoaderResult.js +8 -0
  146. package/src/data/index.js +3 -0
  147. package/src/data/loader-registry.js +28 -0
  148. package/src/data-hook-utils.js +195 -0
  149. package/src/data-hooks.js +354 -0
  150. package/src/errors/AbstractLoaderError.js +14 -0
  151. package/src/errors/DataSourceFetchError.js +15 -0
  152. package/src/errors/DatasetNotFoundError.js +23 -0
  153. package/src/errors/LoaderNotFoundError.js +24 -0
  154. package/src/errors/LoaderValidationError.js +23 -0
  155. package/src/errors/index.js +5 -0
  156. package/src/hooks.js +317 -0
  157. package/src/index.js +76 -0
  158. package/src/plugins.test.fixtures.js +78 -0
  159. package/src/schemas/config-0.1.0.schema.json +85 -0
  160. package/src/schemas/config-1.0.0.schema.json +733 -0
  161. package/src/schemas/config-1.0.1.schema.json +909 -0
  162. package/src/schemas/config-1.0.10.schema.json +969 -0
  163. package/src/schemas/config-1.0.11.schema.json +990 -0
  164. package/src/schemas/config-1.0.12.schema.json +997 -0
  165. package/src/schemas/config-1.0.13.schema.json +1013 -0
  166. package/src/schemas/config-1.0.14.schema.json +1048 -0
  167. package/src/schemas/config-1.0.15.schema.json +1048 -0
  168. package/src/schemas/config-1.0.16.schema.json +1089 -0
  169. package/src/schemas/config-1.0.2.schema.json +911 -0
  170. package/src/schemas/config-1.0.3.schema.json +911 -0
  171. package/src/schemas/config-1.0.4.schema.json +949 -0
  172. package/src/schemas/config-1.0.5.schema.json +949 -0
  173. package/src/schemas/config-1.0.6.schema.json +950 -0
  174. package/src/schemas/config-1.0.7.schema.json +950 -0
  175. package/src/schemas/config-1.0.8.schema.json +966 -0
  176. package/src/schemas/config-1.0.9.schema.json +965 -0
  177. package/src/schemas/fixtures/cellSets.good.json +16 -0
  178. package/src/schemas/fixtures/config-1.0.1.bad.json +1 -0
  179. package/src/schemas/fixtures/config-1.0.1.bad.message.json +11 -0
  180. package/src/schemas/fixtures/config-1.0.1.good.json +37 -0
  181. package/src/schemas/fixtures/config-1.0.2.bad.json +1 -0
  182. package/src/schemas/fixtures/config-1.0.2.bad.message.json +11 -0
  183. package/src/schemas/fixtures/config-1.0.2.good.json +38 -0
  184. package/src/schemas/fixtures/config-1.0.3.bad.json +1 -0
  185. package/src/schemas/fixtures/config-1.0.3.bad.message.json +11 -0
  186. package/src/schemas/fixtures/config-1.0.3.good.json +38 -0
  187. package/src/schemas/fixtures/obsSets.bad.json +1 -0
  188. package/src/schemas/fixtures/obsSets.bad.message.json +11 -0
  189. package/src/schemas/fixtures/obsSets.good.json +16 -0
  190. package/src/schemas/fixtures/obsSetsTabular.bad.json +1 -0
  191. package/src/schemas/fixtures/obsSetsTabular.bad.message.json +11 -0
  192. package/src/schemas/fixtures/obsSetsTabular.good.json +26 -0
  193. package/src/schemas/fixtures/raster.bad.json +1 -0
  194. package/src/schemas/fixtures/raster.bad.message.json +11 -0
  195. package/src/schemas/fixtures/raster.good.json +39 -0
  196. package/src/schemas/obsSets.schema.js +195 -0
  197. package/src/schemas/obsSetsTabular.schema.js +39 -0
  198. package/src/schemas/raster.schema.js +121 -0
  199. package/src/schemas/schema-schema.sh +34 -0
  200. package/src/shared-mui/components.js +81 -0
  201. package/src/shared-mui/container.js +212 -0
  202. package/src/shared-mui/styles.js +113 -0
  203. package/src/shared-plot-options/CellColorEncodingOption.js +42 -0
  204. package/src/shared-plot-options/OptionSelect.js +19 -0
  205. package/src/shared-plot-options/OptionsContainer.js +23 -0
  206. package/src/shared-plot-options/index.js +4 -0
  207. package/src/shared-plot-options/styles.js +49 -0
  208. package/src/state/hooks.js +640 -0
  209. package/src/title-styles.js +73 -0
  210. package/src/view-config-utils.js +263 -0
  211. package/src/view-config-utils.test.fixtures.js +893 -0
  212. package/src/view-config-utils.test.jsx +222 -0
  213. package/src/vitessce-grid-layout/VitessceGridLayout.js +179 -0
  214. package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +64 -0
  215. package/src/vitessce-grid-layout/index.js +1 -0
  216. package/src/vitessce-grid-layout/layout-utils.js +76 -0
  217. package/src/vitessce-grid-layout/layout-utils.test.js +167 -0
  218. package/src/vitessce-grid-utils.js +172 -0
  219. package/dist/VitS.js +0 -117
  220. package/dist/Vitessce.integration.test.js +0 -36
  221. package/dist/Vitessce.js +0 -101
  222. package/dist/component-registry.js +0 -16
  223. package/dist/data/AbstractLoader.js +0 -35
  224. package/dist/data/index.js +0 -3
  225. package/dist/data/loader-registry.js +0 -15
  226. package/dist/errors/OptionsValidationError.js +0 -15
  227. package/dist/export-utils.js +0 -70
  228. package/dist/export-utils.test.js +0 -66
  229. package/dist/file-options-schemas-legacy.js +0 -136
  230. package/dist/file-options-schemas-legacy.test.js +0 -126
  231. package/dist/file-options-schemas.js +0 -322
  232. package/dist/file-options-schemas.test.js +0 -23
  233. package/dist/joint-file-types-legacy.js +0 -278
  234. package/dist/joint-file-types-legacy.test.js +0 -400
  235. package/dist/joint-file-types.js +0 -148
  236. package/dist/joint-file-types.test.js +0 -139
  237. package/dist/loader-registry.js +0 -98
  238. package/dist/plugins.js +0 -154
  239. package/dist/plugins.test.js +0 -30
  240. package/dist/schemas/PrettyJsonSchema.js +0 -34
  241. package/dist/schemas/config-1.0.15.schema.test.js +0 -22
  242. package/dist/schemas/config-1.0.16.schema.test.js +0 -22
  243. package/dist/schemas/obs-sets-tabular.schema.js +0 -37
  244. package/dist/schemas/obs-sets.schema.js +0 -194
  245. package/dist/schemas/schema.test-old.js +0 -50
  246. package/dist/schemas/schema.test.js +0 -46
  247. package/dist/schemas-extra.js +0 -3
  248. package/dist/schemas.js +0 -4
  249. package/dist/shared-plot-options/index.js +0 -4
  250. package/dist/view-config-upgraders.js +0 -525
  251. package/dist/view-config-utils.test.js +0 -66
  252. package/dist/view-config-versions.js +0 -47
  253. package/dist/vitessce-grid-layout/index.js +0 -1
  254. /package/{dist → dist-tsc}/classNames.js +0 -0
  255. /package/{dist → dist-tsc}/data/LoaderResult.js +0 -0
  256. /package/{dist → dist-tsc}/errors/AbstractLoaderError.js +0 -0
  257. /package/{dist → dist-tsc}/plugins.test.fixtures.js +0 -0
  258. /package/{dist → dist-tsc}/schemas/config-0.1.0.schema.json +0 -0
  259. /package/{dist → dist-tsc}/schemas/config-1.0.0.schema.json +0 -0
  260. /package/{dist → dist-tsc}/schemas/config-1.0.1.schema.json +0 -0
  261. /package/{dist → dist-tsc}/schemas/config-1.0.10.schema.json +0 -0
  262. /package/{dist → dist-tsc}/schemas/config-1.0.11.schema.json +0 -0
  263. /package/{dist → dist-tsc}/schemas/config-1.0.12.schema.json +0 -0
  264. /package/{dist → dist-tsc}/schemas/config-1.0.13.schema.json +0 -0
  265. /package/{dist → dist-tsc}/schemas/config-1.0.14.schema.json +0 -0
  266. /package/{dist → dist-tsc}/schemas/config-1.0.15.schema.json +0 -0
  267. /package/{dist → dist-tsc}/schemas/config-1.0.2.schema.json +0 -0
  268. /package/{dist → dist-tsc}/schemas/config-1.0.3.schema.json +0 -0
  269. /package/{dist → dist-tsc}/schemas/config-1.0.4.schema.json +0 -0
  270. /package/{dist → dist-tsc}/schemas/config-1.0.5.schema.json +0 -0
  271. /package/{dist → dist-tsc}/schemas/config-1.0.6.schema.json +0 -0
  272. /package/{dist → dist-tsc}/schemas/config-1.0.7.schema.json +0 -0
  273. /package/{dist → dist-tsc}/schemas/config-1.0.8.schema.json +0 -0
  274. /package/{dist → dist-tsc}/schemas/config-1.0.9.schema.json +0 -0
  275. /package/{dist → dist-tsc}/schemas/obsSets.schema.js +0 -0
  276. /package/{dist → dist-tsc}/schemas/obsSetsTabular.schema.js +0 -0
  277. /package/{dist → dist-tsc}/schemas/raster.schema.js +0 -0
@@ -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"}
@@ -1,10 +1,8 @@
1
1
  import { useState, useEffect } from 'react';
2
- import equal from 'fast-deep-equal';
3
2
  import { capitalize } from '@vitessce/utils';
4
3
  import { STATUS } from '@vitessce/constants-internal';
5
- import { useMatchingLoader, useMatchingLoaders, useSetWarning } from './state/hooks';
6
- import { AbstractLoaderError, LoaderNotFoundError, } from './errors/index';
7
- import { getDefaultCoordinationValues } from './plugins';
4
+ import { useMatchingLoader, useMatchingLoaders, useSetWarning } from './state/hooks.js';
5
+ import { AbstractLoaderError, LoaderNotFoundError, } from './errors/index.js';
8
6
  /**
9
7
  * Warn via publishing to the console
10
8
  * and to the global warning store.
@@ -33,12 +31,12 @@ export function initCoordinationSpace(values, setters, initialValues) {
33
31
  if (!values || !setters) {
34
32
  return;
35
33
  }
36
- const defaultCoordinationValues = getDefaultCoordinationValues();
37
34
  Object.entries(values).forEach(([coordinationType, value]) => {
38
35
  const setterName = `set${capitalize(coordinationType)}`;
39
36
  const setterFunc = setters[setterName];
40
37
  const initialValue = initialValues && initialValues[coordinationType];
41
- const shouldInit = equal(initialValue, defaultCoordinationValues[coordinationType]);
38
+ // Interpret null as "uninitialized" and therefore needing initialization.
39
+ const shouldInit = initialValue === null;
42
40
  if (shouldInit && setterFunc) {
43
41
  setterFunc(value);
44
42
  }
@@ -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"}
@@ -1,9 +1,9 @@
1
1
  import { useState, useEffect, useMemo } from 'react';
2
2
  import { CoordinationType, DataType, STATUS } from '@vitessce/constants-internal';
3
3
  import { fromEntries } from '@vitessce/utils';
4
- import { useMatchingLoader, useMultiCoordinationValues, useSetWarning } from './state/hooks';
5
- import { LoaderNotFoundError, } from './errors/index';
6
- import { warn, useDataType, useDataTypeMulti, } from './data-hook-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
7
  /**
8
8
  * Get the dataset description string.
9
9
  * @param {object} loaders The object mapping
@@ -137,7 +137,7 @@ export function useFeatureSelection(loaders, dataset, isRequired, selection, mat
137
137
  const geneIndex = featureIndex.indexOf(sel);
138
138
  const numGenes = featureIndex.length;
139
139
  const numCells = obsIndex.length;
140
- const expressionData = new Uint8Array(numCells);
140
+ const expressionData = new Float32Array(numCells);
141
141
  for (let cellIndex = 0; cellIndex < numCells; cellIndex += 1) {
142
142
  expressionData[cellIndex] = obsFeatureMatrix.data[cellIndex * numGenes + geneIndex];
143
143
  }
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractLoaderError.d.ts","sourceRoot":"","sources":["../../src/errors/AbstractLoaderError.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACE,0BAEC;IADC,aAAsB;IAIxB,sBAEC;CACF"}
@@ -0,0 +1,8 @@
1
+ export default class DataSourceFetchError extends AbstractLoaderError {
2
+ constructor(source: any, url: any, headers: any);
3
+ source: any;
4
+ url: any;
5
+ headers: any;
6
+ }
7
+ import AbstractLoaderError from "./AbstractLoaderError.js";
8
+ //# sourceMappingURL=DataSourceFetchError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceFetchError.d.ts","sourceRoot":"","sources":["../../src/errors/DataSourceFetchError.js"],"names":[],"mappings":"AAEA;IACE,iDAKC;IAHC,YAAoB;IACpB,SAAc;IACd,aAAsB;CAOzB"}
@@ -1,4 +1,4 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
1
+ import AbstractLoaderError from './AbstractLoaderError.js';
2
2
  export default class DataSourceFetchError extends AbstractLoaderError {
3
3
  constructor(source, url, headers) {
4
4
  super(`${source} Error HTTP Status fetching from ${url}`);
@@ -0,0 +1,6 @@
1
+ export default class DatasetNotFoundError extends AbstractLoaderError {
2
+ name: string;
3
+ datasetUid: any;
4
+ }
5
+ import AbstractLoaderError from "./AbstractLoaderError.js";
6
+ //# sourceMappingURL=DatasetNotFoundError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatasetNotFoundError.d.ts","sourceRoot":"","sources":["../../src/errors/DatasetNotFoundError.js"],"names":[],"mappings":"AAEA;IAGI,aAAkC;IAElC,gBAA4B;CAe/B"}
@@ -1,4 +1,4 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
1
+ import AbstractLoaderError from './AbstractLoaderError.js';
2
2
  export default class DatasetNotFoundError extends AbstractLoaderError {
3
3
  constructor(datasetUid) {
4
4
  super(`Error finding dataset for ${datasetUid}. Please check that at least one dataset exists in the view config.`);
@@ -0,0 +1,10 @@
1
+ export default class LoaderNotFoundError extends AbstractLoaderError {
2
+ constructor(loaders: any, dataset: any, fileType: any, viewCoordinationValues: any);
3
+ name: string;
4
+ loaders: any;
5
+ dataset: any;
6
+ fileType: any;
7
+ viewCoordinationValues: any;
8
+ }
9
+ import AbstractLoaderError from "./AbstractLoaderError.js";
10
+ //# sourceMappingURL=LoaderNotFoundError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoaderNotFoundError.d.ts","sourceRoot":"","sources":["../../src/errors/LoaderNotFoundError.js"],"names":[],"mappings":"AAEA;IACE,oFAQC;IANC,aAAiC;IAEjC,aAAsB;IACtB,aAAsB;IACtB,cAAwB;IACxB,4BAAoD;CAavD"}
@@ -1,4 +1,4 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
1
+ import AbstractLoaderError from './AbstractLoaderError.js';
2
2
  export default class LoaderNotFoundError extends AbstractLoaderError {
3
3
  constructor(loaders, dataset, fileType, viewCoordinationValues) {
4
4
  super(`Error: unable to find matching ${fileType} file in dataset ${dataset}.`);
@@ -0,0 +1,10 @@
1
+ export default class LoaderValidationError extends AbstractLoaderError {
2
+ constructor(datasetType: any, datasetFileType: any, datasetUrl: any, reason: any);
3
+ name: string;
4
+ datasetType: any;
5
+ datasetFileType: any;
6
+ datasetUrl: any;
7
+ reason: any;
8
+ }
9
+ import AbstractLoaderError from "./AbstractLoaderError.js";
10
+ //# sourceMappingURL=LoaderValidationError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoaderValidationError.d.ts","sourceRoot":"","sources":["../../src/errors/LoaderValidationError.js"],"names":[],"mappings":"AAEA;IACE,kFAQC;IANC,aAAmC;IAEnC,iBAA8B;IAC9B,qBAAsC;IACtC,gBAA4B;IAC5B,YAAoB;CAYvB"}
@@ -1,4 +1,4 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
1
+ import AbstractLoaderError from './AbstractLoaderError.js';
2
2
  export default class LoaderValidationError extends AbstractLoaderError {
3
3
  constructor(datasetType, datasetFileType, datasetUrl, reason) {
4
4
  super(`Error while validating ${datasetType}.`);
@@ -0,0 +1,6 @@
1
+ export { default as AbstractLoaderError } from "./AbstractLoaderError.js";
2
+ export { default as LoaderValidationError } from "./LoaderValidationError.js";
3
+ export { default as LoaderNotFoundError } from "./LoaderNotFoundError.js";
4
+ export { default as DatasetNotFoundError } from "./DatasetNotFoundError.js";
5
+ export { default as DataSourceFetchError } from "./DataSourceFetchError.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.js"],"names":[],"mappings":""}
@@ -1,6 +1,5 @@
1
- export { default as AbstractLoaderError } from './AbstractLoaderError';
2
- export { default as LoaderValidationError } from './LoaderValidationError';
3
- export { default as OptionsValidationError } from './OptionsValidationError';
4
- export { default as LoaderNotFoundError } from './LoaderNotFoundError';
5
- export { default as DatasetNotFoundError } from './DatasetNotFoundError';
6
- export { default as DataSourceFetchError } from './DataSourceFetchError';
1
+ export { default as AbstractLoaderError } from './AbstractLoaderError.js';
2
+ export { default as LoaderValidationError } from './LoaderValidationError.js';
3
+ export { default as LoaderNotFoundError } from './LoaderNotFoundError.js';
4
+ export { default as DatasetNotFoundError } from './DatasetNotFoundError.js';
5
+ export { default as DataSourceFetchError } from './DataSourceFetchError.js';
@@ -0,0 +1,80 @@
1
+ export function useVitessceContainer(ref: any): any;
2
+ /**
3
+ * Custom hook, gets the full window dimensions.
4
+ * @returns {array} `[width, height]` where width and height
5
+ * are numbers.
6
+ */
7
+ export function useWindowDimensions(): array;
8
+ /**
9
+ * Custom hook, subscribes to GRID_RESIZE and window resize events.
10
+ * @returns {array} `[width, height, containerRef]` where width and height
11
+ * are numbers and containerRef is a React ref.
12
+ */
13
+ export function useGridItemSize(): array;
14
+ /**
15
+ * Custom hook, subscribes to GRID_RESIZE and window resize events.
16
+ * @returns {array} `[width, height, deckRef]` where width and height
17
+ * are numbers and deckRef is a React ref to be used with
18
+ * a <DeckGL/> element (or a forwardRef to one).
19
+ */
20
+ export function useDeckCanvasSize(): array;
21
+ /**
22
+ * This hook handles a boolean isReady value,
23
+ * which only returns true once every item in the
24
+ * input list has been marked as "ready".
25
+ * @param {string[]} statusValues The items to wait on.
26
+ * @returns {boolean} Whether the status values are all success.
27
+ */
28
+ export function useReady(statusValues: string[]): boolean;
29
+ /**
30
+ * This hook helps manage a list of URLs.
31
+ * @param {object} loaders The loaders dependency.
32
+ * @param {string} dataset The dataset UID dependency.
33
+ * @returns {array} An array
34
+ * [urls, addUrl]
35
+ * where urls is the array of URL objects,
36
+ * and addUrl is a function for adding a URL to the array.
37
+ */
38
+ export function useUrls(loaders: object, dataset: string): array;
39
+ /**
40
+ * Custom hook, subscribes to the width and height of the closest .vitessce-container
41
+ * element and updates upon window resize events.
42
+ * @param {Ref} ref A React ref object within the `.vitessce-container`.
43
+ * @returns {array} `[width, height]` where width and height
44
+ * are numbers.
45
+ */
46
+ export function useClosestVitessceContainerSize(ref: Ref): array;
47
+ /**
48
+ * Normalize an obsFeatureMatrix to a Uint8Array.
49
+ * @param {object} params
50
+ * @param {object} params.obsFeatureMatrix The obsFeatureMatrix
51
+ * returned by the useObsFeatureMatrix hook.
52
+ * @returns {array} A tuple [obsFeatureMatrix, dataExtent]
53
+ * where obsFeatureMatrix
54
+ * is a Uint8Array with the same shape as
55
+ * params.obsFeatureMatrix.data, and dataExtent is the
56
+ * [min, max] of the original data.
57
+ */
58
+ export function useUint8ObsFeatureMatrix({ obsFeatureMatrix }: {
59
+ obsFeatureMatrix: object;
60
+ }): array;
61
+ /**
62
+ * Normalize a feature selection (data for selected
63
+ * columns of an obsFeatureMatrix) to a Uint8Array.
64
+ * @param {array|null} expressionData The expressionData
65
+ * returned by the useFeatureSelection hook,
66
+ * where each element corresponds to an
67
+ * array of values for a selected feature.
68
+ * @returns {array} A tuple [normData, extents] where
69
+ * normData is an array of Uint8Arrays (or null), and extents is
70
+ * an array of [min, max] values for each feature (or null).
71
+ */
72
+ export function useUint8FeatureSelection(expressionData: array | null): array;
73
+ export function useExpressionValueGetter({ instanceObsIndex, matrixObsIndex, expressionData }: {
74
+ instanceObsIndex: any;
75
+ matrixObsIndex: any;
76
+ expressionData: any;
77
+ }): any;
78
+ export function useGetObsMembership(obsSetsMembership: any): any;
79
+ export function useGetObsInfo(obsType: any, obsLabelsTypes: any, obsLabelsData: any, obsSetsMembership: any): any;
80
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.js"],"names":[],"mappings":"AAiBA,oDAOC;AAED;;;;GAIG;AACH,6CAgBC;AAED;;;;GAIG;AACH,yCAiCC;AAED;;;;;GAKG;AACH,2CAiCC;AAED;;;;;;GAMG;AACH,uCAHW,MAAM,EAAE,GACN,OAAO,CAOnB;AAED;;;;;;;;GAQG;AACH,iCAPW,MAAM,WACN,MAAM,SAoBhB;AAED;;;;;;GAMG;AACH,iEAuBC;AAED;;;;;;;;;;GAUG;AACH;IAR0B,gBAAgB,EAA/B,MAAM;UAqBhB;AAED;;;;;;;;;;GAUG;AACH,yDARW,QAAM,IAAI,SAuBpB;AAED;;;;QA2BC;AAED,iEAOC;AAED,kHAuBC"}
@@ -1,9 +1,9 @@
1
1
  import { useRef, useState, useEffect, useCallback, useMemo, } from 'react';
2
- import debounce from 'lodash/debounce';
3
- import every from 'lodash/every';
2
+ import { debounce, every } from 'lodash-es';
3
+ import { extent } from 'd3-array';
4
4
  import { capitalize, fromEntries } from '@vitessce/utils';
5
- import { useGridResize, useEmitGridResize } from './state/hooks';
6
- import { VITESSCE_CONTAINER } from './classNames';
5
+ import { useGridResize, useEmitGridResize } from './state/hooks.js';
6
+ import { VITESSCE_CONTAINER } from './classNames.js';
7
7
  function getWindowDimensions() {
8
8
  const { innerWidth: width, innerHeight: height } = window;
9
9
  return {
@@ -165,6 +165,54 @@ export function useClosestVitessceContainerSize(ref) {
165
165
  }, [ref]);
166
166
  return [width, height];
167
167
  }
168
+ /**
169
+ * Normalize an obsFeatureMatrix to a Uint8Array.
170
+ * @param {object} params
171
+ * @param {object} params.obsFeatureMatrix The obsFeatureMatrix
172
+ * returned by the useObsFeatureMatrix hook.
173
+ * @returns {array} A tuple [obsFeatureMatrix, dataExtent]
174
+ * where obsFeatureMatrix
175
+ * is a Uint8Array with the same shape as
176
+ * params.obsFeatureMatrix.data, and dataExtent is the
177
+ * [min, max] of the original data.
178
+ */
179
+ export function useUint8ObsFeatureMatrix({ obsFeatureMatrix }) {
180
+ return useMemo(() => {
181
+ if (obsFeatureMatrix && obsFeatureMatrix.data) {
182
+ const dataExtent = extent(obsFeatureMatrix.data);
183
+ const [min, max] = dataExtent;
184
+ const ratio = 255 / (max - min);
185
+ const data = new Uint8Array(obsFeatureMatrix.data.map(i => Math.floor((i - min) * ratio)));
186
+ return [{ data }, dataExtent];
187
+ }
188
+ return [null, null];
189
+ }, [obsFeatureMatrix]);
190
+ }
191
+ /**
192
+ * Normalize a feature selection (data for selected
193
+ * columns of an obsFeatureMatrix) to a Uint8Array.
194
+ * @param {array|null} expressionData The expressionData
195
+ * returned by the useFeatureSelection hook,
196
+ * where each element corresponds to an
197
+ * array of values for a selected feature.
198
+ * @returns {array} A tuple [normData, extents] where
199
+ * normData is an array of Uint8Arrays (or null), and extents is
200
+ * an array of [min, max] values for each feature (or null).
201
+ */
202
+ export function useUint8FeatureSelection(expressionData) {
203
+ return useMemo(() => {
204
+ if (expressionData && expressionData[0]) {
205
+ const extents = expressionData.map(arr => extent(arr));
206
+ const normData = expressionData.map((arr, i) => {
207
+ const [min, max] = extents[i];
208
+ const ratio = 255 / (max - min);
209
+ return new Uint8Array(arr.map(j => Math.floor((j - min) * ratio)));
210
+ });
211
+ return [normData, extents];
212
+ }
213
+ return [null, null];
214
+ }, [expressionData]);
215
+ }
168
216
  export function useExpressionValueGetter({ instanceObsIndex, matrixObsIndex, expressionData }) {
169
217
  // Get a mapping from cell ID to row index in the gene expression matrix.
170
218
  // Since the two obsIndices (instanceObsIndex = the obsIndex from obsEmbedding)
@@ -190,6 +238,14 @@ export function useExpressionValueGetter({ instanceObsIndex, matrixObsIndex, exp
190
238
  }, [toMatrixIndexMap, expressionData]);
191
239
  return getExpressionValue;
192
240
  }
241
+ export function useGetObsMembership(obsSetsMembership) {
242
+ return useCallback((obsId) => {
243
+ if (obsId) {
244
+ return obsSetsMembership?.get(obsId) || [];
245
+ }
246
+ return [];
247
+ }, [obsSetsMembership]);
248
+ }
193
249
  export function useGetObsInfo(obsType, obsLabelsTypes, obsLabelsData, obsSetsMembership) {
194
250
  return useCallback((obsId) => {
195
251
  if (obsId) {
@@ -0,0 +1,11 @@
1
+ export { VitS } from "./VitS.js";
2
+ export { TitleInfo } from "./TitleInfo.js";
3
+ export { PopperMenu } from "./shared-mui/components.js";
4
+ export { useHasLoader } from "./data-hook-utils.js";
5
+ export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize } from "./hooks.js";
6
+ export { useCoordination, useComplexCoordination, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout } from "./state/hooks.js";
7
+ export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData } from "./data-hooks.js";
8
+ export { AbstractLoader, AbstractTwoStepLoader, LoaderResult } from "./data/index.js";
9
+ export { AbstractLoaderError, DatasetNotFoundError, LoaderNotFoundError, LoaderValidationError, DataSourceFetchError } from "./errors/index.js";
10
+ export { CellColorEncodingOption, OptionsContainer, OptionSelect, usePlotOptionsStyles } from "./shared-plot-options/index.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ export { VitS } from './VitS.js';
2
+ export { TitleInfo } from './TitleInfo.js';
3
+ export { PopperMenu } from './shared-mui/components.js';
4
+ // For plugin view types:
5
+ export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize, } from './hooks.js';
6
+ export { useCoordination, useComplexCoordination, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout, } from './state/hooks.js';
7
+ export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData, } from './data-hooks.js';
8
+ export { useHasLoader, } from './data-hook-utils.js';
9
+ export { AbstractLoader, AbstractTwoStepLoader, LoaderResult, } from './data/index.js';
10
+ export { AbstractLoaderError, DatasetNotFoundError, LoaderNotFoundError, LoaderValidationError, DataSourceFetchError, } from './errors/index.js';
11
+ export { CellColorEncodingOption, OptionsContainer, OptionSelect, usePlotOptionsStyles, } from './shared-plot-options/index.js';
@@ -0,0 +1,61 @@
1
+ export function pluginExpandAnnDataConvenience(fileDef: any): {
2
+ fileType: string;
3
+ url: any;
4
+ options: any;
5
+ }[];
6
+ export namespace convenienceFileDefsCollapsed {
7
+ const version: string;
8
+ const name: string;
9
+ const description: string;
10
+ const initStrategy: string;
11
+ const datasets: {
12
+ files: {
13
+ fileType: string;
14
+ url: string;
15
+ options: {
16
+ cells: {
17
+ xy: string;
18
+ };
19
+ cellSets: {
20
+ groupName: string;
21
+ setName: string;
22
+ }[];
23
+ };
24
+ }[];
25
+ name: string;
26
+ uid: string;
27
+ }[];
28
+ const layout: never[];
29
+ }
30
+ export namespace convenienceFileDefsExpanded {
31
+ const version_1: string;
32
+ export { version_1 as version };
33
+ const name_1: string;
34
+ export { name_1 as name };
35
+ const description_1: string;
36
+ export { description_1 as description };
37
+ const initStrategy_1: string;
38
+ export { initStrategy_1 as initStrategy };
39
+ const datasets_1: {
40
+ files: ({
41
+ fileType: string;
42
+ url: string;
43
+ options: {
44
+ xy: string;
45
+ };
46
+ } | {
47
+ fileType: string;
48
+ url: string;
49
+ options: {
50
+ groupName: string;
51
+ setName: string;
52
+ }[];
53
+ })[];
54
+ name: string;
55
+ uid: string;
56
+ }[];
57
+ export { datasets_1 as datasets };
58
+ const layout_1: never[];
59
+ export { layout_1 as layout };
60
+ }
61
+ //# sourceMappingURL=plugins.test.fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.test.fixtures.d.ts","sourceRoot":"","sources":["../src/plugins.test.fixtures.js"],"names":[],"mappings":"AA+BA;;;;IAaC"}