@pie-element/shared-math-rendering-mathjax 0.1.3 → 0.1.4-next.20261007175429
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +499 -210
- package/dist/index.d.ts +3 -0
- package/dist/index.js +530 -241
- package/dist/math-name.d.ts +18 -0
- package/dist/math-speech.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface MathNameOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Speaks one MathML `<math>` element. Defaults to the built-in English speaker; a host passes its
|
|
4
|
+
* own to use SRE, another locale or ClearSpeak's full rule set. Returning nothing falls back to
|
|
5
|
+
* the element's text.
|
|
6
|
+
*/
|
|
7
|
+
speak?: (math: Element) => string | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The accessible name of a control from its rendered content, or undefined when the content holds
|
|
11
|
+
* no math, which leaves the name to the browser. Plain text and math keep their order, so a
|
|
12
|
+
* choice of `(9.7 + √25)` followed by `feet` reads as one phrase.
|
|
13
|
+
*
|
|
14
|
+
* Shaped as a `ContentNamer` for `useDraggableControl`, and usable for any control that names
|
|
15
|
+
* itself from its content: the result goes in `aria-label`. Math is read from the hidden MathML
|
|
16
|
+
* that MathJax adds to each `mjx-container`, so call this after the content is typeset.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mathContentName(content: Element, options?: MathNameOptions): string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Speaks MathML as English, for the accessible name of a control that contains math. It reads the
|
|
3
|
+
* hidden MathML both MathJax versions emit, so it runs without MathJax's speech engine and its
|
|
4
|
+
* worker, which a strict CSP blocks. Coverage is the school-math core: numbers, identifiers,
|
|
5
|
+
* operators, fences, fractions, roots, scripts, limits on sums and integrals, accents and tables.
|
|
6
|
+
* An element outside it speaks its children in order. A host that wants SRE or another engine
|
|
7
|
+
* passes its own speaker to `mathContentName`.
|
|
8
|
+
*/
|
|
9
|
+
/** The English speech of one `<math>` element. */
|
|
10
|
+
export declare function speakMathml(math: Element): string;
|