strata-react 1.3.13 → 1.3.14

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.
@@ -0,0 +1,40 @@
1
+ /** How the segmenter tells speech from the room. Every field has a default. */
2
+ export type SegmenterOptions = {
3
+ /** dB above the room's quiet that starts a take. Default 12. */
4
+ onsetDb?: number;
5
+ /** The least a frame must reach to count as speech, in dBFS RMS, however quiet the room. Default -55. */
6
+ floorDb?: number;
7
+ /** Quiet that ends a take, in seconds. Default 1. */
8
+ silenceSeconds?: number;
9
+ /** Kept before the first and after the last speech, in seconds. Default 0.3. */
10
+ padSeconds?: number;
11
+ /** Takes with less speech than this are dropped, in seconds. Default 0.3. */
12
+ minSpeechSeconds?: number;
13
+ /** The longest take: it is cut there. Default none. */
14
+ maxSeconds?: number;
15
+ };
16
+ /** One take cut from the stream. */
17
+ export type Segment = {
18
+ samples: Float32Array;
19
+ /** True when the take reached `maxSeconds` and was cut there, mid-speech. */
20
+ cut: boolean;
21
+ };
22
+ /** A running segmenter: give it every chunk, in order; it hands back each take as it ends. */
23
+ export type Segmenter = {
24
+ /** Reads a chunk; returns the takes that ended inside it (usually none, at most a few). */
25
+ push: (chunk: Float32Array) => Segment[];
26
+ /** Ends the take being heard now, if it has enough speech (when listening stops or pauses). */
27
+ flush: () => Segment | null;
28
+ /** Drops the take being heard now, keeping what was learnt about the room. */
29
+ reset: () => void;
30
+ /** The room's quiet, in dBFS RMS, or null before the first frame. */
31
+ readonly noise: number | null;
32
+ /** True while a take is being heard. */
33
+ readonly speaking: boolean;
34
+ /** Seconds of the take being heard so far (from its first kept sample), 0 when none. */
35
+ readonly seconds: number;
36
+ };
37
+ /** The RMS of `frame` in dBFS, `SILENT_DB` for zeros. */
38
+ export declare function rmsDb(frame: Float32Array): number;
39
+ /** A segmenter for a stream at `sampleRate`. */
40
+ export declare function createSegmenter(sampleRate: number, { onsetDb, floorDb, silenceSeconds, padSeconds, minSpeechSeconds, maxSeconds }?: SegmenterOptions): Segmenter;
@@ -15,7 +15,7 @@ import * as React from "react";
15
15
  export { installLayoutShims, type LayoutBox } from './layout';
16
16
  export { installStorageShim, memoryStorage } from './storage';
17
17
  export { installFakeSpeech, type FakeSpeech, type Spoken } from './speech';
18
- export { fakeMicrophone, type FakeMicrophoneOptions } from './microphone';
18
+ export { fakeMicrophone, speechScript, type FakeMicrophoneOptions, type FakeSpeechStretch } from './microphone';
19
19
  export { filledButtons, expectOneFilledButton, asyncButtonPhase } from './buttons';
20
20
  export { installFakeIntersectionObserver, type FakeIntersectionObserverControls, type FakeObserver, } from './intersection-observer';
21
21
  /** A query client for tests: no retries, and nothing goes stale or is collected mid-test. */
@@ -15,6 +15,21 @@ export type FakeMicrophoneOptions = {
15
15
  sampleRate?: number;
16
16
  /** How many times faster than real time the samples arrive. Default 10. */
17
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;
18
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[];
19
34
  /** A microphone that sends a tone (or refuses), for tests and stories; hardware is never touched. */
20
- export declare function fakeMicrophone({ amplitude, refuse, crash, device, silent, sampleRate, speed, }?: FakeMicrophoneOptions): Microphone;
35
+ export declare function fakeMicrophone({ amplitude, refuse, crash, device, silent, sampleRate, speed, script, loop, }?: FakeMicrophoneOptions): Microphone;
package/dist/testing.js CHANGED
@@ -265,8 +265,27 @@ function installFakeSpeech(voices = []) {
265
265
  };
266
266
  }
267
267
  // src/testing/microphone.ts
268
+ /** A script of `takes` stretches of speech, each `speak` seconds after `gap` seconds of quiet, at `amplitude`. */
269
+ function speechScript(takes, { speak = 1.5, gap = 1.5, amplitude = .3 } = {}) {
270
+ return Array.from({ length: takes }, () => [{
271
+ seconds: gap,
272
+ amplitude: 0
273
+ }, {
274
+ seconds: speak,
275
+ amplitude
276
+ }]).flat();
277
+ }
268
278
  /** A microphone that sends a tone (or refuses), for tests and stories; hardware is never touched. */
