@haniffalab/cherita-react 1.2.0-dev.2025-04-09.0f69cbd1 → 1.2.0-dev.2025-04-28.623a001f

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.
@@ -27,6 +27,7 @@ function FullPage(_ref) {
27
27
  let {
28
28
  children,
29
29
  varMode = _constants.SELECTION_MODES.SINGLE,
30
+ searchDiseases = false,
30
31
  ...props
31
32
  } = _ref;
32
33
  const appRef = (0, _react.useRef)();
@@ -106,7 +107,7 @@ function FullPage(_ref) {
106
107
  }, /*#__PURE__*/_react.default.createElement("div", {
107
108
  className: "sidebar-features modern-scrollbars"
108
109
  }, /*#__PURE__*/_react.default.createElement(_SearchBar.SearchBar, {
109
- searchDiseases: true,
110
+ searchDiseases: searchDiseases,
110
111
  searchVar: true
111
112
  }), /*#__PURE__*/_react.default.createElement(_VarList.VarNamesList, {
112
113
  mode: varMode
@@ -25,6 +25,7 @@ function FullPage(_ref) {
25
25
  let {
26
26
  children,
27
27
  varMode = _constants.SELECTION_MODES.SINGLE,
28
+ searchDiseases = false,
28
29
  ...props
29
30
  } = _ref;
30
31
  const appRef = (0, _react.useRef)();
@@ -120,7 +121,7 @@ function FullPage(_ref) {
120
121
  })), /*#__PURE__*/_react.default.createElement("div", {
121
122
  className: "sidebar-features modern-scrollbars"
122
123
  }, /*#__PURE__*/_react.default.createElement(_SearchBar.SearchBar, {
123
- searchDiseases: true,
124
+ searchDiseases: searchDiseases,
124
125
  searchVar: true
125
126
  }), /*#__PURE__*/_react.default.createElement(_VarList.VarNamesList, {
126
127
  mode: varMode
@@ -13,6 +13,8 @@ var _editModes = require("@nebula.gl/edit-modes");
13
13
  var _layers2 = require("@nebula.gl/layers");
14
14
  var _lodash = _interopRequireDefault(require("lodash"));
15
15
  var _reactBootstrap = require("react-bootstrap");
16
+ var _SpatialControls = require("./SpatialControls");
17
+ var _Toolbox = require("./Toolbox");
16
18
  var _constants = require("../../constants/constants");
17
19
  var _DatasetContext = require("../../context/DatasetContext");
18
20
  var _FilterContext = require("../../context/FilterContext");
@@ -23,8 +25,6 @@ var _Legend = require("../../utils/Legend");
23
25
  var _LoadingIndicators = require("../../utils/LoadingIndicators");
24
26
  var _string = require("../../utils/string");
25
27
  var _zarrData = require("../../utils/zarrData");
26
- var _SpatialControls = require("./SpatialControls");
27
- var _Toolbox = require("./Toolbox");
28
28
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
29
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
30
30
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -45,11 +45,11 @@ const fetchDataFromZarr = async (url, path, s, opts) => {
45
45
  const useZarr = function (_ref2) {
46
46
  let {
47
47
  url,
48
- path
48
+ path,
49
+ s = null
49
50
  } = _ref2;
50
- let s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
51
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : GET_OPTIONS;
52
- let opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
51
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GET_OPTIONS;
52
+ let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
53
53
  const {
54
54
  data = null,
55
55
  isLoading: isPending = false,
@@ -6,25 +6,29 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useXData = exports.useObsmData = exports.useObsData = exports.useLabelObsData = void 0;
7
7
  var _react = require("react");
8
8
  var _lodash = _interopRequireDefault(require("lodash"));
9
+ var _zarr = require("zarr");
9
10
  var _constants = require("../constants/constants");
10
11
  var _DatasetContext = require("../context/DatasetContext");
11
12
  var _zarrHelper = require("../helpers/zarr-helper");
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ // @TODO: support specifying slice to load from context
13
15
  const useObsmData = function () {
14
16
  let obsm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
15
17
  const dataset = (0, _DatasetContext.useDataset)();
16
18
  obsm = obsm || dataset.selectedObsm;
17
19
  const [obsmParams, setObsmParams] = (0, _react.useState)({
18
20
  url: dataset.url,
19
- path: "obsm/" + obsm
21
+ path: "obsm/" + obsm,
22
+ s: [null, (0, _zarr.slice)(null, 2)] // load only [:, :2]
20
23
  });
21
24
  (0, _react.useEffect)(() => {
22
25
  setObsmParams({
23
26
  url: dataset.url,
24
- path: "obsm/" + obsm
27
+ path: "obsm/" + obsm,
28
+ s: [null, (0, _zarr.slice)(null, 2)]
25
29
  });
26
30
  }, [dataset.url, obsm]);
27
- return (0, _zarrHelper.useZarr)(obsmParams, null, _zarrHelper.GET_OPTIONS, {
31
+ return (0, _zarrHelper.useZarr)(obsmParams, _zarrHelper.GET_OPTIONS, {
28
32
  enabled: !!obsm
29
33
  });
30
34
  };
@@ -83,7 +87,7 @@ const useObsData = function () {
83
87
  path: "obs/" + obs?.name + (obs?.type === _constants.OBS_TYPES.CATEGORICAL ? "/codes" : "")
84
88
  });
85
89
  }, [dataset.url, obs]);
86
- return (0, _zarrHelper.useZarr)(obsParams, null, _zarrHelper.GET_OPTIONS, {
90
+ return (0, _zarrHelper.useZarr)(obsParams, _zarrHelper.GET_OPTIONS, {
87
91
  enabled: !!obs
88
92
  });
89
93
  };
@@ -12056,7 +12056,7 @@ textarea.form-control-lg {
12056
12056
  height: 100%;
12057
12057
  width: 100%;
12058
12058
  display: flex;
12059
- z-index: 1;
12059
+ z-index: 2;
12060
12060
  opacity: 0.75;
12061
12061
  position: absolute;
12062
12062
  justify-content: center;
@@ -17,6 +17,7 @@ export function FullPage(_ref) {
17
17
  let {
18
18
  children,
19
19
  varMode = SELECTION_MODES.SINGLE,
20
+ searchDiseases = false,
20
21
  ...props
21
22
  } = _ref;
22
23
  const appRef = useRef();
@@ -96,7 +97,7 @@ export function FullPage(_ref) {
96
97
  }, /*#__PURE__*/React.createElement("div", {
97
98
  className: "sidebar-features modern-scrollbars"
98
99
  }, /*#__PURE__*/React.createElement(SearchBar, {
99
- searchDiseases: true,
100
+ searchDiseases: searchDiseases,
100
101
  searchVar: true
101
102
  }), /*#__PURE__*/React.createElement(VarNamesList, {
102
103
  mode: varMode
@@ -16,6 +16,7 @@ export function FullPage(_ref) {
16
16
  let {
17
17
  children,
18
18
  varMode = SELECTION_MODES.SINGLE,
19
+ searchDiseases = false,
19
20
  ...props
20
21
  } = _ref;
21
22
  const appRef = useRef();
@@ -111,7 +112,7 @@ export function FullPage(_ref) {
111
112
  })), /*#__PURE__*/React.createElement("div", {
112
113
  className: "sidebar-features modern-scrollbars"
113
114
  }, /*#__PURE__*/React.createElement(SearchBar, {
114
- searchDiseases: true,
115
+ searchDiseases: searchDiseases,
115
116
  searchVar: true
116
117
  }), /*#__PURE__*/React.createElement(VarNamesList, {
117
118
  mode: varMode
@@ -7,6 +7,8 @@ import { ViewMode } from "@nebula.gl/edit-modes";
7
7
  import { EditableGeoJsonLayer } from "@nebula.gl/layers";
8
8
  import _ from "lodash";
9
9
  import { Alert } from "react-bootstrap";
10
+ import { SpatialControls } from "./SpatialControls";
11
+ import { Toolbox } from "./Toolbox";
10
12
  import { COLOR_ENCODINGS, OBS_TYPES, SELECTED_POLYGON_FILLCOLOR, UNSELECTED_POLYGON_FILLCOLOR } from "../../constants/constants";
11
13
  import { useDataset, useDatasetDispatch } from "../../context/DatasetContext";
12
14
  import { useFilteredData } from "../../context/FilterContext";
@@ -17,8 +19,6 @@ import { Legend } from "../../utils/Legend";
17
19
  import { LoadingLinear, LoadingSpinner } from "../../utils/LoadingIndicators";
18
20
  import { formatNumerical } from "../../utils/string";
19
21
  import { useLabelObsData } from "../../utils/zarrData";
20
- import { SpatialControls } from "./SpatialControls";
21
- import { Toolbox } from "./Toolbox";
22
22
  window.deck.log.level = 1;
23
23
  const INITIAL_VIEW_STATE = {
24
24
  longitude: 0,
@@ -38,11 +38,11 @@ const fetchDataFromZarr = async (url, path, s, opts) => {
38
38
  export const useZarr = function (_ref2) {
39
39
  let {
40
40
  url,
41
- path
41
+ path,
42
+ s = null
42
43
  } = _ref2;
43
- let s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
44
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : GET_OPTIONS;
45
- let opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
44
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GET_OPTIONS;
45
+ let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
46
46
  const {
47
47
  data = null,
48
48
  isLoading: isPending = false,
@@ -1,23 +1,28 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import _ from "lodash";
3
+ import { slice } from "zarr";
3
4
  import { OBS_TYPES } from "../constants/constants";
4
5
  import { useDataset } from "../context/DatasetContext";
5
6
  import { GET_OPTIONS, useZarr, useMultipleZarr } from "../helpers/zarr-helper";
7
+
8
+ // @TODO: support specifying slice to load from context
6
9
  export const useObsmData = function () {
7
10
  let obsm = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
8
11
  const dataset = useDataset();
9
12
  obsm = obsm || dataset.selectedObsm;
10
13
  const [obsmParams, setObsmParams] = useState({
11
14
  url: dataset.url,
12
- path: "obsm/" + obsm
15
+ path: "obsm/" + obsm,
16
+ s: [null, slice(null, 2)] // load only [:, :2]
13
17
  });
14
18
  useEffect(() => {
15
19
  setObsmParams({
16
20
  url: dataset.url,
17
- path: "obsm/" + obsm
21
+ path: "obsm/" + obsm,
22
+ s: [null, slice(null, 2)]
18
23
  });
19
24
  }, [dataset.url, obsm]);
20
- return useZarr(obsmParams, null, GET_OPTIONS, {
25
+ return useZarr(obsmParams, GET_OPTIONS, {
21
26
  enabled: !!obsm
22
27
  });
23
28
  };
@@ -74,7 +79,7 @@ export const useObsData = function () {
74
79
  path: "obs/" + obs?.name + (obs?.type === OBS_TYPES.CATEGORICAL ? "/codes" : "")
75
80
  });
76
81
  }, [dataset.url, obs]);
77
- return useZarr(obsParams, null, GET_OPTIONS, {
82
+ return useZarr(obsParams, GET_OPTIONS, {
78
83
  enabled: !!obs
79
84
  });
80
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haniffalab/cherita-react",
3
- "version": "1.2.0-dev.2025-04-09.0f69cbd1",
3
+ "version": "1.2.0-dev.2025-04-28.623a001f",
4
4
  "author": "Haniffa Lab",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -124,5 +124,5 @@
124
124
  "url": "https://github.com/haniffalab/cherita-react/issues"
125
125
  },
126
126
  "homepage": "https://github.com/haniffalab/cherita-react#readme",
127
- "prereleaseSha": "0f69cbd1439ad139d295962fe426d556504b7f75"
127
+ "prereleaseSha": "623a001f39d78904c6e7fe4c9c782a0a486a1119"
128
128
  }
package/scss/cherita.scss CHANGED
@@ -14,7 +14,7 @@ $prefix: "bs-" !default;
14
14
  height: 100%;
15
15
  width: 100%;
16
16
  display: flex;
17
- z-index: 1;
17
+ z-index: 2;
18
18
  opacity: 0.75;
19
19
  position: absolute;
20
20
  justify-content: center;