@weasel-js/labkit 1.4.0 → 1.4.2

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 (133) hide show
  1. package/README.md +8 -0
  2. package/dist/_dts/{CanvasStackContext-D6M0o8cQ.d.ts → CanvasStackContext-kjILVnPj.d.ts} +1 -1
  3. package/dist/_dts/PrefsForm.d-CgxUequc.d.ts +20 -0
  4. package/dist/_dts/{frac-QS7XzvpG.d.ts → frac-A4R6v4ld.d.ts} +36 -13
  5. package/dist/_dts/{index-B2X21G1c.d.ts → index-CsU9WhjM.d.ts} +90 -30
  6. package/dist/_dts/{types-ChVJJHvk.d.ts → types-BbXpvQa8.d.ts} +20 -1
  7. package/dist/_dts/{types-C1Zw7s5P.d.ts → types-lg4TSCb2.d.ts} +2 -1
  8. package/dist/_dts/{useTrialState-Cdm13fvl.d.ts → useTrialState-DKjqpv20.d.ts} +5 -1
  9. package/dist/_dts/weasel-canvas-FJTFi3ZZ.d.ts +5041 -0
  10. package/dist/canvas/index.d.ts +16 -16
  11. package/dist/canvas/index.js +2 -2
  12. package/dist/chrome/index.d.ts +15 -9
  13. package/dist/chrome/index.js +5 -5
  14. package/dist/{chunk-7VW3S44V.js → chunk-54ZWZ5FQ.js} +908 -301
  15. package/dist/chunk-54ZWZ5FQ.js.map +1 -0
  16. package/dist/{chunk-Y2HK44TG.js → chunk-D5KQ5OY6.js} +3 -3
  17. package/dist/{chunk-Y2HK44TG.js.map → chunk-D5KQ5OY6.js.map} +1 -1
  18. package/dist/{chunk-VHFQKAUL.js → chunk-FJG4PHTL.js} +83 -75
  19. package/dist/chunk-FJG4PHTL.js.map +1 -0
  20. package/dist/{chunk-LN6JDUGB.js → chunk-HXXTULDN.js} +2 -2
  21. package/dist/{chunk-LN6JDUGB.js.map → chunk-HXXTULDN.js.map} +1 -1
  22. package/dist/{chunk-L5WBGUVR.js → chunk-ISSVF5PT.js} +2753 -2654
  23. package/dist/chunk-ISSVF5PT.js.map +1 -0
  24. package/dist/chunk-NSOVI3AZ.js +170 -0
  25. package/dist/chunk-NSOVI3AZ.js.map +1 -0
  26. package/dist/{chunk-YQGQUBKA.js → chunk-TN7YSJVU.js} +62 -60
  27. package/dist/chunk-TN7YSJVU.js.map +1 -0
  28. package/dist/{chunk-4AMN4MMB.js → chunk-UDXOYZEC.js} +53 -39
  29. package/dist/chunk-UDXOYZEC.js.map +1 -0
  30. package/dist/{chunk-LJSIUFYD.js → chunk-ULDW42CR.js} +23 -2
  31. package/dist/chunk-ULDW42CR.js.map +1 -0
  32. package/dist/{chunk-QR5V3AFG.js → chunk-UTOEDPNU.js} +5 -5
  33. package/dist/{chunk-QR5V3AFG.js.map → chunk-UTOEDPNU.js.map} +1 -1
  34. package/dist/{chunk-UD7TEHZT.js → chunk-W2FJR5FF.js} +35 -22
  35. package/dist/chunk-W2FJR5FF.js.map +1 -0
  36. package/dist/{chunk-B5VWJBWM.js → chunk-WS6ZRV75.js} +3 -3
  37. package/dist/{chunk-B5VWJBWM.js.map → chunk-WS6ZRV75.js.map} +1 -1
  38. package/dist/{chunk-W3KSUXXR.js → chunk-XKENZTNE.js} +45 -14
  39. package/dist/chunk-XKENZTNE.js.map +1 -0
  40. package/dist/controls/index.d.ts +4 -3
  41. package/dist/controls/index.js +3 -3
  42. package/dist/dragdrop/index.d.ts +8 -8
  43. package/dist/dragdrop/index.js +2 -2
  44. package/dist/index.d.ts +75 -110
  45. package/dist/index.js +148 -115
  46. package/dist/index.js.map +1 -1
  47. package/dist/job/index.js +1 -1
  48. package/dist/layers/index.d.ts +26 -11
  49. package/dist/layers/index.js +3 -3
  50. package/dist/loupe/index.d.ts +7 -13
  51. package/dist/loupe/index.js +2 -2
  52. package/dist/passthrough/weasel-canvas.d.ts +3 -343
  53. package/dist/passthrough/weasel-canvas.js +1 -1
  54. package/dist/passthrough/weasel-ui.d.ts +123 -3088
  55. package/dist/passthrough/weasel-ui.js +2 -2
  56. package/dist/primitives/index.js +4 -4
  57. package/dist/state/index.d.ts +3 -3
  58. package/dist/state/index.js +2 -2
  59. package/dist/styles.css +30 -3
  60. package/dist/surface/index.js +2 -2
  61. package/dist/ui/layers/index.d.ts +22 -9
  62. package/dist/ui/layers/index.js +2 -2
  63. package/dist/undo/index.d.ts +6 -5
  64. package/package.json +8 -8
  65. package/src/annotations/AnnotationTargets.tsx +6 -1
  66. package/src/annotations/Annotations.overlay.test.tsx +2 -0
  67. package/src/annotations/types.ts +4 -1
  68. package/src/canvas/CanvasStack.tsx +8 -13
  69. package/src/canvas/useOrbit.test.ts +97 -1
  70. package/src/canvas/useOrbit.ts +41 -34
  71. package/src/canvas/usePanZoom.test.ts +106 -1
  72. package/src/canvas/usePanZoom.ts +54 -36
  73. package/src/chrome/ChromeRegions.stories.tsx +42 -1
  74. package/src/chrome/builtins.test.ts +4 -0
  75. package/src/chrome/builtins.tsx +18 -0
  76. package/src/chrome/index.ts +1 -1
  77. package/src/chrome/regions/SidebarRegion.tsx +7 -6
  78. package/src/chrome/regions/TitleBarRegion.test.tsx +64 -0
  79. package/src/chrome/regions/TitleBarRegion.tsx +16 -7
  80. package/src/chrome/regions/ToolbarRegion.test.tsx +14 -0
  81. package/src/chrome/regions/ToolbarRegion.tsx +2 -2
  82. package/src/chrome/regions/ViewportRegion.tsx +2 -2
  83. package/src/chrome/regions/regions.test.tsx +45 -1
  84. package/src/chrome/types.ts +21 -3
  85. package/src/controls/ControlPanel.test.tsx +38 -0
  86. package/src/controls/ControlPanel.tsx +51 -6
  87. package/src/dragdrop/DragDropRuntime.tsx +74 -61
  88. package/src/dragdrop/Palette.tsx +4 -3
  89. package/src/dragdrop/dragDrop.test.tsx +35 -12
  90. package/src/index.ts +2 -1
  91. package/src/instrument/types.ts +4 -5
  92. package/src/job/useJob.ts +1 -1
  93. package/src/lab/Lab.test.tsx +7 -0
  94. package/src/lab/Lab.tsx +2 -2
  95. package/src/lab/LabContext.ts +5 -1
  96. package/src/lab/LabShell.less +17 -2
  97. package/src/lab/Workspace.tsx +1 -1
  98. package/src/layers/AGENTS.md +29 -7
  99. package/src/layers/LayerList.less +16 -0
  100. package/src/layers/LayerList.stories.tsx +66 -0
  101. package/src/layers/LayerList.test.tsx +185 -2
  102. package/src/layers/LayerList.tsx +221 -74
  103. package/src/layers/index.ts +1 -1
  104. package/src/passthrough/weasel-ui.ts +5 -0
  105. package/src/primitives/FloatingPanel.test.tsx +87 -0
  106. package/src/primitives/FloatingPanel.tsx +59 -41
  107. package/src/state/store.test.ts +78 -0
  108. package/src/state/store.ts +27 -0
  109. package/src/state/types.ts +20 -0
  110. package/src/trial/Trial.less +4 -0
  111. package/src/trial/Trial.targets.test.tsx +96 -0
  112. package/src/trial/Trial.test.tsx +171 -14
  113. package/src/trial/Trial.tsx +4 -1
  114. package/src/trial/TrialChrome.tsx +22 -2
  115. package/src/trial/TrialTitleBar.tsx +7 -3
  116. package/src/trial/index.ts +1 -0
  117. package/src/trial/trialOps.test.ts +49 -1
  118. package/src/trial/trialOps.ts +28 -6
  119. package/dist/_dts/DrawCommand-B3bskUsC.d.ts +0 -564
  120. package/dist/_dts/PrefsForm-BkUJZx0A.d.ts +0 -204
  121. package/dist/_dts/fitViewToBounds-dZ2UDB6e.d.ts +0 -21
  122. package/dist/_dts/shapeKinds-Cx_rxwsa.d.ts +0 -87
  123. package/dist/_dts/types-C-gh9Ap-.d.ts +0 -695
  124. package/dist/chunk-4AMN4MMB.js.map +0 -1
  125. package/dist/chunk-7VW3S44V.js.map +0 -1
  126. package/dist/chunk-L5WBGUVR.js.map +0 -1
  127. package/dist/chunk-LJSIUFYD.js.map +0 -1
  128. package/dist/chunk-UD7TEHZT.js.map +0 -1
  129. package/dist/chunk-VHFQKAUL.js.map +0 -1
  130. package/dist/chunk-W3KSUXXR.js.map +0 -1
  131. package/dist/chunk-XCBCZEBO.js +0 -94
  132. package/dist/chunk-XCBCZEBO.js.map +0 -1
  133. package/dist/chunk-YQGQUBKA.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -2,92 +2,31 @@ 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-B2X21G1c.js';
