@weasel-js/labkit 1.3.0-pre.0 → 1.4.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_dts/CanvasStackContext-DtAn_3O-.d.ts +42 -0
- package/dist/_dts/DrawCommand-B3bskUsC.d.ts +564 -0
- package/dist/_dts/{PrefsForm-BYa6cWnO.d.ts → PrefsForm-BkUJZx0A.d.ts} +4 -1
- package/dist/_dts/fitViewToBounds-dZ2UDB6e.d.ts +21 -0
- package/dist/_dts/frac-Cp3NivlC.d.ts +728 -0
- package/dist/_dts/index-BDVzvRzQ.d.ts +236 -0
- package/dist/_dts/shapeKinds-Cx_rxwsa.d.ts +87 -0
- package/dist/_dts/{DrawCommand-DBB45NfN.d.ts → types-C-gh9Ap-.d.ts} +1 -582
- package/dist/_dts/{types-AHlQxBNN.d.ts → types-D6s4b7if.d.ts} +2 -2
- package/dist/_dts/{types-1Sdxy_Pv.d.ts → types-DYMaEvM5.d.ts} +26 -1
- package/dist/_dts/{useTrialState-CsGMjhu9.d.ts → useTrialState-gmMvZqPc.d.ts} +7 -2
- package/dist/canvas/index.d.ts +43 -25
- package/dist/canvas/index.js +5 -3
- package/dist/chrome/index.d.ts +9 -6
- package/dist/chrome/index.js +7 -6
- package/dist/chunk-2AYGEN57.js +32 -0
- package/dist/chunk-2AYGEN57.js.map +1 -0
- package/dist/{chunk-RVNN4CHQ.js → chunk-3P5TTTA7.js} +16 -8
- package/dist/chunk-3P5TTTA7.js.map +1 -0
- package/dist/{chunk-NS54R52R.js → chunk-3ZELRRBV.js} +45 -40
- package/dist/chunk-3ZELRRBV.js.map +1 -0
- package/dist/{chunk-HFDVGF4X.js → chunk-4EY67BKJ.js} +32 -7
- package/dist/chunk-4EY67BKJ.js.map +1 -0
- package/dist/chunk-5TCEVMPI.js +140 -0
- package/dist/chunk-5TCEVMPI.js.map +1 -0
- package/dist/{chunk-O7NVSCLN.js → chunk-6JMU56CU.js} +133 -134
- package/dist/chunk-6JMU56CU.js.map +1 -0
- package/dist/{chunk-CPUJ3QXL.js → chunk-CQLQPQ4P.js} +2 -2
- package/dist/chunk-CQLQPQ4P.js.map +1 -0
- package/dist/chunk-CTRKTLYZ.js +33 -0
- package/dist/chunk-CTRKTLYZ.js.map +1 -0
- package/dist/chunk-EQIB2PGC.js +458 -0
- package/dist/chunk-EQIB2PGC.js.map +1 -0
- package/dist/chunk-HEORBLVT.js +7128 -0
- package/dist/chunk-HEORBLVT.js.map +1 -0
- package/dist/{chunk-V7PRSIRQ.js → chunk-JDDIZSLL.js} +4 -4
- package/dist/chunk-JDDIZSLL.js.map +1 -0
- package/dist/chunk-LITE5YFB.js +669 -0
- package/dist/chunk-LITE5YFB.js.map +1 -0
- package/dist/{chunk-Z6HJ5FEM.js → chunk-ROQDRXKW.js} +732 -315
- package/dist/chunk-ROQDRXKW.js.map +1 -0
- package/dist/chunk-SBXNQW4G.js +3 -0
- package/dist/chunk-SBXNQW4G.js.map +1 -0
- package/dist/{chunk-4TMMVIDM.js → chunk-XJ6N32QP.js} +50 -6
- package/dist/chunk-XJ6N32QP.js.map +1 -0
- package/dist/chunk-YQJNT4XQ.js +293 -0
- package/dist/chunk-YQJNT4XQ.js.map +1 -0
- package/dist/controls/index.d.ts +4 -28
- package/dist/controls/index.js +3 -3
- package/dist/dragdrop/index.d.ts +50 -5
- package/dist/dragdrop/index.js +3 -1
- package/dist/index.d.ts +660 -302
- package/dist/index.js +1793 -587
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +6 -5
- package/dist/layers/index.js +4 -2
- package/dist/loupe/index.d.ts +187 -0
- package/dist/loupe/index.js +7 -0
- package/dist/loupe/index.js.map +1 -0
- package/dist/passthrough/weasel-canvas.d.ts +3 -1
- package/dist/passthrough/weasel-canvas.js +1 -1
- package/dist/passthrough/weasel-ui.d.ts +151 -91
- package/dist/passthrough/weasel-ui.js +3 -2
- package/dist/primitives/index.d.ts +3 -1
- package/dist/primitives/index.js +6 -5
- package/dist/state/index.d.ts +3 -3
- package/dist/state/index.js +2 -2
- package/dist/styles.css +229 -703
- package/dist/surface/index.d.ts +18 -2
- package/dist/surface/index.js +2 -2
- package/dist/ui/layers/index.d.ts +8 -2
- package/dist/ui/layers/index.js +2 -4
- package/dist/undo/index.d.ts +5 -4
- package/package.json +14 -7
- package/src/annotations/AnnotationOverlay.tsx +205 -0
- package/src/annotations/AnnotationTargets.tsx +37 -0
- package/src/annotations/Annotations.less +129 -0
- package/src/annotations/Annotations.meaning.test.tsx +111 -0
- package/src/annotations/Annotations.overlay.test.tsx +142 -0
- package/src/annotations/AnnotationsContext.ts +49 -0
- package/src/annotations/ExportMenu.test.tsx +86 -0
- package/src/annotations/ExportMenu.tsx +182 -0
- package/src/annotations/MarkList.tsx +75 -0
- package/src/annotations/capture.test.ts +140 -0
- package/src/annotations/capture.ts +237 -0
- package/src/annotations/drawOne.test.ts +56 -0
- package/src/annotations/drawOne.ts +47 -0
- package/src/annotations/frac.test.ts +59 -0
- package/src/annotations/frac.ts +66 -0
- package/src/annotations/history.test.ts +82 -0
- package/src/annotations/history.ts +118 -0
- package/src/annotations/index.ts +37 -0
- package/src/annotations/paint.test.ts +125 -0
- package/src/annotations/paint.ts +130 -0
- package/src/annotations/staleness.test.ts +56 -0
- package/src/annotations/staleness.ts +41 -0
- package/src/annotations/store.test.ts +175 -0
- package/src/annotations/store.ts +317 -0
- package/src/annotations/svgNodes.test.ts +77 -0
- package/src/annotations/svgNodes.ts +74 -0
- package/src/annotations/toolMap.test.ts +36 -0
- package/src/annotations/toolMap.ts +54 -0
- package/src/annotations/types.ts +222 -0
- package/src/annotations/view.test.ts +37 -0
- package/src/annotations/view.ts +40 -0
- package/src/canvas/AGENTS.md +55 -5
- package/src/canvas/CanvasStack.test.tsx +27 -1
- package/src/canvas/CanvasStack.tsx +29 -4
- package/src/canvas/CanvasStackContext.ts +23 -4
- package/src/canvas/camera.test.ts +78 -0
- package/src/canvas/camera.ts +62 -0
- package/src/canvas/canvasCoords.test.ts +26 -0
- package/src/canvas/canvasCoords.ts +20 -7
- package/src/canvas/index.ts +5 -1
- package/src/canvas/useLayerScheduler.ts +7 -3
- package/src/canvas/usePanZoom.test.ts +36 -5
- package/src/canvas/usePanZoom.ts +20 -15
- package/src/canvas/worldSpec.test.ts +63 -0
- package/src/canvas/worldSpec.ts +48 -0
- package/src/chrome/builtins.test.ts +31 -1
- package/src/chrome/builtins.tsx +63 -19
- package/src/chrome/regions/PaletteRegion.test.tsx +22 -1
- package/src/chrome/regions/PaletteRegion.tsx +4 -0
- package/src/chrome/regions/SidebarRegion.tsx +37 -13
- package/src/chrome/regions/ToolbarRegion.tsx +2 -1
- package/src/chrome/regions/ViewportRegion.tsx +9 -1
- package/src/chrome/regions/regions.test.tsx +6 -1
- package/src/chrome/types.ts +20 -0
- package/src/config/builder.test.ts +7 -1
- package/src/config/builder.ts +1 -5
- package/src/config/resolve.test.ts +1 -2
- package/src/controls/ControlPanel.stories.tsx +41 -2
- package/src/controls/ControlPanel.test.tsx +69 -9
- package/src/controls/ControlPanel.tsx +106 -25
- package/src/dragdrop/DragDropRuntime.tsx +8 -2
- package/src/dragdrop/dragDrop.test.tsx +29 -2
- package/src/dragdrop/index.ts +11 -0
- package/src/index.test.ts +22 -0
- package/src/index.ts +136 -4
- package/src/instrument/SineWave.smoke.test.tsx +1 -0
- package/src/instrument/types.ts +24 -1
- package/src/lab/Lab.surface.test.tsx +162 -0
- package/src/lab/Lab.tsx +102 -17
- package/src/lab/Lab.undock.test.tsx +85 -0
- package/src/lab/LabFullChrome.stories.tsx +20 -0
- package/src/lab/LabShell.less +11 -0
- package/src/lab/Workspace.less +73 -0
- package/src/lab/Workspace.surface.test.tsx +2 -0
- package/src/lab/Workspace.tsx +97 -8
- package/src/lab/index.ts +1 -1
- package/src/lab/panelHost.ts +37 -0
- package/src/layers/AGENTS.md +1 -1
- package/src/layers/LayerList.tsx +1 -1
- package/src/loupe/AGENTS.md +49 -0
- package/src/loupe/CanvasLoupe.tsx +83 -0
- package/src/loupe/DomLoupe.tsx +62 -0
- package/src/loupe/Loupe.less +38 -0
- package/src/loupe/LoupeBubble.tsx +32 -0
- package/src/loupe/TrialLoupe.tsx +93 -0
- package/src/loupe/canvasLens.test.ts +205 -0
- package/src/loupe/canvasLens.ts +141 -0
- package/src/loupe/index.ts +19 -0
- package/src/loupe/types.test.ts +29 -0
- package/src/loupe/types.ts +90 -0
- package/src/loupe/useHostSize.ts +30 -0
- package/src/loupe/useLoupe.test.tsx +197 -0
- package/src/loupe/useLoupe.ts +189 -0
- package/src/passthrough/weasel-ui.ts +25 -17
- package/src/primitives/FloatingPanel.test.tsx +76 -1
- package/src/primitives/FloatingPanel.tsx +19 -3
- package/src/primitives/ScaleIndicator.test.tsx +7 -2
- package/src/primitives/Sidebar.less +18 -0
- package/src/primitives/Toolbar.less +8 -0
- package/src/primitives/Toolbar.tsx +5 -0
- package/src/primitives/useRovingTabIndex.test.ts +21 -0
- package/src/primitives/useRovingTabIndex.ts +26 -17
- package/src/state/document.test.ts +23 -0
- package/src/state/document.ts +14 -2
- package/src/state/index.ts +2 -0
- package/src/state/store.test.ts +24 -0
- package/src/state/store.ts +35 -1
- package/src/state/types.ts +11 -0
- package/src/state/undock.test.ts +40 -0
- package/src/state/undock.ts +39 -0
- package/src/styles.less +2 -4
- package/src/surface/SurfaceContext.ts +4 -0
- package/src/surface/index.ts +8 -3
- package/src/surface/useSurfaceTile.test.tsx +2 -0
- package/src/surface/useSurfaceTile.ts +7 -1
- package/src/surface/useTiledSurface.test.tsx +58 -0
- package/src/surface/useTiledSurface.ts +38 -3
- package/src/theme/Interstellar.stories.tsx +1 -1
- package/src/trial/Trial.annotations.persist.test.tsx +166 -0
- package/src/trial/Trial.annotations.test.tsx +121 -0
- package/src/trial/Trial.canvas.test.tsx +76 -1
- package/src/trial/Trial.config.test.tsx +3 -8
- package/src/trial/Trial.less +19 -0
- package/src/trial/Trial.loupe.test.tsx +128 -0
- package/src/trial/Trial.stories.tsx +1 -0
- package/src/trial/Trial.test.tsx +12 -0
- package/src/trial/Trial.trialId.test.tsx +36 -0
- package/src/trial/Trial.tsx +215 -40
- package/src/trial/TrialChrome.tsx +35 -0
- package/src/trial/UndockedSections.tsx +65 -0
- package/src/trial/trialOps.test.ts +21 -0
- package/src/trial/trialOps.ts +5 -3
- package/src/ui/layers/index.ts +5 -1
- package/dist/_dts/index-DgcNdEdh.d.ts +0 -314
- package/dist/chunk-4TMMVIDM.js.map +0 -1
- package/dist/chunk-CPUJ3QXL.js.map +0 -1
- package/dist/chunk-HFDVGF4X.js.map +0 -1
- package/dist/chunk-NS54R52R.js.map +0 -1
- package/dist/chunk-O2BULFHX.js +0 -152
- package/dist/chunk-O2BULFHX.js.map +0 -1
- package/dist/chunk-O7NVSCLN.js.map +0 -1
- package/dist/chunk-PO6L3NSH.js +0 -366
- package/dist/chunk-PO6L3NSH.js.map +0 -1
- package/dist/chunk-PQJ5B2U2.js +0 -27
- package/dist/chunk-PQJ5B2U2.js.map +0 -1
- package/dist/chunk-RVNN4CHQ.js.map +0 -1
- package/dist/chunk-TLGRYALP.js +0 -6151
- package/dist/chunk-TLGRYALP.js.map +0 -1
- package/dist/chunk-V7PRSIRQ.js.map +0 -1
- package/dist/chunk-Z6HJ5FEM.js.map +0 -1
- package/dist/chunk-ZZAYVX4X.js +0 -505
- package/dist/chunk-ZZAYVX4X.js.map +0 -1
- package/src/primitives/DragHandleGlyph.tsx +0 -29
- package/src/ui/format.test.ts +0 -33
- package/src/ui/format.ts +0 -30
- package/src/ui/layers/LayerStack.less +0 -143
- package/src/ui/layers/LayerStack.stories.tsx +0 -45
- package/src/ui/layers/LayerStack.test.tsx +0 -170
- package/src/ui/layers/LayerStack.tsx +0 -208
- package/src/ui/properties/CheckboxRow.stories.tsx +0 -27
- package/src/ui/properties/ColorRow.stories.tsx +0 -106
- package/src/ui/properties/CurveField.less +0 -48
- package/src/ui/properties/CurveField.stories.tsx +0 -20
- package/src/ui/properties/CurveField.test.tsx +0 -127
- package/src/ui/properties/CurveField.tsx +0 -184
- package/src/ui/properties/EffectCard.tsx +0 -324
- package/src/ui/properties/Gallery.stories.tsx +0 -178
- package/src/ui/properties/NumberRow.stories.tsx +0 -65
- package/src/ui/properties/PropertyGroup.less +0 -50
- package/src/ui/properties/PropertyGroup.stories.tsx +0 -34
- package/src/ui/properties/PropertyGroup.test.tsx +0 -33
- package/src/ui/properties/PropertyGroup.tsx +0 -45
- package/src/ui/properties/PropertyList.stories.tsx +0 -83
- package/src/ui/properties/PropertyPanel.less +0 -606
- package/src/ui/properties/PropertyPanel.stories.tsx +0 -190
- package/src/ui/properties/PropertyPanel.test.tsx +0 -193
- package/src/ui/properties/PropertyPanel.tsx +0 -469
- package/src/ui/properties/PropertyRow.stories.tsx +0 -53
- package/src/ui/properties/SelectRow.stories.tsx +0 -58
- package/src/ui/properties/SliderRow.stories.tsx +0 -74
- package/src/ui/properties/SpeechBalloonPanels.stories.tsx +0 -398
- package/src/ui/properties/TextRow.stories.tsx +0 -62
- package/src/ui/properties/ToggleRow.stories.tsx +0 -57
- package/src/ui/properties/index.ts +0 -39
- package/src/ui/properties/storyLayouts.tsx +0 -36
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { R as ResolvedConfig, C as ConfigField, c as ControlRenderer } from './types-D6s4b7if.js';
|
|
4
|
+
|
|
5
|
+
/** Props for `<PropertyPanel>`. */
|
|
6
|
+
interface PropertyPanelProps {
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A titled panel holding property rows — the sidebar container the rest of
|
|
12
|
+
* this module's components fill. */
|
|
13
|
+
declare function PropertyPanel({ title, children, className }: PropertyPanelProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
/** How a property list packs its rows into two columns. */
|
|
15
|
+
type PropertyListPack = 'auto-color' | 'pairs';
|
|
16
|
+
/** Props for `<PropertyList>`. */
|
|
17
|
+
interface PropertyListProps {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* How rows pack into the 2-column grid.
|
|
22
|
+
* - `'auto-color'` (default): only color rows pair side-by-side; everything
|
|
23
|
+
* else spans the full width. Right for sparse top-level panels.
|
|
24
|
+
* - `'pairs'`: every row auto-places into the 2-column grid two-per-row.
|
|
25
|
+
* Headers and subpanels still span the full width; wrap any other
|
|
26
|
+
* full-width child in `<PropertySpan>`. Right for dense effect bodies.
|
|
27
|
+
*/
|
|
28
|
+
pack?: PropertyListPack;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Grid container for PropertyRows. Use standalone for chrome-less layouts, or
|
|
32
|
+
* nest inside <PropertyPanel/> for the standard glass card.
|
|
33
|
+
*/
|
|
34
|
+
declare function PropertyList({ children, className, pack }: PropertyListProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
/** Props for `<PropertySpan>`. */
|
|
36
|
+
interface PropertySpanProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Wrapper that makes an arbitrary child span both columns of a
|
|
42
|
+
* `<PropertyList pack="pairs">`, a `<PropertyGroup pack="pairs">` body, or a
|
|
43
|
+
* `<Subpanel>`. `<PropertyRow span>` covers the row case; this covers
|
|
44
|
+
* everything else a consumer puts in the grid.
|
|
45
|
+
*/
|
|
46
|
+
declare function PropertySpan({ children, className }: PropertySpanProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
/** Which control shape a row holds, which decides its intrinsic layout. */
|
|
48
|
+
type PropertyRowVariant = 'default' | 'color' | 'checkbox';
|
|
49
|
+
/** Whether a row's label sits above its control or beside it. */
|
|
50
|
+
type PropertyRowLayout = 'block' | 'inline';
|
|
51
|
+
/** Props for `<PropertyRow>`. */
|
|
52
|
+
interface PropertyRowProps {
|
|
53
|
+
label: ReactNode;
|
|
54
|
+
/** Right-aligned readout shown next to the label (e.g. current value). */
|
|
55
|
+
readout?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Help text for the row, shown in a tooltip off an ⓘ affordance beside the
|
|
58
|
+
* label. Empty or absent renders no affordance.
|
|
59
|
+
*/
|
|
60
|
+
description?: string;
|
|
61
|
+
variant?: PropertyRowVariant;
|
|
62
|
+
/**
|
|
63
|
+
* Label position relative to the control. "block" (default) stacks
|
|
64
|
+
* label above control; "inline" places the label to the left.
|
|
65
|
+
* Color and checkbox variants are always inline by their own nature.
|
|
66
|
+
*/
|
|
67
|
+
layout?: PropertyRowLayout;
|
|
68
|
+
/**
|
|
69
|
+
* Take the full width of the enclosing grid. Only has an effect inside a
|
|
70
|
+
* `<PropertyList pack="pairs">` or a `<Subpanel>`; elsewhere rows are already
|
|
71
|
+
* full width.
|
|
72
|
+
*/
|
|
73
|
+
span?: boolean;
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
htmlFor?: string;
|
|
76
|
+
className?: string;
|
|
77
|
+
}
|
|
78
|
+
/** The label-plus-control frame every typed row below is built from. Use it
|
|
79
|
+
* directly for a control this module does not cover. */
|
|
80
|
+
declare function PropertyRow({ label, readout, description, variant, layout, span, children, htmlFor, className, }: PropertyRowProps): react_jsx_runtime.JSX.Element;
|
|
81
|
+
/** Props for `<SliderRow>`. */
|
|
82
|
+
interface SliderRowProps {
|
|
83
|
+
label: ReactNode;
|
|
84
|
+
value: number;
|
|
85
|
+
min: number;
|
|
86
|
+
max: number;
|
|
87
|
+
step?: number;
|
|
88
|
+
onChange: (next: number) => void;
|
|
89
|
+
/** Override how the value is rendered next to the label. Defaults to `value.toString()`. */
|
|
90
|
+
format?: (value: number) => ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* Optional suffix rendered next to the readout. A string becomes a
|
|
93
|
+
* baseline-aligned dim "word" unit (e.g. "px"); pass JSX like `<sup>°</sup>`
|
|
94
|
+
* to get the browser's native super positioning for symbol units.
|
|
95
|
+
*/
|
|
96
|
+
unit?: ReactNode;
|
|
97
|
+
layout?: PropertyRowLayout;
|
|
98
|
+
description?: string;
|
|
99
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
100
|
+
span?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** A bounded number edited by dragging, with a live readout whose precision
|
|
103
|
+
* follows `step`. */
|
|
104
|
+
declare function SliderRow({ label, value, min, max, step, onChange, format, unit, layout, description, span, }: SliderRowProps): react_jsx_runtime.JSX.Element;
|
|
105
|
+
/** Props for `<ColorRow>`. */
|
|
106
|
+
interface ColorRowProps {
|
|
107
|
+
label: ReactNode;
|
|
108
|
+
value: string;
|
|
109
|
+
onChange: (next: string) => void;
|
|
110
|
+
/** 0..1 alpha. When provided, a translucent slider renders beneath the swatch. */
|
|
111
|
+
alpha?: number;
|
|
112
|
+
onAlphaChange?: (next: number) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Render the alpha track as inert (dimmed, no thumb, not-allowed cursor).
|
|
115
|
+
* Use when the color's consumer drops alpha so the affordance reads dead.
|
|
116
|
+
*/
|
|
117
|
+
alphaDisabled?: boolean;
|
|
118
|
+
description?: string;
|
|
119
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
120
|
+
span?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/** A color swatch, optionally with an alpha slider beneath it. */
|
|
123
|
+
declare function ColorRow({ label, value, onChange, alpha, onAlphaChange, alphaDisabled, description, span, }: ColorRowProps): react_jsx_runtime.JSX.Element;
|
|
124
|
+
/** Props for `<CheckboxRow>`. */
|
|
125
|
+
interface CheckboxRowProps {
|
|
126
|
+
label: ReactNode;
|
|
127
|
+
value: boolean;
|
|
128
|
+
onChange: (next: boolean) => void;
|
|
129
|
+
description?: string;
|
|
130
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
131
|
+
span?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/** A boolean checkbox. */
|
|
134
|
+
declare function CheckboxRow({ label, value, onChange, span, description }: CheckboxRowProps): react_jsx_runtime.JSX.Element;
|
|
135
|
+
/** Props for `<TextRow>`. */
|
|
136
|
+
interface TextRowProps {
|
|
137
|
+
label: ReactNode;
|
|
138
|
+
value: string;
|
|
139
|
+
onChange: (next: string) => void;
|
|
140
|
+
placeholder?: string;
|
|
141
|
+
maxLength?: number;
|
|
142
|
+
layout?: PropertyRowLayout;
|
|
143
|
+
description?: string;
|
|
144
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
145
|
+
span?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/** A single-line text input. */
|
|
148
|
+
declare function TextRow({ label, value, onChange, placeholder, maxLength, layout, description, span, }: TextRowProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
/** Props for `<NumberRow>`. */
|
|
150
|
+
interface NumberRowProps {
|
|
151
|
+
label: ReactNode;
|
|
152
|
+
value: number;
|
|
153
|
+
onChange: (next: number) => void;
|
|
154
|
+
min?: number;
|
|
155
|
+
max?: number;
|
|
156
|
+
step?: number;
|
|
157
|
+
placeholder?: string;
|
|
158
|
+
layout?: PropertyRowLayout;
|
|
159
|
+
description?: string;
|
|
160
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
161
|
+
span?: boolean;
|
|
162
|
+
}
|
|
163
|
+
/** A number typed directly. Reach for `<SliderRow>` when the range matters
|
|
164
|
+
* more than the exact value. */
|
|
165
|
+
declare function NumberRow({ label, value, onChange, min, max, step, placeholder, layout, description, span, }: NumberRowProps): react_jsx_runtime.JSX.Element;
|
|
166
|
+
interface PropertyOption<T extends string> {
|
|
167
|
+
value: T;
|
|
168
|
+
label: ReactNode;
|
|
169
|
+
}
|
|
170
|
+
/** Props for `<SelectRow>`. */
|
|
171
|
+
interface SelectRowProps<T extends string> {
|
|
172
|
+
label: ReactNode;
|
|
173
|
+
value: T;
|
|
174
|
+
options: ReadonlyArray<PropertyOption<T>>;
|
|
175
|
+
onChange: (next: T) => void;
|
|
176
|
+
layout?: PropertyRowLayout;
|
|
177
|
+
description?: string;
|
|
178
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
179
|
+
span?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/** A dropdown over a fixed set of choices. Prefer `<ToggleRow>` when there
|
|
182
|
+
* are only two or three and they should all stay visible. */
|
|
183
|
+
declare function SelectRow<T extends string>({ label, value, options, onChange, layout, description, span, }: SelectRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
184
|
+
/** Props for `<ToggleRow>`. */
|
|
185
|
+
interface ToggleRowProps<T extends string> {
|
|
186
|
+
label: ReactNode;
|
|
187
|
+
value: T;
|
|
188
|
+
options: ReadonlyArray<PropertyOption<T>>;
|
|
189
|
+
onChange: (next: T) => void;
|
|
190
|
+
layout?: PropertyRowLayout;
|
|
191
|
+
description?: string;
|
|
192
|
+
/** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
|
|
193
|
+
span?: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** A segmented control: the same choice as a select, with every option
|
|
196
|
+
* visible at once. */
|
|
197
|
+
declare function ToggleRow<T extends string>({ label, value, options, onChange, layout, description, span, }: ToggleRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
198
|
+
|
|
199
|
+
/** How a panel packs its rows into the two-column property grid.
|
|
200
|
+
* - `'auto'`: narrow controls (numbers, checkboxes, dropdowns, colours) sit
|
|
201
|
+
* two per row; the ones that need the width — text, sliders, segmented
|
|
202
|
+
* toggles — span it.
|
|
203
|
+
* - `'pairs'`: every row pairs. A control that needs the full width says so
|
|
204
|
+
* itself, with `<PropertyRow span>`.
|
|
205
|
+
* - `'one-up'`: one control per row, colours excepted.
|
|
206
|
+
*/
|
|
207
|
+
type ControlPack = 'auto' | 'pairs' | 'one-up';
|
|
208
|
+
interface ControlPanelProps<TC extends Record<string, unknown>> {
|
|
209
|
+
/** The instrument's resolved config schema. */
|
|
210
|
+
schema?: ResolvedConfig;
|
|
211
|
+
/** @deprecated Pass `schema`. A field list is adapted into one internally. */
|
|
212
|
+
fields?: ConfigField[];
|
|
213
|
+
config: TC;
|
|
214
|
+
setConfig: (key: keyof TC, value: unknown) => void;
|
|
215
|
+
/**
|
|
216
|
+
* Control overrides and app-defined kinds, PrefsForm-style. Keys are config
|
|
217
|
+
* paths (checked first) or leaf kinds. A renderer returning `null` collapses
|
|
218
|
+
* the row; entries override the built-in rows on collision.
|
|
219
|
+
*/
|
|
220
|
+
renderers?: Record<string, ControlRenderer>;
|
|
221
|
+
/** How rows pack into the two-column grid. Defaults to `'pairs'`. */
|
|
222
|
+
pack?: ControlPack;
|
|
223
|
+
/** Where a row's label sits relative to its control. Defaults to `'block'`
|
|
224
|
+
* — above it, which is what leaves a paired row room for its value. */
|
|
225
|
+
layout?: PropertyRowLayout;
|
|
226
|
+
/** Draw leaves marked `hidden`. */
|
|
227
|
+
showHidden?: boolean;
|
|
228
|
+
className?: string;
|
|
229
|
+
}
|
|
230
|
+
/** Render an instrument's config schema as a stack of controls, each writing
|
|
231
|
+
* back through `setConfig`. Built on the property rows, so a lab's controls
|
|
232
|
+
* are the same aligned, themed rows the rest of the kit uses. */
|
|
233
|
+
declare function ControlPanel<TC extends Record<string, unknown>>({ schema, fields, config, setConfig, renderers, pack, layout, showHidden, className, }: ControlPanelProps<TC>): react_jsx_runtime.JSX.Element;
|
|
234
|
+
|
|
235
|
+
export { CheckboxRow as C, NumberRow as N, PropertyList as P, SelectRow as S, TextRow as T, ColorRow as b, ControlPanel as d, PropertyPanel as i, PropertyRow as k, PropertySpan as o, SliderRow as r, ToggleRow as u };
|
|
236
|
+
export type { CheckboxRowProps as a, ColorRowProps as c, NumberRowProps as e, PropertyListPack as f, PropertyListProps as g, PropertyOption as h, PropertyPanelProps as j, PropertyRowLayout as l, PropertyRowProps as m, PropertyRowVariant as n, PropertySpanProps as p, SelectRowProps as q, SliderRowProps as s, TextRowProps as t, ToggleRowProps as v };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kit's built-in shape kinds — one table, every other spelling derived.
|
|
3
|
+
*
|
|
4
|
+
* Lives in `core/` rather than beside the shape tools because both layers ask
|
|
5
|
+
* questions of the same set: the interactions layer decides whether
|
|
6
|
+
* `insertAction` can paint a live preview for a kind, and the canvas layer
|
|
7
|
+
* decides which shape tools `useBuiltinShapeTools` mounts and what
|
|
8
|
+
* `BUNDLE_TOOLS` / `defaultNodeRouting` / `defaultNodeProperties` enumerate.
|
|
9
|
+
*
|
|
10
|
+
* This module imports nothing on purpose: `useBuiltinShapeTools` imports the
|
|
11
|
+
* package barrel, so anything barrel-reachable that needs these lists at
|
|
12
|
+
* module-evaluation time must not route through it.
|
|
13
|
+
*/
|
|
14
|
+
/** What the kit knows about one built-in shape kind. */
|
|
15
|
+
interface ShapeKindDescriptor {
|
|
16
|
+
/** Mounted as a built-in shape tool by `useBuiltinShapeTools`, and so a
|
|
17
|
+
* member of `BuiltinShapeToolId` / `KIT_SHAPE_KINDS`. `image` is false:
|
|
18
|
+
* `useImageTool` needs a `src` and can't be auto-mounted. */
|
|
19
|
+
readonly tool: boolean;
|
|
20
|
+
/** `insertAction` emits an `insertPreview` overlay for this kind, and the
|
|
21
|
+
* dispatcher overlay layer knows how to draw it. Kinds without one still
|
|
22
|
+
* commit; they just have no live drag preview (`pen` and `lasso` don't
|
|
23
|
+
* route through `insertAction` at all). */
|
|
24
|
+
readonly insertPreview: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Declaration order is the enumeration order of every derived list —
|
|
28
|
+
* `KIT_SHAPE_KINDS`, and through it `defaultNodeRouting` /
|
|
29
|
+
* `defaultNodeProperties` / `BUNDLE_TOOLS.exhaustive`.
|
|
30
|
+
*/
|
|
31
|
+
declare const SHAPE_KINDS: {
|
|
32
|
+
readonly rect: {
|
|
33
|
+
readonly tool: true;
|
|
34
|
+
readonly insertPreview: true;
|
|
35
|
+
};
|
|
36
|
+
readonly ellipse: {
|
|
37
|
+
readonly tool: true;
|
|
38
|
+
readonly insertPreview: true;
|
|
39
|
+
};
|
|
40
|
+
readonly line: {
|
|
41
|
+
readonly tool: true;
|
|
42
|
+
readonly insertPreview: true;
|
|
43
|
+
};
|
|
44
|
+
readonly polygon: {
|
|
45
|
+
readonly tool: true;
|
|
46
|
+
readonly insertPreview: true;
|
|
47
|
+
};
|
|
48
|
+
readonly star: {
|
|
49
|
+
readonly tool: true;
|
|
50
|
+
readonly insertPreview: true;
|
|
51
|
+
};
|
|
52
|
+
readonly pen: {
|
|
53
|
+
readonly tool: true;
|
|
54
|
+
readonly insertPreview: false;
|
|
55
|
+
};
|
|
56
|
+
readonly pencil: {
|
|
57
|
+
readonly tool: true;
|
|
58
|
+
readonly insertPreview: true;
|
|
59
|
+
};
|
|
60
|
+
readonly lasso: {
|
|
61
|
+
readonly tool: true;
|
|
62
|
+
readonly insertPreview: false;
|
|
63
|
+
};
|
|
64
|
+
readonly text: {
|
|
65
|
+
readonly tool: true;
|
|
66
|
+
readonly insertPreview: true;
|
|
67
|
+
};
|
|
68
|
+
readonly image: {
|
|
69
|
+
readonly tool: false;
|
|
70
|
+
readonly insertPreview: true;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/** The keys of a shape-kind table whose descriptor sets `F` to `true`. */
|
|
74
|
+
type ShapeKindsWhere<T, F extends keyof ShapeKindDescriptor> = {
|
|
75
|
+
[K in keyof T]: T[K] extends Record<F, true> ? K : never;
|
|
76
|
+
}[keyof T];
|
|
77
|
+
/**
|
|
78
|
+
* Built-in shape tool ids handled by `useBuiltinShapeTools`. Each maps to a
|
|
79
|
+
* kit tool hook + a default `create` that produces a leaf node compatible
|
|
80
|
+
* with `PATH_PAINTER`.
|
|
81
|
+
*/
|
|
82
|
+
type BuiltinShapeToolId = ShapeKindsWhere<typeof SHAPE_KINDS, 'tool'>;
|
|
83
|
+
/** The insert kinds the kit's dispatcher overlay layer knows how to render.
|
|
84
|
+
* Consumer-defined kinds fall outside it: no live preview, commit unaffected. */
|
|
85
|
+
type KitInsertShape = ShapeKindsWhere<typeof SHAPE_KINDS, 'insertPreview'>;
|
|
86
|
+
|
|
87
|
+
export type { BuiltinShapeToolId as B, KitInsertShape as K };
|