@weasel-js/labkit 1.6.1 → 1.7.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.
Files changed (256) hide show
  1. package/README.md +3 -3
  2. package/dist/_dts/{CanvasStackContext-Wo6OwIVM.d.ts → CanvasStackContext-Cjy6I-Iv.d.ts} +4 -1
  3. package/dist/_dts/{Stage-DWBBi8IU.d.ts → Stage-D6t7o0pF.d.ts} +59 -18
  4. package/dist/_dts/{index-CKyX0ME_.d.ts → index-BTmaRy6a.d.ts} +10 -6
  5. package/dist/_dts/{types-B7yBTTF9.d.ts → index-DCMA4Fy1.d.ts} +59 -113
  6. package/dist/_dts/{types-DTuViBvc.d.ts → types-BUBSIZuV.d.ts} +18 -8
  7. package/dist/_dts/{useTrialState-CMaV6UD4.d.ts → useTrialState-Bh8bzFgE.d.ts} +1 -1
  8. package/dist/canvas/index.d.ts +8 -6
  9. package/dist/canvas/index.js +6 -6
  10. package/dist/chrome/index.d.ts +6 -4
  11. package/dist/chrome/index.js +11 -10
  12. package/dist/chunk-2ES4W47N.js +8 -0
  13. package/dist/chunk-2ES4W47N.js.map +1 -0
  14. package/dist/{chunk-WPLAANH4.js → chunk-2N7UBSS2.js} +12 -12
  15. package/dist/chunk-2N7UBSS2.js.map +1 -0
  16. package/dist/chunk-4KSC7NXL.js +15491 -0
  17. package/dist/chunk-4KSC7NXL.js.map +1 -0
  18. package/dist/{chunk-SLAQPUI4.js → chunk-CEGFXTBD.js} +10 -63
  19. package/dist/chunk-CEGFXTBD.js.map +1 -0
  20. package/dist/chunk-CZZPXUOU.js +3 -0
  21. package/dist/{chunk-SBXNQW4G.js.map → chunk-CZZPXUOU.js.map} +1 -1
  22. package/dist/{chunk-QGMOA2YE.js → chunk-E23Q6A3Y.js} +296 -104
  23. package/dist/chunk-E23Q6A3Y.js.map +1 -0
  24. package/dist/{chunk-GHGO52SO.js → chunk-E6NARGU7.js} +5 -5
  25. package/dist/{chunk-GHGO52SO.js.map → chunk-E6NARGU7.js.map} +1 -1
  26. package/dist/{chunk-IJJUK4FU.js → chunk-EESJUSYR.js} +5 -6
  27. package/dist/chunk-EESJUSYR.js.map +1 -0
  28. package/dist/{chunk-HXXTULDN.js → chunk-EFXRM6XQ.js} +8 -11
  29. package/dist/chunk-EFXRM6XQ.js.map +1 -0
  30. package/dist/chunk-F4ACIK7Z.js +210 -0
  31. package/dist/chunk-F4ACIK7Z.js.map +1 -0
  32. package/dist/{chunk-6FLXL3I7.js → chunk-FB4MIZOO.js} +77 -45
  33. package/dist/chunk-FB4MIZOO.js.map +1 -0
  34. package/dist/{chunk-AWQG7FCC.js → chunk-FG3EXZDV.js} +3 -3
  35. package/dist/{chunk-AWQG7FCC.js.map → chunk-FG3EXZDV.js.map} +1 -1
  36. package/dist/{chunk-4TT3PNPR.js → chunk-GAHELLJT.js} +95 -95
  37. package/dist/chunk-GAHELLJT.js.map +1 -0
  38. package/dist/{chunk-HKV7LRHY.js → chunk-IBVRMHW5.js} +5 -5
  39. package/dist/{chunk-HKV7LRHY.js.map → chunk-IBVRMHW5.js.map} +1 -1
  40. package/dist/{chunk-ASOK76ZH.js → chunk-JFOJESJF.js} +72 -29
  41. package/dist/chunk-JFOJESJF.js.map +1 -0
  42. package/dist/{chunk-RWNDDKOH.js → chunk-PMLZP7RT.js} +18 -15
  43. package/dist/chunk-PMLZP7RT.js.map +1 -0
  44. package/dist/{chunk-TJ77A4A3.js → chunk-READTDQX.js} +5 -9
  45. package/dist/chunk-READTDQX.js.map +1 -0
  46. package/dist/{chunk-JVBYV6TL.js → chunk-ROGJWDQA.js} +3 -3
  47. package/dist/{chunk-JVBYV6TL.js.map → chunk-ROGJWDQA.js.map} +1 -1
  48. package/dist/{chunk-CGHF6RZV.js → chunk-T6DLGEJB.js} +18 -18
  49. package/dist/chunk-T6DLGEJB.js.map +1 -0
  50. package/dist/{chunk-24W5VEJW.js → chunk-ULYYNWGP.js} +2 -2
  51. package/dist/{chunk-24W5VEJW.js.map → chunk-ULYYNWGP.js.map} +1 -1
  52. package/dist/{chunk-DWMSB4CA.js → chunk-VYVGVBGY.js} +95 -32
  53. package/dist/chunk-VYVGVBGY.js.map +1 -0
  54. package/dist/{chunk-IRTGUQ5O.js → chunk-WLMDTI2Q.js} +16 -6
  55. package/dist/chunk-WLMDTI2Q.js.map +1 -0
  56. package/dist/{chunk-NEXR37YJ.js → chunk-XE5HJOPL.js} +6 -8
  57. package/dist/chunk-XE5HJOPL.js.map +1 -0
  58. package/dist/chunk-XVUKDSYV.js +38 -0
  59. package/dist/chunk-XVUKDSYV.js.map +1 -0
  60. package/dist/{chunk-O6FFFOHS.js → chunk-YCFKW5RX.js} +16 -8
  61. package/dist/chunk-YCFKW5RX.js.map +1 -0
  62. package/dist/{chunk-CQLQPQ4P.js → chunk-ZQIHJXP4.js} +2 -2
  63. package/dist/chunk-ZQIHJXP4.js.map +1 -0
  64. package/dist/config/index.d.ts +28 -13
  65. package/dist/config/index.js +4 -4
  66. package/dist/controls/index.d.ts +4 -7
  67. package/dist/controls/index.js +6 -5
  68. package/dist/dragdrop/index.d.ts +23 -3
  69. package/dist/dragdrop/index.js +4 -3
  70. package/dist/fonts/oswald-tabular-digits.woff2 +0 -0
  71. package/dist/index.d.ts +72 -487
  72. package/dist/index.js +603 -441
  73. package/dist/index.js.map +1 -1
  74. package/dist/job/index.d.ts +8 -0
  75. package/dist/job/index.js +1 -1
  76. package/dist/layers/index.d.ts +6 -5
  77. package/dist/layers/index.js +3 -2
  78. package/dist/loupe/index.d.ts +100 -30
  79. package/dist/loupe/index.js +585 -6
  80. package/dist/loupe/index.js.map +1 -1
  81. package/dist/overview/index.d.ts +4 -2
  82. package/dist/overview/index.js +20 -18
  83. package/dist/overview/index.js.map +1 -1
  84. package/dist/passthrough/weasel-canvas.d.ts +2 -0
  85. package/dist/passthrough/weasel-ui.d.ts +2 -2701
  86. package/dist/passthrough/weasel-ui.js +4 -3
  87. package/dist/primitives/index.d.ts +37 -2
  88. package/dist/primitives/index.js +9 -8
  89. package/dist/state/index.d.ts +7 -5
  90. package/dist/state/index.js +6 -6
  91. package/dist/styles.css +150 -126
  92. package/dist/surface/index.d.ts +10 -2
  93. package/dist/surface/index.js +1 -1
  94. package/dist/undo/index.d.ts +5 -3
  95. package/package.json +14 -13
  96. package/src/annotations/AnnotationOverlay.abandon.test.tsx +143 -0
  97. package/src/annotations/AnnotationOverlay.tsx +52 -33
  98. package/src/annotations/Annotations.less +0 -10
  99. package/src/annotations/Annotations.overlay.test.tsx +31 -0
  100. package/src/annotations/MarkList.tsx +4 -8
  101. package/src/annotations/capture.browser.test.ts +41 -0
  102. package/src/annotations/capture.ts +14 -7
  103. package/src/annotations/drawOne.ts +2 -2
  104. package/src/annotations/frac.test.ts +44 -1
  105. package/src/annotations/frac.ts +46 -18
  106. package/src/annotations/index.ts +1 -0
  107. package/src/annotations/paint.test.ts +76 -46
  108. package/src/annotations/paint.ts +65 -43
  109. package/src/annotations/store.test.ts +212 -2
  110. package/src/annotations/store.ts +130 -27
  111. package/src/annotations/svgNodes.test.ts +28 -19
  112. package/src/annotations/svgNodes.ts +6 -6
  113. package/src/annotations/types.ts +29 -10
  114. package/src/canvas/AGENTS.md +1 -0
  115. package/src/canvas/CameraInput.test.tsx +30 -0
  116. package/src/canvas/CameraInput.tsx +60 -48
  117. package/src/canvas/CanvasStack.tsx +11 -6
  118. package/src/canvas/CanvasStackContext.ts +4 -1
  119. package/src/canvas/LinkedCursor.less +1 -1
  120. package/src/canvas/Stage.test.tsx +33 -4
  121. package/src/canvas/Stage.tsx +9 -4
  122. package/src/canvas/cameraRegistry.test.ts +55 -0
  123. package/src/canvas/cameraRegistry.ts +87 -0
  124. package/src/canvas/cameraZoom.test.ts +46 -0
  125. package/src/canvas/cameraZoom.ts +24 -0
  126. package/src/canvas/index.ts +14 -2
  127. package/src/canvas/sharedScope.test.tsx +94 -0
  128. package/src/canvas/worldSpec.ts +3 -1
  129. package/src/chrome/ChromeRegions.stories.tsx +1 -0
  130. package/src/chrome/builtins.test.ts +7 -6
  131. package/src/chrome/builtins.tsx +5 -1
  132. package/src/chrome/index.ts +1 -1
  133. package/src/chrome/merge.test.ts +5 -0
  134. package/src/chrome/merge.ts +4 -2
  135. package/src/chrome/regions/PaletteRegion.less +0 -7
  136. package/src/chrome/regions/PaletteRegion.test.tsx +2 -3
  137. package/src/chrome/regions/PaletteRegion.tsx +3 -4
  138. package/src/chrome/regions/SidebarRegion.less +12 -2
  139. package/src/chrome/regions/ViewportRegion.browser.test.less +6 -0
  140. package/src/chrome/regions/ViewportRegion.browser.test.tsx +38 -0
  141. package/src/chrome/regions/ViewportRegion.less +6 -0
  142. package/src/chrome/regions/ViewportRegion.tsx +10 -4
  143. package/src/chrome/types.ts +4 -2
  144. package/src/config/auto.ts +1 -0
  145. package/src/config/builder.test.ts +2 -1
  146. package/src/config/builder.ts +18 -5
  147. package/src/config/fromConfigField.test.ts +14 -0
  148. package/src/config/fromConfigField.ts +18 -4
  149. package/src/config/path.ts +2 -5
  150. package/src/config/resolve.ts +4 -0
  151. package/src/config/types.ts +14 -9
  152. package/src/controls/ControlPanel.less +1 -1
  153. package/src/controls/ControlPanel.stories.tsx +3 -2
  154. package/src/controls/ControlPanel.test.tsx +98 -11
  155. package/src/controls/ControlPanel.tsx +61 -2
  156. package/src/dragdrop/DragDropRuntime.tsx +22 -13
  157. package/src/dragdrop/DragGhost.tsx +3 -0
  158. package/src/dragdrop/Palette.tsx +2 -0
  159. package/src/index.test.ts +5 -0
  160. package/src/index.ts +16 -2
  161. package/src/instrument/types.ts +0 -6
  162. package/src/job/useJob.ts +14 -9
  163. package/src/lab/Lab.tsx +88 -73
  164. package/src/lab/{LabFit.stories.less → LabFit.browser.test.less} +1 -1
  165. package/src/lab/{LabFit.stories.tsx → LabFit.browser.test.tsx} +41 -63
  166. package/src/lab/LabFullChrome.stories.tsx +1 -0
  167. package/src/lab/LabHeader.test.tsx +24 -14
  168. package/src/lab/LabHeader.tsx +11 -12
  169. package/src/lab/LabShell.less +9 -17
  170. package/src/lab/LabSwitcher.browser.test.tsx +27 -0
  171. package/src/lab/LabSwitcher.less +8 -6
  172. package/src/lab/LabZoom.test.tsx +223 -0
  173. package/src/lab/LabZoom.tsx +170 -0
  174. package/src/lab/Workspace.tsx +48 -52
  175. package/src/lab/index.ts +1 -0
  176. package/src/loupe/AGENTS.md +28 -15
  177. package/src/loupe/CanvasLoupe.tsx +2 -3
  178. package/src/loupe/DomLoupe.tsx +1 -7
  179. package/src/loupe/Loupe.less +16 -0
  180. package/src/loupe/LoupeGestures.tsx +1 -1
  181. package/src/loupe/TrialLoupe.tsx +120 -57
  182. package/src/loupe/index.ts +1 -6
  183. package/src/loupe/types.test.ts +3 -3
  184. package/src/loupe/types.ts +24 -27
  185. package/src/loupe/useLoupe.test.tsx +29 -4
  186. package/src/loupe/useLoupe.ts +20 -17
  187. package/src/overview/OverviewMarks.tsx +12 -4
  188. package/src/overview/TrialOverview.tsx +10 -8
  189. package/src/passthrough/weasel-ui.test.ts +2 -0
  190. package/src/passthrough/weasel-ui.ts +17 -5
  191. package/src/primitives/FloatingPanel.test.tsx +11 -0
  192. package/src/primitives/FloatingPanel.tsx +8 -7
  193. package/src/primitives/JobProgress.less +2 -1
  194. package/src/primitives/Legend.stories.tsx +1 -0
  195. package/src/primitives/Readout.browser.test.tsx +137 -0
  196. package/src/primitives/Readout.less +12 -0
  197. package/src/primitives/Readout.stories.tsx +58 -0
  198. package/src/primitives/Readout.test.tsx +93 -0
  199. package/src/primitives/Readout.tsx +56 -0
  200. package/src/primitives/Split.tsx +69 -41
  201. package/src/primitives/Toolbar.tsx +3 -3
  202. package/src/primitives/ZoomControl.less +1 -2
  203. package/src/primitives/index.ts +2 -0
  204. package/src/specimen/Specimen.stories.tsx +1 -0
  205. package/src/specimen/Specimen.tsx +2 -3
  206. package/src/state/Persistence.browser.test.tsx +47 -0
  207. package/src/state/store.test.ts +5 -1
  208. package/src/state/undock.ts +3 -0
  209. package/src/state/useOpenOnce.ts +20 -16
  210. package/src/state/usePersistedState.test.tsx +1 -1
  211. package/src/state/view.ts +1 -0
  212. package/src/styles.less +1 -0
  213. package/src/surface/index.ts +1 -1
  214. package/src/surface/useTiledSurface.test.tsx +14 -0
  215. package/src/surface/useTiledSurface.ts +11 -3
  216. package/src/theme/Interstellar.stories.tsx +3 -1
  217. package/src/theme/base.less +21 -47
  218. package/src/theme/interstellar.test.ts +1 -1
  219. package/src/theme/interstellar.theme.json +10 -3
  220. package/src/trial/Trial.annotations.test.tsx +73 -0
  221. package/src/trial/Trial.less +0 -29
  222. package/src/trial/Trial.loupe.test.tsx +28 -11
  223. package/src/trial/Trial.tsx +85 -67
  224. package/src/trial/TrialChrome.tsx +27 -6
  225. package/src/trial/index.ts +2 -0
  226. package/src/trial/loupeSwitch.ts +15 -0
  227. package/dist/_dts/LayerList.d-BoELAMsM.d.ts +0 -83
  228. package/dist/_dts/PrefsRow.d-DFpPIeIC.d.ts +0 -39
  229. package/dist/_dts/PropertyField.d-D0ndfIIt.d.ts +0 -404
  230. package/dist/_dts/Select.d-Cr8-zoup.d.ts +0 -569
  231. package/dist/chunk-4TT3PNPR.js.map +0 -1
  232. package/dist/chunk-6FLXL3I7.js.map +0 -1
  233. package/dist/chunk-ASOK76ZH.js.map +0 -1
  234. package/dist/chunk-CGHF6RZV.js.map +0 -1
  235. package/dist/chunk-CQLQPQ4P.js.map +0 -1
  236. package/dist/chunk-DWMSB4CA.js.map +0 -1
  237. package/dist/chunk-HXXTULDN.js.map +0 -1
  238. package/dist/chunk-IJJUK4FU.js.map +0 -1
  239. package/dist/chunk-IRTGUQ5O.js.map +0 -1
  240. package/dist/chunk-KHK5FGER.js +0 -145
  241. package/dist/chunk-KHK5FGER.js.map +0 -1
  242. package/dist/chunk-NEXR37YJ.js.map +0 -1
  243. package/dist/chunk-O6FFFOHS.js.map +0 -1
  244. package/dist/chunk-QGMOA2YE.js.map +0 -1
  245. package/dist/chunk-RWNDDKOH.js.map +0 -1
  246. package/dist/chunk-S4NCI32V.js +0 -549
  247. package/dist/chunk-S4NCI32V.js.map +0 -1
  248. package/dist/chunk-SBXNQW4G.js +0 -3
  249. package/dist/chunk-SLAQPUI4.js.map +0 -1
  250. package/dist/chunk-TJ77A4A3.js.map +0 -1
  251. package/dist/chunk-TYN6MLXX.js +0 -13864
  252. package/dist/chunk-TYN6MLXX.js.map +0 -1
  253. package/dist/chunk-WPLAANH4.js.map +0 -1
  254. package/src/primitives/useRovingTabIndex.test.ts +0 -48
  255. package/src/primitives/useRovingTabIndex.ts +0 -88
  256. package/src/state/Persistence.stories.tsx +0 -75