6
- import { N as Node, P as Path } from './_dts/types-C-gh9Ap-.js';
7
- import { F as FillStyle, S as Stroke, D as DrawCommand, V as View, T as TextStyle } from './_dts/DrawCommand-B3bskUsC.js';
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-QS7XzvpG.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-QS7XzvpG.js';
10
- import { B as BuiltinShapeToolId } from './_dts/shapeKinds-Cx_rxwsa.js';
5
+ import { P as PropertyMetricProps, a as PropertyListPack } from './_dts/index-CsU9WhjM.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-CsU9WhjM.js';
7
+ 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';
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-A4R6v4ld.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-A4R6v4ld.js';
10
+ import { i as TrialInfo, a as StorageAdapter, h as LabMode, T as TrialRecord, c as SavedSnapshot } from './_dts/types-BbXpvQa8.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-BbXpvQa8.js';
11
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';
12
- export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from './_dts/CanvasStackContext-D6M0o8cQ.js';
13
- export { PaletteRegion, PaletteRegionProps, SidebarRegion, SidebarRegionProps, StatusRegion, StatusRegionProps, TitleBarRegion, TitleBarRegionProps, ToolbarRegion, ToolbarRegionProps, ViewportRegion, ViewportRegionProps, builtinContributions, mergeContributions, suppressContributions } from './chrome/index.js';
14
- import { T as ToolPrefLeaf } from './_dts/PrefsForm-BkUJZx0A.js';
15
- 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-C1Zw7s5P.js';
16
- 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-C1Zw7s5P.js';
13
+ export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from './_dts/CanvasStackContext-kjILVnPj.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, 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';
16
+ 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';
17
17
  import { J as JobHandle } from './_dts/types-DJ79Tg5J.js';
