strata-react 1.3.25 → 1.3.27

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 +1 -0
  2. package/UPGRADING.md +4 -0
  3. package/dist/{api-types/cli.d.ts → api-types-cli.d.ts} +1 -0
  4. package/dist/api-types-cli.js +4 -3
  5. package/dist/api-types-cli.js.map +1 -1
  6. package/dist/{api-types/generate.d.ts → api-types.d.ts} +3 -3
  7. package/dist/api-types.js +3 -1
  8. package/dist/{button-KGJI6jQr.js → button-CYXjU-fs.js} +8 -5
  9. package/dist/button-CYXjU-fs.js.map +1 -0
  10. package/dist/{cursor-DDGBPiTJ.js → cursor-Cwyvgwsw.js} +9 -7
  11. package/dist/cursor-Cwyvgwsw.js.map +1 -0
  12. package/dist/{errors-BUvY1Z4d.js → errors-CmuwcWlb.js} +6 -6
  13. package/dist/{errors-BUvY1Z4d.js.map → errors-CmuwcWlb.js.map} +1 -1
  14. package/dist/{field-BjeE_FeB.js → field-DBCsFIng.js} +27 -23
  15. package/dist/field-DBCsFIng.js.map +1 -0
  16. package/dist/{follow-BTPs49FP.js → follow-CXQsL86O.js} +2 -2
  17. package/dist/follow-CXQsL86O.js.map +1 -0
  18. package/dist/{generate-CjTHKJ39.js → generate-BkWhh4k4.js} +8 -6
  19. package/dist/generate-BkWhh4k4.js.map +1 -0
  20. package/dist/{lib/geo.d.ts → geo-DfKa9JtK.d.ts} +35 -33
  21. package/dist/{hls/index.d.ts → hls.d.ts} +13 -12
  22. package/dist/hls.js +5 -4
  23. package/dist/hls.js.map +1 -1
  24. package/dist/index.d.ts +5401 -142
  25. package/dist/index.js +1072 -227
  26. package/dist/index.js.map +1 -1
  27. package/dist/map.d.ts +184 -0
  28. package/dist/map.js +21 -17
  29. package/dist/map.js.map +1 -1
  30. package/dist/media-player-BETa3P7K.d.ts +758 -0
  31. package/dist/{microphone-Bo3WaXgD.js → microphone-76skMt6i.js} +41 -30
  32. package/dist/microphone-76skMt6i.js.map +1 -0
  33. package/dist/microphone-DDOnQHxf.d.ts +237 -0
  34. package/dist/{migrate/cli.d.ts → migrate-cli.d.ts} +1 -0
  35. package/dist/migrate-cli.js +8 -6
  36. package/dist/migrate-cli.js.map +1 -1
  37. package/dist/panorama.d.ts +102 -0
  38. package/dist/panorama.js +18 -15
  39. package/dist/panorama.js.map +1 -1
  40. package/dist/{run-BT2WKzMz.js → run-D_Ic1jE7.js} +23 -16
  41. package/dist/run-D_Ic1jE7.js.map +1 -0
  42. package/dist/scene.d.ts +147 -0
  43. package/dist/scene.js +15 -13
  44. package/dist/scene.js.map +1 -1
  45. package/dist/testing.d.ts +468 -0
  46. package/dist/testing.js +11 -3
  47. package/dist/testing.js.map +1 -1
  48. package/dist/{theme-CxYZkUNk.js → theme-1oOSMj_D.js} +19 -17
  49. package/dist/theme-1oOSMj_D.js.map +1 -0
  50. package/dist/{tooltip-DhqrDtyu.js → tooltip-BosfsWYh.js} +9 -6
  51. package/dist/tooltip-BosfsWYh.js.map +1 -0
  52. package/dist/types-B3TsF0Ey.d.ts +241 -0
  53. package/dist/{value-controls-Dm_EYfZW.js → value-controls-5u7sD_wG.js} +22 -17
  54. package/dist/value-controls-5u7sD_wG.js.map +1 -0
  55. package/dist/{viewer-input-CHU0Hx4A.js → viewer-input-3Qa-o35k.js} +3 -2
  56. package/dist/{viewer-input-CHU0Hx4A.js.map → viewer-input-3Qa-o35k.js.map} +1 -1
  57. package/dist/{visual/cli.d.ts → visual-cli.d.ts} +2 -1
  58. package/dist/visual-cli.js +5 -4
  59. package/dist/visual-cli.js.map +1 -1
  60. package/dist/visual.d.ts +105 -0
  61. package/dist/visual.js +4 -3
  62. package/dist/visual.js.map +1 -1
  63. package/package.json +24 -19
  64. package/dist/api-types/index.d.ts +0 -1
  65. package/dist/button-KGJI6jQr.js.map +0 -1
  66. package/dist/components/active-list.d.ts +0 -46
  67. package/dist/components/alert.d.ts +0 -17
  68. package/dist/components/app-shell.d.ts +0 -32
  69. package/dist/components/async-button.d.ts +0 -48
  70. package/dist/components/auto-recorder.d.ts +0 -67
  71. package/dist/components/book-viewer.d.ts +0 -50
  72. package/dist/components/box-overlay.d.ts +0 -44
  73. package/dist/components/boxed-picture.d.ts +0 -34
  74. package/dist/components/button.d.ts +0 -45
  75. package/dist/components/byte-view.d.ts +0 -32
  76. package/dist/components/checkbox.d.ts +0 -39
  77. package/dist/components/choice-grid.d.ts +0 -42
  78. package/dist/components/commands.d.ts +0 -104
  79. package/dist/components/compare-audio.d.ts +0 -30
  80. package/dist/components/compare-grid.d.ts +0 -24
  81. package/dist/components/compare-parts.d.ts +0 -90
  82. package/dist/components/compare-regions.d.ts +0 -37
  83. package/dist/components/compare-text.d.ts +0 -32
  84. package/dist/components/compare-video-grid.d.ts +0 -52
  85. package/dist/components/compare-video.d.ts +0 -61
  86. package/dist/components/compare.d.ts +0 -90
  87. package/dist/components/composition.d.ts +0 -44
  88. package/dist/components/console.d.ts +0 -34
  89. package/dist/components/conversation.d.ts +0 -83
  90. package/dist/components/cursor.d.ts +0 -44
  91. package/dist/components/data-table.d.ts +0 -89
  92. package/dist/components/data-view.d.ts +0 -66
  93. package/dist/components/density.d.ts +0 -16
  94. package/dist/components/dialog.d.ts +0 -45
  95. package/dist/components/difference.d.ts +0 -19
  96. package/dist/components/disclosure.d.ts +0 -49
  97. package/dist/components/done.d.ts +0 -14
  98. package/dist/components/drag-source.d.ts +0 -29
  99. package/dist/components/field.d.ts +0 -79
  100. package/dist/components/file-intake.d.ts +0 -60
  101. package/dist/components/film-strip.d.ts +0 -35
  102. package/dist/components/folder-picker.d.ts +0 -59
  103. package/dist/components/fullscreen-frame.d.ts +0 -18
  104. package/dist/components/history.d.ts +0 -61
  105. package/dist/components/hotkeys.d.ts +0 -44
  106. package/dist/components/infinite-list.d.ts +0 -77
  107. package/dist/components/inspector.d.ts +0 -66
  108. package/dist/components/job-action.d.ts +0 -30
  109. package/dist/components/job-status.d.ts +0 -55
  110. package/dist/components/jobs-table.d.ts +0 -35
  111. package/dist/components/key-glyphs.d.ts +0 -5
  112. package/dist/components/key-owner.d.ts +0 -11
  113. package/dist/components/lightbox.d.ts +0 -61
  114. package/dist/components/line-chart.d.ts +0 -169
  115. package/dist/components/link-card.d.ts +0 -32
  116. package/dist/components/link.d.ts +0 -54
  117. package/dist/components/markable-text.d.ts +0 -60
  118. package/dist/components/media-contents.d.ts +0 -28
  119. package/dist/components/media-group.d.ts +0 -32
  120. package/dist/components/media-player.d.ts +0 -251
  121. package/dist/components/media-progress.d.ts +0 -17
  122. package/dist/components/media-skip.d.ts +0 -31
  123. package/dist/components/media-spans.d.ts +0 -93
  124. package/dist/components/media.d.ts +0 -133
  125. package/dist/components/meter.d.ts +0 -32
  126. package/dist/components/metric.d.ts +0 -17
  127. package/dist/components/outbox-status.d.ts +0 -10
  128. package/dist/components/page-header.d.ts +0 -14
  129. package/dist/components/pair-vote.d.ts +0 -70
  130. package/dist/components/pause-button.d.ts +0 -7
  131. package/dist/components/pixel-image.d.ts +0 -29
  132. package/dist/components/place-board.d.ts +0 -39
  133. package/dist/components/player-warning.d.ts +0 -24
  134. package/dist/components/popover.d.ts +0 -20
  135. package/dist/components/recorder.d.ts +0 -73
  136. package/dist/components/region-editor.d.ts +0 -67
  137. package/dist/components/save.d.ts +0 -46
  138. package/dist/components/say-again.d.ts +0 -13
  139. package/dist/components/schedule-table.d.ts +0 -24
  140. package/dist/components/secret-field.d.ts +0 -34
  141. package/dist/components/selectable-grid.d.ts +0 -57
  142. package/dist/components/selection.d.ts +0 -104
  143. package/dist/components/sequence-timeline.d.ts +0 -50
  144. package/dist/components/shortcut-editor.d.ts +0 -44
  145. package/dist/components/sortable-list.d.ts +0 -39
  146. package/dist/components/status.d.ts +0 -9
  147. package/dist/components/switch.d.ts +0 -15
  148. package/dist/components/system-panel.d.ts +0 -58
  149. package/dist/components/tabs.d.ts +0 -16
  150. package/dist/components/theme.d.ts +0 -106
  151. package/dist/components/thumbnail.d.ts +0 -50
  152. package/dist/components/tile-grid.d.ts +0 -67
  153. package/dist/components/timeline-player.d.ts +0 -18
  154. package/dist/components/timeline.d.ts +0 -115
  155. package/dist/components/toast.d.ts +0 -36
  156. package/dist/components/toggle.d.ts +0 -51
  157. package/dist/components/toolbar.d.ts +0 -15
  158. package/dist/components/tooltip.d.ts +0 -19
  159. package/dist/components/transcript-view.d.ts +0 -63
  160. package/dist/components/tree.d.ts +0 -74
  161. package/dist/components/undo.d.ts +0 -63
  162. package/dist/components/use-timeline.d.ts +0 -44
  163. package/dist/components/value-controls.d.ts +0 -91
  164. package/dist/components/video-clock.d.ts +0 -68
  165. package/dist/components/view-options.d.ts +0 -105
  166. package/dist/components/viewport.d.ts +0 -85
  167. package/dist/components/virtual-list.d.ts +0 -19
  168. package/dist/components/waveform.d.ts +0 -71
  169. package/dist/components/workflow-steps.d.ts +0 -71
  170. package/dist/components/workspace.d.ts +0 -83
  171. package/dist/cursor-DDGBPiTJ.js.map +0 -1
  172. package/dist/field-BjeE_FeB.js.map +0 -1
  173. package/dist/follow-BTPs49FP.js.map +0 -1
  174. package/dist/generate-CjTHKJ39.js.map +0 -1
  175. package/dist/lib/base.d.ts +0 -10
  176. package/dist/lib/book.d.ts +0 -25
  177. package/dist/lib/boxes.d.ts +0 -55
  178. package/dist/lib/breakpoint.d.ts +0 -4
  179. package/dist/lib/choice.d.ts +0 -29
  180. package/dist/lib/chords.d.ts +0 -20
  181. package/dist/lib/client-work.d.ts +0 -24
  182. package/dist/lib/control.d.ts +0 -4
  183. package/dist/lib/dev.d.ts +0 -2
  184. package/dist/lib/errors.d.ts +0 -43
  185. package/dist/lib/file-intake.d.ts +0 -60
  186. package/dist/lib/follow.d.ts +0 -18
  187. package/dist/lib/format.d.ts +0 -243
  188. package/dist/lib/grouped-grid-layout.d.ts +0 -44
  189. package/dist/lib/icon.d.ts +0 -6
  190. package/dist/lib/image-diff.d.ts +0 -30
  191. package/dist/lib/in-view.d.ts +0 -21
  192. package/dist/lib/loudness.d.ts +0 -18
  193. package/dist/lib/marks.d.ts +0 -6
  194. package/dist/lib/microphone.d.ts +0 -24
  195. package/dist/lib/number-input.d.ts +0 -4
  196. package/dist/lib/object-url.d.ts +0 -2
  197. package/dist/lib/overlay.d.ts +0 -1
  198. package/dist/lib/recording.d.ts +0 -16
  199. package/dist/lib/region.d.ts +0 -64
  200. package/dist/lib/rich-text.d.ts +0 -44
  201. package/dist/lib/search-param.d.ts +0 -16
  202. package/dist/lib/segmenter.d.ts +0 -40
  203. package/dist/lib/sequence.d.ts +0 -34
  204. package/dist/lib/speech.d.ts +0 -53
  205. package/dist/lib/text-diff.d.ts +0 -16
  206. package/dist/lib/timeline.d.ts +0 -14
  207. package/dist/lib/transcript.d.ts +0 -53
  208. package/dist/lib/utils.d.ts +0 -4
  209. package/dist/lib/viewer-input.d.ts +0 -29
  210. package/dist/lib/viewport.d.ts +0 -55
  211. package/dist/lib/waveform.d.ts +0 -46
  212. package/dist/map/fan.d.ts +0 -15
  213. package/dist/map/index.d.ts +0 -3
  214. package/dist/map/map-styles.d.ts +0 -2
  215. package/dist/map/markers.d.ts +0 -60
  216. package/dist/map/route-map.d.ts +0 -146
  217. package/dist/microphone-Bo3WaXgD.js.map +0 -1
  218. package/dist/migrate/stock-classes.d.ts +0 -11
  219. package/dist/panorama/gl.d.ts +0 -16
  220. package/dist/panorama/index.d.ts +0 -2
  221. package/dist/panorama/panorama-viewer.d.ts +0 -56
  222. package/dist/panorama/projection.d.ts +0 -45
  223. package/dist/query/api.d.ts +0 -23
  224. package/dist/query/clips.d.ts +0 -48
  225. package/dist/query/index.d.ts +0 -55
  226. package/dist/query/infinite.d.ts +0 -60
  227. package/dist/query/job.d.ts +0 -26
  228. package/dist/query/outbox.d.ts +0 -85
  229. package/dist/query/poll.d.ts +0 -24
  230. package/dist/query/reserve.d.ts +0 -33
  231. package/dist/query/typed-api.d.ts +0 -84
  232. package/dist/query/workflow.d.ts +0 -17
  233. package/dist/run-BT2WKzMz.js.map +0 -1
  234. package/dist/scene/camera.d.ts +0 -99
  235. package/dist/scene/index.d.ts +0 -2
  236. package/dist/scene/scene-viewport.d.ts +0 -48
  237. package/dist/testing/buttons.d.ts +0 -7
  238. package/dist/testing/index.d.ts +0 -161
  239. package/dist/testing/intersection-observer.d.ts +0 -34
  240. package/dist/testing/layout.d.ts +0 -13
  241. package/dist/testing/microphone.d.ts +0 -35
  242. package/dist/testing/setup.d.ts +0 -14
  243. package/dist/testing/speech.d.ts +0 -38
  244. package/dist/testing/storage.d.ts +0 -7
  245. package/dist/theme-CxYZkUNk.js.map +0 -1
  246. package/dist/tooltip-DhqrDtyu.js.map +0 -1
  247. package/dist/value-controls-Dm_EYfZW.js.map +0 -1
  248. package/dist/visual/capture.d.ts +0 -37
  249. package/dist/visual/compare.d.ts +0 -46
  250. package/dist/visual/drop.d.ts +0 -19
  251. package/dist/visual/fonts.d.ts +0 -18
  252. package/dist/visual/index.d.ts +0 -19
  253. package/dist/visual/run.d.ts +0 -22
  254. package/dist/visual/serve.d.ts +0 -13
  255. package/dist/visual/targets.d.ts +0 -17
  256. package/dist/visual/types.d.ts +0 -188
