@weasel-js/labkit 1.4.4 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -6
- package/dist/_dts/{CanvasStackContext-kTEZvEgE.d.ts → CanvasStackContext-CJNMS6mz.d.ts} +1 -1
- package/dist/_dts/{PrefsForm.d-DDHFANkc.d.ts → PrefsForm.d-DPy9I8It.d.ts} +4 -0
- package/dist/_dts/Select.d-Gwr8fLpK.d.ts +453 -0
- package/dist/_dts/{frac-z7ker2Vx.d.ts → frac-B4okC2lX.d.ts} +291 -31
- package/dist/_dts/{index-Blv9uQzu.d.ts → index-BNdz-tNd.d.ts} +105 -17
- package/dist/_dts/index-CSJoj4LC.d.ts +248 -0
- package/dist/_dts/{types-B9_zrHmb.d.ts → types-DzoNY1pO.d.ts} +91 -4
- package/dist/_dts/usePanZoom-Pzf9f2jh.d.ts +160 -0
- package/dist/_dts/useTrialState-uLlmaccn.d.ts +212 -0
- package/dist/canvas/index.d.ts +18 -129
- package/dist/canvas/index.js +4 -2
- package/dist/chrome/index.d.ts +5 -93
- package/dist/chrome/index.js +10 -6
- package/dist/chunk-7PFH3CNM.js +150 -0
- package/dist/chunk-7PFH3CNM.js.map +1 -0
- package/dist/{chunk-I6JCVE24.js → chunk-CEIUBPPW.js} +143 -17
- package/dist/chunk-CEIUBPPW.js.map +1 -0
- package/dist/chunk-EH7UEQV7.js +590 -0
- package/dist/chunk-EH7UEQV7.js.map +1 -0
- package/dist/{chunk-MOM3GOVY.js → chunk-EHGVROVV.js} +125 -27
- package/dist/chunk-EHGVROVV.js.map +1 -0
- package/dist/{chunk-TJ7QY3OC.js → chunk-ERFMC6WU.js} +160 -78
- package/dist/chunk-ERFMC6WU.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-64ZCN3DA.js → chunk-IHUVQ3TX.js} +250 -160
- package/dist/chunk-IHUVQ3TX.js.map +1 -0
- package/dist/{chunk-FQMJUVHJ.js → chunk-IJJUK4FU.js} +53 -46
- package/dist/chunk-IJJUK4FU.js.map +1 -0
- package/dist/chunk-IXTQI7JX.js +737 -0
- package/dist/chunk-IXTQI7JX.js.map +1 -0
- package/dist/{chunk-BKFVHKJH.js → chunk-MDVTK5U3.js} +4 -4
- package/dist/{chunk-BKFVHKJH.js.map → chunk-MDVTK5U3.js.map} +1 -1
- package/dist/chunk-PHK4W562.js +72 -0
- package/dist/chunk-PHK4W562.js.map +1 -0
- package/dist/chunk-PJ7WEQBJ.js +18 -0
- package/dist/chunk-PJ7WEQBJ.js.map +1 -0
- package/dist/chunk-RWNDDKOH.js +682 -0
- package/dist/chunk-RWNDDKOH.js.map +1 -0
- package/dist/chunk-T3EC2DXD.js +12628 -0
- package/dist/chunk-T3EC2DXD.js.map +1 -0
- package/dist/{chunk-SMHP6XZ4.js → chunk-UN4U4P63.js} +10 -8
- package/dist/chunk-UN4U4P63.js.map +1 -0
- package/dist/chunk-WIG6XHJ7.js +35 -0
- package/dist/chunk-WIG6XHJ7.js.map +1 -0
- package/dist/chunk-Z76KEZAX.js +15 -0
- package/dist/chunk-Z76KEZAX.js.map +1 -0
- package/dist/chunk-ZDHY47EV.js +363 -0
- package/dist/chunk-ZDHY47EV.js.map +1 -0
- package/dist/config/index.d.ts +276 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/controls/index.d.ts +3 -4
- package/dist/controls/index.js +4 -3
- package/dist/dragdrop/index.d.ts +3 -5
- package/dist/index.d.ts +266 -413
- package/dist/index.js +1775 -2251
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +4 -6
- package/dist/layers/index.js +2 -2
- package/dist/loupe/index.d.ts +69 -20
- package/dist/loupe/index.js +2 -2
- package/dist/passthrough/weasel-ui.d.ts +175 -309
- package/dist/passthrough/weasel-ui.js +1 -1
- package/dist/primitives/index.d.ts +55 -6
- package/dist/primitives/index.js +6 -4
- package/dist/state/index.d.ts +13 -8
- package/dist/state/index.js +18 -13
- package/dist/state/index.js.map +1 -1
- package/dist/styles.css +223 -76
- 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 +3 -5
- package/package.json +15 -8
- package/src/annotations/AnnotationOverlay.tsx +56 -5
- package/src/annotations/Annotations.less +4 -0
- package/src/annotations/Annotations.overlay.test.tsx +105 -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/svgNodes.ts +1 -0
- package/src/annotations/toolMap.test.ts +9 -5
- package/src/annotations/toolMap.ts +6 -3
- package/src/annotations/types.ts +6 -3
- package/src/canvas/CameraWheelContext.ts +12 -0
- package/src/canvas/CanvasStack.stories.tsx +1 -1
- 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.test.ts +28 -0
- package/src/canvas/usePanZoom.ts +21 -9
- package/src/chrome/ChromeRegions.stories.tsx +1 -4
- package/src/chrome/LabChrome.tsx +130 -0
- package/src/chrome/builtins.test.ts +1 -0
- package/src/chrome/builtins.tsx +21 -31
- package/src/chrome/index.ts +16 -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 +16 -9
- package/src/chrome/regions/SidebarRegion.stories.tsx +44 -0
- package/src/chrome/regions/SidebarRegion.tsx +25 -13
- package/src/chrome/regions/StatusRegion.tsx +15 -8
- package/src/chrome/regions/ToolbarRegion.tsx +34 -16
- package/src/chrome/types.ts +50 -20
- package/src/config/auto.test.ts +12 -0
- package/src/config/auto.ts +15 -0
- package/src/config/autoConfig.test.ts +107 -0
- package/src/config/autoConfig.ts +153 -0
- package/src/config/builder.test.ts +42 -0
- package/src/config/builder.ts +68 -17
- 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 +16 -1
- package/src/config/nodeClasses.test.ts +18 -0
- package/src/config/path.ts +7 -2
- package/src/config/resolve.test.ts +25 -0
- package/src/config/resolve.ts +17 -1
- package/src/config/types.ts +34 -2
- package/src/config/useResolvedConfig.ts +26 -0
- package/src/controls/AutoControls.stories.tsx +88 -0
- package/src/controls/ControlPanel.stories.tsx +42 -1
- package/src/controls/ControlPanel.test.tsx +530 -4
- package/src/controls/ControlPanel.tsx +562 -82
- package/src/fake-indexeddb-auto.d.ts +5 -0
- package/src/index.test.ts +7 -0
- package/src/index.ts +66 -5
- package/src/instrument/serializers.test.ts +22 -0
- package/src/instrument/serializers.ts +40 -1
- package/src/instrument/types.ts +25 -1
- package/src/lab/Lab.chrome.test.tsx +16 -0
- package/src/lab/Lab.less +4 -13
- package/src/lab/Lab.persist.test.tsx +147 -0
- package/src/lab/Lab.stories.tsx +1 -3
- package/src/lab/Lab.surface.test.tsx +71 -3
- package/src/lab/Lab.test.tsx +168 -16
- package/src/lab/Lab.tsx +434 -129
- package/src/lab/LabContext.ts +8 -0
- package/src/lab/LabFit.stories.less +18 -0
- package/src/lab/LabFit.stories.tsx +219 -0
- package/src/lab/LabFullChrome.stories.tsx +1 -4
- package/src/lab/LabHeader.test.tsx +40 -9
- package/src/lab/LabHeader.tsx +7 -14
- package/src/lab/LabPalette.tsx +13 -26
- package/src/lab/LabRoot.test.tsx +56 -0
- package/src/lab/LabRoot.tsx +47 -0
- package/src/lab/LabShell.less +73 -15
- package/src/lab/LabShell.stories.tsx +50 -1
- package/src/lab/LabShell.tsx +18 -27
- package/src/lab/LabSwitcher.less +18 -11
- package/src/lab/LabSwitcher.test.tsx +14 -9
- package/src/lab/LabSwitcher.tsx +8 -4
- package/src/lab/Workspace.less +1 -1
- package/src/lab/Workspace.stories.tsx +1 -1
- package/src/lab/Workspace.surface.test.tsx +1 -0
- package/src/lab/fitCheck.test.ts +57 -0
- package/src/lab/fitCheck.ts +125 -0
- package/src/lab/index.ts +2 -0
- package/src/layers/LayerList.stories.tsx +1 -1
- package/src/loupe/AGENTS.md +17 -5
- package/src/loupe/Loupe.less +1 -1
- package/src/loupe/LoupeGestures.tsx +67 -0
- package/src/loupe/TrialLoupe.tsx +43 -28
- package/src/loupe/canvasLens.ts +1 -1
- package/src/loupe/index.ts +4 -0
- package/src/loupe/loupeActions.ts +98 -0
- package/src/loupe/types.ts +1 -1
- package/src/loupe/useLoupe.test.tsx +60 -3
- package/src/loupe/useLoupe.ts +29 -49
- package/src/passthrough/weasel-ui.ts +9 -0
- package/src/primitives/FloatingPanel.stories.tsx +14 -2
- package/src/primitives/FloatingPanel.test.tsx +47 -16
- package/src/primitives/FloatingPanel.tsx +11 -25
- package/src/primitives/FpsMeter.stories.tsx +1 -1
- package/src/primitives/JobProgress.stories.tsx +1 -1
- package/src/primitives/Legend.stories.tsx +1 -1
- package/src/primitives/ScaleIndicator.stories.tsx +1 -1
- package/src/primitives/Sidebar.less +7 -0
- package/src/primitives/Sidebar.stories.tsx +1 -1
- package/src/primitives/Split.less +14 -0
- package/src/primitives/Split.test.tsx +133 -0
- package/src/primitives/Split.tsx +175 -0
- package/src/primitives/StatusBar.stories.tsx +1 -1
- package/src/primitives/Toolbar.stories.tsx +1 -1
- package/src/primitives/ZoomControl.tsx +5 -2
- package/src/primitives/index.ts +2 -0
- package/src/specimen/Specimen.less +95 -0
- package/src/specimen/Specimen.stories.tsx +13 -0
- package/src/specimen/Specimen.test.tsx +13 -0
- package/src/specimen/Specimen.tsx +888 -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 +169 -635
- package/src/state/store.ts +146 -163
- package/src/state/toolSlot.test.ts +1 -1
- package/src/state/types.ts +65 -17
- 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 +87 -3
- package/src/state/useTrialState.ts +9 -1
- package/src/state/view.test.ts +49 -15
- package/src/state/view.ts +18 -1
- package/src/styles.less +3 -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 +1 -0
- package/src/surface/useSurfaceTile.ts +6 -5
- package/src/surface/useTiledSurface.test.tsx +231 -1
- package/src/surface/useTiledSurface.ts +76 -15
- package/src/theme/Interstellar.stories.tsx +9 -9
- package/src/theme/interstellar.test.ts +17 -6
- package/src/theme/interstellar.theme.json +180 -0
- package/src/theme/interstellar.ts +8 -5
- package/src/tools/labTool.ts +11 -0
- package/src/trial/Trial.annotations.persist.test.tsx +100 -58
- package/src/trial/Trial.annotations.test.tsx +59 -7
- package/src/trial/Trial.canvas.test.tsx +32 -0
- package/src/trial/Trial.config.test.tsx +75 -2
- package/src/trial/Trial.job.test.tsx +3 -3
- package/src/trial/Trial.less +5 -26
- package/src/trial/Trial.stories.tsx +5 -3
- package/src/trial/Trial.test.tsx +31 -4
- package/src/trial/Trial.trialId.test.tsx +23 -1
- package/src/trial/Trial.tsx +139 -52
- package/src/trial/TrialBody.tsx +17 -141
- package/src/trial/TrialChrome.tsx +24 -7
- package/src/trial/trialOps.test.ts +101 -1
- package/src/trial/trialOps.ts +67 -7
- 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-E44SU6XS.js +0 -50
- package/dist/chunk-E44SU6XS.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 +0 -343
- package/dist/chunk-U3IYHIAE.js.map +0 -1
- package/dist/chunk-W3ECWC2K.js +0 -7335
- package/dist/chunk-W3ECWC2K.js.map +0 -1
- package/src/theme/interstellar.tokens.json +0 -61
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ToolPrefNumberFormat } from '@weasel-js/core';
|
|
4
|
+
import { R as ResolvedConfig, a as ConfigField, d as ControlRenderer } from './types-DzoNY1pO.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* How much room a container gives its rows — gaps, padding, and field height,
|
|
@@ -100,11 +100,25 @@ interface PropertyRowProps extends PropertyMetricProps {
|
|
|
100
100
|
span?: boolean;
|
|
101
101
|
children: ReactNode;
|
|
102
102
|
htmlFor?: string;
|
|
103
|
+
/** The control is a group of several (a segmented toggle), not one element.
|
|
104
|
+
* The row then renders as a `<div>`: a `<label>` hands a click on its text to
|
|
105
|
+
* its first control, which in a group means selecting the first option. Each
|
|
106
|
+
* member has to carry its own name. */
|
|
107
|
+
group?: boolean;
|
|
103
108
|
className?: string;
|
|
109
|
+
/** The row is auto: its value is not pinned and the owner computes it. Draws
|
|
110
|
+
* the control ghosted and colorless. */
|
|
111
|
+
auto?: boolean;
|
|
112
|
+
/** Given, the row carries a pin dot that toggles `auto`. Omitted, the row can
|
|
113
|
+
* show an auto state but not change it. */
|
|
114
|
+
onAutoChange?: (next: boolean) => void;
|
|
115
|
+
/** Marks the row's element for a panel-level gesture handler. `PropertyRow`
|
|
116
|
+
* does not spread unknown props, so this is declared rather than inherited. */
|
|
117
|
+
'data-auto-path'?: string;
|
|
104
118
|
}
|
|
105
119
|
/** The label-plus-control frame every typed row below is built from. Use it
|
|
106
120
|
* directly for a control this module does not cover. */
|
|
107
|
-
declare function PropertyRow({ label, readout, description, variant, layout, span, children, htmlFor, className, density, align, }: PropertyRowProps): react_jsx_runtime.JSX.Element;
|
|
121
|
+
declare function PropertyRow({ label, readout, description, variant, layout, span, children, htmlFor, group, className, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: PropertyRowProps): react_jsx_runtime.JSX.Element;
|
|
108
122
|
/** Props for `<SliderRow>`. */
|
|
109
123
|
interface SliderRowProps extends PropertyMetricProps {
|
|
110
124
|
label: ReactNode;
|
|
@@ -126,6 +140,14 @@ interface SliderRowProps extends PropertyMetricProps {
|
|
|
126
140
|
onInput?: (next: number) => void;
|
|
127
141
|
/** Override how the value is rendered next to the label. Defaults to `value.toString()`. */
|
|
128
142
|
format?: (value: number) => ReactNode;
|
|
143
|
+
/**
|
|
144
|
+
* Static text in place of the editable readout. Use it when the row is not
|
|
145
|
+
* showing a number a caller could type back — an auto row's `auto · 18`, say,
|
|
146
|
+
* which an editable field would seed a draft with and then fail to parse.
|
|
147
|
+
*/
|
|
148
|
+
readout?: ReactNode;
|
|
149
|
+
/** A named display for the value: `compact` reads `2.0M`. `format` wins when both are given. */
|
|
150
|
+
notation?: ToolPrefNumberFormat;
|
|
129
151
|
/**
|
|
130
152
|
* Optional suffix rendered next to the readout. A string becomes a
|
|
131
153
|
* baseline-aligned dim "word" unit (e.g. "px"); pass JSX like `<sup>°</sup>`
|
|
@@ -136,10 +158,16 @@ interface SliderRowProps extends PropertyMetricProps {
|
|
|
136
158
|
description?: string;
|
|
137
159
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
138
160
|
span?: boolean;
|
|
161
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
162
|
+
auto?: boolean;
|
|
163
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
164
|
+
onAutoChange?: (next: boolean) => void;
|
|
165
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
166
|
+
'data-auto-path'?: string;
|
|
139
167
|
}
|
|
140
168
|
/** A bounded number edited by dragging, with a live readout whose precision
|
|
141
169
|
* follows `step`. */
|
|
142
|
-
declare function SliderRow({ label, value, min, max, step, onChange, onInput, format, unit, layout, description, span, density, align, }: SliderRowProps): react_jsx_runtime.JSX.Element;
|
|
170
|
+
declare function SliderRow({ label, value, min, max, step, onChange, onInput, format, readout, notation, unit, layout, description, span, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: SliderRowProps): react_jsx_runtime.JSX.Element;
|
|
143
171
|
/** Props for `<ColorRow>`. */
|
|
144
172
|
interface ColorRowProps extends PropertyMetricProps {
|
|
145
173
|
label: ReactNode;
|
|
@@ -170,42 +198,69 @@ interface ColorRowProps extends PropertyMetricProps {
|
|
|
170
198
|
/** Label beside the swatch (default) or above it. */
|
|
171
199
|
layout?: PropertyRowLayout;
|
|
172
200
|
description?: string;
|
|
201
|
+
/** Right-aligned readout shown next to the label — see `<PropertyRow readout>`. */
|
|
202
|
+
readout?: ReactNode;
|
|
173
203
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
174
204
|
span?: boolean;
|
|
205
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
206
|
+
auto?: boolean;
|
|
207
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
208
|
+
onAutoChange?: (next: boolean) => void;
|
|
209
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
210
|
+
'data-auto-path'?: string;
|
|
175
211
|
}
|
|
176
212
|
/** A color swatch, optionally with an alpha slider beneath it. */
|
|
177
|
-
declare function ColorRow({ label, value, onChange, onInput, alpha, onAlphaChange, onAlphaInput, alphaDisabled, layout, description, span, density, align, }: ColorRowProps): react_jsx_runtime.JSX.Element;
|
|
213
|
+
declare function ColorRow({ label, readout, value, onChange, onInput, alpha, onAlphaChange, onAlphaInput, alphaDisabled, layout, description, span, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: ColorRowProps): react_jsx_runtime.JSX.Element;
|
|
178
214
|
/** Props for `<CheckboxRow>`. */
|
|
179
215
|
interface CheckboxRowProps extends PropertyMetricProps {
|
|
180
216
|
label: ReactNode;
|
|
181
|
-
|
|
217
|
+
/** Absent reads as unchecked. */
|
|
218
|
+
value: boolean | undefined;
|
|
182
219
|
onChange: (next: boolean) => void;
|
|
183
220
|
/** Label beside the box (default) or above it. */
|
|
184
221
|
layout?: PropertyRowLayout;
|
|
185
222
|
description?: string;
|
|
223
|
+
/** Right-aligned readout shown next to the label — see `<PropertyRow readout>`. */
|
|
224
|
+
readout?: ReactNode;
|
|
186
225
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
187
226
|
span?: boolean;
|
|
227
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
228
|
+
auto?: boolean;
|
|
229
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
230
|
+
onAutoChange?: (next: boolean) => void;
|
|
231
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
232
|
+
'data-auto-path'?: string;
|
|
188
233
|
}
|
|
189
234
|
/** A boolean checkbox. */
|
|
190
|
-
declare function CheckboxRow({ label, value, onChange, layout, span, description, density, align, }: CheckboxRowProps): react_jsx_runtime.JSX.Element;
|
|
235
|
+
declare function CheckboxRow({ label, readout, value, onChange, layout, span, description, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: CheckboxRowProps): react_jsx_runtime.JSX.Element;
|
|
191
236
|
/** Props for `<TextRow>`. */
|
|
192
237
|
interface TextRowProps extends PropertyMetricProps {
|
|
193
238
|
label: ReactNode;
|
|
194
|
-
|
|
239
|
+
/** Absent reads as an empty field. */
|
|
240
|
+
value: string | null | undefined;
|
|
195
241
|
onChange: (next: string) => void;
|
|
196
242
|
placeholder?: string;
|
|
197
243
|
maxLength?: number;
|
|
198
244
|
layout?: PropertyRowLayout;
|
|
199
245
|
description?: string;
|
|
246
|
+
/** Right-aligned readout shown next to the label — see `<PropertyRow readout>`. */
|
|
247
|
+
readout?: ReactNode;
|
|
200
248
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
201
249
|
span?: boolean;
|
|
250
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
251
|
+
auto?: boolean;
|
|
252
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
253
|
+
onAutoChange?: (next: boolean) => void;
|
|
254
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
255
|
+
'data-auto-path'?: string;
|
|
202
256
|
}
|
|
203
257
|
/** A single-line text input. */
|
|
204
|
-
declare function TextRow({ label, value, onChange, placeholder, maxLength, layout, description, span, density, align, }: TextRowProps): react_jsx_runtime.JSX.Element;
|
|
258
|
+
declare function TextRow({ label, readout, value, onChange, placeholder, maxLength, layout, description, span, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: TextRowProps): react_jsx_runtime.JSX.Element;
|
|
205
259
|
/** Props for `<NumberRow>`. */
|
|
206
260
|
interface NumberRowProps extends PropertyMetricProps {
|
|
207
261
|
label: ReactNode;
|
|
208
|
-
|
|
262
|
+
/** Absent reads as an empty field. */
|
|
263
|
+
value: number | null | undefined;
|
|
209
264
|
/**
|
|
210
265
|
* The committed value. Given `onInput` as well, it fires on blur or Enter;
|
|
211
266
|
* on its own it fires on every keystroke, which is what a row with one
|
|
@@ -230,12 +285,20 @@ interface NumberRowProps extends PropertyMetricProps {
|
|
|
230
285
|
unit?: ReactNode;
|
|
231
286
|
layout?: PropertyRowLayout;
|
|
232
287
|
description?: string;
|
|
288
|
+
/** Right-aligned readout shown next to the label — see `<PropertyRow readout>`. */
|
|
289
|
+
readout?: ReactNode;
|
|
233
290
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
234
291
|
span?: boolean;
|
|
292
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
293
|
+
auto?: boolean;
|
|
294
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
295
|
+
onAutoChange?: (next: boolean) => void;
|
|
296
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
297
|
+
'data-auto-path'?: string;
|
|
235
298
|
}
|
|
236
299
|
/** A number typed directly. Reach for `<SliderRow>` when the range matters
|
|
237
300
|
* more than the exact value. */
|
|
238
|
-
declare function NumberRow({ label, value, onChange, onInput, min, max, step, placeholder, unit, layout, description, span, density, align, }: NumberRowProps): react_jsx_runtime.JSX.Element;
|
|
301
|
+
declare function NumberRow({ label, readout, value, onChange, onInput, min, max, step, placeholder, unit, layout, description, span, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: NumberRowProps): react_jsx_runtime.JSX.Element;
|
|
239
302
|
interface PropertyOption<T extends string> {
|
|
240
303
|
value: T;
|
|
241
304
|
label: ReactNode;
|
|
@@ -243,17 +306,28 @@ interface PropertyOption<T extends string> {
|
|
|
243
306
|
/** Props for `<SelectRow>`. */
|
|
244
307
|
interface SelectRowProps<T extends string> extends PropertyMetricProps {
|
|
245
308
|
label: ReactNode;
|
|
246
|
-
|
|
309
|
+
/** Absent, or not one of `options`, shows a placeholder rather than the first option. */
|
|
310
|
+
value: T | undefined;
|
|
247
311
|
options: ReadonlyArray<PropertyOption<T>>;
|
|
248
312
|
onChange: (next: T) => void;
|
|
313
|
+
/** Shown while no option is chosen. Defaults to "Choose option…". */
|
|
314
|
+
placeholder?: string;
|
|
249
315
|
layout?: PropertyRowLayout;
|
|
250
316
|
description?: string;
|
|
317
|
+
/** Right-aligned readout shown next to the label — see `<PropertyRow readout>`. */
|
|
318
|
+
readout?: ReactNode;
|
|
251
319
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
252
320
|
span?: boolean;
|
|
321
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
322
|
+
auto?: boolean;
|
|
323
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
324
|
+
onAutoChange?: (next: boolean) => void;
|
|
325
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
326
|
+
'data-auto-path'?: string;
|
|
253
327
|
}
|
|
254
328
|
/** A dropdown over a fixed set of choices. Prefer `<ToggleRow>` when there
|
|
255
329
|
* are only two or three and they should all stay visible. */
|
|
256
|
-
declare function SelectRow<T extends string>({ label, value, options, onChange, layout, description, span, density, align, }: SelectRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
330
|
+
declare function SelectRow<T extends string>({ label, readout, value, options, onChange, placeholder, layout, description, span, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: SelectRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
257
331
|
/** Props for `<ToggleRow>`. */
|
|
258
332
|
interface ToggleRowProps<T extends string> extends PropertyMetricProps {
|
|
259
333
|
label: ReactNode;
|
|
@@ -262,20 +336,28 @@ interface ToggleRowProps<T extends string> extends PropertyMetricProps {
|
|
|
262
336
|
onChange: (next: T) => void;
|
|
263
337
|
layout?: PropertyRowLayout;
|
|
264
338
|
description?: string;
|
|
339
|
+
/** Right-aligned readout shown next to the label — see `<PropertyRow readout>`. */
|
|
340
|
+
readout?: ReactNode;
|
|
265
341
|
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
266
342
|
span?: boolean;
|
|
343
|
+
/** The row is auto — see `<PropertyRow auto>`. */
|
|
344
|
+
auto?: boolean;
|
|
345
|
+
/** Toggles `auto` from a pin dot — see `<PropertyRow onAutoChange>`. */
|
|
346
|
+
onAutoChange?: (next: boolean) => void;
|
|
347
|
+
/** Marks the row for a panel-level gesture handler — see `<PropertyRow data-auto-path>`. */
|
|
348
|
+
'data-auto-path'?: string;
|
|
267
349
|
}
|
|
268
350
|
/** A segmented control: the same choice as a select, with every option
|
|
269
351
|
* visible at once. */
|
|
270
|
-
declare function ToggleRow<T extends string>({ label, value, options, onChange, layout, description, span, density, align, }: ToggleRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
352
|
+
declare function ToggleRow<T extends string>({ label, readout, value, options, onChange, layout, description, span, density, align, auto, onAutoChange, 'data-auto-path': autoPath, }: ToggleRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
271
353
|
|
|
272
354
|
/** How a panel packs its rows into the two-column property grid.
|
|
273
|
-
* - `'auto'`: narrow controls (numbers, checkboxes, dropdowns,
|
|
355
|
+
* - `'auto'`: narrow controls (numbers, checkboxes, dropdowns, colors) sit
|
|
274
356
|
* two per row; the ones that need the width — text, sliders, segmented
|
|
275
357
|
* toggles — span it.
|
|
276
358
|
* - `'pairs'`: every row pairs. A control that needs the full width says so
|
|
277
359
|
* itself, with `<PropertyRow span>`.
|
|
278
|
-
* - `'one-up'`: one control per row,
|
|
360
|
+
* - `'one-up'`: one control per row, colors excepted.
|
|
279
361
|
*/
|
|
280
362
|
type ControlPack = 'auto' | 'pairs' | 'one-up';
|
|
281
363
|
interface ControlPanelProps<TC extends Record<string, unknown>> {
|
|
@@ -322,6 +404,12 @@ interface ControlPanelProps<TC extends Record<string, unknown>> {
|
|
|
322
404
|
/** A fold moved. The key is a section's label — prefixed by its group's
|
|
323
405
|
* dotted path when the section sits inside one — or a group's own path. */
|
|
324
406
|
onCollapse?: (key: string, collapsed: boolean) => void;
|
|
407
|
+
/** Dotted paths currently unpinned. A row in this set draws ghosted and its
|
|
408
|
+
* dot reads as auto, and the dot writes the sentinel back through
|
|
409
|
+
* `setConfig`. Omitted, the panel keeps the set itself: the dots still work
|
|
410
|
+
* and the sentinel never reaches `setConfig`, which would otherwise store it
|
|
411
|
+
* as the row's value. */
|
|
412
|
+
auto?: ReadonlySet<string>;
|
|
325
413
|
/** Draw leaves marked `hidden`. */
|
|
326
414
|
showHidden?: boolean;
|
|
327
415
|
className?: string;
|
|
@@ -329,7 +417,7 @@ interface ControlPanelProps<TC extends Record<string, unknown>> {
|
|
|
329
417
|
/** Render an instrument's config schema as a stack of controls, each writing
|
|
330
418
|
* back through `setConfig`. Built on the property rows, so a lab's controls
|
|
331
419
|
* are the same aligned, themed rows the rest of the kit uses. */
|
|
332
|
-
declare function ControlPanel<TC extends Record<string, unknown>>({ schema, fields, config, setConfig, renderers, pack, layout, density, align, collapse, collapsed, onCollapse, showHidden, className, }: ControlPanelProps<TC>): react_jsx_runtime.JSX.Element;
|
|
420
|
+
declare function ControlPanel<TC extends Record<string, unknown>>({ schema, fields, config, setConfig, renderers, pack, layout, density, align, collapse, collapsed, onCollapse, auto: given, showHidden, className, }: ControlPanelProps<TC>): react_jsx_runtime.JSX.Element;
|
|
333
421
|
|
|
334
422
|
export { CheckboxRow as C, NumberRow as N, SelectRow as S, TextRow as T, ColorRow as c, ControlPanel as e, PropertyList as g, PropertyPanel as j, PropertyRow as l, PropertySpan as p, SliderRow as s, ToggleRow as v };
|
|
335
423
|
export type { PropertyMetricProps as P, PropertyListPack as a, CheckboxRowProps as b, ColorRowProps as d, NumberRowProps as f, PropertyListProps as h, PropertyOption as i, PropertyPanelProps as k, PropertyRowLayout as m, PropertyRowProps as n, PropertyRowVariant as o, PropertySpanProps as q, SelectRowProps as r, SliderRowProps as t, TextRowProps as u, ToggleRowProps as w };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { d as ControlRenderer, c as ConfigRule } from './types-DzoNY1pO.js';
|
|
2
|
+
import { K as Instrument, ar as TrialChromeContext, N as TrialContribution, T as TrialRecord, q as InstrumentList, e as SavedSnapshot, o as LabMode, ap as ToolSlotContext, a3 as ContributionBase, aq as ToolbarItem, ao as ToolItem, ai as SidebarSection, al as StatusReadout, H as TrialTool, ae as RegionContribution, aj as SidebarSlotContext } from './frac-B4okC2lX.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The contributions a trial gets from what its instrument declared. This is
|
|
9
|
+
* the whole "declaring a capability provides the chrome" rule — it replaces
|
|
10
|
+
* the presence checks that used to be spread across the runtime.
|
|
11
|
+
*/
|
|
12
|
+
declare function builtinContributions(instrument: Instrument, ctx: TrialChromeContext, controls?: Record<string, ControlRenderer>): TrialContribution[];
|
|
13
|
+
|
|
14
|
+
/** What a trial opens on beyond its instrument's own defaults. */
|
|
15
|
+
interface AddTrialOptions<TC = Record<string, unknown>> {
|
|
16
|
+
/** Overlaid on `defaultConfig()` before `initialState` reads it, so a trial
|
|
17
|
+
* opened on a subject is running that subject from its first frame. Keys
|
|
18
|
+
* whose value is `undefined` are left to the default. */
|
|
19
|
+
config?: Partial<TC>;
|
|
20
|
+
}
|
|
21
|
+
/** Append a new trial running `instrumentName`, at that instrument's default
|
|
22
|
+
* config — with `options.config` written over it — and the initial state
|
|
23
|
+
* that config produces. */
|
|
24
|
+
declare function addTrial(trials: TrialRecord[], instruments: InstrumentList, instrumentName: string, options?: AddTrialOptions): TrialRecord[];
|
|
25
|
+
/** Insert a deep copy of a trial directly after it. The copy starts with
|
|
26
|
+
* an empty undo history — the original's is not shared. */
|
|
27
|
+
declare function cloneTrial(trials: TrialRecord[], id: string): TrialRecord[];
|
|
28
|
+
/** Remove a trial, unless it is the last one — a lab always has at least
|
|
29
|
+
* one. */
|
|
30
|
+
declare function closeTrial(trials: TrialRecord[], id: string): TrialRecord[];
|
|
31
|
+
/** Return a trial to what it opened on — its instrument's defaults under the
|
|
32
|
+
* seed `addTrial` was given — keeping its id and its place in the list. */
|
|
33
|
+
declare function resetTrial(trials: TrialRecord[], id: string, instruments: InstrumentList): TrialRecord[];
|
|
34
|
+
/**
|
|
35
|
+
* Reorder to match `ids`. Ids the list doesn't mention keep their relative
|
|
36
|
+
* order at the end, and ids it names that no longer exist are dropped — a
|
|
37
|
+
* reorder that raced a close should not resurrect the closed trial.
|
|
38
|
+
*/
|
|
39
|
+
declare function reorderTrials(trials: TrialRecord[], ids: readonly string[]): TrialRecord[];
|
|
40
|
+
|
|
41
|
+
/** Lab-wide state and commands: the available instruments, the open
|
|
42
|
+
* trials and the operations over them, saved snapshots, and the color
|
|
43
|
+
* mode. */
|
|
44
|
+
interface LabContextValue {
|
|
45
|
+
instruments: InstrumentList;
|
|
46
|
+
trials: TrialRecord[];
|
|
47
|
+
/** Open a trial running `instrumentName`. `options.config` is written over
|
|
48
|
+
* that instrument's defaults, which is where a trial opened on a subject
|
|
49
|
+
* says which subject. */
|
|
50
|
+
addTrial: (instrumentName: string, options?: AddTrialOptions) => void;
|
|
51
|
+
cloneTrial: (id: string) => void;
|
|
52
|
+
closeTrial: (id: string) => void;
|
|
53
|
+
resetTrial: (id: string) => void;
|
|
54
|
+
reorderTrials: (ids: readonly string[]) => void;
|
|
55
|
+
/** Put a fresh trial running `instrumentName` in trial `id`'s place, at its
|
|
56
|
+
* size. The replacement has a new id, and takes the focus if `id` had it. */
|
|
57
|
+
swapTrial: (id: string, instrumentName: string, options?: AddTrialOptions) => void;
|
|
58
|
+
/** The trial last pointed at or focused, counting focus that moved into a
|
|
59
|
+
* frame inside it. A trial `addTrial` or `cloneTrial` opens takes it. Falls
|
|
60
|
+
* back to the first trial; null only when there are none. */
|
|
61
|
+
focusedTrialId: string | null;
|
|
62
|
+
focusTrial: (id: string) => void;
|
|
63
|
+
savedSnapshots: SavedSnapshot[];
|
|
64
|
+
saveSnapshot: (trialId: string, name?: string) => void;
|
|
65
|
+
loadSnapshot: (trialId: string, snapshotId: string) => void;
|
|
66
|
+
deleteSnapshot: (snapshotId: string) => void;
|
|
67
|
+
mode: LabMode;
|
|
68
|
+
setMode: (m: LabMode) => void;
|
|
69
|
+
/** Lab-wide rules run over every instrument's config leaves, before
|
|
70
|
+
* labkit's own inference. */
|
|
71
|
+
configRules?: readonly ConfigRule[];
|
|
72
|
+
/** Lab-wide control overrides, keyed by config path or by leaf kind. */
|
|
73
|
+
controls?: Record<string, ControlRenderer>;
|
|
74
|
+
}
|
|
75
|
+
/** Context carrying the surrounding lab. Prefer `useLabContext`. */
|
|
76
|
+
declare const LabContext: react.Context<LabContextValue | null>;
|
|
77
|
+
/** The surrounding lab. Throws outside a `<Lab>`. */
|
|
78
|
+
declare function useLabContext(): LabContextValue;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A named position in the lab's own chrome — a box the shell owns, outside any
|
|
82
|
+
* one trial. `header` and `footer` are the shell's two bars, named as
|
|
83
|
+
* `<LabShell>` names them; `palette` is the tool rail down the side of the
|
|
84
|
+
* workspace; `sidebar` is a column of sections left of the tool rail.
|
|
85
|
+
*/
|
|
86
|
+
type LabRegion = 'header' | 'palette' | 'sidebar' | 'aside' | 'footer';
|
|
87
|
+
/**
|
|
88
|
+
* Everything a lab-level contribution can read and command: the lab's own
|
|
89
|
+
* state and operations, plus the lab's tool slot — which every trial whose
|
|
90
|
+
* instrument declares no tools of its own reflects and writes.
|
|
91
|
+
*/
|
|
92
|
+
interface LabChromeContext extends LabContextValue, ToolSlotContext {
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A contribution to the lab's chrome. Shaped as `TrialContribution` is, and
|
|
96
|
+
* merged and suppressed by the same rules, but keyed to the lab's regions and
|
|
97
|
+
* rendered with the lab's context. Supplying `render` instead of `item` opts
|
|
98
|
+
* out of the region's layout.
|
|
99
|
+
*
|
|
100
|
+
* `TCtx` is what the chrome hands a handler. It defaults to `LabChromeContext`,
|
|
101
|
+
* which is what `<Lab>` renders its regions with; a consumer mounting the
|
|
102
|
+
* regions under a bare `<LabShell>` names whatever it passes as `ctx` instead.
|
|
103
|
+
*/
|
|
104
|
+
type LabContribution<TCtx = LabChromeContext> = (ContributionBase & {
|
|
105
|
+
region: 'header';
|
|
106
|
+
item: ToolbarItem<TCtx>;
|
|
107
|
+
render?: never;
|
|
108
|
+
}) | (ContributionBase & {
|
|
109
|
+
region: 'palette';
|
|
110
|
+
item: ToolItem;
|
|
111
|
+
render?: never;
|
|
112
|
+
}) | (ContributionBase & {
|
|
113
|
+
region: 'sidebar' | 'aside';
|
|
114
|
+
item: SidebarSection;
|
|
115
|
+
render?: never;
|
|
116
|
+
}) | (ContributionBase & {
|
|
117
|
+
region: 'footer';
|
|
118
|
+
item: StatusReadout;
|
|
119
|
+
render?: never;
|
|
120
|
+
}) | (ContributionBase & {
|
|
121
|
+
region: LabRegion;
|
|
122
|
+
item?: never;
|
|
123
|
+
render: (ctx: TCtx) => ReactNode;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
/** The lab's chrome context: the lab itself, plus the lab's tool slot. Throws
|
|
127
|
+
* outside a `<Lab>`. */
|
|
128
|
+
declare function useLabChromeContext(): LabChromeContext;
|
|
129
|
+
/** The lab's contributions for one region, in declaration order. */
|
|
130
|
+
declare function contributionsIn<TCtx = LabChromeContext>(contributions: readonly LabContribution<TCtx>[], region: LabRegion): LabContribution<TCtx>[];
|
|
131
|
+
/** The palette contributions a lab's `tools` stand for. Declaring a tool is
|
|
132
|
+
* shorthand for contributing a palette item that writes the lab's tool
|
|
133
|
+
* slot. */
|
|
134
|
+
declare function toolContributions(tools: readonly TrialTool[]): LabContribution[];
|
|
135
|
+
/** Everything the lab's chrome renders, from both of the ways a lab declares
|
|
136
|
+
* it. Tools and contributions share one id namespace, so a tool colliding
|
|
137
|
+
* with a contribution throws here rather than one of them silently losing. */
|
|
138
|
+
declare function labContributions(tools: readonly TrialTool[] | undefined, chrome: readonly LabContribution[] | undefined): LabContribution[];
|
|
139
|
+
/** Props shared by the lab's region mounts. Each takes the lab's whole
|
|
140
|
+
* contribution list and lays out the part addressed to it. */
|
|
141
|
+
interface LabRegionProps {
|
|
142
|
+
contributions: readonly LabContribution[];
|
|
143
|
+
}
|
|
144
|
+
/** The lab's action bar, in the shell header beside the title. */
|
|
145
|
+
declare function LabHeaderRegion({ contributions }: LabRegionProps): react_jsx_runtime.JSX.Element;
|
|
146
|
+
/** The lab's sidebar sections. Fold state is a lab-scoped persisted value, so it
|
|
147
|
+
* survives a reload in a stored lab and lasts the session in an unstored one. */
|
|
148
|
+
declare function LabSidebarRegion({ contributions }: LabRegionProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
/** The lab's aside sections, on the far side of the workspace from the sidebar.
|
|
150
|
+
* Fold state persists the way the sidebar's does. */
|
|
151
|
+
declare function LabAsideRegion({ contributions }: LabRegionProps): react_jsx_runtime.JSX.Element;
|
|
152
|
+
/** The lab's readouts, in the shell footer below the workspace. */
|
|
153
|
+
declare function LabFooterRegion({ contributions }: LabRegionProps): react_jsx_runtime.JSX.Element;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Concatenate contribution bundles into one list, preserving order — order
|
|
157
|
+
* decides how a region lays its contributions out, so it is part of the
|
|
158
|
+
* result, not an accident of it.
|
|
159
|
+
*
|
|
160
|
+
* Throws on a duplicate id rather than dropping one: a contribution silently
|
|
161
|
+
* losing to a later bundle is the failure a registry exists to prevent.
|
|
162
|
+
*/
|
|
163
|
+
declare function mergeContributions<T extends {
|
|
164
|
+
id: string;
|
|
165
|
+
}>(...bundles: readonly (readonly T[])[]): T[];
|
|
166
|
+
/**
|
|
167
|
+
* Drop contributions by id. Throws when an id is not present: a typo that
|
|
168
|
+
* silently suppresses nothing is the same class of bug as a duplicate id
|
|
169
|
+
* silently winning.
|
|
170
|
+
*/
|
|
171
|
+
declare function suppressContributions<T extends {
|
|
172
|
+
id: string;
|
|
173
|
+
}>(bundle: readonly T[], ids: readonly string[]): T[];
|
|
174
|
+
|
|
175
|
+
/** Props for `<PaletteRegion>`. */
|
|
176
|
+
interface PaletteRegionProps<TCtx extends ToolSlotContext = TrialChromeContext> {
|
|
177
|
+
contributions: readonly RegionContribution<NoInfer<TCtx>>[];
|
|
178
|
+
ctx: TCtx;
|
|
179
|
+
/** Which region's items to lay out. The lab's rail names the same box
|
|
180
|
+
* `palette` too, so this only moves for a chrome that does not. */
|
|
181
|
+
region?: string;
|
|
182
|
+
}
|
|
183
|
+
/** A tool strip: a trial's, or the lab's. Selection lives in whichever tool
|
|
184
|
+
* slot the context carries; this region only reflects it. */
|
|
185
|
+
declare function PaletteRegion<TCtx extends ToolSlotContext = TrialChromeContext>({ contributions, ctx, region, }: PaletteRegionProps<TCtx>): react_jsx_runtime.JSX.Element | null;
|
|
186
|
+
|
|
187
|
+
/** Props for `<SidebarRegion>`. */
|
|
188
|
+
interface SidebarRegionProps<TCtx extends SidebarSlotContext = TrialChromeContext> {
|
|
189
|
+
contributions: readonly RegionContribution<NoInfer<TCtx>>[];
|
|
190
|
+
ctx: TCtx;
|
|
191
|
+
/** Which region's items to lay out. */
|
|
192
|
+
region?: string;
|
|
193
|
+
}
|
|
194
|
+
/** Lays `sidebar` contributions out as titled, collapsible sections — a
|
|
195
|
+
* trial's, or the lab's. A section the trial has torn out is not rendered
|
|
196
|
+
* here — `Trial` portals its body into the workspace instead. A context with
|
|
197
|
+
* no `undockPanel` offers no tear-out. */
|
|
198
|
+
declare function SidebarRegion<TCtx extends SidebarSlotContext = TrialChromeContext>({ contributions, ctx, region, }: SidebarRegionProps<TCtx>): react_jsx_runtime.JSX.Element | null;
|
|
199
|
+
|
|
200
|
+
/** Props for `<StatusRegion>`. */
|
|
201
|
+
interface StatusRegionProps<TCtx = TrialChromeContext> {
|
|
202
|
+
contributions: readonly RegionContribution<NoInfer<TCtx>>[];
|
|
203
|
+
ctx: TCtx;
|
|
204
|
+
/** Which region's readouts to lay out; the lab's footer is `footer`. */
|
|
205
|
+
region?: string;
|
|
206
|
+
}
|
|
207
|
+
/** Lays a bar's readouts out. */
|
|
208
|
+
declare function StatusRegion<TCtx = TrialChromeContext>({ contributions, ctx, region, }: StatusRegionProps<TCtx>): react_jsx_runtime.JSX.Element | null;
|
|
209
|
+
|
|
210
|
+
/** Which end of the title bar a `<TitleBarRegion>` lays out: `'lead'` renders
|
|
211
|
+
* the contributions that leave `end` unset, before the title; `'actions'`
|
|
212
|
+
* renders the ones that set it, after everything else. */
|
|
213
|
+
type TitleBarPlacement = 'lead' | 'actions';
|
|
214
|
+
/** Props for `<TitleBarRegion>`. */
|
|
215
|
+
interface TitleBarRegionProps {
|
|
216
|
+
contributions: readonly TrialContribution[];
|
|
217
|
+
ctx: TrialChromeContext;
|
|
218
|
+
/** Defaults to `'actions'`, where the built-ins live. */
|
|
219
|
+
placement?: TitleBarPlacement;
|
|
220
|
+
}
|
|
221
|
+
/** Lays a trial's `titlebar` contributions out at one end of the bar. */
|
|
222
|
+
declare function TitleBarRegion({ contributions, ctx, placement }: TitleBarRegionProps): react_jsx_runtime.JSX.Element | null;
|
|
223
|
+
|
|
224
|
+
/** Props for `<ToolbarRegion>`. */
|
|
225
|
+
interface ToolbarRegionProps<TCtx = TrialChromeContext> {
|
|
226
|
+
contributions: readonly RegionContribution<NoInfer<TCtx>>[];
|
|
227
|
+
ctx: TCtx;
|
|
228
|
+
/** Which region's items to lay out; the lab's action bar is `header`. */
|
|
229
|
+
region?: string;
|
|
230
|
+
/** The bar's accessible name. */
|
|
231
|
+
label?: string;
|
|
232
|
+
}
|
|
233
|
+
/** Lays a bar's contributions out, grouped by their `group`. */
|
|
234
|
+
declare function ToolbarRegion<TCtx = TrialChromeContext>({ contributions, ctx, region, label, }: ToolbarRegionProps<TCtx>): react_jsx_runtime.JSX.Element | null;
|
|
235
|
+
|
|
236
|
+
/** Props for `<ViewportRegion>`. */
|
|
237
|
+
interface ViewportRegionProps {
|
|
238
|
+
contributions: readonly TrialContribution[];
|
|
239
|
+
ctx: TrialChromeContext;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Controls acting on the view of a trial. Anchored inside the content well
|
|
243
|
+
* rather than in the toolbar, which acts on the trial itself.
|
|
244
|
+
*/
|
|
245
|
+
declare function ViewportRegion({ contributions, ctx }: ViewportRegionProps): react_jsx_runtime.JSX.Element | null;
|
|
246
|
+
|
|
247
|
+
export { resetTrial as B, suppressContributions as C, toolContributions as D, useLabChromeContext as E, useLabContext as F, PaletteRegion as P, SidebarRegion as S, ViewportRegion as V, LabAsideRegion as a, LabContext as c, LabFooterRegion as e, LabHeaderRegion as f, LabSidebarRegion as i, StatusRegion as l, TitleBarRegion as n, ToolbarRegion as p, addTrial as s, builtinContributions as t, cloneTrial as u, closeTrial as v, contributionsIn as w, labContributions as x, mergeContributions as y, reorderTrials as z };
|
|
248
|
+
export type { AddTrialOptions as A, LabContribution as L, TitleBarPlacement as T, LabChromeContext as b, LabContextValue as d, LabRegion as g, LabRegionProps as h, PaletteRegionProps as j, SidebarRegionProps as k, StatusRegionProps as m, TitleBarRegionProps as o, ToolbarRegionProps as q, ViewportRegionProps as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ToolPrefLeaf, ToolPrefGroup } from '@weasel-js/core';
|
|
2
|
-
import { P as PrefRenderer } from './PrefsForm.d-
|
|
1
|
+
import { ToolPrefNumberFormat, ToolPrefNumberUnit, ToolPrefLeaf, ToolPrefGroup } from '@weasel-js/core';
|
|
2
|
+
import { P as PrefRenderer } from './PrefsForm.d-DPy9I8It.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Renders the control cell for one config leaf. Identical to weasel-ui's
|
|
@@ -24,6 +24,13 @@ interface Annotations {
|
|
|
24
24
|
max?: number;
|
|
25
25
|
step?: number;
|
|
26
26
|
suffix?: string;
|
|
27
|
+
/** How a number's value is shown. `compact` abbreviates from a thousand up. */
|
|
28
|
+
format?: ToolPrefNumberFormat;
|
|
29
|
+
/** Display-unit conversion for a number stored in a canonical unit — the
|
|
30
|
+
* value, its bounds and its step all convert at the control's edge. */
|
|
31
|
+
unit?: ToolPrefNumberUnit;
|
|
32
|
+
/** A color leaf's value carries alpha (`#rrggbbaa`) and its row edits it. */
|
|
33
|
+
alpha?: boolean;
|
|
27
34
|
control?: string;
|
|
28
35
|
options?: readonly ConfigOption[];
|
|
29
36
|
placeholder?: string;
|
|
@@ -71,6 +78,10 @@ interface SectionSpec {
|
|
|
71
78
|
* whether or not it was given a panel-wide `collapse`; a fold the reader
|
|
72
79
|
* has since toggled outranks it. */
|
|
73
80
|
collapsed?: boolean;
|
|
81
|
+
/** Where the section's rows put their labels, over the panel's `layout`. */
|
|
82
|
+
layout?: 'block' | 'inline';
|
|
83
|
+
/** How the section packs its rows, over the panel's `pack`. */
|
|
84
|
+
pack?: 'auto' | 'pairs' | 'one-up';
|
|
74
85
|
}
|
|
75
86
|
/** A schema resolved against a set of rules: the vocabulary weasel-ui renders,
|
|
76
87
|
* plus the three things labkit keeps on the side because `PrefLeaf` has no
|
|
@@ -90,11 +101,26 @@ interface ResolvedConfig {
|
|
|
90
101
|
interface SectionOption {
|
|
91
102
|
label: string;
|
|
92
103
|
collapsed?: boolean;
|
|
104
|
+
/** Where the section's rows put their labels, over the panel's `layout`. */
|
|
105
|
+
layout?: 'block' | 'inline';
|
|
106
|
+
/** How the section packs its rows, over the panel's `pack`. */
|
|
107
|
+
pack?: 'auto' | 'pairs' | 'one-up';
|
|
93
108
|
}
|
|
94
109
|
/** Per-node extras that do not belong on a `PrefLeaf`. */
|
|
95
110
|
interface NodeOptions extends BranchOptions {
|
|
96
111
|
render?: ControlRenderer;
|
|
97
|
-
|
|
112
|
+
/** Errors for this leaf under `config`, the instrument's whole config. */
|
|
113
|
+
validate?: (leaf: ToolPrefLeaf, config: Record<string, unknown>) => string[];
|
|
114
|
+
/** Computes this leaf's value while it is auto. Attaching one is what lets
|
|
115
|
+
* the ghosted control draw a real value and keeps the instrument off
|
|
116
|
+
* `?? compute()`. */
|
|
117
|
+
autoResolve?: (config: Record<string, unknown>) => unknown;
|
|
118
|
+
/** The leaf starts auto rather than pinned at its default. Set by
|
|
119
|
+
* `.initial(auto)`. */
|
|
120
|
+
unpinned?: boolean;
|
|
121
|
+
/** The leaf can never be auto: the row takes no pin dot and ignores the
|
|
122
|
+
* gesture. For a value the instrument cannot receive as `undefined`. */
|
|
123
|
+
manual?: boolean;
|
|
98
124
|
}
|
|
99
125
|
/** What a branch can say about itself, beyond its children. */
|
|
100
126
|
interface BranchOptions {
|
|
@@ -163,4 +189,65 @@ interface ConfigSchema<TC> {
|
|
|
163
189
|
/** The config type behind a schema: `ConfigOf<typeof sceneConfig>`. */
|
|
164
190
|
type ConfigOf<S> = S extends ConfigSchema<infer TC> ? TC : never;
|
|
165
191
|
|
|
166
|
-
|
|
192
|
+
/** Which control a config field is edited with. */
|
|
193
|
+
type ConfigFieldType = 'slider' | 'checkbox' | 'select' | 'number' | 'text' | 'color';
|
|
194
|
+
/** What every config field carries: the config key it writes, the label shown
|
|
195
|
+
* beside it, and which control renders it. */
|
|
196
|
+
interface ConfigFieldBase {
|
|
197
|
+
key: string;
|
|
198
|
+
label: string;
|
|
199
|
+
type: ConfigFieldType;
|
|
200
|
+
}
|
|
201
|
+
/** A bounded number edited by dragging. */
|
|
202
|
+
interface SliderField extends ConfigFieldBase {
|
|
203
|
+
type: 'slider';
|
|
204
|
+
default: number;
|
|
205
|
+
min: number;
|
|
206
|
+
max: number;
|
|
207
|
+
step?: number;
|
|
208
|
+
}
|
|
209
|
+
/** A boolean. */
|
|
210
|
+
interface CheckboxField extends ConfigFieldBase {
|
|
211
|
+
type: 'checkbox';
|
|
212
|
+
default: boolean;
|
|
213
|
+
}
|
|
214
|
+
/** One choice in a select field. */
|
|
215
|
+
interface SelectOption {
|
|
216
|
+
value: string;
|
|
217
|
+
label: string;
|
|
218
|
+
}
|
|
219
|
+
/** A fixed set of labeled choices. */
|
|
220
|
+
interface SelectField extends ConfigFieldBase {
|
|
221
|
+
type: 'select';
|
|
222
|
+
default: string;
|
|
223
|
+
options: SelectOption[];
|
|
224
|
+
}
|
|
225
|
+
/** A number typed directly, optionally bounded. Use a slider field instead
|
|
226
|
+
* when the range matters more than the exact value. */
|
|
227
|
+
interface NumberField extends ConfigFieldBase {
|
|
228
|
+
type: 'number';
|
|
229
|
+
default: number;
|
|
230
|
+
min?: number;
|
|
231
|
+
max?: number;
|
|
232
|
+
step?: number;
|
|
233
|
+
}
|
|
234
|
+
/** A free-text string. Writes are debounced so typing does not re-run the
|
|
235
|
+
* instrument on every keystroke. */
|
|
236
|
+
interface TextField extends ConfigFieldBase {
|
|
237
|
+
type: 'text';
|
|
238
|
+
default: string;
|
|
239
|
+
placeholder?: string;
|
|
240
|
+
maxLength?: number;
|
|
241
|
+
/** Milliseconds to debounce live setConfig calls. Default 150 ms. Set to 0 to disable. */
|
|
242
|
+
debounceMs?: number;
|
|
243
|
+
}
|
|
244
|
+
/** A color, as a CSS color string. */
|
|
245
|
+
interface ColorField extends ConfigFieldBase {
|
|
246
|
+
type: 'color';
|
|
247
|
+
default: string;
|
|
248
|
+
}
|
|
249
|
+
/** One field of an instrument's config schema. The schema is what the control
|
|
250
|
+
* panel renders, and what `validateConfigSchema` checks. */
|
|
251
|
+
type ConfigField = SliderField | CheckboxField | SelectField | NumberField | TextField | ColorField;
|
|
252
|
+
|
|
253
|
+
export type { Annotations as A, BranchAnnotations as B, ConfigPath as C, EntryValue as E, InferConfig as I, LeafPatch as L, NodeOptions as N, ResolvedConfig as R, SectionSpec as S, TextField as T, ValueAtPath as V, ConfigField as a, ConfigSchema as b, ConfigRule as c, ControlRenderer as d, BranchOptions as e, CheckboxField as f, ColorField as g, ConfigBranch as h, ConfigEntry as i, ConfigFieldBase as j, ConfigFieldType as k, ConfigNode as l, ConfigOf as m, ConfigOption as n, ConfigRuleContext as o, ConfigShape as p, NodeValue as q, NumberField as r, SelectField as s, SelectOption as t, SliderField as u, SectionOption as v };
|