18
18
  export { a as JobCapability, b as JobEvent, c as JobFailure, d as JobStatus } from './_dts/types-DJ79Tg5J.js';
19
19
  export { UseJobOptions, useJob } from './job/index.js';
20
- import { a as StorageAdapter, h as LabMode, T as TrialRecord, c as SavedSnapshot } from './_dts/types-ChVJJHvk.js';
21
- 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';
22
- export { LayerList, LayerListProps } from './layers/index.js';
20
+ export { LayerList, LayerListProps, LayerTreeNode } from './layers/index.js';
23
21
  export { CanvasLoupe, CanvasLoupeProps, DomLoupe, DomLoupeProps, LensCamera, LoupeBubble, LoupeBubbleProps, LoupeState, SourceRect, TrialLoupe, TrialLoupeProps, UseLoupeOptions, drawCanvasLens, lensCamera, lensSourceRect, sampleStack, useLoupe } from './loupe/index.js';
24
22
  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';
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-Cdm13fvl.js';
23
+ 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-DKjqpv20.js';
26
24
  export { Box, Rect, SurfaceCanvasContext, SurfaceContext, SurfaceFrame, SurfaceHandle, TilePainter, UseTiledSurfaceOptions, composeRects, rectsEqual, toDeviceRect, useSurface, useSurfaceCanvas, useSurfaceOptional, useSurfaceTile, useTileId, useTiledSurface } from './surface/index.js';