@@ -1 +1 @@
1
- {"version":3,"file":"visual-cli.js","names":[],"sources":["../src/visual/cli.ts"],"sourcesContent":["// The strata-visual command. With no arguments it reads strata-visual.config.(ts|mts|js|mjs)\n// from the current folder; `--storybook <dir>` screenshots a built Storybook with no config at\n// all (that is how strata-react runs its own suite). A TypeScript config is loaded through Vite's\n// module runner when Vite is installed, so it can import the app's MSW handlers and fixtures\n// with the same extensionless imports and aliases the app's code uses.\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { parseArgs } from \"node:util\";\nimport { formatReport, runVisual } from \"./run\";\nimport type { VisualConfig } from \"./types\";\n\nconst usage = `Usage: strata-visual [options]\n\nScreenshots a built Storybook and/or an app's routes in light and dark, and compares each\nwith its committed baseline (Playwright Chromium + pixelmatch).\n\n --config <file> config file (default: strata-visual.config.{ts,mts,js,mjs} here)\n --storybook <dir> screenshot this Storybook build (overrides the config's storybook)\n --update write the screenshots as the baselines and remove obsolete ones\n --filter <text> only shots whose name contains the text\n --baselines <dir> where baselines live (default tests/visual/baselines)\n --output <dir> where diffs go (default tests/visual/output)\n --concurrency <n> pages at once (default 4)\n --help show this\n`;\n\nconst configNames = [\"strata-visual.config.ts\", \"strata-visual.config.mts\", \"strata-visual.config.js\", \"strata-visual.config.mjs\"];\n\n/** Loads a config file's default export. */\nexport async function loadConfig(file: string): Promise<VisualConfig> {\n if (/\\.[cm]?ts$/.test(file)) {\n const vite = await import(\"vite\").catch(() => undefined);\n if (vite?.runnerImport) {\n const { module } = await vite.runnerImport<{ default: VisualConfig }>(file);\n return module.default;\n }\n }\n const mod = (await import(pathToFileURL(file).href)) as { default: VisualConfig };\n return mod.default;\n}\n\n/** Runs the command with the given arguments and returns the exit code. */\nexport async function main(argv: readonly string[], cwd = process.cwd()): Promise<number> {\n let values;\n try {\n ({ values } = parseArgs({\n args: [...argv],\n options: {\n config: { type: \"string\" },\n storybook: { type: \"string\" },\n update: { type: \"boolean\" },\n filter: { type: \"string\" },\n baselines: { type: \"string\" },\n output: { type: \"string\" },\n concurrency: { type: \"string\" },\n help: { type: \"boolean\" },\n },\n }));\n } catch (e) {\n console.error(`${(e as Error).message}\\n\\n${usage}`);\n return 2;\n }\n if (values.help) {\n console.log(usage);\n return 0;\n }\n\n let config: VisualConfig = {};\n let base = cwd;\n const file = values.config ? resolve(cwd, values.config) : configNames.map((n) => resolve(cwd, n)).find((f) => existsSync(f));\n if (values.config && !existsSync(file!)) {\n console.error(`strata-visual: ${values.config} not found`);\n return 2;\n }\n if (file) {\n config = await loadConfig(file);\n base = resolve(file, \"..\");\n }\n if (values.storybook) config = { ...config, storybook: { ...(typeof config.storybook === \"object\" ? config.storybook : {}), dir: resolve(cwd, values.storybook) } };\n if (values.baselines) config = { ...config, baselines: resolve(cwd, values.baselines) };\n if (values.output) config = { ...config, output: resolve(cwd, values.output) };\n if (values.concurrency) config = { ...config, concurrency: Number(values.concurrency) };\n if (config.storybook === undefined && config.app === undefined) {\n if (existsSync(resolve(cwd, \"storybook-static/index.json\"))) config = { ...config, storybook: \"storybook-static\" };\n else {\n console.error(`strata-visual: no config file and no Storybook build here.\\n\\n${usage}`);\n return 2;\n }\n }\n\n try {\n const report = await runVisual(config, { cwd: base, update: values.update, filter: values.filter });\n console.log(formatReport(report));\n return report.failed ? 1 : 0;\n } catch (e) {\n console.error(`strata-visual: ${(e as Error).message}`);\n return 1;\n }\n}\n"],"mappings":";;;;;;AAYA,IAAM,QAAQ;;;;;;;;;;;;;;AAed,IAAM,cAAc;CAAC;CAA2B;CAA4B;CAA2B;AAA0B;;AAGjI,eAAsB,WAAW,MAAqC;CACpE,IAAI,aAAa,KAAK,IAAI,GAAG;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,CAAC,YAAY,KAAA,CAAS;EACvD,IAAI,MAAM,cAAc;GACtB,MAAM,EAAE,WAAW,MAAM,KAAK,aAAwC,IAAI;GAC1E,OAAO,OAAO;EAChB;CACF;CAEA,QAAO,MADY,OAAO,cAAc,IAAI,CAAC,CAAC,MAAA,CACnC;AACb;;AAGA,eAAsB,KAAK,MAAyB,MAAM,QAAQ,IAAI,GAAoB;CACxF,IAAI;CACJ,IAAI;EACF,CAAC,CAAE,UAAW,UAAU;GACtB,MAAM,CAAC,GAAG,IAAI;GACd,SAAS;IACP,QAAQ,EAAE,MAAM,SAAS;IACzB,WAAW,EAAE,MAAM,SAAS;IAC5B,QAAQ,EAAE,MAAM,UAAU;IAC1B,QAAQ,EAAE,MAAM,SAAS;IACzB,WAAW,EAAE,MAAM,SAAS;IAC5B,QAAQ,EAAE,MAAM,SAAS;IACzB,aAAa,EAAE,MAAM,SAAS;IAC9B,MAAM,EAAE,MAAM,UAAU;GAC1B;EACF,CAAC;CACH,SAAS,GAAG;EACV,QAAQ,MAAM,GAAI,EAAY,QAAQ,MAAM,OAAO;EACnD,OAAO;CACT;CACA,IAAI,OAAO,MAAM;EACf,QAAQ,IAAI,KAAK;EACjB,OAAO;CACT;CAEA,IAAI,SAAuB,CAAC;CAC5B,IAAI,OAAO;CACX,MAAM,OAAO,OAAO,SAAS,QAAQ,KAAK,OAAO,MAAM,IAAI,YAAY,KAAK,MAAM,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,WAAW,CAAC,CAAC;CAC5H,IAAI,OAAO,UAAU,CAAC,WAAW,IAAK,GAAG;EACvC,QAAQ,MAAM,kBAAkB,OAAO,OAAO,WAAW;EACzD,OAAO;CACT;CACA,IAAI,MAAM;EACR,SAAS,MAAM,WAAW,IAAI;EAC9B,OAAO,QAAQ,MAAM,IAAI;CAC3B;CACA,IAAI,OAAO,WAAW,SAAS;EAAE,GAAG;EAAQ,WAAW;GAAE,GAAI,OAAO,OAAO,cAAc,WAAW,OAAO,YAAY,CAAC;GAAI,KAAK,QAAQ,KAAK,OAAO,SAAS;EAAE;CAAE;CAClK,IAAI,OAAO,WAAW,SAAS;EAAE,GAAG;EAAQ,WAAW,QAAQ,KAAK,OAAO,SAAS;CAAE;CACtF,IAAI,OAAO,QAAQ,SAAS;EAAE,GAAG;EAAQ,QAAQ,QAAQ,KAAK,OAAO,MAAM;CAAE;CAC7E,IAAI,OAAO,aAAa,SAAS;EAAE,GAAG;EAAQ,aAAa,OAAO,OAAO,WAAW;CAAE;CACtF,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,QAAQ,KAAA,GAAW;EAC9D,IAAI,WAAW,QAAQ,KAAK,6BAA6B,CAAC,GAAG,SAAS;GAAE,GAAG;GAAQ,WAAW;EAAmB;OAC5G;GACH,QAAQ,MAAM,iEAAiE,OAAO;GACtF,OAAO;EACT;CACF;CAEA,IAAI;EACF,MAAM,SAAS,MAAM,UAAU,QAAQ;GAAE,KAAK;GAAM,QAAQ,OAAO;GAAQ,QAAQ,OAAO;EAAO,CAAC;EAClG,QAAQ,IAAI,aAAa,MAAM,CAAC;EAChC,OAAO,OAAO,SAAS,IAAI;CAC7B,SAAS,GAAG;EACV,QAAQ,MAAM,kBAAmB,EAAY,SAAS;EACtD,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"visual-cli.js","names":[],"sources":["../src/visual/cli.ts"],"sourcesContent":["// The strata-visual command. With no arguments it reads strata-visual.config.(ts|mts|js|mjs)\n// from the current folder; `--storybook <dir>` screenshots a built Storybook with no config at\n// all (that is how strata-react runs its own suite). A TypeScript config is loaded through Vite's\n// module runner when Vite is installed, so it can import the app's MSW handlers and fixtures\n// with the same extensionless imports and aliases the app's code uses.\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { parseArgs } from \"node:util\";\nimport { formatReport, runVisual } from \"./run\";\nimport type { VisualConfig } from \"./types\";\n\nconst usage = `Usage: strata-visual [options]\n\nScreenshots a built Storybook and/or an app's routes in light and dark, and compares each\nwith its committed baseline (Playwright Chromium + pixelmatch).\n\n --config <file> config file (default: strata-visual.config.{ts,mts,js,mjs} here)\n --storybook <dir> screenshot this Storybook build (overrides the config's storybook)\n --update write the screenshots as the baselines and remove obsolete ones\n --filter <text> only shots whose name contains the text\n --baselines <dir> where baselines live (default tests/visual/baselines)\n --output <dir> where diffs go (default tests/visual/output)\n --concurrency <n> pages at once (default 4)\n --help show this\n`;\n\nconst configNames = [\n \"strata-visual.config.ts\",\n \"strata-visual.config.mts\",\n \"strata-visual.config.js\",\n \"strata-visual.config.mjs\",\n];\n\n/** Loads a config file's default export. */\nexport async function loadConfig(file: string): Promise<VisualConfig> {\n if (/\\.[cm]?ts$/.test(file)) {\n const vite = await import(\"vite\").catch(() => undefined);\n if (vite?.runnerImport) {\n const { module } = await vite.runnerImport<{ default: VisualConfig }>(file);\n return module.default;\n }\n }\n const mod = (await import(pathToFileURL(file).href)) as { default: VisualConfig };\n return mod.default;\n}\n\n/** Runs the command with the given arguments and returns the exit code. */\nexport async function main(argv: readonly string[], cwd = process.cwd()): Promise<number> {\n let values;\n try {\n ({ values } = parseArgs({\n args: [...argv],\n options: {\n config: { type: \"string\" },\n storybook: { type: \"string\" },\n update: { type: \"boolean\" },\n filter: { type: \"string\" },\n baselines: { type: \"string\" },\n output: { type: \"string\" },\n concurrency: { type: \"string\" },\n help: { type: \"boolean\" },\n },\n }));\n } catch (e) {\n console.error(`${(e as Error).message}\\n\\n${usage}`);\n return 2;\n }\n if (values.help) {\n console.log(usage);\n return 0;\n }\n\n let config: VisualConfig = {};\n let base = cwd;\n const file = values.config\n ? resolve(cwd, values.config)\n : configNames.map((n) => resolve(cwd, n)).find((f) => existsSync(f));\n if (values.config && !existsSync(file!)) {\n console.error(`strata-visual: ${values.config} not found`);\n return 2;\n }\n if (file) {\n config = await loadConfig(file);\n base = resolve(file, \"..\");\n }\n if (values.storybook)\n config = {\n ...config,\n storybook: {\n ...(typeof config.storybook === \"object\" ? config.storybook : {}),\n dir: resolve(cwd, values.storybook),\n },\n };\n if (values.baselines) config = { ...config, baselines: resolve(cwd, values.baselines) };\n if (values.output) config = { ...config, output: resolve(cwd, values.output) };\n if (values.concurrency) config = { ...config, concurrency: Number(values.concurrency) };\n if (config.storybook === undefined && config.app === undefined) {\n if (existsSync(resolve(cwd, \"storybook-static/index.json\"))) config = { ...config, storybook: \"storybook-static\" };\n else {\n console.error(`strata-visual: no config file and no Storybook build here.\\n\\n${usage}`);\n return 2;\n }\n }\n\n try {\n const report = await runVisual(config, { cwd: base, update: values.update, filter: values.filter });\n console.log(formatReport(report));\n return report.failed ? 1 : 0;\n } catch (e) {\n console.error(`strata-visual: ${(e as Error).message}`);\n return 1;\n }\n}\n"],"mappings":";;;;;;;AAYA,MAAM,QAAQ;;;;;;;;;;;;;;AAed,MAAM,cAAc;CAClB;CACA;CACA;CACA;AACF;;AAGA,eAAsB,WAAW,MAAqC;CACpE,IAAI,aAAa,KAAK,IAAI,GAAG;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,CAAC,YAAY,MAAS;EACvD,IAAI,MAAM,cAAc;GACtB,MAAM,EAAE,WAAW,MAAM,KAAK,aAAwC,IAAI;GAC1E,OAAO,OAAO;EAChB;CACF;CAEA,QAAO,MADY,OAAO,cAAc,IAAI,CAAC,CAAC,MACpC,CAAC;AACb;;AAGA,eAAsB,KAAK,MAAyB,MAAM,QAAQ,IAAI,GAAoB;CACxF,IAAI;CACJ,IAAI;EACF,CAAC,CAAE,UAAW,UAAU;GACtB,MAAM,CAAC,GAAG,IAAI;GACd,SAAS;IACP,QAAQ,EAAE,MAAM,SAAS;IACzB,WAAW,EAAE,MAAM,SAAS;IAC5B,QAAQ,EAAE,MAAM,UAAU;IAC1B,QAAQ,EAAE,MAAM,SAAS;IACzB,WAAW,EAAE,MAAM,SAAS;IAC5B,QAAQ,EAAE,MAAM,SAAS;IACzB,aAAa,EAAE,MAAM,SAAS;IAC9B,MAAM,EAAE,MAAM,UAAU;GAC1B;EACF,CAAC;CACH,SAAS,GAAG;EACV,QAAQ,MAAM,GAAI,EAAY,QAAQ,MAAM,OAAO;EACnD,OAAO;CACT;CACA,IAAI,OAAO,MAAM;EACf,QAAQ,IAAI,KAAK;EACjB,OAAO;CACT;CAEA,IAAI,SAAuB,CAAC;CAC5B,IAAI,OAAO;CACX,MAAM,OAAO,OAAO,SAChB,QAAQ,KAAK,OAAO,MAAM,IAC1B,YAAY,KAAK,MAAM,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,WAAW,CAAC,CAAC;CACrE,IAAI,OAAO,UAAU,CAAC,WAAW,IAAK,GAAG;EACvC,QAAQ,MAAM,kBAAkB,OAAO,OAAO,WAAW;EACzD,OAAO;CACT;CACA,IAAI,MAAM;EACR,SAAS,MAAM,WAAW,IAAI;EAC9B,OAAO,QAAQ,MAAM,IAAI;CAC3B;CACA,IAAI,OAAO,WACT,SAAS;EACP,GAAG;EACH,WAAW;GACT,GAAI,OAAO,OAAO,cAAc,WAAW,OAAO,YAAY,CAAC;GAC/D,KAAK,QAAQ,KAAK,OAAO,SAAS;EACpC;CACF;CACF,IAAI,OAAO,WAAW,SAAS;EAAE,GAAG;EAAQ,WAAW,QAAQ,KAAK,OAAO,SAAS;CAAE;CACtF,IAAI,OAAO,QAAQ,SAAS;EAAE,GAAG;EAAQ,QAAQ,QAAQ,KAAK,OAAO,MAAM;CAAE;CAC7E,IAAI,OAAO,aAAa,SAAS;EAAE,GAAG;EAAQ,aAAa,OAAO,OAAO,WAAW;CAAE;CACtF,IAAI,OAAO,cAAc,UAAa,OAAO,QAAQ,QAAW;EAC9D,IAAI,WAAW,QAAQ,KAAK,6BAA6B,CAAC,GAAG,SAAS;GAAE,GAAG;GAAQ,WAAW;EAAmB;OAC5G;GACH,QAAQ,MAAM,iEAAiE,OAAO;GACtF,OAAO;EACT;CACF;CAEA,IAAI;EACF,MAAM,SAAS,MAAM,UAAU,QAAQ;GAAE,KAAK;GAAM,QAAQ,OAAO;GAAQ,QAAQ,OAAO;EAAO,CAAC;EAClG,QAAQ,IAAI,aAAa,MAAM,CAAC;EAChC,OAAO,OAAO,SAAS,IAAI;CAC7B,SAAS,GAAG;EACV,QAAQ,MAAM,kBAAmB,EAAY,SAAS;EACtD,OAAO;CACT;AACF"}
@@ -0,0 +1,105 @@
1
+ import { C as encode, S as decode, _ as Image, a as Setup, b as boxBlur, c as Theme, d as VisualConfig, f as VisualReport, g as CompareResult, h as CompareOptions, i as RouteState, l as Viewport, m as BLUR, n as Clip, o as Shot, p as viewports, r as Route, s as StorybookTarget, t as AppTarget, u as ViewportChoice, v as MAX_DIFF_PIXELS, w as PinnedSystemFont, x as compare, y as THRESHOLD } from "./types-B3TsF0Ey.js";
2
+ import { Browser, Locator, Page, Request as Request$1 } from "playwright";
3
+ /** Returns the config unchanged; it exists so a config file is type-checked. */
4
+ export declare function defineVisualConfig(config: VisualConfig): VisualConfig;
5
+ /** Options for one run, usually from the command line. */
6
+ interface RunOptions {
7
+ /** Folder the config's paths are relative to. Default `process.cwd()`. */
8
+ cwd?: string;
9
+ /** Write the screenshots as the baselines and remove obsolete ones, instead of comparing. */
10
+ update?: boolean;
11
+ /** Only shots whose name contains this text (obsolete baselines are then not reported). */
12
+ filter?: string;
13
+ /** Fail when a shot has no baseline. Default: when the `CI` environment variable is set. */
14
+ ci?: boolean;
15
+ /** Progress lines; default none. */
16
+ log?: (line: string) => void;
17
+ }
18
+ /** Screenshots every shot the config describes, compares with the baselines, and reports. */
19
+ export declare function runVisual(config: VisualConfig, options?: RunOptions): Promise<VisualReport>;
20
+ /** A warning when the app's package.json lets Playwright float, since each version brings its own Chromium. */
21
+ export declare function pinWarnings(cwd: string): string[];
22
+ /** The report as the lines the command prints. */
23
+ export declare function formatReport(report: VisualReport): string;
24
+ /** The light and dark themes, the default for every target. */
25
+ export declare const defaultThemes: readonly Theme[];
26
+ /**
27
+ * Shots for every story in a built Storybook (its `index.json`), in each theme. Tags pick the
28
+ * viewport: `visual-phone` 390×844, `visual-wide` 1440×900, otherwise 1024 wide; `no-visual`
29
+ * skips the story. A story's own tag beats its file's, since Storybook merges both.
30
+ */
31
+ export declare function storybookShots(target: StorybookTarget & {
32
+ dir: string;
33
+ }, themes?: readonly Theme[]): Shot[];
34
+ /**
35
+ * Shots for every route of an app in each state, viewport and theme, named
36
+ * `route--state--viewport--theme`. A state's handlers come before the target's base handlers, as
37
+ * `server.use(...)` would put them.
38
+ */
39
+ export declare function routeShots(app: AppTarget, themes?: readonly Theme[]): Shot[];
40
+ /** Options shared by every shot of a run. */
41
+ interface CaptureOptions {
42
+ /** Where `shot.path` resolves, ending in `/`. */
43
+ baseUrl: string;
44
+ time?: string | number | Date;
45
+ timezone?: string;
46
+ locale?: string;
47
+ /** Block service workers (an app's own MSW worker or PWA cache would bypass the handlers). */
48
+ blockServiceWorkers?: boolean;
49
+ onUnhandledRequest?: "error" | "bypass";
50
+ /** Look up which faces drew the page's text and return the ones that are not web fonts. Default true. */
51
+ checkFonts?: boolean;
52
+ /** A family the runner pinned every system family to (`systemFonts: { pin }`): text drawn in it is deterministic, so it is not reported. */
53
+ pinnedFamily?: string;
54
+ /** Scroll a page taller than the window through before the shot, so pictures that wait until they are near the window have loaded (issue #273). Default true. */
55
+ scrollThrough?: boolean;
56
+ }
57
+ /** What one shot produced. */
58
+ interface Capture {
59
+ png: Buffer;
60
+ /** Page errors, console errors and unanswered requests. */
61
+ problems: string[];
62
+ /**
63
+ * Text drawn in a font installed on this machine rather than one the page loaded, one line per
64
+ * face with an example element, e.g. `"DejaVu Sans" in <kbd> "⌘K"`. Such text renders
65
+ * differently on every machine, so the runner fails the shot (see {@link VisualConfig.systemFonts}).
66
+ */
67
+ systemFonts: string[];
68
+ }
69
+ /** Resolves a shot's path under the base URL, keeping the base's own path (`/app/` + `/review`). */
70
+ export declare function resolveShotUrl(path: string, baseUrl: string): string;
71
+ /** Converts a request the page made into a Fetch `Request` MSW can match. */
72
+ export declare function toFetchRequest(request: Pick<Request$1, "url" | "method" | "headers" | "postDataBuffer">): Request;
73
+ /** Takes one shot and returns its PNG, or throws with what went wrong. Page and console errors are returned as problems. */
74
+ export declare function capture(browser: Browser, shot: Shot, options: CaptureOptions): Promise<Capture>;
75
+ /** A file to drop. */
76
+ interface DroppedFile {
77
+ name: string;
78
+ /** The file's bytes, or its text. */
79
+ content: string | Uint8Array;
80
+ /** MIME type. Default "application/octet-stream". */
81
+ type?: string;
82
+ /** Milliseconds since the epoch. Fixed by default (2026-01-01 UTC), so a date shown from the file never changes between runs. */
83
+ lastModified?: number;
84
+ }
85
+ /** What `dropFiles` uses when a file gives no `lastModified`. */
86
+ export declare const DROPPED_FILE_MODIFIED: number;
87
+ /**
88
+ * Drops files on a target as a person dragging them in from the desktop would: `dragenter`,
89
+ * `dragover` and `drop`, with a data transfer that holds the files and file-system entries. The
90
+ * target is a selector or a Playwright `Locator`; it must be on screen.
91
+ */
92
+ export declare function dropFiles(page: Page, target: string | Locator, files: DroppedFile[]): Promise<void>;
93
+ /** A running server: its origin plus base, and how to stop it. */
94
+ interface StaticServer {
95
+ /** e.g. `http://127.0.0.1:53121/app/` (always ends in `/`). */
96
+ url: string;
97
+ close(): Promise<void>;
98
+ }
99
+ /** Serves `dir` on 127.0.0.1 under `base`, with history fallback to `index.html` when `spa` is set. */
100
+ export declare function serveStatic(dir: string, { spa, base }?: {
101
+ spa?: boolean;
102
+ base?: string;
103
+ }): Promise<StaticServer>;
104
+ export { type AppTarget, BLUR, type Capture, type CaptureOptions, type Clip, type CompareOptions, type CompareResult, type DroppedFile, type Image, MAX_DIFF_PIXELS, type PinnedSystemFont, type Route, type RouteState, type RunOptions, type Setup, type Shot, type StaticServer, type StorybookTarget, THRESHOLD, type Theme, type Viewport, type ViewportChoice, type VisualConfig, type VisualReport, boxBlur, compare, decode, encode, viewports };
105
+ //# sourceMappingURL=visual.d.ts.map
package/dist/visual.js CHANGED
@@ -1,7 +1,8 @@
1
- import { _ as capture, a as defaultThemes, c as viewports, d as MAX_DIFF_PIXELS, f as THRESHOLD, g as encode, h as decode, i as runVisual, l as serveStatic, m as compare, n as formatReport, o as routeShots, p as boxBlur, r as pinWarnings, s as storybookShots, t as defineVisualConfig, u as BLUR, v as resolveShotUrl, y as toFetchRequest } from "./run-BT2WKzMz.js";
1
+ import { _ as capture, a as defaultThemes, c as viewports, d as MAX_DIFF_PIXELS, f as THRESHOLD, g as encode, h as decode, i as runVisual, l as serveStatic, m as compare, n as formatReport, o as routeShots, p as boxBlur, r as pinWarnings, s as storybookShots, t as defineVisualConfig, u as BLUR, v as resolveShotUrl, y as toFetchRequest } from "./run-D_Ic1jE7.js";
2
+
2
3
  // src/visual/drop.ts
3
4
  /** What `dropFiles` uses when a file gives no `lastModified`. */
4
- var DROPPED_FILE_MODIFIED = Date.UTC(2026, 0, 1);
5
+ const DROPPED_FILE_MODIFIED = Date.UTC(2026, 0, 1);
5
6
  /**
6
7
  * Drops files on a target as a person dragging them in from the desktop would: `dragenter`,
7
8
  * `dragover` and `drop`, with a data transfer that holds the files and file-system entries. The
@@ -63,6 +64,6 @@ async function dropFiles(page, target, files) {
63
64
  }
64
65
  }, payload);
65
66
  }
66
- export { BLUR, DROPPED_FILE_MODIFIED, MAX_DIFF_PIXELS, THRESHOLD, boxBlur, capture, compare, decode, defaultThemes, defineVisualConfig, dropFiles, encode, formatReport, pinWarnings, resolveShotUrl, routeShots, runVisual, serveStatic, storybookShots, toFetchRequest, viewports };
67
67
 
68
+ export { BLUR, DROPPED_FILE_MODIFIED, MAX_DIFF_PIXELS, THRESHOLD, boxBlur, capture, compare, decode, defaultThemes, defineVisualConfig, dropFiles, encode, formatReport, pinWarnings, resolveShotUrl, routeShots, runVisual, serveStatic, storybookShots, toFetchRequest, viewports };
68
69
  //# sourceMappingURL=visual.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"visual.js","names":[],"sources":["../src/visual/drop.ts"],"sourcesContent":["// Dropping files on a target in a visual flow (strata-react issue #136, from strata-vid).\n// Why not the obvious ways: a `DataTransfer` built in the page has no file-system entry, and React\n// Aria's drop handling skips a file item whose `webkitGetAsEntry()` returns null (it reads the entry\n// to tell a file from a folder); the file chooser instead gives each file the `lastModified` of the\n// moment of the run, so any date the app shows from it changes every run. So the drop is built here:\n// the bytes, name, type and a fixed `lastModified` go into real `File`s, and the data transfer the\n// events carry answers `webkitGetAsEntry()` with a file entry. Native drag events are dispatched, so\n// the app's handlers (React's or React Aria's) see what a browser's drop gives them.\nimport type { Locator, Page } from \"playwright\";\n\n/** A file to drop. */\nexport interface DroppedFile {\n name: string;\n /** The file's bytes, or its text. */\n content: string | Uint8Array;\n /** MIME type. Default \"application/octet-stream\". */\n type?: string;\n /** Milliseconds since the epoch. Fixed by default (2026-01-01 UTC), so a date shown from the file never changes between runs. */\n lastModified?: number;\n}\n\n/** What `dropFiles` uses when a file gives no `lastModified`. */\nexport const DROPPED_FILE_MODIFIED = Date.UTC(2026, 0, 1);\n\n/**\n * Drops files on a target as a person dragging them in from the desktop would: `dragenter`,\n * `dragover` and `drop`, with a data transfer that holds the files and file-system entries. The\n * target is a selector or a Playwright `Locator`; it must be on screen.\n */\nexport async function dropFiles(page: Page, target: string | Locator, files: DroppedFile[]): Promise<void> {\n const locator = typeof target === \"string\" ? page.locator(target).first() : target.first();\n const payload = files.map((f) => ({\n name: f.name,\n type: f.type ?? \"application/octet-stream\",\n lastModified: f.lastModified ?? DROPPED_FILE_MODIFIED,\n bytes: Array.from(typeof f.content === \"string\" ? new TextEncoder().encode(f.content) : f.content),\n }));\n await locator.evaluate((element, list) => {\n const made = list.map((f) => new File([new Uint8Array(f.bytes)], f.name, { type: f.type, lastModified: f.lastModified }));\n const items = made.map((file) => ({\n kind: \"file\" as const,\n type: file.type,\n getAsFile: () => file,\n getAsString: () => {},\n webkitGetAsEntry: () => ({\n isFile: true,\n isDirectory: false,\n name: file.name,\n fullPath: `/${file.name}`,\n file: (ok: (f: File) => void) => ok(file),\n }),\n }));\n const transfer = { dropEffect: \"copy\", effectAllowed: \"all\", types: [\"Files\"], files: made, items, getData: () => \"\", setData: () => {}, clearData: () => {}, setDragImage: () => {} };\n const rect = element.getBoundingClientRect();\n const at = { clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2 };\n for (const type of [\"dragenter\", \"dragover\", \"drop\"]) {\n const event = new DragEvent(type, { bubbles: true, cancelable: true, ...at });\n Object.defineProperty(event, \"dataTransfer\", { value: transfer });\n element.dispatchEvent(event);\n }\n }, payload);\n}\n"],"mappings":";;;AAsBA,IAAa,wBAAwB,KAAK,IAAI,MAAM,GAAG,CAAC;;;;;;AAOxD,eAAsB,UAAU,MAAY,QAA0B,OAAqC;CACzG,MAAM,UAAU,OAAO,WAAW,WAAW,KAAK,QAAQ,MAAM,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM;CACzF,MAAM,UAAU,MAAM,KAAK,OAAO;EAChC,MAAM,EAAE;EACR,MAAM,EAAE,QAAQ;EAChB,cAAc,EAAE,gBAAgB;EAChC,OAAO,MAAM,KAAK,OAAO,EAAE,YAAY,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,OAAO;CACnG,EAAE;CACF,MAAM,QAAQ,UAAU,SAAS,SAAS;EACxC,MAAM,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,WAAW,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM;GAAE,MAAM,EAAE;GAAM,cAAc,EAAE;EAAa,CAAC,CAAC;EAcxH,MAAM,WAAW;GAAE,YAAY;GAAQ,eAAe;GAAO,OAAO,CAAC,OAAO;GAAG,OAAO;GAAM,OAb9E,KAAK,KAAK,UAAU;IAChC,MAAM;IACN,MAAM,KAAK;IACX,iBAAiB;IACjB,mBAAmB,CAAC;IACpB,yBAAyB;KACvB,QAAQ;KACR,aAAa;KACb,MAAM,KAAK;KACX,UAAU,IAAI,KAAK;KACnB,OAAO,OAA0B,GAAG,IAAI;IAC1C;GACF,EAC4F;GAAO,eAAe;GAAI,eAAe,CAAC;GAAG,iBAAiB,CAAC;GAAG,oBAAoB,CAAC;EAAE;EACrL,MAAM,OAAO,QAAQ,sBAAsB;EAC3C,MAAM,KAAK;GAAE,SAAS,KAAK,OAAO,KAAK,QAAQ;GAAG,SAAS,KAAK,MAAM,KAAK,SAAS;EAAE;EACtF,KAAK,MAAM,QAAQ;GAAC;GAAa;GAAY;EAAM,GAAG;GACpD,MAAM,QAAQ,IAAI,UAAU,MAAM;IAAE,SAAS;IAAM,YAAY;IAAM,GAAG;GAAG,CAAC;GAC5E,OAAO,eAAe,OAAO,gBAAgB,EAAE,OAAO,SAAS,CAAC;GAChE,QAAQ,cAAc,KAAK;EAC7B;CACF,GAAG,OAAO;AACZ"}
