@niivue/nvreact 1.0.0-rc.4 → 1.0.0-rc.40
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/lib.js +23 -25
- package/dist/types/nvscene-controller.d.ts +6 -6
- package/dist/types/types.d.ts +2 -2
- package/package.json +4 -4
package/dist/lib.js
CHANGED
|
@@ -22,7 +22,7 @@ function useSceneContext() {
|
|
|
22
22
|
import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
23
23
|
|
|
24
24
|
// src/nvscene-controller.ts
|
|
25
|
-
import
|
|
25
|
+
import NiiVue, { DRAG_MODE, SHOW_RENDER, SLICE_TYPE } from "@niivue/niivue";
|
|
26
26
|
|
|
27
27
|
// src/layouts.ts
|
|
28
28
|
var layout1x1 = () => ({
|
|
@@ -410,8 +410,7 @@ class NvSceneController {
|
|
|
410
410
|
const nv = viewer.niivue;
|
|
411
411
|
const volIdx = nv.volumes.findIndex((v) => v.url === url || v.name === url);
|
|
412
412
|
if (volIdx >= 0) {
|
|
413
|
-
nv.
|
|
414
|
-
await nv.updateGLVolume();
|
|
413
|
+
await nv.removeVolume(volIdx);
|
|
415
414
|
this.emit("volumeRemoved", index, url);
|
|
416
415
|
if (this.broadcasting) {
|
|
417
416
|
this.rewireBroadcasting();
|
|
@@ -492,7 +491,7 @@ class NvSceneController {
|
|
|
492
491
|
...this.viewerDefaults,
|
|
493
492
|
...options
|
|
494
493
|
};
|
|
495
|
-
const niivue = new
|
|
494
|
+
const niivue = new NiiVue(mergedOptions);
|
|
496
495
|
const id = `nv-${this.nextId++}`;
|
|
497
496
|
this.viewerSliceLayouts.set(id, null);
|
|
498
497
|
this.loadingCounts.set(id, 0);
|
|
@@ -637,7 +636,7 @@ var NvScene = ({
|
|
|
637
636
|
});
|
|
638
637
|
};
|
|
639
638
|
// src/nvviewer.tsx
|
|
640
|
-
import
|
|
639
|
+
import NiiVue2, { SLICE_TYPE as SLICE_TYPE2 } from "@niivue/niivue";
|
|
641
640
|
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
642
641
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
643
642
|
function extractVisualProps(opts) {
|
|
@@ -683,7 +682,7 @@ var NvViewer = ({
|
|
|
683
682
|
...defaultViewerOptions,
|
|
684
683
|
...options
|
|
685
684
|
};
|
|
686
|
-
const nv = new
|
|
685
|
+
const nv = new NiiVue2(mergedOptions);
|
|
687
686
|
nv.addEventListener("locationChange", (evt) => {
|
|
688
687
|
onLocationChangeRef.current?.(evt.detail);
|
|
689
688
|
});
|
|
@@ -724,8 +723,7 @@ var NvViewer = ({
|
|
|
724
723
|
if (!desiredUrls.has(url)) {
|
|
725
724
|
const volIdx = nv.volumes.findIndex((v) => v.url === url || v.name === url);
|
|
726
725
|
if (volIdx >= 0) {
|
|
727
|
-
nv.
|
|
728
|
-
nv.updateGLVolume();
|
|
726
|
+
nv.removeVolume(volIdx);
|
|
729
727
|
}
|
|
730
728
|
currentVolumes.delete(url);
|
|
731
729
|
}
|
|
@@ -772,22 +770,22 @@ var NvViewer = ({
|
|
|
772
770
|
});
|
|
773
771
|
};
|
|
774
772
|
export {
|
|
775
|
-
|
|
776
|
-
useSceneContext,
|
|
777
|
-
useScene,
|
|
778
|
-
useNiivue,
|
|
779
|
-
triSliceLayout,
|
|
780
|
-
stackedSliceLayout,
|
|
781
|
-
splitSliceLayout,
|
|
782
|
-
quadSliceLayout,
|
|
783
|
-
heroRenderSliceLayout,
|
|
784
|
-
defaultViewerOptions,
|
|
785
|
-
defaultSliceLayouts,
|
|
786
|
-
defaultSliceLayout,
|
|
787
|
-
defaultLayouts,
|
|
788
|
-
SLICE_TYPE,
|
|
789
|
-
NvViewer,
|
|
790
|
-
NvSceneProvider,
|
|
773
|
+
NvScene,
|
|
791
774
|
NvSceneController,
|
|
792
|
-
|
|
775
|
+
NvSceneProvider,
|
|
776
|
+
NvViewer,
|
|
777
|
+
SLICE_TYPE,
|
|
778
|
+
defaultLayouts,
|
|
779
|
+
defaultSliceLayout,
|
|
780
|
+
defaultSliceLayouts,
|
|
781
|
+
defaultViewerOptions,
|
|
782
|
+
heroRenderSliceLayout,
|
|
783
|
+
quadSliceLayout,
|
|
784
|
+
splitSliceLayout,
|
|
785
|
+
stackedSliceLayout,
|
|
786
|
+
triSliceLayout,
|
|
787
|
+
useNiivue,
|
|
788
|
+
useScene,
|
|
789
|
+
useSceneContext,
|
|
790
|
+
useSceneEvent
|
|
793
791
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { NiiVueOptions, NVImage } from '@niivue/niivue';
|
|
2
|
-
import
|
|
2
|
+
import NiiVue, { SLICE_TYPE } from '@niivue/niivue';
|
|
3
3
|
import type { LayoutConfig } from './layouts';
|
|
4
4
|
import type { ImageFromUrlOptions, NvSceneEventMap, ViewerState } from './types';
|
|
5
5
|
export { SLICE_TYPE };
|
|
6
|
-
export type NiivueCallback = (nv:
|
|
6
|
+
export type NiivueCallback = (nv: NiiVue, index: number) => void;
|
|
7
7
|
export interface ViewerSlot {
|
|
8
8
|
id: string;
|
|
9
|
-
niivue:
|
|
9
|
+
niivue: NiiVue;
|
|
10
10
|
canvasElement: HTMLCanvasElement;
|
|
11
11
|
containerDiv: HTMLDivElement;
|
|
12
12
|
}
|
|
@@ -100,8 +100,8 @@ export declare class NvSceneController {
|
|
|
100
100
|
setLayout(layoutName: string): void;
|
|
101
101
|
updateLayout(): void;
|
|
102
102
|
canAddViewer(): boolean;
|
|
103
|
-
getNiivue(index: number):
|
|
104
|
-
getAllNiivue():
|
|
103
|
+
getNiivue(index: number): NiiVue | undefined;
|
|
104
|
+
getAllNiivue(): NiiVue[];
|
|
105
105
|
forEachNiivue(callback: NiivueCallback): void;
|
|
106
106
|
private hasSyncableContent;
|
|
107
107
|
private safeBroadcastTo;
|
|
@@ -111,7 +111,7 @@ export declare class NvSceneController {
|
|
|
111
111
|
setViewerSliceLayout(index: number, layout: SliceLayoutTile[] | null): void;
|
|
112
112
|
getViewerSliceLayout(index: number): SliceLayoutTile[] | null;
|
|
113
113
|
private applySliceLayout;
|
|
114
|
-
getNiivueById(id: string):
|
|
114
|
+
getNiivueById(id: string): NiiVue | undefined;
|
|
115
115
|
getViewerById(id: string): ViewerSlot | undefined;
|
|
116
116
|
loadVolume(index: number, opts: ImageFromUrlOptions): Promise<NVImage>;
|
|
117
117
|
loadVolumes(index: number, opts: ImageFromUrlOptions[]): Promise<NVImage[]>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type NiiVue from '@niivue/niivue';
|
|
2
2
|
import type { ImageFromUrlOptions, NiiVueOptions, NVImage } from '@niivue/niivue';
|
|
3
3
|
export type { ImageFromUrlOptions, NiiVueOptions, NVImage };
|
|
4
4
|
export interface NvSceneEventMap {
|
|
5
|
-
viewerCreated: (nv:
|
|
5
|
+
viewerCreated: (nv: NiiVue, index: number) => void;
|
|
6
6
|
viewerRemoved: (index: number) => void;
|
|
7
7
|
locationChange: (viewerIndex: number, data: unknown) => void;
|
|
8
8
|
imageLoaded: (viewerIndex: number, volume: NVImage) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niivue/nvreact",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.40",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@niivue/niivue": "
|
|
33
|
+
"@niivue/niivue": "1.0.0-rc.39",
|
|
34
34
|
"react": "^19",
|
|
35
35
|
"react-dom": "^19"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@happy-dom/global-registrator": "^20.6.1",
|
|
39
|
-
"@niivue/niivue": "
|
|
39
|
+
"@niivue/niivue": "1.0.0-rc.39",
|
|
40
40
|
"@testing-library/dom": "^10.4.1",
|
|
41
41
|
"@testing-library/jest-dom": "^6.9.1",
|
|
42
42
|
"@testing-library/react": "^16.3.2",
|
|
43
|
-
"@types/bun": "
|
|
43
|
+
"@types/bun": "^1.3.12",
|
|
44
44
|
"@types/react": "^19",
|
|
45
45
|
"@types/react-dom": "^19",
|
|
46
46
|
"@vitejs/plugin-react": "^6.0.1",
|