Skip to content

Commit a6d7d91

Browse files
authored
Merge pull request #1085 from mathjax/beta-6-fixes
Fix issues with GeneratorPool init() looping, and move some a11y options to semantic-enrich. Add SRE dependencies.
2 parents ed94a10 + 40d3701 commit a6d7d91

File tree

5 files changed

+39
-12
lines changed

5 files changed

+39
-12
lines changed

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"scripts": {
6868
"=============================================================================== clean": "",
6969
"clean:dir": "clean() { pnpm -s log:single \"Cleaning $1 directory\"; pnpm rimraf $1; }; clean",
70-
"clean:lib": "clean() { pnpm -s log:single \"Cleaning $1 components\"; pnpm rimraf -g components/$1'/**/lib'; }; clean",
70+
"clean:lib": "clean() { pnpm -s log:single \"Cleaning $1 component libs\"; pnpm rimraf -g components/$1'/**/lib'; }; clean",
7171
"clean:mod": "clean() { pnpm -s log:comp \"Cleaning $1 module\"; pnpm -s clean:dir $1 && pnpm -s clean:lib $1; }; clean",
7272
"=============================================================================== copy": "",
7373
"copy:assets": "pnpm -s log:comp 'Copying assets'; copy() { pnpm -s copy:mj2 $1 && pnpm -s copy:mml3 $1; }; copy",
@@ -84,7 +84,7 @@
8484
"cjs:bundle:finalize": "pnpm -s log:single 'Finalize cjs bundle'; echo '{\n \"type\": \"commonjs\"\n}' > bundle-cjs/package.json;",
8585
"cjs:compile": "pnpm -s log:single 'Compiling cjs typescript files' && pnpm tsc --project tsconfig/cjs.json",
8686
"cjs:components:build": "pnpm -s log:comp 'Building cjs components'; pnpm -s cjs:components:src:build && pnpm clean:dir bundle-cjs && pnpm -s cjs:components:make --build",
87-
"cjs:components:clean": "pnpm -s log:single \"Cleaning cjs components\" pnpm rimraf components/cjs",
87+
"cjs:components:clean": "pnpm -s log:single \"Cleaning cjs components\"; pnpm rimraf components/cjs",
8888
"cjs:components:compile": "pnpm -s log:single 'Compiling component files'; pnpm tsc --project tsconfig/components.json",
8989
"cjs:components:copy": "pnpm copyfiles -u 2 -e 'components/mjs/**/*.js' 'components/mjs/**/*' components/cjs",
9090
"cjs:components:finalize": "pnpm -s log:comp 'Finalize cjs components'; pnpm -s cjs:components:copy && pnpm -s copy:pkg components/cjs && pnpm -s clean:lib cjs",
@@ -138,9 +138,12 @@
138138
"xslt3": "^2.6.0"
139139
},
140140
"dependencies": {
141+
"@xmldom/xmldom": "^0.8.10",
142+
"commander": "^12.0.0",
141143
"mathjax-modern-font": "^4.0.0-beta.5",
142144
"mhchemparser": "^4.2.1",
143145
"mj-context-menu": "^0.9.1",
144-
"speech-rule-engine": "^4.1.0-beta.9"
146+
"speech-rule-engine": "^4.1.0-beta.9",
147+
"wicked-good-xpath": "^1.3.0"
145148
}
146149
}

pnpm-lock.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/a11y/explorer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ export function ExplorerMathDocumentMixin<B extends MathDocumentConstructor<HTML
200200
aria: true,
201201
}),
202202
a11y: {
203+
...BaseDocument.OPTIONS.a11y,
203204
align: 'top', // placement of magnified expression
204205
backgroundColor: 'Blue', // color for background of selected sub-expression
205206
backgroundOpacity: 20, // opacity for background of selected sub-expression
206-
braille: true, // switch on Braille output
207207
flame: false, // color collapsible sub-expressions
208208
foregroundColor: 'Black', // color to use for text of selected sub-expression
209209
foregroundOpacity: 100, // opacity for text of selected sub-expression
@@ -216,7 +216,6 @@ export function ExplorerMathDocumentMixin<B extends MathDocumentConstructor<HTML
216216
magnification: 'None', // type of magnification
217217
magnify: '400%', // percentage of magnification of zoomed expressions
218218
mouseMagnifier: false, // switch on magnification via mouse hovering
219-
speech: true, // switch on speech output
220219
subtitles: true, // show speech as a subtitle
221220
treeColoring: false, // tree color expression
222221
viewBraille: true, // display Braille output as subtitles

ts/a11y/semantic-enrich.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,14 @@ export function EnrichedMathDocumentMixin<N, T, D, B extends MathDocumentConstru
382382
sre: expandable({
383383
speech: 'none', // by default no speech is included
384384
locale: 'en', // switch the locale
385-
domain: 'clearspeak', // speech rules domain
385+
domain: 'clearspeak', // speech rules domain
386386
style: 'default', // speech rules style
387387
braille: 'nemeth', // TODO: Dummy switch for braille
388388
}),
389+
a11y: expandable({
390+
speech: true, // switch on speech output
391+
braille: true, // switch on Braille output
392+
})
389393
};
390394

391395
/**

ts/a11y/speech/GeneratorPool.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export class GeneratorPool<N, T, D> {
6868
/**
6969
* The current speech setting for Sre
7070
*/
71-
private currentLocale = 'none';
72-
private currentBraille = 'none';
71+
private static currentLocale = 'none';
72+
private static currentBraille = 'none';
7373
private _options: OptionList = {};
7474

7575
/**
@@ -138,13 +138,13 @@ export class GeneratorPool<N, T, D> {
138138
private _update(options: OptionList) {
139139
if (!options || !options.sre) return false;
140140
let update = false;
141-
if (options.sre.braille !== this.currentBraille) {
142-
this.currentBraille = options.sre.braille;
141+
if (options.sre.braille !== GeneratorPool.currentBraille) {
142+
GeneratorPool.currentBraille = options.sre.braille;
143143
update = true;
144144
Sre.setupEngine({locale: options.sre.braille})
145145
}
146-
if (options.sre.locale !== this.currentLocale) {
147-
this.currentLocale = options.sre.locale;
146+
if (options.sre.locale !== GeneratorPool.currentLocale) {
147+
GeneratorPool.currentLocale = options.sre.locale;
148148
update = true;
149149
Sre.setupEngine({locale: options.sre.locale})
150150
}

0 commit comments

Comments
 (0)