1
+ {"version":3,"file":"visual.js","names":[],"sources":["../src/visual/drop.ts"],"sourcesContent":["// Dropping files on a target in a visual flow (strata-react issue #136, from strata-vid).\n// Why not the obvious ways: a `DataTransfer` built in the page has no file-system entry, and React\n// Aria's drop handling skips a file item whose `webkitGetAsEntry()` returns null (it reads the entry\n// to tell a file from a folder); the file chooser instead gives each file the `lastModified` of the\n// moment of the run, so any date the app shows from it changes every run. So the drop is built here:\n// the bytes, name, type and a fixed `lastModified` go into real `File`s, and the data transfer the\n// events carry answers `webkitGetAsEntry()` with a file entry. Native drag events are dispatched, so\n// the app's handlers (React's or React Aria's) see what a browser's drop gives them.\nimport type { Locator, Page } from \"playwright\";\n\n/** A file to drop. */\nexport interface DroppedFile {\n name: string;\n /** The file's bytes, or its text. */\n content: string | Uint8Array;\n /** MIME type. Default \"application/octet-stream\". */\n type?: string;\n /** Milliseconds since the epoch. Fixed by default (2026-01-01 UTC), so a date shown from the file never changes between runs. */\n lastModified?: number;\n}\n\n/** What `dropFiles` uses when a file gives no `lastModified`. */\nexport const DROPPED_FILE_MODIFIED = Date.UTC(2026, 0, 1);\n\n/**\n * Drops files on a target as a person dragging them in from the desktop would: `dragenter`,\n * `dragover` and `drop`, with a data transfer that holds the files and file-system entries. The\n * target is a selector or a Playwright `Locator`; it must be on screen.\n */\nexport async function dropFiles(page: Page, target: string | Locator, files: DroppedFile[]): Promise<void> {\n const locator = typeof target === \"string\" ? page.locator(target).first() : target.first();\n const payload = files.map((f) => ({\n name: f.name,\n type: f.type ?? \"application/octet-stream\",\n lastModified: f.lastModified ?? DROPPED_FILE_MODIFIED,\n bytes: Array.from(typeof f.content === \"string\" ? new TextEncoder().encode(f.content) : f.content),\n }));\n await locator.evaluate((element, list) => {\n const made = list.map(\n (f) => new File([new Uint8Array(f.bytes)], f.name, { type: f.type, lastModified: f.lastModified }),\n );\n const items = made.map((file) => ({\n kind: \"file\" as const,\n type: file.type,\n getAsFile: () => file,\n getAsString: () => {},\n webkitGetAsEntry: () => ({\n isFile: true,\n isDirectory: false,\n name: file.name,\n fullPath: `/${file.name}`,\n file: (ok: (f: File) => void) => ok(file),\n }),\n }));\n const transfer = {\n dropEffect: \"copy\",\n effectAllowed: \"all\",\n types: [\"Files\"],\n files: made,\n items,\n getData: () => \"\",\n setData: () => {},\n clearData: () => {},\n setDragImage: () => {},\n };\n const rect = element.getBoundingClientRect();\n const at = { clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2 };\n for (const type of [\"dragenter\", \"dragover\", \"drop\"]) {\n const event = new DragEvent(type, { bubbles: true, cancelable: true, ...at });\n Object.defineProperty(event, \"dataTransfer\", { value: transfer });\n element.dispatchEvent(event);\n }\n }, payload);\n}\n"],"mappings":";;;;AAsBA,MAAa,wBAAwB,KAAK,IAAI,MAAM,GAAG,CAAC;;;;;;AAOxD,eAAsB,UAAU,MAAY,QAA0B,OAAqC;CACzG,MAAM,UAAU,OAAO,WAAW,WAAW,KAAK,QAAQ,MAAM,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM;CACzF,MAAM,UAAU,MAAM,KAAK,OAAO;EAChC,MAAM,EAAE;EACR,MAAM,EAAE,QAAQ;EAChB,cAAc,EAAE,gBAAgB;EAChC,OAAO,MAAM,KAAK,OAAO,EAAE,YAAY,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,OAAO;CACnG,EAAE;CACF,MAAM,QAAQ,UAAU,SAAS,SAAS;EACxC,MAAM,OAAO,KAAK,KACf,MAAM,IAAI,KAAK,CAAC,IAAI,WAAW,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM;GAAE,MAAM,EAAE;GAAM,cAAc,EAAE;EAAa,CAAC,CACnG;EAcA,MAAM,WAAW;GACf,YAAY;GACZ,eAAe;GACf,OAAO,CAAC,OAAO;GACf,OAAO;GACP,OAlBY,KAAK,KAAK,UAAU;IAChC,MAAM;IACN,MAAM,KAAK;IACX,iBAAiB;IACjB,mBAAmB,CAAC;IACpB,yBAAyB;KACvB,QAAQ;KACR,aAAa;KACb,MAAM,KAAK;KACX,UAAU,IAAI,KAAK;KACnB,OAAO,OAA0B,GAAG,IAAI;IAC1C;GACF,EAMM;GACJ,eAAe;GACf,eAAe,CAAC;GAChB,iBAAiB,CAAC;GAClB,oBAAoB,CAAC;EACvB;EACA,MAAM,OAAO,QAAQ,sBAAsB;EAC3C,MAAM,KAAK;GAAE,SAAS,KAAK,OAAO,KAAK,QAAQ;GAAG,SAAS,KAAK,MAAM,KAAK,SAAS;EAAE;EACtF,KAAK,MAAM,QAAQ;GAAC;GAAa;GAAY;EAAM,GAAG;GACpD,MAAM,QAAQ,IAAI,UAAU,MAAM;IAAE,SAAS;IAAM,YAAY;IAAM,GAAG;GAAG,CAAC;GAC5E,OAAO,eAAe,OAAO,gBAAgB,EAAE,OAAO,SAAS,CAAC;GAChE,QAAQ,cAAc,KAAK;EAC7B;CACF,GAAG,OAAO;AACZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strata-react",
3
- "version": "1.3.25",
3
+ "version": "1.3.27",
4
4
  "description": "React + Tailwind v4 components that ship structure, behaviour, states and a token contract, and no look: each product brings a theme generated from its own subject.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,17 +20,17 @@
20
20
  "default": "./dist/index.js"
21
21
  },
