Repository navigation
Released 2026-09-29.
Interactive toolbar tools, and brush classes. The first user is dianne-js: its DIANNE tool is a toolbar button next to the host's own actions, and it paints positive and negative strokes with the brush in blue and red.
Changed
TOOLBAR_TOOLSis typedreadonly ToolbarContribution[], the union of the run tools (ToolbarToolContribution, unchanged) and the new dialog tools. Providing tools is unaffected. Code that injects the token and reads run-tool members directly must narrow first, for example withvisibleToolContributions()orisDialogToolContribution(). That is a type-level break, so this is a minor bump under 0.x.visibleToolContributionsskips dialog tools (and anything withoutmodels()), andsortToolContributionsis generic.
Added
-
Dialog tools on
TOOLBAR_TOOLS(kind: 'dialog',ToolbarDialogToolContribution).- Button: placed right after the host's projected toolbar buttons, and shown in the Image view only. It is highlighted while its dialog is open.
- Dialog: clicking opens a floating, non-modal dialog. The tool fills it through
mount(host, ctx, session), with aToolDialogContext: the plot-mode context, withtoolsalways present.mountruns once the dialog has rendered andhostis in the document, so the body can measure itself. - Lifecycle: the same as plot modes, sharing the same controller.
- Closing the dialog, or clicking the button again, tears the body down and calls
deactivate()once. - A re-render restarts the session with the dialog still open.
- Leaving the Image view closes the dialog.
- A failed start closes it with a warning.
- Closing the dialog, or clicking the button again, tears the body down and calls
- Helpers:
dialogToolContributions()validates and sorts them, and help entries are listed with the other tools.
-
Brush classes (
IBrushOptions.label/color). With a label set, the brush paints regions of that one class:- New regions take the label and colour. The colour is marked
colorOverridden, so a preset re-apply keeps it. - A stroke only extends or merges regions with the same label, so painting one class never grows another.
setBrushMode(true, …)sets the class in full.setBrushOptionschanges it only whenlabelorcoloris passed, so the size slider keeps it.- Switching class drops the active region; the next stroke starts a new one.
- With neither set, the brush behaves exactly as before.
- New regions take the label and colour. The colour is marked
-
Toolbar tools for plot modes (
PlotModeContext.tools).armBrush(class),disarm()andactiveTool$go through the same path as the toolbar, so the brush button shows as active and its size control appears. Picking any tool from the toolbar gives the plain tool again.toolsis optional in the type, so a context built against 0.5.0 still type-checks.
npm: @jax-data-science/sci-image-visualizer@0.6.0
Full diff: v0.5.0...v0.6.0