strata-react 1.3.25 → 1.3.26

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 (255) hide show
  1. package/UPGRADING.md +4 -0
  2. package/dist/{api-types/cli.d.ts → api-types-cli.d.ts} +1 -0
  3. package/dist/api-types-cli.js +4 -3
  4. package/dist/api-types-cli.js.map +1 -1
  5. package/dist/{api-types/generate.d.ts → api-types.d.ts} +3 -3
  6. package/dist/api-types.js +3 -1
  7. package/dist/{button-KGJI6jQr.js → button-CYXjU-fs.js} +8 -5
  8. package/dist/button-CYXjU-fs.js.map +1 -0
  9. package/dist/{cursor-DDGBPiTJ.js → cursor-Cwyvgwsw.js} +9 -7
  10. package/dist/cursor-Cwyvgwsw.js.map +1 -0
  11. package/dist/{errors-BUvY1Z4d.js → errors-CmuwcWlb.js} +6 -6
  12. package/dist/{errors-BUvY1Z4d.js.map → errors-CmuwcWlb.js.map} +1 -1
  13. package/dist/{field-BjeE_FeB.js → field-DBCsFIng.js} +27 -23
  14. package/dist/field-DBCsFIng.js.map +1 -0
  15. package/dist/{follow-BTPs49FP.js → follow-CXQsL86O.js} +2 -2
  16. package/dist/follow-CXQsL86O.js.map +1 -0
  17. package/dist/{generate-CjTHKJ39.js → generate-BkWhh4k4.js} +8 -6
  18. package/dist/generate-BkWhh4k4.js.map +1 -0
  19. package/dist/{lib/geo.d.ts → geo-DfKa9JtK.d.ts} +35 -33
  20. package/dist/{hls/index.d.ts → hls.d.ts} +13 -12
  21. package/dist/hls.js +5 -4
  22. package/dist/hls.js.map +1 -1
  23. package/dist/index.d.ts +5300 -142
  24. package/dist/index.js +363 -226
  25. package/dist/index.js.map +1 -1
  26. package/dist/map.d.ts +184 -0
  27. package/dist/map.js +21 -17
  28. package/dist/map.js.map +1 -1
  29. package/dist/media-player-BETa3P7K.d.ts +758 -0
  30. package/dist/{microphone-Bo3WaXgD.js → microphone-76skMt6i.js} +41 -30
  31. package/dist/microphone-76skMt6i.js.map +1 -0
  32. package/dist/microphone-DDOnQHxf.d.ts +237 -0
  33. package/dist/{migrate/cli.d.ts → migrate-cli.d.ts} +1 -0
  34. package/dist/migrate-cli.js +8 -6
  35. package/dist/migrate-cli.js.map +1 -1
  36. package/dist/panorama.d.ts +102 -0
  37. package/dist/panorama.js +18 -15
  38. package/dist/panorama.js.map +1 -1
  39. package/dist/{run-BT2WKzMz.js → run-D_Ic1jE7.js} +23 -16
  40. package/dist/run-D_Ic1jE7.js.map +1 -0
  41. package/dist/scene.d.ts +147 -0
  42. package/dist/scene.js +15 -13
  43. package/dist/scene.js.map +1 -1
  44. package/dist/testing.d.ts +468 -0
  45. package/dist/testing.js +11 -3
  46. package/dist/testing.js.map +1 -1
  47. package/dist/{theme-CxYZkUNk.js → theme-1oOSMj_D.js} +19 -17
  48. package/dist/theme-1oOSMj_D.js.map +1 -0
  49. package/dist/{tooltip-DhqrDtyu.js → tooltip-BosfsWYh.js} +9 -6
  50. package/dist/tooltip-BosfsWYh.js.map +1 -0
  51. package/dist/types-B3TsF0Ey.d.ts +241 -0
  52. package/dist/{value-controls-Dm_EYfZW.js → value-controls-5u7sD_wG.js} +22 -17
  53. package/dist/value-controls-5u7sD_wG.js.map +1 -0
  54. package/dist/{viewer-input-CHU0Hx4A.js → viewer-input-3Qa-o35k.js} +3 -2
  55. package/dist/{viewer-input-CHU0Hx4A.js.map → viewer-input-3Qa-o35k.js.map} +1 -1
  56. package/dist/{visual/cli.d.ts → visual-cli.d.ts} +2 -1
  57. package/dist/visual-cli.js +5 -4
  58. package/dist/visual-cli.js.map +1 -1
  59. package/dist/visual.d.ts +105 -0
  60. package/dist/visual.js +4 -3
  61. package/dist/visual.js.map +1 -1
  62. package/package.json +24 -19
  63. package/dist/api-types/index.d.ts +0 -1
  64. package/dist/button-KGJI6jQr.js.map +0 -1
  65. package/dist/components/active-list.d.ts +0 -46
  66. package/dist/components/alert.d.ts +0 -17
  67. package/dist/components/app-shell.d.ts +0 -32
  68. package/dist/components/async-button.d.ts +0 -48
  69. package/dist/components/auto-recorder.d.ts +0 -67
  70. package/dist/components/book-viewer.d.ts +0 -50
  71. package/dist/components/box-overlay.d.ts +0 -44
  72. package/dist/components/boxed-picture.d.ts +0 -34
  73. package/dist/components/button.d.ts +0 -45
  74. package/dist/components/byte-view.d.ts +0 -32
  75. package/dist/components/checkbox.d.ts +0 -39
  76. package/dist/components/choice-grid.d.ts +0 -42
  77. package/dist/components/commands.d.ts +0 -104
  78. package/dist/components/compare-audio.d.ts +0 -30
  79. package/dist/components/compare-grid.d.ts +0 -24
  80. package/dist/components/compare-parts.d.ts +0 -90
  81. package/dist/components/compare-regions.d.ts +0 -37
  82. package/dist/components/compare-text.d.ts +0 -32
  83. package/dist/components/compare-video-grid.d.ts +0 -52
  84. package/dist/components/compare-video.d.ts +0 -61
  85. package/dist/components/compare.d.ts +0 -90
  86. package/dist/components/composition.d.ts +0 -44
  87. package/dist/components/console.d.ts +0 -34
  88. package/dist/components/conversation.d.ts +0 -83
  89. package/dist/components/cursor.d.ts +0 -44
  90. package/dist/components/data-table.d.ts +0 -89
  91. package/dist/components/data-view.d.ts +0 -66
  92. package/dist/components/density.d.ts +0 -16
  93. package/dist/components/dialog.d.ts +0 -45
  94. package/dist/components/difference.d.ts +0 -19
  95. package/dist/components/disclosure.d.ts +0 -49
  96. package/dist/components/done.d.ts +0 -14
  97. package/dist/components/drag-source.d.ts +0 -29
  98. package/dist/components/field.d.ts +0 -79
  99. package/dist/components/file-intake.d.ts +0 -60
  100. package/dist/components/film-strip.d.ts +0 -35
  101. package/dist/components/folder-picker.d.ts +0 -59
  102. package/dist/components/fullscreen-frame.d.ts +0 -18
  103. package/dist/components/history.d.ts +0 -61
  104. package/dist/components/hotkeys.d.ts +0 -44
  105. package/dist/components/infinite-list.d.ts +0 -77
  106. package/dist/components/inspector.d.ts +0 -66
  107. package/dist/components/job-action.d.ts +0 -30
  108. package/dist/components/job-status.d.ts +0 -55
  109. package/dist/components/jobs-table.d.ts +0 -35
  110. package/dist/components/key-glyphs.d.ts +0 -5
  111. package/dist/components/key-owner.d.ts +0 -11
  112. package/dist/components/lightbox.d.ts +0 -61
  113. package/dist/components/line-chart.d.ts +0 -169
  114. package/dist/components/link-card.d.ts +0 -32
  115. package/dist/components/link.d.ts +0 -54
  116. package/dist/components/markable-text.d.ts +0 -60
  117. package/dist/components/media-contents.d.ts +0 -28
  118. package/dist/components/media-group.d.ts +0 -32
  119. package/dist/components/media-player.d.ts +0 -251
  120. package/dist/components/media-progress.d.ts +0 -17
  121. package/dist/components/media-skip.d.ts +0 -31
  122. package/dist/components/media-spans.d.ts +0 -93
  123. package/dist/components/media.d.ts +0 -133
  124. package/dist/components/meter.d.ts +0 -32
  125. package/dist/components/metric.d.ts +0 -17
  126. package/dist/components/outbox-status.d.ts +0 -10
  127. package/dist/components/page-header.d.ts +0 -14
  128. package/dist/components/pair-vote.d.ts +0 -70
  129. package/dist/components/pause-button.d.ts +0 -7
  130. package/dist/components/pixel-image.d.ts +0 -29
  131. package/dist/components/place-board.d.ts +0 -39
  132. package/dist/components/player-warning.d.ts +0 -24
  133. package/dist/components/popover.d.ts +0 -20
  134. package/dist/components/recorder.d.ts +0 -73
  135. package/dist/components/region-editor.d.ts +0 -67
  136. package/dist/components/save.d.ts +0 -46
  137. package/dist/components/say-again.d.ts +0 -13
  138. package/dist/components/schedule-table.d.ts +0 -24
  139. package/dist/components/secret-field.d.ts +0 -34
  140. package/dist/components/selectable-grid.d.ts +0 -57
  141. package/dist/components/selection.d.ts +0 -104
  142. package/dist/components/sequence-timeline.d.ts +0 -50
  143. package/dist/components/shortcut-editor.d.ts +0 -44
  144. package/dist/components/sortable-list.d.ts +0 -39
  145. package/dist/components/status.d.ts +0 -9
  146. package/dist/components/switch.d.ts +0 -15
  147. package/dist/components/system-panel.d.ts +0 -58
  148. package/dist/components/tabs.d.ts +0 -16
  149. package/dist/components/theme.d.ts +0 -106
  150. package/dist/components/thumbnail.d.ts +0 -50
  151. package/dist/components/tile-grid.d.ts +0 -67
  152. package/dist/components/timeline-player.d.ts +0 -18
  153. package/dist/components/timeline.d.ts +0 -115
  154. package/dist/components/toast.d.ts +0 -36
  155. package/dist/components/toggle.d.ts +0 -51
  156. package/dist/components/toolbar.d.ts +0 -15
  157. package/dist/components/tooltip.d.ts +0 -19
  158. package/dist/components/transcript-view.d.ts +0 -63
  159. package/dist/components/tree.d.ts +0 -74
  160. package/dist/components/undo.d.ts +0 -63
  161. package/dist/components/use-timeline.d.ts +0 -44
  162. package/dist/components/value-controls.d.ts +0 -91
  163. package/dist/components/video-clock.d.ts +0 -68
  164. package/dist/components/view-options.d.ts +0 -105
  165. package/dist/components/viewport.d.ts +0 -85
  166. package/dist/components/virtual-list.d.ts +0 -19
  167. package/dist/components/waveform.d.ts +0 -71
  168. package/dist/components/workflow-steps.d.ts +0 -71
  169. package/dist/components/workspace.d.ts +0 -83
  170. package/dist/cursor-DDGBPiTJ.js.map +0 -1
  171. package/dist/field-BjeE_FeB.js.map +0 -1
  172. package/dist/follow-BTPs49FP.js.map +0 -1
  173. package/dist/generate-CjTHKJ39.js.map +0 -1
  174. package/dist/lib/base.d.ts +0 -10
  175. package/dist/lib/book.d.ts +0 -25
  176. package/dist/lib/boxes.d.ts +0 -55
  177. package/dist/lib/breakpoint.d.ts +0 -4
  178. package/dist/lib/choice.d.ts +0 -29
  179. package/dist/lib/chords.d.ts +0 -20
  180. package/dist/lib/client-work.d.ts +0 -24
  181. package/dist/lib/control.d.ts +0 -4
  182. package/dist/lib/dev.d.ts +0 -2
  183. package/dist/lib/errors.d.ts +0 -43
  184. package/dist/lib/file-intake.d.ts +0 -60
  185. package/dist/lib/follow.d.ts +0 -18
  186. package/dist/lib/format.d.ts +0 -243
  187. package/dist/lib/grouped-grid-layout.d.ts +0 -44
  188. package/dist/lib/icon.d.ts +0 -6
  189. package/dist/lib/image-diff.d.ts +0 -30
  190. package/dist/lib/in-view.d.ts +0 -21
  191. package/dist/lib/loudness.d.ts +0 -18
  192. package/dist/lib/marks.d.ts +0 -6
  193. package/dist/lib/microphone.d.ts +0 -24
  194. package/dist/lib/number-input.d.ts +0 -4
  195. package/dist/lib/object-url.d.ts +0 -2
  196. package/dist/lib/overlay.d.ts +0 -1
  197. package/dist/lib/recording.d.ts +0 -16
  198. package/dist/lib/region.d.ts +0 -64
  199. package/dist/lib/rich-text.d.ts +0 -44
  200. package/dist/lib/search-param.d.ts +0 -16
  201. package/dist/lib/segmenter.d.ts +0 -40
  202. package/dist/lib/sequence.d.ts +0 -34
  203. package/dist/lib/speech.d.ts +0 -53
  204. package/dist/lib/text-diff.d.ts +0 -16
  205. package/dist/lib/timeline.d.ts +0 -14
  206. package/dist/lib/transcript.d.ts +0 -53
  207. package/dist/lib/utils.d.ts +0 -4
  208. package/dist/lib/viewer-input.d.ts +0 -29
  209. package/dist/lib/viewport.d.ts +0 -55
  210. package/dist/lib/waveform.d.ts +0 -46
  211. package/dist/map/fan.d.ts +0 -15
  212. package/dist/map/index.d.ts +0 -3
  213. package/dist/map/map-styles.d.ts +0 -2
  214. package/dist/map/markers.d.ts +0 -60
  215. package/dist/map/route-map.d.ts +0 -146
  216. package/dist/microphone-Bo3WaXgD.js.map +0 -1
  217. package/dist/migrate/stock-classes.d.ts +0 -11
  218. package/dist/panorama/gl.d.ts +0 -16
  219. package/dist/panorama/index.d.ts +0 -2
  220. package/dist/panorama/panorama-viewer.d.ts +0 -56
  221. package/dist/panorama/projection.d.ts +0 -45
  222. package/dist/query/api.d.ts +0 -23
  223. package/dist/query/clips.d.ts +0 -48
  224. package/dist/query/index.d.ts +0 -55
  225. package/dist/query/infinite.d.ts +0 -60
  226. package/dist/query/job.d.ts +0 -26
  227. package/dist/query/outbox.d.ts +0 -85
  228. package/dist/query/poll.d.ts +0 -24
  229. package/dist/query/reserve.d.ts +0 -33
  230. package/dist/query/typed-api.d.ts +0 -84
  231. package/dist/query/workflow.d.ts +0 -17
  232. package/dist/run-BT2WKzMz.js.map +0 -1
  233. package/dist/scene/camera.d.ts +0 -99
  234. package/dist/scene/index.d.ts +0 -2
  235. package/dist/scene/scene-viewport.d.ts +0 -48
  236. package/dist/testing/buttons.d.ts +0 -7
  237. package/dist/testing/index.d.ts +0 -161
  238. package/dist/testing/intersection-observer.d.ts +0 -34
  239. package/dist/testing/layout.d.ts +0 -13
  240. package/dist/testing/microphone.d.ts +0 -35
  241. package/dist/testing/setup.d.ts +0 -14
  242. package/dist/testing/speech.d.ts +0 -38
  243. package/dist/testing/storage.d.ts +0 -7
  244. package/dist/theme-CxYZkUNk.js.map +0 -1
  245. package/dist/tooltip-DhqrDtyu.js.map +0 -1
  246. package/dist/value-controls-Dm_EYfZW.js.map +0 -1
  247. package/dist/visual/capture.d.ts +0 -37
  248. package/dist/visual/compare.d.ts +0 -46
  249. package/dist/visual/drop.d.ts +0 -19
  250. package/dist/visual/fonts.d.ts +0 -18
  251. package/dist/visual/index.d.ts +0 -19
  252. package/dist/visual/run.d.ts +0 -22
  253. package/dist/visual/serve.d.ts +0 -13
  254. package/dist/visual/targets.d.ts +0 -17
  255. package/dist/visual/types.d.ts +0 -188
