@weasel-js/labkit 1.4.4 → 1.5.0
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 +13 -2
- package/dist/_dts/{CanvasStackContext-kTEZvEgE.d.ts → CanvasStackContext-CqkxkFJW.d.ts} +1 -1
- package/dist/_dts/ToggleBar.d-DbHoWKIA.d.ts +116 -0
- package/dist/_dts/{frac-z7ker2Vx.d.ts → frac-8R6UmlvN.d.ts} +253 -31
- package/dist/_dts/index-B8uu2ba7.d.ts +237 -0
- package/dist/_dts/{index-Blv9uQzu.d.ts → index-retnAut7.d.ts} +18 -10
- package/dist/_dts/{types-B9_zrHmb.d.ts → types-Ca2LCnPq.d.ts} +65 -2
- package/dist/_dts/usePanZoom-nS798rOF.d.ts +160 -0
- package/dist/_dts/useTrialState-jcx_TdU6.d.ts +212 -0
- package/dist/canvas/index.d.ts +17 -128
- package/dist/canvas/index.js +4 -2
- package/dist/chrome/index.d.ts +4 -92
- package/dist/chrome/index.js +9 -5
- package/dist/chunk-67SJLMC7.js +704 -0
- package/dist/chunk-67SJLMC7.js.map +1 -0
- package/dist/chunk-6ZDGOZQV.js +310 -0
- package/dist/chunk-6ZDGOZQV.js.map +1 -0
- package/dist/{chunk-MOM3GOVY.js → chunk-EKIICY6X.js} +111 -25
- package/dist/chunk-EKIICY6X.js.map +1 -0
- package/dist/{chunk-CTRKTLYZ.js → chunk-H6ZAOWNE.js} +11 -11
- package/dist/chunk-H6ZAOWNE.js.map +1 -0
- package/dist/{chunk-SMHP6XZ4.js → chunk-KJALCDWE.js} +9 -7
- package/dist/chunk-KJALCDWE.js.map +1 -0
- package/dist/{chunk-BKFVHKJH.js → chunk-MUKOW3TC.js} +3 -3
- package/dist/{chunk-BKFVHKJH.js.map → chunk-MUKOW3TC.js.map} +1 -1
- package/dist/chunk-NDRYLVOW.js +15 -0
- package/dist/chunk-NDRYLVOW.js.map +1 -0
- package/dist/{chunk-64ZCN3DA.js → chunk-NS64DXMN.js} +226 -159
- package/dist/chunk-NS64DXMN.js.map +1 -0
- package/dist/{chunk-I6JCVE24.js → chunk-PGETSEDK.js} +135 -13
- package/dist/chunk-PGETSEDK.js.map +1 -0
- package/dist/{chunk-FQMJUVHJ.js → chunk-QLSV2N3G.js} +32 -37
- package/dist/chunk-QLSV2N3G.js.map +1 -0
- package/dist/chunk-RWNDDKOH.js +682 -0
- package/dist/chunk-RWNDDKOH.js.map +1 -0
- package/dist/chunk-S2SHZRD7.js +7681 -0
- package/dist/chunk-S2SHZRD7.js.map +1 -0
- package/dist/{chunk-U3IYHIAE.js → chunk-TQBBYTAF.js} +19 -82
- package/dist/chunk-TQBBYTAF.js.map +1 -0
- package/dist/chunk-UU3NJO6N.js +72 -0
- package/dist/chunk-UU3NJO6N.js.map +1 -0
- package/dist/chunk-WIG6XHJ7.js +35 -0
- package/dist/chunk-WIG6XHJ7.js.map +1 -0
- package/dist/{chunk-TJ7QY3OC.js → chunk-ZPH5WTWF.js} +21 -15
- package/dist/chunk-ZPH5WTWF.js.map +1 -0
- package/dist/config/index.d.ts +232 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controls/index.d.ts +2 -3
- package/dist/controls/index.js +3 -2
- package/dist/dragdrop/index.d.ts +2 -4
- package/dist/index.d.ts +110 -381
- package/dist/index.js +691 -817
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +3 -5
- package/dist/layers/index.js +2 -2
- package/dist/loupe/index.d.ts +6 -8
- package/dist/loupe/index.js +2 -2
- package/dist/passthrough/weasel-ui.d.ts +164 -122
- package/dist/passthrough/weasel-ui.js +1 -1
- package/dist/primitives/index.d.ts +53 -6
- package/dist/primitives/index.js +6 -4
- package/dist/state/index.d.ts +12 -7
- package/dist/state/index.js +16 -13
- package/dist/state/index.js.map +1 -1
- package/dist/styles.css +84 -50
- package/dist/surface/index.d.ts +44 -7
- package/dist/surface/index.js +2 -1
- package/dist/ui/layers/index.js +1 -1
- package/dist/undo/index.d.ts +2 -4
- package/package.json +15 -8
- package/src/annotations/AnnotationOverlay.tsx +53 -5
- package/src/annotations/Annotations.overlay.test.tsx +85 -6
- package/src/annotations/drawOne.test.ts +1 -1
- package/src/annotations/drawOne.ts +2 -2
- package/src/annotations/paint.test.ts +2 -2
- package/src/annotations/paint.ts +1 -1
- package/src/annotations/preload.ts +6 -0
- package/src/annotations/store.test.ts +18 -0
- package/src/annotations/store.ts +5 -4
- package/src/annotations/svgNodes.test.ts +2 -2
- package/src/annotations/toolMap.ts +3 -3
- package/src/annotations/types.ts +6 -3
- package/src/canvas/CameraWheelContext.ts +12 -0
- package/src/canvas/CanvasStack.test.tsx +25 -0
- package/src/canvas/CanvasStack.tsx +31 -4
- package/src/canvas/Stage.less +18 -0
- package/src/canvas/Stage.test.tsx +186 -0
- package/src/canvas/Stage.tsx +134 -0
- package/src/canvas/camera.test.ts +17 -2
- package/src/canvas/camera.ts +9 -9
- package/src/canvas/index.ts +4 -0
- package/src/canvas/usePanZoom.ts +10 -5
- package/src/chrome/ChromeRegions.stories.tsx +0 -3
- package/src/chrome/LabChrome.tsx +114 -0
- package/src/chrome/builtins.tsx +20 -31
- package/src/chrome/index.ts +15 -0
- package/src/chrome/labRegions.test.tsx +208 -0
- package/src/chrome/labTypes.ts +50 -0
- package/src/chrome/merge.ts +7 -9
- package/src/chrome/regions/PaletteRegion.test.tsx +6 -4
- package/src/chrome/regions/PaletteRegion.tsx +21 -9
- package/src/chrome/regions/SidebarRegion.tsx +25 -13
- package/src/chrome/regions/StatusRegion.tsx +15 -8
- package/src/chrome/regions/ToolbarRegion.tsx +30 -16
- package/src/chrome/types.ts +47 -20
- package/src/config/builder.test.ts +4 -0
- package/src/config/builder.ts +16 -10
- package/src/config/declarationEmit.fixture.ts +11 -0
- package/src/config/declarationEmit.test.ts +51 -0
- package/src/config/entry.test.ts +46 -0
- package/src/config/index.ts +13 -1
- package/src/config/nodeClasses.test.ts +18 -0
- package/src/config/types.ts +3 -1
- package/src/controls/ControlPanel.test.tsx +16 -0
- package/src/controls/ControlPanel.tsx +5 -2
- package/src/fake-indexeddb-auto.d.ts +5 -0
- package/src/index.test.ts +7 -0
- package/src/index.ts +38 -5
- package/src/instrument/serializers.test.ts +22 -0
- package/src/instrument/serializers.ts +11 -0
- package/src/instrument/types.ts +25 -1
- package/src/lab/Lab.less +4 -13
- package/src/lab/Lab.persist.test.tsx +147 -0
- package/src/lab/Lab.stories.tsx +0 -2
- package/src/lab/Lab.surface.test.tsx +66 -3
- package/src/lab/Lab.test.tsx +91 -17
- package/src/lab/Lab.tsx +337 -124
- package/src/lab/LabFit.stories.less +18 -0
- package/src/lab/LabFit.stories.tsx +219 -0
- package/src/lab/LabFullChrome.stories.tsx +0 -3
- package/src/lab/LabHeader.test.tsx +40 -9
- package/src/lab/LabHeader.tsx +7 -13
- package/src/lab/LabPalette.tsx +13 -26
- package/src/lab/LabShell.less +49 -12
- package/src/lab/LabSwitcher.less +8 -1
- package/src/lab/Workspace.surface.test.tsx +2 -1
- package/src/lab/fitCheck.test.ts +57 -0
- package/src/lab/fitCheck.ts +125 -0
- package/src/loupe/AGENTS.md +1 -1
- package/src/loupe/Loupe.less +1 -1
- package/src/loupe/canvasLens.ts +1 -1
- package/src/loupe/types.ts +1 -1
- package/src/loupe/useLoupe.test.tsx +1 -1
- package/src/loupe/useLoupe.ts +1 -1
- package/src/passthrough/weasel-ui.ts +9 -0
- package/src/primitives/FloatingPanel.stories.tsx +13 -1
- package/src/primitives/FloatingPanel.test.tsx +47 -16
- package/src/primitives/FloatingPanel.tsx +11 -25
- package/src/primitives/Split.less +14 -0
- package/src/primitives/Split.test.tsx +108 -0
- package/src/primitives/Split.tsx +159 -0
- package/src/primitives/ZoomControl.tsx +5 -2
- package/src/primitives/index.ts +2 -0
- package/src/state/Persistence.stories.tsx +75 -0
- package/src/state/Persistence.tsx +33 -0
- package/src/state/SingletonExperiment.test.tsx +47 -53
- package/src/state/SingletonExperiment.tsx +24 -13
- package/src/state/adapterContract.ts +116 -0
- package/src/state/adapters.test.ts +113 -61
- package/src/state/adapters.ts +328 -69
- package/src/state/document.test.ts +71 -96
- package/src/state/document.ts +66 -52
- package/src/state/helpers.test.ts +1 -1
- package/src/state/index.ts +8 -0
- package/src/state/labRecords.test.ts +105 -0
- package/src/state/labRecords.ts +160 -0
- package/src/state/openLabStore.test.ts +658 -0
- package/src/state/openLabStore.ts +403 -0
- package/src/state/records.test.ts +234 -0
- package/src/state/records.ts +219 -0
- package/src/state/store.test.ts +104 -635
- package/src/state/store.ts +116 -157
- package/src/state/toolSlot.test.ts +1 -1
- package/src/state/types.ts +39 -15
- package/src/state/useOpenOnce.ts +68 -0
- package/src/state/usePersistedState.test.tsx +125 -0
- package/src/state/usePersistedState.ts +66 -0
- package/src/state/useTrialState.test.tsx +2 -3
- package/src/state/view.test.ts +49 -15
- package/src/state/view.ts +18 -1
- package/src/styles.less +2 -0
- package/src/surface/AGENTS.md +39 -7
- package/src/surface/SurfaceContext.ts +26 -3
- package/src/surface/index.ts +2 -0
- package/src/surface/useSurfaceTile.test.tsx +2 -1
- package/src/surface/useSurfaceTile.ts +6 -5
- package/src/surface/useTiledSurface.test.tsx +175 -0
- package/src/surface/useTiledSurface.ts +54 -5
- package/src/theme/Interstellar.stories.tsx +7 -7
- package/src/theme/interstellar.test.ts +1 -1
- package/src/theme/interstellar.tokens.json +2 -2
- package/src/tools/labTool.ts +11 -0
- package/src/trial/Trial.annotations.persist.test.tsx +100 -58
- package/src/trial/Trial.annotations.test.tsx +47 -4
- package/src/trial/Trial.job.test.tsx +3 -3
- package/src/trial/Trial.less +1 -26
- package/src/trial/Trial.stories.tsx +1 -2
- package/src/trial/Trial.test.tsx +28 -4
- package/src/trial/Trial.trialId.test.tsx +23 -1
- package/src/trial/Trial.tsx +118 -38
- package/src/trial/TrialBody.tsx +17 -141
- package/src/trial/TrialChrome.tsx +7 -4
- package/src/trial/trialOps.ts +5 -3
- package/dist/_dts/types-BP2OCcpg.d.ts +0 -155
- package/dist/_dts/types-x92Kfeme.d.ts +0 -62
- package/dist/_dts/useTrialState-D6Vb3T-g.d.ts +0 -99
- package/dist/chunk-2P6PP5N4.js +0 -553
- package/dist/chunk-2P6PP5N4.js.map +0 -1
- package/dist/chunk-64ZCN3DA.js.map +0 -1
- package/dist/chunk-CTRKTLYZ.js.map +0 -1
- package/dist/chunk-FQMJUVHJ.js.map +0 -1
- package/dist/chunk-I6JCVE24.js.map +0 -1
- package/dist/chunk-MOM3GOVY.js.map +0 -1
- package/dist/chunk-SMHP6XZ4.js.map +0 -1
- package/dist/chunk-TJ7QY3OC.js.map +0 -1
- package/dist/chunk-U3IYHIAE.js.map +0 -1
- package/dist/chunk-W3ECWC2K.js +0 -7335
- package/dist/chunk-W3ECWC2K.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
export { B as Button, a as ButtonProps, b as ButtonSize, c as ButtonVariant, T as ToggleBar, d as ToggleBarItem, e as ToggleBarProps, f as ToggleBarSize, g as ToggleBarVariant } from './_dts/ToggleBar.d-DbHoWKIA.js';
|
|
1
2
|
export { LayerStack, LayerStackItem, LayerStackProps } from './ui/layers/index.js';
|
|
2
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as react from 'react';
|
|
4
5
|
import { ReactNode } from 'react';
|
|
5
|
-
import { P as PropertyMetricProps, a as PropertyListPack } from './_dts/index-
|
|
6
|
-
export { C as CheckboxRow, b as CheckboxRowProps, c as ColorRow, d as ColorRowProps, e as ControlPanel, N as NumberRow, f as NumberRowProps, g as PropertyList, h as PropertyListProps, i as PropertyOption, j as PropertyPanel, k as PropertyPanelProps, l as PropertyRow, m as PropertyRowLayout, n as PropertyRowProps, o as PropertyRowVariant, p as PropertySpan, q as PropertySpanProps, S as SelectRow, r as SelectRowProps, s as SliderRow, t as SliderRowProps, T as TextRow, u as TextRowProps, v as ToggleRow, w as ToggleRowProps } from './_dts/index-
|
|
7
|
-
import { DrawCommand, SceneNode, View, Path, FillStyle, StyledRun, TextStyle, Stroke, BuiltinToolId
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export { C as
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
import { b as
|
|
16
|
-
export { k as ConfigOf, C as ConfigPath, E as EntryValue,
|
|
17
|
-
import { C as ConfigField } from './_dts/types-x92Kfeme.js';
|
|
18
|
-
export { a as CheckboxField, b as ColorField, c as ConfigFieldBase, d as ConfigFieldType, N as NumberField, S as SelectField, e as SelectOption, f as SliderField, T as TextField } from './_dts/types-x92Kfeme.js';
|
|
6
|
+
import { P as PropertyMetricProps, a as PropertyListPack } from './_dts/index-retnAut7.js';
|
|
7
|
+
export { C as CheckboxRow, b as CheckboxRowProps, c as ColorRow, d as ColorRowProps, e as ControlPanel, N as NumberRow, f as NumberRowProps, g as PropertyList, h as PropertyListProps, i as PropertyOption, j as PropertyPanel, k as PropertyPanelProps, l as PropertyRow, m as PropertyRowLayout, n as PropertyRowProps, o as PropertyRowVariant, p as PropertySpan, q as PropertySpanProps, S as SelectRow, r as SelectRowProps, s as SliderRow, t as SliderRowProps, T as TextRow, u as TextRowProps, v as ToggleRow, w as ToggleRowProps } from './_dts/index-retnAut7.js';
|
|
8
|
+
import { DrawCommand, SceneNode, View, Path, FillStyle, StyledRun, TextStyle, Stroke, BuiltinToolId } from '@weasel-js/core';
|
|
9
|
+
import { t as WorldRect, A as AnnotationData, v as AnnotationMeaning, w as MarkScene, x as CaptureSource, y as CaptureOptions, z as CaptureResult, B as AnnotationTarget, E as AnnotationsApi, F as AnnotationsCapability, G as TrialInfo, H as TrialTool, J as AnnotationKind, k as ViewTransform, K as Instrument, q as InstrumentList, o as LabMode, N as TrialContribution, c as StorageAdapter, T as TrialRecord } from './_dts/frac-8R6UmlvN.js';
|
|
10
|
+
export { O as Annotation, Q as AnnotationInit, R as AnnotationPatch, X as AnnotationQuery, Y as AnnotationStatus, Z as AnnotationStoreOptions, _ as AnnotationTargetInfo, $ as CanvasCapability, a0 as CanvasLayer, a1 as CaptureDeps, a2 as ContributionBase, C as CreateLabStoreOptions, D as DEFAULT_FRAME, n as DragDropCapability, m as DragFeedback, a3 as FracPoint, a4 as FracRect, a5 as HitResult, a6 as IconComponent, a7 as LOUPE_DEFAULTS, L as LabDocument, d as LabStoreState, a8 as LayerCapability, a9 as LayerDescriptor, aa as LoupeCapability, ab as LoupeDeclaration, ac as LoupeRenderArgs, P as PaletteItem, l as Point, ad as RegionContribution, ae as RenderContext, af as ResolvedLoupe, e as SavedSnapshot, ag as SerializedAnnotations, S as SerializedTrial, ah as SidebarSection, ai as SidebarSlotContext, aj as StageCapability, ak as StatusReadout, f as StorageChange, al as SystemEvent, am as ToolCapability, an as ToolItem, ao as ToolSlotContext, ap as ToolbarItem, aq as TrialChromeContext, ar as TrialRegion, g as TrialStateHandle, as as UndoCapability, U as UndoStack, h as UndockedPanel, i as UndockedPanels, at as ViewportControl, V as ViewportSize, W as WorldFrame, a as WorldSpec, au as annotationsFromJSON, b as applyCamera, av as createAnnotationScene, aw as createAnnotationStore, j as dockPanel, ax as fracContains, ay as fracEncloses, az as fracToWorld, p as panelKey, r as resolveFrame, aA as resolveLoupe, aB as roundFrac, u as undockPanel, aC as worldToFrac } from './_dts/frac-8R6UmlvN.js';
|
|
11
|
+
export { C as CanvasStack, a as CanvasStackProps, O as OrbitHandlers, b as OrbitView, P as PITCH_LIMIT, c as PanZoomHandlers, S as Stage, d as StageProps, U as UseOrbitOptions, e as UsePanZoomOptions, V as Vec3, Z as ZoomAtOptions, f as centerOn, g as clampPitch, h as fitStage, o as orbitAfterDrag, i as orbitAfterWheel, s as screenToWorld, u as useOrbit, j as usePanZoom, w as worldToScreen, k as wrapYaw, z as zoomAt } from './_dts/usePanZoom-nS798rOF.js';
|
|
12
|
+
export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from './_dts/CanvasStackContext-CqkxkFJW.js';
|
|
13
|
+
import { L as LabContribution } from './_dts/index-B8uu2ba7.js';
|
|
14
|
+
export { A as AddTrialOptions, a as LabChromeContext, b as LabContext, c as LabContextValue, d as LabFooterRegion, e as LabHeaderRegion, f as LabRegion, g as LabRegionProps, h as LabSidebarRegion, P as PaletteRegion, i as PaletteRegionProps, S as SidebarRegion, j as SidebarRegionProps, k as StatusRegion, l as StatusRegionProps, T as TitleBarPlacement, m as TitleBarRegion, n as TitleBarRegionProps, o as ToolbarRegion, p as ToolbarRegionProps, V as ViewportRegion, q as ViewportRegionProps, r as addTrial, s as builtinContributions, t as cloneTrial, u as closeTrial, v as contributionsIn, w as labContributions, x as mergeContributions, y as reorderTrials, z as resetTrial, B as suppressContributions, C as toolContributions, D as useLabChromeContext, E as useLabContext } from './_dts/index-B8uu2ba7.js';
|
|
15
|
+
export { BaseNode, BooleanNode, ColorNode, CustomNode, EnumNode, GroupNode, NumberNode, StringNode, ValueNode, applyRules, builtinRules, f, fillConfigDefaults, fromConfigFields, hasConfigPath, isConfigBranch, isLeafVisible, resolveConfigSchema, schemaNodeAtPath, titleCase, useConfigSchema, valueAtPath, withValueAtPath } from './config/index.js';
|
|
16
|
+
import { b as ConfigSchema, a as ConfigField, c as ConfigRule, d as ControlRenderer } from './_dts/types-Ca2LCnPq.js';
|
|
17
|
+
export { A as Annotations, B as BranchAnnotations, e as BranchOptions, f as CheckboxField, g as ColorField, h as ConfigBranch, i as ConfigEntry, j as ConfigFieldBase, k as ConfigFieldType, l as ConfigNode, m as ConfigOf, n as ConfigOption, C as ConfigPath, o as ConfigRuleContext, p as ConfigShape, E as EntryValue, I as InferConfig, L as LeafPatch, N as NodeOptions, q as NodeValue, r as NumberField, R as ResolvedConfig, S as SectionSpec, s as SelectField, t as SelectOption, u as SliderField, T as TextField, V as ValueAtPath } from './_dts/types-Ca2LCnPq.js';
|
|
19
18
|
import { J as JobHandle } from './_dts/types-DJ79Tg5J.js';
|
|
20
19
|
export { a as JobCapability, b as JobEvent, c as JobFailure, d as JobStatus } from './_dts/types-DJ79Tg5J.js';
|
|
21
20
|
export { UseJobOptions, useJob } from './job/index.js';
|
|
22
21
|
export { LayerList, LayerListProps, LayerTreeNode } from './layers/index.js';
|
|
23
22
|
export { CanvasLoupe, CanvasLoupeProps, DomLoupe, DomLoupeProps, LensCamera, LoupeBubble, LoupeBubbleProps, LoupeState, SourceRect, TrialLoupe, TrialLoupeProps, UseLoupeOptions, drawCanvasLens, lensCamera, lensSourceRect, sampleStack, useLoupe } from './loupe/index.js';
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
23
|
+
import { SplitProps } from './primitives/index.js';
|
|
24
|
+
export { FloatingPanel, FloatingPanelProps, FpsMeter, JobProgress, JobProgressProps, Legend, LegendEntry, LegendMark, LegendProps, ScaleIndicator, ScaleIndicatorProps, Sidebar, SidebarProps, Split, StatusBar, StatusBarProps, StatusBarSectionProps, Toolbar, ToolbarButtonProps, ToolbarGroupProps, ToolbarProps, ZoomControl, ZoomControlProps } from './primitives/index.js';
|
|
25
|
+
export { C as CURRENT_DOCUMENT_VERSION, I as IndexedDbAdapterOptions, b as LabStoreContext, c as LabStoreProvider, O as OpenLabStoreOptions, d as OpenedLabStore, P as PersistedStateOptions, e as Persistence, f as PersistenceProps, R as RecordCache, g as RecordChange, T as TrialIdContext, h as TrialIdProvider, i as createIndexedDbAdapter, k as createMemoryAdapter, l as indexedDbAdapter, m as labDocumentKey, n as localStorageAdapter, o as noneAdapter, p as openLabStore, q as quarantineKey, s as sessionStorageAdapter, u as urlHashAdapter, r as useLabStore, t as usePersistedState, v as useTrialId, w as useTrialState } from './_dts/useTrialState-jcx_TdU6.js';
|
|
26
|
+
export { Box, Rect, SurfaceCanvasContext, SurfaceCanvases, SurfaceClear, SurfaceContext, SurfaceFrame, SurfaceHandle, SurfaceLayer, TilePainter, UseTiledSurfaceOptions, composeRects, rectsEqual, toDeviceRect, useSurface, useSurfaceCanvas, useSurfaceOptional, useSurfaceTile, useTileId, useTiledSurface } from './surface/index.js';
|
|
27
27
|
export { EventBus, EventListener, clearUndo, createEventBus, emptyStack, pushSnapshot, redo, undo } from './undo/index.js';
|
|
28
28
|
import './_dts/PrefsForm.d-DDHFANkc.js';
|
|
29
29
|
import 'windease';
|
|
@@ -177,7 +177,7 @@ interface PaintableMark {
|
|
|
177
177
|
/** How a mark is drawn, as opposed to where. Resolved by the overlay from the
|
|
178
178
|
* instrument's vocabulary and the mark's own staleness. */
|
|
179
179
|
interface MarkStyle {
|
|
180
|
-
/** The status's
|
|
180
|
+
/** The status's color, or the default. */
|
|
181
181
|
color?: string;
|
|
182
182
|
/** A mark whose stored position no longer describes the picture. Drawn
|
|
183
183
|
* dashed rather than hidden: it still describes *something*, and dropping
|
|
@@ -207,14 +207,14 @@ interface MarkDrawOptions {
|
|
|
207
207
|
positionDependsOn?: readonly string[];
|
|
208
208
|
/** The trial's config at the time of the draw. */
|
|
209
209
|
config: unknown;
|
|
210
|
-
/** The instrument's vocabulary, for a status's
|
|
210
|
+
/** The instrument's vocabulary, for a status's color. */
|
|
211
211
|
meaning?: AnnotationMeaning;
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* How one mark is drawn — shared by the pane on screen and by an export.
|
|
215
215
|
*
|
|
216
216
|
* One function rather than two call sites building their own, because an
|
|
217
|
-
* export that resolves a status
|
|
217
|
+
* export that resolves a status color or a stale dash differently from the
|
|
218
218
|
* screen produces a picture nobody was looking at.
|
|
219
219
|
*/
|
|
220
220
|
declare function createMarkDrawOne(opts: MarkDrawOptions): (node: SceneNode<AnnotationData, 'marks', WorldRect>, pose: WorldRect, view: View) => DrawCommand[];
|
|
@@ -445,9 +445,12 @@ interface SvgGroupNode {
|
|
|
445
445
|
* `dominant-baseline="text-before-edge"` so `y` is the top of the text
|
|
446
446
|
* box, plus `data-weasel-width` / `data-weasel-height` so weasel's
|
|
447
447
|
* explicit box dimensions round-trip losslessly. External SVG text
|
|
448
|
-
* (lacking the data-* attrs) imports with
|
|
449
|
-
*
|
|
448
|
+
* (lacking the data-* attrs) imports with the width the kit's text layout
|
|
449
|
+
* measures — an em-based estimate when no registered font can — and
|
|
450
450
|
* `height = fontSize * lineHeight * (lineCount || 1)`.
|
|
451
|
+
*
|
|
452
|
+
* `x` here is always the box's left edge. In the SVG it is the
|
|
453
|
+
* `text-anchor` point, and the parser and serializer convert between them.
|
|
451
454
|
*/
|
|
452
455
|
interface SvgTextNode {
|
|
453
456
|
kind: 'text';
|
|
@@ -530,7 +533,7 @@ interface AnnotationOverlayProps {
|
|
|
530
533
|
config: unknown;
|
|
531
534
|
/** The trial's resolved tool slot. */
|
|
532
535
|
activeToolId: string | null;
|
|
533
|
-
/** The instrument's vocabulary, for a status's
|
|
536
|
+
/** The instrument's vocabulary, for a status's color. */
|
|
534
537
|
meaning?: AnnotationMeaning;
|
|
535
538
|
}
|
|
536
539
|
/**
|
|
@@ -575,9 +578,9 @@ interface AnnotationToolInfo {
|
|
|
575
578
|
weaselTool: BuiltinToolId;
|
|
576
579
|
kind?: AnnotationKind;
|
|
577
580
|
}
|
|
578
|
-
/** The
|
|
579
|
-
*
|
|
580
|
-
* holds whichever is active. */
|
|
581
|
+
/** The tools a lab's rail gets when any instrument declares `annotations`.
|
|
582
|
+
* Ids share the lab's contribution namespace with its own `tools`, and the
|
|
583
|
+
* lab's tool slot holds whichever is active. */
|
|
581
584
|
declare const ANNOTATION_TOOLS: readonly TrialTool[];
|
|
582
585
|
/** What `id` drives, or undefined for a tool that is not one of these. */
|
|
583
586
|
declare function annotationToolInfo(id: string | null): AnnotationToolInfo | undefined;
|
|
@@ -610,226 +613,6 @@ declare function fromWeaselView(v: View): ViewTransform;
|
|
|
610
613
|
*/
|
|
611
614
|
declare function fitView(content: ContentSize, pane: PaneSize): ViewTransform;
|
|
612
615
|
|
|
613
|
-
/** Whether a schema entry is a branch rather than a leaf. */
|
|
614
|
-
declare function isConfigBranch(entry: ConfigEntry): entry is ConfigBranch;
|
|
615
|
-
/** Shared chaining surface. Every method clones, so a node can be reused as a
|
|
616
|
-
* base for several leaves without one bleeding into the next. */
|
|
617
|
-
declare abstract class BaseNode<T> implements ConfigNode<T> {
|
|
618
|
-
readonly annotations: Readonly<Annotations>;
|
|
619
|
-
readonly options: Readonly<NodeOptions>;
|
|
620
|
-
abstract readonly kind: string | null;
|
|
621
|
-
readonly default: T;
|
|
622
|
-
constructor(defaultValue: T, annotations?: Readonly<Annotations>, options?: Readonly<NodeOptions>);
|
|
623
|
-
/** Clone into the same subclass. Subclasses with extra constructor
|
|
624
|
-
* arguments override this. */
|
|
625
|
-
protected with(annotations: Annotations, options: NodeOptions): this;
|
|
626
|
-
protected ann(patch: Annotations): this;
|
|
627
|
-
protected opt(patch: NodeOptions): this;
|
|
628
|
-
/** Human-readable label. Defaults to the key, title-cased. */
|
|
629
|
-
label(name: string): this;
|
|
630
|
-
/** Longer help text, surfaced as a tooltip on the row label. */
|
|
631
|
-
describe(description: string): this;
|
|
632
|
-
/** Omit from the panel unless it is asked to show hidden leaves. */
|
|
633
|
-
hidden(): this;
|
|
634
|
-
/** Pair with a sibling sharing this id, side-by-side on one row. */
|
|
635
|
-
pair(pair: string): this;
|
|
636
|
-
/** Render under a named section heading. `collapsed` opens the section
|
|
637
|
-
* folded — say it on any one of the section's leaves. */
|
|
638
|
-
section(label: string, opts?: {
|
|
639
|
-
collapsed?: boolean;
|
|
640
|
-
}): this;
|
|
641
|
-
/** Show this row only while the predicate holds. Presentational — the value
|
|
642
|
-
* stays in config and the instrument still reads it. */
|
|
643
|
-
showIf(predicate: (config: Record<string, unknown>) => boolean): this;
|
|
644
|
-
/** Draw this one row yourself, keeping the kind, default and validation. */
|
|
645
|
-
render(renderer: ControlRenderer): this;
|
|
646
|
-
}
|
|
647
|
-
declare class NumberNode extends BaseNode<number> {
|
|
648
|
-
readonly kind = "number";
|
|
649
|
-
/** Bound the value. A number with both bounds renders as a slider. */
|
|
650
|
-
range(min: number, max: number): this;
|
|
651
|
-
step(step: number): this;
|
|
652
|
-
/** A display suffix for the value — `'px'`, `'ms'`, `'°'`. Presentation only:
|
|
653
|
-
* it is never parsed, and the stored value stays a plain number. */
|
|
654
|
-
suffix(suffix: string): this;
|
|
655
|
-
/** Force a slider even without both bounds. */
|
|
656
|
-
slider(): this;
|
|
657
|
-
/** Force a typed input even when both bounds are set. */
|
|
658
|
-
input(): this;
|
|
659
|
-
}
|
|
660
|
-
declare class BooleanNode extends BaseNode<boolean> {
|
|
661
|
-
readonly kind = "boolean";
|
|
662
|
-
/** Ask for a switch. `ControlPanel` still draws a checkbox; weasel-ui's
|
|
663
|
-
* `PrefsForm` honors the distinction. */
|
|
664
|
-
toggle(): this;
|
|
665
|
-
}
|
|
666
|
-
declare class StringNode extends BaseNode<string> {
|
|
667
|
-
readonly kind = "string";
|
|
668
|
-
placeholder(placeholder: string): this;
|
|
669
|
-
maxLength(maxLength: number): this;
|
|
670
|
-
/** Milliseconds to debounce live writes. 0 commits every keystroke. */
|
|
671
|
-
debounce(debounceMs: number): this;
|
|
672
|
-
}
|
|
673
|
-
declare class ColorNode extends BaseNode<string> {
|
|
674
|
-
readonly kind = "color";
|
|
675
|
-
}
|
|
676
|
-
declare class EnumNode<T extends string> extends BaseNode<T> {
|
|
677
|
-
readonly kind = "enum";
|
|
678
|
-
/** Render as a segmented control rather than a select. */
|
|
679
|
-
radio(): this;
|
|
680
|
-
/** Relabel the choices. Named `labels` rather than `options` because
|
|
681
|
-
* `options` is the node's own extras bag. */
|
|
682
|
-
labels(options: readonly ConfigOption[]): this;
|
|
683
|
-
}
|
|
684
|
-
/** A leaf whose kind the rule chain decides. */
|
|
685
|
-
declare class ValueNode<T> extends BaseNode<T> {
|
|
686
|
-
readonly kind: null;
|
|
687
|
-
}
|
|
688
|
-
/** A leaf of a kind labkit does not ship a row for. */
|
|
689
|
-
declare class CustomNode<T> extends BaseNode<T> {
|
|
690
|
-
readonly kind: string;
|
|
691
|
-
constructor(kind: string, defaultValue: T, annotations?: Readonly<Annotations>, options?: Readonly<NodeOptions>);
|
|
692
|
-
protected with(annotations: Annotations, options: NodeOptions): this;
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* A branch of the schema: its children nest under its key, so a leaf inside
|
|
696
|
-
* one is read and written at a dotted path. Distinct from `.section()`, which
|
|
697
|
-
* puts a heading over sibling leaves and leaves their paths alone.
|
|
698
|
-
*/
|
|
699
|
-
declare class GroupNode<S extends ConfigShape> implements ConfigBranch<S> {
|
|
700
|
-
readonly children: S;
|
|
701
|
-
readonly annotations: Readonly<BranchAnnotations>;
|
|
702
|
-
readonly options: Readonly<BranchOptions>;
|
|
703
|
-
constructor(children: S, annotations?: Readonly<BranchAnnotations>, options?: Readonly<BranchOptions>);
|
|
704
|
-
private with;
|
|
705
|
-
/** Heading for the group's rows. Defaults to the key, title-cased. */
|
|
706
|
-
label(name: string): GroupNode<S>;
|
|
707
|
-
/** Longer help text. Carried on the resolved `PrefGroup`, where weasel-ui's
|
|
708
|
-
* `PrefsForm` draws it under the heading; `ControlPanel` has no place for
|
|
709
|
-
* it yet and shows the heading alone. */
|
|
710
|
-
describe(description: string): GroupNode<S>;
|
|
711
|
-
/** Render this whole group under a named section heading. */
|
|
712
|
-
section(label: string, opts?: {
|
|
713
|
-
collapsed?: boolean;
|
|
714
|
-
}): GroupNode<S>;
|
|
715
|
-
/** Show this group only while the predicate holds. Presentational — every
|
|
716
|
-
* value beneath it stays in config and the instrument still reads it. */
|
|
717
|
-
showIf(predicate: (config: Record<string, unknown>) => boolean): GroupNode<S>;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Builds an instrument's config: the values, their types, and how each is
|
|
721
|
-
* edited, in one declaration.
|
|
722
|
-
*
|
|
723
|
-
* ```ts
|
|
724
|
-
* const config = f.schema({
|
|
725
|
-
* showGrid: f.boolean(true),
|
|
726
|
-
* cellSize: f.number(20).range(5, 80).step(5).label('Grid spacing'),
|
|
727
|
-
* // Nested: read and written at `grid.color`.
|
|
728
|
-
* grid: f.group({ color: f.color('#ffffff') }),
|
|
729
|
-
* })
|
|
730
|
-
* ```
|
|
731
|
-
*/
|
|
732
|
-
declare const f: {
|
|
733
|
-
number: (def: number) => NumberNode;
|
|
734
|
-
boolean: (def: boolean) => BooleanNode;
|
|
735
|
-
string: (def: string) => StringNode;
|
|
736
|
-
color: (def: string) => ColorNode;
|
|
737
|
-
/** A fixed set of choices. The default's literal type flows into the config
|
|
738
|
-
* type, so `f.enum('fast', ['fast', 'accurate'])` gives
|
|
739
|
-
* `'fast' | 'accurate'` with no `as const`. */
|
|
740
|
-
enum: <const T extends string>(def: T, options: readonly T[] | readonly ConfigOption[]) => EnumNode<T>;
|
|
741
|
-
/** A leaf with no declared kind: the rule chain decides, which is how a lab
|
|
742
|
-
* states a convention like "every `*Color` key is a color picker". */
|
|
743
|
-
value: <T>(def: T) => ValueNode<T>;
|
|
744
|
-
/** A branch: its children nest under this key, so `grid: f.group({ size })`
|
|
745
|
-
* puts the value at `config.grid.size` and addresses it as `'grid.size'`.
|
|
746
|
-
* Groups nest as deeply as the schema wants. */
|
|
747
|
-
group: <const S extends ConfigShape>(children: S) => GroupNode<S>;
|
|
748
|
-
/** A leaf of a kind a lab supplies the control for, through `controls`. */
|
|
749
|
-
custom: <T>(kind: string, def: T, validate?: (leaf: ToolPrefLeaf) => string[]) => CustomNode<T>;
|
|
750
|
-
/** Collect leaves and groups into an instrument's config. */
|
|
751
|
-
schema<S extends ConfigShape>(nodes: S): ConfigSchema<InferConfig<S>>;
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* Adapt a legacy `configSchema(): ConfigField[]` into the resolved shape, so
|
|
756
|
-
* both instrument paths reach one renderer.
|
|
757
|
-
*
|
|
758
|
-
* Rules do not run here: a hand-written `ConfigField` already states its label
|
|
759
|
-
* and control, which is everything the rule chain would have inferred.
|
|
760
|
-
*/
|
|
761
|
-
declare function fromConfigFields(fields: readonly ConfigField[]): ResolvedConfig;
|
|
762
|
-
|
|
763
|
-
/** The value at a dotted path. `undefined` when a segment is missing or the
|
|
764
|
-
* walk hits something that is not a record. */
|
|
765
|
-
declare function valueAtPath(config: unknown, path: string): unknown;
|
|
766
|
-
/** Whether a dotted path is actually present, which a `undefined` value is
|
|
767
|
-
* not enough to tell you. */
|
|
768
|
-
declare function hasConfigPath(config: unknown, path: string): boolean;
|
|
769
|
-
/** A copy of `config` with `value` written at a dotted path. Every record on
|
|
770
|
-
* the way down is copied and the input is left alone; a missing — or
|
|
771
|
-
* non-record — intermediate is replaced with the branch the path implies. */
|
|
772
|
-
declare function withValueAtPath<T>(config: T, path: string, value: unknown): T;
|
|
773
|
-
/**
|
|
774
|
-
* `stored` with every gap filled from `defaults`, down the whole tree.
|
|
775
|
-
*
|
|
776
|
-
* This is how a config written before its schema grew a branch still loads:
|
|
777
|
-
* the branch arrives at its defaults instead of `undefined`, and a key the
|
|
778
|
-
* defaults no longer mention is kept rather than dropped, so nothing is lost
|
|
779
|
-
* to a schema change the author has not finished making.
|
|
780
|
-
*/
|
|
781
|
-
declare function fillConfigDefaults<T>(stored: unknown, defaults: T): T;
|
|
782
|
-
/** A node in a resolved schema tree, by dotted path. Structural rather than
|
|
783
|
-
* `isPrefLeaf` so this stays free of a runtime import. */
|
|
784
|
-
declare function schemaNodeAtPath(group: ToolPrefGroup, path: string): ToolPrefLeaf | ToolPrefGroup | undefined;
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* Resolve a schema into the vocabulary weasel-ui renders, running each leaf
|
|
788
|
-
* through the consumer's rules and then labkit's own.
|
|
789
|
-
*
|
|
790
|
-
* The group mirrors the schema's own nesting: an `f.group` becomes a nested
|
|
791
|
-
* `PrefGroup`, so a leaf's dotted path within the tree is the path its value
|
|
792
|
-
* is written at, and both `ControlPanel` and `PrefsForm` address it
|
|
793
|
-
* identically.
|
|
794
|
-
*/
|
|
795
|
-
declare function resolveConfigSchema<TC>(schema: ConfigSchema<TC>, rules?: readonly ConfigRule[]): ResolvedConfig;
|
|
796
|
-
|
|
797
|
-
/** `cellSize` -> `Cell size`. Splits camelCase without shattering acronyms. */
|
|
798
|
-
declare function titleCase(key: string): string;
|
|
799
|
-
/**
|
|
800
|
-
* labkit's own inference, expressed in the same vocabulary a consumer
|
|
801
|
-
* extends. Runs after the consumer's rules, so a lab always wins.
|
|
802
|
-
*
|
|
803
|
-
* If one of these ever needs something a `ConfigRule` cannot express, the
|
|
804
|
-
* seam is too weak — that is the point of writing them this way.
|
|
805
|
-
*/
|
|
806
|
-
declare const builtinRules: readonly ConfigRule[];
|
|
807
|
-
/**
|
|
808
|
-
* Fold a rule chain into one leaf patch. Gap-filling: a property already
|
|
809
|
-
* settled is never overwritten, so the accumulator seeded with the author's
|
|
810
|
-
* annotations beats every rule, and earlier rules beat later ones.
|
|
811
|
-
*/
|
|
812
|
-
declare function applyRules(seed: LeafPatch, ctx: Omit<ConfigRuleContext, 'leaf'>, rules: readonly ConfigRule[]): LeafPatch;
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* An instrument's controls, resolved against the surrounding lab's rules.
|
|
816
|
-
*
|
|
817
|
-
* Resolution cannot happen in `defineInstrument` — rules are lab-scoped and
|
|
818
|
-
* that runs at module load — so it happens here, at render. Both instrument
|
|
819
|
-
* paths land in the same shape, so callers never branch on which was used.
|
|
820
|
-
*/
|
|
821
|
-
declare function useConfigSchema(instrument: Instrument<any, any, any>): ResolvedConfig;
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Whether the row at a dotted path should be drawn right now. A group answers
|
|
825
|
-
* for its whole subtree — hiding one hides everything under it.
|
|
826
|
-
*
|
|
827
|
-
* `hidden` is the node's own static flag; `showIf` is the schema's predicate
|
|
828
|
-
* over the live config. Both are presentational — a hidden leaf keeps its
|
|
829
|
-
* value and the instrument still reads it.
|
|
830
|
-
*/
|
|
831
|
-
declare function isLeafVisible(resolved: ResolvedConfig, path: string, config: Record<string, unknown>, showHidden?: boolean): boolean;
|
|
832
|
-
|
|
833
616
|
/** An instrument as it is written: either the legacy `defaultConfig` (plus an
|
|
834
617
|
* optional `configSchema`), or a `config` schema that supplies both. */
|
|
835
618
|
type InstrumentSpec<TS, TC, TItem = unknown> = Instrument<TS, TC, TItem> | (Omit<Instrument<TS, TC, TItem>, 'defaultConfig'> & {
|
|
@@ -868,109 +651,6 @@ interface ValidationResult {
|
|
|
868
651
|
* a field simply has no constraints to check here. */
|
|
869
652
|
declare function validateConfigSchema(fields: ConfigField[]): ValidationResult;
|
|
870
653
|
|
|
871
|
-
/** Props for `<Lab>`. */
|
|
872
|
-
interface LabProps {
|
|
873
|
-
instruments: InstrumentList;
|
|
874
|
-
defaultInstrument: string;
|
|
875
|
-
storage?: StorageAdapter | null;
|
|
876
|
-
storageKey?: string;
|
|
877
|
-
mode?: LabMode;
|
|
878
|
-
/**
|
|
879
|
-
* Optional list of CSS colors used to compose the interstellar theme's
|
|
880
|
-
* cosmic backdrop. Each color becomes one radial-gradient blob on the
|
|
881
|
-
* dark void base. Order maps to a fixed spread of positions; extras wrap
|
|
882
|
-
* around. Ignored unless the resolved mode is dark.
|
|
883
|
-
*/
|
|
884
|
-
nebula?: readonly string[];
|
|
885
|
-
title?: string;
|
|
886
|
-
/** Rendered in the shell's footer, below the workspace. */
|
|
887
|
-
footer?: ReactNode;
|
|
888
|
-
/** Contributions added to every trial's chrome, after the instrument's own. */
|
|
889
|
-
chrome?: readonly TrialContribution[];
|
|
890
|
-
/** Built-in contribution ids to drop. Throws on an id that is not there. */
|
|
891
|
-
suppress?: readonly string[];
|
|
892
|
-
/** Tools offered lab-wide. A trial whose instrument declares none of its own
|
|
893
|
-
* reflects and writes this slot. */
|
|
894
|
-
tools?: readonly TrialTool[];
|
|
895
|
-
/** Rules run over every instrument's config leaves, before labkit's own
|
|
896
|
-
* inference — where a lab states a convention once instead of annotating
|
|
897
|
-
* each field. Memoize or hoist. */
|
|
898
|
-
configRules?: readonly ConfigRule[];
|
|
899
|
-
/** Control overrides and app-defined kinds for every trial's settings panel.
|
|
900
|
-
* Keys are config paths (checked first) or leaf kinds. Memoize or hoist. */
|
|
901
|
-
controls?: Record<string, ControlRenderer>;
|
|
902
|
-
children?: ReactNode;
|
|
903
|
-
}
|
|
904
|
-
/** The lab runtime: creates the store, provides it, and renders one trial
|
|
905
|
-
* per record in a grid. Each trial runs one of `instruments`. */
|
|
906
|
-
declare function Lab({ instruments, defaultInstrument, storage, storageKey, mode, nebula, title, footer, chrome, suppress, tools, configRules, controls, children, }: LabProps): react_jsx_runtime.JSX.Element;
|
|
907
|
-
|
|
908
|
-
/** What a trial opens on beyond its instrument's own defaults. */
|
|
909
|
-
interface AddTrialOptions<TC = Record<string, unknown>> {
|
|
910
|
-
/** Overlaid on `defaultConfig()` before `initialState` reads it, so a trial
|
|
911
|
-
* opened on a subject is running that subject from its first frame. Keys
|
|
912
|
-
* whose value is `undefined` are left to the default. */
|
|
913
|
-
config?: Partial<TC>;
|
|
914
|
-
}
|
|
915
|
-
/** Append a new trial running `instrumentName`, at that instrument's default
|
|
916
|
-
* config — with `options.config` written over it — and the initial state
|
|
917
|
-
* that config produces. */
|
|
918
|
-
declare function addTrial(trials: TrialRecord[], instruments: InstrumentList, instrumentName: string, options?: AddTrialOptions): TrialRecord[];
|
|
919
|
-
/** Insert a deep copy of a trial directly after it. The copy starts with
|
|
920
|
-
* an empty undo history — the original's is not shared. */
|
|
921
|
-
declare function cloneTrial(trials: TrialRecord[], id: string): TrialRecord[];
|
|
922
|
-
/** Remove a trial, unless it is the last one — a lab always has at least
|
|
923
|
-
* one. */
|
|
924
|
-
declare function closeTrial(trials: TrialRecord[], id: string): TrialRecord[];
|
|
925
|
-
/** Return a trial to what it opened on — its instrument's defaults under the
|
|
926
|
-
* seed `addTrial` was given — keeping its id and its place in the list. */
|
|
927
|
-
declare function resetTrial(trials: TrialRecord[], id: string, instruments: InstrumentList): TrialRecord[];
|
|
928
|
-
/**
|
|
929
|
-
* Reorder to match `ids`. Ids the list doesn't mention keep their relative
|
|
930
|
-
* order at the end, and ids it names that no longer exist are dropped — a
|
|
931
|
-
* reorder that raced a close should not resurrect the closed trial.
|
|
932
|
-
*/
|
|
933
|
-
declare function reorderTrials(trials: TrialRecord[], ids: readonly string[]): TrialRecord[];
|
|
934
|
-
|
|
935
|
-
/** Lab-wide state and commands: the available instruments, the open
|
|
936
|
-
* trials and the operations over them, saved snapshots, and the color
|
|
937
|
-
* mode. */
|
|
938
|
-
interface LabContextValue {
|
|
939
|
-
instruments: InstrumentList;
|
|
940
|
-
trials: TrialRecord[];
|
|
941
|
-
/** Open a trial running `instrumentName`. `options.config` is written over
|
|
942
|
-
* that instrument's defaults, which is where a trial opened on a subject
|
|
943
|
-
* says which subject. */
|
|
944
|
-
addTrial: (instrumentName: string, options?: AddTrialOptions) => void;
|
|
945
|
-
cloneTrial: (id: string) => void;
|
|
946
|
-
closeTrial: (id: string) => void;
|
|
947
|
-
resetTrial: (id: string) => void;
|
|
948
|
-
reorderTrials: (ids: readonly string[]) => void;
|
|
949
|
-
savedSnapshots: SavedSnapshot[];
|
|
950
|
-
saveSnapshot: (trialId: string, name?: string) => void;
|
|
951
|
-
loadSnapshot: (trialId: string, snapshotId: string) => void;
|
|
952
|
-
deleteSnapshot: (snapshotId: string) => void;
|
|
953
|
-
mode: LabMode;
|
|
954
|
-
setMode: (m: LabMode) => void;
|
|
955
|
-
/** Lab-wide rules run over every instrument's config leaves, before
|
|
956
|
-
* labkit's own inference. */
|
|
957
|
-
configRules?: readonly ConfigRule[];
|
|
958
|
-
/** Lab-wide control overrides, keyed by config path or by leaf kind. */
|
|
959
|
-
controls?: Record<string, ControlRenderer>;
|
|
960
|
-
}
|
|
961
|
-
/** Context carrying the surrounding lab. Prefer `useLabContext`. */
|
|
962
|
-
declare const LabContext: react.Context<LabContextValue | null>;
|
|
963
|
-
/** The surrounding lab. Throws outside a `<Lab>`. */
|
|
964
|
-
declare function useLabContext(): LabContextValue;
|
|
965
|
-
|
|
966
|
-
/** Props for `<LabPalette>`. */
|
|
967
|
-
interface LabPaletteProps {
|
|
968
|
-
tools: readonly TrialTool[];
|
|
969
|
-
}
|
|
970
|
-
/** The lab's tool strip. Writes the lab's tool slot, which every trial whose
|
|
971
|
-
* instrument declares no tools of its own resolves to. */
|
|
972
|
-
declare function LabPalette({ tools }: LabPaletteProps): react_jsx_runtime.JSX.Element;
|
|
973
|
-
|
|
974
654
|
/** One page in a project's set of labs. */
|
|
975
655
|
interface LabPage {
|
|
976
656
|
/** The page's own URL, and how the switcher knows which page is open. */
|
|
@@ -1006,6 +686,82 @@ declare function currentPage(path: string, pages: readonly LabPage[]): number;
|
|
|
1006
686
|
* bench -- and a tab strip is the layout that stops working first. */
|
|
1007
687
|
declare function LabSwitcher({ title, pages, path, className }: LabSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
1008
688
|
|
|
689
|
+
interface LabBaseProps {
|
|
690
|
+
/** May change while mounted. An instrument that is a different object from
|
|
691
|
+
* the last render counts as replaced and its open trials' configs are
|
|
692
|
+
* refilled, so hoist or memoize the list. */
|
|
693
|
+
instruments: InstrumentList;
|
|
694
|
+
defaultInstrument: string;
|
|
695
|
+
mode?: LabMode;
|
|
696
|
+
/** Rendered while a stored lab loads. Default: the lab's empty shell. */
|
|
697
|
+
fallback?: ReactNode;
|
|
698
|
+
/**
|
|
699
|
+
* Optional list of CSS colors used to compose the interstellar theme's
|
|
700
|
+
* cosmic backdrop. Each color becomes one radial-gradient blob on the
|
|
701
|
+
* dark void base. Order maps to a fixed spread of positions; extras wrap
|
|
702
|
+
* around. Ignored unless the resolved mode is dark.
|
|
703
|
+
*/
|
|
704
|
+
nebula?: readonly string[];
|
|
705
|
+
title?: string;
|
|
706
|
+
/** The project's other labs. Given two or more, the title becomes the way to
|
|
707
|
+
* reach them — the same switcher `<LabShell>` renders, so a lab reached from
|
|
708
|
+
* one is not a dead end. */
|
|
709
|
+
pages?: readonly LabPage[];
|
|
710
|
+
/** The path the switcher marks as open. Defaults to the current location. */
|
|
711
|
+
path?: string;
|
|
712
|
+
/** Rendered in the shell's footer, below the workspace. */
|
|
713
|
+
footer?: ReactNode;
|
|
714
|
+
/** Contributions added to every trial's chrome, after the instrument's own. */
|
|
715
|
+
chrome?: readonly TrialContribution[];
|
|
716
|
+
/** Contributions to the lab's own chrome — its header bar, its sidebar, its
|
|
717
|
+
* tool rail and its footer — rather than to every trial's. Rendered after
|
|
718
|
+
* `children` and `footer`, which stay the way a lab drops arbitrary content
|
|
719
|
+
* into those same two boxes. Going from no sidebar contributions to some
|
|
720
|
+
* remounts the workspace and every trial, dropping unpersisted trial state. */
|
|
721
|
+
labChrome?: readonly LabContribution[];
|
|
722
|
+
/** Built-in contribution ids to drop. Throws on an id that is not there. */
|
|
723
|
+
suppress?: readonly string[];
|
|
724
|
+
/** Offer the header's add-trial control. Default `true`; a lab that opens
|
|
725
|
+
* trials some other way passes `false`. */
|
|
726
|
+
addTrial?: boolean;
|
|
727
|
+
/** Tools offered lab-wide. A trial whose instrument declares none of its own
|
|
728
|
+
* reflects and writes this slot. */
|
|
729
|
+
tools?: readonly TrialTool[];
|
|
730
|
+
/** Rules run over every instrument's config leaves, before labkit's own
|
|
731
|
+
* inference — where a lab states a convention once instead of annotating
|
|
732
|
+
* each field. Memoize or hoist. */
|
|
733
|
+
configRules?: readonly ConfigRule[];
|
|
734
|
+
/** Control overrides and app-defined kinds for every trial's settings panel.
|
|
735
|
+
* Keys are config paths (checked first) or leaf kinds. Memoize or hoist. */
|
|
736
|
+
controls?: Record<string, ControlRenderer>;
|
|
737
|
+
children?: ReactNode;
|
|
738
|
+
}
|
|
739
|
+
/** Props for `<Lab>`. With a `storageKey` the lab persists — to IndexedDB
|
|
740
|
+
* unless `storage` names another substrate — and both are read once, at
|
|
741
|
+
* mount. Without one, nothing persists. */
|
|
742
|
+
type LabProps = LabBaseProps & ({
|
|
743
|
+
storageKey?: undefined;
|
|
744
|
+
storage?: undefined;
|
|
745
|
+
} | {
|
|
746
|
+
storageKey: string;
|
|
747
|
+
storage?: StorageAdapter;
|
|
748
|
+
});
|
|
749
|
+
/** The lab runtime: opens the store, provides it, and renders one trial
|
|
750
|
+
* per record in a grid. Each trial runs one of `instruments`. */
|
|
751
|
+
declare function Lab(props: LabProps): react_jsx_runtime.JSX.Element;
|
|
752
|
+
|
|
753
|
+
/** Props for `<LabPalette>`. */
|
|
754
|
+
interface LabPaletteProps {
|
|
755
|
+
/** Tools offered lab-wide. Shorthand for one `palette` contribution each. */
|
|
756
|
+
tools?: readonly TrialTool[];
|
|
757
|
+
/** The lab's contributions; the `palette` ones are laid out here. */
|
|
758
|
+
contributions?: readonly LabContribution[];
|
|
759
|
+
}
|
|
760
|
+
/** The lab's tool rail. Writes the lab's tool slot, which every trial whose
|
|
761
|
+
* instrument declares no tools of its own resolves to. Renders nothing when
|
|
762
|
+
* the lab contributes no tool rail. */
|
|
763
|
+
declare function LabPalette({ tools, contributions }: LabPaletteProps): react_jsx_runtime.JSX.Element;
|
|
764
|
+
|
|
1009
765
|
/** Props for `<LabShell>`. */
|
|
1010
766
|
interface LabShellProps {
|
|
1011
767
|
title: string;
|
|
@@ -1149,7 +905,7 @@ interface TrialProps {
|
|
|
1149
905
|
declare function Trial({ id, chrome, suppress }: TrialProps): react_jsx_runtime.JSX.Element;
|
|
1150
906
|
|
|
1151
907
|
/** Props for `<TrialBody>`. */
|
|
1152
|
-
interface TrialBodyProps {
|
|
908
|
+
interface TrialBodyProps extends Omit<SplitProps, 'sidebar' | 'children' | 'className' | 'sidebarClassName' | 'label'> {
|
|
1153
909
|
/** The sidebar region's sections. */
|
|
1154
910
|
sidebar: ReactNode;
|
|
1155
911
|
/** The instrument's own output. */
|
|
@@ -1157,36 +913,9 @@ interface TrialBodyProps {
|
|
|
1157
913
|
/** Extra class on the content pane — `Trial` marks a canvas instrument's
|
|
1158
914
|
* well flush. */
|
|
1159
915
|
contentClassName?: string;
|
|
1160
|
-
/** The sidebar's current extent in pixels. Omit for an unpersisted lab: the
|
|
1161
|
-
* seam still works, its result just does not outlive the mount. */
|
|
1162
|
-
width?: number;
|
|
1163
|
-
/** Where the sidebar starts before anyone drags it. */
|
|
1164
|
-
defaultWidth?: number;
|
|
1165
|
-
minWidth?: number;
|
|
1166
|
-
maxWidth?: number;
|
|
1167
|
-
/** How little the instrument may be squeezed to. Reported as the seam's
|
|
1168
|
-
* reachable maximum, so the drag stops there rather than clamping silently. */
|
|
1169
|
-
contentMinWidth?: number;
|
|
1170
|
-
/** Fires through the drag, not on release: the pane is already there. */
|
|
1171
|
-
onWidthChange?: (width: number) => void;
|
|
1172
|
-
/**
|
|
1173
|
-
* Fixed extent. Omit in an app — the strip measures its own box. Supply it
|
|
1174
|
-
* where nothing measures, notably jsdom, or both panes lay out at zero.
|
|
1175
|
-
*/
|
|
1176
|
-
viewport?: {
|
|
1177
|
-
w: number;
|
|
1178
|
-
h: number;
|
|
1179
|
-
};
|
|
1180
916
|
}
|
|
1181
|
-
/**
|
|
1182
|
-
|
|
1183
|
-
*
|
|
1184
|
-
* The seam is `stripStrategy`'s own resize affordance, so it arrives as a
|
|
1185
|
-
* `role="separator"` carrying the reachable range, operable by pointer and by
|
|
1186
|
-
* arrows / Home / End, and clamped against the content pane's floor rather
|
|
1187
|
-
* than against the sidebar's alone.
|
|
1188
|
-
*/
|
|
1189
|
-
declare function TrialBody({ sidebar, children, contentClassName, width, defaultWidth, minWidth, maxWidth, contentMinWidth, onWidthChange, viewport, }: TrialBodyProps): react_jsx_runtime.JSX.Element;
|
|
917
|
+
/** A trial's sidebar and content as a `Split`, wearing the trial's classes. */
|
|
918
|
+
declare function TrialBody({ sidebar, children, contentClassName, ...rest }: TrialBodyProps): react_jsx_runtime.JSX.Element;
|
|
1190
919
|
|
|
1191
920
|
/** The trial's loupe as its chrome sees it: a switch and its position. */
|
|
1192
921
|
interface LoupeBindings {
|
|
@@ -1229,5 +958,5 @@ interface TrialChromeProps {
|
|
|
1229
958
|
* each region its slice. */
|
|
1230
959
|
declare function TrialChrome({ trialId, record, instrument, isLastTrial, undoBindings, job, loupe, trialChrome, chrome, suppress, activeToolId, setActiveTool, children, }: TrialChromeProps): react_jsx_runtime.JSX.Element;
|
|
1231
960
|
|
|
1232
|
-
export { ANNOTATION_TOOLS, ANNOTATION_WEASEL_TOOLS, AnnotationData, AnnotationKind, AnnotationMeaning, AnnotationOverlay, AnnotationTarget, AnnotationTargets,
|
|
1233
|
-
export type {
|
|
961
|
+
export { ANNOTATION_TOOLS, ANNOTATION_WEASEL_TOOLS, AnnotationData, AnnotationKind, AnnotationMeaning, AnnotationOverlay, AnnotationTarget, AnnotationTargets, AnnotationsApi, AnnotationsCapability, AnnotationsContext, CaptureOptions, CaptureResult, CaptureSource, ConfigField, ConfigRule, ConfigSchema, ControlRenderer, CurveField, DEFAULT_VIEW, EffectCard, EffectCardList, ExportMenu, Instrument, InstrumentList, JobHandle, Lab, LabContribution, LabMode, LabPalette, LabShell, LabSwitcher, MarkList, MarkScene, PropertyGroup, PropertyListPack, SplitProps, StorageAdapter, Subpanel, Trial, TrialBody, TrialChrome, TrialContribution, TrialInfo, TrialRecord, TrialTool, ViewTransform, Workspace, WorldRect, annotationToolInfo, as2DView, capturePlan, captureTarget, composeCaptureSvg, createMarkDrawOne, currentPage, defineInstrument, fitView, fromWeaselView, interstellarTheme, isStale, markCommands, markSvgNodes, resolveMarkStyle, seenFrom, toWeaselView, useAnnotations, useAnnotationsOptional, validateConfigSchema };
|
|
962
|
+
export type { AnnotationOverlayProps, AnnotationTargetsProps, AnnotationToolInfo, CaptureArgs, CapturePlan, ComposeSvgArgs, ContentSize, CurveFieldProps, CurveMark, EffectCardListItem, EffectCardListProps, EffectCardProps, InstrumentSpec, LabPage, LabPaletteProps, LabProps, LabShellProps, LabSwitcherProps, MarkDrawOptions, MarkListProps, MarkStyle, PaintableMark, PaneSize, PanelDescriptor, PropertyGroupProps, SubpanelProps, TrialBodyProps, TrialChromeProps, TrialLayout, TrialProps, UndoBindings, ValidationResult, ViewTransform2D, WorkspaceProps };
|