@weasel-js/labkit 1.4.1 → 1.4.3

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.
Files changed (145) hide show
  1. package/README.md +28 -2
  2. package/dist/_dts/{CanvasStackContext-BIRUVVGH.d.ts → CanvasStackContext-Dde8_1my.d.ts} +1 -1
  3. package/dist/_dts/{PrefsForm.d-CgxUequc.d.ts → PrefsForm.d-DDHFANkc.d.ts} +1 -1
  4. package/dist/_dts/{frac-X7mWgd7y.d.ts → frac-B5mB8LsJ.d.ts} +33 -13
  5. package/dist/_dts/{index-FEa1MudK.d.ts → index-DelFfeV0.d.ts} +99 -31
  6. package/dist/_dts/types-B9_zrHmb.d.ts +166 -0
  7. package/dist/_dts/{types-ChVJJHvk.d.ts → types-BP2OCcpg.d.ts} +41 -4
  8. package/dist/_dts/types-x92Kfeme.d.ts +62 -0
  9. package/dist/_dts/{useTrialState-Cdm13fvl.d.ts → useTrialState-D6Vb3T-g.d.ts} +11 -7
  10. package/dist/canvas/index.d.ts +9 -8
  11. package/dist/canvas/index.js +1 -2
  12. package/dist/chrome/index.d.ts +16 -9
  13. package/dist/chrome/index.js +5 -5
  14. package/dist/{chunk-MSR7EVS6.js → chunk-2RQPGOQF.js} +6 -5
  15. package/dist/chunk-2RQPGOQF.js.map +1 -0
  16. package/dist/{chunk-LJSIUFYD.js → chunk-5TROQVQ2.js} +46 -21
  17. package/dist/chunk-5TROQVQ2.js.map +1 -0
  18. package/dist/{chunk-53AZ2O2N.js → chunk-ASWKLRKJ.js} +92 -45
  19. package/dist/chunk-ASWKLRKJ.js.map +1 -0
  20. package/dist/{chunk-BMQWLKOL.js → chunk-C42T6DJT.js} +94 -83
  21. package/dist/chunk-C42T6DJT.js.map +1 -0
  22. package/dist/chunk-E44SU6XS.js +50 -0
  23. package/dist/chunk-E44SU6XS.js.map +1 -0
  24. package/dist/{chunk-OFCBEZMU.js → chunk-FQMJUVHJ.js} +3 -3
  25. package/dist/{chunk-OFCBEZMU.js.map → chunk-FQMJUVHJ.js.map} +1 -1
  26. package/dist/{chunk-PP7ZWAMV.js → chunk-I6JCVE24.js} +3 -3
  27. package/dist/chunk-I6JCVE24.js.map +1 -0
  28. package/dist/chunk-ISCOFAUO.js +170 -0
  29. package/dist/chunk-ISCOFAUO.js.map +1 -0
  30. package/dist/chunk-MHAGC6VD.js +7320 -0
  31. package/dist/chunk-MHAGC6VD.js.map +1 -0
  32. package/dist/{chunk-7TRFMIWX.js → chunk-QAGAHJKZ.js} +4 -4
  33. package/dist/{chunk-7TRFMIWX.js.map → chunk-QAGAHJKZ.js.map} +1 -1
  34. package/dist/{chunk-D7QIPGEB.js → chunk-RS3HRQWU.js} +62 -60
  35. package/dist/chunk-RS3HRQWU.js.map +1 -0
  36. package/dist/{chunk-RLOXQZW3.js → chunk-TJ7QY3OC.js} +3 -3
  37. package/dist/{chunk-RLOXQZW3.js.map → chunk-TJ7QY3OC.js.map} +1 -1
  38. package/dist/controls/index.d.ts +5 -4
  39. package/dist/controls/index.js +3 -3
  40. package/dist/dragdrop/index.d.ts +9 -8
  41. package/dist/dragdrop/index.js +1 -2
  42. package/dist/index.d.ts +152 -57
  43. package/dist/index.js +315 -200
  44. package/dist/index.js.map +1 -1
  45. package/dist/layers/index.d.ts +27 -11
  46. package/dist/layers/index.js +2 -3
  47. package/dist/loupe/index.d.ts +8 -7
  48. package/dist/loupe/index.js +1 -2
  49. package/dist/passthrough/weasel-canvas.d.ts +1 -3
  50. package/dist/passthrough/weasel-canvas.js +1 -1
  51. package/dist/passthrough/weasel-canvas.js.map +1 -1
  52. package/dist/passthrough/weasel-ui.d.ts +171 -22
  53. package/dist/passthrough/weasel-ui.js +1 -2
  54. package/dist/primitives/index.js +3 -4
  55. package/dist/state/index.d.ts +6 -3
  56. package/dist/state/index.js +3 -2
  57. package/dist/state/index.js.map +1 -1
  58. package/dist/styles.css +21 -4
  59. package/dist/surface/index.js +1 -2
  60. package/dist/ui/layers/index.d.ts +22 -9
  61. package/dist/ui/layers/index.js +1 -2
  62. package/dist/undo/index.d.ts +6 -6
  63. package/package.json +7 -7
  64. package/src/annotations/AnnotationTargets.tsx +6 -1
  65. package/src/annotations/Annotations.overlay.test.tsx +2 -0
  66. package/src/annotations/ExportMenu.test.tsx +16 -0
  67. package/src/annotations/ExportMenu.tsx +0 -5
  68. package/src/annotations/types.ts +4 -1
  69. package/src/canvas/useOrbit.test.ts +7 -3
  70. package/src/canvas/usePanZoom.test.ts +7 -3
  71. package/src/chrome/ChromeRegions.stories.tsx +42 -1
  72. package/src/chrome/builtins.test.ts +4 -0
  73. package/src/chrome/builtins.tsx +18 -0
  74. package/src/chrome/index.ts +1 -1
  75. package/src/chrome/regions/SidebarRegion.tsx +7 -6
  76. package/src/chrome/regions/TitleBarRegion.test.tsx +64 -0
  77. package/src/chrome/regions/TitleBarRegion.tsx +16 -7
  78. package/src/chrome/regions/ToolbarRegion.test.tsx +14 -0
  79. package/src/chrome/regions/ToolbarRegion.tsx +2 -2
  80. package/src/chrome/regions/ViewportRegion.tsx +2 -2
  81. package/src/chrome/regions/regions.test.tsx +45 -1
  82. package/src/chrome/types.ts +21 -3
  83. package/src/config/builder.test.ts +56 -2
  84. package/src/config/builder.ts +73 -13
  85. package/src/config/index.ts +16 -1
  86. package/src/config/path.test.ts +109 -0
  87. package/src/config/path.ts +76 -0
  88. package/src/config/resolve.test.ts +93 -2
  89. package/src/config/resolve.ts +72 -29
  90. package/src/config/types.ts +99 -9
  91. package/src/config/visible.ts +6 -4
  92. package/src/controls/ControlPanel.stories.tsx +38 -4
  93. package/src/controls/ControlPanel.test.tsx +152 -0
  94. package/src/controls/ControlPanel.tsx +134 -40
  95. package/src/dragdrop/DragDropRuntime.tsx +74 -61
  96. package/src/dragdrop/Palette.tsx +4 -3
  97. package/src/dragdrop/dragDrop.test.tsx +35 -12
  98. package/src/index.ts +18 -2
  99. package/src/instrument/serializers.ts +36 -0
  100. package/src/instrument/types.ts +8 -7
  101. package/src/lab/Lab.test.tsx +36 -1
  102. package/src/lab/Lab.tsx +12 -3
  103. package/src/lab/LabContext.ts +5 -1
  104. package/src/lab/LabShell.less +17 -2
  105. package/src/lab/LabShell.test.tsx +8 -0
  106. package/src/lab/LabShell.tsx +3 -1
  107. package/src/layers/AGENTS.md +29 -7
  108. package/src/layers/LayerList.less +16 -0
  109. package/src/layers/LayerList.stories.tsx +66 -0
  110. package/src/layers/LayerList.test.tsx +117 -5
  111. package/src/layers/LayerList.tsx +192 -53
  112. package/src/layers/index.ts +1 -1
  113. package/src/passthrough/weasel-ui.ts +5 -0
  114. package/src/primitives/FloatingPanel.test.tsx +8 -3
  115. package/src/primitives/ZoomControl.less +6 -2
  116. package/src/primitives/ZoomControl.tsx +1 -0
  117. package/src/state/helpers.ts +1 -1
  118. package/src/state/store.test.ts +233 -1
  119. package/src/state/store.ts +57 -24
  120. package/src/state/types.ts +44 -3
  121. package/src/state/useTrialState.ts +1 -1
  122. package/src/trial/Trial.config.test.tsx +44 -0
  123. package/src/trial/Trial.less +4 -0
  124. package/src/trial/Trial.targets.test.tsx +96 -0
  125. package/src/trial/Trial.test.tsx +171 -14
  126. package/src/trial/Trial.tsx +7 -4
  127. package/src/trial/TrialChrome.tsx +32 -7
  128. package/src/trial/TrialTitleBar.tsx +7 -3
  129. package/src/trial/index.ts +1 -0
  130. package/src/trial/trialOps.test.ts +49 -1
  131. package/src/trial/trialOps.ts +24 -6
  132. package/dist/_dts/types-lg4TSCb2.d.ts +0 -164
  133. package/dist/_dts/weasel-canvas-FJTFi3ZZ.d.ts +0 -5041
  134. package/dist/chunk-53AZ2O2N.js.map +0 -1
  135. package/dist/chunk-BMQWLKOL.js.map +0 -1
  136. package/dist/chunk-D7QIPGEB.js.map +0 -1
  137. package/dist/chunk-DG2IFMLA.js +0 -29970
  138. package/dist/chunk-DG2IFMLA.js.map +0 -1
  139. package/dist/chunk-J6SBFZYT.js +0 -7121
  140. package/dist/chunk-J6SBFZYT.js.map +0 -1
  141. package/dist/chunk-LJSIUFYD.js.map +0 -1
  142. package/dist/chunk-MIT3ISW4.js +0 -100
  143. package/dist/chunk-MIT3ISW4.js.map +0 -1
  144. package/dist/chunk-MSR7EVS6.js.map +0 -1
  145. package/dist/chunk-PP7ZWAMV.js.map +0 -1