22
22
  "./testing": {
23
- "types": "./dist/testing/index.d.ts",
23
+ "types": "./dist/testing.d.ts",
24
24
  "import": "./dist/testing.js",
25
25
  "default": "./dist/testing.js"
26
26
  },
27
27
  "./visual": {
28
- "types": "./dist/visual/index.d.ts",
28
+ "types": "./dist/visual.d.ts",
29
29
  "import": "./dist/visual.js",
30
30
  "default": "./dist/visual.js"
31
31
  },
32
32
  "./map": {
33
- "types": "./dist/map/index.d.ts",
33
+ "types": "./dist/map.d.ts",
34
34
  "import": "./dist/map.js",
35
35
  "default": "./dist/map.js"
36
36
  },
@@ -52,22 +52,22 @@
52
52
  },
53
53
  "./package.json": "./package.json",
54
54
  "./hls": {
55
- "types": "./dist/hls/index.d.ts",
55
+ "types": "./dist/hls.d.ts",
56
56
  "import": "./dist/hls.js",
57
57
  "default": "./dist/hls.js"
58
58
  },
59
59
  "./panorama": {
60
- "types": "./dist/panorama/index.d.ts",
60
+ "types": "./dist/panorama.d.ts",
61
61
  "import": "./dist/panorama.js",
62
62
  "default": "./dist/panorama.js"
63
63
  },
