@vitessce/vit-s 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2444 -2806
- package/dist-tsc/CallbackPublisher.d.ts.map +1 -1
- package/dist-tsc/CallbackPublisher.js +4 -4
- package/dist-tsc/DebugWindow.d.ts +1 -1
- package/dist-tsc/DebugWindow.d.ts.map +1 -1
- package/dist-tsc/Warning.d.ts +1 -1
- package/dist-tsc/Warning.d.ts.map +1 -1
- package/dist-tsc/state/hooks.d.ts +8 -18
- package/dist-tsc/state/hooks.d.ts.map +1 -1
- package/dist-tsc/state/hooks.js +92 -36
- package/package.json +13 -13
- package/src/CallbackPublisher.js +4 -3
- package/src/state/hooks.js +119 -43
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallbackPublisher.d.ts","sourceRoot":"","sources":["../src/CallbackPublisher.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,iDAPG;IAAwB,cAAc;IAEd,cAAc;IAEf,sBAAsB,EAArC,OAAO;CAEjB,
|
|
1
|
+
{"version":3,"file":"CallbackPublisher.d.ts","sourceRoot":"","sources":["../src/CallbackPublisher.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,iDAPG;IAAwB,cAAc;IAEd,cAAc;IAEf,sBAAsB,EAArC,OAAO;CAEjB,QAmDA"}
|
|
@@ -34,6 +34,9 @@ export default function CallbackPublisher(props) {
|
|
|
34
34
|
// to subscribe to view config changes.
|
|
35
35
|
// Reference: https://github.com/react-spring/zustand#transient-updates-for-often-occuring-state-changes
|
|
36
36
|
useEffect(() => viewConfigStoreApi.subscribe(
|
|
37
|
+
// The function to specify which part of the store
|
|
38
|
+
// we want to subscribe to.
|
|
39
|
+
state => state.viewConfig,
|
|
37
40
|
// The function to run on each publish.
|
|
38
41
|
(viewConfig) => {
|
|
39
42
|
if (validateOnConfigChange && viewConfig) {
|
|
@@ -42,10 +45,7 @@ export default function CallbackPublisher(props) {
|
|
|
42
45
|
if (onConfigChange && viewConfig) {
|
|
43
46
|
onConfigChange(viewConfig);
|
|
44
47
|
}
|
|
45
|
-
},
|
|
46
|
-
// The function to specify which part of the store
|
|
47
|
-
// we want to subscribe to.
|
|
48
|
-
state => state.viewConfig), [onConfigChange, validateOnConfigChange, viewConfigStoreApi, pluginSpecificConfigSchema]);
|
|
48
|
+
}), [onConfigChange, validateOnConfigChange, viewConfigStoreApi, pluginSpecificConfigSchema]);
|
|
49
49
|
// Emit updates to the warning message.
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
if (onWarn && warning) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugWindow.d.ts","sourceRoot":"","sources":["../src/DebugWindow.js"],"names":[],"mappings":"AAIA;;
|
|
1
|
+
{"version":3,"file":"DebugWindow.d.ts","sourceRoot":"","sources":["../src/DebugWindow.js"],"names":[],"mappings":"AAIA;;8EA8BC"}
|
package/dist-tsc/Warning.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function Warning(props: any): import("react").JSX.Element;
|
|
1
|
+
export function Warning(props: any): import(".pnpm/@types+react@19.1.6/node_modules/@types/react").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=Warning.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Warning.d.ts","sourceRoot":"","sources":["../src/Warning.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Warning.d.ts","sourceRoot":"","sources":["../src/Warning.js"],"names":[],"mappings":"AAIA,+GAoBC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export function ViewConfigProvider(props: any): JSX.Element;
|
|
2
|
+
export function useViewConfigStoreApi(): any;
|
|
3
|
+
export function useViewConfigStore(selector: any): any;
|
|
4
|
+
export function useViewConfigStoreShallow(selector: any): any;
|
|
5
|
+
export function AuxiliaryProvider(props: any): JSX.Element;
|
|
6
|
+
export function useAuxiliaryStoreApi(): any;
|
|
7
|
+
export function useAuxiliaryStore(selector: any): any;
|
|
8
|
+
export function useAuxiliaryStoreShallow(selector: any): any;
|
|
1
9
|
/**
|
|
2
10
|
* Get the "computed" coordinationScopes after accounting for
|
|
3
11
|
* meta-coordination.
|
|
@@ -291,24 +299,6 @@ export function useGridResize(): number;
|
|
|
291
299
|
* function.
|
|
292
300
|
*/
|
|
293
301
|
export function useEmitGridResize(): Function;
|
|
294
|
-
export const ViewConfigProvider: ({ initialStore, createStore, children, }: {
|
|
295
|
-
initialStore?: import("zustand").UseBoundStore<object> | undefined;
|
|
296
|
-
createStore: () => import("zustand").UseBoundStore<object>;
|
|
297
|
-
children: import("react").ReactNode;
|
|
298
|
-
}) => import("react").FunctionComponentElement<import("react").ProviderProps<import("zustand").UseBoundStore<object> | undefined>>;
|
|
299
|
-
export const useViewConfigStore: import("zustand/context").UseContextStore<object>;
|
|
300
|
-
export const useViewConfigStoreApi: () => {
|
|
301
|
-
getState: import("zustand").GetState<object>;
|
|
302
|
-
setState: import("zustand").SetState<object>;
|
|
303
|
-
subscribe: import("zustand").Subscribe<object>;
|
|
304
|
-
destroy: import("zustand").Destroy;
|
|
305
|
-
};
|
|
306
|
-
export const AuxiliaryProvider: ({ initialStore, createStore, children, }: {
|
|
307
|
-
initialStore?: import("zustand").UseBoundStore<object> | undefined;
|
|
308
|
-
createStore: () => import("zustand").UseBoundStore<object>;
|
|
309
|
-
children: import("react").ReactNode;
|
|
310
|
-
}) => import("react").FunctionComponentElement<import("react").ProviderProps<import("zustand").UseBoundStore<object> | undefined>>;
|
|
311
|
-
export const useAuxiliaryStore: import("zustand/context").UseContextStore<object>;
|
|
312
302
|
export function createViewConfigStore(initialLoaders: any, initialConfig: any): Function;
|
|
313
303
|
export function useComponentLayout(component: any, scopes: any, coordinationScopes: any): Object;
|
|
314
304
|
export function createAuxiliaryStore(): Function;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"AA8BA,4DAiBC;AAED,6CAMC;AACD,uDAOC;AAED,8DAEC;AAGD,2DAiBC;AAED,4CAMC;AACD,sDAOC;AAED,6DAEC;AAID;;;;;;GAMG;AACH,8CAJW,GAAC,mBAEC,MAAM,GAAC,SAAS,CA4B5B;AAED;;;;;;;GAOG;AACH,gDALW,GAAC,wBACD,GAAC,qBAEC,MAAM,GAAC,SAAS,CA0C5B;AAED;;;;;GAKG;AACH,6CAJW,MAAM,sBACN,GAAC,GACC,MAAM,GAAC,SAAS,CAI5B;AAED;;;;;;GAMG;AACH,+CALW,MAAM,mDACN,GAAC,wBACD,GAAC,GACC,MAAM,GAAC,SAAS,CAc5B;AAySD;;;;;;;;;GASG;AACH,mDALW,MAAM,EAAE,sBACR,MAAM,GAEJ,MAAM,CAclB;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CATW,MAAM,EAAE,sBACR,MAAM,GAEJ,KAAK,CAmCjB;AAED,yFAKC;AAED,gGAqBC;AAED,0IA4BC;AAED,iJAkEC;AAED,yFAmBC;AAED;;;;GAIG;AACH,mDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,UAEN,MAAM,GAEJ,KAAK,CA2EjB;AAED;;;;;GAKG;AACH,0DAHW,MAAM,GACJ,MAAM,CAiBlB;AAED;;;;;;GAMG;AACH,4DAJW,MAAM,wBACN,MAAM,GACJ,MAAM,CAgBlB;AAED;;;;;;;GAOG;AACH,4DANW,MAAM,EAAE,iDACR,MAAM,eACN,MAAM,iBACN,MAAM,SAuEhB;AAGD;;;;;;;;;;;GAWG;AACH,wDATW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,GAEJ,KAAK,CAUjB;AA6BD;;;;;;;;;;;;;;;GAeG;AACH,qDATW,MAAM,EAAE,sBACR,MAAM,GAEJ,KAAK,CAgCjB;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAGD;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAoBhB;AAED;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAShB;AAED;;;;;GAKG;AACH,6BAHa,MAAM,EAAE,CAKpB;AAED;;;;;GAKG;AACH,+CAEC;AAED;;;;;GAKG;AACH,0EAEC;AAED;;;;;GAKG;AACH,uEAEC;AAED;;;;;GAKG;AACH,4CAEC;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,iDAEC;AAED;;;;;GAKG;AACH,iCAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,oEAIC;AAGD;;;;;GAKG;AACH,qCAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,iDAEC;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,iDAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,6DAOC;AAED;;;;GAIG;AACH,iCAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,8CAEC;AAzhCM,yFA4LH;AAOG,0FAFM,MAAM,CAOlB;AAcM,iDAUJ"}
|
package/dist-tsc/state/hooks.js
CHANGED
|
@@ -1,23 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
/* eslint-disable max-len */
|
|
2
3
|
/* eslint-disable react-refresh/only-export-components */
|
|
3
|
-
import {
|
|
4
|
-
import create from 'zustand';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import React, { useCallback, useRef, useMemo, createContext, useContext, } from 'react';
|
|
5
|
+
import { create, useStore } from 'zustand';
|
|
6
|
+
import { useShallow } from 'zustand/shallow';
|
|
7
|
+
import { subscribeWithSelector } from 'zustand/middleware';
|
|
7
8
|
import { isMatch, cloneDeep } from 'lodash-es';
|
|
8
9
|
import { CoordinationType } from '@vitessce/constants-internal';
|
|
9
10
|
import { capitalize } from '@vitessce/utils';
|
|
10
11
|
import { getCoordinationSpaceAndScopes } from '@vitessce/config';
|
|
11
12
|
import { removeImageChannelInMetaCoordinationScopesHelper, addImageChannelInMetaCoordinationScopesHelper, } from './spatial-reducers.js';
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
export
|
|
13
|
+
// References for Zustand v3:
|
|
14
|
+
// - https://github.com/pmndrs/zustand#react-context
|
|
15
|
+
// - https://github.com/pmndrs/zustand/blob/e47ea03/tests/context.test.tsx#L60
|
|
16
|
+
// References for Zustand v4:
|
|
17
|
+
// - https://github.com/pmndrs/zustand/discussions/1180#discussioncomment-3354713
|
|
18
|
+
// - https://zustand.docs.pmnd.rs/previous-versions/zustand-v3-create-context#migration
|
|
19
|
+
const ViewConfigStoreContext = createContext(null);
|
|
20
|
+
const AuxiliaryStoreContext = createContext(null);
|
|
21
|
+
export function ViewConfigProvider(props) {
|
|
22
|
+
const { createStore, children, } = props;
|
|
23
|
+
// Reference: https://github.com/pmndrs/zustand/discussions/1180
|
|
24
|
+
const storeRef = useRef();
|
|
25
|
+
if (!storeRef.current) {
|
|
26
|
+
storeRef.current = createStore();
|
|
27
|
+
}
|
|
28
|
+
return (_jsx(ViewConfigStoreContext.Provider, { value: storeRef.current, children: children }));
|
|
29
|
+
}
|
|
30
|
+
export function useViewConfigStoreApi() {
|
|
31
|
+
const store = useContext(ViewConfigStoreContext);
|
|
32
|
+
if (!store) {
|
|
33
|
+
throw new Error('Missing StoreProvider');
|
|
34
|
+
}
|
|
35
|
+
return store;
|
|
36
|
+
}
|
|
37
|
+
export function useViewConfigStore(selector) {
|
|
38
|
+
const store = useViewConfigStoreApi();
|
|
39
|
+
if (!store) {
|
|
40
|
+
throw new Error('Missing StoreProvider');
|
|
41
|
+
}
|
|
42
|
+
const slice = useStore(store, selector);
|
|
43
|
+
return slice;
|
|
44
|
+
}
|
|
45
|
+
export function useViewConfigStoreShallow(selector) {
|
|
46
|
+
return useViewConfigStore(useShallow(selector));
|
|
47
|
+
}
|
|
48
|
+
/* Begin auxiliary store things */
|
|
49
|
+
export function AuxiliaryProvider(props) {
|
|
50
|
+
const { createStore, children, } = props;
|
|
51
|
+
// Reference: https://github.com/pmndrs/zustand/discussions/1180
|
|
52
|
+
const storeRef = useRef();
|
|
53
|
+
if (!storeRef.current) {
|
|
54
|
+
storeRef.current = createStore();
|
|
55
|
+
}
|
|
56
|
+
return (_jsx(AuxiliaryStoreContext.Provider, { value: storeRef.current, children: children }));
|
|
57
|
+
}
|
|
58
|
+
export function useAuxiliaryStoreApi() {
|
|
59
|
+
const store = useContext(AuxiliaryStoreContext);
|
|
60
|
+
if (!store) {
|
|
61
|
+
throw new Error('Missing StoreProvider');
|
|
62
|
+
}
|
|
63
|
+
return store;
|
|
64
|
+
}
|
|
65
|
+
export function useAuxiliaryStore(selector) {
|
|
66
|
+
const store = useAuxiliaryStoreApi();
|
|
67
|
+
if (!store) {
|
|
68
|
+
throw new Error('Missing StoreProvider');
|
|
69
|
+
}
|
|
70
|
+
const slice = useStore(store, selector);
|
|
71
|
+
return slice;
|
|
72
|
+
}
|
|
73
|
+
export function useAuxiliaryStoreShallow(selector) {
|
|
74
|
+
return useAuxiliaryStore(useShallow(selector));
|
|
75
|
+
}
|
|
76
|
+
/* end auxiliary store things */
|
|
21
77
|
/**
|
|
22
78
|
* Get the "computed" coordinationScopes after accounting for
|
|
23
79
|
* meta-coordination.
|
|
@@ -137,7 +193,7 @@ export function getParameterScopeBy(parameter, byType, typeScope, coordinationSc
|
|
|
137
193
|
* - https://github.com/pmndrs/zustand#using-subscribe-with-selector
|
|
138
194
|
* @returns {function} The useStore hook.
|
|
139
195
|
*/
|
|
140
|
-
export const createViewConfigStore = (initialLoaders, initialConfig) => create(set => ({
|
|
196
|
+
export const createViewConfigStore = (initialLoaders, initialConfig) => create()(subscribeWithSelector(set => ({
|
|
141
197
|
// State:
|
|
142
198
|
// The viewConfig is an object which must conform to the schema
|
|
143
199
|
// found in src/schemas/config.schema.json.
|
|
@@ -309,13 +365,13 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
|
|
|
309
365
|
mostRecentConfigSource: 'internal',
|
|
310
366
|
};
|
|
311
367
|
}),
|
|
312
|
-
}));
|
|
368
|
+
})));
|
|
313
369
|
/**
|
|
314
370
|
* Hook for getting components' layout from the view config based on
|
|
315
371
|
* matching all coordination scopes.
|
|
316
372
|
* @returns {Object} The components' layout.
|
|
317
373
|
*/
|
|
318
|
-
export const useComponentLayout = (component, scopes, coordinationScopes) =>
|
|
374
|
+
export const useComponentLayout = (component, scopes, coordinationScopes) => useViewConfigStoreShallow(state => state.viewConfig.layout.filter(l => l.component === component).filter(l => scopes.every(scope => l.coordinationScopes[scope]
|
|
319
375
|
=== coordinationScopes[scope])));
|
|
320
376
|
/**
|
|
321
377
|
* The useAuxiliaryStore hook is initialized via the zustand
|
|
@@ -405,7 +461,7 @@ const useGridSizeStore = create(set => ({
|
|
|
405
461
|
* @returns {object} Object containing all coordination values.
|
|
406
462
|
*/
|
|
407
463
|
export function useInitialCoordination(parameters, coordinationScopes) {
|
|
408
|
-
const values =
|
|
464
|
+
const values = useViewConfigStoreShallow((state) => {
|
|
409
465
|
const { coordinationSpace } = state.initialViewConfig;
|
|
410
466
|
return Object.fromEntries(parameters.map((parameter) => {
|
|
411
467
|
if (coordinationSpace && coordinationSpace[parameter]) {
|
|
@@ -414,7 +470,7 @@ export function useInitialCoordination(parameters, coordinationScopes) {
|
|
|
414
470
|
}
|
|
415
471
|
return [parameter, undefined];
|
|
416
472
|
}));
|
|
417
|
-
}
|
|
473
|
+
});
|
|
418
474
|
return values;
|
|
419
475
|
}
|
|
420
476
|
/**
|
|
@@ -435,7 +491,7 @@ export function useInitialCoordination(parameters, coordinationScopes) {
|
|
|
435
491
|
*/
|
|
436
492
|
export function useCoordination(parameters, coordinationScopes) {
|
|
437
493
|
const setCoordinationValue = useViewConfigStore(state => state.setCoordinationValue);
|
|
438
|
-
const values =
|
|
494
|
+
const values = useViewConfigStoreShallow((state) => {
|
|
439
495
|
const { coordinationSpace } = state.viewConfig;
|
|
440
496
|
return Object.fromEntries(parameters.map((parameter) => {
|
|
441
497
|
if (coordinationSpace) {
|
|
@@ -447,7 +503,7 @@ export function useCoordination(parameters, coordinationScopes) {
|
|
|
447
503
|
}
|
|
448
504
|
return [parameter, undefined];
|
|
449
505
|
}));
|
|
450
|
-
}
|
|
506
|
+
});
|
|
451
507
|
const setters = useMemo(() => Object.fromEntries(parameters.map((parameter) => {
|
|
452
508
|
const setterName = `set${capitalize(parameter)}`;
|
|
453
509
|
const setterFunc = value => setCoordinationValue({
|
|
@@ -470,10 +526,10 @@ export function useMultiCoordinationScopesNonNull(parameter, coordinationScopes)
|
|
|
470
526
|
const scopes = getParameterScope(parameter, coordinationScopes);
|
|
471
527
|
// Return array of coordination scopes,
|
|
472
528
|
// but filter out any whose value is null / falsey.
|
|
473
|
-
const parameterSpace =
|
|
529
|
+
const parameterSpace = useViewConfigStoreShallow((state) => {
|
|
474
530
|
const { coordinationSpace } = state.viewConfig;
|
|
475
531
|
return coordinationSpace?.[parameter];
|
|
476
|
-
}
|
|
532
|
+
});
|
|
477
533
|
const nonNullScopes = useMemo(() => {
|
|
478
534
|
// Convert a single scope to an array of scopes to be consistent.
|
|
479
535
|
const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
|
|
@@ -516,14 +572,14 @@ export function useMultiCoordinationScopesSecondary(parameter, byType, coordinat
|
|
|
516
572
|
}
|
|
517
573
|
export function useMultiCoordinationScopesSecondaryNonNull(parameter, byType, coordinationScopes, coordinationScopesBy) {
|
|
518
574
|
const scopes = getParameterScope(byType, coordinationScopes);
|
|
519
|
-
const parameterSpace =
|
|
575
|
+
const parameterSpace = useViewConfigStoreShallow((state) => {
|
|
520
576
|
const { coordinationSpace } = state.viewConfig;
|
|
521
577
|
return coordinationSpace?.[parameter];
|
|
522
|
-
}
|
|
523
|
-
const byTypeSpace =
|
|
578
|
+
});
|
|
579
|
+
const byTypeSpace = useViewConfigStoreShallow((state) => {
|
|
524
580
|
const { coordinationSpace } = state.viewConfig;
|
|
525
581
|
return coordinationSpace?.[byType];
|
|
526
|
-
}
|
|
582
|
+
});
|
|
527
583
|
return useMemo(() => {
|
|
528
584
|
if (scopes && coordinationScopesBy?.[byType]?.[parameter]) {
|
|
529
585
|
const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
|
|
@@ -580,7 +636,7 @@ export function useMultiCoordinationScopesSecondaryNonNull(parameter, byType, co
|
|
|
580
636
|
export function useMultiCoordinationValues(parameter, coordinationScopes) {
|
|
581
637
|
const scopes = getParameterScope(parameter, coordinationScopes);
|
|
582
638
|
// Mapping from dataset coordination scope name to dataset uid
|
|
583
|
-
const vals =
|
|
639
|
+
const vals = useViewConfigStoreShallow((state) => {
|
|
584
640
|
const { coordinationSpace } = state.viewConfig;
|
|
585
641
|
// Convert a single scope to an array of scopes to be consistent.
|
|
586
642
|
const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
|
|
@@ -592,7 +648,7 @@ export function useMultiCoordinationValues(parameter, coordinationScopes) {
|
|
|
592
648
|
return [scope, undefined];
|
|
593
649
|
// eslint-disable-next-line no-unused-vars
|
|
594
650
|
}).filter(([k, v]) => v !== undefined));
|
|
595
|
-
}
|
|
651
|
+
});
|
|
596
652
|
return vals;
|
|
597
653
|
}
|
|
598
654
|
/**
|
|
@@ -619,10 +675,10 @@ export function useDatasetUids(coordinationScopes) {
|
|
|
619
675
|
*/
|
|
620
676
|
export function useComplexCoordination(parameters, coordinationScopes, coordinationScopesBy, byType) {
|
|
621
677
|
const setCoordinationValue = useViewConfigStore(state => state.setCoordinationValue);
|
|
622
|
-
const parameterSpaces =
|
|
678
|
+
const parameterSpaces = useViewConfigStoreShallow((state) => {
|
|
623
679
|
const { coordinationSpace } = state.viewConfig;
|
|
624
680
|
return parameters.map(parameter => coordinationSpace[parameter]);
|
|
625
|
-
}
|
|
681
|
+
});
|
|
626
682
|
const values = useMemo(() => {
|
|
627
683
|
const typeScopes = getParameterScope(byType, coordinationScopes);
|
|
628
684
|
if (typeScopes) {
|
|
@@ -683,10 +739,10 @@ export function useComplexCoordination(parameters, coordinationScopes, coordinat
|
|
|
683
739
|
* @returns {object} The coordinationScopes after filling in with meta-coordinationScopes.
|
|
684
740
|
*/
|
|
685
741
|
export function useCoordinationScopes(coordinationScopes) {
|
|
686
|
-
const metaSpace =
|
|
742
|
+
const metaSpace = useViewConfigStoreShallow((state) => {
|
|
687
743
|
const { coordinationSpace } = state.viewConfig;
|
|
688
744
|
return coordinationSpace?.[CoordinationType.META_COORDINATION_SCOPES];
|
|
689
|
-
}
|
|
745
|
+
});
|
|
690
746
|
const vals = useMemo(() => {
|
|
691
747
|
const scopes = getScopes(coordinationScopes, metaSpace);
|
|
692
748
|
// Prevent infinite loop, delete metaCoordinationScopes now that they are computed.
|
|
@@ -703,10 +759,10 @@ export function useCoordinationScopes(coordinationScopes) {
|
|
|
703
759
|
* @returns {object} The coordinationScopesBy after filling in with meta-coordinationScopesBy.
|
|
704
760
|
*/
|
|
705
761
|
export function useCoordinationScopesBy(coordinationScopes, coordinationScopesBy) {
|
|
706
|
-
const metaSpaceBy =
|
|
762
|
+
const metaSpaceBy = useViewConfigStoreShallow((state) => {
|
|
707
763
|
const { coordinationSpace } = state.viewConfig;
|
|
708
764
|
return coordinationSpace?.[CoordinationType.META_COORDINATION_SCOPES_BY];
|
|
709
|
-
}
|
|
765
|
+
});
|
|
710
766
|
const vals = useMemo(() => {
|
|
711
767
|
const scopesBy = getScopesBy(coordinationScopes, coordinationScopesBy, metaSpaceBy);
|
|
712
768
|
return scopesBy;
|
|
@@ -846,7 +902,7 @@ export function useAuxiliaryCoordination(parameters, coordinationScopes) {
|
|
|
846
902
|
const setCoordinationValue = useAuxiliaryStore(state => state.setCoordinationValue);
|
|
847
903
|
const mappedCoordinationScopes = mapCoordinationScopes(coordinationScopes);
|
|
848
904
|
const mappedParameters = mapParameters(parameters);
|
|
849
|
-
const values =
|
|
905
|
+
const values = useAuxiliaryStoreShallow((state) => {
|
|
850
906
|
const { auxiliaryStore } = state;
|
|
851
907
|
return Object.fromEntries(mappedParameters.map((parameter) => {
|
|
852
908
|
if (auxiliaryStore && auxiliaryStore[parameter]) {
|
|
@@ -855,7 +911,7 @@ export function useAuxiliaryCoordination(parameters, coordinationScopes) {
|
|
|
855
911
|
}
|
|
856
912
|
return [parameter, undefined];
|
|
857
913
|
}));
|
|
858
|
-
}
|
|
914
|
+
});
|
|
859
915
|
const setters = useMemo(() => Object.fromEntries(mappedParameters.map((parameter) => {
|
|
860
916
|
const setterName = `set${capitalize(parameter)}`;
|
|
861
917
|
const setterFunc = value => setCoordinationValue({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/vit-s",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist-tsc"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@tanstack/react-query": "^
|
|
19
|
+
"@tanstack/react-query": "^5.80.2",
|
|
20
20
|
"clsx": "^1.1.1",
|
|
21
21
|
"d3-array": "^2.4.0",
|
|
22
22
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"lodash-es": "^4.17.21",
|
|
26
26
|
"react-grid-layout-with-lodash": "^1.3.5",
|
|
27
27
|
"uuid": "^9.0.0",
|
|
28
|
-
"zustand": "^
|
|
28
|
+
"zustand": "^5.0.4",
|
|
29
29
|
"react-aria": "^3.28.0",
|
|
30
30
|
"react-error-boundary": "^5.0.0",
|
|
31
|
-
"@vitessce/styles": "3.6.
|
|
32
|
-
"@vitessce/abstract": "3.6.
|
|
33
|
-
"@vitessce/constants-internal": "3.6.
|
|
34
|
-
"@vitessce/plugins": "3.6.
|
|
35
|
-
"@vitessce/schemas": "3.6.
|
|
36
|
-
"@vitessce/utils": "3.6.
|
|
37
|
-
"@vitessce/sets-utils": "3.6.
|
|
38
|
-
"@vitessce/config": "3.6.
|
|
39
|
-
"@vitessce/globals": "3.6.
|
|
31
|
+
"@vitessce/styles": "3.6.1",
|
|
32
|
+
"@vitessce/abstract": "3.6.1",
|
|
33
|
+
"@vitessce/constants-internal": "3.6.1",
|
|
34
|
+
"@vitessce/plugins": "3.6.1",
|
|
35
|
+
"@vitessce/schemas": "3.6.1",
|
|
36
|
+
"@vitessce/utils": "3.6.1",
|
|
37
|
+
"@vitessce/sets-utils": "3.6.1",
|
|
38
|
+
"@vitessce/config": "3.6.1",
|
|
39
|
+
"@vitessce/globals": "3.6.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": "^18.0.0",
|
|
46
46
|
"vite": "^6.3.5",
|
|
47
47
|
"vitest": "^3.1.4",
|
|
48
|
-
"@vitessce/types": "3.6.
|
|
48
|
+
"@vitessce/types": "3.6.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
package/src/CallbackPublisher.js
CHANGED
|
@@ -44,6 +44,9 @@ export default function CallbackPublisher(props) {
|
|
|
44
44
|
// to subscribe to view config changes.
|
|
45
45
|
// Reference: https://github.com/react-spring/zustand#transient-updates-for-often-occuring-state-changes
|
|
46
46
|
useEffect(() => viewConfigStoreApi.subscribe(
|
|
47
|
+
// The function to specify which part of the store
|
|
48
|
+
// we want to subscribe to.
|
|
49
|
+
state => state.viewConfig,
|
|
47
50
|
// The function to run on each publish.
|
|
48
51
|
(viewConfig) => {
|
|
49
52
|
if (validateOnConfigChange && viewConfig) {
|
|
@@ -53,9 +56,7 @@ export default function CallbackPublisher(props) {
|
|
|
53
56
|
onConfigChange(viewConfig);
|
|
54
57
|
}
|
|
55
58
|
},
|
|
56
|
-
//
|
|
57
|
-
// we want to subscribe to.
|
|
58
|
-
state => state.viewConfig,
|
|
59
|
+
// TODO: here, should we specify the "shallow" equality function?
|
|
59
60
|
), [onConfigChange, validateOnConfigChange, viewConfigStoreApi, pluginSpecificConfigSchema]);
|
|
60
61
|
|
|
61
62
|
// Emit updates to the warning message.
|