@weasel-js/labkit 1.7.0 → 1.7.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/README.md +3 -3
- package/dist/_dts/{CanvasStackContext-D2jnIwfk.d.ts → CanvasStackContext-Cjy6I-Iv.d.ts} +4 -1
- package/dist/_dts/{Stage-CCWfQQWM.d.ts → Stage-D6t7o0pF.d.ts} +3 -2
- package/dist/_dts/{index-CsYqUHD3.d.ts → index-BTmaRy6a.d.ts} +10 -6
- package/dist/_dts/{types-CSm9jgol.d.ts → index-DCMA4Fy1.d.ts} +59 -113
- package/dist/_dts/{types-CRPSGFAp.d.ts → types-BUBSIZuV.d.ts} +8 -7
- package/dist/_dts/{useTrialState-CTZPgeZ7.d.ts → useTrialState-Bh8bzFgE.d.ts} +1 -1
- package/dist/canvas/index.d.ts +8 -6
- package/dist/canvas/index.js +6 -6
- package/dist/chrome/index.d.ts +7 -5
- package/dist/chrome/index.js +10 -9
- package/dist/chunk-2ES4W47N.js +8 -0
- package/dist/chunk-2ES4W47N.js.map +1 -0
- package/dist/{chunk-WPLAANH4.js → chunk-2N7UBSS2.js} +12 -12
- package/dist/chunk-2N7UBSS2.js.map +1 -0
- package/dist/chunk-4KSC7NXL.js +15491 -0
- package/dist/chunk-4KSC7NXL.js.map +1 -0
- package/dist/{chunk-7BO7HNGF.js → chunk-CEGFXTBD.js} +8 -61
- package/dist/chunk-CEGFXTBD.js.map +1 -0
- package/dist/{chunk-275JRRVD.js → chunk-E23Q6A3Y.js} +232 -37
- package/dist/chunk-E23Q6A3Y.js.map +1 -0
- package/dist/{chunk-GOZLNM4L.js → chunk-E6NARGU7.js} +5 -5
- package/dist/{chunk-GOZLNM4L.js.map → chunk-E6NARGU7.js.map} +1 -1
- package/dist/{chunk-IJJUK4FU.js → chunk-EESJUSYR.js} +5 -6
- package/dist/chunk-EESJUSYR.js.map +1 -0
- package/dist/{chunk-HXXTULDN.js → chunk-EFXRM6XQ.js} +8 -11
- package/dist/chunk-EFXRM6XQ.js.map +1 -0
- package/dist/chunk-F4ACIK7Z.js +210 -0
- package/dist/chunk-F4ACIK7Z.js.map +1 -0
- package/dist/{chunk-FMK7UQ6V.js → chunk-FB4MIZOO.js} +61 -44
- package/dist/chunk-FB4MIZOO.js.map +1 -0
- package/dist/{chunk-AWQG7FCC.js → chunk-FG3EXZDV.js} +3 -3
- package/dist/{chunk-AWQG7FCC.js.map → chunk-FG3EXZDV.js.map} +1 -1
- package/dist/{chunk-I5DUQ5HM.js → chunk-GAHELLJT.js} +75 -72
- package/dist/chunk-GAHELLJT.js.map +1 -0
- package/dist/{chunk-YT75VYRD.js → chunk-IBVRMHW5.js} +5 -5
- package/dist/{chunk-YT75VYRD.js.map → chunk-IBVRMHW5.js.map} +1 -1
- package/dist/{chunk-T5IBSPAM.js → chunk-JFOJESJF.js} +33 -23
- package/dist/chunk-JFOJESJF.js.map +1 -0
- package/dist/{chunk-RWNDDKOH.js → chunk-PMLZP7RT.js} +18 -15
- package/dist/chunk-PMLZP7RT.js.map +1 -0
- package/dist/{chunk-Y23G2VZL.js → chunk-READTDQX.js} +2 -2
- package/dist/chunk-READTDQX.js.map +1 -0
- package/dist/{chunk-JVBYV6TL.js → chunk-ROGJWDQA.js} +3 -3
- package/dist/{chunk-JVBYV6TL.js.map → chunk-ROGJWDQA.js.map} +1 -1
- package/dist/{chunk-ZIFPHIWZ.js → chunk-T6DLGEJB.js} +12 -14
- package/dist/chunk-T6DLGEJB.js.map +1 -0
- package/dist/{chunk-24W5VEJW.js → chunk-ULYYNWGP.js} +2 -2
- package/dist/{chunk-24W5VEJW.js.map → chunk-ULYYNWGP.js.map} +1 -1
- package/dist/{chunk-UNAZSLWE.js → chunk-VYVGVBGY.js} +17 -20
- package/dist/chunk-VYVGVBGY.js.map +1 -0
- package/dist/{chunk-KMJ7RWD3.js → chunk-WLMDTI2Q.js} +3 -3
- package/dist/{chunk-KMJ7RWD3.js.map → chunk-WLMDTI2Q.js.map} +1 -1
- package/dist/{chunk-J7OWWTCW.js → chunk-XE5HJOPL.js} +5 -6
- package/dist/chunk-XE5HJOPL.js.map +1 -0
- package/dist/chunk-XVUKDSYV.js +38 -0
- package/dist/chunk-XVUKDSYV.js.map +1 -0
- package/dist/{chunk-FZ7YFQN7.js → chunk-YCFKW5RX.js} +3 -3
- package/dist/chunk-YCFKW5RX.js.map +1 -0
- package/dist/{chunk-CQLQPQ4P.js → chunk-ZQIHJXP4.js} +2 -2
- package/dist/chunk-ZQIHJXP4.js.map +1 -0
- package/dist/config/index.d.ts +18 -10
- package/dist/config/index.js +4 -4
- package/dist/controls/index.d.ts +4 -7
- package/dist/controls/index.js +6 -5
- package/dist/dragdrop/index.d.ts +23 -3
- package/dist/dragdrop/index.js +4 -3
- package/dist/fonts/oswald-tabular-digits.woff2 +0 -0
- package/dist/index.d.ts +60 -714
- package/dist/index.js +357 -334
- package/dist/index.js.map +1 -1
- package/dist/job/index.d.ts +8 -0
- package/dist/job/index.js +1 -1
- package/dist/layers/index.d.ts +6 -5
- package/dist/layers/index.js +3 -2
- package/dist/loupe/index.d.ts +100 -30
- package/dist/loupe/index.js +585 -6
- package/dist/loupe/index.js.map +1 -1
- package/dist/overview/index.d.ts +4 -2
- package/dist/overview/index.js +15 -14
- package/dist/overview/index.js.map +1 -1
- package/dist/passthrough/weasel-canvas.d.ts +2 -0
- package/dist/passthrough/weasel-ui.d.ts +2 -2871
- package/dist/passthrough/weasel-ui.js +3 -2
- package/dist/primitives/index.d.ts +213 -3
- package/dist/primitives/index.js +8 -7
- package/dist/state/index.d.ts +7 -5
- package/dist/state/index.js +6 -6
- package/dist/styles.css +60 -44
- package/dist/surface/index.d.ts +10 -2
- package/dist/surface/index.js +1 -1
- package/dist/undo/index.d.ts +5 -3
- package/package.json +11 -11
- package/src/annotations/AnnotationOverlay.abandon.test.tsx +143 -0
- package/src/annotations/AnnotationOverlay.tsx +50 -31
- package/src/annotations/Annotations.overlay.test.tsx +31 -0
- package/src/annotations/capture.browser.test.ts +41 -0
- package/src/annotations/capture.ts +14 -7
- package/src/annotations/drawOne.ts +2 -2
- package/src/annotations/frac.test.ts +44 -1
- package/src/annotations/frac.ts +46 -18
- package/src/annotations/index.ts +1 -0
- package/src/annotations/paint.test.ts +74 -33
- package/src/annotations/paint.ts +70 -32
- package/src/annotations/store.test.ts +212 -2
- package/src/annotations/store.ts +130 -27
- package/src/annotations/svgNodes.test.ts +22 -10
- package/src/annotations/svgNodes.ts +3 -3
- package/src/annotations/types.ts +29 -10
- package/src/canvas/CameraInput.test.tsx +30 -0
- package/src/canvas/CameraInput.tsx +16 -15
- package/src/canvas/CanvasStack.tsx +5 -5
- package/src/canvas/CanvasStackContext.ts +4 -1
- package/src/canvas/Stage.tsx +3 -3
- package/src/canvas/cameraRegistry.ts +1 -0
- package/src/canvas/worldSpec.ts +3 -1
- package/src/chrome/builtins.test.ts +7 -6
- package/src/chrome/builtins.tsx +5 -1
- package/src/chrome/index.ts +1 -1
- package/src/chrome/merge.test.ts +5 -0
- package/src/chrome/merge.ts +4 -2
- package/src/chrome/regions/PaletteRegion.test.tsx +2 -3
- package/src/chrome/regions/PaletteRegion.tsx +3 -4
- package/src/chrome/regions/ViewportRegion.browser.test.less +6 -0
- package/src/chrome/regions/ViewportRegion.browser.test.tsx +38 -0
- package/src/chrome/regions/ViewportRegion.less +6 -0
- package/src/chrome/regions/ViewportRegion.tsx +10 -4
- package/src/chrome/types.ts +4 -2
- package/src/config/auto.ts +1 -0
- package/src/config/builder.ts +6 -0
- package/src/config/types.ts +2 -1
- package/src/controls/ControlPanel.test.tsx +37 -3
- package/src/controls/ControlPanel.tsx +12 -3
- package/src/dragdrop/DragDropRuntime.tsx +22 -13
- package/src/dragdrop/DragGhost.tsx +3 -0
- package/src/dragdrop/Palette.tsx +2 -0
- package/src/index.test.ts +5 -0
- package/src/index.ts +1 -1
- package/src/instrument/types.ts +0 -6
- package/src/job/useJob.ts +14 -9
- package/src/lab/Lab.tsx +5 -1
- package/src/lab/LabShell.less +1 -0
- package/src/lab/LabSwitcher.browser.test.tsx +27 -0
- package/src/lab/LabSwitcher.less +2 -0
- package/src/lab/LabZoom.tsx +4 -4
- package/src/lab/Workspace.tsx +48 -52
- package/src/loupe/AGENTS.md +28 -15
- package/src/loupe/CanvasLoupe.tsx +2 -3
- package/src/loupe/DomLoupe.tsx +1 -7
- package/src/loupe/Loupe.less +16 -0
- package/src/loupe/TrialLoupe.tsx +120 -57
- package/src/loupe/index.ts +1 -6
- package/src/loupe/types.test.ts +3 -3
- package/src/loupe/types.ts +24 -27
- package/src/loupe/useLoupe.test.tsx +29 -4
- package/src/loupe/useLoupe.ts +20 -17
- package/src/overview/OverviewMarks.tsx +12 -4
- package/src/overview/TrialOverview.tsx +3 -3
- package/src/passthrough/weasel-ui.test.ts +1 -1
- package/src/passthrough/weasel-ui.ts +1 -1
- package/src/primitives/FloatingPanel.tsx +7 -3
- package/src/primitives/JobProgress.less +1 -0
- package/src/primitives/Readout.test.tsx +2 -2
- package/src/primitives/Split.tsx +69 -41
- package/src/primitives/Toolbar.tsx +3 -3
- package/src/primitives/ZoomControl.less +1 -2
- package/src/specimen/Specimen.tsx +0 -1
- package/src/state/undock.ts +3 -0
- package/src/state/useOpenOnce.ts +20 -16
- package/src/state/view.ts +1 -0
- package/src/surface/index.ts +1 -1
- package/src/surface/useTiledSurface.test.tsx +14 -0
- package/src/surface/useTiledSurface.ts +11 -3
- package/src/trial/Trial.annotations.test.tsx +73 -0
- package/src/trial/Trial.less +0 -16
- package/src/trial/Trial.loupe.test.tsx +28 -11
- package/src/trial/Trial.tsx +74 -62
- package/src/trial/TrialChrome.tsx +6 -3
- package/src/trial/index.ts +2 -0
- package/src/trial/loupeSwitch.ts +15 -0
- package/dist/_dts/LayerList.d-DiuEArKq.d.ts +0 -83
- package/dist/_dts/PrefsRow.d-TOZ7BgD9.d.ts +0 -79
- package/dist/_dts/PropertyPanel.d-D-1paCbE.d.ts +0 -141
- package/dist/_dts/Select.d-Bensr_MT.d.ts +0 -579
- package/dist/_dts/index-B2Yj5aA0.d.ts +0 -274
- package/dist/chunk-275JRRVD.js.map +0 -1
- package/dist/chunk-4LJSC7MB.js +0 -143
- package/dist/chunk-4LJSC7MB.js.map +0 -1
- package/dist/chunk-7BO7HNGF.js.map +0 -1
- package/dist/chunk-CQLQPQ4P.js.map +0 -1
- package/dist/chunk-FMK7UQ6V.js.map +0 -1
- package/dist/chunk-FZ7YFQN7.js.map +0 -1
- package/dist/chunk-HXXTULDN.js.map +0 -1
- package/dist/chunk-I5DUQ5HM.js.map +0 -1
- package/dist/chunk-IJJUK4FU.js.map +0 -1
- package/dist/chunk-J7OWWTCW.js.map +0 -1
- package/dist/chunk-M7HP3FTK.js +0 -549
- package/dist/chunk-M7HP3FTK.js.map +0 -1
- package/dist/chunk-MIM5R4ZT.js +0 -14972
- package/dist/chunk-MIM5R4ZT.js.map +0 -1
- package/dist/chunk-RWNDDKOH.js.map +0 -1
- package/dist/chunk-T5IBSPAM.js.map +0 -1
- package/dist/chunk-UNAZSLWE.js.map +0 -1
- package/dist/chunk-WPLAANH4.js.map +0 -1
- package/dist/chunk-Y23G2VZL.js.map +0 -1
- package/dist/chunk-ZIFPHIWZ.js.map +0 -1
- package/src/primitives/useRovingTabIndex.test.ts +0 -48
- package/src/primitives/useRovingTabIndex.ts +0 -88
package/README.md
CHANGED
|
@@ -143,7 +143,6 @@ provide the corresponding chrome; they compose freely.
|
|
|
143
143
|
| `canvas` | A stack of layered `<canvas>` elements with pan and zoom, redrawing only the layers that changed |
|
|
144
144
|
| `layers` | A sidebar list that hides and reorders those layers |
|
|
145
145
|
| `annotations` | Drawing tools, an overlay on each region you name, a Marks panel, undo and export |
|
|
146
|
-
| `loupe` | A magnifier toggle that redraws the canvas through a zoomed camera, or calls your own `render` for DOM content |
|
|
147
146
|
| `dragDrop` | A palette to drag items from, and a drop pipeline that hands you world coordinates |
|
|
148
147
|
| `undo` | Undo and redo buttons, snapshotting state on the events you name |
|
|
149
148
|
| `job` | Starts async work, aborts it on unmount and on a key change, and renders progress and a cancel control |
|
|
@@ -307,14 +306,15 @@ directly. Several expose more than the root does, `/state` most of all.
|
|
|
307
306
|
|
|
308
307
|
| Subpath | |
|
|
309
308
|
| --- | --- |
|
|
310
|
-
| `@weasel-js/labkit` | Everything |
|
|
309
|
+
| `@weasel-js/labkit` | Everything but `/loupe` and `/overview` |
|
|
311
310
|
| `/styles.css` | The one stylesheet |
|
|
312
311
|
| `/primitives` | Toolbar, Sidebar, StatusBar, Legend, FloatingPanel, meters |
|
|
313
312
|
| `/chrome` | Regions, contribution types, built-in contributions |
|
|
314
313
|
| `/controls` | `<ControlPanel>` and the config field types |
|
|
315
314
|
| `/canvas` | `<CanvasStack>`, coordinate helpers, `usePanZoom`, `useOrbit` |
|
|
316
315
|
| `/layers` | `<LayerList>` from `@weasel-js/ui`, and the layers capability types |
|
|
317
|
-
| `/loupe` |
|
|
316
|
+
| `/loupe` | `<TrialLoupe>`, the magnifier an instrument mounts in its content; the trial offers a Loupe toggle while one is mounted. Not in the root barrel |
|
|
317
|
+
| `/overview` | `<TrialOverview>`, a floating panel showing a trial's whole content. Not in the root barrel |
|
|
318
318
|
| `/surface` | Tiled surface hooks for your own renderer |
|
|
319
319
|
| `/job` | `useJob` and the job capability types |
|
|
320
320
|
| `/state` | The lab store, storage adapters, `useTrialState`, serialization helpers |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { RefObject } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { a as ViewTransform, W as WorldFrame, b as WorldSpec } from './index-DCMA4Fy1.js';
|
|
4
4
|
|
|
5
5
|
/** One layer of a canvas stack: its id, whether it is currently shown, and how
|
|
6
6
|
* it paints itself. */
|
|
@@ -25,6 +25,9 @@ interface CanvasStackSurface {
|
|
|
25
25
|
canvases: RefObject<Map<string, HTMLCanvasElement>>;
|
|
26
26
|
/** The layers as the stack is drawing them, bottom first. */
|
|
27
27
|
layers: readonly CanvasLayerDescriptor[];
|
|
28
|
+
/** The coordinate system the stack was given, which `frame` resolves at
|
|
29
|
+
* its size — for a re-draw at another size. */
|
|
30
|
+
worldSpec?: WorldSpec;
|
|
28
31
|
}
|
|
29
32
|
/** What a canvas stack publishes to its children: the view, and the resolved
|
|
30
33
|
* coordinate system it is read in, so DOM overlays can place themselves in the
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { RefObject, ReactNode } from 'react';
|
|
3
3
|
import { ViewApi, Yoke } from '@weasel-js/core';
|
|
4
|
-
import { W as WorldFrame, P as Point,
|
|
5
|
-
import { C as CanvasLayerDescriptor } from './CanvasStackContext-
|
|
4
|
+
import { W as WorldFrame, P as Point, a as ViewTransform, b as WorldSpec, V as ViewportSize } from './index-DCMA4Fy1.js';
|
|
5
|
+
import { C as CanvasLayerDescriptor } from './CanvasStackContext-Cjy6I-Iv.js';
|
|
6
6
|
|
|
7
7
|
/** The view id the stage publishes its pointer under. */
|
|
8
8
|
declare const STAGE_VIEW_ID = "stage";
|
|
@@ -142,6 +142,7 @@ interface CameraRegistry {
|
|
|
142
142
|
/** Fires after any register or release. Shaped for `useSyncExternalStore`. */
|
|
143
143
|
subscribe(listener: () => void): () => void;
|
|
144
144
|
}
|
|
145
|
+
/** An empty in-memory `CameraRegistry`. */
|
|
145
146
|
declare function createCameraRegistry(): CameraRegistry;
|
|
146
147
|
/** The registry a lab keeps its trials' cameras in. */
|
|
147
148
|
declare const CameraRegistryContext: react.Context<CameraRegistry | null>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as ControlRenderer, b as ConfigRule } from './types-BUBSIZuV.js';
|
|
2
|
+
import { O as Instrument, ar as TrialChromeContext, R as TrialContribution, T as TrialRecord, q as InstrumentList, e as SavedSnapshot, o as LabMode, ap as ToolSlotContext, a8 as ContributionBase, aq as ToolbarItem, ao as ToolItem, ai as SidebarSection, al as StatusReadout, K as TrialTool, af as RegionContribution, aj as SidebarSlotContext } from './index-DCMA4Fy1.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
+
/** Built-in ids contributed only while runtime state says so — the loupe
|
|
7
|
+
* toggle appears once a lens mounts, after the trial's first render. */
|
|
8
|
+
declare const TRANSIENT_BUILTINS: ReadonlySet<string>;
|
|
6
9
|
/**
|
|
7
10
|
* The contributions a trial gets from what its instrument declared. This is
|
|
8
11
|
* the whole "declaring a capability provides the chrome" rule — it replaces
|
|
@@ -165,11 +168,12 @@ declare function mergeContributions<T extends {
|
|
|
165
168
|
/**
|
|
166
169
|
* Drop contributions by id. Throws when an id is not present: a typo that
|
|
167
170
|
* silently suppresses nothing is the same class of bug as a duplicate id
|
|
168
|
-
* silently winning.
|
|
171
|
+
* silently winning. `transient` names ids that are legitimately absent at
|
|
172
|
+
* times — contributed only while some runtime state holds.
|
|
169
173
|
*/
|
|
170
174
|
declare function suppressContributions<T extends {
|
|
171
175
|
id: string;
|
|
172
|
-
}>(bundle: readonly T[], ids: readonly string[]): T[];
|
|
176
|
+
}>(bundle: readonly T[], ids: readonly string[], transient?: ReadonlySet<string>): T[];
|
|
173
177
|
|
|
174
178
|
/** Props for `<PaletteRegion>`. */
|
|
175
179
|
interface PaletteRegionProps<TCtx extends ToolSlotContext = TrialChromeContext> {
|
|
@@ -244,5 +248,5 @@ interface ViewportRegionProps {
|
|
|
244
248
|
*/
|
|
245
249
|
declare function ViewportRegion({ contributions, ctx }: ViewportRegionProps): react.JSX.Element | null;
|
|
246
250
|
|
|
247
|
-
export {
|
|
248
|
-
export type { AddTrialOptions as A, LabContribution as L,
|
|
251
|
+
export { reorderTrials as B, resetTrial as C, suppressContributions as D, toolContributions as E, useLabChromeContext as F, useLabContext as G, PaletteRegion as P, SidebarRegion as S, TRANSIENT_BUILTINS as T, ViewportRegion as V, LabAsideRegion as a, LabContext as c, LabFooterRegion as e, LabHeaderRegion as f, LabSidebarRegion as i, StatusRegion as l, TitleBarRegion as o, ToolbarRegion as q, addTrial as t, builtinContributions as u, cloneTrial as v, closeTrial as w, contributionsIn as x, labContributions as y, mergeContributions as z };
|
|
252
|
+
export type { AddTrialOptions as A, LabContribution as L, LabChromeContext as b, LabContextValue as d, LabRegion as g, LabRegionProps as h, PaletteRegionProps as j, SidebarRegionProps as k, StatusRegionProps as m, TitleBarPlacement as n, TitleBarRegionProps as p, ToolbarRegionProps as r, ViewportRegionProps as s };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StanceProps } from '@weasel-js/ui';
|
|
2
|
+
import { View, DrawCommand, Scene, PointerContextValue } from '@weasel-js/core';
|
|
2
3
|
import { RefObject, ComponentType, ReactNode } from 'react';
|
|
3
|
-
import { S as StanceProps } from './PrefsRow.d-TOZ7BgD9.js';
|
|
4
|
-
import { R as ResolvedConfig, C as ConfigPath, V as ValueAtPath, a as ConfigField, b as ConfigSchema } from './types-CRPSGFAp.js';
|
|
5
4
|
import { ColorModePreference } from '@weasel-js/theme';
|
|
5
|
+
import { R as ResolvedConfig, n as ConfigPath, V as ValueAtPath, a as ConfigField, C as ConfigSchema } from './types-BUBSIZuV.js';
|
|
6
|
+
import { Rect } from '@weasel-js/geom';
|
|
6
7
|
import { J as JobHandle, a as JobCapability } from './types-DJ79Tg5J.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -15,6 +16,7 @@ import { J as JobHandle, a as JobCapability } from './types-DJ79Tg5J.js';
|
|
|
15
16
|
declare const auto: unique symbol;
|
|
16
17
|
/** The type of the `auto` sentinel, for widening a value parameter. */
|
|
17
18
|
type Auto = typeof auto;
|
|
19
|
+
/** Whether `value` is the `auto` sentinel. */
|
|
18
20
|
declare function isAuto(value: unknown): value is Auto;
|
|
19
21
|
|
|
20
22
|
/** A sidebar section torn out of its trial, and where it went. */
|
|
@@ -25,7 +27,10 @@ interface UndockedPanel {
|
|
|
25
27
|
}
|
|
26
28
|
/** Undocked panels, keyed by {@link panelKey}. */
|
|
27
29
|
type UndockedPanels = Record<string, UndockedPanel>;
|
|
30
|
+
/** The `UndockedPanels` key for one trial's section. */
|
|
28
31
|
declare function panelKey(trialId: string, sectionId: string): string;
|
|
32
|
+
/** `panels` with the section marked undocked `as` a tile or a floating panel,
|
|
33
|
+
* replacing any earlier entry for it. Returns a new record. */
|
|
29
34
|
declare function undockPanel(panels: UndockedPanels, trialId: string, sectionId: string, as?: UndockedPanel['as']): UndockedPanels;
|
|
30
35
|
/** Dock one section back, or — with no `sectionId` — every panel the trial
|
|
31
36
|
* owns, which is what closing a trial wants. */
|
|
@@ -218,12 +223,7 @@ type Migration = (doc: Record<string, unknown>) => Record<string, unknown>;
|
|
|
218
223
|
|
|
219
224
|
/** A mark's box in its target's world: CSS pixels at zoom 1. Matches weasel's
|
|
220
225
|
* default `RectPose`, which is what the scene stores. */
|
|
221
|
-
|
|
222
|
-
x: number;
|
|
223
|
-
y: number;
|
|
224
|
-
width: number;
|
|
225
|
-
height: number;
|
|
226
|
-
}
|
|
226
|
+
type WorldRect = Rect;
|
|
227
227
|
/** Where a fraction lands on a content box of this size. */
|
|
228
228
|
declare function fracToWorld(f: FracRect, content: {
|
|
229
229
|
w: number;
|
|
@@ -267,14 +267,15 @@ interface MarkStyle {
|
|
|
267
267
|
/**
|
|
268
268
|
* What one mark draws, in its target's world.
|
|
269
269
|
*
|
|
270
|
-
* Pure: a node
|
|
271
|
-
*
|
|
272
|
-
*
|
|
270
|
+
* Pure: a node in, draw commands out, in its target's world. Geometry that a
|
|
271
|
+
* bounding box cannot describe — a line's ends, a stroke's path — comes from
|
|
272
|
+
* `data.shape`, placed in the pose.
|
|
273
|
+
*
|
|
274
|
+
* `scale` is the view's, world to screen. Only a point reads it — its ring is
|
|
275
|
+
* sized in screen pixels — and the default draws that ring as though a world
|
|
276
|
+
* unit were a pixel.
|
|
273
277
|
*/
|
|
274
|
-
declare function markCommands(m: PaintableMark,
|
|
275
|
-
w: number;
|
|
276
|
-
h: number;
|
|
277
|
-
}, style?: MarkStyle): DrawCommand[];
|
|
278
|
+
declare function markCommands(m: PaintableMark, style?: MarkStyle, scale?: View['scale']): DrawCommand[];
|
|
278
279
|
|
|
279
280
|
/** A mark's box in its target's world. Matches weasel's default `RectPose`. */
|
|
280
281
|
type MarkPose = WorldRect;
|
|
@@ -282,6 +283,7 @@ type MarkPose = WorldRect;
|
|
|
282
283
|
type MarkScene = Scene<AnnotationData, 'marks', MarkPose>;
|
|
283
284
|
/** A mark scene: one layer, because marks do not stack in tiers. */
|
|
284
285
|
declare function createAnnotationScene(): MarkScene;
|
|
286
|
+
/** Inputs to `createAnnotationStore`. */
|
|
285
287
|
interface AnnotationStoreOptions {
|
|
286
288
|
/** Re-read on every call, so a target resizing or gaining a dependency takes
|
|
287
289
|
* effect without rebuilding the store. */
|
|
@@ -297,6 +299,10 @@ interface AnnotationStoreOptions {
|
|
|
297
299
|
config?: () => unknown;
|
|
298
300
|
/** Notified after every finished export. */
|
|
299
301
|
onCapture?: (result: CaptureResult) => void;
|
|
302
|
+
/** Whether a selection can stand in several targets at once. `'exclusive'`
|
|
303
|
+
* (the default) clears every other target when a mark is selected in one.
|
|
304
|
+
* A thunk is read at each selection change. */
|
|
305
|
+
selection?: AnnotationSelectionMode | (() => AnnotationSelectionMode | undefined);
|
|
300
306
|
}
|
|
301
307
|
/** Everything a capture needs that is not the store's own state. Split out so
|
|
302
308
|
* `capture.ts` takes data rather than reaching back into the store. */
|
|
@@ -338,8 +344,8 @@ interface FracRect {
|
|
|
338
344
|
h: number;
|
|
339
345
|
}
|
|
340
346
|
/** What shape a mark is. The kinds map onto weasel's own tools; an arrow is a
|
|
341
|
-
* line carrying an end marker, not a separate geometry. A point
|
|
342
|
-
*
|
|
347
|
+
* line carrying an end marker, not a separate geometry. A point is zero-size
|
|
348
|
+
* bounds at its position. */
|
|
343
349
|
type AnnotationKind = 'stroke' | 'line' | 'arrow' | 'rect' | 'ellipse' | 'text' | 'point';
|
|
344
350
|
/** One selectable status in an instrument's meaning tier. */
|
|
345
351
|
interface AnnotationStatus {
|
|
@@ -360,8 +366,11 @@ interface AnnotationData {
|
|
|
360
366
|
target: string;
|
|
361
367
|
kind: AnnotationKind;
|
|
362
368
|
/** Vertices for the kinds a bounding box cannot describe — a line's two
|
|
363
|
-
* ends, a stroke's path
|
|
364
|
-
|
|
369
|
+
* ends, a stroke's path — in fractions of the mark's own bounds, so moving
|
|
370
|
+
* or resizing the bounds carries them along. A point stores none: it is its
|
|
371
|
+
* bounds' origin. `Annotation.points` is this restated in the target's
|
|
372
|
+
* content box. */
|
|
373
|
+
shape?: readonly FracPoint[];
|
|
365
374
|
title?: string;
|
|
366
375
|
status?: string;
|
|
367
376
|
tags?: readonly string[];
|
|
@@ -373,16 +382,21 @@ interface AnnotationData {
|
|
|
373
382
|
}
|
|
374
383
|
/** A mark, as the store reports it. `id` is `<target>/<node>`: one scene per
|
|
375
384
|
* target means a node id is only unique within one. */
|
|
376
|
-
interface Annotation extends AnnotationData {
|
|
385
|
+
interface Annotation extends Omit<AnnotationData, 'shape'> {
|
|
377
386
|
id: string;
|
|
378
387
|
/** Bounds in fractions of the target's content box. */
|
|
379
388
|
frac: FracRect;
|
|
389
|
+
/** Vertices in fractions of the target's content box, wherever the bounds
|
|
390
|
+
* now are. A point's one entry is its bounds' origin. */
|
|
391
|
+
points?: readonly FracPoint[];
|
|
380
392
|
}
|
|
381
393
|
/** A new mark, before the store gives it an id and dates it. */
|
|
382
394
|
interface AnnotationInit {
|
|
383
395
|
target: string;
|
|
384
396
|
kind: AnnotationKind;
|
|
385
397
|
frac: FracRect;
|
|
398
|
+
/** In the target's content box. Stored relative to `frac`, so they should
|
|
399
|
+
* lie inside it; a point takes its position from `frac` alone. */
|
|
386
400
|
points?: readonly FracPoint[];
|
|
387
401
|
title?: string;
|
|
388
402
|
status?: string;
|
|
@@ -398,7 +412,8 @@ interface AnnotationQuery {
|
|
|
398
412
|
where?: (a: Annotation) => boolean;
|
|
399
413
|
}
|
|
400
414
|
/** What a mark's meaning can be patched to. Geometry moves through `frac` /
|
|
401
|
-
* `points`; everything else is the meaning tier.
|
|
415
|
+
* `points`; everything else is the meaning tier. `frac` alone carries the
|
|
416
|
+
* vertices with it; `points` alone moves the bounds to enclose them. */
|
|
402
417
|
type AnnotationPatch = Partial<Pick<Annotation, 'frac' | 'points' | 'title' | 'status' | 'tags' | 'meta'>>;
|
|
403
418
|
/** A target's own picture, handed over for an export to draw marks on top of.
|
|
404
419
|
* labkit cannot rasterize it: it is the consumer's DOM. `svg` is the one that
|
|
@@ -468,10 +483,14 @@ interface AnnotationStorage {
|
|
|
468
483
|
load: () => Promise<SerializedAnnotations | null | undefined>;
|
|
469
484
|
save: (doc: SerializedAnnotations) => void;
|
|
470
485
|
}
|
|
471
|
-
/** Declares that an instrument accepts marks: which regions take them,
|
|
472
|
-
* optionally what a mark is allowed to mean, and optionally where they live. */
|
|
473
486
|
/** The annotation tools a lab's rail can carry. */
|
|
474
487
|
type AnnotationToolId = 'pointer' | 'select' | 'stroke' | 'line' | 'arrow' | 'rect' | 'ellipse' | 'text';
|
|
488
|
+
/** Whether a selection can stand in several of a trial's targets at once.
|
|
489
|
+
* `'exclusive'` clears every other target when a mark is selected in one;
|
|
490
|
+
* `'per-target'` lets each target keep its own. */
|
|
491
|
+
type AnnotationSelectionMode = 'exclusive' | 'per-target';
|
|
492
|
+
/** Declares that an instrument accepts marks: which regions take them,
|
|
493
|
+
* optionally what a mark is allowed to mean, and optionally where they live. */
|
|
475
494
|
interface AnnotationsCapability<TS = unknown, TC = unknown> {
|
|
476
495
|
/** `trial` is which trial is asking: a declaration made once per instrument
|
|
477
496
|
* is called once per trial, and its targets are that trial's own. */
|
|
@@ -488,6 +507,9 @@ interface AnnotationsCapability<TS = unknown, TC = unknown> {
|
|
|
488
507
|
* notification, not an interception: a host wanting its own flow calls
|
|
489
508
|
* `capture()` from its own UI, which is the surface the chrome uses. */
|
|
490
509
|
onCapture?: (result: CaptureResult) => void;
|
|
510
|
+
/** Defaults to `'exclusive'`: selecting a mark in one target clears the
|
|
511
|
+
* selection in every other. */
|
|
512
|
+
selection?: AnnotationSelectionMode;
|
|
491
513
|
}
|
|
492
514
|
/** A persisted mark set. Versioned by this arc rather than by labkit's
|
|
493
515
|
* document migrations, which only ever reach top-level document sections and
|
|
@@ -526,11 +548,13 @@ interface AnnotationsApi {
|
|
|
526
548
|
* annotation ids. Every one resolves through `get`. */
|
|
527
549
|
selection(): readonly string[];
|
|
528
550
|
/** Replace the selection. An id naming a target or a mark that is not
|
|
529
|
-
* there is dropped, the way `update` and `remove` ignore one.
|
|
551
|
+
* there is dropped, the way `update` and `remove` ignore one. Under an
|
|
552
|
+
* `'exclusive'` selection, so is every id outside the first id's target. */
|
|
530
553
|
setSelection(ids: readonly string[]): void;
|
|
531
554
|
/** Fires after every mutation *and* after a selection change — weasel keeps
|
|
532
555
|
* a canvas's selection on the scene, so both already arrive on this one
|
|
533
|
-
* channel.
|
|
556
|
+
* channel. A selection change touching several targets is one event. No
|
|
557
|
+
* delta: re-query, and re-read `selection()`. */
|
|
534
558
|
subscribe(fn: () => void): () => void;
|
|
535
559
|
/** Whether the last mark change on any target can be taken back. Weasel
|
|
536
560
|
* history is the authority; this only decides *which* target's. */
|
|
@@ -559,7 +583,7 @@ interface AnnotationsApi {
|
|
|
559
583
|
* world (0,0) at the element's top-left, y growing downward. */
|
|
560
584
|
interface WorldSpec {
|
|
561
585
|
/** Where world (0,0) sits at `pan` zero, as a fraction of the viewport.
|
|
562
|
-
* `{x:0,y:0}` top-left (default); `{x:0.5,y:0.5}`
|
|
586
|
+
* `{x:0,y:0}` top-left (default); `{x:0.5,y:0.5}` center. */
|
|
563
587
|
origin?: Point;
|
|
564
588
|
/** Which way the world y axis runs on screen. Default `'down'`. */
|
|
565
589
|
yAxis?: 'down' | 'up';
|
|
@@ -576,7 +600,9 @@ interface WorldFrame {
|
|
|
576
600
|
originPx: Point;
|
|
577
601
|
yDir: 1 | -1;
|
|
578
602
|
}
|
|
603
|
+
/** The frame an absent `WorldSpec` resolves to: origin top-left, y down. */
|
|
579
604
|
declare const DEFAULT_FRAME: WorldFrame;
|
|
605
|
+
/** Resolve `spec` against a viewport of `size`; `undefined` gives `DEFAULT_FRAME`. */
|
|
580
606
|
declare function resolveFrame(spec: WorldSpec | undefined, size: ViewportSize): WorldFrame;
|
|
581
607
|
/** Put a 2D context into the instrument's world coordinates, so a layer's
|
|
582
608
|
* `draw` works in them. Must stay the exact inverse of `screenToWorld`. */
|
|
@@ -744,8 +770,10 @@ interface TrialChromeContext extends ToolSlotContext, SidebarSlotContext {
|
|
|
744
770
|
canRedo: boolean;
|
|
745
771
|
undo: () => void;
|
|
746
772
|
redo: () => void;
|
|
747
|
-
/** Whether the trial's
|
|
748
|
-
*
|
|
773
|
+
/** Whether a `<TrialLoupe>` following the trial's toggle is mounted in it.
|
|
774
|
+
* The loupe toggle is offered only while one is. */
|
|
775
|
+
hasLoupe: boolean;
|
|
776
|
+
/** Whether the trial's loupe is turned on. */
|
|
749
777
|
loupeOn: boolean;
|
|
750
778
|
toggleLoupe: () => void;
|
|
751
779
|
/** The instrument's controls, resolved against the lab's rules. Always
|
|
@@ -780,83 +808,6 @@ interface TrialChromeContext extends ToolSlotContext, SidebarSlotContext {
|
|
|
780
808
|
close: () => void;
|
|
781
809
|
}
|
|
782
810
|
|
|
783
|
-
/** A point on the magnified surface, in its own CSS pixels. */
|
|
784
|
-
interface LoupePoint {
|
|
785
|
-
x: number;
|
|
786
|
-
y: number;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
/** How a loupe magnifies. `'vector'` re-renders the source through a zoomed-in
|
|
790
|
-
* view, so content stays sharp at any factor; `'pixel'` blows up the actual
|
|
791
|
-
* pixels the surface presented. */
|
|
792
|
-
type LoupeMode = 'vector' | 'pixel';
|
|
793
|
-
|
|
794
|
-
/** What a DOM instrument's loupe `render` is handed: the same data its own
|
|
795
|
-
* `render` gets, and the camera to draw it through. */
|
|
796
|
-
interface LoupeRenderArgs<TS = unknown, TC = unknown> {
|
|
797
|
-
state: TS;
|
|
798
|
-
config: TC;
|
|
799
|
-
/** The trial's own camera composed with the magnification, about the aimed
|
|
800
|
-
* point — so drawing the same content through it magnifies in place. */
|
|
801
|
-
view: ViewTransform;
|
|
802
|
-
/** The magnification on its own, for whatever must not scale with the
|
|
803
|
-
* camera. */
|
|
804
|
-
factor: number;
|
|
805
|
-
mode: LoupeMode;
|
|
806
|
-
/** The size of the viewport `view` is written for: the trial's content well,
|
|
807
|
-
* not the lens. The lens shows a circle cut out of it. */
|
|
808
|
-
size: ViewportSize;
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Declares that an instrument can be magnified.
|
|
812
|
-
*
|
|
813
|
-
* With no `render`, the loupe re-draws the instrument's canvas layers through a
|
|
814
|
-
* zoomed camera, so it stays sharp at any factor. An instrument whose content is
|
|
815
|
-
* DOM supplies `render` instead: given a camera, draw me again.
|
|
816
|
-
*/
|
|
817
|
-
interface LoupeCapability<TS = unknown, TC = unknown> {
|
|
818
|
-
render?: (args: LoupeRenderArgs<TS, TC>) => ReactNode;
|
|
819
|
-
/** Opening magnification, clamped to the bounds below. Default 6. */
|
|
820
|
-
factor?: number;
|
|
821
|
-
/** What the wheel clamps to. Defaults 2 and 32. */
|
|
822
|
-
minFactor?: number;
|
|
823
|
-
maxFactor?: number;
|
|
824
|
-
/** `'vector'` (default) re-renders the content magnified; `'pixel'` blows up
|
|
825
|
-
* the pixels the instrument presented. A `render` loupe is always vector —
|
|
826
|
-
* DOM has no framebuffer to enlarge. */
|
|
827
|
-
mode?: LoupeMode;
|
|
828
|
-
/** Lens diameter in CSS px. Default 200. */
|
|
829
|
-
diameter?: number;
|
|
830
|
-
/** Held for a momentary peek while the loupe is off. Default `'Alt'`; `null`
|
|
831
|
-
* turns hold-to-peek off. Matched against `KeyboardEvent.key`. */
|
|
832
|
-
peekKey?: string | null;
|
|
833
|
-
/** Called with the color under the aim, wherever the surface can say. The
|
|
834
|
-
* canvas painter reads it back; a DOM loupe has no pixels to sample. */
|
|
835
|
-
onColorChange?: (hex: string) => void;
|
|
836
|
-
}
|
|
837
|
-
/** An instrument's loupe declaration. `true` takes every default. */
|
|
838
|
-
type LoupeDeclaration<TS = unknown, TC = unknown> = true | LoupeCapability<TS, TC>;
|
|
839
|
-
/** A {@link LoupeCapability} with every default filled in. */
|
|
840
|
-
interface ResolvedLoupe<TS = unknown, TC = unknown> {
|
|
841
|
-
render?: (args: LoupeRenderArgs<TS, TC>) => ReactNode;
|
|
842
|
-
onColorChange?: (hex: string) => void;
|
|
843
|
-
factor: number;
|
|
844
|
-
minFactor: number;
|
|
845
|
-
maxFactor: number;
|
|
846
|
-
mode: LoupeMode;
|
|
847
|
-
diameter: number;
|
|
848
|
-
peekKey: string | null;
|
|
849
|
-
}
|
|
850
|
-
declare const LOUPE_DEFAULTS: {
|
|
851
|
-
readonly factor: 6;
|
|
852
|
-
readonly minFactor: 2;
|
|
853
|
-
readonly maxFactor: 32;
|
|
854
|
-
readonly mode: "vector";
|
|
855
|
-
readonly diameter: 200;
|
|
856
|
-
readonly peekKey: "Alt";
|
|
857
|
-
};
|
|
858
|
-
declare function resolveLoupe<TS, TC>(declared: LoupeDeclaration<TS, TC>): ResolvedLoupe<TS, TC>;
|
|
859
|
-
|
|
860
811
|
/**
|
|
861
812
|
* A tool a trial can be in. labkit's own — core's `ToolsApi` carries hotkey
|
|
862
813
|
* slots, ambient tools, eligibility tiers and canvas overlay layers, all bound
|
|
@@ -1070,11 +1021,6 @@ interface Instrument<TS = unknown, TC = unknown, TItem = unknown> {
|
|
|
1070
1021
|
* is allowed to mean. Declaring it is what makes the trial provide the
|
|
1071
1022
|
* annotation overlay and its chrome. */
|
|
1072
1023
|
annotations?: AnnotationsCapability<TS, TC>;
|
|
1073
|
-
/** Magnification. `true` takes every default and re-draws the instrument's
|
|
1074
|
-
* canvas layers through a zoomed camera; an instrument whose content is DOM
|
|
1075
|
-
* gives a `render` that draws it again at a camera it is handed. A function
|
|
1076
|
-
* is re-read as the config changes, so a setting can drive the lens. */
|
|
1077
|
-
loupe?: LoupeDeclaration<TS, TC> | ((config: TC) => LoupeDeclaration<TS, TC>);
|
|
1078
1024
|
/** Chrome this instrument contributes beyond what its capabilities imply. */
|
|
1079
1025
|
chrome?: TrialContribution[];
|
|
1080
1026
|
/** Work too slow to do during a render. The runtime starts it, aborts it on
|
|
@@ -1086,5 +1032,5 @@ interface Instrument<TS = unknown, TC = unknown, TItem = unknown> {
|
|
|
1086
1032
|
* an `Instrument<unknown, unknown>[]`; it is contained to this alias. */
|
|
1087
1033
|
type InstrumentList = readonly Instrument<any, any, any>[];
|
|
1088
1034
|
|
|
1089
|
-
export { DEFAULT_FRAME as D,
|
|
1090
|
-
export type {
|
|
1035
|
+
export { DEFAULT_FRAME as D, fracEncloses as aA, fracToWorld as aB, isAuto as aC, markCommands as aD, roundFrac as aE, worldToFrac as aF, annotationsFromJSON as av, auto as aw, createAnnotationScene as ax, createAnnotationStore as ay, fracContains as az, dockPanel as j, applyCamera as k, panelKey as p, resolveFrame as r, undockPanel as u };
|
|
1036
|
+
export type { AnnotationSelectionMode as $, AnnotationMeaning as A, CaptureResult as B, CreateLabStoreOptions as C, PaintableMark as E, AnnotationTarget as F, AnnotationsApi as G, AnnotationsCapability as H, InstrumentSerializers as I, TrialInfo as J, TrialTool as K, LabDocument as L, Migration as M, AnnotationKind as N, Instrument as O, Point as P, LabDensity as Q, TrialContribution as R, SerializedTrial as S, TrialRecord as T, UndoStack as U, ViewportSize as V, WorldFrame as W, Annotation as X, AnnotationInit as Y, AnnotationPatch as Z, AnnotationQuery as _, ViewTransform as a, AnnotationStatus as a0, AnnotationStoreOptions as a1, AnnotationTargetInfo as a2, AnnotationToolId as a3, Auto as a4, CanvasCapability as a5, CanvasLayer as a6, CaptureDeps as a7, ContributionBase as a8, FracPoint as a9, FracRect as aa, HitResult as ab, IconComponent as ac, LayerCapability as ad, LayerDescriptor as ae, RegionContribution as af, RenderContext as ag, SerializedAnnotations as ah, SidebarSection as ai, SidebarSlotContext as aj, StageCapability as ak, StatusReadout as al, SystemEvent as am, ToolCapability as an, ToolItem as ao, ToolSlotContext as ap, ToolbarItem as aq, TrialChromeContext as ar, TrialRegion as as, UndoCapability as at, ViewportControl as au, WorldSpec as b, StorageAdapter as c, LabStoreState as d, SavedSnapshot as e, StorageChange as f, TrialStateHandle as g, UndockedPanel as h, UndockedPanels as i, PaletteItem as l, DragFeedback as m, DragDropCapability as n, LabMode as o, InstrumentList as q, InstrumentHooks as s, AnnotationData as t, WorldRect as v, MarkStyle as w, MarkScene as x, CaptureSource as y, CaptureOptions as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Display } from '@weasel-js/quantity';
|
|
2
|
+
import { PrefNumberUnit, PrefRenderer, PrefLeaf, PrefGroup } from '@weasel-js/ui';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ToolPrefNumberUnit, ToolPrefLeaf, ToolPrefGroup } from '@weasel-js/core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Renders the control cell for one config leaf. Identical to weasel-ui's
|
|
@@ -13,7 +13,8 @@ interface ConfigOption {
|
|
|
13
13
|
value: string;
|
|
14
14
|
label: string;
|
|
15
15
|
/** A glyph in weasel-ui's icon set (`IconName`). A segmented row draws it in
|
|
16
|
-
* place of `label`, which stays the accessible name and becomes the tooltip
|
|
16
|
+
* place of `label`, which stays the accessible name and becomes the tooltip;
|
|
17
|
+
* a select draws it beside `label`. */
|
|
17
18
|
icon?: string;
|
|
18
19
|
}
|
|
19
20
|
/** Everything a leaf can carry beyond its kind and default. A flat union of
|
|
@@ -32,7 +33,7 @@ interface Annotations {
|
|
|
32
33
|
display?: Display;
|
|
33
34
|
/** Display-unit conversion for a number stored in a canonical unit — the
|
|
34
35
|
* value, its bounds and its step all convert at the control's edge. */
|
|
35
|
-
unit?:
|
|
36
|
+
unit?: PrefNumberUnit;
|
|
36
37
|
/** A color leaf's value carries alpha (`#rrggbbaa`) and its row edits it. */
|
|
37
38
|
alpha?: boolean;
|
|
38
39
|
control?: string;
|
|
@@ -93,7 +94,7 @@ interface SectionSpec {
|
|
|
93
94
|
interface ResolvedConfig {
|
|
94
95
|
/** The schema as a `PrefGroup` tree: an `f.group` is a nested group, so a
|
|
95
96
|
* leaf's dotted path within it is the path its value is written at. */
|
|
96
|
-
group:
|
|
97
|
+
group: PrefGroup;
|
|
97
98
|
sections: readonly SectionSpec[];
|
|
98
99
|
showIf: ReadonlyMap<string, (config: Record<string, unknown>) => boolean>;
|
|
99
100
|
/** Node-level `.render` overrides, keyed by path. */
|
|
@@ -135,7 +136,7 @@ interface NodeOptions extends BranchOptions {
|
|
|
135
136
|
* config entry records it, and `ControlPanel` draws it. */
|
|
136
137
|
dialog?: DialogSpec;
|
|
137
138
|
/** Errors for this leaf under `config`, the instrument's whole config. */
|
|
138
|
-
validate?: (leaf:
|
|
139
|
+
validate?: (leaf: PrefLeaf, config: Record<string, unknown>) => string[];
|
|
139
140
|
/** Computes this leaf's value while it is auto. Attaching one is what gives
|
|
140
141
|
* the row a real value to pin back to and keeps the instrument off
|
|
141
142
|
* `?? compute()`. */
|
|
@@ -278,4 +279,4 @@ interface ColorField extends ConfigFieldBase {
|
|
|
278
279
|
* panel renders, and what `validateConfigSchema` checks. */
|
|
279
280
|
type ConfigField = SliderField | CheckboxField | SelectField | NumberField | TextField | ColorField;
|
|
280
281
|
|
|
281
|
-
export type { Annotations as A, BranchAnnotations as B,
|
|
282
|
+
export type { Annotations as A, BranchAnnotations as B, ConfigSchema as C, DialogSpec as D, EntryValue as E, InDialogOptions as I, LeafPatch as L, NodeOptions as N, ResolvedConfig as R, SectionOption as S, TextField as T, ValueAtPath as V, ConfigField as a, ConfigRule as b, ControlRenderer as c, BranchOptions as d, CheckboxField as e, ColorField as f, ConfigBranch as g, ConfigEntry as h, ConfigFieldBase as i, ConfigFieldType as j, ConfigNode as k, ConfigOf as l, ConfigOption as m, ConfigPath as n, ConfigRuleContext as o, ConfigShape as p, InferConfig as q, NodeValue as r, NumberField as s, SectionSpec as t, SelectField as u, SelectOption as v, SliderField as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as StorageAdapter,
|
|
1
|
+
import { c as StorageAdapter, d as LabStoreState, T as TrialRecord, e as SavedSnapshot, o as LabMode, h as UndockedPanel, q as InstrumentList, s as InstrumentHooks, C as CreateLabStoreOptions, g as TrialStateHandle } from './index-DCMA4Fy1.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, ReactElement, Dispatch, SetStateAction } from 'react';
|
|
4
4
|
import { StoreApi } from 'zustand/vanilla';
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export { C as CameraContext, a as CameraContextValue, b as CameraInput, c as CameraInputProps, d as CameraPublishContext, e as CameraRegistry, f as CameraRegistryContext, g as CameraScope, h as CameraView, i as CameraViewOptions, j as CanvasStack, k as CanvasStackProps, S as STAGE_VIEW_ID, l as Stage, m as StageProps, Z as ZoomAtOptions, n as ZoomRange, o as centerOn, p as createCameraRegistry, q as fitStage, s as screenToWorld, u as useCameraView, r as usePublishCamera, w as worldToScreen, z as zoomAt } from '../_dts/Stage-
|
|
1
|
+
export { C as CameraContext, a as CameraContextValue, b as CameraInput, c as CameraInputProps, d as CameraPublishContext, e as CameraRegistry, f as CameraRegistryContext, g as CameraScope, h as CameraView, i as CameraViewOptions, j as CanvasStack, k as CanvasStackProps, S as STAGE_VIEW_ID, l as Stage, m as StageProps, Z as ZoomAtOptions, n as ZoomRange, o as centerOn, p as createCameraRegistry, q as fitStage, s as screenToWorld, u as useCameraView, r as usePublishCamera, w as worldToScreen, z as zoomAt } from '../_dts/Stage-D6t7o0pF.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from '../_dts/CanvasStackContext-
|
|
3
|
+
export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from '../_dts/CanvasStackContext-Cjy6I-Iv.js';
|
|
4
4
|
import { View } from '@weasel-js/core';
|
|
5
|
-
import { W as WorldFrame } from '../_dts/
|
|
5
|
+
import { W as WorldFrame } from '../_dts/index-DCMA4Fy1.js';
|
|
6
6
|
import { Point, ViewTransform } from '../index.js';
|
|
7
|
-
export { D as DEFAULT_FRAME, V as ViewportSize,
|
|
8
|
-
import '
|
|
7
|
+
export { D as DEFAULT_FRAME, V as ViewportSize, b as WorldSpec, k as applyCamera, r as resolveFrame } from '../_dts/index-DCMA4Fy1.js';
|
|
8
|
+
import '@weasel-js/ui';
|
|
9
9
|
import '@weasel-js/theme';
|
|
10
|
-
import '../_dts/types-
|
|
10
|
+
import '../_dts/types-BUBSIZuV.js';
|
|
11
|
+
import '@weasel-js/quantity';
|
|
12
|
+
import '@weasel-js/geom';
|
|
11
13
|
import '../_dts/types-DJ79Tg5J.js';
|
|
12
14
|
|
|
13
15
|
/** Where a trial's camera takes a wheel event from outside its own element. */
|
package/dist/canvas/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { CanvasStack, LinkedCursor, Stage, fitStage } from '../chunk-
|
|
2
|
-
export { centerOn, zoomAt } from '../chunk-
|
|
3
|
-
export { screenToWorld, worldToScreen } from '../chunk-
|
|
1
|
+
export { CanvasStack, LinkedCursor, Stage, fitStage } from '../chunk-T6DLGEJB.js';
|
|
2
|
+
export { centerOn, zoomAt } from '../chunk-ROGJWDQA.js';
|
|
3
|
+
export { screenToWorld, worldToScreen } from '../chunk-FG3EXZDV.js';
|
|
4
4
|
import '../chunk-WIG6XHJ7.js';
|
|
5
|
-
export { CameraContext, CameraInput, CameraPublishContext, CameraRegistryContext, CameraScope, CameraWheelContext, STAGE_VIEW_ID, clampZoomAbout, createCameraRegistry, frameLocalToWorld, fromCameraView, toCameraView, useCameraView, usePublishCamera } from '../chunk-
|
|
6
|
-
export { DEFAULT_FRAME, applyCamera, resolveFrame } from '../chunk-
|
|
7
|
-
export { CanvasStackContext } from '../chunk-
|
|
5
|
+
export { CameraContext, CameraInput, CameraPublishContext, CameraRegistryContext, CameraScope, CameraWheelContext, STAGE_VIEW_ID, clampZoomAbout, createCameraRegistry, frameLocalToWorld, fromCameraView, toCameraView, useCameraView, usePublishCamera } from '../chunk-VYVGVBGY.js';
|
|
6
|
+
export { DEFAULT_FRAME, applyCamera, resolveFrame } from '../chunk-ULYYNWGP.js';
|
|
7
|
+
export { CanvasStackContext } from '../chunk-ZQIHJXP4.js';
|
|
8
8
|
import '../chunk-2YILQ7Y5.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export { a as LabAsideRegion, b as LabChromeContext, L as LabContribution, e as LabFooterRegion, f as LabHeaderRegion, g as LabRegion, h as LabRegionProps, i as LabSidebarRegion, P as PaletteRegion, j as PaletteRegionProps, S as SidebarRegion, k as SidebarRegionProps, l as StatusRegion, m as StatusRegionProps, T as
|
|
2
|
-
export {
|
|
3
|
-
import '../_dts/types-
|
|
4
|
-
import '
|
|
5
|
-
import '@weasel-js/
|
|
1
|
+
export { a as LabAsideRegion, b as LabChromeContext, L as LabContribution, e as LabFooterRegion, f as LabHeaderRegion, g as LabRegion, h as LabRegionProps, i as LabSidebarRegion, P as PaletteRegion, j as PaletteRegionProps, S as SidebarRegion, k as SidebarRegionProps, l as StatusRegion, m as StatusRegionProps, T as TRANSIENT_BUILTINS, n as TitleBarPlacement, o as TitleBarRegion, p as TitleBarRegionProps, q as ToolbarRegion, r as ToolbarRegionProps, V as ViewportRegion, s as ViewportRegionProps, u as builtinContributions, x as contributionsIn, y as labContributions, z as mergeContributions, D as suppressContributions, E as toolContributions, F as useLabChromeContext } from '../_dts/index-BTmaRy6a.js';
|
|
2
|
+
export { a8 as ContributionBase, ac as IconComponent, af as RegionContribution, ai as SidebarSection, aj as SidebarSlotContext, al as StatusReadout, ao as ToolItem, ap as ToolSlotContext, aq as ToolbarItem, ar as TrialChromeContext, R as TrialContribution, as as TrialRegion, au as ViewportControl } from '../_dts/index-DCMA4Fy1.js';
|
|
3
|
+
import '../_dts/types-BUBSIZuV.js';
|
|
4
|
+
import '@weasel-js/quantity';
|
|
5
|
+
import '@weasel-js/ui';
|
|
6
6
|
import 'react';
|
|
7
7
|
import '@weasel-js/core';
|
|
8
|
+
import '@weasel-js/theme';
|
|
9
|
+
import '@weasel-js/geom';
|
|
8
10
|
import '../_dts/types-DJ79Tg5J.js';
|
package/dist/chrome/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export { LabAsideRegion, LabFooterRegion, LabHeaderRegion, LabSidebarRegion, PaletteRegion, SidebarRegion, StatusRegion, TitleBarRegion, ToolbarRegion, ViewportRegion, builtinContributions, contributionsIn, labContributions, mergeContributions, suppressContributions, toolContributions, useLabChromeContext } from '../chunk-
|
|
1
|
+
export { LabAsideRegion, LabFooterRegion, LabHeaderRegion, LabSidebarRegion, PaletteRegion, SidebarRegion, StatusRegion, TRANSIENT_BUILTINS, TitleBarRegion, ToolbarRegion, ViewportRegion, builtinContributions, contributionsIn, labContributions, mergeContributions, suppressContributions, toolContributions, useLabChromeContext } from '../chunk-GAHELLJT.js';
|
|
2
2
|
import '../chunk-3RY6WL5T.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-CEGFXTBD.js';
|
|
4
4
|
import '../chunk-CZZPXUOU.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-PMLZP7RT.js';
|
|
6
|
+
import '../chunk-JFOJESJF.js';
|
|
7
7
|
import '../chunk-Z76KEZAX.js';
|
|
8
|
-
import '../chunk-
|
|
9
|
-
import '../chunk-
|
|
10
|
-
import '../chunk-
|
|
8
|
+
import '../chunk-WLMDTI2Q.js';
|
|
9
|
+
import '../chunk-READTDQX.js';
|
|
10
|
+
import '../chunk-ZQIHJXP4.js';
|
|
11
11
|
import '../chunk-2YILQ7Y5.js';
|
|
12
|
-
import '../chunk-
|
|
13
|
-
import '../chunk-
|
|
12
|
+
import '../chunk-4KSC7NXL.js';
|
|
13
|
+
import '../chunk-E23Q6A3Y.js';
|
|
14
|
+
import '../chunk-XVUKDSYV.js';
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/trial/loupeSwitch.ts"],"names":[],"mappings":";;;AAcO,IAAM,kBAAA,GAAqB,cAAkC,IAAI","file":"chunk-2ES4W47N.js","sourcesContent":["import { createContext } from 'react';\n\n/**\n * A trial's loupe switch, as a lens mounted inside the trial finds it. The\n * trial offers its toolbar toggle while at least one lens has called `mount`,\n * and every lens reads `on` as whether it is turned on.\n */\nexport interface LoupeSwitch {\n on: boolean;\n /** Reports a lens mounted; the returned function reports it gone. */\n mount: () => () => void;\n}\n\n/** The loupe switch of the trial around the caller, or `null` outside one. */\nexport const LoupeSwitchContext = createContext<LoupeSwitch | null>(null);\n"]}
|