269
- function fakeMicrophone({ amplitude = .3, refuse, crash, device = "Fake USB microphone", silent, sampleRate = 16e3, speed = 10 } = {}) {
279
+ function fakeMicrophone({ amplitude = .3, refuse, crash, device = "Fake USB microphone", silent, sampleRate = 16e3, speed = 10, script, loop } = {}) {
280
+ const ends = (script ?? []).reduce((acc, s) => [...acc, (acc.at(-1) ?? 0) + Math.round(s.seconds * sampleRate)], []);
281
+ const total = ends.at(-1) ?? 0;
282
+ const at = (t) => {
283
+ if (!script) return amplitude;
284
+ if (total === 0) return 0;
285
+ const n = loop ? t % total : t;
286
+ if (n >= total) return 0;
287
+ return script[ends.findIndex((end) => n < end)].amplitude;
288
+ };
270
289
  return { open(onSamples) {
271
290
  if (crash) return Promise.reject(/* @__PURE__ */ new TypeError("audio graph exploded"));
272
291
  if (refuse) return Promise.reject(new MicrophoneError(refuse));
@@ -274,7 +293,7 @@ function fakeMicrophone({ amplitude = .3, refuse, crash, device = "Fake USB micr
274
293
  const frames = Math.round(sampleRate / 10);
275
294
  const timer = silent ? void 0 : setInterval(() => {
276
295
  const chunk = new Float32Array(frames);
277
- for (let i = 0; i < frames; i++) chunk[i] = amplitude * Math.sin(2 * Math.PI * 220 * t++ / sampleRate);
296
+ for (let i = 0; i < frames; i++) chunk[i] = at(t) * Math.sin(2 * Math.PI * 220 * t++ / sampleRate);
278
297
  onSamples(chunk);
279
298
  }, 100 / speed);
280
299
  return Promise.resolve({
@@ -471,6 +490,6 @@ function renderRoutes(routes, { route, basename, client = createTestQueryClient(
471
490
  ...result
472
491
  };
473
492
  }
474
- export { asyncButtonPhase, createTestQueryClient, expectOneFilledButton, fakeMicrophone, filledButtons, installFakeIntersectionObserver, installFakeSpeech, installLayoutShims, installStorageShim, memoryStorage, renderRoutes, renderWithStrata };
493
+ export { asyncButtonPhase, createTestQueryClient, expectOneFilledButton, fakeMicrophone, filledButtons, installFakeIntersectionObserver, installFakeSpeech, installLayoutShims, installStorageShim, memoryStorage, renderRoutes, renderWithStrata, speechScript };
475
494
 
476
495
  //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","names":[],"sources":["../src/testing/storage.ts","../src/testing/layout.ts","../src/testing/speech.ts","../src/testing/microphone.ts","../src/testing/buttons.ts","../src/testing/intersection-observer.ts","../src/testing/index.tsx"],"sourcesContent":["// Node 25 and later define a global `localStorage` that is undefined unless Node runs with\n// `--localstorage-file`, and it shadows jsdom's. In a Vitest jsdom project on Node 26 (Strata's floor)\n// `localStorage.getItem` then throws, so any app code that reads storage (a remembered choice, a\n// `ColorSchemeChoice` on a settings screen tested with storage on) fails in its tests. Strata's own\n// tests never hit it because `renderWithStrata` turns theme storage off. Every app would have copied\n// the same dozen lines (issue #298), so `installLayoutShims` installs this when, and only when, the\n// platform's storage is unusable; where it works nothing is replaced.\n\n/** An in-memory `Storage`, with the platform's behaviour (values are strings, `key` and `length` work). */\nexport function memoryStorage(): Storage {\n const data = new Map<string, string>();\n return {\n get length() {\n return data.size;\n },\n clear: () => data.clear(),\n getItem: (key) => data.get(String(key)) ?? null,\n key: (index) => [...data.keys()][index] ?? null,\n removeItem: (key) => void data.delete(String(key)),\n setItem: (key, value) => void data.set(String(key), String(value)),\n };\n}\n\nfunction usable(name: \"localStorage\" | \"sessionStorage\"): boolean {\n try {\n return typeof (globalThis as unknown as Record<string, Storage | undefined>)[name]?.getItem === \"function\";\n } catch {\n return false;\n }\n}\n\n/**\n * 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`.\n * Does nothing where storage works. Returns a function that puts the originals back. Called by `installLayoutShims`.\n */\nexport function installStorageShim(): () => void {\n const restore: (() => void)[] = [];\n for (const name of [\"localStorage\", \"sessionStorage\"] as const) {\n if (usable(name)) continue;\n const storage = memoryStorage();\n const targets = [globalThis, typeof window !== \"undefined\" ? window : undefined].filter((t): t is typeof globalThis => t !== undefined);\n for (const target of new Set(targets)) {\n const before = Object.getOwnPropertyDescriptor(target, name);\n Object.defineProperty(target, name, { configurable: true, value: storage });\n restore.push(() => {\n if (before) Object.defineProperty(target, name, before);\n else delete (target as unknown as Record<string, unknown>)[name];\n });\n }\n const after = (globalThis as { afterEach?: (fn: () => void) => void }).afterEach;\n if (typeof after === \"function\") after(() => storage.clear());\n }\n return () => {\n for (const undo of restore.reverse()) undo();\n };\n}\n","// jsdom does no layout: every box is 0×0 and there is no ResizeObserver. Components that measure\n// (LineChart's width; React Aria's Virtualizer draws every row of a list in a test unless the box is mocked, which these shims do not make smaller. A virtualised table with detail rows, or a virtualised grid of tiles, measures each row by its scroll size, which jsdom reports as 0: a test of one gives `Element.prototype.scrollHeight` a value) then render nothing to\n// assert on, so an app testing a screen built from them hits the same wall Strata's own suite did.\n// These shims give every element one fixed box and a ResizeObserver that reports it once on\n// observe (and, on Node 25+, a working in-memory localStorage: see storage.ts). Real layout is checked by the visual suite in Chromium, never here.\n\nimport { installStorageShim } from \"./storage\";\n\n// jsdom has no DOMRect constructor in every version, so rects are plain objects of the same shape.\n/** A DOMRect-shaped object, for stand-ins that report geometry. */\nexport function box(x: number, y: number, width: number, height: number): DOMRect {\n return { x, y, width, height, top: y, left: x, right: x + width, bottom: y + height, toJSON() { return this; } } as DOMRect;\n}\n\n/** The box every element reports while the shims are installed. */\nexport interface LayoutBox {\n width: number;\n height: number;\n}\n\n/**\n * Give jsdom a fixed box for every element (`getBoundingClientRect`, `offset*`, `client*`) and a\n * 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.\n * Call once in a Vitest setup file; returns a function that puts the originals back.\n */\nexport function installLayoutShims({ width = 640, height = 280 }: Partial<LayoutBox> = {}): () => void {\n const restore: (() => void)[] = [];\n const replace = (target: object, prop: string, descriptor: PropertyDescriptor) => {\n const before = Object.getOwnPropertyDescriptor(target, prop);\n Object.defineProperty(target, prop, { configurable: true, ...descriptor });\n restore.push(() => {\n if (before) Object.defineProperty(target, prop, before);\n else delete (target as Record<string, unknown>)[prop];\n });\n };\n\n class FixedResizeObserver implements ResizeObserver {\n constructor(private readonly callback: ResizeObserverCallback) {}\n observe(target: Element) {\n this.callback([{ target, contentRect: { width, height } } as unknown as ResizeObserverEntry], this);\n }\n unobserve() {}\n disconnect() {}\n }\n if (!globalThis.ResizeObserver) replace(globalThis, \"ResizeObserver\", { writable: true, value: FixedResizeObserver });\n\n replace(Element.prototype, \"getBoundingClientRect\", {\n writable: true,\n value: () => box(0, 0, width, height),\n });\n for (const [prop, value] of [[\"offsetWidth\", width], [\"offsetHeight\", height], [\"clientWidth\", width], [\"clientHeight\", height]] as const) {\n replace(HTMLElement.prototype, prop, { get: () => value });\n }\n\n restore.push(installStorageShim());\n\n return () => {\n for (const undo of restore.reverse()) undo();\n };\n}\n","// jsdom has no `speechSynthesis`, and the device's voices are a true external, so a test of a screen\n// that speaks needs a stand-in that records what was said (strata-react issue #299). This is the one\n// stand-in an app would otherwise write: it has `speak`, `cancel`, `getVoices`, `speaking` and the\n// voiceschanged event, it ends an utterance when the test says so (`finish()`), and it never makes a sound.\n// It stands in for `Audio` too (issue #310): a recorded clip that plays is said with its `clip`, `finish()`\n// ends it (the next part starts) and `failClip()` makes it fail, as a missing file or a refused autoplay does.\n\n/** One thing said aloud. */\nexport type Spoken = {\n text: string;\n lang: string;\n rate: number;\n voice: string | null;\n cancelled: boolean;\n /** The recording that was played, or null when the browser's voice said it. */\n clip: string | null;\n};\n\n/** The recording stand-in `installFakeSpeech` puts on `window`. */\nexport type FakeSpeech = {\n /** Everything said so far, in order; an utterance cut off by a later one has `cancelled: true`. */\n said: Spoken[];\n /** The texts said so far that were not cancelled. */\n texts(): string[];\n /** The clips played so far, in order (cut-off ones included). */\n clips(): string[];\n /** Ends the utterance or clip being said, as the browser does when it has finished. */\n finish(): void;\n /** Makes the clip playing now fail (a missing file, a refused autoplay): the rest of the prompt goes to the browser's voice. */\n failClip(): void;\n /** Makes these voices the device's, and fires `voiceschanged` (the late arrival some browsers have). */\n setVoices(voices: { name: string; lang: string }[]): void;\n /** Puts the browser's own back (or none). */\n uninstall(): void;\n};\n\n/**\n * Installs a recording `speechSynthesis` and `SpeechSynthesisUtterance` on `window` and returns what was said.\n * `uninstall()` after each test. `const speech = installFakeSpeech(); … expect(speech.texts()).toEqual([\"Which one is the cat?\"])`.\n */\nexport function installFakeSpeech(voices: { name: string; lang: string }[] = []): FakeSpeech {\n const hadSynth = Object.getOwnPropertyDescriptor(window, \"speechSynthesis\");\n const hadUtterance = Object.getOwnPropertyDescriptor(globalThis, \"SpeechSynthesisUtterance\");\n const hadAudio = Object.getOwnPropertyDescriptor(window, \"Audio\");\n let clip: { entry: Spoken; audio: FakeAudio } | undefined;\n let current: { entry: Spoken; utterance: FakeUtterance } | undefined;\n let installed = voices.map((v) => ({ ...v, default: false, localService: true, voiceURI: v.name }) as SpeechSynthesisVoice);\n const listeners = new Set<EventListener>();\n const said: Spoken[] = [];\n\n class FakeUtterance {\n lang = \"\";\n rate = 1;\n voice: SpeechSynthesisVoice | null = null;\n onend: (() => void) | null = null;\n onerror: (() => void) | null = null;\n constructor(public text: string) {}\n }\n\n // Only what `speak` uses of an audio element: src, title (the words), play, pause and the two events.\n class FakeAudio {\n src = \"\";\n title = \"\";\n onended: (() => void) | null = null;\n onerror: (() => void) | null = null;\n play() {\n const entry: Spoken = { text: this.title, lang: \"\", rate: 1, voice: null, cancelled: false, clip: this.src };\n said.push(entry);\n clip = { entry, audio: this };\n return Promise.resolve();\n }\n pause() {\n if (clip?.audio !== this) return;\n clip.entry.cancelled = true;\n clip = undefined;\n }\n }\n\n const synth = {\n get speaking() {\n return current !== undefined;\n },\n speak(utterance: FakeUtterance) {\n const entry: Spoken = { text: utterance.text, lang: utterance.lang, rate: utterance.rate, voice: utterance.voice?.name ?? null, cancelled: false, clip: null };\n said.push(entry);\n current = { entry, utterance };\n },\n cancel() {\n if (!current) return;\n const { entry, utterance } = current;\n current = undefined;\n entry.cancelled = true;\n utterance.onerror?.();\n },\n getVoices: () => installed,\n addEventListener: (_: string, l: EventListener) => void listeners.add(l),\n removeEventListener: (_: string, l: EventListener) => void listeners.delete(l),\n };\n\n Object.defineProperty(window, \"speechSynthesis\", { configurable: true, value: synth });\n Object.defineProperty(globalThis, \"SpeechSynthesisUtterance\", { configurable: true, writable: true, value: FakeUtterance });\n Object.defineProperty(window, \"Audio\", { configurable: true, writable: true, value: FakeAudio });\n\n return {\n said,\n texts: () => said.filter((s) => !s.cancelled).map((s) => s.text),\n clips: () => said.flatMap((s) => (s.clip === null ? [] : [s.clip])),\n finish() {\n if (clip) {\n const done = clip;\n clip = undefined;\n done.audio.onended?.();\n return;\n }\n const done = current;\n current = undefined;\n done?.utterance.onend?.();\n },\n failClip() {\n const failed = clip;\n clip = undefined;\n failed?.audio.onerror?.();\n },\n setVoices(next) {\n installed = next.map((v) => ({ ...v, default: false, localService: true, voiceURI: v.name }) as SpeechSynthesisVoice);\n for (const l of listeners) l(new Event(\"voiceschanged\"));\n },\n uninstall() {\n if (hadSynth) Object.defineProperty(window, \"speechSynthesis\", hadSynth);\n else delete (window as unknown as Record<string, unknown>).speechSynthesis;\n if (hadUtterance) Object.defineProperty(globalThis, \"SpeechSynthesisUtterance\", hadUtterance);\n else delete (globalThis as unknown as Record<string, unknown>).SpeechSynthesisUtterance;\n if (hadAudio) Object.defineProperty(window, \"Audio\", hadAudio);\n else delete (window as unknown as Record<string, unknown>).Audio;\n },\n };\n}\n","import { MicrophoneError, type Microphone } from \"../lib/microphone\";\n\n// The microphone is hardware, the one true external a recording screen has, and jsdom, Storybook and\n// the visual suite have none. This stand-in sends a sine tone at a chosen level, `speed` times faster\n// than real time (ten by default, so a test of a two-second take waits a fifth of a second), or refuses\n// to open with a sentence as the browser's refusals become (`explainMicrophoneError`). Give it to the\n// screen through `MicrophoneContext`, or `renderWithStrata(ui, { microphone })`.\n\n/** `fakeMicrophone`'s options. */\nexport type FakeMicrophoneOptions = {\n /** Peak of the tone, 0 to 1. Default 0.3 (about -10 dBFS, a good level for speech). */\n amplitude?: number;\n /** Refuse to open with this sentence, as a `MicrophoneError` (what a screen shows). */\n refuse?: string;\n /** Throw something that is not a `MicrophoneError` (an audio graph that failed). */\n crash?: boolean;\n /** What the browser calls the device. Default \"Fake USB microphone\". */\n device?: string | null;\n /** Open but never send a sample: a take held in its first moment, for a screenshot. */\n silent?: boolean;\n /** Samples a second. Default 16 000. */\n sampleRate?: number;\n /** How many times faster than real time the samples arrive. Default 10. */\n speed?: number;\n};\n\n/** A microphone that sends a tone (or refuses), for tests and stories; hardware is never touched. */\nexport function fakeMicrophone({\n amplitude = 0.3,\n refuse,\n crash,\n device = \"Fake USB microphone\",\n silent,\n sampleRate = 16_000,\n speed = 10,\n}: FakeMicrophoneOptions = {}): Microphone {\n return {\n open(onSamples) {\n if (crash) return Promise.reject(new TypeError(\"audio graph exploded\"));\n if (refuse) return Promise.reject(new MicrophoneError(refuse));\n let t = 0;\n // A tenth of a second of sound each tick, every 100 / speed ms of real time.\n const frames = Math.round(sampleRate / 10);\n const timer = silent\n ? undefined\n : setInterval(() => {\n const chunk = new Float32Array(frames);\n for (let i = 0; i < frames; i++) chunk[i] = amplitude * Math.sin((2 * Math.PI * 220 * t++) / sampleRate);\n onSamples(chunk);\n }, 100 / speed);\n return Promise.resolve({ sampleRate, device, close: () => clearInterval(timer) });\n },\n };\n}\n","import type { Phase } from \"../components/async-button\";\n\n// Assertions for the rules a screen keeps, read from what the components draw rather than from\n// their class names (strata-react issue #48, from the Tubes Library test, which matched\n// `bg-primary`). `Button` marks its variant (`data-variant`), so \"one filled button per view\"\n// (ux-research patterns.md §2, with the BulkBar hand-over: while rows are chosen the bulk action is\n// the filled one) is a check a screen test can make after every interaction. `AsyncButton` marks\n// its phase (`data-phase`), because it keeps every phase's label in the DOM to hold its width, so\n// its text reads \"AddAdding…AddedTry again\" and only the phase says which one shows.\n\n/** Whether an element is out of the view: hidden, inert or aria-hidden, itself or by an ancestor. */\nfunction outOfView(el: Element) {\n return Boolean(el.closest('[hidden], [inert], [aria-hidden=\"true\"]'));\n}\n\n/** An element's name as a person reads it: its `aria-label`, else its text without the parts hidden from screen readers. */\nfunction nameOf(el: Element): string {\n const label = el.getAttribute(\"aria-label\");\n if (label) return label;\n const walk = (node: Node): string =>\n node.nodeType === 3\n ? (node.textContent ?? \"\")\n : node instanceof Element && node.getAttribute(\"aria-hidden\") === \"true\"\n ? \"\"\n : [...node.childNodes].map(walk).join(\"\");\n return walk(el).replace(/\\s+/g, \" \").trim();\n}\n\n/** The filled (`variant=\"default\"`) buttons and links in `container` (default the whole document) that are in view. */\nexport function filledButtons(container: ParentNode = document.body): HTMLElement[] {\n return [...container.querySelectorAll<HTMLElement>('[data-variant=\"default\"]')].filter((el) => !outOfView(el));\n}\n\n/** Throws unless `container` (default the whole document) has exactly one filled button in view; the message names the ones found. */\nexport function expectOneFilledButton(container: ParentNode = document.body): HTMLElement {\n const found = filledButtons(container);\n if (found.length === 1) return found[0];\n const names = found.map((el) => `\"${nameOf(el)}\"`).join(\", \");\n throw new Error(`Expected one filled button in the view, found ${found.length}${names ? `: ${names}` : \"\"}.`);\n}\n\n/** The phase an `AsyncButton` is in (`idle`, `pending`, `done`, `error`), from the button or any element inside it. */\nexport function asyncButtonPhase(el: Element): Phase {\n const phase = el.closest(\"[data-phase]\")?.getAttribute(\"data-phase\");\n if (phase === \"idle\" || phase === \"pending\" || phase === \"done\" || phase === \"error\") return phase;\n throw new Error(`Not an AsyncButton: ${el.outerHTML.slice(0, 120)}`);\n}\n","// jsdom has no IntersectionObserver and does no layout, so nothing a component observes ever comes\n// into view in a unit test. Infinite lists load the next page when a sentinel at the end of the\n// list intersects, and before this helper every app wrote its own firable fake to test that\n// (strata-react issue #12, from strata-listory). This one stands in for the global, records what\n// each observer watches, and lets the test say when something scrolls into view: `scrollToEnd()`\n// for the common case, `intersect(el)` for one element. Entries are delivered inside `act` so the\n// state updates they cause are flushed before the next assertion, as a real scroll would be.\n\nimport { act } from \"@testing-library/react\";\nimport { box } from \"./layout\";\n\n/** One stand-in observer: its callback, options and the elements it currently watches. */\nexport interface FakeObserver {\n readonly callback: IntersectionObserverCallback;\n readonly options: IntersectionObserverInit;\n readonly targets: ReadonlySet<Element>;\n}\n\n/** The controls `installFakeIntersectionObserver` returns. */\nexport interface FakeIntersectionObserverControls {\n /** Every observer created since install, including disconnected ones (their target sets are empty). */\n readonly observers: readonly FakeObserver[];\n /** Report `el` to every observer watching it: in view by default, or out of view with `false`. Returns how many observers were told. */\n intersect(el: Element, isIntersecting?: boolean): number;\n /** Report every watched element as in view, as if the person scrolled to the end of the list. Returns how many elements were reported. */\n scrollToEnd(): number;\n /** Put back whatever `IntersectionObserver` was there before install. */\n uninstall(): void;\n}\n\nfunction entryFor(target: Element, isIntersecting: boolean): IntersectionObserverEntry {\n const rect = target.getBoundingClientRect();\n return {\n target,\n isIntersecting,\n intersectionRatio: isIntersecting ? 1 : 0,\n boundingClientRect: rect,\n intersectionRect: isIntersecting ? rect : box(0, 0, 0, 0),\n rootBounds: null,\n time: performance.now(),\n };\n}\n\n/**\n * Replace `globalThis.IntersectionObserver` with a stand-in the test fires by hand. Call it in\n * `beforeEach` and call `uninstall()` in `afterEach`.\n *\n * @example\n * let io: FakeIntersectionObserverControls;\n * beforeEach(() => { io = installFakeIntersectionObserver(); });\n * afterEach(() => io.uninstall());\n *\n * it(\"loads the next page at the end of the list\", async () => {\n * renderWithStrata(<Pieces />);\n * await screen.findByRole(\"list\", { name: \"Pieces\" });\n * io.scrollToEnd();\n * expect(await screen.findByText(\"Celadon bowl\")).toBeInTheDocument();\n * });\n */\nexport function installFakeIntersectionObserver(): FakeIntersectionObserverControls {\n const previous = Object.getOwnPropertyDescriptor(globalThis, \"IntersectionObserver\");\n const observers: (FakeObserver & { targets: Set<Element>; self: IntersectionObserver })[] = [];\n\n class FakeIntersectionObserver implements IntersectionObserver {\n readonly root: Element | Document | null;\n readonly rootMargin: string;\n readonly thresholds: readonly number[];\n readonly scrollMargin = \"0px\";\n private readonly record: (typeof observers)[number];\n\n constructor(callback: IntersectionObserverCallback, options: IntersectionObserverInit = {}) {\n this.root = options.root ?? null;\n this.rootMargin = options.rootMargin ?? \"0px\";\n const threshold = options.threshold ?? 0;\n this.thresholds = Array.isArray(threshold) ? threshold : [threshold];\n this.record = { callback, options, targets: new Set(), self: this };\n observers.push(this.record);\n }\n observe(target: Element) {\n this.record.targets.add(target);\n }\n unobserve(target: Element) {\n this.record.targets.delete(target);\n }\n disconnect() {\n this.record.targets.clear();\n }\n takeRecords(): IntersectionObserverEntry[] {\n return [];\n }\n }\n\n Object.defineProperty(globalThis, \"IntersectionObserver\", {\n configurable: true,\n writable: true,\n value: FakeIntersectionObserver,\n });\n\n const deliver = (observer: (typeof observers)[number], targets: readonly Element[], isIntersecting: boolean) => {\n act(() => observer.callback(targets.map((t) => entryFor(t, isIntersecting)), observer.self));\n };\n\n return {\n observers,\n intersect(el, isIntersecting = true) {\n const watching = observers.filter((o) => o.targets.has(el));\n for (const o of watching) deliver(o, [el], isIntersecting);\n return watching.length;\n },\n scrollToEnd() {\n // Snapshot every observer's targets before any callback runs: a callback that loads more\n // may observe a new sentinel, on this observer or another, which the person has not\n // scrolled to yet.\n const batches = observers.map((o) => [o, [...o.targets]] as const).filter(([, targets]) => targets.length > 0);\n for (const [o, targets] of batches) deliver(o, targets, true);\n return batches.reduce((n, [, targets]) => n + targets.length, 0);\n },\n uninstall() {\n if (previous) Object.defineProperty(globalThis, \"IntersectionObserver\", previous);\n else delete (globalThis as { IntersectionObserver?: unknown }).IntersectionObserver;\n },\n };\n}\n","/**\n * Test helpers: render a component, or a whole route tree, inside a router and a query client, as\n * a Strata app runs it,\n * and fill the gaps jsdom leaves (layout, ResizeObserver, IntersectionObserver). Use with MSW for\n * the network, never module mocks.\n *\n * @module strata-react/testing\n */\nimport * as React from \"react\";\nimport { act, render, type RenderOptions } from \"@testing-library/react\";\nimport { MemoryRouter, RouterProvider, createMemoryRouter, type RouteObject, type To } from \"react-router\";\nimport { QueryClient } from \"@tanstack/react-query\";\nimport { StrataQueryProvider, createQueryClient } from \"../query\";\nimport { ThemeProvider, type ColorSchemePreference } from \"../components/theme\";\nimport { StrataToastRegion, toast } from \"../components/toast\";\nimport { MicrophoneContext, type Microphone } from \"../lib/microphone\";\n\nexport { installLayoutShims, type LayoutBox } from \"./layout\";\nexport { installStorageShim, memoryStorage } from \"./storage\";\nexport { installFakeSpeech, type FakeSpeech, type Spoken } from \"./speech\";\nexport { fakeMicrophone, type FakeMicrophoneOptions } from \"./microphone\";\nexport { filledButtons, expectOneFilledButton, asyncButtonPhase } from \"./buttons\";\nexport {\n installFakeIntersectionObserver,\n type FakeIntersectionObserverControls,\n type FakeObserver,\n} from \"./intersection-observer\";\n\n// Render a component the way a Strata app runs it: inside a router and a query client. Tests use\n// MSW for the network (see CLAUDE.md), never module mocks, so the real fetch/query/DataView path\n// runs. Each call gets a fresh QueryClient with retries off, so a test that serves a 500 sees the\n// error at once instead of after the retry delay. It also runs inside a ThemeProvider with\n// storage off, so `useColorScheme` works and a test can render the dark scheme with\n// `colorScheme: \"dark\"` without touching localStorage or leaking state into the next test.\n\n/** A query client for tests: no retries, and nothing goes stale or is collected mid-test. */\nexport function createTestQueryClient() {\n return createQueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity, gcTime: Infinity } } });\n}\n\n/** The options `renderWithStrata` and `renderRoutes` share, beside Testing Library's own. */\nexport type StrataRenderOptions = Omit<RenderOptions, \"wrapper\"> & {\n /** The URL the test starts at, with its search and hash (`/bookings?sort=pieces.desc`). Defaults to `/`. */\n route?: string;\n /** The query client; a fresh `createTestQueryClient()` when left out. */\n client?: QueryClient;\n /** The colour scheme to render; `light` when left out. */\n colorScheme?: ColorSchemePreference;\n /** 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. */\n toasts?: boolean;\n /** The microphone a recording screen gets from `useMicrophone()`, such as `fakeMicrophone()`; the browser's when left out (which jsdom cannot open). */\n microphone?: Microphone;\n};\n\n// The providers every Strata app has above its router, in the order an app nests them.\nfunction StrataProviders({\n client,\n colorScheme,\n toasts,\n microphone,\n children,\n}: {\n client: QueryClient;\n colorScheme: ColorSchemePreference;\n toasts: boolean;\n microphone?: Microphone;\n children: React.ReactNode;\n}) {\n const tree = (\n <ThemeProvider defaultPreference={colorScheme} storageKey={null}>\n <StrataQueryProvider client={client}>\n {children}\n {toasts && <StrataToastRegion />}\n </StrataQueryProvider>\n </ThemeProvider>\n );\n return microphone ? <MicrophoneContext.Provider value={microphone}>{tree}</MicrophoneContext.Provider> : tree;\n}\n\n/** Testing Library's `render` inside `StrataQueryProvider` and a `MemoryRouter` at `route`. */\nexport function renderWithStrata(\n ui: React.ReactElement,\n { route = \"/\", client = createTestQueryClient(), colorScheme = \"light\", toasts = true, microphone, ...options }: StrataRenderOptions = {},\n) {\n toast.clear(); // module state: a toast from the last test must not show in this one\n const Wrapper = ({ children }: { children: React.ReactNode }) => (\n <StrataProviders client={client} colorScheme={colorScheme} toasts={toasts} microphone={microphone}>\n <MemoryRouter initialEntries={[route]}>{children}</MemoryRouter>\n </StrataProviders>\n );\n return { client, ...render(ui, { wrapper: Wrapper, ...options }) };\n}\n\n// Render an app's own route tree: its layout routes and <Outlet />s, index routes, redirects\n// (<Navigate /> or a loader's redirect()), loaders, actions and error elements. Those only run in\n// a data router, which <MemoryRouter> is not, so renderWithStrata cannot show them; this builds\n// the memory twin of the app's createBrowserRouter from the same RouteObject[] the app exports,\n// so the test and the app cannot drift. The providers and options are renderWithStrata's.\n// `basename` is the app's own (the kiln app runs under /kiln), and `route` is the full URL,\n// basename included, as the browser would show it. The router is returned so a test can assert\n// where a redirect landed (`router.state.location`), and `navigate` moves it inside act().\n\n/** `renderRoutes`'s options: `renderWithStrata`'s, plus the app's `basename`. */\nexport type RenderRoutesOptions = StrataRenderOptions & {\n /** The base path the app is served under, as passed to `createBrowserRouter`. */\n basename?: string;\n};\n\n/** Testing Library's `render` of an app's route tree in a memory data router at `route`, with Strata's providers. */\nexport function renderRoutes(\n routes: RouteObject[],\n {\n route,\n basename,\n client = createTestQueryClient(),\n colorScheme = \"light\",\n toasts = true,\n microphone,\n ...options\n }: RenderRoutesOptions = {},\n) {\n toast.clear();\n const router = createMemoryRouter(routes, { initialEntries: [route ?? basename ?? \"/\"], basename });\n const result = render(\n <StrataProviders client={client} colorScheme={colorScheme} toasts={toasts} microphone={microphone}>\n <RouterProvider router={router} />\n </StrataProviders>,\n options,\n );\n const navigate = (to: To | number) =>\n act(async () => {\n await (typeof to === \"number\" ? router.navigate(to) : router.navigate(to));\n });\n return { client, router, navigate, ...result };\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,gBAAyB;CACvC,MAAM,uBAAO,IAAI,IAAoB;CACrC,OAAO;EACL,IAAI,SAAS;GACX,OAAO,KAAK;EACd;EACA,aAAa,KAAK,MAAM;EACxB,UAAU,QAAQ,KAAK,IAAI,OAAO,GAAG,CAAC,KAAK;EAC3C,MAAM,UAAU,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU;EAC3C,aAAa,QAAQ,KAAK,KAAK,OAAO,OAAO,GAAG,CAAC;EACjD,UAAU,KAAK,UAAU,KAAK,KAAK,IAAI,OAAO,GAAG,GAAG,OAAO,KAAK,CAAC;CACnE;AACF;AAEA,SAAS,OAAO,MAAkD;CAChE,IAAI;EAC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ACA,MAAM,MAAM;CACZ,MAAM,WAAW,EAAE,eACjB,oBAAC,iBAAD;EAAyB;EAAqB;EAAqB;EAAoB;EACrF,UAAA,oBAAC,cAAD;GAAc,gBAAgB,CAAC,KAAK;GAAI;EAAuB,CAAA;CAChD,CAAA;CAEnB,OAAO;EAAE;EAAQ,GAAG,OAAO,IAAI;GAAE,SAAS;GAAS,GAAG;EAAQ,CAAC;CAAE;AACnE;;AAkBA,SAAgB,aACd,QACA,EACE,OACA,UACA,SAAS,sBAAsB,GAC/B,cAAc,SACd,SAAS,MACT,YACA,GAAG,YACoB,CAAC,GAC1B;CACA,MAAM,MAAM;CACZ,MAAM,SAAS,mBAAmB,QAAQ;EAAE,gBAAgB,CAAC,SAAS,YAAY,GAAG;EAAG;CAAS,CAAC;CAClG,MAAM,SAAS,OACb,oBAAC,iBAAD;EAAyB;EAAqB;EAAqB;EAAoB;EACrF,UAAA,oBAAC,gBAAD,EAAwB,OAAS,CAAA;CAClB,CAAA,GACjB,OACF;CACA,MAAM,YAAY,OAChB,IAAI,YAAY;EACd,OAAO,OAAO,OAAO,WAAW,OAAO,SAAS,EAAE,IAAI,OAAO,SAAS,EAAE;CAC1E,CAAC;CACH,OAAO;EAAE;EAAQ;EAAQ;EAAU,GAAG;CAAO;AAC/C"}
1
+ {"version":3,"file":"testing.js","names":[],"sources":["../src/testing/storage.ts","../src/testing/layout.ts","../src/testing/speech.ts","../src/testing/microphone.ts","../src/testing/buttons.ts","../src/testing/intersection-observer.ts","../src/testing/index.tsx"],"sourcesContent":["// Node 25 and later define a global `localStorage` that is undefined unless Node runs with\n// `--localstorage-file`, and it shadows jsdom's. In a Vitest jsdom project on Node 26 (Strata's floor)\n// `localStorage.getItem` then throws, so any app code that reads storage (a remembered choice, a\n// `ColorSchemeChoice` on a settings screen tested with storage on) fails in its tests. Strata's own\n// tests never hit it because `renderWithStrata` turns theme storage off. Every app would have copied\n// the same dozen lines (issue #298), so `installLayoutShims` installs this when, and only when, the\n// platform's storage is unusable; where it works nothing is replaced.\n\n/** An in-memory `Storage`, with the platform's behaviour (values are strings, `key` and `length` work). */\nexport function memoryStorage(): Storage {\n const data = new Map<string, string>();\n return {\n get length() {\n return data.size;\n },\n clear: () => data.clear(),\n getItem: (key) => data.get(String(key)) ?? null,\n key: (index) => [...data.keys()][index] ?? null,\n removeItem: (key) => void data.delete(String(key)),\n setItem: (key, value) => void data.set(String(key), String(value)),\n };\n}\n\nfunction usable(name: \"localStorage\" | \"sessionStorage\"): boolean {\n try {\n return typeof (globalThis as unknown as Record<string, Storage | undefined>)[name]?.getItem === \"function\";\n } catch {\n return false;\n }\n}\n\n/**\n * 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`.\n * Does nothing where storage works. Returns a function that puts the originals back. Called by `installLayoutShims`.\n */\nexport function installStorageShim(): () => void {\n const restore: (() => void)[] = [];\n for (const name of [\"localStorage\", \"sessionStorage\"] as const) {\n if (usable(name)) continue;\n const storage = memoryStorage();\n const targets = [globalThis, typeof window !== \"undefined\" ? window : undefined].filter((t): t is typeof globalThis => t !== undefined);\n for (const target of new Set(targets)) {\n const before = Object.getOwnPropertyDescriptor(target, name);\n Object.defineProperty(target, name, { configurable: true, value: storage });\n restore.push(() => {\n if (before) Object.defineProperty(target, name, before);\n else delete (target as unknown as Record<string, unknown>)[name];\n });\n }\n const after = (globalThis as { afterEach?: (fn: () => void) => void }).afterEach;\n if (typeof after === \"function\") after(() => storage.clear());\n }\n return () => {\n for (const undo of restore.reverse()) undo();\n };\n}\n","// jsdom does no layout: every box is 0×0 and there is no ResizeObserver. Components that measure\n// (LineChart's width; React Aria's Virtualizer draws every row of a list in a test unless the box is mocked, which these shims do not make smaller. A virtualised table with detail rows, or a virtualised grid of tiles, measures each row by its scroll size, which jsdom reports as 0: a test of one gives `Element.prototype.scrollHeight` a value) then render nothing to\n// assert on, so an app testing a screen built from them hits the same wall Strata's own suite did.\n// These shims give every element one fixed box and a ResizeObserver that reports it once on\n// observe (and, on Node 25+, a working in-memory localStorage: see storage.ts). Real layout is checked by the visual suite in Chromium, never here.\n\nimport { installStorageShim } from \"./storage\";\n\n// jsdom has no DOMRect constructor in every version, so rects are plain objects of the same shape.\n/** A DOMRect-shaped object, for stand-ins that report geometry. */\nexport function box(x: number, y: number, width: number, height: number): DOMRect {\n return { x, y, width, height, top: y, left: x, right: x + width, bottom: y + height, toJSON() { return this; } } as DOMRect;\n}\n\n/** The box every element reports while the shims are installed. */\nexport interface LayoutBox {\n width: number;\n height: number;\n}\n\n/**\n * Give jsdom a fixed box for every element (`getBoundingClientRect`, `offset*`, `client*`) and a\n * 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.\n * Call once in a Vitest setup file; returns a function that puts the originals back.\n */\nexport function installLayoutShims({ width = 640, height = 280 }: Partial<LayoutBox> = {}): () => void {\n const restore: (() => void)[] = [];\n const replace = (target: object, prop: string, descriptor: PropertyDescriptor) => {\n const before = Object.getOwnPropertyDescriptor(target, prop);\n Object.defineProperty(target, prop, { configurable: true, ...descriptor });\n restore.push(() => {\n if (before) Object.defineProperty(target, prop, before);\n else delete (target as Record<string, unknown>)[prop];\n });\n };\n\n class FixedResizeObserver implements ResizeObserver {\n constructor(private readonly callback: ResizeObserverCallback) {}\n observe(target: Element) {\n this.callback([{ target, contentRect: { width, height } } as unknown as ResizeObserverEntry], this);\n }\n unobserve() {}\n disconnect() {}\n }\n if (!globalThis.ResizeObserver) replace(globalThis, \"ResizeObserver\", { writable: true, value: FixedResizeObserver });\n\n replace(Element.prototype, \"getBoundingClientRect\", {\n writable: true,\n value: () => box(0, 0, width, height),\n });\n for (const [prop, value] of [[\"offsetWidth\", width], [\"offsetHeight\", height], [\"clientWidth\", width], [\"clientHeight\", height]] as const) {\n replace(HTMLElement.prototype, prop, { get: () => value });\n }\n\n restore.push(installStorageShim());\n\n return () => {\n for (const undo of restore.reverse()) undo();\n };\n}\n","// jsdom has no `speechSynthesis`, and the device's voices are a true external, so a test of a screen\n// that speaks needs a stand-in that records what was said (strata-react issue #299). This is the one\n// stand-in an app would otherwise write: it has `speak`, `cancel`, `getVoices`, `speaking` and the\n// voiceschanged event, it ends an utterance when the test says so (`finish()`), and it never makes a sound.\n// It stands in for `Audio` too (issue #310): a recorded clip that plays is said with its `clip`, `finish()`\n// ends it (the next part starts) and `failClip()` makes it fail, as a missing file or a refused autoplay does.\n\n/** One thing said aloud. */\nexport type Spoken = {\n text: string;\n lang: string;\n rate: number;\n voice: string | null;\n cancelled: boolean;\n /** The recording that was played, or null when the browser's voice said it. */\n clip: string | null;\n};\n\n/** The recording stand-in `installFakeSpeech` puts on `window`. */\nexport type FakeSpeech = {\n /** Everything said so far, in order; an utterance cut off by a later one has `cancelled: true`. */\n said: Spoken[];\n /** The texts said so far that were not cancelled. */\n texts(): string[];\n /** The clips played so far, in order (cut-off ones included). */\n clips(): string[];\n /** Ends the utterance or clip being said, as the browser does when it has finished. */\n finish(): void;\n /** Makes the clip playing now fail (a missing file, a refused autoplay): the rest of the prompt goes to the browser's voice. */\n failClip(): void;\n /** Makes these voices the device's, and fires `voiceschanged` (the late arrival some browsers have). */\n setVoices(voices: { name: string; lang: string }[]): void;\n /** Puts the browser's own back (or none). */\n uninstall(): void;\n};\n\n/**\n * Installs a recording `speechSynthesis` and `SpeechSynthesisUtterance` on `window` and returns what was said.\n * `uninstall()` after each test. `const speech = installFakeSpeech(); … expect(speech.texts()).toEqual([\"Which one is the cat?\"])`.\n */\nexport function installFakeSpeech(voices: { name: string; lang: string }[] = []): FakeSpeech {\n const hadSynth = Object.getOwnPropertyDescriptor(window, \"speechSynthesis\");\n const hadUtterance = Object.getOwnPropertyDescriptor(globalThis, \"SpeechSynthesisUtterance\");\n const hadAudio = Object.getOwnPropertyDescriptor(window, \"Audio\");\n let clip: { entry: Spoken; audio: FakeAudio } | undefined;\n let current: { entry: Spoken; utterance: FakeUtterance } | undefined;\n let installed = voices.map((v) => ({ ...v, default: false, localService: true, voiceURI: v.name }) as SpeechSynthesisVoice);\n const listeners = new Set<EventListener>();\n const said: Spoken[] = [];\n\n class FakeUtterance {\n lang = \"\";\n rate = 1;\n voice: SpeechSynthesisVoice | null = null;\n onend: (() => void) | null = null;\n onerror: (() => void) | null = null;\n constructor(public text: string) {}\n }\n\n // Only what `speak` uses of an audio element: src, title (the words), play, pause and the two events.\n class FakeAudio {\n src = \"\";\n title = \"\";\n onended: (() => void) | null = null;\n onerror: (() => void) | null = null;\n play() {\n const entry: Spoken = { text: this.title, lang: \"\", rate: 1, voice: null, cancelled: false, clip: this.src };\n said.push(entry);\n clip = { entry, audio: this };\n return Promise.resolve();\n }\n pause() {\n if (clip?.audio !== this) return;\n clip.entry.cancelled = true;\n clip = undefined;\n }\n }\n\n const synth = {\n get speaking() {\n return current !== undefined;\n },\n speak(utterance: FakeUtterance) {\n const entry: Spoken = { text: utterance.text, lang: utterance.lang, rate: utterance.rate, voice: utterance.voice?.name ?? null, cancelled: false, clip: null };\n said.push(entry);\n current = { entry, utterance };\n },\n cancel() {\n if (!current) return;\n const { entry, utterance } = current;\n current = undefined;\n entry.cancelled = true;\n utterance.onerror?.();\n },\n getVoices: () => installed,\n addEventListener: (_: string, l: EventListener) => void listeners.add(l),\n removeEventListener: (_: string, l: EventListener) => void listeners.delete(l),\n };\n\n Object.defineProperty(window, \"speechSynthesis\", { configurable: true, value: synth });\n Object.defineProperty(globalThis, \"SpeechSynthesisUtterance\", { configurable: true, writable: true, value: FakeUtterance });\n Object.defineProperty(window, \"Audio\", { configurable: true, writable: true, value: FakeAudio });\n\n return {\n said,\n texts: () => said.filter((s) => !s.cancelled).map((s) => s.text),\n clips: () => said.flatMap((s) => (s.clip === null ? [] : [s.clip])),\n finish() {\n if (clip) {\n const done = clip;\n clip = undefined;\n done.audio.onended?.();\n return;\n }\n const done = current;\n current = undefined;\n done?.utterance.onend?.();\n },\n failClip() {\n const failed = clip;\n clip = undefined;\n failed?.audio.onerror?.();\n },\n setVoices(next) {\n installed = next.map((v) => ({ ...v, default: false, localService: true, voiceURI: v.name }) as SpeechSynthesisVoice);\n for (const l of listeners) l(new Event(\"voiceschanged\"));\n },\n uninstall() {\n if (hadSynth) Object.defineProperty(window, \"speechSynthesis\", hadSynth);\n else delete (window as unknown as Record<string, unknown>).speechSynthesis;\n if (hadUtterance) Object.defineProperty(globalThis, \"SpeechSynthesisUtterance\", hadUtterance);\n else delete (globalThis as unknown as Record<string, unknown>).SpeechSynthesisUtterance;\n if (hadAudio) Object.defineProperty(window, \"Audio\", hadAudio);\n else delete (window as unknown as Record<string, unknown>).Audio;\n },\n };\n}\n","import { MicrophoneError, type Microphone } from \"../lib/microphone\";\n\n// The microphone is hardware, the one true external a recording screen has, and jsdom, Storybook and\n// the visual suite have none. This stand-in sends a sine tone at a chosen level, `speed` times faster\n// than real time (ten by default, so a test of a two-second take waits a fifth of a second), or refuses\n// to open with a sentence as the browser's refusals become (`explainMicrophoneError`). Give it to the\n// screen through `MicrophoneContext`, or `renderWithStrata(ui, { microphone })`.\n// For a hands-free screen (`useAutoRecorder`), `script` plays stretches of tone and quiet in turn, as a\n// speaker reading prompts with gaps between them would, once (then quiet) or over and over (`loop`).\n\n/** `fakeMicrophone`'s options. */\nexport type FakeMicrophoneOptions = {\n /** Peak of the tone, 0 to 1. Default 0.3 (about -10 dBFS, a good level for speech). */\n amplitude?: number;\n /** Refuse to open with this sentence, as a `MicrophoneError` (what a screen shows). */\n refuse?: string;\n /** Throw something that is not a `MicrophoneError` (an audio graph that failed). */\n crash?: boolean;\n /** What the browser calls the device. Default \"Fake USB microphone\". */\n device?: string | null;\n /** Open but never send a sample: a take held in its first moment, for a screenshot. */\n silent?: boolean;\n /** Samples a second. Default 16 000. */\n sampleRate?: number;\n /** How many times faster than real time the samples arrive. Default 10. */\n speed?: number;\n /** Stretches of tone at their own `amplitude` (0 for quiet), played in order instead of one steady tone. */\n script?: readonly FakeSpeechStretch[];\n /** Play `script` again from the start when it ends, instead of falling quiet. */\n loop?: boolean;\n};\n\n/** One stretch of a fake microphone's `script`: so many seconds at a peak (0 is quiet). */\nexport type FakeSpeechStretch = { seconds: number; amplitude: number };\n\n/** A script of `takes` stretches of speech, each `speak` seconds after `gap` seconds of quiet, at `amplitude`. */\nexport function speechScript(takes: number, { speak = 1.5, gap = 1.5, amplitude = 0.3 }: { speak?: number; gap?: number; amplitude?: number } = {}): FakeSpeechStretch[] {\n return Array.from({ length: takes }, () => [\n { seconds: gap, amplitude: 0 },\n { seconds: speak, amplitude },\n ]).flat();\n}\n\n/** A microphone that sends a tone (or refuses), for tests and stories; hardware is never touched. */\nexport function fakeMicrophone({\n amplitude = 0.3,\n refuse,\n crash,\n device = \"Fake USB microphone\",\n silent,\n sampleRate = 16_000,\n speed = 10,\n script,\n loop,\n}: FakeMicrophoneOptions = {}): Microphone {\n // The amplitude at sample `t`: the script's stretch it falls in, or the steady tone's.\n const ends = (script ?? []).reduce<number[]>((acc, s) => [...acc, (acc.at(-1) ?? 0) + Math.round(s.seconds * sampleRate)], []);\n const total = ends.at(-1) ?? 0;\n const at = (t: number): number => {\n if (!script) return amplitude;\n if (total === 0) return 0;\n const n = loop ? t % total : t;\n if (n >= total) return 0;\n const i = ends.findIndex((end) => n < end);\n return script[i].amplitude;\n };\n return {\n open(onSamples) {\n if (crash) return Promise.reject(new TypeError(\"audio graph exploded\"));\n if (refuse) return Promise.reject(new MicrophoneError(refuse));\n let t = 0;\n // A tenth of a second of sound each tick, every 100 / speed ms of real time.\n const frames = Math.round(sampleRate / 10);\n const timer = silent\n ? undefined\n : setInterval(() => {\n const chunk = new Float32Array(frames);\n for (let i = 0; i < frames; i++) chunk[i] = at(t) * Math.sin((2 * Math.PI * 220 * t++) / sampleRate);\n onSamples(chunk);\n }, 100 / speed);\n return Promise.resolve({ sampleRate, device, close: () => clearInterval(timer) });\n },\n };\n}\n","import type { Phase } from \"../components/async-button\";\n\n// Assertions for the rules a screen keeps, read from what the components draw rather than from\n// their class names (strata-react issue #48, from the Tubes Library test, which matched\n// `bg-primary`). `Button` marks its variant (`data-variant`), so \"one filled button per view\"\n// (ux-research patterns.md §2, with the BulkBar hand-over: while rows are chosen the bulk action is\n// the filled one) is a check a screen test can make after every interaction. `AsyncButton` marks\n// its phase (`data-phase`), because it keeps every phase's label in the DOM to hold its width, so\n// its text reads \"AddAdding…AddedTry again\" and only the phase says which one shows.\n\n/** Whether an element is out of the view: hidden, inert or aria-hidden, itself or by an ancestor. */\nfunction outOfView(el: Element) {\n return Boolean(el.closest('[hidden], [inert], [aria-hidden=\"true\"]'));\n}\n\n/** An element's name as a person reads it: its `aria-label`, else its text without the parts hidden from screen readers. */\nfunction nameOf(el: Element): string {\n const label = el.getAttribute(\"aria-label\");\n if (label) return label;\n const walk = (node: Node): string =>\n node.nodeType === 3\n ? (node.textContent ?? \"\")\n : node instanceof Element && node.getAttribute(\"aria-hidden\") === \"true\"\n ? \"\"\n : [...node.childNodes].map(walk).join(\"\");\n return walk(el).replace(/\\s+/g, \" \").trim();\n}\n\n/** The filled (`variant=\"default\"`) buttons and links in `container` (default the whole document) that are in view. */\nexport function filledButtons(container: ParentNode = document.body): HTMLElement[] {\n return [...container.querySelectorAll<HTMLElement>('[data-variant=\"default\"]')].filter((el) => !outOfView(el));\n}\n\n/** Throws unless `container` (default the whole document) has exactly one filled button in view; the message names the ones found. */\nexport function expectOneFilledButton(container: ParentNode = document.body): HTMLElement {\n const found = filledButtons(container);\n if (found.length === 1) return found[0];\n const names = found.map((el) => `\"${nameOf(el)}\"`).join(\", \");\n throw new Error(`Expected one filled button in the view, found ${found.length}${names ? `: ${names}` : \"\"}.`);\n}\n\n/** The phase an `AsyncButton` is in (`idle`, `pending`, `done`, `error`), from the button or any element inside it. */\nexport function asyncButtonPhase(el: Element): Phase {\n const phase = el.closest(\"[data-phase]\")?.getAttribute(\"data-phase\");\n if (phase === \"idle\" || phase === \"pending\" || phase === \"done\" || phase === \"error\") return phase;\n throw new Error(`Not an AsyncButton: ${el.outerHTML.slice(0, 120)}`);\n}\n","// jsdom has no IntersectionObserver and does no layout, so nothing a component observes ever comes\n// into view in a unit test. Infinite lists load the next page when a sentinel at the end of the\n// list intersects, and before this helper every app wrote its own firable fake to test that\n// (strata-react issue #12, from strata-listory). This one stands in for the global, records what\n// each observer watches, and lets the test say when something scrolls into view: `scrollToEnd()`\n// for the common case, `intersect(el)` for one element. Entries are delivered inside `act` so the\n// state updates they cause are flushed before the next assertion, as a real scroll would be.\n\nimport { act } from \"@testing-library/react\";\nimport { box } from \"./layout\";\n\n/** One stand-in observer: its callback, options and the elements it currently watches. */\nexport interface FakeObserver {\n readonly callback: IntersectionObserverCallback;\n readonly options: IntersectionObserverInit;\n readonly targets: ReadonlySet<Element>;\n}\n\n/** The controls `installFakeIntersectionObserver` returns. */\nexport interface FakeIntersectionObserverControls {\n /** Every observer created since install, including disconnected ones (their target sets are empty). */\n readonly observers: readonly FakeObserver[];\n /** Report `el` to every observer watching it: in view by default, or out of view with `false`. Returns how many observers were told. */\n intersect(el: Element, isIntersecting?: boolean): number;\n /** Report every watched element as in view, as if the person scrolled to the end of the list. Returns how many elements were reported. */\n scrollToEnd(): number;\n /** Put back whatever `IntersectionObserver` was there before install. */\n uninstall(): void;\n}\n\nfunction entryFor(target: Element, isIntersecting: boolean): IntersectionObserverEntry {\n const rect = target.getBoundingClientRect();\n return {\n target,\n isIntersecting,\n intersectionRatio: isIntersecting ? 1 : 0,\n boundingClientRect: rect,\n intersectionRect: isIntersecting ? rect : box(0, 0, 0, 0),\n rootBounds: null,\n time: performance.now(),\n };\n}\n\n/**\n * Replace `globalThis.IntersectionObserver` with a stand-in the test fires by hand. Call it in\n * `beforeEach` and call `uninstall()` in `afterEach`.\n *\n * @example\n * let io: FakeIntersectionObserverControls;\n * beforeEach(() => { io = installFakeIntersectionObserver(); });\n * afterEach(() => io.uninstall());\n *\n * it(\"loads the next page at the end of the list\", async () => {\n * renderWithStrata(<Pieces />);\n * await screen.findByRole(\"list\", { name: \"Pieces\" });\n * io.scrollToEnd();\n * expect(await screen.findByText(\"Celadon bowl\")).toBeInTheDocument();\n * });\n */\nexport function installFakeIntersectionObserver(): FakeIntersectionObserverControls {\n const previous = Object.getOwnPropertyDescriptor(globalThis, \"IntersectionObserver\");\n const observers: (FakeObserver & { targets: Set<Element>; self: IntersectionObserver })[] = [];\n\n class FakeIntersectionObserver implements IntersectionObserver {\n readonly root: Element | Document | null;\n readonly rootMargin: string;\n readonly thresholds: readonly number[];\n readonly scrollMargin = \"0px\";\n private readonly record: (typeof observers)[number];\n\n constructor(callback: IntersectionObserverCallback, options: IntersectionObserverInit = {}) {\n this.root = options.root ?? null;\n this.rootMargin = options.rootMargin ?? \"0px\";\n const threshold = options.threshold ?? 0;\n this.thresholds = Array.isArray(threshold) ? threshold : [threshold];\n this.record = { callback, options, targets: new Set(), self: this };\n observers.push(this.record);\n }\n observe(target: Element) {\n this.record.targets.add(target);\n }\n unobserve(target: Element) {\n this.record.targets.delete(target);\n }\n disconnect() {\n this.record.targets.clear();\n }\n takeRecords(): IntersectionObserverEntry[] {\n return [];\n }\n }\n\n Object.defineProperty(globalThis, \"IntersectionObserver\", {\n configurable: true,\n writable: true,\n value: FakeIntersectionObserver,\n });\n\n const deliver = (observer: (typeof observers)[number], targets: readonly Element[], isIntersecting: boolean) => {\n act(() => observer.callback(targets.map((t) => entryFor(t, isIntersecting)), observer.self));\n };\n\n return {\n observers,\n intersect(el, isIntersecting = true) {\n const watching = observers.filter((o) => o.targets.has(el));\n for (const o of watching) deliver(o, [el], isIntersecting);\n return watching.length;\n },\n scrollToEnd() {\n // Snapshot every observer's targets before any callback runs: a callback that loads more\n // may observe a new sentinel, on this observer or another, which the person has not\n // scrolled to yet.\n const batches = observers.map((o) => [o, [...o.targets]] as const).filter(([, targets]) => targets.length > 0);\n for (const [o, targets] of batches) deliver(o, targets, true);\n return batches.reduce((n, [, targets]) => n + targets.length, 0);\n },\n uninstall() {\n if (previous) Object.defineProperty(globalThis, \"IntersectionObserver\", previous);\n else delete (globalThis as { IntersectionObserver?: unknown }).IntersectionObserver;\n },\n };\n}\n","/**\n * Test helpers: render a component, or a whole route tree, inside a router and a query client, as\n * a Strata app runs it,\n * and fill the gaps jsdom leaves (layout, ResizeObserver, IntersectionObserver). Use with MSW for\n * the network, never module mocks.\n *\n * @module strata-react/testing\n */\nimport * as React from \"react\";\nimport { act, render, type RenderOptions } from \"@testing-library/react\";\nimport { MemoryRouter, RouterProvider, createMemoryRouter, type RouteObject, type To } from \"react-router\";\nimport { QueryClient } from \"@tanstack/react-query\";\nimport { StrataQueryProvider, createQueryClient } from \"../query\";\nimport { ThemeProvider, type ColorSchemePreference } from \"../components/theme\";\nimport { StrataToastRegion, toast } from \"../components/toast\";\nimport { MicrophoneContext, type Microphone } from \"../lib/microphone\";\n\nexport { installLayoutShims, type LayoutBox } from \"./layout\";\nexport { installStorageShim, memoryStorage } from \"./storage\";\nexport { installFakeSpeech, type FakeSpeech, type Spoken } from \"./speech\";\nexport { fakeMicrophone, speechScript, type FakeMicrophoneOptions, type FakeSpeechStretch } from \"./microphone\";\nexport { filledButtons, expectOneFilledButton, asyncButtonPhase } from \"./buttons\";\nexport {\n installFakeIntersectionObserver,\n type FakeIntersectionObserverControls,\n type FakeObserver,\n} from \"./intersection-observer\";\n\n// Render a component the way a Strata app runs it: inside a router and a query client. Tests use\n// MSW for the network (see CLAUDE.md), never module mocks, so the real fetch/query/DataView path\n// runs. Each call gets a fresh QueryClient with retries off, so a test that serves a 500 sees the\n// error at once instead of after the retry delay. It also runs inside a ThemeProvider with\n// storage off, so `useColorScheme` works and a test can render the dark scheme with\n// `colorScheme: \"dark\"` without touching localStorage or leaking state into the next test.\n\n/** A query client for tests: no retries, and nothing goes stale or is collected mid-test. */\nexport function createTestQueryClient() {\n return createQueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity, gcTime: Infinity } } });\n}\n\n/** The options `renderWithStrata` and `renderRoutes` share, beside Testing Library's own. */\nexport type StrataRenderOptions = Omit<RenderOptions, \"wrapper\"> & {\n /** The URL the test starts at, with its search and hash (`/bookings?sort=pieces.desc`). Defaults to `/`. */\n route?: string;\n /** The query client; a fresh `createTestQueryClient()` when left out. */\n client?: QueryClient;\n /** The colour scheme to render; `light` when left out. */\n colorScheme?: ColorSchemePreference;\n /** 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. */\n toasts?: boolean;\n /** The microphone a recording screen gets from `useMicrophone()`, such as `fakeMicrophone()`; the browser's when left out (which jsdom cannot open). */\n microphone?: Microphone;\n};\n\n// The providers every Strata app has above its router, in the order an app nests them.\nfunction StrataProviders({\n client,\n colorScheme,\n toasts,\n microphone,\n children,\n}: {\n client: QueryClient;\n colorScheme: ColorSchemePreference;\n toasts: boolean;\n microphone?: Microphone;\n children: React.ReactNode;\n}) {\n const tree = (\n <ThemeProvider defaultPreference={colorScheme} storageKey={null}>\n <StrataQueryProvider client={client}>\n {children}\n {toasts && <StrataToastRegion />}\n </StrataQueryProvider>\n </ThemeProvider>\n );\n return microphone ? <MicrophoneContext.Provider value={microphone}>{tree}</MicrophoneContext.Provider> : tree;\n}\n\n/** Testing Library's `render` inside `StrataQueryProvider` and a `MemoryRouter` at `route`. */\nexport function renderWithStrata(\n ui: React.ReactElement,\n { route = \"/\", client = createTestQueryClient(), colorScheme = \"light\", toasts = true, microphone, ...options }: StrataRenderOptions = {},\n) {\n toast.clear(); // module state: a toast from the last test must not show in this one\n const Wrapper = ({ children }: { children: React.ReactNode }) => (\n <StrataProviders client={client} colorScheme={colorScheme} toasts={toasts} microphone={microphone}>\n <MemoryRouter initialEntries={[route]}>{children}</MemoryRouter>\n </StrataProviders>\n );\n return { client, ...render(ui, { wrapper: Wrapper, ...options }) };\n}\n\n// Render an app's own route tree: its layout routes and <Outlet />s, index routes, redirects\n// (<Navigate /> or a loader's redirect()), loaders, actions and error elements. Those only run in\n// a data router, which <MemoryRouter> is not, so renderWithStrata cannot show them; this builds\n// the memory twin of the app's createBrowserRouter from the same RouteObject[] the app exports,\n// so the test and the app cannot drift. The providers and options are renderWithStrata's.\n// `basename` is the app's own (the kiln app runs under /kiln), and `route` is the full URL,\n// basename included, as the browser would show it. The router is returned so a test can assert\n// where a redirect landed (`router.state.location`), and `navigate` moves it inside act().\n\n/** `renderRoutes`'s options: `renderWithStrata`'s, plus the app's `basename`. */\nexport type RenderRoutesOptions = StrataRenderOptions & {\n /** The base path the app is served under, as passed to `createBrowserRouter`. */\n basename?: string;\n};\n\n/** Testing Library's `render` of an app's route tree in a memory data router at `route`, with Strata's providers. */\nexport function renderRoutes(\n routes: RouteObject[],\n {\n route,\n basename,\n client = createTestQueryClient(),\n colorScheme = \"light\",\n toasts = true,\n microphone,\n ...options\n }: RenderRoutesOptions = {},\n) {\n toast.clear();\n const router = createMemoryRouter(routes, { initialEntries: [route ?? basename ?? \"/\"], basename });\n const result = render(\n <StrataProviders client={client} colorScheme={colorScheme} toasts={toasts} microphone={microphone}>\n <RouterProvider router={router} />\n </StrataProviders>,\n options,\n );\n const navigate = (to: To | number) =>\n act(async () => {\n await (typeof to === \"number\" ? router.navigate(to) : router.navigate(to));\n });\n return { client, router, navigate, ...result };\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,gBAAyB;CACvC,MAAM,uBAAO,IAAI,IAAoB;CACrC,OAAO;EACL,IAAI,SAAS;GACX,OAAO,KAAK;EACd;EACA,aAAa,KAAK,MAAM;EACxB,UAAU,QAAQ,KAAK,IAAI,OAAO,GAAG,CAAC,KAAK;EAC3C,MAAM,UAAU,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU;EAC3C,aAAa,QAAQ,KAAK,KAAK,OAAO,OAAO,GAAG,CAAC;EACjD,UAAU,KAAK,UAAU,KAAK,KAAK,IAAI,OAAO,GAAG,GAAG,OAAO,KAAK,CAA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AClG,MAAM,SAAS,OACb,oBAAC,iBAAD;EAAyB;EAAqB;EAAqB;EAAoB;EACrF,UAAA,oBAAC,gBAAD,EAAwB,OAAS,CAAA;CAClB,CAAA,GACjB,OACF;CACA,MAAM,YAAY,OAChB,IAAI,YAAY;EACd,OAAO,OAAO,OAAO,WAAW,OAAO,SAAS,EAAE,IAAI,OAAO,SAAS,EAAE;CAC1E,CAAC;CACH,OAAO;EAAE;EAAQ;EAAQ;EAAU,GAAG;CAAO;AAC/C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strata-react",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
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",