27
25
  export { EventBus, EventListener, clearUndo, createEventBus, emptyStack, pushSnapshot, redo, undo } from './undo/index.js';
26
+ import './_dts/PrefsForm.d-CgxUequc.js';
28
27
  import 'windease';
29
28
  import 'zustand/vanilla';
30
29
 
31
- /**
32
- * Canonical inline-styling primitive for text nodes. A node's text is
33
- * either a plain `string` (treated as a single-run, default-styled fragment)
34
- * or `StyledRun[]` for rich content. `toRuns` is the funnel that normalizes
35
- * either form into the array shape used by the renderer.
36
- *
37
- * Every field except `text` is optional; missing fields fall back to the
38
- * node-level `TextStyle`. `bold`/`italic` are toggles; richer weight axes
39
- * (300/500/900) are out of scope for slice 1.
40
- */
41
-
42
- /** A span of text with its own styling, as authored. Fields left absent
43
- * inherit from the node's text style — this is the difference between a run
44
- * and a fully resolved one. */
45
- interface StyledRun {
46
- text: string;
47
- bold?: boolean;
48
- italic?: boolean;
49
- fontFamily?: string;
50
- fontSize?: number;
51
- fill?: FillStyle;
52
- /** Outline over this run's glyphs. Overrides the node's own `data.stroke`;
53
- * absent inherits it. Only painted on the outline tier. */
54
- stroke?: Stroke;
55
- letterSpacing?: number;
56
- underline?: boolean;
57
- strikethrough?: boolean;
58
- /** Draw a rule above this run's ascent. Additive over the node style. */
59
- overline?: boolean;
60
- /**
61
- * Set this run as a superscript or subscript — a raised or lowered baseline
62
- * and a smaller size together, which is the pair `<sup>` and `<sub>` imply.
63
- *
64
- * A preset over the two primitives below, not a third mechanism: it supplies
65
- * a `baselineShift` and a `fontScale`, and naming either of those directly
66
- * overrides that half while leaving the other alone. The numbers are in
67
- * {@link SCRIPT_METRICS}.
68
- */
69
- script?: 'super' | 'sub';
70
- /**
71
- * Raise (positive) or lower (negative) this run off the line's shared
72
- * baseline, in ems of the *inherited* font size — so a run's rise does not
73
- * shrink along with the run when `fontScale` also applies.
74
- */
75
- baselineShift?: number;
76
- /**
77
- * Multiplier on the inherited font size. The relative counterpart to
78
- * `fontSize`, which pins an absolute size and wins over this when both are
79
- * present.
80
- */
81
- fontScale?: number;
82
- }
83
-
84
- /** Built-in tool ids that aren't shape tools — the ones with no entry in
85
- * the `core/shapeKinds` table. */
86
- declare const NON_SHAPE_BUILTIN_TOOLS: readonly ["select", "rotate", "hand"];
87
- /** Built-in tool ids SceneCanvas knows how to mount when no `tools` prop
88
- * is supplied. Pass a subset via `defaultTools` to slim the registered set. */
89
- type BuiltinToolId = (typeof NON_SHAPE_BUILTIN_TOOLS)[number] | BuiltinShapeToolId;
90
-
91
30
  /** An annotation drawn over a curve plot: a shaded band across a range of x,
92
31
  * or a vertical line at one x. */
