@itk-viewer/viewer
Advanced tools
Comparing version 0.2.0 to 0.2.1
# @itk-viewer/viewer | ||
## 0.2.1 | ||
### Patch Changes | ||
- b85a579: Route MultiscaleSpatialImages through Viewport actor to RemoteViewport actor. | ||
- Updated dependencies [b85a579] | ||
- @itk-viewer/io@0.1.2 | ||
## 0.2.0 | ||
@@ -4,0 +12,0 @@ |
@@ -9,4 +9,4 @@ import { ReadonlyMat4 } from 'gl-matrix'; | ||
}; | ||
export declare const createCamera: () => import("xstate").Interpreter<import("xstate").ActorLogic<SetPoseEvent, import("xstate").State<context, SetPoseEvent, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SetPoseEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<context, SetPoseEvent, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SetPoseEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<context, SetPoseEvent, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SetPoseEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, SetPoseEvent>; | ||
export declare const createCamera: () => import("xstate").Actor<import("xstate").StateMachine<context, SetPoseEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SetPoseEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>, SetPoseEvent>; | ||
export type Camera = ReturnType<typeof createCamera>; | ||
export {}; |
import { mat4 } from 'gl-matrix'; | ||
import { assign, createMachine, interpret } from 'xstate'; | ||
import { assign, createActor, createMachine } from 'xstate'; | ||
const cameraMachine = createMachine({ | ||
@@ -23,3 +23,4 @@ types: {}, | ||
export const createCamera = () => { | ||
return interpret(cameraMachine).start(); | ||
return createActor(cameraMachine).start(); | ||
}; | ||
//# sourceMappingURL=camera-machine.js.map |
@@ -7,5 +7,5 @@ export declare const fpsWatcher: import("xstate").StateMachine<{ | ||
renderTime: number; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: 'newSample'; | ||
renderTime: number; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>; | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>; |
@@ -63,1 +63,2 @@ import { assign, createMachine, sendParent } from 'xstate'; | ||
}); | ||
//# sourceMappingURL=fps-watcher-machine.js.map |
@@ -0,7 +1,9 @@ | ||
import { ActorRefFrom } from 'xstate'; | ||
import MultiscaleSpatialImage from '@itk-viewer/io/MultiscaleSpatialImage.js'; | ||
import { Viewport } from './viewport.js'; | ||
import { viewportMachine } from './viewport-machine.js'; | ||
type ViewportActor = ActorRefFrom<typeof viewportMachine>; | ||
type addViewportEvent = { | ||
type: 'addViewport'; | ||
name: string; | ||
viewport: Viewport; | ||
viewport: ViewportActor; | ||
}; | ||
@@ -14,6 +16,6 @@ type addImageEvent = { | ||
type context = { | ||
viewports: Record<string, Viewport>; | ||
viewports: Record<string, ViewportActor>; | ||
images: Record<string, MultiscaleSpatialImage>; | ||
}; | ||
export declare const viewerMachine: import("xstate").StateMachine<context, addViewportEvent | addImageEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, addViewportEvent | addImageEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap>>; | ||
export declare const viewerMachine: import("xstate").StateMachine<context, addViewportEvent | addImageEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, addViewportEvent | addImageEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>; | ||
export {}; |
@@ -40,1 +40,2 @@ import { assign, createMachine } from 'xstate'; | ||
}); | ||
//# sourceMappingURL=viewer-machine.js.map |
@@ -1,5 +0,6 @@ | ||
import { interpret } from 'xstate'; | ||
import { createActor } from 'xstate'; | ||
import { viewerMachine } from './viewer-machine.js'; | ||
export const createViewer = () => { | ||
return interpret(viewerMachine).start(); | ||
return createActor(viewerMachine).start(); | ||
}; | ||
//# sourceMappingURL=viewer.js.map |
@@ -21,3 +21,3 @@ import MultiscaleSpatialImage from '@itk-viewer/io/MultiscaleSpatialImage.js'; | ||
}; | ||
export declare const viewportMachine: import("xstate").StateMachine<Context, SetImageEvent | SetCameraEvent | CameraPoseUpdatedEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SetImageEvent | SetCameraEvent | CameraPoseUpdatedEvent, import("xstate").ParameterizedObject, import("xstate").ActorMap>>; | ||
export declare const viewportMachine: import("xstate").StateMachine<Context, SetImageEvent | SetCameraEvent | CameraPoseUpdatedEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SetImageEvent | SetCameraEvent | CameraPoseUpdatedEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
import { assign, createMachine } from 'xstate'; | ||
import { assign, createMachine, sendParent } from 'xstate'; | ||
export const viewportMachine = createMachine({ | ||
@@ -19,2 +19,3 @@ types: {}, | ||
}), | ||
'forwardToParent', | ||
], | ||
@@ -41,5 +42,15 @@ }, | ||
}, | ||
cameraPoseUpdated: { | ||
actions: ['forwardToParent'], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, { | ||
actions: { | ||
forwardToParent: sendParent(({ event }) => { | ||
return event; | ||
}), | ||
}, | ||
}); | ||
//# sourceMappingURL=viewport-machine.js.map |
/// <reference types="gl-matrix/index.js" /> | ||
export declare const createViewport: () => import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setImage"; | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
} | { | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
} | { | ||
type: "cameraPoseUpdated"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
export declare const createViewport: () => import("xstate").Actor<import("xstate").StateMachine<{ | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default | undefined; | ||
camera?: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
camera?: import("xstate").Actor<import("xstate").StateMachine<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}> | undefined; | ||
@@ -80,32 +22,13 @@ cameraSubscription?: import("xstate").Subscription | undefined; | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
camera: import("xstate").Actor<import("xstate").StateMachine<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
@@ -115,3 +38,3 @@ } | { | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setImage"; | ||
@@ -121,32 +44,13 @@ image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
camera: import("xstate").Actor<import("xstate").StateMachine<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
@@ -156,37 +60,3 @@ } | { | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default | undefined; | ||
camera?: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}> | undefined; | ||
cameraSubscription?: import("xstate").Subscription | undefined; | ||
}, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>, { | ||
type: "setImage"; | ||
@@ -196,32 +66,13 @@ image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
camera: import("xstate").Actor<import("xstate").StateMachine<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, any, import("xstate").NonReducibleUnknown, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
}, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
@@ -231,193 +82,3 @@ } | { | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setImage"; | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
} | { | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
} | { | ||
type: "cameraPoseUpdated"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default | undefined; | ||
camera?: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}> | undefined; | ||
cameraSubscription?: import("xstate").Subscription | undefined; | ||
}, { | ||
type: "setImage"; | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
} | { | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
} | { | ||
type: "cameraPoseUpdated"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setImage"; | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
} | { | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
} | { | ||
type: "cameraPoseUpdated"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setImage"; | ||
image: import("@itk-viewer/io/MultiscaleSpatialImage.js").default; | ||
} | { | ||
type: "setCamera"; | ||
camera: import("xstate").Interpreter<import("xstate").ActorLogic<{ | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>, import("xstate").PersistedMachineState<import("xstate").State<{ | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}, import("xstate").ParameterizedObject, import("xstate").ActorMap>>>, import("xstate").ActorSystem<any>>, { | ||
type: "setPose"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
} | { | ||
type: "cameraPoseUpdated"; | ||
pose: import("gl-matrix").ReadonlyMat4; | ||
}>; | ||
export type Viewport = ReturnType<typeof createViewport>; |
@@ -1,5 +0,12 @@ | ||
import { interpret } from 'xstate'; | ||
import { createActor } from 'xstate'; | ||
import { viewportMachine } from './viewport-machine.js'; | ||
const noop = () => { }; | ||
export const createViewport = () => { | ||
return interpret(viewportMachine).start(); | ||
const standAloneViewportLogic = viewportMachine.provide({ | ||
actions: { | ||
forwardToParent: noop, // if not spawned in system, don't error | ||
}, | ||
}); | ||
return createActor(standAloneViewportLogic).start(); | ||
}; | ||
//# sourceMappingURL=viewport.js.map |
{ | ||
"name": "@itk-viewer/viewer", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Multi-dimensional web-based image, mesh, and point set viewer", | ||
@@ -40,9 +40,9 @@ "type": "module", | ||
"devDependencies": { | ||
"typescript": "^5.1.3", | ||
"vite": "^4.3.9" | ||
"typescript": "^5.2.2", | ||
"vite": "^4.4.9" | ||
}, | ||
"dependencies": { | ||
"gl-matrix": "^3.4.3", | ||
"xstate": "5.0.0-beta.18", | ||
"@itk-viewer/io": "^0.1.1" | ||
"xstate": "5.0.0-beta.24", | ||
"@itk-viewer/io": "^0.1.2" | ||
}, | ||
@@ -49,0 +49,0 @@ "scripts": { |
import { ReadonlyMat4, mat4 } from 'gl-matrix'; | ||
import { assign, createMachine, interpret } from 'xstate'; | ||
import { assign, createActor, createMachine } from 'xstate'; | ||
@@ -37,5 +37,5 @@ type context = { | ||
export const createCamera = () => { | ||
return interpret(cameraMachine).start(); | ||
return createActor(cameraMachine).start(); | ||
}; | ||
export type Camera = ReturnType<typeof createCamera>; |
@@ -76,3 +76,3 @@ import { assign, createMachine, sendParent } from 'xstate'; | ||
}, | ||
} | ||
}, | ||
); |
@@ -1,10 +0,12 @@ | ||
import { assign, createMachine } from 'xstate'; | ||
import { ActorRefFrom, assign, createMachine } from 'xstate'; | ||
import MultiscaleSpatialImage from '@itk-viewer/io/MultiscaleSpatialImage.js'; | ||
import { Viewport } from './viewport.js'; | ||
import { viewportMachine } from './viewport-machine.js'; | ||
type ViewportActor = ActorRefFrom<typeof viewportMachine>; | ||
type addViewportEvent = { | ||
type: 'addViewport'; | ||
name: string; | ||
viewport: Viewport; | ||
viewport: ViewportActor; | ||
}; | ||
@@ -19,3 +21,3 @@ | ||
type context = { | ||
viewports: Record<string, Viewport>; | ||
viewports: Record<string, ViewportActor>; | ||
images: Record<string, MultiscaleSpatialImage>; | ||
@@ -22,0 +24,0 @@ }; |
@@ -20,3 +20,3 @@ import { createViewport } from './viewport.js'; | ||
'first', | ||
viewport | ||
viewport, | ||
); | ||
@@ -38,3 +38,3 @@ }); | ||
'/ome-ngff-prototypes/single_image/v0.4/yx.ome.zarr', | ||
document.location.origin | ||
document.location.origin, | ||
); | ||
@@ -41,0 +41,0 @@ const image = await ZarrMultiscaleSpatialImage.fromUrl(storeURL); |
@@ -1,2 +0,2 @@ | ||
import { interpret } from 'xstate'; | ||
import { createActor } from 'xstate'; | ||
@@ -6,5 +6,5 @@ import { viewerMachine } from './viewer-machine.js'; | ||
export const createViewer = () => { | ||
return interpret(viewerMachine).start(); | ||
return createActor(viewerMachine).start(); | ||
}; | ||
export type Viewer = ReturnType<typeof createViewer>; |
@@ -1,2 +0,2 @@ | ||
import { ActorRef, assign, createMachine } from 'xstate'; | ||
import { ActorRef, assign, createMachine, sendParent } from 'xstate'; | ||
@@ -28,47 +28,56 @@ import MultiscaleSpatialImage from '@itk-viewer/io/MultiscaleSpatialImage.js'; | ||
export const viewportMachine = createMachine({ | ||
types: {} as { | ||
context: Context; | ||
events: SetImageEvent | SetCameraEvent | CameraPoseUpdatedEvent; | ||
}, | ||
id: 'viewport', | ||
initial: 'active', | ||
context: { | ||
image: undefined, | ||
camera: undefined, | ||
cameraSubscription: undefined, | ||
}, | ||
states: { | ||
active: { | ||
on: { | ||
setImage: { | ||
actions: [ | ||
assign({ | ||
image: ({ event: { image } }: { event: SetImageEvent }) => image, | ||
}), | ||
], | ||
}, | ||
setCamera: { | ||
actions: [ | ||
assign({ | ||
camera: ({ event: { camera } }: { event: SetCameraEvent }) => | ||
camera, | ||
}), | ||
({ context, self }) => { | ||
if (context.cameraSubscription) | ||
context.cameraSubscription.unsubscribe(); | ||
type Events = SetImageEvent | SetCameraEvent | CameraPoseUpdatedEvent; | ||
// Let observers of Viewport know that camera has updated | ||
context.cameraSubscription = context.camera?.subscribe( | ||
(cameraState) => { | ||
( | ||
self as ActorRef<SetCameraEvent | CameraPoseUpdatedEvent> | ||
).send({ | ||
type: 'cameraPoseUpdated', | ||
pose: cameraState.context.pose, | ||
}); | ||
} | ||
); | ||
}, | ||
], | ||
export const viewportMachine = createMachine( | ||
{ | ||
types: {} as { | ||
context: Context; | ||
events: Events; | ||
}, | ||
id: 'viewport', | ||
initial: 'active', | ||
context: { | ||
image: undefined, | ||
camera: undefined, | ||
cameraSubscription: undefined, | ||
}, | ||
states: { | ||
active: { | ||
on: { | ||
setImage: { | ||
actions: [ | ||
assign({ | ||
image: ({ event: { image } }: { event: SetImageEvent }) => | ||
image, | ||
}), | ||
'forwardToParent', | ||
], | ||
}, | ||
setCamera: { | ||
actions: [ | ||
assign({ | ||
camera: ({ event: { camera } }: { event: SetCameraEvent }) => | ||
camera, | ||
}), | ||
({ context, self }) => { | ||
if (context.cameraSubscription) | ||
context.cameraSubscription.unsubscribe(); | ||
// Let observers of Viewport know that camera has updated | ||
context.cameraSubscription = context.camera?.subscribe( | ||
(cameraState) => { | ||
( | ||
self as ActorRef<SetCameraEvent | CameraPoseUpdatedEvent> | ||
).send({ | ||
type: 'cameraPoseUpdated', | ||
pose: cameraState.context.pose, | ||
}); | ||
}, | ||
); | ||
}, | ||
], | ||
}, | ||
cameraPoseUpdated: { | ||
actions: ['forwardToParent'], | ||
}, | ||
}, | ||
@@ -78,2 +87,9 @@ }, | ||
}, | ||
}); | ||
{ | ||
actions: { | ||
forwardToParent: sendParent<Context, Events, undefined>(({ event }) => { | ||
return event; | ||
}), | ||
}, | ||
}, | ||
); |
@@ -17,3 +17,3 @@ import { mat4 } from 'gl-matrix'; | ||
'/ome-ngff-prototypes/single_image/v0.4/yx.ome.zarr', | ||
document.location.origin | ||
document.location.origin, | ||
); | ||
@@ -35,3 +35,3 @@ const image = await ZarrMultiscaleSpatialImage.fromUrl(storeURL); | ||
cy.wrap( | ||
viewport.getSnapshot().context.camera?.getSnapshot().context.pose | ||
viewport.getSnapshot().context.camera?.getSnapshot().context.pose, | ||
).should('deep.equal', camera.getSnapshot().context.pose); | ||
@@ -38,0 +38,0 @@ |
@@ -1,8 +0,15 @@ | ||
import { interpret } from 'xstate'; | ||
import { createActor } from 'xstate'; | ||
import { viewportMachine } from './viewport-machine.js'; | ||
const noop = () => {}; | ||
export const createViewport = () => { | ||
return interpret(viewportMachine).start(); | ||
const standAloneViewportLogic = viewportMachine.provide({ | ||
actions: { | ||
forwardToParent: noop, // if not spawned in system, don't error | ||
}, | ||
}); | ||
return createActor(standAloneViewportLogic).start(); | ||
}; | ||
export type Viewport = ReturnType<typeof createViewport>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33
101714
1049
1
+ Addedxstate@5.0.0-beta.24(transitive)
- Removedxstate@5.0.0-beta.18(transitive)
Updated@itk-viewer/io@^0.1.2
Updatedxstate@5.0.0-beta.24