@@ -1,404 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { ToolPrefNumberFormat, FillStyle, PaintKind } from '@weasel-js/core';
4
- import { S as StanceProps } from './PrefsRow.d-DFpPIeIC.js';
5
-
6
- /**
7
- * Display-formatter for numbers. Use this anywhere a number is shown to
8
- * a user. The whole point: negative values get prefixed with the real
9
- * MINUS SIGN (U+2212) instead of the ASCII HYPHEN-MINUS (U+002D) that
10
- * `toLocaleString` and template literals produce by default.
11
- *
12
- * U+2212 is the same visual width as `+` and reads as a sign rather
13
- * than a hyphen — columns of signed numbers align cleanly and the
14
- * glyph doesn't get confused with a bullet or list dash.
15
- */
16
- declare const MINUS_SIGN = "\u2212";
17
- /**
18
- * Formats a number for display, substituting {@link MINUS_SIGN} for the ASCII
19
- * hyphen `toLocaleString` emits. Non-finite values stringify as-is.
20
- */
21
- declare function formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
22
- /** One unit's conversion into the shown unit: a bare factor, or a scale that
23
- * also moves zero. Structurally the kit's `UnitEntry`, kept local so this
24
- * formatting helper stays free of the scene vocabulary. */
25
- type UnitTableEntry = number | {
26
- factor: number;
27
- offset?: number;
28
- };
29
- /** Suffixes a person may type, each mapped to its conversion. */
30
- type UnitTable = Record<string, UnitTableEntry>;
31
-
32
- /**
33
- * How much room a container gives its rows — gaps, padding, and field height,
34
- * moved together. Set on any container in the family; it reaches every
35
- * descendant, so an inner group can differ from the panel around it.
36
- */
37
- type PropertyDensity = 'tight' | 'normal' | 'roomy';
38
- /** Where an inline row's label and control sit on the row's cross axis. Set on
39
- * a container to line a whole column of them up. */
40
- type PropertyAlign = 'start' | 'center' | 'end' | 'baseline';
41
- /** Metric props every container in the family takes. Both reach descendants,
42
- * so the nearest container that states one wins. */
43
- interface PropertyMetricProps {
44
- /** Room the rows get. Unset inherits from an outer container, else `normal`. */
45
- density?: PropertyDensity;
46
- /**
47
- * Cross-axis alignment of an inline row's label and control. `baseline` sits
48
- * the control on the label's first-line baseline, which is what lines a
49
- * column of swatches up against labels of different heights. Unset keeps each
50
- * variant's own alignment — a color row centers its label and swatch and
51
- * sinks the pair to the row's bottom edge, which keeps a paired alpha track
52
- * level with its neighbour.
53
- */
54
- align?: PropertyAlign;
55
- }
56
- /** Props for `<PropertyPanel>`. */
57
- interface PropertyPanelProps extends PropertyMetricProps, StanceProps {
58
- title?: ReactNode;
59
- /** Controls on the trailing edge of the title row — a switch, a clear
60
- * button. They sit outside the heading, so they neither take its type nor
61
- * join its accessible name. */
62
- actions?: ReactNode;
63
- /**
64
- * Lets text inside the panel be selected and copied. A panel is chrome by
65
- * default, so a drag across it moves a slider rather than painting a
66
- * selection; a `debug` panel defaults to selectable, since what it shows —
67
- * ids, keys, traces — is there to be copied.
68
- */
69
- selectable?: boolean;
70
- children: ReactNode;
71
- className?: string;
72
- }
73
- /**
74
- * A titled panel holding property rows — the sidebar container the rest of
75
- * this module's components fill.
76
- *
77
- * `stance` says what kind of content it holds and `tone` which of its peers it
78
- * is; the theme's `--wzl-panel-*` and `--wzl-stance-*` slots decide how each looks. A stanced
79
- * panel's title takes the row-label recipe rather than the display title.
80
- */
81
- declare function PropertyPanel({ title, actions, selectable, children, className, density, align, stance, tone, }: PropertyPanelProps): react.JSX.Element;
82
- /** How a property list packs its rows into two columns. */
83
- type PropertyListPack = 'auto-color' | 'pairs' | 'one-up';
84
- /** Props for `<PropertyList>`. */
85
- interface PropertyListProps extends PropertyMetricProps {
86
- children: ReactNode;
87
- className?: string;
88
- /**
89
- * How rows pack into the 2-column grid.
90
- * - `'auto-color'` (default): only color rows pair side-by-side; everything
91
- * else spans the full width. Right for sparse top-level panels.
92
- * - `'pairs'`: every row auto-places into the 2-column grid two-per-row.
93
- * Headers and subpanels still span the full width; wrap any other
94
- * full-width child in `<PropertySpan>`. Right for dense effect bodies.
95
- * - `'one-up'`: every row spans the full width, color rows included. Right
96
- * for a palette — a column of swatches read as a group.
97
- */
98
- pack?: PropertyListPack;
99
- }
100
- /**
101
- * Grid container for PropertyRows. Use standalone for chrome-less layouts, or
102
- * nest inside <PropertyPanel/> for the standard glass card.
103
- */
104
- declare const PropertyList: react.ForwardRefExoticComponent<PropertyListProps & react.RefAttributes<HTMLDivElement>>;
105
- /** Props for `<PropertySpan>`. */
106
- interface PropertySpanProps {
107
- children: ReactNode;
108
- className?: string;
109
- }
110
- /**
111
- * Wrapper that makes an arbitrary child span both columns of a
112
- * `<PropertyList pack="pairs">`, a `<PropertyGroup pack="pairs">` body, or a
113
- * `<Subpanel>`. `<PropertyRow span>` covers the row case; this covers
114
- * everything else a consumer puts in the grid.
115
- */
116
- declare function PropertySpan({ children, className }: PropertySpanProps): react.JSX.Element;
117
- /** Which control shape a row holds, which decides its intrinsic layout. */
118
- type PropertyRowVariant = 'default' | 'color' | 'checkbox';
119
- /** Whether a row's label sits above its control or beside it. */
120
- type PropertyRowLayout = 'block' | 'inline';
121
- /** Props for `<PropertyRow>`. */
122
- interface PropertyRowProps extends PropertyMetricProps {
123
- label: ReactNode;
124
- /** Right-aligned readout shown next to the label (e.g. current value). */
125
- readout?: ReactNode;
126
- /**
127
- * Help text for the row, shown in a tooltip off an ⓘ affordance beside the
128
- * label. Empty or absent renders no affordance.
129
- */
130
- description?: string;
131
- variant?: PropertyRowVariant;
132
- /**
133
- * Label position relative to the control. Unset takes the variant's own
134
- * orientation: `block` — label above control — for the default variant, and
135
- * `inline` for the color and checkbox variants, which read as a row.
136
- */
137
- layout?: PropertyRowLayout;
138
- /**
139
- * Take the full width of the enclosing grid. Only has an effect inside a
140
- * `<PropertyList pack="pairs">` or a `<Subpanel>`; elsewhere rows are already
141
- * full width.
142
- */
143
- span?: boolean;
144
- children: ReactNode;
145
- htmlFor?: string;
146
- /** The control is a group of several (a segmented toggle), not one element.
147
- * The row then renders as a `<div>`: a `<label>` hands a click on its text to
148
- * its first control, which in a group means selecting the first option. Each
149
- * member has to carry its own name. */
150
- group?: boolean;
151
- className?: string;
152
- /** The row is auto: its value is not pinned and the owner computes it. The
153
- * control is hidden — its box kept, so the row does not resize — and the
154
- * row reads out the word instead. */
155
- auto?: boolean;
156
- /** Given, the row's label toggles `auto` when it is clicked. Omitted, the row
157
- * can show an auto state but not change it.
158
- *
159
- * The label then names that toggle, so a control passed as `children` has to
160
- * carry its own accessible name — every `<PropertyField>` does. */
161
- onAutoChange?: (next: boolean) => void;
162
- /**
163
- * What draws the row's control. `bare` (the default) is a native input the
164
- * row's stylesheet dresses; `framed` is a kit field bringing its own frame,
165
- * which the row then leaves alone — see {@link PropertyFieldChrome}.
166
- */
167
- chrome?: PropertyFieldChrome;
168
- }
169
- /** The label-plus-control frame `<PropertyField>` draws its rows in. Use it
170
- * directly for a control no field kind covers. */
171
- declare function PropertyRow({ label, readout, description, variant, layout, span, children, htmlFor, group, className, density, align, auto, onAutoChange, chrome, }: PropertyRowProps): react.JSX.Element;
172
-
173
- /**
174
- * Which controls a field is drawn with.
175
- *
176
- * - `'bare'` (the default): native inputs the property row's own stylesheet
177
- * draws — the compact controls of an inspector sidebar or a lab panel.
178
- * - `'framed'`: the kit's field components, each bringing its own frame —
179
- * for a surface whose row does not style its controls (`SelectionPanel`,
180
- * `ToolOptionsBar`), or that needs what only they do, such as reading a
181
- * unit typed into a number (`accepts`).
182
- *
183
- * The two differ only where the kit still has two widgets for one job; a
184
- * slider, a switch, a font picker and a paint are the same in both.
185
- */
186
- type PropertyFieldChrome = 'bare' | 'framed';
187
- /** One choice of an enum field. */
188
- interface PropertyOption<T extends string> {
189
- value: T;
190
- /** The option's name. A string also names its segment for a screen reader. */
191
- label: ReactNode;
192
- /** What a segment shows in place of `label` when the full one would not fit
193
- * — a glyph or a letter. `label` stays the accessible name. */
194
- glyph?: ReactNode;
195
- /** Shown but not choosable: a value the control reports and cannot author. */
196
- disabled?: boolean;
197
- }
198
- /** Props every kind of field shares. */
199
- interface FieldBase {
200
- /** The control's accessible name. A `<PropertyField>` takes it from a string
201
- * `label` when this is omitted. */
202
- name?: string;
203
- /** The sources the field reads disagree — a multi-selection whose nodes
204
- * differ. The control shows no value, in whatever form it has for that. */
205
- mixed?: boolean;
206
- /**
207
- * The sources agree on holding nothing: whatever is in effect comes from a
208
- * fallback further down. The control shows no chosen value rather than
209
- * inventing one, since the next edit would write the invention back.
210
- */
211
- unset?: boolean;
212
- chrome?: PropertyFieldChrome;
213
- /** Class on the control element itself. */
214
- className?: string;
215
- /** Id for the control element, for a `<label htmlFor>` outside it. */
216
- id?: string;
217
- }
218
- /** A boolean field. */
219
- interface PropertyBooleanFieldProps extends FieldBase {
220
- kind: 'boolean';
221
- /** `checkbox` (default), `switch`, or `toggle` — a one-segment pressable bar. */
222
- control?: 'checkbox' | 'switch' | 'toggle';
223
- /** Absent reads as off. */
224
- value: boolean | undefined;
225
- onChange: (next: boolean) => void;
226
- /** A `toggle`'s segment content. Defaults to the first letter of `name`. */
227
- glyph?: ReactNode;
228
- }
229
- /** A number field. */
230
- interface PropertyNumberFieldProps extends FieldBase {
231
- kind: 'number';
232
- /** `input` (default) for a typed number; `slider` for a track with an
233
- * editable readout, where the range matters more than the exact value. */
234
- control?: 'input' | 'slider';
235
- /** Absent reads as an empty field. */
236
- value: number | null | undefined;
237
- /**
238
- * The committed value. Given `onInput` as well, it fires once a drag ends,
239
- * or on blur or Enter in a typed field; on its own it fires on every move
240
- * and keystroke. A `framed` typed field commits only on blur or Enter,
241
- * whichever callbacks it has.
242
- */
243
- onChange: (next: number) => void;
244
- /** The live value, fired continuously. Pass it alongside `onChange` when the
245
- * write is expensive — cheap state here, the costly work there. */
246
- onInput?: (next: number) => void;
247
- /** A slider's track runs 0..100 where these are omitted. */
248
- min?: number;
249
- max?: number;
250
- step?: number;
251
- /**
252
- * Suffix after the value. A string becomes a dim word unit (`px`); pass JSX
253
- * like `<sup>°</sup>` for a symbol. Display only — the value stays a number.
254
- */
255
- unit?: ReactNode;
256
- /** Units a person may type into a `framed` field, each mapped to the factor
257
- * that turns it into the unit shown: `{ mm: 0.1, cm: 1 }`. */
258
- accepts?: Readonly<UnitTable>;
259
- /** A slider readout's display. Defaults to the value at `step`'s precision. */
260
- format?: (value: number) => ReactNode;
261
- /** A named display for the value: `compact` reads `2.00M`. `format` wins. */
262
- notation?: ToolPrefNumberFormat;
263
- placeholder?: string;
264
- /** A `framed` unitless field's stepper buttons. Default `true`. */
265
- steppers?: boolean;
266
- }
267
- /** A text field. */
268
- interface PropertyStringFieldProps extends FieldBase {
269
- kind: 'string';
270
- control?: 'input' | 'textarea';
271
- /** Absent reads as an empty field. */
272
- value: string | null | undefined;
273
- /**
274
- * The committed text. On its own it fires on every keystroke. Given
275
- * `onInput` as well, the field drafts: `onInput` gets each keystroke and
276
- * this fires once, on blur or Enter, and only if the text changed.
277
- */
278
- onChange: (next: string) => void;
279
- onInput?: (next: string) => void;
280
- placeholder?: string;
281
- maxLength?: number;
282
- }
283
- /** A choice among fixed options. */
284
- interface PropertyEnumFieldProps<T extends string = string> extends FieldBase {
285
- kind: 'enum';
286
- /**
287
- * `select` (default) is a dropdown. `radio` and `toggle` show every option
288
- * at once — a radio group chooses, and a toggle is a row of pressable
289
- * segments. Drawn `bare`, both are segments.
290
- */
291
- control?: 'select' | 'radio' | 'toggle';
292
- /** Absent, or not one of `options`, chooses nothing. */
293
- value: T | undefined;
294
- options: ReadonlyArray<PropertyOption<T>>;
295
- onChange: (next: T) => void;
296
- /** Shown while no option is chosen. Defaults to "Choose option…". */
297
- placeholder?: string;
298
- }
299
- /** A single color. */
300
- interface PropertyColorFieldProps extends FieldBase {
301
- kind: 'color';
302
- /** `#rrggbb`, or `#rrggbbaa` when `alpha` is `true`. */
303
- value: string | undefined;
304
- /**
305
- * The committed color. `bare`: given `onInput` as well, it fires once the
306
- * picker closes; on its own it fires on every move. `framed`: it fires once
307
- * per gesture, whichever callbacks it has.
308
- */
309
- onChange: (next: string) => void;
310
- onInput?: (next: string) => void;
311
- /**
312
- * Offer an opacity track. `true` keeps the alpha in `value` as `#rrggbbaa`;
313
- * a number is the 0..1 alpha held apart from it, reported through
314
- * `onAlphaChange` / `onAlphaInput`.
315
- */
316
- alpha?: boolean | number;
317
- onAlphaChange?: (next: number) => void;
318
- onAlphaInput?: (next: number) => void;
319
- /** Draw the opacity track inert, for a consumer that drops alpha. */
320
- alphaDisabled?: boolean;
321
- }
322
- /** A whole paint: a solid, a gradient, a pattern, or none. */
323
- interface PropertyPaintFieldProps extends FieldBase {
324
- kind: 'paint';
325
- /** `swatch` (default) opens the editor in a popover, for a narrow slot;
326
- * `inline` draws the kind bar and its editor in place. */
327
- control?: 'swatch' | 'inline';
328
- /** `null` is an explicit "no paint"; `undefined` is nothing to show. */
329
- value: FillStyle | null | undefined;
330
- onChange: (next: FillStyle | null) => void;
331
- onInput?: (next: FillStyle | null) => void;
332
- /** Offer "None". Default `true`. */
333
- allowNone?: boolean;
334
- /** Restrict the kinds offered. Default: every registered kind. */
335
- kinds?: readonly PaintKind[];
336
- }
337
- /** A font family, picked from the live font registry. */
338
- interface PropertyFontFamilyFieldProps extends FieldBase {
339
- kind: 'font-family';
340
- value: string | undefined;
341
- onChange: (next: string) => void;
342
- /** The weight and slant the family is drawn at, so the picker names the
343
- * variant that will actually paint. */
344
- weight?: number;
345
- fontStyle?: 'normal' | 'italic';
346
- }
347
- /**
348
- * One field for {@link PropertyControl} and {@link PropertyField}, keyed by
349
- * `kind`.
350
- */
351
- type PropertyControlProps<T extends string = string> = PropertyBooleanFieldProps | PropertyNumberFieldProps | PropertyStringFieldProps | PropertyEnumFieldProps<T> | PropertyColorFieldProps | PropertyPaintFieldProps | PropertyFontFamilyFieldProps;
352
- /** Row props {@link PropertyField} adds to the field it draws. */
353
- interface PropertyFieldRowProps extends PropertyMetricProps {
354
- label: ReactNode;
355
- /**
356
- * Text beside the label. On a slider it replaces the editable readout —
357
- * use it when the row is not showing a number a caller could type back,
358
- * such as an auto row's `auto`.
359
- */
360
- readout?: ReactNode;
361
- description?: string;
362
- layout?: PropertyRowLayout;
363
- /** Take the full width of the enclosing grid — see `<PropertyRow span>`. */
364
- span?: boolean;
365
- /** The row is auto — see `<PropertyRow auto>`. */
366
- auto?: boolean;
367
- /** Toggles `auto` from the row's label — see `<PropertyRow onAutoChange>`. */
368
- onAutoChange?: (next: boolean) => void;
369
- /** Class on the row. `controlClassName` reaches the control. */
370
- rowClassName?: string;
371
- controlClassName?: string;
372
- }
373
- /** Props for {@link PropertyField}: one field, and the row around it. */
374
- type PropertyFieldProps<T extends string = string> = PropertyFieldRowProps & DistributiveOmit<PropertyControlProps<T>, 'className' | 'id'>;
375
- type DistributiveOmit<U, K extends PropertyKey> = U extends unknown ? Omit<U, K> : never;
376
- /**
377
- * A labeled settings row for one field, its control chosen by `kind` (and
378
- * `control`): `<PropertyField kind="number" control="slider" label="Blur" …>`.
379
- *
380
- * The row is a {@link PropertyRow}; the control is the one
381
- * {@link PropertyControl} draws for the same props. Every schema-driven
382
- * settings surface in the kit — `ControlPanel`, `PrefsForm`, `SelectionPanel`
383
- * — draws its built-in kinds through that one mapping, so a kind's control
384
- * is decided once.
385
- *
386
- * Callbacks follow the field's shape: a discrete control (a box, a choice)
387
- * reports each pick; a continuous or typed one reports every change through
388
- * `onChange` alone, or splits them into live `onInput` and settled
389
- * `onChange` when given both. `mixed` and `unset` show a field whose sources
390
- * disagree, or agree on holding nothing.
391
- */
392
- declare function PropertyField<T extends string = string>(props: PropertyFieldProps<T>): react.JSX.Element;
393
- /**
394
- * The control for one field, with no row around it — for a cell that shares
395
- * a row with others, or a surface that draws its own row. Keyed by `kind`
396
- * (and `control`), the same mapping {@link PropertyField} draws.
397
- *
398
- * A slider brings its readout beside the track. Several elements come back
399
- * as siblings rather than wrapped, so the surrounding row lays them out.
400
- */
401
- declare function PropertyControl<T extends string = string>(typed: PropertyControlProps<T>): react.JSX.Element;
402
-
403
- export { MINUS_SIGN as M, PropertyControl as b, PropertyField as d, PropertyList as f, PropertyPanel as i, PropertyRow as k, PropertySpan as o, formatNumber as s };
404
- export type { PropertyMetricProps as P, PropertyListPack as a, PropertyControlProps as c, PropertyFieldProps as e, PropertyListProps as g, PropertyOption as h, PropertyPanelProps as j, PropertyRowLayout as l, PropertyRowProps as m, PropertyRowVariant as n, PropertySpanProps as p, PropertyAlign as q, PropertyDensity as r };