93
32
  type CurveMark = {
@@ -126,14 +65,14 @@ interface CurveFieldProps {
126
65
  declare function CurveField({ values, min, max, step, width, height, defaults, onChange, marks, }: CurveFieldProps): react_jsx_runtime.JSX.Element;
127
66
 
128
67
  /** Props for `<Subpanel>`. */
129
- interface SubpanelProps {
68
+ interface SubpanelProps extends PropertyMetricProps {
130
69
  title: ReactNode;
131
70
  children: ReactNode;
132
71
  className?: string;
133
72
  }
134
73
  /** A typographic divider inside a property list: a small title flanked by a
135
74
  * rule. Purely a heading — use `<PropertyGroup>` for a bordered section. */
136
- declare function Subpanel({ title, children, className }: SubpanelProps): react_jsx_runtime.JSX.Element;
75
+ declare function Subpanel({ title, children, className, density, align }: SubpanelProps): react_jsx_runtime.JSX.Element;
137
76
  /** Props for `<EffectCard>`. */
138
77
  interface EffectCardProps {
139
78
  /** Card title rendered in the title bar (e.g. effect kind label or a select). */
@@ -193,27 +132,40 @@ interface EffectCardListProps<T extends EffectCardListItem> {
193
132
  declare function EffectCardList<T extends EffectCardListItem>({ items, renderItem, onReorder, empty, defaultExpandedIds, }: EffectCardListProps<T>): react_jsx_runtime.JSX.Element;
194
133
 
195
134
  /** Props for `<PropertyGroup>`. */
196
- interface PropertyGroupProps {
135
+ interface PropertyGroupProps extends PropertyMetricProps {
197
136
  /** Title rendered between two rules at the top of the group. */
198
137
  title: ReactNode;
199
138
  /** When true the group renders nothing — useful for conditional sections. */
200
139
  hidden?: boolean;
201
- children: ReactNode;
202
- className?: string;
203
140
  /**
204
- * How rows pack into the 2-column grid.
205
- * - `'auto-color'` (default): only color rows pair side-by-side; everything
206
- * else spans the full width.
207
- * - `'pairs'`: every row auto-places into the 2-column grid two-per-row.
141
+ * Give the title a twisty that folds the rows away. Implied by any of the
142
+ * three props below, so it is only needed for a group that starts open and
143
+ * keeps its own state.
208
144
  */
209
- pack?: 'auto-color' | 'pairs';
145
+ collapsible?: boolean;
146
+ /** Start folded. Read once; the group owns the state from then on. */
147
+ defaultCollapsed?: boolean;
148
+ /**
149
+ * Folded or not, as the consumer holds it. Given, the group keeps no state
150
+ * of its own and every toggle arrives at `onCollapsedChange` instead — which
151
+ * is what a panel that remembers its sections past a reload needs.
152
+ */
153
+ collapsed?: boolean;
154
+ onCollapsedChange?: (next: boolean) => void;
155
+ children: ReactNode;
156
+ className?: string;
157
+ /** How rows pack into the 2-column grid — see `<PropertyList pack>`. */
158
+ pack?: PropertyListPack;
210
159
  }
211
160
  /**
212
161
  * Visually-bordered group inside a PropertyList. Use to scope a set of
213
162
  * related rows under a heading (e.g. "Aqua", "Bevel", "Dome" sections
214
163
  * inside a fill effect's controls).
164
+ *
165
+ * A collapsible group keeps its rows mounted and hides them, so a control's
166
+ * local state survives being folded away.
215
167
  */
216
- declare function PropertyGroup({ title, hidden, children, className, pack, }: PropertyGroupProps): react_jsx_runtime.JSX.Element | null;
168
+ declare function PropertyGroup({ title, hidden, collapsible, defaultCollapsed, collapsed, onCollapsedChange, children, className, pack, density, align, }: PropertyGroupProps): react_jsx_runtime.JSX.Element | null;
217
169
 
218
170
  /** The subset of a mark's scene node this needs: where it is, and what it is. */
219
171
  interface PaintableMark {
@@ -598,11 +550,14 @@ interface AnnotationTargetsProps {
598
550
  capability: AnnotationsCapability;
599
551
  state: unknown;
600
552
  config: unknown;
553
+ /** The trial these targets belong to. `capability.targets` is told it, so a
554
+ * consumer holding per-trial refs can hand back this trial's. */
555
+ trial: TrialInfo;
601
556
  annotations: AnnotationsApi;
602
557
  activeToolId: string | null;
603
558
  }
604
559
  /** One overlay per region the instrument said accepts marks. */
605
- declare function AnnotationTargets({ capability, state, config, annotations, activeToolId, }: AnnotationTargetsProps): react_jsx_runtime.JSX.Element;
560
+ declare function AnnotationTargets({ capability, state, config, trial, annotations, activeToolId, }: AnnotationTargetsProps): react_jsx_runtime.JSX.Element;
606
561
 
607
562
  /** Which weasel tool an annotation tool drives, and what kind of mark that
608
563
  * makes. `select` makes none. */
@@ -878,13 +833,43 @@ interface LabProps {
878
833
  * per record in a grid. Each trial runs one of `instruments`. */
879
834
  declare function Lab({ instruments, defaultInstrument, storage, storageKey, mode, nebula, title, footer, chrome, suppress, tools, configRules, controls, children, }: LabProps): react_jsx_runtime.JSX.Element;
880
835
 
836
+ /** What a trial opens on beyond its instrument's own defaults. */
837
+ interface AddTrialOptions<TC = Record<string, unknown>> {
838
+ /** Overlaid on `defaultConfig()` before `initialState` reads it, so a trial
839
+ * opened on a subject is running that subject from its first frame. Keys
840
+ * whose value is `undefined` are left to the default. */
841
+ config?: Partial<TC>;
842
+ }
843
+ /** Append a new trial running `instrumentName`, at that instrument's default
844
+ * config — with `options.config` written over it — and the initial state
845
+ * that config produces. */
846
+ declare function addTrial(trials: TrialRecord[], instruments: InstrumentList, instrumentName: string, options?: AddTrialOptions): TrialRecord[];
847
+ /** Insert a deep copy of a trial directly after it. The copy starts with
848
+ * an empty undo history — the original's is not shared. */
849
+ declare function cloneTrial(trials: TrialRecord[], id: string): TrialRecord[];
850
+ /** Remove a trial, unless it is the last one — a lab always has at least
851
+ * one. */
852
+ declare function closeTrial(trials: TrialRecord[], id: string): TrialRecord[];
853
+ /** Return a trial to what it opened on — its instrument's defaults under the
854
+ * seed `addTrial` was given — keeping its id and its place in the list. */
855
+ declare function resetTrial(trials: TrialRecord[], id: string, instruments: InstrumentList): TrialRecord[];
856
+ /**
857
+ * Reorder to match `ids`. Ids the list doesn't mention keep their relative
858
+ * order at the end, and ids it names that no longer exist are dropped — a
859
+ * reorder that raced a close should not resurrect the closed trial.
860
+ */
861
+ declare function reorderTrials(trials: TrialRecord[], ids: readonly string[]): TrialRecord[];
862
+
881
863
  /** Lab-wide state and commands: the available instruments, the open
882
864
  * trials and the operations over them, saved snapshots, and the color
883
865
  * mode. */
884
866
  interface LabContextValue {
885
867
  instruments: InstrumentList;
886
868
  trials: TrialRecord[];
887
- addTrial: (instrumentName: string) => void;
869
+ /** Open a trial running `instrumentName`. `options.config` is written over
870
+ * that instrument's defaults, which is where a trial opened on a subject
871
+ * says which subject. */
872
+ addTrial: (instrumentName: string, options?: AddTrialOptions) => void;
888
873
  cloneTrial: (id: string) => void;
889
874
  closeTrial: (id: string) => void;
890
875
  resetTrial: (id: string) => void;
@@ -1015,7 +1000,6 @@ interface RawToken {
1015
1000
  /** A token graph flattened to one level, keyed by token name (no `--wzl-`
1016
1001
  * prefix). Still unresolved — see `ResolvedTokenMap` for the output side. */
1017
1002
  type FlatTokens = Record<string, RawToken>;
1018
-
1019
1003
  /**
1020
1004
  * A theme: a named set of design tokens, organized into a mode-invariant layer
1021
1005
  * plus one layer per mode (light, dark, …), optionally extending another theme.
@@ -1132,24 +1116,5 @@ interface TrialChromeProps {
1132
1116
  * each region its slice. */
1133
1117
  declare function TrialChrome({ trialId, record, instrument, isLastTrial, undoBindings, job, loupe, trialChrome, chrome, suppress, activeToolId, setActiveTool, children, }: TrialChromeProps): react_jsx_runtime.JSX.Element;
1134
1118
 
1135
- /** Append a new trial running `instrumentName`, at that instrument's
1136
- * default config and initial state. */
1137
- declare function addTrial(trials: TrialRecord[], instruments: InstrumentList, instrumentName: string): TrialRecord[];
1138
- /** Insert a deep copy of a trial directly after it. The copy starts with
1139
- * an empty undo history — the original's is not shared. */
1140
- declare function cloneTrial(trials: TrialRecord[], id: string): TrialRecord[];
1141
- /** Remove a trial, unless it is the last one — a lab always has at least
1142
- * one. */
1143
- declare function closeTrial(trials: TrialRecord[], id: string): TrialRecord[];
1144
- /** Return a trial to its instrument's defaults, keeping its id and its
1145
- * place in the list. */
1146
- declare function resetTrial(trials: TrialRecord[], id: string, instruments: InstrumentList): TrialRecord[];
1147
- /**
1148
- * Reorder to match `ids`. Ids the list doesn't mention keep their relative
1149
- * order at the end, and ids it names that no longer exist are dropped — a
1150
- * reorder that raced a close should not resurrect the closed trial.
1151
- */
1152
- declare function reorderTrials(trials: TrialRecord[], ids: readonly string[]): TrialRecord[];
1153
-
1154
- 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 };
1155
- 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 };
1119
+ 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, 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, fitView, fromConfigFields, fromWeaselView, interstellarTheme, isLeafVisible, isStale, markCommands, markSvgNodes, reorderTrials, resetTrial, resolveConfigSchema, resolveMarkStyle, seenFrom, titleCase, toWeaselView, useAnnotations, useAnnotationsOptional, useConfigSchema, useLabContext, validateConfigSchema };
1120
+ 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 };