64
64
  "./scene": {
65
- "types": "./dist/scene/index.d.ts",
65
+ "types": "./dist/scene.d.ts",
66
66
  "import": "./dist/scene.js",
67
67
  "default": "./dist/scene.js"
68
68
  },
69
69
  "./api-types": {
70
- "types": "./dist/api-types/index.d.ts",
70
+ "types": "./dist/api-types.d.ts",
71
71
  "import": "./dist/api-types.js",
72
72
  "default": "./dist/api-types.js"
73
73
  }
@@ -80,13 +80,13 @@
80
80
  ],
81
81
  "scripts": {
82
82
  "clean": "node scripts/clean.mjs",
83
- "build": "npm run clean && vite build && node scripts/copy-css.mjs",
83
+ "build": "npm run clean && vp pack && node scripts/copy-css.mjs",
84
84
  "typecheck": "node node_modules/typescript7/bin/tsc --noEmit",
85
- "test": "npm run typecheck && npm run test:unit",
86
- "test:unit": "vitest run --project unit",
87
- "test:integration": "npm run build && vitest run --project integration",
85
+ "test": "npm run typecheck && npm run check && npm run test:unit",
86
+ "test:unit": "vp test run --project unit",
87
+ "test:integration": "npm run build && vp test run --project integration",
88
88
  "test:all": "npm run test && npm run test:integration",
89
- "coverage": "vitest run --project unit --coverage",
89
+ "coverage": "vp test run --project unit --coverage",
90
90
  "storybook": "storybook dev -p 6006",
91
91
  "build-storybook": "storybook build --quiet -o storybook-static",
92
92
  "test:visual": "npm run build && npm run build-storybook && npm run build-example && node bin/strata-visual.js",
@@ -95,7 +95,9 @@
95
95
  "prepublishOnly": "npm run test:all",
96
96
  "docs:api": "typedoc",
97
97
  "site": "npm run build-storybook && typedoc && node scripts/build-site.mjs",
98
- "build-example": "vite build --config examples/kiln-app/vite.config.ts --logLevel warn"
98
+ "build-example": "vp build --config examples/kiln-app/vite.config.ts --logLevel warn",
99
+ "check": "vp check --deny-warnings",
100
+ "fmt": "vp fmt"
99
101
  },