@@ -1,99 +0,0 @@
1
- /** Where the eye is and what it looks at. */
2
- export type OrbitCamera = {
3
- /** The point looked at (orbit) or the eye itself (fly, `distance` 0). */
4
- target: readonly [number, number, number];
5
- /** How far the eye is from `target`. 0 is a fly camera. */
6
- distance: number;
7
- /** Degrees; positive turns right. */
8
- yaw: number;
9
- /** Degrees; positive looks up. */
10
- pitch: number;
11
- };
12
- /** Everything a draw needs, from a camera and a box. */
13
- export type SceneFrame = {
14
- camera: OrbitCamera;
15
- /** The eye's place. */
16
- eye: [number, number, number];
17
- /** Unit vectors: where the camera looks, its right, and its up. */
18
- forward: [number, number, number];
19
- right: [number, number, number];
20
- up: [number, number, number];
21
- /** World to eye space. */
22
- view: Float32Array;
23
- projection: Float32Array;
24
- /** `projection × view`: one uniform for the usual vertex shader. */
25
- viewProjection: Float32Array;
26
- /** The drawing buffer's size in device pixels; `gl.viewport` is already set to it. */
27
- width: number;
28
- height: number;
29
- /** Counts up each time a GL context is made (the first, and each one restored after a loss): when it changes, recreate buffers, textures and programs. */
30
- context: number;
31
- /** The scene's time in seconds when the viewport was given a `time` (a `useTimeline` clock's; issue #386), else 0: draw the scene as it is at this moment. */
32
- time: number;
33
- };
34
- /** The limits a camera is held to. */
35
- export type CameraLimits = {
36
- minDistance: number;
37
- maxDistance: number;
38
- maxPitch: number;
39
- };
40
- export declare const DEFAULT_LIMITS: CameraLimits;
41
- /** Keeps a camera inside its limits and its yaw in -180 to 180. */
42
- export declare function clampCamera(c: OrbitCamera, limits?: Partial<CameraLimits>): OrbitCamera;
43
- type Vec3 = [number, number, number];
44
- /** The unit vectors a camera looks along, and to its right and up. */
45
- export declare function basis(c: Pick<OrbitCamera, "yaw" | "pitch">): {
46
- forward: Vec3;
47
- right: Vec3;
48
- up: Vec3;
49
- };
50
- /** A right-handed perspective projection (OpenGL clip space, depth -1 to 1). `fov` is the vertical field of view in degrees. */
51
- export declare function perspective(fov: number, aspect: number, near: number, far: number): Float32Array;
52
- /** The view matrix of an eye looking along `forward`. */
53
- export declare function lookAlong(eye: Vec3, forward: Vec3, right: Vec3, up: Vec3): Float32Array;
54
- /** `a × b` for column-major matrices. */
55
- export declare function multiply(a: Float32Array, b: Float32Array): Float32Array;
56
- /** The frame for a camera in a drawing buffer of `width` by `height`. */
57
- export declare function frameFor(camera: OrbitCamera, width: number, height: number, { fov, near, far, context, time }?: {
58
- fov?: number;
59
- near?: number;
60
- far?: number;
61
- context?: number;
62
- time?: number;
63
- }): SceneFrame;
64
- /** Turns the camera as dragging does: orbit moves the eye round the target; look (fly) turns the head. Pixels in, degrees out at `degreesPerPixel`. */
65
- export declare function turn(c: OrbitCamera, dx: number, dy: number, mode: "orbit" | "fly", degreesPerPixel?: number): OrbitCamera;
66
- /** Moves the target in the screen's plane by pixels (a pan): the scene follows the pointer. `heightPx` is the box's height and `fov` the vertical field of view, which give the world size of a pixel at the target's distance. */
67
- export declare function pan(c: OrbitCamera, dx: number, dy: number, heightPx: number, fov?: number): OrbitCamera;
68
- /** Moves along the look direction (`ahead`), to the right (`side`) and up (`rise`), in world units: a fly camera's walk, or an orbit camera's pan by keys. */
69
- export declare function walk(c: OrbitCamera, ahead: number, side: number, rise: number): OrbitCamera;
70
- /** Moves the eye toward or away from the target by a factor of the distance (orbit zoom). */
71
- export declare function dolly(c: OrbitCamera, factor: number): OrbitCamera;
72
- /** The camera in words, for the viewport's name and its status: "Looking at 0, 2, 0 from 5 away, turned 45° right, 30° above the horizon". */
73
- export declare function describeCamera(c: OrbitCamera): string;
74
- /** A view from inside a sphere as `PanoramaViewer` holds it: the same degrees, positive yaw to the right and positive pitch up. */
75
- export type LookView = {
76
- yaw: number;
77
- pitch: number;
78
- fov: number;
79
- };
80
- /** The fly camera that sees what a `PanoramaViewer` view sees from `eye`: one view model for looking from a point, in a picture or a scene (issue #386). */
81
- export declare function cameraFromView(view: Pick<LookView, "yaw" | "pitch">, eye?: readonly [number, number, number]): OrbitCamera;
82
- /** The panorama view a camera looks along from its eye (an orbit camera looks along its `forward` just the same), with the field of view given. */
83
- export declare function viewFromCamera(camera: Pick<OrbitCamera, "yaw" | "pitch">, fov: number): LookView;
84
- /**
85
- * A camera that follows a moving point (issue #386, "through the player's eyes" in a replay): the eye is at `eye` and looks along the
86
- * heading the app supplies, plus the person's own `look` on top. With `behind` it is a chase camera instead, that far back along the look.
87
- */
88
- export declare function followCamera({ eye, heading, pitch, look, behind, maxPitch }: {
89
- eye: readonly [number, number, number];
90
- heading: number;
91
- pitch?: number;
92
- look?: {
93
- yaw?: number;
94
- pitch?: number;
95
- };
96
- behind?: number;
97
- maxPitch?: number;
98
- }): OrbitCamera;
99
- export {};
@@ -1,2 +0,0 @@
1
- export { SceneViewport, useOrbitCamera, type SceneViewportProps, type SceneViewportHandle, type OrbitCameraState } from './scene-viewport';
2
- export { basis, clampCamera, describeCamera, dolly, frameFor, lookAlong, multiply, pan, perspective, turn, walk, cameraFromView, followCamera, viewFromCamera, DEFAULT_LIMITS, type CameraLimits, type LookView, type OrbitCamera, type SceneFrame } from './camera';
@@ -1,48 +0,0 @@
1
- import { CameraLimits, OrbitCamera, SceneFrame } from './camera';
2
- import * as React from "react";
3
- /** What a `SceneViewport` hands the app to hold: the camera, and ways to move it that obey the limits. */
4
- export type OrbitCameraState = {
5
- camera: OrbitCamera;
6
- setCamera: (next: OrbitCamera) => void;
7
- /** Back to the camera the hook started with (the viewport's Reset button does this, animated). */
8
- home: OrbitCamera;
9
- };
10
- /** A camera the app holds: `{ target, distance, yaw, pitch }` to start from, and the limits it is kept inside. Give `camera` and `setCamera` to `SceneViewport`. */
11
- export declare function useOrbitCamera(initial?: Partial<OrbitCamera>, limits?: Partial<CameraLimits>): OrbitCameraState;
12
- export type SceneViewportProps = {
13
- /** Names the view: "Map e1m1". The camera in words is added to it. Required. */
14
- label: string;
15
- /** The camera, from `useOrbitCamera`. */
16
- camera: OrbitCamera;
17
- onCameraChange: (camera: OrbitCamera) => void;
18
- /** Where Reset goes. Default: the camera the viewport first had. */
19
- home?: OrbitCamera;
20
- /** Draws the scene. Called when the camera or size changed, or after `invalidate()`; the viewport is set. */
21
- render: (gl: WebGL2RenderingContext, frame: SceneFrame) => void;
22
- /** `"orbit"` (default) circles a target; `"fly"` is the eye itself, for a walkthrough. */
23
- mode?: "orbit" | "fly";
24
- /** The vertical field of view in degrees. Default 60. */
25
- fov?: number;
26
- near?: number;
27
- far?: number;
28
- /** Closest and furthest an orbit camera may be, and the highest and lowest look in degrees. Defaults 0, none, 89. */
29
- limits?: Partial<CameraLimits>;
30
- /** World units a second of fly walking covers. Default 5. */
31
- flySpeed?: number;
32
- /** The scene's time in seconds, from a `useTimeline` clock (issue #386): the scene is drawn again when it changes, with `frame.time` set, so a recorded run or a replay scrubs and plays like a video under `TimelinePlayer`. Default: no time. */
33
- time?: number;
34
- /** Redraw every frame while on screen, for a scene that moves by itself. Default false: draw on change. */
35
- continuous?: boolean;
36
- /** The shape of the box. Default 16/9. */
37
- aspect?: number | `${number}/${number}`;
38
- /** A handle for `invalidate()` (a texture finished loading) and the canvas. */
39
- handle?: React.Ref<SceneViewportHandle>;
40
- className?: string;
41
- };
42
- /** What `handle` gives: ask for a redraw, and the canvas. */
43
- export type SceneViewportHandle = {
44
- invalidate: () => void;
45
- canvas: HTMLCanvasElement | null;
46
- };
47
- /** A sized, focusable canvas for a 3D scene the app draws: orbit by drag, pan by right drag or Shift, zoom by Ctrl/Cmd+wheel or pinch, keys, a Reset button, a fly mode, a lost context restored, and the camera in words. */
48
- export declare function SceneViewport({ label, camera, onCameraChange, home, render, mode, fov, near, far, limits, flySpeed, time, continuous, aspect, handle, className }: SceneViewportProps): React.JSX.Element;
@@ -1,7 +0,0 @@
1
- import { Phase } from '../components/async-button';
2
- /** The filled (`variant="default"`) buttons and links in `container` (default the whole document) that are in view. */
3
- export declare function filledButtons(container?: ParentNode): HTMLElement[];
4
- /** Throws unless `container` (default the whole document) has exactly one filled button in view; the message names the ones found. */
5
- export declare function expectOneFilledButton(container?: ParentNode): HTMLElement;
6
- /** The phase an `AsyncButton` is in (`idle`, `pending`, `done`, `error`), from the button or any element inside it. */
7
- export declare function asyncButtonPhase(el: Element): Phase;
@@ -1,161 +0,0 @@
1
- import { RenderOptions } from '@testing-library/react';
2
- import { RouteObject, To } from 'react-router';
3
- import { QueryClient } from '@tanstack/react-query';
4
- import { ColorSchemePreference } from '../components/theme';
5
- import { Microphone } from '../lib/microphone';
6
- /**
7
- * Test helpers: render a component, or a whole route tree, inside a router and a query client, as
8
- * a Strata app runs it,
9
- * and fill the gaps jsdom leaves (layout, ResizeObserver, IntersectionObserver). Use with MSW for
10
- * the network, never module mocks.
11
- *
12
- * @module strata-react/testing
13
- */
14
- import * as React from "react";
15
- export { installLayoutShims, type LayoutBox } from './layout';
16
- export { setupStrataTests, type StrataTestSetup } from './setup';
17
- export { installStorageShim, memoryStorage } from './storage';
18
- export { installFakeSpeech, type FakeSpeech, type Spoken } from './speech';
19
- export { fakeMicrophone, speechScript, type FakeMicrophoneOptions, type FakeSpeechStretch } from './microphone';
20
- export { filledButtons, expectOneFilledButton, asyncButtonPhase } from './buttons';
21
- export { installFakeIntersectionObserver, type FakeIntersectionObserverControls, type FakeObserver, } from './intersection-observer';
22
- /** A query client for tests: no retries, and nothing goes stale or is collected mid-test. */
23
- export declare function createTestQueryClient(): QueryClient;
24
- /** The options `renderWithStrata` and `renderRoutes` share, beside Testing Library's own. */
25
- export type StrataRenderOptions = Omit<RenderOptions, "wrapper"> & {
26
- /** The URL the test starts at, with its search and hash (`/bookings?sort=pieces.desc`). Defaults to `/`. */
27
- route?: string;
28
- /** The query client; a fresh `createTestQueryClient()` when left out. */
29
- client?: QueryClient;
30
- /** The colour scheme to render; `light` when left out. */
31
- colorScheme?: ColorSchemePreference;
32
- /** Render the one `StrataToastRegion`, so `toast.show(...)` has somewhere to appear and a test can find it. Default true; pass `false` when the app's own route tree renders the region (a root layout route), or a test would see every toast twice. The queue is cleared at the start of each render, so a toast never carries into the next test. */
33
- toasts?: boolean;
34
- /** The microphone a recording screen gets from `useMicrophone()`, such as `fakeMicrophone()`; the browser's when left out (which jsdom cannot open). */
35
- microphone?: Microphone;
36
- /** The mount point of an app served behind a proxy (`"/_home/"`): a `<base href>` is in the document while the render lasts and removed when it unmounts, so `withBase`, `createApi` and `useSystemInfo` read what they read in production and in `strata-visual`. None when left out. */
37
- base?: string;
38
- };
39
- /** Testing Library's `render` inside `StrataQueryProvider` and a `MemoryRouter` at `route`. */
40
- export declare function renderWithStrata(ui: React.ReactElement, { route, client, colorScheme, toasts, microphone, base, ...options }?: StrataRenderOptions): {
41
- container: HTMLElement;
42
- baseElement: HTMLElement;
43
- debug: (baseElement?: import('react-dom/client').Container | (Element | Document) | Array<import('react-dom/client').Container | (Element | Document)> | undefined, maxLength?: number | undefined, options?: import('pretty-format').OptionsReceived | undefined) => void;
44
- rerender: (ui: React.ReactNode) => void;
45
- unmount: () => void;
46
- asFragment: () => DocumentFragment;
47
- getByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement;
48
- getAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
49
- queryByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement | null;
50
- queryAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
51
- findByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
52
- findAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
53
- getByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
54
- getAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
55
- queryByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
56
- queryAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
57
- findByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
58
- findAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
59
- getByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement;
60
- getAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
61
- queryByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement | null;
62
- queryAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
63
- findByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
64
- findAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
65
- getByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
66
- getAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
67
- queryByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
68
- queryAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
69
- findByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
70
- findAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
71
- getByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
72
- getAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
73
- queryByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
74
- queryAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
75
- findByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
76
- findAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
77
- getByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
78
- getAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
79
- queryByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
80
- queryAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
81
- findByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
82
- findAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
83
- getByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement;
84
- getAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement[];
85
- queryByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement | null;
86
- queryAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement[];
87
- findByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
88
- findAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
89
- getByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
90
- getAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
91
- queryByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
92
- queryAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
93
- findByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
94
- findAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
95
- client: QueryClient;
96
- };
97
- /** `renderRoutes`'s options: `renderWithStrata`'s, plus the app's `basename`. */
98
- export type RenderRoutesOptions = StrataRenderOptions & {
99
- /** The base path the app is served under, as passed to `createBrowserRouter`. */
100
- basename?: string;
101
- };
102
- /** Testing Library's `render` of an app's route tree in a memory data router at `route`, with Strata's providers. */
103
- export declare function renderRoutes(routes: RouteObject[], { route, basename, client, colorScheme, toasts, microphone, base, ...options }?: RenderRoutesOptions): {
104
- container: HTMLElement;
105
- baseElement: HTMLElement;
106
- debug: (baseElement?: import('react-dom/client').Container | (Element | Document) | Array<import('react-dom/client').Container | (Element | Document)> | undefined, maxLength?: number | undefined, options?: import('pretty-format').OptionsReceived | undefined) => void;
107
- rerender: (ui: React.ReactNode) => void;
108
- unmount: () => void;
109
- asFragment: () => DocumentFragment;
110
- getByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement;
111
- getAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
112
- queryByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement | null;
113
- queryAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
114
- findByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
115
- findAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
116
- getByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
117
- getAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
118
- queryByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
119
- queryAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
120
- findByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
121
- findAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
122
- getByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement;
123
- getAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
124
- queryByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement | null;
125
- queryAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
126
- findByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
127
- findAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
128
- getByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
129
- getAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
130
- queryByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
131
- queryAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
132
- findByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
133
- findAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
134
- getByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
135
- getAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
136
- queryByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
137
- queryAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
138
- findByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
139
- findAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
140
- getByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
141
- getAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
142
- queryByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
143
- queryAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
144
- findByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
145
- findAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
146
- getByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement;
147
- getAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement[];
148
- queryByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement | null;
149
- queryAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement[];
150
- findByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
151
- findAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
152
- getByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
153
- getAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
154
- queryByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
155
- queryAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
156
- findByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
157
- findAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
158
- client: QueryClient;
159
- router: import('react-router').DataRouter;
160
- navigate: (to: To | number) => Promise<void>;
161
- };
@@ -1,34 +0,0 @@
1
- /** One stand-in observer: its callback, options and the elements it currently watches. */
2
- export interface FakeObserver {
3
- readonly callback: IntersectionObserverCallback;
4
- readonly options: IntersectionObserverInit;
5
- readonly targets: ReadonlySet<Element>;
6
- }
7
- /** The controls `installFakeIntersectionObserver` returns. */
8
- export interface FakeIntersectionObserverControls {
9
- /** Every observer created since install, including disconnected ones (their target sets are empty). */
10
- readonly observers: readonly FakeObserver[];
11
- /** Report `el` to every observer watching it: in view by default, or out of view with `false`. Returns how many observers were told. */
12
- intersect(el: Element, isIntersecting?: boolean): number;
13
- /** Report every watched element as in view, as if the person scrolled to the end of the list. Returns how many elements were reported. */
14
- scrollToEnd(): number;
15
- /** Put back whatever `IntersectionObserver` was there before install. */
16
- uninstall(): void;
17
- }
18
- /**
19
- * Replace `globalThis.IntersectionObserver` with a stand-in the test fires by hand. Call it in
20
- * `beforeEach` and call `uninstall()` in `afterEach`.
21
- *
22
- * @example
23
- * let io: FakeIntersectionObserverControls;
24
- * beforeEach(() => { io = installFakeIntersectionObserver(); });
25
- * afterEach(() => io.uninstall());
26
- *
27
- * it("loads the next page at the end of the list", async () => {
28
- * renderWithStrata(<Pieces />);
29
- * await screen.findByRole("list", { name: "Pieces" });
30
- * io.scrollToEnd();
31
- * expect(await screen.findByText("Celadon bowl")).toBeInTheDocument();
32
- * });
33
- */
34
- export declare function installFakeIntersectionObserver(): FakeIntersectionObserverControls;
@@ -1,13 +0,0 @@
1
- /** A DOMRect-shaped object, for stand-ins that report geometry. */
2
- export declare function box(x: number, y: number, width: number, height: number): DOMRect;
3
- /** The box every element reports while the shims are installed. */
4
- export interface LayoutBox {
5
- width: number;
6
- height: number;
7
- }
8
- /**
9
- * Give jsdom a fixed box for every element (`getBoundingClientRect`, `offset*`, `client*`) and a
10
- * ResizeObserver that reports it on observe, so measuring components render, and an in-memory `localStorage` and `sessionStorage` where the runtime's throw (Node 25+). Defaults to 640×280.
11
- * Call once in a Vitest setup file (or let `setupStrataTests` do it); does nothing, and returns a no-op, where there is no DOM (a node-environment test); returns a function that puts the originals back.
12
- */
13
- export declare function installLayoutShims({ width, height }?: Partial<LayoutBox>): () => void;
@@ -1,35 +0,0 @@
1
- import { Microphone } from '../lib/microphone';
2
- /** `fakeMicrophone`'s options. */
3
- export type FakeMicrophoneOptions = {
4
- /** Peak of the tone, 0 to 1. Default 0.3 (about -10 dBFS, a good level for speech). */
5
- amplitude?: number;
6
- /** Refuse to open with this sentence, as a `MicrophoneError` (what a screen shows). */
7
- refuse?: string;
8
- /** Throw something that is not a `MicrophoneError` (an audio graph that failed). */
9
- crash?: boolean;
10
- /** What the browser calls the device. Default "Fake USB microphone". */
11
- device?: string | null;
12
- /** Open but never send a sample: a take held in its first moment, for a screenshot. */
13
- silent?: boolean;
14
- /** Samples a second. Default 16 000. */
15
- sampleRate?: number;
16
- /** How many times faster than real time the samples arrive. Default 10. */
17
- speed?: number;
18
- /** Stretches of tone at their own `amplitude` (0 for quiet), played in order instead of one steady tone. */
19
- script?: readonly FakeSpeechStretch[];
20
- /** Play `script` again from the start when it ends, instead of falling quiet. */
21
- loop?: boolean;
22
- };
23
- /** One stretch of a fake microphone's `script`: so many seconds at a peak (0 is quiet). */
24
- export type FakeSpeechStretch = {
25
- seconds: number;
26
- amplitude: number;
27
- };
28
- /** A script of `takes` stretches of speech, each `speak` seconds after `gap` seconds of quiet, at `amplitude`. */
29
- export declare function speechScript(takes: number, { speak, gap, amplitude }?: {
30
- speak?: number;
31
- gap?: number;
32
- amplitude?: number;
33
- }): FakeSpeechStretch[];
34
- /** A microphone that sends a tone (or refuses), for tests and stories; hardware is never touched. */
35
- export declare function fakeMicrophone({ amplitude, refuse, crash, device, silent, sampleRate, speed, script, loop, }?: FakeMicrophoneOptions): Microphone;
@@ -1,14 +0,0 @@
1
- import { LayoutBox } from './layout';
2
- /** The options of `setupStrataTests`. */
3
- export type StrataTestSetup = {
4
- /** The runner's `afterEach` (`import { afterEach } from "vitest"`). */
5
- afterEach: (hook: () => void | Promise<void>) => void;
6
- /** The box every element reports (`installLayoutShims`); `false` to skip the shims. */
7
- layout?: Partial<LayoutBox> | false;
8
- };
9
- /**
10
- * One call in a Vitest setup file: installs the layout shims (a no-op without a DOM), and after each
11
- * test unmounts what it rendered, clears the toast queue and forgets loaded thumbnails. Returns a
12
- * function that puts the layout back. Add jest-dom and MSW's `server` lifecycle beside it.
13
- */
14
- export declare function setupStrataTests({ afterEach, layout }: StrataTestSetup): () => void;
@@ -1,38 +0,0 @@
1
- /** One thing said aloud. */
2
- export type Spoken = {
3
- text: string;
4
- lang: string;
5
- rate: number;
6
- voice: string | null;
7
- cancelled: boolean;
8
- /** The recording that was played, or null when the browser's voice said it. */
9
- clip: string | null;
10
- };
11
- /** The recording stand-in `installFakeSpeech` puts on `window`. */
12
- export type FakeSpeech = {
13
- /** Everything said so far, in order; an utterance cut off by a later one has `cancelled: true`. */
14
- said: Spoken[];
15
- /** The texts said so far that were not cancelled. */
16
- texts(): string[];
17
- /** The clips played so far, in order (cut-off ones included). */
18
- clips(): string[];
19
- /** Ends the utterance or clip being said, as the browser does when it has finished. */
20
- finish(): void;
21
- /** Makes the clip playing now fail (a missing file, a refused autoplay): the rest of the prompt goes to the browser's voice. */
22
- failClip(): void;
23
- /** Makes these voices the device's, and fires `voiceschanged` (the late arrival some browsers have). */
24
- setVoices(voices: {
25
- name: string;
26
- lang: string;
27
- }[]): void;
28
- /** Puts the browser's own back (or none). */
29
- uninstall(): void;
30
- };
31
- /**
32
- * Installs a recording `speechSynthesis` and `SpeechSynthesisUtterance` on `window` and returns what was said.
33
- * `uninstall()` after each test. `const speech = installFakeSpeech(); … expect(speech.texts()).toEqual(["Which one is the cat?"])`.
34
- */
35
- export declare function installFakeSpeech(voices?: {
36
- name: string;
37
- lang: string;
38
- }[]): FakeSpeech;
@@ -1,7 +0,0 @@
1
- /** An in-memory `Storage`, with the platform's behaviour (values are strings, `key` and `length` work). */
2
- export declare function memoryStorage(): Storage;
3
- /**
4
- * Replaces `localStorage` and `sessionStorage` with in-memory ones where the runtime's are missing or throw (Node 25+ under jsdom), and empties them after each test when the test runner has a global `afterEach`.
5
- * Does nothing where storage works. Returns a function that puts the originals back. Called by `installLayoutShims`.
6
- */
7
- export declare function installStorageShim(): () => void;
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme-CxYZkUNk.js","names":["_Fragment","Tooltip"],"sources":["../src/components/density.tsx","../src/components/theme.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../lib/utils\";\n\n// Density is how much a screen packs in: `default` for forms and pages, `compact` for a tool screen\n// worked for hours (an editor, an inspector, a timeline). strata.css moves --control-h and\n// --control-h-sm together on `[data-density]`; this is how an app says which (issue #117, from\n// strata-vid, whose export dialog came out at default density over a compact editor).\n//\n// There are two places it can live, and they are different on purpose:\n// - the page (`ThemeProvider density` or `<Density page>`): the attribute goes on the document's\n// root element, so everything Strata renders sees it, including `Dialog`, `Menu`, `ContextMenu`,\n// `Popover` and `CommandMenu`, which portal to <body> and so are never inside the app's own root.\n// An app chooses it once, here.\n// - a region (`<Density value=\"compact\">`): a wrapper element, for a dense inspector inside an\n// ordinary app. Its overlays portal out of it and stay at the page's density, which is right: a\n// confirm opened from a dense panel is still the app's confirm.\n//\n// `default` exists as a value so a region can step back inside a compact page. A coarse pointer\n// still gets 44px targets in every density (strata.css).\n\n/** How much a screen packs in: `default`, or `compact` for a tool screen. */\nexport type DensityName = \"default\" | \"compact\";\n\n/** The density attribute's page-level setter, shared by `ThemeProvider`. @internal */\nexport function useDensityOn(value: DensityName | undefined, target?: HTMLElement | null) {\n React.useLayoutEffect(() => {\n if (value === undefined) return;\n const element = target === undefined ? document.documentElement : target;\n if (!element) return;\n const before = element.getAttribute(\"data-density\");\n element.setAttribute(\"data-density\", value);\n return () => {\n if (before === null) element.removeAttribute(\"data-density\");\n else element.setAttribute(\"data-density\", before);\n };\n }, [value, target]);\n}\n\n/** Props for `Density`. */\nexport type DensityProps = {\n value: DensityName;\n /** Set it on the document's root element for the whole page, overlays included, instead of wrapping a region. Renders only its children. */\n page?: boolean;\n /** For the wrapper of a region: layout classes (the wrapper is a plain `div`; `contents` takes it out of layout). */\n className?: string;\n children?: React.ReactNode;\n};\n\n/** Sets the density of a region (a wrapper `div`), or of the whole page with `page`, where overlays are reached too. */\nexport function Density({ value, page = false, className, children }: DensityProps) {\n useDensityOn(page ? value : undefined);\n if (page) return <>{children}</>;\n return (\n <div data-density={value} className={cn(className)}>\n {children}\n </div>\n );\n}\n","import * as React from \"react\";\nimport { useDensityOn, type DensityName } from \"./density\";\nimport { Radio, RadioGroup } from \"react-aria-components\";\nimport { Tooltip } from \"./tooltip\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { IconComponent } from \"../lib/icon\";\nimport { cn } from \"../lib/utils\";\nimport { ChoiceGroup } from \"./field\";\n\n// strata.css keys dark mode on a `.dark` ancestor (`@custom-variant dark (&:is(.dark *))`) and\n// gives `.dark` its `color-scheme`, but nothing in the library set the class, so every app wrote\n// the same matchMedia listener by hand (strata-listory did, in web/src/main.tsx). This is that\n// listener, once:\n// - Three choices, not two. \"system\" follows the operating system and keeps following it when it\n// changes at dusk; \"light\" and \"dark\" are a person's override. A toggle with only light and dark\n// loses the system setting the first time it is pressed.\n// - The choice persists in localStorage, read and written inside try/catch. Storage throws in\n// private windows, with blocked site data and in sandboxed frames; the theme then simply does\n// not persist, and the page still renders. A stored value that is not one of the three is\n// ignored.\n// - Another tab changing the choice changes this one too (the `storage` event).\n// - The first render uses the default preference, as a server render would, and the stored choice\n// is applied in a layout effect, so server-rendered markup hydrates cleanly and nothing paints\n// with the wrong scheme (found in review).\n// - The class is set in a layout effect, before paint. A page that must not flash light on first\n// load before React runs puts `colorSchemeScript()` in an inline script in its `<head>`.\n// - `ColorSchemeChoice` is the picker for a settings page: a `ChoiceGroup` of the three, with\n// \"Match this device\" first because it is the default and the one most people should keep. A\n// product that wants the choice elsewhere (a menu item, a header button) builds it from\n// `useColorScheme`. Changing theme is rare, so the picker has no motion and no icon flourish.\n// - `compact` is the same choice for an app with no settings page (a homepage, a single-page\n// tool), sized to sit in a header or footer: three segments with an icon each, named\n// \"Appearance\" (strata-react issue #25). They are still native radio buttons, so arrow keys move\n// the choice and a screen reader hears \"Match this device, radio button, 1 of 3, Appearance\".\n// Each segment is named by `aria-label` on its radio and shows the same words as a tooltip; the\n// icons are the familiar three (screen, sun, moon), and none of them is a toggle that loses the\n// system setting. The visible words are left out only because the icons are that well known.\n// - A palette is chosen independently of the scheme (2026-11-25, Jonathan: \"palettes as themes alongside\n// dark mode, each app an easy toggle\"). The provider sets `data-palette` on the same element as `.dark`;\n// strata.css has a light and a dark block per palette keyed on it (`src/styles/palettes.css`), and the\n// default palette is the plain :root, so no attribute and `\"petrol\"` are the same. The palette persists\n// under its own key like the scheme does, with the same safeguards (storage in try/catch, a stored\n// value that is not a palette name is ignored, other tabs follow). `PaletteChoice` is the picker: each\n// option carries a swatch drawn in its own palette by scoping `data-palette` on the swatch, so a person\n// sees the colours before choosing; a swatch is never the only name, the words are always there.\n// - Storybook's decorator and `renderWithStrata({ colorScheme })` run through this provider, so\n// stories and tests see the same class, in the same place, as an app.\n\n/** What a person chose: follow the operating system, or a fixed light or dark theme. */\nexport type ColorSchemePreference = \"system\" | \"light\" | \"dark\";\n/** The scheme in effect after \"system\" is resolved. */\nexport type ColorScheme = \"light\" | \"dark\";\n\n/** The localStorage key `ThemeProvider` uses unless given another. */\nexport const COLOR_SCHEME_STORAGE_KEY = \"strata-color-scheme\";\n\nconst QUERY = \"(prefers-color-scheme: dark)\";\nconst PREFERENCES: readonly ColorSchemePreference[] = [\"system\", \"light\", \"dark\"];\n\n/** A palette Strata ships: its name (the `data-palette` value) and the words `PaletteChoice` shows. */\nexport type PaletteOption = { name: string; label: string; detail?: string };\n\n/** The palettes in `strata.css`: the default first, then four others. An app that adds its own in CSS passes its own list to `PaletteChoice`. */\nexport const palettes: readonly PaletteOption[] = [\n { name: \"petrol\", label: \"Petrol and marigold\", detail: \"The default\" },\n { name: \"pine\", label: \"Pine and coral\" },\n { name: \"cobalt\", label: \"Cobalt and tangerine\" },\n { name: \"steel\", label: \"Steel and mint\" },\n { name: \"clay\", label: \"Clay and teal\" },\n];\n\n/** The default palette: the plain `:root` look, with no override. */\nexport const DEFAULT_PALETTE = \"petrol\";\n\n/** The localStorage key `ThemeProvider` keeps the palette under unless given another. */\nexport const PALETTE_STORAGE_KEY = \"strata-palette\";\n\nconst PALETTE_NAME = /^[a-z][a-z0-9-]{0,31}$/;\n\nfunction isPalette(value: unknown): value is string {\n return typeof value === \"string\" && PALETTE_NAME.test(value);\n}\n\nfunction readStoredPalette(key: string | null): string | null {\n if (key === null) return null;\n try {\n const value = window.localStorage.getItem(key);\n return isPalette(value) ? value : null;\n } catch {\n return null;\n }\n}\n\nfunction writeStoredPalette(key: string | null, value: string) {\n if (key === null) return;\n try {\n window.localStorage.setItem(key, value);\n } catch {\n // Storage unavailable: the palette lasts this visit only.\n }\n}\n\nfunction isPreference(value: unknown): value is ColorSchemePreference {\n return typeof value === \"string\" && (PREFERENCES as readonly string[]).includes(value);\n}\n\nfunction readStored(key: string | null): ColorSchemePreference | null {\n if (key === null) return null;\n try {\n const value = window.localStorage.getItem(key);\n return isPreference(value) ? value : null;\n } catch {\n return null;\n }\n}\n\nfunction writeStored(key: string | null, value: ColorSchemePreference) {\n if (key === null) return;\n try {\n window.localStorage.setItem(key, value);\n } catch {\n // Storage unavailable (private window, blocked site data): the choice lasts this visit only.\n }\n}\n\nfunction media(): MediaQueryList | null {\n return typeof window !== \"undefined\" && typeof window.matchMedia === \"function\" ? window.matchMedia(QUERY) : null;\n}\n\nfunction subscribeSystem(onChange: () => void) {\n const list = media();\n if (!list) return () => undefined;\n list.addEventListener(\"change\", onChange);\n return () => list.removeEventListener(\"change\", onChange);\n}\n\nconst systemSnapshot = (): ColorScheme => (media()?.matches ? \"dark\" : \"light\");\nconst serverSnapshot = (): ColorScheme => \"light\";\n\n/** The operating system's colour scheme, kept current as it changes. Light where it cannot be read (the server, jsdom). */\nexport function useSystemColorScheme(): ColorScheme {\n return React.useSyncExternalStore(subscribeSystem, systemSnapshot, serverSnapshot);\n}\n\n/** What `useColorScheme` returns: the chosen preference, the scheme in effect, and a setter that persists the choice. */\nexport type ColorSchemeState = {\n preference: ColorSchemePreference;\n scheme: ColorScheme;\n setPreference: (preference: ColorSchemePreference) => void;\n};\n\nconst Context = React.createContext<ColorSchemeState | null>(null);\n\n/** What `usePalette` returns: the palette name in effect and a setter that persists it. */\nexport type PaletteState = { palette: string; setPalette: (palette: string) => void };\n\nconst PaletteContext = React.createContext<PaletteState | null>(null);\n\n/** Sets the `.dark` class strata.css keys on, from a system, light or dark preference that persists in localStorage when it can. */\nexport function ThemeProvider({\n children,\n defaultPreference = \"system\",\n storageKey = COLOR_SCHEME_STORAGE_KEY,\n defaultPalette = DEFAULT_PALETTE,\n paletteStorageKey = PALETTE_STORAGE_KEY,\n target,\n density,\n}: {\n children: React.ReactNode;\n /** The preference before a person has chosen one. */\n defaultPreference?: ColorSchemePreference;\n /** Where the choice is kept in localStorage; `null` keeps it for this visit only. */\n storageKey?: string | null;\n /** The palette before a person has chosen one: a `data-palette` name from `palettes` (or the app's own). Left out, the default palette. */\n defaultPalette?: string;\n /** Where the palette is kept in localStorage; `null` keeps it for this visit only. */\n paletteStorageKey?: string | null;\n /**\n * The element that gets the `.dark` class; the document's root element when left out. A nested\n * target can turn a light page's panel dark, not the reverse: strata.css keys dark on any\n * `.dark` ancestor. Pass the element itself (keep it in state with a callback ref, since a\n * wrapping element's ref is not attached yet when this provider's effect first runs); `null`\n * means it has not mounted yet, and nothing is set until it has.\n */\n target?: HTMLElement | null;\n /**\n * How much the screen packs in, set on the same element as the colour scheme (the root, so\n * overlays are reached): `compact` for a tool screen. See `Density`. Left out, nothing is set.\n */\n density?: DensityName;\n}) {\n // The first render uses the default, as the server does, so a server-rendered tree hydrates\n // without a mismatch; the stored choice is read in a layout effect, which re-renders before the\n // browser paints, so a client-only app still never shows the default first.\n const [preference, setState] = React.useState<ColorSchemePreference>(defaultPreference);\n React.useLayoutEffect(() => {\n const stored = readStored(storageKey);\n if (stored) setState(stored);\n }, [storageKey]);\n const system = useSystemColorScheme();\n const scheme: ColorScheme = preference === \"system\" ? system : preference;\n\n const setPreference = React.useCallback(\n (next: ColorSchemePreference) => {\n setState(next);\n writeStored(storageKey, next);\n },\n [storageKey],\n );\n\n // Another tab changed the choice. A cleared key (`newValue` null) falls back to the default.\n React.useEffect(() => {\n if (storageKey === null) return;\n const onStorage = (event: StorageEvent) => {\n if (event.key !== storageKey && event.key !== null) return;\n const value = event.key === null ? null : event.newValue;\n setState(isPreference(value) ? value : defaultPreference);\n };\n window.addEventListener(\"storage\", onStorage);\n return () => window.removeEventListener(\"storage\", onStorage);\n }, [storageKey, defaultPreference]);\n\n React.useLayoutEffect(() => {\n const element = target === undefined ? document.documentElement : target;\n if (!element) return;\n element.classList.toggle(\"dark\", scheme === \"dark\");\n return () => element.classList.remove(\"dark\");\n }, [scheme, target]);\n\n // The palette follows the scheme's pattern: default first, the stored choice in a layout effect.\n const [palette, setPaletteState] = React.useState<string>(defaultPalette);\n React.useLayoutEffect(() => {\n const stored = readStoredPalette(paletteStorageKey);\n if (stored) setPaletteState(stored);\n }, [paletteStorageKey]);\n const setPalette = React.useCallback(\n (next: string) => {\n if (!isPalette(next)) return;\n setPaletteState(next);\n writeStoredPalette(paletteStorageKey, next);\n },\n [paletteStorageKey],\n );\n React.useEffect(() => {\n if (paletteStorageKey === null) return;\n const onStorage = (event: StorageEvent) => {\n if (event.key !== paletteStorageKey && event.key !== null) return;\n const value = event.key === null ? null : event.newValue;\n setPaletteState(isPalette(value) ? value : defaultPalette);\n };\n window.addEventListener(\"storage\", onStorage);\n return () => window.removeEventListener(\"storage\", onStorage);\n }, [paletteStorageKey, defaultPalette]);\n React.useLayoutEffect(() => {\n const element = target === undefined ? document.documentElement : target;\n if (!element) return;\n element.setAttribute(\"data-palette\", palette);\n return () => element.removeAttribute(\"data-palette\");\n }, [palette, target]);\n\n useDensityOn(density, target);\n\n const value = React.useMemo(() => ({ preference, scheme, setPreference }), [preference, scheme, setPreference]);\n const paletteValue = React.useMemo(() => ({ palette, setPalette }), [palette, setPalette]);\n return (\n <Context.Provider value={value}>\n <PaletteContext.Provider value={paletteValue}>{children}</PaletteContext.Provider>\n </Context.Provider>\n );\n}\n\n/** The person's colour-scheme preference, the scheme in effect, and a setter that persists it. Must be inside `ThemeProvider`. */\nexport function useColorScheme(): ColorSchemeState {\n const value = React.useContext(Context);\n if (!value) throw new Error(\"useColorScheme must be used inside a ThemeProvider.\");\n return value;\n}\n\n/**\n * The body of an inline `<script>` for the page's `<head>` that sets `.dark` before the first\n * paint, from the stored choice or the operating system, so a dark page does not flash light while\n * the bundle loads. Pass the same key and default as the `ThemeProvider`.\n */\nexport function colorSchemeScript(\n storageKey: string = COLOR_SCHEME_STORAGE_KEY,\n defaultPreference: ColorSchemePreference = \"system\",\n): string {\n const key = JSON.stringify(storageKey);\n const fallback = JSON.stringify(defaultPreference);\n return (\n `(function(){var p=${fallback};try{var s=localStorage.getItem(${key});` +\n `if(s===\"system\"||s===\"light\"||s===\"dark\")p=s}catch(e){}` +\n `var d=p===\"dark\"||(p===\"system\"&&window.matchMedia&&matchMedia(${JSON.stringify(QUERY)}).matches);` +\n `document.documentElement.classList.toggle(\"dark\",!!d)})()`\n );\n}\n\n/** The words `ColorSchemeChoice` shows for each preference. */\nexport type ColorSchemeLabels = Record<ColorSchemePreference, { label: string; detail?: string }>;\n\nconst defaultLabels: ColorSchemeLabels = {\n system: { label: \"Match this device\", detail: \"Light or dark as your system setting changes\" },\n light: { label: \"Light\" },\n dark: { label: \"Dark\" },\n};\n\nconst icons: Record<ColorSchemePreference, IconComponent> = { system: Monitor, light: Sun, dark: Moon };\n\n/** The three colour-scheme preferences as radio buttons, bound to the nearest `ThemeProvider`. A list for a settings page, or `compact` icon segments named \"Appearance\" for a header. */\nexport function ColorSchemeChoice({\n legend,\n labels = defaultLabels,\n compact = false,\n className,\n}: {\n /** The group's name, as the page words it. Defaults to \"Theme\", or \"Appearance\" when `compact`. */\n legend?: string;\n /** Overrides the words for each choice, in the product's voice. */\n labels?: Partial<ColorSchemeLabels>;\n /** Three icon segments for a header or footer, for an app with no settings page. */\n compact?: boolean;\n /** Layout at the call site (compact only). */\n className?: string;\n}) {\n const { preference, setPreference } = useColorScheme();\n const name = React.useId();\n const words = { ...defaultLabels, ...labels };\n if (compact) {\n return (\n <RadioGroup\n aria-label={legend ?? \"Appearance\"}\n orientation=\"horizontal\"\n name={name}\n value={preference}\n onChange={(value) => {\n if (isPreference(value)) setPreference(value);\n }}\n className={cn(\"inline-flex gap-0.5 rounded-surface border border-border bg-background p-0.5\", className)}\n >\n {PREFERENCES.map((value) => {\n const Icon = icons[value];\n return (\n <Tooltip key={value} label={words[value].label}>\n <Radio\n value={value}\n aria-label={words[value].label}\n className={cn(\n // Outer 6px less 2px padding: the segments are 4px, as optical nesting asks.\n \"grid size-(--control-h-sm) cursor-pointer place-items-center rounded-control text-muted-foreground transition-state\",\n \"hover:text-foreground selected:bg-muted selected:text-foreground\",\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\",\n )}\n >\n <Icon aria-hidden className=\"size-4\" />\n </Radio>\n </Tooltip>\n );\n })}\n </RadioGroup>\n );\n }\n return (\n <ChoiceGroup\n legend={legend ?? \"Theme\"}\n name={name}\n value={preference}\n onChange={(value) => {\n if (isPreference(value)) setPreference(value);\n }}\n choices={PREFERENCES.map((value) => ({ value, ...words[value] }))}\n />\n );\n}\n\n/** The palette in effect and a setter that persists it. Must be inside `ThemeProvider`. */\nexport function usePalette(): PaletteState {\n const value = React.useContext(PaletteContext);\n if (!value) throw new Error(\"usePalette must be used inside a ThemeProvider.\");\n return value;\n}\n\n/**\n * The body of an inline `<script>` for the page's `<head>` that sets `data-palette` before the first paint\n * from the stored choice, so a page does not flash the default palette while the bundle loads. Pass the\n * same key and default as the `ThemeProvider`; put it beside `colorSchemeScript()`.\n */\nexport function paletteScript(storageKey: string = PALETTE_STORAGE_KEY, defaultPalette: string = DEFAULT_PALETTE): string {\n const key = JSON.stringify(storageKey);\n const fallback = JSON.stringify(defaultPalette);\n return (\n `(function(){var p=${fallback};try{var s=localStorage.getItem(${key});` +\n `if(s&&/^[a-z][a-z0-9-]{0,31}$/.test(s))p=s}catch(e){}` +\n `document.documentElement.setAttribute(\"data-palette\",p)})()`\n );\n}\n\n/**\n * The palettes as radio buttons, bound to the nearest `ThemeProvider`, each with a swatch drawn in its own\n * palette (primary and the one warm accent) so the colours are seen before they are chosen. A list for a\n * settings page, or `compact` swatches named \"Palette\" for a header. The words are always present (the\n * list shows them, the compact form names each swatch and shows the same words as a tooltip).\n */\nexport function PaletteChoice({\n legend,\n options = palettes,\n compact = false,\n className,\n}: {\n /** The group's name, as the page words it. Defaults to \"Palette\". */\n legend?: string;\n /** The palettes offered: names that `strata.css` (or the app's own CSS) defines under `data-palette`, with their words. Defaults to `palettes`. */\n options?: readonly PaletteOption[];\n /** Swatches only, for a header or footer, for an app with no settings page. */\n compact?: boolean;\n /** Layout at the call site (compact only). */\n className?: string;\n}) {\n const { palette, setPalette } = usePalette();\n const name = React.useId();\n const swatch = (option: PaletteOption) => (\n // Scoping the palette on the swatch draws it in its own colours, in light and in a dark page.\n <span data-palette={option.name} aria-hidden className=\"inline-flex size-5 shrink-0 overflow-hidden rounded-pill border border-border\">\n <span className=\"w-1/2 bg-primary\" />\n <span className=\"w-1/2 bg-secondary-9\" />\n </span>\n );\n if (compact) {\n return (\n <RadioGroup\n aria-label={legend ?? \"Palette\"}\n orientation=\"horizontal\"\n name={name}\n value={palette}\n onChange={setPalette}\n className={cn(\"inline-flex gap-0.5 rounded-surface border border-border bg-background p-0.5\", className)}\n >\n {options.map((option) => (\n <Tooltip key={option.name} label={option.label}>\n <Radio\n value={option.name}\n aria-label={option.label}\n className={cn(\n \"grid size-(--control-h-sm) cursor-pointer place-items-center rounded-control transition-state\",\n \"hover:bg-muted selected:bg-muted selected:ring-1 selected:ring-border\",\n \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\",\n )}\n >\n {swatch(option)}\n </Radio>\n </Tooltip>\n ))}\n </RadioGroup>\n );\n }\n return (\n <ChoiceGroup\n legend={legend ?? \"Palette\"}\n name={name}\n value={palette}\n onChange={setPalette}\n choices={options.map((option) => ({ value: option.name, label: option.label, detail: option.detail, leading: swatch(option) }))}\n />\n );\n}\n"],"mappings":";;;;;;;;AAwBA,SAAgB,aAAa,OAAgC,QAA6B;CACxF,MAAM,sBAAsB;EAC1B,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,UAAU,WAAW,KAAA,IAAY,SAAS,kBAAkB;EAClE,IAAI,CAAC,SAAS;EACd,MAAM,SAAS,QAAQ,aAAa,cAAc;EAClD,QAAQ,aAAa,gBAAgB,KAAK;EAC1C,aAAa;GACX,IAAI,WAAW,MAAM,QAAQ,gBAAgB,cAAc;QACtD,QAAQ,aAAa,gBAAgB,MAAM;EAClD;CACF,GAAG,CAAC,OAAO,MAAM,CAAC;AACpB;;AAaA,SAAgB,QAAQ,EAAE,OAAO,OAAO,OAAO,WAAW,YAA0B;CAClF,aAAa,OAAO,QAAQ,KAAA,CAAS;CACrC,IAAI,MAAM,OAAO,oBAAAA,UAAA,EAAG,SAAW,CAAA;CAC/B,OACE,oBAAC,OAAD;EAAK,gBAAc;EAAO,WAAW,GAAG,SAAS;EAC9C;CACE,CAAA;AAET;;;ACHA,IAAa,2BAA2B;AAExC,IAAM,QAAQ;AACd,IAAM,cAAgD;CAAC;CAAU;CAAS;AAAM;;AAMhF,IAAa,WAAqC;CAChD;EAAE,MAAM;EAAU,OAAO;EAAuB,QAAQ;CAAc;CACtE;EAAE,MAAM;EAAQ,OAAO;CAAiB;CACxC;EAAE,MAAM;EAAU,OAAO;CAAuB;CAChD;EAAE,MAAM;EAAS,OAAO;CAAiB;CACzC;EAAE,MAAM;EAAQ,OAAO;CAAgB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ip-DhqrDtyu.js","names":["_Fragment","Tooltip","AriaTooltip"],"sources":["../src/lib/utils.ts","../src/components/key-glyphs.tsx","../src/components/tooltip.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\n// Teach tailwind-merge that `type-*` utilities are font sizes. Without this, cn() cannot tell\n// `type-label` from a colour and may drop one of two classes that both survive in CSS; with stock\n// shadcn the same bug drops `text-muted-foreground` next to a custom `text-*` size.\nexport const typeSteps = [\"caption\", \"label\", \"body-sm\", \"body\", \"heading\", \"title\", \"figure\", \"display\", \"picture\"] as const;\n\n// The radius roles too, so `rounded-pill` at a call site (a round avatar Thumbnail) replaces a\n// component's `rounded-control` instead of both surviving and CSS order picking one.\nconst radiusRoles = [\"control\", \"surface\", \"overlay\", \"pill\"] as const;\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: { radius: [...radiusRoles] },\n classGroups: {\n \"font-size\": [{ type: [...typeSteps] }],\n },\n },\n});\n\n/** clsx + tailwind-merge, taught that `type-*` utilities are font sizes and `rounded-control`, `-surface`, `-overlay`, `-pill` are radii. */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport { ArrowBigUp, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ChevronUp, Command, Option, type LucideIcon } from \"lucide-react\";\n\n// Keys drawn as icons where a font cannot be trusted to have them (strata-react issue #136, from\n// strata-vid). The arrows (← → ↑ ↓) and the macOS modifiers (⌘ ⌃ ⌥ ⇧) are outside the latin subset of\n// the bundled variable fonts, so a legend drew them in whatever face the machine had: different on\n// every machine, and `strata-visual` fails a shot with text in a system font. Lucide's icons are\n// SVG, so they draw the same everywhere and take the text colour. Each is hidden from assistive\n// technology and followed by its name in screen-reader-only text (\"left arrow\", \"Command\"), so the\n// keycap reads as words rather than as a symbol each screen reader pronounces its own way.\n// Checked: React Aria has no keyboard-shortcut display beyond the `Keyboard` slot (which only\n// labels the text it is given), so this is the glyph mapping the slot's content needs.\n\nconst GLYPHS: Record<string, { icon: LucideIcon; name: string }> = {\n \"←\": { icon: ArrowLeft, name: \"left arrow\" },\n \"→\": { icon: ArrowRight, name: \"right arrow\" },\n \"↑\": { icon: ArrowUp, name: \"up arrow\" },\n \"↓\": { icon: ArrowDown, name: \"down arrow\" },\n \"⌘\": { icon: Command, name: \"Command\" },\n \"⌃\": { icon: ChevronUp, name: \"Control\" },\n \"⌥\": { icon: Option, name: \"Option\" },\n \"⇧\": { icon: ArrowBigUp, name: \"Shift\" },\n};\nconst PATTERN = new RegExp(`([${Object.keys(GLYPHS).join(\"\")}])`);\n\n/** Key text with its arrows and modifier symbols drawn as icons, each with its name for screen readers. Other text is left as it is. */\nexport function KeyText({ children }: { children: string }) {\n return (\n <>\n {children.split(PATTERN).map((part, i) => {\n const glyph = GLYPHS[part];\n if (!glyph) return part ? <React.Fragment key={i}>{part}</React.Fragment> : null;\n const Icon = glyph.icon;\n return (\n <React.Fragment key={i}>\n <Icon aria-hidden className=\"inline size-[1em] align-[-0.125em]\" />\n <span className=\"sr-only\">{glyph.name} </span>\n </React.Fragment>\n );\n })}\n </>\n );\n}\n","import { KeyText } from \"./key-glyphs\";\nimport * as React from \"react\";\nimport { Tooltip as AriaTooltip, TooltipTrigger } from \"react-aria-components\";\nimport { cn } from \"../lib/utils\";\n\n// A tooltip names or explains a control; it is never the only place information lives. React Aria\n// opens it on keyboard focus as well as hover (strata-vid's old hover-only tooltip hid it from\n// keyboard users), after a short delay so a pointer crossing a toolbar does not flash every tip,\n// and shares the delay between neighbouring tips. It holds only words: anything interactive is a\n// Popover. It is portalled to the body, so a parent's overflow cannot clip it, and sits on the\n// `layer-tip` layer above dialogs, since it can name a control inside one.\n//\n// `IconButton` uses it for its required `label`, so the name and the visible hint come from one\n// string and cannot drift.\n\n/** Props for `Tooltip`. */\nexport type TooltipProps = {\n /** The words: a control's name or one sentence about it. Not interactive. */\n label: React.ReactNode;\n /** A shortcut or other aside shown after the label, muted (\"Ctrl+Z\"). */\n hint?: React.ReactNode;\n /** The element that gets the tip. It must be a React Aria pressable or focusable (a Strata `Button` is). */\n children: React.ReactElement;\n /** Which side of the trigger it prefers; it flips when there is no room. Default `top`. */\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n /** Milliseconds before it opens on hover. Focus opens it at once. Default 500. */\n delay?: number;\n /** A controlled open state, for a story or test that needs it shown. */\n open?: boolean;\n className?: string;\n};\n\n/** A hover-and-focus tooltip for a control, portalled above everything. Words only; not the only home of information. */\nexport function Tooltip({ label, hint, children, side = \"top\", delay = 500, open, className }: TooltipProps) {\n return (\n <TooltipTrigger delay={delay} closeDelay={0} isOpen={open}>\n {children}\n <AriaTooltip\n placement={side}\n offset={6}\n className={cn(\"layer-tip enter-overlay max-w-xs rounded-control bg-foreground px-2 py-1 type-caption text-background\", className)}\n >\n {label}\n {hint != null && <span className=\"ml-2 opacity-70\">{typeof hint === \"string\" ? <KeyText>{hint}</KeyText> : hint}</span>}\n </AriaTooltip>\n </TooltipTrigger>\n );\n}\n"],"mappings":";;;;;;;AAMA,IAAa,YAAY;CAAC;CAAW;CAAS;CAAW;CAAQ;CAAW;CAAS;CAAU;CAAW;AAAS;AAMnH,IAAM,UAAU,oBAAoB,EAClC,QAAQ;CACN,OAAO,EAAE,QAAQ,CAAC,GAAG;EAJJ;EAAW;EAAW;EAAW;CAI7B,CAAW,EAAE;CAClC,aAAa,EACX,aAAa,CAAC,EAAE,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC,EACxC;AACF,EACF,CAAC;;AAGD,SAAgB,GAAG,GAAG,QAAsB;CAC1C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;ACXA,IAAM,SAA6D;CACjE,KAAK;EAAE,MAAM;EAAW,MAAM;CAAa;CAC3C,KAAK;EAAE,MAAM;EAAY,MAAM;CAAc;CAC7C,KAAK;EAAE,MAAM;EAAS,MAAM;CAAW;CACvC,KAAK;EAAE,MAAM;EAAW,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