@@ -1,10 +1,11 @@
1
- import { P as PaletteItem, a as Point, D as DragFeedback, b as DragDropCapability, V as ViewTransform, c as WorldSpec } from '../_dts/frac-X7mWgd7y.js';
1
+ import { P as PaletteItem, a as Point, D as DragFeedback, b as DragDropCapability, V as ViewTransform, c as WorldSpec } from '../_dts/frac-B5mB8LsJ.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { RefObject, ReactPortal } from 'react';
4
- import '../_dts/types-lg4TSCb2.js';
5
- import '../_dts/weasel-canvas-FJTFi3ZZ.js';
6
- import '../_dts/PrefsForm.d-CgxUequc.js';
7
- import '../_dts/types-ChVJJHvk.js';
3
+ import { RefObject, PointerEvent, ReactPortal } from 'react';
4
+ import '../_dts/types-B9_zrHmb.js';
5
+ import '@weasel-js/core';
6
+ import '../_dts/PrefsForm.d-DDHFANkc.js';
7
+ import '../_dts/types-x92Kfeme.js';
8
+ import '../_dts/types-BP2OCcpg.js';
8
9
  import '../_dts/types-DJ79Tg5J.js';
9
10
 
10
11
  interface DragState {
@@ -26,7 +27,7 @@ interface UseDragDropArgs<TS, TC> {
26
27
  }
27
28
  interface UseDragDropResult {
28
29
  drag: DragState | null;
29
- startDrag: (item: PaletteItem, originScreenPos: Point) => void;
30
+ startDrag: (item: PaletteItem, e: PointerEvent) => void;
30
31
  }
31
32
  declare function useDragDrop<TS, TC>({ capability, canvasContainerRef, view, state, config, setState, emit, worldSpec, }: UseDragDropArgs<TS, TC>): UseDragDropResult;
32
33
  interface DragOverlayProps {
@@ -42,7 +43,7 @@ declare function DragGhost({ item, screenPos }: DragGhostProps): ReactPortal | n
42
43
 
43
44
  interface PaletteProps {
44
45
  items: PaletteItem[];
45
- onDragStart: (item: PaletteItem, originScreenPos: Point) => void;
46
+ onDragStart: (item: PaletteItem, e: PointerEvent) => void;
46
47
  className?: string;
47
48
  }
48
49
  declare function Palette({ items, onDragStart, className }: PaletteProps): react_jsx_runtime.JSX.Element;
@@ -1,5 +1,4 @@
1
- export { DragGhost, DragOverlay, Palette, useDragDrop } from '../chunk-D7QIPGEB.js';
1
+ export { DragGhost, DragOverlay, Palette, useDragDrop } from '../chunk-RS3HRQWU.js';
2
2
  import '../chunk-2AYGEN57.js';
3
- import '../chunk-DG2IFMLA.js';
4
3
  //# sourceMappingURL=index.js.map
5
4
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -2,27 +2,30 @@ export { LayerStack, LayerStackItem, LayerStackProps } from './ui/layers/index.j
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
- export { C as CheckboxRow, a as CheckboxRowProps, b as ColorRow, c as ColorRowProps, d as ControlPanel, N as NumberRow, e as NumberRowProps, P as PropertyList, f as PropertyListPack, g as PropertyListProps, h as PropertyOption, i as PropertyPanel, j as PropertyPanelProps, k as PropertyRow, l as PropertyRowLayout, m as PropertyRowProps, n as PropertyRowVariant, o as PropertySpan, p as PropertySpanProps, S as SelectRow, q as SelectRowProps, r as SliderRow, s as SliderRowProps, T as TextRow, t as TextRowProps, u as ToggleRow, v as ToggleRowProps } from './_dts/index-FEa1MudK.js';
6
- import { D as DrawCommand, N as Node, V as View, P as Path, F as FillStyle, b as StyledRun, c as TextStyle, d as Stroke, B as BuiltinToolId, T as ToolPrefLeaf } from './_dts/weasel-canvas-FJTFi3ZZ.js';
7
- import { d as WorldRect, A as AnnotationData, e as AnnotationMeaning, M as MarkScene, C as CaptureSource, f as CaptureOptions, g as CaptureResult, h as AnnotationTarget, i as AnnotationsApi, j as AnnotationsCapability, T as TrialTool, k as AnnotationKind, V as ViewTransform, I as Instrument, l as InstrumentList, m as TrialContribution } from './_dts/frac-X7mWgd7y.js';
8
- export { n as Annotation, o as AnnotationInit, p as AnnotationPatch, q as AnnotationQuery, r as AnnotationStatus, s as AnnotationStoreOptions, t as AnnotationTargetInfo, u as CanvasCapability, v as CanvasLayer, w as CaptureDeps, x as DEFAULT_FRAME, b as DragDropCapability, D as DragFeedback, F as FracPoint, y as FracRect, H as HitResult, z as IconComponent, L as LOUPE_DEFAULTS, B as LayerCapability, E as LayerDescriptor, G as LoupeCapability, J as LoupeDeclaration, K as LoupeRenderArgs, P as PaletteItem, a as Point, R as RenderContext, N as ResolvedLoupe, S as SerializedAnnotations, O as SidebarSection, Q as StatusReadout, U as SystemEvent, X as ToolCapability, Y as ToolItem, Z as ToolbarItem, _ as TrialChromeContext, $ as TrialRegion, a0 as UndoCapability, a1 as ViewportControl, a2 as ViewportSize, W as WorldFrame, c as WorldSpec, a3 as annotationsFromJSON, a4 as applyCamera, a5 as createAnnotationScene, a6 as createAnnotationStore, a7 as fracContains, a8 as fracIntersects, a9 as fracToWorld, aa as resolveFrame, ab as resolveLoupe, ac as roundFrac, ad as worldToFrac } from './_dts/frac-X7mWgd7y.js';
5
+ import { P as PropertyMetricProps, a as PropertyListPack } from './_dts/index-DelFfeV0.js';
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-DelFfeV0.js';
7
+ import { DrawCommand, SceneNode, View, Path, FillStyle, StyledRun, TextStyle, Stroke, BuiltinToolId, ToolPrefLeaf, ToolPrefGroup } from '@weasel-js/core';
8
+ import { d as WorldRect, A as AnnotationData, e as AnnotationMeaning, M as MarkScene, C as CaptureSource, f as CaptureOptions, g as CaptureResult, h as AnnotationTarget, i as AnnotationsApi, j as AnnotationsCapability, T as TrialTool, k as AnnotationKind, V as ViewTransform, I as Instrument, l as InstrumentList, m as TrialContribution } from './_dts/frac-B5mB8LsJ.js';
9
+ export { n as Annotation, o as AnnotationInit, p as AnnotationPatch, q as AnnotationQuery, r as AnnotationStatus, s as AnnotationStoreOptions, t as AnnotationTargetInfo, u as CanvasCapability, v as CanvasLayer, w as CaptureDeps, x as DEFAULT_FRAME, b as DragDropCapability, D as DragFeedback, F as FracPoint, y as FracRect, H as HitResult, z as IconComponent, L as LOUPE_DEFAULTS, B as LayerCapability, E as LayerDescriptor, G as LoupeCapability, J as LoupeDeclaration, K as LoupeRenderArgs, P as PaletteItem, a as Point, R as RenderContext, N as ResolvedLoupe, S as SerializedAnnotations, O as SidebarSection, Q as StatusReadout, U as SystemEvent, X as ToolCapability, Y as ToolItem, Z as ToolbarItem, _ as TrialChromeContext, $ as TrialRegion, a0 as UndoCapability, a1 as ViewportControl, a2 as ViewportSize, W as WorldFrame, c as WorldSpec, a3 as annotationsFromJSON, a4 as applyCamera, a5 as createAnnotationScene, a6 as createAnnotationStore, a7 as fracContains, a8 as fracIntersects, a9 as fracToWorld, aa as resolveFrame, ab as resolveLoupe, ac as roundFrac, ad as worldToFrac } from './_dts/frac-B5mB8LsJ.js';
10
+ import { i as TrialInfo, a as StorageAdapter, h as LabMode, T as TrialRecord, c as SavedSnapshot } from './_dts/types-BP2OCcpg.js';
11
+ export { C as CreateLabStoreOptions, L as LabDocument, b as LabStoreState, S as SerializedTrial, d as TrialStateHandle, U as UndoStack, e as UndockedPanel, f as UndockedPanels, g as dockPanel, p as panelKey, u as undockPanel } from './_dts/types-BP2OCcpg.js';
9
12
  export { CanvasStack, CanvasStackProps, OrbitHandlers, OrbitView, PITCH_LIMIT, PanZoomHandlers, UseOrbitOptions, UsePanZoomOptions, Vec3, ZoomAtOptions, centerOn, clampPitch, orbitAfterDrag, orbitAfterWheel, screenToWorld, useOrbit, usePanZoom, worldToScreen, wrapYaw, zoomAt } from './canvas/index.js';
10
- export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from './_dts/CanvasStackContext-BIRUVVGH.js';
11
- export { PaletteRegion, PaletteRegionProps, SidebarRegion, SidebarRegionProps, StatusRegion, StatusRegionProps, TitleBarRegion, TitleBarRegionProps, ToolbarRegion, ToolbarRegionProps, ViewportRegion, ViewportRegionProps, builtinContributions, mergeContributions, suppressContributions } from './chrome/index.js';
12
- import { b as ConfigNode, A as Annotations, N as NodeOptions, c as ControlRenderer, d as ConfigOption, a as ConfigSchema, I as InferConfig, C as ConfigField, R as ResolvedConfig, e as ConfigRule, L as LeafPatch, f as ConfigRuleContext } from './_dts/types-lg4TSCb2.js';
13
- export { g as CheckboxField, h as ColorField, i as ConfigFieldBase, j as ConfigFieldType, k as ConfigOf, l as NodeValue, m as NumberField, S as SectionSpec, n as SelectField, o as SelectOption, p as SliderField, T as TextField } from './_dts/types-lg4TSCb2.js';
13
+ export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from './_dts/CanvasStackContext-Dde8_1my.js';
14
+ export { PaletteRegion, PaletteRegionProps, SidebarRegion, SidebarRegionProps, StatusRegion, StatusRegionProps, TitleBarPlacement, TitleBarRegion, TitleBarRegionProps, ToolbarRegion, ToolbarRegionProps, ViewportRegion, ViewportRegionProps, builtinContributions, mergeContributions, suppressContributions } from './chrome/index.js';
15
+ import { b as ConfigNode, A as Annotations, N as NodeOptions, c as ControlRenderer, d as ConfigOption, e as ConfigShape, f as ConfigBranch, B as BranchAnnotations, g as BranchOptions, a as ConfigSchema, I as InferConfig, h as ConfigEntry, R as ResolvedConfig, i as ConfigRule, L as LeafPatch, j as ConfigRuleContext } from './_dts/types-B9_zrHmb.js';
16
+ export { k as ConfigOf, C as ConfigPath, E as EntryValue, l as NodeValue, S as SectionSpec, V as ValueAtPath } from './_dts/types-B9_zrHmb.js';
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';
14
19
  import { J as JobHandle } from './_dts/types-DJ79Tg5J.js';
15
20
  export { a as JobCapability, b as JobEvent, c as JobFailure, d as JobStatus } from './_dts/types-DJ79Tg5J.js';
16
21
  export { UseJobOptions, useJob } from './job/index.js';
17
- import { a as StorageAdapter, h as LabMode, T as TrialRecord, c as SavedSnapshot } from './_dts/types-ChVJJHvk.js';
18
- export { C as CreateLabStoreOptions, L as LabDocument, b as LabStoreState, S as SerializedTrial, d as TrialStateHandle, U as UndoStack, e as UndockedPanel, f as UndockedPanels, g as dockPanel, p as panelKey, u as undockPanel } from './_dts/types-ChVJJHvk.js';
19
- export { LayerList, LayerListProps } from './layers/index.js';
22
+ export { LayerList, LayerListProps, LayerTreeNode } from './layers/index.js';
20
23
  export { CanvasLoupe, CanvasLoupeProps, DomLoupe, DomLoupeProps, LensCamera, LoupeBubble, LoupeBubbleProps, LoupeState, SourceRect, TrialLoupe, TrialLoupeProps, UseLoupeOptions, drawCanvasLens, lensCamera, lensSourceRect, sampleStack, useLoupe } from './loupe/index.js';
21
24
  export { FloatingPanel, FloatingPanelProps, FpsMeter, JobProgress, JobProgressProps, Legend, LegendEntry, LegendMark, LegendProps, ScaleIndicator, ScaleIndicatorProps, Sidebar, SidebarProps, StatusBar, StatusBarProps, StatusBarSectionProps, Toolbar, ToolbarButtonProps, ToolbarGroupProps, ToolbarProps, ZoomControl, ZoomControlProps } from './primitives/index.js';
22
- export { C as CURRENT_DOCUMENT_VERSION, b as LabStoreContext, c as LabStoreProvider, T as TrialIdContext, d as TrialIdProvider, f as createMemoryAdapter, l as labDocumentKey, g as localStorageAdapter, n as noneAdapter, q as quarantineKey, s as sessionStorageAdapter, u as urlHashAdapter, h as useLabStore, i as useTrialId, j as useTrialState } from './_dts/useTrialState-Cdm13fvl.js';
25
+ export { C as CURRENT_DOCUMENT_VERSION, b as LabStoreContext, c as LabStoreProvider, T as TrialIdContext, d as TrialIdProvider, f as createMemoryAdapter, l as labDocumentKey, g as localStorageAdapter, n as noneAdapter, q as quarantineKey, s as sessionStorageAdapter, u as urlHashAdapter, h as useLabStore, i as useTrialId, j as useTrialState } from './_dts/useTrialState-D6Vb3T-g.js';
23
26
  export { Box, Rect, SurfaceCanvasContext, SurfaceContext, SurfaceFrame, SurfaceHandle, TilePainter, UseTiledSurfaceOptions, composeRects, rectsEqual, toDeviceRect, useSurface, useSurfaceCanvas, useSurfaceOptional, useSurfaceTile, useTileId, useTiledSurface } from './surface/index.js';
24
27
  export { EventBus, EventListener, clearUndo, createEventBus, emptyStack, pushSnapshot, redo, undo } from './undo/index.js';
25
- import './_dts/PrefsForm.d-CgxUequc.js';
28
+ import './_dts/PrefsForm.d-DDHFANkc.js';
26
29
  import 'windease';
27
30
  import 'zustand/vanilla';
28
31
 
@@ -64,14 +67,14 @@ interface CurveFieldProps {
64
67
  declare function CurveField({ values, min, max, step, width, height, defaults, onChange, marks, }: CurveFieldProps): react_jsx_runtime.JSX.Element;
65
68
 
66
69
  /** Props for `<Subpanel>`. */
67
- interface SubpanelProps {
70
+ interface SubpanelProps extends PropertyMetricProps {
68
71
  title: ReactNode;
69
72
  children: ReactNode;
70
73
  className?: string;
71
74
  }
72
75
  /** A typographic divider inside a property list: a small title flanked by a
73
76
  * rule. Purely a heading — use `<PropertyGroup>` for a bordered section. */
74
- declare function Subpanel({ title, children, className }: SubpanelProps): react_jsx_runtime.JSX.Element;
77
+ declare function Subpanel({ title, children, className, density, align }: SubpanelProps): react_jsx_runtime.JSX.Element;
75
78
  /** Props for `<EffectCard>`. */
76
79
  interface EffectCardProps {
77
80
  /** Card title rendered in the title bar (e.g. effect kind label or a select). */
@@ -131,27 +134,40 @@ interface EffectCardListProps<T extends EffectCardListItem> {
131
134
  declare function EffectCardList<T extends EffectCardListItem>({ items, renderItem, onReorder, empty, defaultExpandedIds, }: EffectCardListProps<T>): react_jsx_runtime.JSX.Element;
132
135
 
133
136
  /** Props for `<PropertyGroup>`. */
134
- interface PropertyGroupProps {
137
+ interface PropertyGroupProps extends PropertyMetricProps {
135
138
  /** Title rendered between two rules at the top of the group. */
136
139
  title: ReactNode;
137
140
  /** When true the group renders nothing — useful for conditional sections. */
138
141
  hidden?: boolean;
139
- children: ReactNode;
140
- className?: string;
141
142
  /**
142
- * How rows pack into the 2-column grid.
143
- * - `'auto-color'` (default): only color rows pair side-by-side; everything
144
- * else spans the full width.
145
- * - `'pairs'`: every row auto-places into the 2-column grid two-per-row.
143
+ * Give the title a twisty that folds the rows away. Implied by any of the
144
+ * three props below, so it is only needed for a group that starts open and
145
+ * keeps its own state.
146
+ */
147
+ collapsible?: boolean;
148
+ /** Start folded. Read once; the group owns the state from then on. */
149
+ defaultCollapsed?: boolean;
150
+ /**
151
+ * Folded or not, as the consumer holds it. Given, the group keeps no state
152
+ * of its own and every toggle arrives at `onCollapsedChange` instead — which
153
+ * is what a panel that remembers its sections past a reload needs.
146
154
  */
147
- pack?: 'auto-color' | 'pairs';
155
+ collapsed?: boolean;
156
+ onCollapsedChange?: (next: boolean) => void;
157
+ children: ReactNode;
158
+ className?: string;
159
+ /** How rows pack into the 2-column grid — see `<PropertyList pack>`. */
160
+ pack?: PropertyListPack;
148
161
  }
149
162
  /**
150
163
  * Visually-bordered group inside a PropertyList. Use to scope a set of
151
164
  * related rows under a heading (e.g. "Aqua", "Bevel", "Dome" sections
152
165
  * inside a fill effect's controls).
166
+ *
167
+ * A collapsible group keeps its rows mounted and hides them, so a control's
168
+ * local state survives being folded away.
153
169
  */
154
- declare function PropertyGroup({ title, hidden, children, className, pack, }: PropertyGroupProps): react_jsx_runtime.JSX.Element | null;
170
+ declare function PropertyGroup({ title, hidden, collapsible, defaultCollapsed, collapsed, onCollapsedChange, children, className, pack, density, align, }: PropertyGroupProps): react_jsx_runtime.JSX.Element | null;
155
171
 
156
172
  /** The subset of a mark's scene node this needs: where it is, and what it is. */
157
173
  interface PaintableMark {
@@ -201,7 +217,7 @@ interface MarkDrawOptions {
201
217
  * export that resolves a status colour or a stale dash differently from the
202
218
  * screen produces a picture nobody was looking at.
203
219
  */
204
- declare function createMarkDrawOne(opts: MarkDrawOptions): (node: Node<AnnotationData, 'marks', WorldRect>, pose: WorldRect, view: View) => DrawCommand[];
220
+ declare function createMarkDrawOne(opts: MarkDrawOptions): (node: SceneNode<AnnotationData, 'marks', WorldRect>, pose: WorldRect, view: View) => DrawCommand[];
205
221
  /** How a mark looks, as opposed to where it is. Separate from the callback
206
222
  * above because an SVG export resolves the same appearance without ever
207
223
  * building a draw command. */
@@ -445,8 +461,11 @@ interface SvgTextNode {
445
461
  * in `data.fill` / `data.stroke`. Not `SvgPaint`, which is the path
446
462
  * nodes' shape — a text paint reaches the renderer through the runs, and
447
463
  * `StyledRun.fill` / `.stroke` override these per range.
464
+ *
465
+ * `null` is SVG's `fill="none"`: outline-only text, painted by its stroke
466
+ * alone. Absent takes the default black.
448
467
  */
449
- fill?: FillStyle;
468
+ fill?: FillStyle | null;
450
469
  stroke?: Stroke;
451
470
  /** Element-level opacity (`opacity="..."`), 0..1. */
452
471
  opacity?: number;
@@ -536,11 +555,14 @@ interface AnnotationTargetsProps {
536
555
  capability: AnnotationsCapability;
537
556
  state: unknown;
538
557
  config: unknown;
558
+ /** The trial these targets belong to. `capability.targets` is told it, so a
559
+ * consumer holding per-trial refs can hand back this trial's. */
560
+ trial: TrialInfo;
539
561
  annotations: AnnotationsApi;
540
562
  activeToolId: string | null;
541
563
  }
542
564
  /** One overlay per region the instrument said accepts marks. */
543
- declare function AnnotationTargets({ capability, state, config, annotations, activeToolId, }: AnnotationTargetsProps): react_jsx_runtime.JSX.Element;
565
+ declare function AnnotationTargets({ capability, state, config, trial, annotations, activeToolId, }: AnnotationTargetsProps): react_jsx_runtime.JSX.Element;
544
566
 
545
567
  /** Which weasel tool an annotation tool drives, and what kind of mark that
546
568
  * makes. `select` makes none. */
@@ -583,6 +605,8 @@ declare function fromWeaselView(v: View): ViewTransform;
583
605
  */
584
606
  declare function fitView(content: ContentSize, pane: PaneSize): ViewTransform;
585
607
 
608
+ /** Whether a schema entry is a branch rather than a leaf. */
609
+ declare function isConfigBranch(entry: ConfigEntry): entry is ConfigBranch;
586
610
  /** Shared chaining surface. Every method clones, so a node can be reused as a
587
611
  * base for several leaves without one bleeding into the next. */
588
612
  declare abstract class BaseNode<T> implements ConfigNode<T> {
@@ -604,8 +628,11 @@ declare abstract class BaseNode<T> implements ConfigNode<T> {
604
628
  hidden(): this;
605
629
  /** Pair with a sibling sharing this id, side-by-side on one row. */
606
630
  pair(pair: string): this;
607
- /** Render under a named section heading. */
608
- section(section: string): this;
631
+ /** Render under a named section heading. `collapsed` opens the section
632
+ * folded — say it on any one of the section's leaves. */
633
+ section(label: string, opts?: {
634
+ collapsed?: boolean;
635
+ }): this;
609
636
  /** Show this row only while the predicate holds. Presentational — the value
610
637
  * stays in config and the instrument still reads it. */
611
638
  showIf(predicate: (config: Record<string, unknown>) => boolean): this;
@@ -659,6 +686,31 @@ declare class CustomNode<T> extends BaseNode<T> {
659
686
  constructor(kind: string, defaultValue: T, annotations?: Readonly<Annotations>, options?: Readonly<NodeOptions>);
660
687
  protected with(annotations: Annotations, options: NodeOptions): this;
661
688
  }
689
+ /**
690
+ * A branch of the schema: its children nest under its key, so a leaf inside
691
+ * one is read and written at a dotted path. Distinct from `.section()`, which
692
+ * puts a heading over sibling leaves and leaves their paths alone.
693
+ */
694
+ declare class GroupNode<S extends ConfigShape> implements ConfigBranch<S> {
695
+ readonly children: S;
696
+ readonly annotations: Readonly<BranchAnnotations>;
697
+ readonly options: Readonly<BranchOptions>;
698
+ constructor(children: S, annotations?: Readonly<BranchAnnotations>, options?: Readonly<BranchOptions>);
699
+ private with;
700
+ /** Heading for the group's rows. Defaults to the key, title-cased. */
701
+ label(name: string): GroupNode<S>;
702
+ /** Longer help text. Carried on the resolved `PrefGroup`, where weasel-ui's
703
+ * `PrefsForm` draws it under the heading; `ControlPanel` has no place for
704
+ * it yet and shows the heading alone. */
705
+ describe(description: string): GroupNode<S>;
706
+ /** Render this whole group under a named section heading. */
707
+ section(label: string, opts?: {
708
+ collapsed?: boolean;
709
+ }): GroupNode<S>;
710
+ /** Show this group only while the predicate holds. Presentational — every
711
+ * value beneath it stays in config and the instrument still reads it. */
712
+ showIf(predicate: (config: Record<string, unknown>) => boolean): GroupNode<S>;
713
+ }
662
714
  /**
663
715
  * Builds an instrument's config: the values, their types, and how each is
664
716
  * edited, in one declaration.
@@ -667,6 +719,8 @@ declare class CustomNode<T> extends BaseNode<T> {
667
719
  * const config = f.schema({
668
720
  * showGrid: f.boolean(true),
669
721
  * cellSize: f.number(20).range(5, 80).step(5).label('Grid spacing'),
722
+ * // Nested: read and written at `grid.color`.
723
+ * grid: f.group({ color: f.color('#ffffff') }),
670
724
  * })
671
725
  * ```
672
726
  */
@@ -682,10 +736,14 @@ declare const f: {
682
736
  /** A leaf with no declared kind: the rule chain decides, which is how a lab
683
737
  * states a convention like "every `*Color` key is a color picker". */
684
738
  value: <T>(def: T) => ValueNode<T>;
739
+ /** A branch: its children nest under this key, so `grid: f.group({ size })`
740
+ * puts the value at `config.grid.size` and addresses it as `'grid.size'`.
741
+ * Groups nest as deeply as the schema wants. */
742
+ group: <const S extends ConfigShape>(children: S) => GroupNode<S>;
685
743
  /** A leaf of a kind a lab supplies the control for, through `controls`. */
686
744
  custom: <T>(kind: string, def: T, validate?: (leaf: ToolPrefLeaf) => string[]) => CustomNode<T>;
687
- /** Collect leaves into an instrument's config. */
688
- schema<S extends Record<string, ConfigNode>>(nodes: S): ConfigSchema<InferConfig<S>>;
745
+ /** Collect leaves and groups into an instrument's config. */
746
+ schema<S extends ConfigShape>(nodes: S): ConfigSchema<InferConfig<S>>;
689
747
  };
690
748
 
691
749
  /**
@@ -697,12 +755,37 @@ declare const f: {
697
755
  */
698
756
  declare function fromConfigFields(fields: readonly ConfigField[]): ResolvedConfig;
699
757
 
758
+ /** The value at a dotted path. `undefined` when a segment is missing or the
759
+ * walk hits something that is not a record. */
760
+ declare function valueAtPath(config: unknown, path: string): unknown;
761
+ /** Whether a dotted path is actually present, which a `undefined` value is
762
+ * not enough to tell you. */
763
+ declare function hasConfigPath(config: unknown, path: string): boolean;
764
+ /** A copy of `config` with `value` written at a dotted path. Every record on
765
+ * the way down is copied and the input is left alone; a missing — or
766
+ * non-record — intermediate is replaced with the branch the path implies. */
767
+ declare function withValueAtPath<T>(config: T, path: string, value: unknown): T;
768
+ /**
769
+ * `stored` with every gap filled from `defaults`, down the whole tree.
770
+ *
771
+ * This is how a config written before its schema grew a branch still loads:
772
+ * the branch arrives at its defaults instead of `undefined`, and a key the
773
+ * defaults no longer mention is kept rather than dropped, so nothing is lost
774
+ * to a schema change the author has not finished making.
775
+ */
776
+ declare function fillConfigDefaults<T>(stored: unknown, defaults: T): T;
777
+ /** A node in a resolved schema tree, by dotted path. Structural rather than
778
+ * `isPrefLeaf` so this stays free of a runtime import. */
779
+ declare function schemaNodeAtPath(group: ToolPrefGroup, path: string): ToolPrefLeaf | ToolPrefGroup | undefined;
780
+
700
781
  /**
701
782
  * Resolve a schema into the vocabulary weasel-ui renders, running each leaf
702
783
  * through the consumer's rules and then labkit's own.
703
784
  *
704
- * The group is flat — every leaf is a direct child — so a leaf's path is its
705
- * config key and both `ControlPanel` and `PrefsForm` address it identically.
785
+ * The group mirrors the schema's own nesting: an `f.group` becomes a nested
786
+ * `PrefGroup`, so a leaf's dotted path within the tree is the path its value
787
+ * is written at, and both `ControlPanel` and `PrefsForm` address it
788
+ * identically.
706
789
  */
707
790
  declare function resolveConfigSchema<TC>(schema: ConfigSchema<TC>, rules?: readonly ConfigRule[]): ResolvedConfig;
708
791
 
@@ -733,9 +816,10 @@ declare function applyRules(seed: LeafPatch, ctx: Omit<ConfigRuleContext, 'leaf'
733
816
  declare function useConfigSchema(instrument: Instrument<any, any, any>): ResolvedConfig;
734
817
 
735
818
  /**
736
- * Whether a leaf's row should be drawn right now.
819
+ * Whether the row at a dotted path should be drawn right now. A group answers
820
+ * for its whole subtree — hiding one hides everything under it.
737
821
  *
738
- * `hidden` is the leaf's own static flag; `showIf` is the schema's predicate
822
+ * `hidden` is the node's own static flag; `showIf` is the schema's predicate
739
823
  * over the live config. Both are presentational — a hidden leaf keeps its
740
824
  * value and the instrument still reads it.
741
825
  */
@@ -816,13 +900,43 @@ interface LabProps {
816
900
  * per record in a grid. Each trial runs one of `instruments`. */
817
901
  declare function Lab({ instruments, defaultInstrument, storage, storageKey, mode, nebula, title, footer, chrome, suppress, tools, configRules, controls, children, }: LabProps): react_jsx_runtime.JSX.Element;
818
902
 
903
+ /** What a trial opens on beyond its instrument's own defaults. */
904
+ interface AddTrialOptions<TC = Record<string, unknown>> {
905
+ /** Overlaid on `defaultConfig()` before `initialState` reads it, so a trial
906
+ * opened on a subject is running that subject from its first frame. Keys
907
+ * whose value is `undefined` are left to the default. */
908
+ config?: Partial<TC>;
909
+ }
910
+ /** Append a new trial running `instrumentName`, at that instrument's default
911
+ * config — with `options.config` written over it — and the initial state
912
+ * that config produces. */
913
+ declare function addTrial(trials: TrialRecord[], instruments: InstrumentList, instrumentName: string, options?: AddTrialOptions): TrialRecord[];
914
+ /** Insert a deep copy of a trial directly after it. The copy starts with
915
+ * an empty undo history — the original's is not shared. */
916
+ declare function cloneTrial(trials: TrialRecord[], id: string): TrialRecord[];
917
+ /** Remove a trial, unless it is the last one — a lab always has at least
918
+ * one. */
919
+ declare function closeTrial(trials: TrialRecord[], id: string): TrialRecord[];
920
+ /** Return a trial to what it opened on — its instrument's defaults under the
921
+ * seed `addTrial` was given — keeping its id and its place in the list. */
922
+ declare function resetTrial(trials: TrialRecord[], id: string, instruments: InstrumentList): TrialRecord[];
923
+ /**
924
+ * Reorder to match `ids`. Ids the list doesn't mention keep their relative
925
+ * order at the end, and ids it names that no longer exist are dropped — a
926
+ * reorder that raced a close should not resurrect the closed trial.
927
+ */
928
+ declare function reorderTrials(trials: TrialRecord[], ids: readonly string[]): TrialRecord[];
929
+
819
930
  /** Lab-wide state and commands: the available instruments, the open
820
931
  * trials and the operations over them, saved snapshots, and the color
821
932
  * mode. */
822
933
  interface LabContextValue {
823
934
  instruments: InstrumentList;
824
935
  trials: TrialRecord[];
825
- addTrial: (instrumentName: string) => void;
936
+ /** Open a trial running `instrumentName`. `options.config` is written over
937
+ * that instrument's defaults, which is where a trial opened on a subject
938
+ * says which subject. */
939
+ addTrial: (instrumentName: string, options?: AddTrialOptions) => void;
826
940
  cloneTrial: (id: string) => void;
827
941
  closeTrial: (id: string) => void;
828
942
  resetTrial: (id: string) => void;
@@ -1069,24 +1183,5 @@ interface TrialChromeProps {
1069
1183
  * each region its slice. */
1070
1184
  declare function TrialChrome({ trialId, record, instrument, isLastTrial, undoBindings, job, loupe, trialChrome, chrome, suppress, activeToolId, setActiveTool, children, }: TrialChromeProps): react_jsx_runtime.JSX.Element;
1071
1185
 
1072
- /** Append a new trial running `instrumentName`, at that instrument's
1073
- * default config and initial state. */
1074
- declare function addTrial(trials: TrialRecord[], instruments: InstrumentList, instrumentName: string): TrialRecord[];
1075
- /** Insert a deep copy of a trial directly after it. The copy starts with
1076
- * an empty undo history — the original's is not shared. */
1077
- declare function cloneTrial(trials: TrialRecord[], id: string): TrialRecord[];
1078
- /** Remove a trial, unless it is the last one — a lab always has at least
1079
- * one. */
1080
- declare function closeTrial(trials: TrialRecord[], id: string): TrialRecord[];
1081
- /** Return a trial to its instrument's defaults, keeping its id and its
1082
- * place in the list. */
1083
- declare function resetTrial(trials: TrialRecord[], id: string, instruments: InstrumentList): TrialRecord[];
1084
- /**
1085
- * Reorder to match `ids`. Ids the list doesn't mention keep their relative
1086
- * order at the end, and ids it names that no longer exist are dropped — a
1087
- * reorder that raced a close should not resurrect the closed trial.
1088
- */
1089
- declare function reorderTrials(trials: TrialRecord[], ids: readonly string[]): TrialRecord[];
1090
-
1091
- export { ANNOTATION_TOOLS, ANNOTATION_WEASEL_TOOLS, AnnotationData, AnnotationKind, AnnotationMeaning, AnnotationOverlay, AnnotationTarget, AnnotationTargets, Annotations, AnnotationsApi, AnnotationsCapability, AnnotationsContext, CaptureOptions, CaptureResult, CaptureSource, ConfigField, ConfigNode, ConfigOption, ConfigRule, ConfigRuleContext, ConfigSchema, ControlRenderer, CurveField, DEFAULT_VIEW, EffectCard, EffectCardList, ExportMenu, InferConfig, Instrument, InstrumentList, JobHandle, Lab, LabContext, LabMode, LabPalette, LabShell, LeafPatch, MarkList, MarkScene, NodeOptions, PropertyGroup, ResolvedConfig, SavedSnapshot, StorageAdapter, Subpanel, Trial, TrialBody, TrialChrome, TrialContribution, TrialRecord, TrialTool, ViewTransform, Workspace, WorldRect, addTrial, annotationToolInfo, applyRules, as2DView, builtinRules, capturePlan, captureTarget, cloneTrial, closeTrial, composeCaptureSvg, createMarkDrawOne, defineInstrument, f, fitView, fromConfigFields, fromWeaselView, interstellarTheme, isLeafVisible, isStale, markCommands, markSvgNodes, reorderTrials, resetTrial, resolveConfigSchema, resolveMarkStyle, seenFrom, titleCase, toWeaselView, useAnnotations, useAnnotationsOptional, useConfigSchema, useLabContext, validateConfigSchema };
1092
- export type { AnnotationOverlayProps, AnnotationTargetsProps, AnnotationToolInfo, CaptureArgs, CapturePlan, ComposeSvgArgs, ContentSize, CurveFieldProps, CurveMark, EffectCardListItem, EffectCardListProps, EffectCardProps, InstrumentSpec, LabContextValue, LabPaletteProps, LabProps, LabShellProps, MarkDrawOptions, MarkListProps, MarkStyle, PaintableMark, PaneSize, PanelDescriptor, PropertyGroupProps, SubpanelProps, TrialBodyProps, TrialChromeProps, TrialLayout, TrialProps, UndoBindings, ValidationResult, ViewTransform2D, WorkspaceProps };
1186
+ export { ANNOTATION_TOOLS, ANNOTATION_WEASEL_TOOLS, AnnotationData, AnnotationKind, AnnotationMeaning, AnnotationOverlay, AnnotationTarget, AnnotationTargets, Annotations, AnnotationsApi, AnnotationsCapability, AnnotationsContext, BranchAnnotations, BranchOptions, CaptureOptions, CaptureResult, CaptureSource, ConfigBranch, ConfigEntry, ConfigField, ConfigNode, ConfigOption, ConfigRule, ConfigRuleContext, ConfigSchema, ConfigShape, ControlRenderer, CurveField, DEFAULT_VIEW, EffectCard, EffectCardList, ExportMenu, InferConfig, Instrument, InstrumentList, JobHandle, Lab, LabContext, LabMode, LabPalette, LabShell, LeafPatch, MarkList, MarkScene, NodeOptions, PropertyGroup, PropertyListPack, ResolvedConfig, SavedSnapshot, StorageAdapter, Subpanel, Trial, TrialBody, TrialChrome, TrialContribution, TrialInfo, TrialRecord, TrialTool, ViewTransform, Workspace, WorldRect, addTrial, annotationToolInfo, applyRules, as2DView, builtinRules, capturePlan, captureTarget, cloneTrial, closeTrial, composeCaptureSvg, createMarkDrawOne, defineInstrument, f, fillConfigDefaults, fitView, fromConfigFields, fromWeaselView, hasConfigPath, interstellarTheme, isConfigBranch, isLeafVisible, isStale, markCommands, markSvgNodes, reorderTrials, resetTrial, resolveConfigSchema, resolveMarkStyle, schemaNodeAtPath, seenFrom, titleCase, toWeaselView, useAnnotations, useAnnotationsOptional, useConfigSchema, useLabContext, validateConfigSchema, valueAtPath, withValueAtPath };
1187
+ export type { AddTrialOptions, AnnotationOverlayProps, AnnotationTargetsProps, AnnotationToolInfo, CaptureArgs, CapturePlan, ComposeSvgArgs, ContentSize, CurveFieldProps, CurveMark, EffectCardListItem, EffectCardListProps, EffectCardProps, InstrumentSpec, LabContextValue, LabPaletteProps, LabProps, LabShellProps, MarkDrawOptions, MarkListProps, MarkStyle, PaintableMark, PaneSize, PanelDescriptor, PropertyGroupProps, SubpanelProps, TrialBodyProps, TrialChromeProps, TrialLayout, TrialProps, UndoBindings, ValidationResult, ViewTransform2D, WorkspaceProps };