100
102
  "keywords": [
101
103
  "react",
@@ -178,7 +180,7 @@
178
180
  "@types/react": "^19.3.0",
179
181
  "@types/react-dom": "^19.3.0",
180
182
  "@vitejs/plugin-react": "^6.2.1",
181
- "@vitest/coverage-v8": "^5.1.0",
183
+ "@vitest/coverage-v8": "5.1.1",
182
184
  "hls.js": "^1.7.4",
183
185
  "jsdom": "^31.0.0",
184
186
  "leaflet": "^1.9.4",
@@ -195,9 +197,9 @@
195
197
  "typedoc": "^0.28.20",
196
198
  "typescript": "npm:@typescript/typescript6@~6.0.2",
197
199
  "typescript7": "npm:typescript@~7.0.2",
198
- "vite": "^8.3.6",
199
- "vite-plugin-dts": "^5.1.2",
200
- "vitest": "^5.1.0"
200
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001",
201
+ "vitest": "5.1.1",
202
+ "vite-plus": "1.8.0"
201
203
  },
202
204
  "engines": {
203
205
  "node": ">=26.0.0"
@@ -215,6 +217,9 @@
215
217
  "overrides": {
216
218
  "openapi-typescript": {
217
219
  "typescript": "$typescript"
218
- }
220
+ },
221
+ "vite-plus": "$vite-plus",
222
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001",
223
+ "vitest": "5.1.1"
219
224
  }
220
225
  }
