@haniffalab/cherita-react 0.2.0-dev.2024-02-12.9498443 → 0.2.0-dev.2024-02-13.c21dcf17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dotplot/Dotplot.js +104 -129
- package/dist/components/heatmap/Heatmap.js +48 -74
- package/dist/components/matrixplot/Matrixplot.js +59 -87
- package/dist/components/obs-list/ObsList.js +68 -93
- package/dist/components/obsm-list/ObsmList.js +26 -45
- package/dist/components/scatterplot/Legend.js +7 -5
- package/dist/components/scatterplot/Scatterplot.js +103 -198
- package/dist/components/scatterplot/Toolbox.js +14 -24
- package/dist/components/var-list/VarList.js +66 -112
- package/dist/components/violin/Violin.js +48 -77
- package/dist/constants/constants.js +9 -17
- package/dist/context/DatasetContext.js +114 -107
- package/dist/helpers/color.js +18 -21
- package/dist/helpers/map.js +41 -43
- package/dist/helpers/zarr.js +20 -42
- package/dist/index.js +17 -17
- package/dist/utils/LoadingSpinner.js +4 -4
- package/dist/utils/errors.js +22 -21
- package/dist/utils/requests.js +67 -105
- package/package.json +6 -6
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -15,50 +14,34 @@ var _reactQueryPersistClient = require("@tanstack/react-query-persist-client");
|
|
|
15
14
|
var _querySyncStoragePersister = require("@tanstack/query-sync-storage-persister");
|
|
16
15
|
var _constants = require("../constants/constants");
|
|
17
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
function _getRequireWildcardCache(
|
|
19
|
-
function _interopRequireWildcard(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
28
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
29
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
30
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
32
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
33
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
34
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
-
var DatasetContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
36
|
-
exports.DatasetContext = DatasetContext;
|
|
37
|
-
var DatasetDispatchContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
38
|
-
exports.DatasetDispatchContext = DatasetDispatchContext;
|
|
39
|
-
var queryClient = new _reactQuery.QueryClient({
|
|
17
|
+
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); }
|
|
18
|
+
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 && Object.prototype.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; }
|
|
19
|
+
const DatasetContext = exports.DatasetContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
20
|
+
const DatasetDispatchContext = exports.DatasetDispatchContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
21
|
+
const queryClient = new _reactQuery.QueryClient({
|
|
40
22
|
defaultOptions: {
|
|
41
23
|
queries: {
|
|
42
24
|
gcTime: 1000 * 60 * 60 * 24 * 7 // store for a week
|
|
43
25
|
}
|
|
44
26
|
},
|
|
45
|
-
|
|
46
27
|
queryCache: new _reactQuery.QueryCache({
|
|
47
|
-
onError:
|
|
28
|
+
onError: (error, query) => {
|
|
48
29
|
console.error(error);
|
|
49
30
|
}
|
|
50
31
|
})
|
|
51
32
|
});
|
|
52
33
|
// Type of queries to store responses
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
const persistKeys = ["obs/cols", "var/names", "obsm/keys"];
|
|
35
|
+
const persistOptions = {
|
|
55
36
|
persister: (0, _querySyncStoragePersister.createSyncStoragePersister)({
|
|
56
37
|
storage: window.localStorage
|
|
57
38
|
}),
|
|
58
39
|
dehydrateOptions: {
|
|
59
|
-
shouldDehydrateQuery:
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
shouldDehydrateQuery: _ref => {
|
|
41
|
+
let {
|
|
42
|
+
queryKey,
|
|
43
|
+
state
|
|
44
|
+
} = _ref;
|
|
62
45
|
if (state.status === "success") {
|
|
63
46
|
return persistKeys.includes(queryKey === null || queryKey === void 0 ? void 0 : queryKey[0]);
|
|
64
47
|
}
|
|
@@ -67,8 +50,7 @@ var persistOptions = {
|
|
|
67
50
|
}
|
|
68
51
|
// @TODO: add maxAge and buster (app and api version numbers as busters)
|
|
69
52
|
};
|
|
70
|
-
|
|
71
|
-
var initialDataset = {
|
|
53
|
+
const initialDataset = {
|
|
72
54
|
obs: {},
|
|
73
55
|
selectedObs: null,
|
|
74
56
|
selectedObsm: null,
|
|
@@ -92,24 +74,26 @@ var initialDataset = {
|
|
|
92
74
|
obs: {}
|
|
93
75
|
}
|
|
94
76
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
77
|
+
const initializer = initialState => {
|
|
78
|
+
const localObj = (JSON.parse(localStorage.getItem(_constants.LOCAL_STORAGE_KEY)) || {})[initialState.url] || {};
|
|
79
|
+
const keys = _lodash.default.keys(initialState);
|
|
80
|
+
const localValues = _lodash.default.pick(localObj, keys);
|
|
99
81
|
return _lodash.default.assign(initialState, localValues);
|
|
100
82
|
};
|
|
101
83
|
function DatasetProvider(_ref2) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
(0, _react.useEffect)(
|
|
84
|
+
let {
|
|
85
|
+
dataset_url,
|
|
86
|
+
children
|
|
87
|
+
} = _ref2;
|
|
88
|
+
const [dataset, dispatch] = (0, _react.useReducer)(datasetReducer, {
|
|
89
|
+
url: dataset_url,
|
|
90
|
+
...initialDataset
|
|
91
|
+
}, initializer);
|
|
92
|
+
(0, _react.useEffect)(() => {
|
|
111
93
|
try {
|
|
112
|
-
localStorage.setItem(_constants.LOCAL_STORAGE_KEY, JSON.stringify(
|
|
94
|
+
localStorage.setItem(_constants.LOCAL_STORAGE_KEY, JSON.stringify({
|
|
95
|
+
[dataset.url]: dataset
|
|
96
|
+
}));
|
|
113
97
|
} catch (err) {
|
|
114
98
|
if (err.code === 22 || err.code === 1014 || err.name === "QuotaExceededError" || err.name === "NS_ERROR_DOM_QUOTA_REACHED") {
|
|
115
99
|
console.log("Browser storage quota exceeded");
|
|
@@ -141,130 +125,153 @@ function datasetReducer(dataset, action) {
|
|
|
141
125
|
}
|
|
142
126
|
case "set.obs":
|
|
143
127
|
{
|
|
144
|
-
return
|
|
128
|
+
return {
|
|
129
|
+
...dataset,
|
|
145
130
|
obs: action.value
|
|
146
|
-
}
|
|
131
|
+
};
|
|
147
132
|
}
|
|
148
133
|
case "obsSelected":
|
|
149
134
|
{
|
|
150
|
-
return
|
|
135
|
+
return {
|
|
136
|
+
...dataset,
|
|
151
137
|
selectedObs: action.obs
|
|
152
|
-
}
|
|
138
|
+
};
|
|
153
139
|
}
|
|
154
140
|
case "obsmSelected":
|
|
155
141
|
{
|
|
156
|
-
return
|
|
142
|
+
return {
|
|
143
|
+
...dataset,
|
|
157
144
|
selectedObsm: action.obsm
|
|
158
|
-
}
|
|
145
|
+
};
|
|
159
146
|
}
|
|
160
147
|
case "varSelected":
|
|
161
148
|
{
|
|
162
|
-
return
|
|
149
|
+
return {
|
|
150
|
+
...dataset,
|
|
163
151
|
selectedVar: action.var
|
|
164
|
-
}
|
|
152
|
+
};
|
|
165
153
|
}
|
|
166
154
|
case "multiVarSelected":
|
|
167
155
|
{
|
|
168
|
-
if (dataset.selectedMultiVar.find(
|
|
169
|
-
return i === action.var;
|
|
170
|
-
})) {
|
|
156
|
+
if (dataset.selectedMultiVar.find(i => i === action.var)) {
|
|
171
157
|
return dataset;
|
|
172
158
|
} else {
|
|
173
|
-
return
|
|
174
|
-
|
|
175
|
-
|
|
159
|
+
return {
|
|
160
|
+
...dataset,
|
|
161
|
+
selectedMultiVar: [...dataset.selectedMultiVar, action.var]
|
|
162
|
+
};
|
|
176
163
|
}
|
|
177
164
|
}
|
|
178
165
|
case "multiVarDeselected":
|
|
179
166
|
{
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
});
|
|
167
|
+
return {
|
|
168
|
+
...dataset,
|
|
169
|
+
selectedMultiVar: dataset.selectedMultiVar.filter(a => a !== action.var)
|
|
170
|
+
};
|
|
185
171
|
}
|
|
186
172
|
case "set.colorEncoding":
|
|
187
173
|
{
|
|
188
|
-
return
|
|
174
|
+
return {
|
|
175
|
+
...dataset,
|
|
189
176
|
colorEncoding: action.value
|
|
190
|
-
}
|
|
177
|
+
};
|
|
191
178
|
}
|
|
192
179
|
case "multiVarReset":
|
|
193
180
|
{
|
|
194
|
-
return
|
|
181
|
+
return {
|
|
182
|
+
...dataset,
|
|
195
183
|
selectedMultiVar: []
|
|
196
|
-
}
|
|
184
|
+
};
|
|
197
185
|
}
|
|
198
186
|
case "set.controls.colorScale":
|
|
199
187
|
{
|
|
200
|
-
return
|
|
201
|
-
|
|
188
|
+
return {
|
|
189
|
+
...dataset,
|
|
190
|
+
controls: {
|
|
191
|
+
...dataset.controls,
|
|
202
192
|
colorScale: action.colorScale
|
|
203
|
-
}
|
|
204
|
-
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
205
195
|
}
|
|
206
196
|
case "set.controls.colorAxis":
|
|
207
197
|
{
|
|
208
|
-
return
|
|
209
|
-
|
|
198
|
+
return {
|
|
199
|
+
...dataset,
|
|
200
|
+
controls: {
|
|
201
|
+
...dataset.controls,
|
|
210
202
|
colorAxis: action.colorAxis
|
|
211
|
-
}
|
|
212
|
-
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
213
205
|
}
|
|
214
206
|
case "set.controls.colorAxis.crange":
|
|
215
207
|
{
|
|
216
|
-
return
|
|
217
|
-
|
|
218
|
-
|
|
208
|
+
return {
|
|
209
|
+
...dataset,
|
|
210
|
+
controls: {
|
|
211
|
+
...dataset.controls,
|
|
212
|
+
colorAxis: {
|
|
213
|
+
...dataset.controls.colorAxis,
|
|
219
214
|
cmin: action.cmin,
|
|
220
215
|
cmax: action.cmax
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
224
219
|
}
|
|
225
220
|
case "set.controls.colorAxis.cmin":
|
|
226
221
|
{
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
return {
|
|
223
|
+
...dataset,
|
|
224
|
+
controls: {
|
|
225
|
+
...dataset.controls,
|
|
226
|
+
colorAxis: {
|
|
227
|
+
...dataset.controls.colorAxis,
|
|
230
228
|
cmin: action.cmin
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
234
232
|
}
|
|
235
233
|
case "set.controls.colorAxis.cmax":
|
|
236
234
|
{
|
|
237
|
-
return
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
return {
|
|
236
|
+
...dataset,
|
|
237
|
+
controls: {
|
|
238
|
+
...dataset.controls,
|
|
239
|
+
colorAxis: {
|
|
240
|
+
...dataset.controls.colorAxis,
|
|
240
241
|
cmax: action.cmax
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
244
245
|
}
|
|
245
246
|
case "set.controls.standardScale":
|
|
246
247
|
{
|
|
247
|
-
return
|
|
248
|
-
|
|
248
|
+
return {
|
|
249
|
+
...dataset,
|
|
250
|
+
controls: {
|
|
251
|
+
...dataset.controls,
|
|
249
252
|
standardScale: action.standardScale
|
|
250
|
-
}
|
|
251
|
-
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
252
255
|
}
|
|
253
256
|
case "set.controls.meanOnlyExpressed":
|
|
254
257
|
{
|
|
255
|
-
return
|
|
256
|
-
|
|
258
|
+
return {
|
|
259
|
+
...dataset,
|
|
260
|
+
controls: {
|
|
261
|
+
...dataset.controls,
|
|
257
262
|
meanOnlyExpressed: action.meanOnlyExpressed
|
|
258
|
-
}
|
|
259
|
-
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
260
265
|
}
|
|
261
266
|
case "set.controls.expressionCutoff":
|
|
262
267
|
{
|
|
263
|
-
return
|
|
264
|
-
|
|
268
|
+
return {
|
|
269
|
+
...dataset,
|
|
270
|
+
controls: {
|
|
271
|
+
...dataset.controls,
|
|
265
272
|
expressionCutoff: action.expressionCutoff
|
|
266
|
-
}
|
|
267
|
-
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
268
275
|
}
|
|
269
276
|
default:
|
|
270
277
|
{
|
package/dist/helpers/color.js
CHANGED
|
@@ -9,26 +9,23 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
9
9
|
var _constants = require("../constants/constants");
|
|
10
10
|
var _DatasetContext = require("../context/DatasetContext");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
14
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
12
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
function _toPropertyKey(
|
|
18
|
-
function _toPrimitive(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
class ColorHelper {
|
|
16
|
+
constructor() {
|
|
17
|
+
_defineProperty(this, "getScale", (dataset, values) => {
|
|
18
|
+
return _chromaJs.default.scale(_constants.CHROMA_COLORSCALES[dataset.controls.colorScale]).domain([_lodash.default.min(values), _lodash.default.max(values)]);
|
|
19
|
+
});
|
|
20
|
+
_defineProperty(this, "getColor", function (dataset, value) {
|
|
21
|
+
let scale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _chromaJs.default.scale();
|
|
22
|
+
if (dataset.colorEncoding === "var") {
|
|
23
|
+
return scale(value).rgb();
|
|
24
|
+
} else if (dataset.colorEncoding === "obs") {
|
|
25
|
+
//console.log(dataset.obs[dataset.selectedObs.name].state[value]["color"]);
|
|
26
|
+
return dataset.obs[dataset.selectedObs.name].state.hasOwnProperty(value) ? dataset.obs[dataset.selectedObs.name].state[value]["color"] : null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
34
31
|
exports.ColorHelper = ColorHelper;
|
package/dist/helpers/map.js
CHANGED
|
@@ -5,54 +5,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MapHelper = void 0;
|
|
7
7
|
var _core = require("@deck.gl/core");
|
|
8
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(
|
|
14
|
-
function _toPrimitive(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
class MapHelper {
|
|
12
|
+
constructor() {
|
|
13
|
+
_defineProperty(this, "fitBounds", coords => {
|
|
14
|
+
let view = new _core.WebMercatorViewport({
|
|
15
|
+
width: 600,
|
|
16
|
+
height: 400,
|
|
17
|
+
longitude: -122.45,
|
|
18
|
+
latitude: 37.78,
|
|
19
|
+
zoom: 12,
|
|
20
|
+
pitch: 30,
|
|
21
|
+
bearing: 15
|
|
22
|
+
});
|
|
23
|
+
let latMin = 90;
|
|
24
|
+
let latMax = -90;
|
|
25
|
+
let lonMin = 180;
|
|
26
|
+
let lonMax = -180;
|
|
27
|
+
coords.forEach(function (coord) {
|
|
28
|
+
const RECT_LAT_INDEX = "0";
|
|
29
|
+
const RECT_LON_INDEX = "1";
|
|
30
|
+
if (coord[RECT_LAT_INDEX] < latMin) latMin = coord[RECT_LAT_INDEX];
|
|
31
|
+
if (coord[RECT_LAT_INDEX] > latMax) latMax = coord[RECT_LAT_INDEX];
|
|
32
|
+
if (coord[RECT_LON_INDEX] < lonMin) lonMin = coord[RECT_LON_INDEX];
|
|
33
|
+
if (coord[RECT_LON_INDEX] > lonMax) lonMax = coord[RECT_LON_INDEX];
|
|
34
|
+
});
|
|
35
|
+
const bounds = [[lonMin, latMax], [lonMax, latMin]];
|
|
36
|
+
const {
|
|
37
|
+
longitude,
|
|
38
|
+
latitude,
|
|
39
|
+
zoom
|
|
40
|
+
} = view.fitBounds(bounds, {
|
|
41
41
|
padding: {
|
|
42
42
|
top: 50,
|
|
43
43
|
bottom: 50,
|
|
44
44
|
left: 50,
|
|
45
45
|
right: 50
|
|
46
46
|
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
});
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
longitude,
|
|
50
|
+
latitude,
|
|
51
|
+
zoom
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
58
56
|
exports.MapHelper = MapHelper;
|
package/dist/helpers/zarr.js
CHANGED
|
@@ -5,52 +5,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ZarrHelper = exports.GET_OPTIONS = void 0;
|
|
7
7
|
var _zarr = require("zarr");
|
|
8
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
-
function _toPropertyKey(
|
|
17
|
-
function _toPrimitive(
|
|
18
|
-
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
const GET_OPTIONS = exports.GET_OPTIONS = {
|
|
19
12
|
concurrencyLimit: 10,
|
|
20
13
|
// max number of concurrent requests (default 10)
|
|
21
|
-
progressCallback:
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
progressCallback: _ref => {
|
|
15
|
+
let {
|
|
16
|
+
progress,
|
|
17
|
+
queueSize
|
|
18
|
+
} = _ref;
|
|
24
19
|
console.log("".concat(progress / queueSize * 100, "% complete."));
|
|
25
20
|
} // callback executed after each request
|
|
26
21
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
path: path,
|
|
40
|
-
mode: "r"
|
|
41
|
-
});
|
|
42
|
-
case 2:
|
|
43
|
-
z = _context.sent;
|
|
44
|
-
return _context.abrupt("return", z);
|
|
45
|
-
case 4:
|
|
46
|
-
case "end":
|
|
47
|
-
return _context.stop();
|
|
48
|
-
}
|
|
49
|
-
}, _callee);
|
|
50
|
-
}));
|
|
51
|
-
return function (_x, _x2) {
|
|
52
|
-
return _ref2.apply(this, arguments);
|
|
53
|
-
};
|
|
54
|
-
}());
|
|
55
|
-
});
|
|
22
|
+
class ZarrHelper {
|
|
23
|
+
constructor() {
|
|
24
|
+
_defineProperty(this, "open", async (url, path) => {
|
|
25
|
+
const z = await (0, _zarr.openArray)({
|
|
26
|
+
store: url,
|
|
27
|
+
path: path,
|
|
28
|
+
mode: "r"
|
|
29
|
+
});
|
|
30
|
+
return z;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
56
34
|
exports.ZarrHelper = ZarrHelper;
|