@@ -1 +0,0 @@
1
- export { generateApiTypes, loadSchema, type OpenApiDocument } from './generate';
@@ -1 +0,0 @@
1
- {"version":3,"file":"button-KGJI6jQr.js","names":["Button","AriaButton","Tooltip"],"sources":["../src/lib/in-view.ts","../src/lib/dev.ts","../src/components/button.tsx"],"sourcesContent":["import * as React from \"react\";\n\n// One IntersectionObserver hook for everything that waits until it is near the screen: the\n// sentinel at the end of an InfiniteList and an image in a Thumbnail. Both watch from the nearest\n// `[data-strata-scroll]` region (a VirtualList's) or else the viewport, with a root\n// margin so the work starts before the element is reached. They differ in two ways, which are\n// options rather than two hooks:\n//\n// - `once`: an image, once asked for, stays asked for; scrolling it away again must not unload it.\n// A sentinel reports in and out of view every time.\n// - `unsupported`: where there is no IntersectionObserver (an old browser, a test without the\n// fake), an image loads at once, because a photo that never loads is worse than one loaded\n// early. A sentinel reports out of view, because InfiniteList's Show more button is the path\n// that always works.\n\n/** Options for {@link useInView}. */\nexport type InViewOptions = {\n /** Watch only while this is true. Default true. */\n active?: boolean;\n /** How far outside the scroll region still counts as in view (IntersectionObserver `rootMargin`). */\n rootMargin?: string;\n /** Stay in view after the first time, and stop watching. */\n once?: boolean;\n /** What to report where `IntersectionObserver` does not exist. Default false. */\n unsupported?: boolean;\n};\n\n/**\n * Whether an element is within `rootMargin` of its scroll region (the nearest\n * `[data-strata-scroll]` ancestor, else the viewport). Returns a callback ref, so it follows the\n * element as it mounts and unmounts.\n */\nexport function useInView({ active = true, rootMargin = \"0px\", once = false, unsupported = false }: InViewOptions = {}) {\n const [inView, setInView] = React.useState(false);\n const [el, setEl] = React.useState<Element | null>(null);\n const seen = once && inView;\n React.useEffect(() => {\n if (seen) return;\n if (!active || !el) {\n setInView(false);\n return;\n }\n if (typeof IntersectionObserver === \"undefined\") {\n setInView(unsupported);\n return;\n }\n const root = el.parentElement?.closest<HTMLElement>(\"[data-strata-scroll]\") ?? null;\n const observer = new IntersectionObserver((entries) => setInView(entries[entries.length - 1].isIntersecting), { root, rootMargin });\n observer.observe(el);\n return () => observer.disconnect();\n }, [active, el, rootMargin, seen, unsupported]);\n return { ref: setEl, inView };\n}\n","// Development-only checks (a warning for a mistake a type cannot catch). `import.meta.env.DEV` is\n// replaced by the library build itself, so in the published package it is always false and the check\n// never runs in an app's development. `process.env.NODE_ENV` is left for the app's bundler to replace\n// (Vite, webpack and the rest do, in dependencies too), so the app decides. Where nothing replaces it\n// `process` does not exist, and the check is off.\n\n/** Whether the app is running in development, decided by the app's bundler. */\nexport function isDev(): boolean {\n try {\n return process.env.NODE_ENV !== \"production\";\n } catch {\n return false;\n }\n}\n","import * as React from \"react\";\nimport { Button as AriaButton, type PressEvent } from \"react-aria-components\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { IconComponent } from \"../lib/icon\";\nimport { cn } from \"../lib/utils\";\nimport type { ControlSize } from \"../lib/control\";\nimport { Tooltip } from \"./tooltip\";\nimport { isDev } from \"../lib/dev\";\n\n// Variant names are shadcn's, so copied code and agents' prior knowledge still work. Two things\n// differ on purpose:\n// 1. The default variant is `outline`, not the filled accent. A bare <Button> is the restrained\n// one; the accent (`variant=\"default\"`) has to be asked for, once per view. Generated app screens\n// put the accent on every button; 12 of 23 real product screens had no filled primary at all.\n// 2. Heights come from --control-h, shared with Input and NativeSelect, so density changes move\n// every control together.\n// 3. React Aria is the primitives layer (CLAUDE.md, \"The stack\"): behaviour and accessibility come\n// from it, the look from our tokens. `asChild`/`Slot` is gone; a button that navigates is a link.\n// 4. `press`: the button gives 2% under a click or a finger, over 100ms. Buttons are used tens of\n// times a day, so that is all the motion they get (character.md, the frequency budget).\n// 5. `title` is refused, not passed through (issue #231). React Aria's `Button` does not forward it,\n// so a tip moved over from a native button vanished with nothing said. Passing it through would\n// give a tip that has no keyboard focus, no touch and a long, unstyled delay; the answer is a\n// `Tooltip` (and `IconButton`'s `label` and `hint`). The type says so (`title?: never`) and, for\n// an untyped caller, so does a development warning. A button whose only child is one symbol\n// (`✕`, `−`, `+`) has no accessible name from its text and gets a development warning too.\nexport const buttonVariants = cva(\n \"inline-flex max-w-full shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control type-label transition-state press disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-(--control-icon) [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary-10\",\n outline: \"border border-input bg-background text-foreground hover:bg-muted\",\n secondary: \"bg-muted text-foreground hover:bg-neutral-4\",\n ghost: \"text-foreground hover:bg-muted\",\n destructive: \"bg-destructive text-destructive-foreground hover:bg-danger\",\n link: \"h-auto px-0 text-primary-11 underline underline-offset-4 hover:text-primary-12\",\n },\n size: {\n default: \"h-(--control-h) px-(--control-px)\",\n sm: \"h-(--control-h-sm) px-(--control-px-sm)\",\n icon: \"size-(--control-h)\",\n \"icon-sm\": \"size-(--control-h-sm)\",\n },\n },\n defaultVariants: { variant: \"outline\", size: \"default\" },\n },\n);\n\nexport type ButtonProps = Omit<React.ComponentProps<\"button\">, \"className\" | \"style\" | \"title\"> &\n VariantProps<typeof buttonVariants> & {\n className?: string;\n /** Not accepted: a `title` is a poor tooltip (no keyboard focus, no touch) and React Aria's button drops it. Wrap the button in a `Tooltip`, or use `IconButton`'s `label` and `hint`. */\n title?: never;\n /** React Aria's press event (mouse, touch, pen and keyboard alike). `onClick` also works. */\n onPress?: (event: PressEvent) => void;\n /** When a press begins and ends: for a control that acts while held (a nudge that repeats). */\n onPressStart?: (event: PressEvent) => void;\n onPressEnd?: (event: PressEvent) => void;\n };\n\n/**\n * A button with shadcn's variant names, built on React Aria's `Button` (press handling that behaves\n * the same for mouse, touch, pen and keyboard, focus-visible and hover state). The default variant is\n * `outline`; ask for the filled accent (`variant=\"default\"`) once per view. `type` defaults to `button`.\n * `onClick` and `disabled` are the DOM names and keep working; `onPress` is also accepted.\n */\nexport function Button({ className, variant, size, type = \"button\", disabled, children, \"aria-busy\": ariaBusy, ...props }: ButtonProps) {\n // React Aria's button drops `aria-busy` (it forwards only the aria props it knows), so it is set\n // on the element here; a pending row action says it is busy to a screen reader (issue #248).\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (ariaBusy) el.setAttribute(\"aria-busy\", String(ariaBusy));\n else el.removeAttribute(\"aria-busy\");\n }, [ariaBusy]);\n if (isDev()) warnOnLoss(props as Record<string, unknown>, children);\n // data-variant says which variant was drawn, so a test can check \"one filled button per view\"\n // without reading class names (strata-react issue #48, `filledButtons` in strata-react/testing).\n return (\n <AriaButton\n ref={ref}\n type={type}\n isDisabled={disabled}\n data-variant={variant ?? \"outline\"}\n className={cn(buttonVariants({ variant, size }), className)}\n {...(props as object)}\n >\n {/* A text label that cannot fit its column is cut with an ellipsis, not drawn past the button (issue #116). */}\n {typeof children === \"string\" ? <span className=\"min-w-0 truncate\">{children}</span> : children}\n </AriaButton>\n );\n}\n\n/** Development only: what a native button had that this one loses or cannot name (issue #231). */\nfunction warnOnLoss(props: Record<string, unknown>, children: React.ReactNode) {\n if (props.title !== undefined && !warned.has(\"title\")) {\n warned.add(\"title\");\n console.warn(\"strata-react: Button does not pass `title` through (React Aria's button drops it, and a title has no keyboard or touch). Wrap the button in a `Tooltip`, or use IconButton's `label` and `hint`.\");\n }\n const glyph = typeof children === \"string\" ? children.trim() : \"\";\n if (glyph && Array.from(glyph).length === 1 && !/[\\p{L}\\p{N}]/u.test(glyph) && !props[\"aria-label\"] && !props[\"aria-labelledby\"] && !warned.has(\"glyph\")) {\n warned.add(\"glyph\");\n console.warn(`strata-react: a Button whose only content is \"${glyph}\" has no accessible name. Give it an aria-label, or use an IconButton with a label.`);\n }\n}\nconst warned = new Set<string>();\n\n// An icon-only button cannot be written without a name: `label` is required by the type, becomes\n// the accessible name and is shown as a `Tooltip` on hover and keyboard focus, so the name and the\n// visible hint come from one string and cannot drift. This makes the most common generated\n// accessibility defect (an unlabelled icon button) a compile error instead of an audit finding.\nexport type IconButtonProps = Omit<ButtonProps, \"size\" | \"children\" | \"aria-label\"> & {\n /** `sm` is --control-h-sm, the height of a small `Toggle` or `Button`, for a toolbar or property row. Default --control-h. */\n size?: ControlSize;\n icon: IconComponent;\n label: string;\n /** Shown after the label in its tooltip, muted: \"Ctrl+Z\". */\n hint?: React.ReactNode;\n};\n\n/** An icon-only button. `label` is required and becomes the accessible name and the tooltip (hover and keyboard focus); `hint` adds a muted aside to it, such as a shortcut. */\nexport function IconButton({ icon: Icon, label, hint, variant = \"ghost\", size = \"default\", ...props }: IconButtonProps) {\n return (\n <Tooltip label={label} hint={hint}>\n <Button size={size === \"sm\" ? \"icon-sm\" : \"icon\"} variant={variant} aria-label={label} {...props}>\n <Icon aria-hidden />\n </Button>\n </Tooltip>\n );\n}\n\n// A row action says what it does in the row (\"Withdraw\") and whom it does it to in its name\n// (\"Withdraw Tom Ellery\"): a table of eight \"Withdraw\" buttons is eight identical names in a\n// screen reader's list of controls. The name is an aria-label that starts with the visible verb,\n// so it meets WCAG 2.5.3 (label in name) and voice control still finds it by \"Withdraw\". Visually\n// hidden suffix text is not used: a hidden span joined to the verb did not form a name with its\n// space in dom-testing-library (strata-react issue #11). Ghost and small, one per row, shown only\n// on the rows where it applies; an icon-only row action is an `IconButton` whose `label` names the\n// row the same way. It keeps the row's pitch: rows with and without the action are the same height.\nexport type RowActionProps = Omit<ButtonProps, \"children\" | \"aria-label\"> & {\n /** The visible verb, sentence case: \"Withdraw\", \"Remove\". */\n label: string;\n /** What the row is, as a person would say it: \"Tom Ellery\", \"Moonbeam\". Completes the accessible name. */\n subject: string;\n icon?: IconComponent;\n};\n\n/** A small ghost action for one table row: shows `label`, and is named \"`label` `subject`\" so every row's action has its own name. */\nexport function RowAction({ label, subject, icon: Icon, variant = \"ghost\", size = \"sm\", className, ...props }: RowActionProps) {\n // -my-1.5 lets the 32px button sit in the 20px line of a table row, inside the row's padding, so\n // rows with an action keep the same pitch as rows without one.\n return (\n <Button variant={variant} size={size} aria-label={`${label} ${subject}`} className={cn(\"-my-1.5\", className)} {...props}>\n {Icon && <Icon aria-hidden />}\n {label}\n </Button>\n );\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgB,UAAU,EAAE,SAAS,MAAM,aAAa,OAAO,OAAO,OAAO,cAAc,UAAyB,CAAC,GAAG;CACtH,MAAM,CAAC,QAAQ,aAAa,MAAM,SAAS,KAAK;CAChD,MAAM,CAAC,IAAI,SAAS,MAAM,SAAyB,IAAI;CACvD,MAAM,OAAO,QAAQ;CACrB,MAAM,gBAAgB;EACpB,IAAI,MAAM;EACV,IAAI,CAAC,UAAU,CAAC,IAAI;GAClB,UAAU,KAAK;GACf;EACF;EACA,IAAI,OAAO,yBAAyB,aAAa;GAC/C,UAAU,WAAW;GACrB;EACF;EACA,MAAM,OAAO,GAAG,eAAe,QAAqB,sBAAsB,KAAK;EAC/E,MAAM,WAAW,IAAI,sBAAsB,YAAY,UAAU,QAAQ,QAAQ,SAAS,EAAE,CAAC,cAAc,GAAG;GAAE;GAAM;EAAW,CAAC;EAClI,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG;EAAC;EAAQ;EAAI;EAAY;EAAM;CAAW,CAAC;CAC9C,OAAO;EAAE,KAAK;EAAO;CAAO;AAC9B;;;AC7CA,SAAgB,QAAiB;CAC/B,IAAI;EACF,OAAA,QAAA,IAAA,aAAgC;CAClC,QAAQ;EACN,OAAO;CACT;AACF;;ACaA,IAAa,iBAAiB,IAC5B,oRACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SAAS;GACT,WAAW;GACX,OAAO;GACP,aAAa;GACb,MAAM;EACR;EACA,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,MAAM;GACN,WAAW;EACb;CACF;CACA,iBAAiB;EAAE,SAAS;EAAW,MAAM;CAAU;AACzD,CACF;;;;;;;AAoBA,SAAgBA,SAAO,EAAE,WAAW,SAAS,MAAM,OAAO,UAAU,UAAU,UAAU,aAAa,UAAU,GAAG,SAAsB;CAGtI,MAAM,MAAM,MAAM,OAA0B,IAAI;CAChD,MAAM,gBAAgB;EACpB,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,IAAI;EACT,IAAI,UAAU,GAAG,aAAa,aAAa,OAAO,QAAQ,CAAC;OACtD,GAAG,gBAAgB,WAAW;CACrC,GAAG,CAAC,QAAQ,CAAC;CACb,IAAI,MAAM,GAAG,WAAW,OAAkC,QAAQ;CAGlE,OACE,oBAACC,QAAD;EACO;EACC;EACN,YAAY;EACZ,gBAAc,WAAW;EACzB,WAAW,GAAG,eAAe;GAAE;GAAS;EAAK,CAAC,GAAG,SAAS;EAC1D,GAAK;EAGJ,UAAA,OAAO,aAAa,WAAW,oBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,IAAI;CAC7E,CAAA;AAEhB;;AAGA,SAAS,WAAW,OAAgC,UAA2B;CAC7E,IAAI,MAAM,UAAU,KAAA,KAAa,CAAC,OAAO,IAAI,OAAO,GAAG;EACrD,OAAO,IAAI,OAAO;EAClB,QAAQ,KAAK,kMAAkM;CACjN;CACA,MAAM,QAAQ,OAAO,aAAa,WAAW,SAAS,KAAK,IAAI;CAC/D,IAAI,SAAS,MAAM,KAAK,KAAK,CAAC,CAAC,WAAW,KAAK,CAAC,gBAAgB,KAAK,KAAK,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,sBAAsB,CAAC,OAAO,IAAI,OAAO,GAAG;EACxJ,OAAO,IAAI,OAAO;EAClB,QAAQ,KAAK,iDAAiD,MAAM,oFAAoF;CAC1J;AACF;AACA,IAAM,yBAAS,IAAI,IAAY;;AAgB/B,SAAgB,WAAW,EAAE,MAAM,MAAM,OAAO,MAAM,UAAU,SAAS,OAAO,WAAW,GAAG,SAA0B;CACtH,OACE,oBAACC,WAAD;EAAgB;EAAa;EAC3B,UAAA,oBAACF,UAAD;GAAQ,MAAM,SAAS,OAAO,YAAY;GAAiB;GAAS,cAAY;GAAO,GAAI;GACzF,UAAA,oBAAC,MAAD,EAAM,eAAA,KAAa,CAAA;EACb,CAAA;CACD,CAAA;AAEb;;AAmBA,SAAgB,UAAU,EAAE,OAAO,SAAS,MAAM,MAAM,UAAU,SAAS,OAAO,MAAM,WAAW,GAAG,SAAyB;CAG7H,OACE,qBAACA,UAAD;EAAiB;EAAe;EAAM,cAAY,GAAG,MAAM,GAAG;EAAW,WAAW,GAAG,WAAW,SAAS;EAAG,GAAI;EAAlH,UAAA,CACG,QAAQ,oBAAC,MAAD,EAAM,eAAA,KAAa,CAAA,GAC3B,KACK;;AAEZ"}
@@ -1,46 +0,0 @@
1
- import { Shortcut } from './hotkeys';
2
- import * as React from "react";
3
- /** What `useActiveItem` returns: the active item, ways to move it, and the props each item element needs. */
4
- export type ActiveItem<T> = {
5
- items: readonly T[];
6
- getKey: (item: T) => string;
7
- activeKey: string | null;
8
- activeItem: T | null;
9
- /** Position of the active item, or -1 when the list is empty. */
10
- index: number;
11
- next: () => void;
12
- prev: () => void;
13
- first: () => void;
14
- last: () => void;
15
- setActive: (key: string) => void;
16
- /** The j/k shortcuts for `useHotkeys` and `KeysLegend`. */
17
- shortcuts: Shortcut[];
18
- /** Props for the element that represents an item: ref, tabIndex, aria-current and focus tracking. */
19
- itemProps: (key: string) => {
20
- ref: (el: HTMLElement | null) => void;
21
- tabIndex: number;
22
- "aria-current": "true" | undefined;
23
- "data-active": "" | undefined;
24
- onFocus: () => void;
25
- onBlur: (e: React.FocusEvent) => void;
26
- };
27
- };
28
- /** Tracks the active item in a list worked through from the keyboard: moving, roving focus, and moving on when the active item is removed. */
29
- export declare function useActiveItem<T>(items: readonly T[], getKey: (item: T) => string, { initial, noun, }?: {
30
- /** Key of the item active at first; the first item otherwise. */
31
- initial?: string;
32
- /** Names an item in the shortcut labels: "Next booking". */
33
- noun?: string;
34
- }): ActiveItem<T>;
35
- /** A keyboard-worked queue: the active item is a roving tab stop with aria-current, and the arrow keys, Home and End move it. */
36
- export declare function ActiveList<T>({ label, active, empty, children, className, }: {
37
- /** Names the list for screen readers. */
38
- label: string;
39
- active: ActiveItem<T>;
40
- /** Shown when the queue is clear: what that means and what to do next. */
41
- empty: React.ReactNode;
42
- children: (item: T, state: {
43
- active: boolean;
44
- }) => React.ReactNode;
45
- className?: string;
46
- }): React.JSX.Element;
@@ -1,17 +0,0 @@
1
- import { Tone } from './status';
2
- import * as React from "react";
3
- /** Props for `Alert`. */
4
- export type AlertProps = {
5
- tone: Exclude<Tone, "neutral">;
6
- /** A short first line, when the sentence needs one: "Export failed". */
7
- title?: string;
8
- /** The sentence, in the product's words: what happened and what to do. */
9
- children: React.ReactNode;
10
- /** One recovery, a `Button` ("Try again"). */
11
- action?: React.ReactNode;
12
- /** It appeared because of something the person just did (a failed submit): announce it at once (`role="alert"`). */
13
- announce?: boolean;
14
- className?: string;
15
- };
16
- /** An inline sentence about a problem or a fact, in a tone with an icon, with one optional action. `announce` makes it `role="alert"` for a result of the person's own action. */
17
- export declare function Alert({ tone, title, children, action, announce, className }: AlertProps): React.JSX.Element;
@@ -1,32 +0,0 @@
1
- import { IconComponent } from '../lib/icon';
2
- import * as React from "react";
3
- export type NavItem = {
4
- to: string;
5
- label: string;
6
- icon?: IconComponent;
7
- /** Match only this exact path, for an index route such as "/". */
8
- end?: boolean;
9
- };
10
- /** The app frame: product name, side nav on the page ground (a scrollable row on phones), optional top bar, and the main region. */
11
- export declare function AppShell({ product, nav, navLabel, topBar, children, className, }: {
12
- /** The product's name or mark, linking home. */
13
- product: React.ReactNode;
14
- nav: NavItem[];
15
- navLabel?: string;
16
- topBar?: React.ReactNode;
17
- children: React.ReactNode;
18
- className?: string;
19
- }): React.JSX.Element;
20
- /** Navigation links (React Router `NavLink`); the current route is a neutral pill with `aria-current`. */
21
- export declare function SideNav({ items, label, className }: {
22
- items: NavItem[];
23
- label: string;
24
- className?: string;
25
- }): React.JSX.Element;
26
- /** Plain links separated by `/`; the last crumb is the current page. */
27
- export declare function Breadcrumb({ items }: {
28
- items: {
29
- label: string;
30
- to?: string;
31
- }[];
32
- }): React.JSX.Element;
@@ -1,48 +0,0 @@
1
- import { ButtonProps } from './button';
2
- import * as React from "react";
3
- export type Phase = "idle" | "pending" | "done" | "error";
4
- export type AsyncLabels = {
5
- idle: string;
6
- /** Ends in an ellipsis: "Saving…", "Booking…". */
7
- pending: string;
8
- /** The same verb, finished: "Saved", "Booked". */
9
- done: string;
10
- error?: string;
11
- };
12
- /** One button through idle, pending, done and error, with the label changing in place and its width fixed by the longest label. The outcome is announced politely, with the error's own words when `error` is given. */
13
- export declare function AsyncButton({ phase, labels, error, disabled, ...props }: Omit<ButtonProps, "children"> & {
14
- phase: Phase;
15
- labels: AsyncLabels;
16
- /** What went wrong, in the product's words (`useAsyncAction`'s `error`). Announced with the error label when `phase` is `error`. */
17
- error?: string;
18
- }): React.JSX.Element;
19
- /** Messages for a form's fields, keyed by field name. */
20
- export type FieldErrors = Readonly<Record<string, string>>;
21
- /** Options for `useAsyncAction`. */
22
- export type AsyncActionOptions<A extends unknown[] = unknown[]> = {
23
- /** How long `done` shows before returning to `idle`. Default 2000ms. */
24
- settleMs?: number;
25
- /** Called with whatever the action threw, once the `error` render has committed: for logging, or to move focus to the retry button or an error message. */
26
- onError?: (error: unknown) => void;
27
- /** Turns what was thrown into `error`'s sentence, in the product's words. Default `describeActionError`: HTTP status sentences for `fetchJson`'s `HttpError`, else the Error's message. */
28
- describeError?: (error: unknown) => string | undefined;
29
- /** Checks the arguments before the action runs. A message for any field stops the run and is put on `fieldErrors`; the button stays idle. */
30
- validate?: (...args: A) => Record<string, string | undefined> | undefined;
31
- /** Called once validation's messages are on screen: to move focus to the first field named. */
32
- onInvalid?: (fieldErrors: FieldErrors) => void;
33
- };
34
- /** What `useAsyncAction` returns: the phase for `AsyncButton`, a stable `run`, and what went wrong while `phase` is `error`. */
35
- export type AsyncAction<A extends unknown[]> = {
36
- phase: Phase;
37
- run: (...args: A) => Promise<void>;
38
- /** What went wrong, from `describeError`, while `phase` is `error`; otherwise undefined. Pass it to `AsyncButton`'s `error`. */
39
- error: string | undefined;
40
- /** What the action threw, while `phase` is `error`: to read more than the sentence (an HttpError's `status` or `body`). */
41
- thrown: unknown;
42
- /** Messages per field, from `validate` or from the server (an HttpError's `fieldErrors`). Pass each to its `Field`'s `error`. Cleared by the next run. */
43
- fieldErrors: FieldErrors;
44
- /** Clears one field's message (as the person edits it), or all of them. */
45
- clearFieldError: (field?: string) => void;
46
- };
47
- /** Runs an async action and reports its phase, its error and any field messages. `done` returns to `idle` after `settleMs`; `run` never changes identity. */
48
- export declare function useAsyncAction<A extends unknown[]>(action: (...args: A) => Promise<unknown>, { settleMs, onError, describeError, validate, onInvalid }?: AsyncActionOptions<A>): AsyncAction<A>;
@@ -1,67 +0,0 @@
1
- import { Microphone } from '../lib/microphone';
2
- import { SegmenterOptions } from '../lib/segmenter';
3
- import { Recording } from './recorder';
4
- import * as React from "react";
5
- /** Where an auto recorder is: idle, opening the device, listening (and hearing a take or not), or refused. */
6
- export type AutoRecorderState = {
7
- phase: "idle";
8
- } | {
9
- phase: "opening";
10
- } | {
11
- phase: "listening";
12
- /** The live peak in dBFS. */
13
- level: number;
14
- /** The room's quiet in dBFS (RMS), or null before the first chunk. */
15
- noise: number | null;
16
- /** True while a take is being heard. */
17
- speaking: boolean;
18
- /** How long the take being heard has run, 0 when none. */
19
- seconds: number;
20
- /** True while `paused`: the microphone is open but nothing is taken. */
21
- paused: boolean;
22
- } | {
23
- phase: "failed";
24
- reason: string;
25
- };
26
- /** A take cut from a microphone that is always open. */
27
- export type AutoTake = Recording & {
28
- /** True when the speaker was still talking at `maxSeconds` and the take was cut there. */
29
- cut: boolean;
30
- };
31
- /** `useAutoRecorder`'s options: the segmenter's (`SegmenterOptions`) plus these. */
32
- export type UseAutoRecorderOptions = Omit<SegmenterOptions, "maxSeconds"> & {
33
- /** The longest take, in seconds: a longer stretch of speech is cut there (`AutoTake.cut`). */
34
- maxSeconds: number;
35
- /** Called with each take as it ends. */
36
- onTake: (take: AutoTake) => void;
37
- /** Keep the microphone open but take nothing. */
38
- paused?: boolean;
39
- /** The microphone to listen to; `useMicrophone()` (the nearest `MicrophoneContext`) when left out. */
40
- microphone?: Microphone;
41
- };
42
- /** What `useAutoRecorder` returns. */
43
- export type AutoRecorder = {
44
- state: AutoRecorderState;
45
- /** Opens the microphone and listens until `stop`; resolves false when it would not open or is already open. */
46
- start: () => Promise<boolean>;
47
- /** Closes the microphone, handing over a take being heard if it has enough speech. */
48
- stop: () => void;
49
- /** True while opening or listening. */
50
- listening: boolean;
51
- };
52
- /** Listens all the time and hands over each stretch of speech as its own lossless take. */
53
- export declare function useAutoRecorder({ maxSeconds, onTake, paused, microphone, ...tuning }: UseAutoRecorderOptions): AutoRecorder;
54
- /** `ListeningLevel`'s props. */
55
- export type ListeningLevelProps = {
56
- /** The recorder's state while listening. */
57
- state: Extract<AutoRecorderState, {
58
- phase: "listening";
59
- }>;
60
- /** The longest take, said beside a take's running time. */
61
- maxSeconds: number;
62
- /** The meter's name. Default "Input level". */
63
- label?: string;
64
- className?: string;
65
- };
66
- /** The live level of a microphone that is always open, with what it is doing in words: waiting, hearing a take, or paused. */
67
- export declare function ListeningLevel({ state, maxSeconds, label, className }: ListeningLevelProps): React.JSX.Element;
@@ -1,50 +0,0 @@
1
- import * as React from "react";
2
- /** One page of the book. */
3
- export type BookPage = {
4
- id: string;
5
- src: string;
6
- /** What the page shows, for assistive technology: "Page 22 of the Punch book". Required. */
7
- label: string;
8
- /** Its position in the scan, as a person counts: "22". */
9
- scan: string;
10
- /** What is printed on it: "12", "iv", or a running head. Pages with none have only their scan position. */
11
- printed?: string;
12
- /** A small picture for the strip. Default `src`. */
13
- thumb?: string;
14
- /** Its natural size in pixels, for 1:1 and the frame's shape. */
15
- natural?: readonly [number, number];
16
- };
17
- export type BookViewerProps = {
18
- /** Names the book: "The Play of Punch and Judy". */
19
- label: string;
20
- pages: readonly BookPage[];
21
- /** The page being read (any page of a spread), as an index into `pages`. */
22
- index: number;
23
- onIndexChange: (index: number) => void;
24
- /** What shows in place of a page that did not load, in words. Required. */
25
- missing: string;
26
- /** `"spread"` (default) shows facing pages when there is room; `"single"` always one. */
27
- layout?: "spread" | "single";
28
- /** Beside the pages (under them when narrow): the pages shown, for the transcript pane. */
29
- side?: (shown: readonly BookPage[]) => React.ReactNode;
30
- sideLabel?: string;
31
- /** In the corner of a page's thumbnail: a `Status` ("Look") for the pages that need a look. */
32
- badge?: (page: BookPage) => React.ReactNode;
33
- /** A layer inside a page's zoomable frame, in the page's own pixels (`natural` once known): a `BoxOverlay`. */
34
- overlay?: (page: BookPage, natural: readonly [number, number] | null) => React.ReactNode;
35
- /** The thumbnail strip under the pages. Default true. */
36
- strip?: boolean;
37
- /** Width over height of a page before it loads. Default 2:3. */
38
- aspect?: number;
39
- /** What a page is called: "Page" (default), or "Leaf", "Folio". */
40
- word?: string;
41
- className?: string;
42
- };
43
- /** What `useBookUrl` returns: the `index` and `onIndexChange` a `BookViewer` takes. */
44
- export type BookUrl = Pick<BookViewerProps, "index" | "onIndexChange">;
45
- /** Keeps the page being read in the URL (`?page=22`, the 1-based position in the scan): a link or a reload opens it, and turning pages replaces the entry so Back leaves the book. */
46
- export declare function useBookUrl(count: number, { param }?: {
47
- param?: string;
48
- }): BookUrl;
49
- /** A scanned book read as a book: facing pages (the first alone on the right) or one page, printed and scan names with a go-to that takes either, arrows, Page Up/Down, Home/End and a click on a page's outer half, the position in the URL and in words, a thumbnail strip with badges, an optional text pane. */
50
- export declare function BookViewer({ label, pages, index, onIndexChange, missing, layout, side, sideLabel, badge, overlay, strip, aspect, word, className }: BookViewerProps): React.JSX.Element;