diff options
| author | Ricardo Wurmus <rekado@elephly.net> | 2026-01-28 09:08:33 +0100 |
|---|---|---|
| committer | Andreas Enge <andreas@enge.fr> | 2026-02-14 10:18:12 +0100 |
| commit | 6dd4497f6378fe4c2eaf7179c265be8ca0d7b8c6 (patch) | |
| tree | e74077f3d8a40f7e3a41534b32e943f433156f7f /gnu/packages | |
| parent | 853b2585222023bde2aa4f9033cade97548b5735 (diff) | |
gnu: Add js-mathjax-4.
* gnu/packages/patches/mathjax-4.0.0-disable-webpack.patch,
gnu/packages/patches/mathjax-4.0.0-no-a11y.patch: New files.
* gnu/local.mk (dist_patch_DATA): Record them.
* gnu/packages/javascript.scm (js-mathjax-4): New variable.
(js-mathjax-for-r-mathjaxr): Define as alias for js-mathjax-4.
Change-Id: I156605a8d11d615489d8f0c0c267c96339afc3c7
Diffstat (limited to 'gnu/packages')
| -rw-r--r-- | gnu/packages/javascript.scm | 176 | ||||
| -rw-r--r-- | gnu/packages/patches/mathjax-4.0.0-disable-webpack.patch | 15 | ||||
| -rw-r--r-- | gnu/packages/patches/mathjax-4.0.0-no-a11y.patch | 489 |
3 files changed, 650 insertions, 30 deletions
diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm index e89cdf855e3..bd6d2a0a62b 100644 --- a/gnu/packages/javascript.scm +++ b/gnu/packages/javascript.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net> -;;; Copyright © 2017, 2019, 2020, 2022, 2023 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2017, 2019, 2020, 2022, 2023, 2026 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017, 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2017-2020, 2022-2024 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr> @@ -316,11 +316,10 @@ be able to view it naturally and easily."))) (description (package-description js-mathjax)) (license license:asl2.0))) -(define-public js-mathjax-for-r-mathjaxr +(define-public js-mathjax-4 (package - (inherit js-mathjax-3) (name "js-mathjax") - (version "3.1.2") + (version "4.0.0") (source (origin (method git-fetch) @@ -330,39 +329,136 @@ be able to view it naturally and easily."))) (file-name (git-file-name name version)) (sha256 (base32 - "0kqcb6pl0zfs4hf8zqb4l50kkfq7isv35vpy05m0lg0yr9w0w4ai")) - (patches (search-patches "mathjax-disable-webpack.patch" - "mathjax-3.1.2-no-a11y.patch")))) + "1ak864p80bvsvmz5fb41snrb165zs5miy54h08lld005ph8pqgk0")) + (patches (search-patches "mathjax-4.0.0-disable-webpack.patch" + "mathjax-4.0.0-no-a11y.patch")))) + (build-system gnu-build-system) (arguments - (substitute-keyword-arguments (package-arguments js-mathjax-3) - ((#:phases phases '%standard-phases) - `(modify-phases ,phases - (replace 'prepare-sources - (lambda* (#:key inputs #:allow-other-keys) - ;; All a11y components depend on speech-rule-engine, which cannot be - ;; built from source. Since this only affects accessibility, remove them. - (delete-file-recursively "ts/a11y") - (delete-file-recursively "components/src/a11y") - (delete-file-recursively "components/src/sre") - (delete-file-recursively "components/src/node-main") + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'prepare-sources + (lambda* (#:key inputs #:allow-other-keys) + ;; All a11y components depend on speech-rule-engine, which cannot be + ;; built from source. Since this only affects accessibility, remove them. + (delete-file-recursively "ts/a11y/") + (delete-file-recursively "components/mjs/a11y") + (delete-file-recursively "components/mjs/sre") + (delete-file-recursively "components/mjs/node-main") - ;; Copy sources of dependencies, so we can create symlinks. - (mkdir-p "node_modules") - (with-directory-excursion "node_modules" - (for-each - (lambda (p) - (copy-recursively (assoc-ref inputs (string-append "node-" p)) p)) - '("mj-context-menu"))) + ;; Copy sources of dependencies, so we can create symlinks. + (mkdir-p "node_modules") + (let ((components (string-append (getcwd) "/components")) + (subdir "mathjax-newcm-font")) + (with-directory-excursion "node_modules" + (for-each + (lambda (p) + (copy-recursively (assoc-ref inputs (string-append "node-" p)) p)) + '("mj-context-menu" "mhchemparser"))) - ;; Make sure esbuild can find imports. This way we don’t have to rewrite files. - (symlink "ts" "js") - (symlink "ts" "node_modules/mj-context-menu/js"))))))) + ;; Unpack font files. + (mkdir-p subdir) + (invoke "tar" "-xf" (assoc-ref inputs "node-mathjax-newcm-font") + "-C" subdir + "--strip-components=1") + (substitute* (find-files subdir "\\.js$") + (("@mathjax/src/mjs/output/chtml/") + (string-append components "/mjs/output/chtml/lib/output/chtml/")) + (("@mathjax/src/mjs/output/svg/") + (string-append components "/mjs/output/svg/lib/output/svg/")) + (("@mathjax/src/mjs/output/common/") + (string-append components "/mjs/output/chtml/lib/output/common/")) + (("@mathjax/src/components/") + (string-append components "/")) + (("@mathjax/src/mjs/util/Options.js") + (string-append components "/mjs/core/lib/util/Options.js"))) + (rename-file (string-append subdir "/mjs") "components/mjs/font")) + + ;; Make sure esbuild can find imports. This way we don’t have to rewrite files. + (symlink "ts" "js") + (symlink "ts" "mjs") + (symlink "ts" "node_modules/mj-context-menu/js") + (substitute* "package.json" + (("@mathjax/src/") "./js/") + (("@mathjax/mathjax-newcm-font/mjs/") "./components/mjs/font/")))) + (delete 'configure) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((esbuild (string-append (assoc-ref inputs "esbuild") + "/bin/esbuild")) + (node (string-append (assoc-ref inputs "node") + "/bin/node")) + (npm (string-append (assoc-ref inputs "node") + "/bin/npm")) + (target (string-append #$output + "/share/javascript/mathjax"))) + ;; Prepare fonts. + (invoke node "components/bin/makeAll" "--mjs" "components/mjs/font") + ;; Preprocess files and generate lib/ subdirs. + (invoke node "components/bin/makeAll" "--mjs" "components/mjs") + ;; Build components. + (apply + invoke + esbuild + "--bundle" + "--minify" + ;; esbuild cannot transpile some features to ES5, so use ES6 instead. + "--target=es6" + (string-append "--outdir=" target) + "--sourcemap" + "--outbase=components/mjs" + "--define:__dirname=\"/\"" + ;; In the browser the global object is window, see + ;; https://developer.mozilla.org/en-US/docs/Glossary/Global_object + "--define:global=window" + ;; Find all component entry points, which have the same name as their + ;; parent directory. + (filter + (lambda (f) + (string=? + (basename (dirname f)) + (string-drop-right (basename f) 3))) + (find-files "components/mjs" "\\.js$"))) + ;; Move all .js files into their parent directory, where MathJax + ;; expects them. + (for-each + (lambda (f) + (rename-file f (string-append (dirname (dirname f)) "/" (basename f)))) + (find-files target "\\.js(\\.map)?$")) + + ;; Copy font files. These files contain character tables, + ;; which is why they are so large. The tools to generate + ;; these tables has not been released yet, so we install them + ;; as opaque data instead of building them from font + ;; definition files. + (install-file + "mathjax-newcm-font/chtml.js" + (string-append target "/font/")) + (install-file + "mathjax-newcm-font/tex-mml-chtml-mathjax-newcm.js" + (string-append target "/font/")) + (copy-recursively + "mathjax-newcm-font/chtml/woff2" + (string-append target "/font/chtml/woff2"))))) + (delete 'check) + (delete 'install)))) (native-inputs `(("esbuild" ,esbuild) ("node" ,node-lts) + ;; There is no public source code repository for this component. See + ;; <https://github.com/mathjax/MathJax-src/issues/973>. + ("node-mathjax-newcm-font" + ,(origin + (method url-fetch) + (uri (string-append "https://registry.npmjs.org/@mathjax/" + "mathjax-newcm-font/-/mathjax-newcm-font-" + version ".tgz")) + (sha256 + (base32 + "0cklfhl2n5zy20cnik1ww068rk91bsvllx8bnrjhjbk1sz7yw63q")))) ("node-mj-context-menu" ,(let ((name "context-menu") - (version "0.6.1")) + (version "0.9.1")) (origin (method git-fetch) (uri (git-reference @@ -371,7 +467,27 @@ be able to view it naturally and easily."))) (file-name (git-file-name name version)) (sha256 (base32 - "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh"))))))))) + "03wdf8v99sxr91h4b21gaggf32h5l0h2jk0yw3wm6f6r1ildxdap"))))) + ("node-mhchemparser" + ,(let ((name "mhchemparser") + ;; Version 4.2.1. There are no tags. + (commit "2159346e2bb45ec6beaf64b617e0e5a049b4d200") + (revision "0")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mhchem/mhchemParser.git") + (commit commit))) + (file-name (git-file-name name (git-version "4.2.1" revision commit))) + (sha256 + (base32 + "1xzzfrk5bl5cby77qm0bdsmzjmfxxzjrzdh0cw5f811r78js0cib"))))))) + (home-page "https://www.mathjax.org/") + (synopsis (package-synopsis js-mathjax)) + (description (package-description js-mathjax)) + (license license:asl2.0))) + +(define-public js-mathjax-for-r-mathjaxr js-mathjax-4) (define-public js-commander (package diff --git a/gnu/packages/patches/mathjax-4.0.0-disable-webpack.patch b/gnu/packages/patches/mathjax-4.0.0-disable-webpack.patch new file mode 100644 index 00000000000..8bec8806749 --- /dev/null +++ b/gnu/packages/patches/mathjax-4.0.0-disable-webpack.patch @@ -0,0 +1,15 @@ +Guix uses esbuild to “link” the files. We only need the build step. + +diff --git a/components/bin/makeAll b/components/bin/makeAll +--- a/components/bin/makeAll ++++ b/components/bin/makeAll +@@ -154,7 +154,7 @@ + const fulldir = path.resolve(root, dir); + const config = getConfig(fulldir); + processDir(fulldir, buildLib, config); +- processDir(fulldir, copyLib, config); +- processDir(fulldir, webpackLib, config); ++ //processDir(fulldir, copyLib, config); ++ //processDir(fulldir, webpackLib, config); + } + } diff --git a/gnu/packages/patches/mathjax-4.0.0-no-a11y.patch b/gnu/packages/patches/mathjax-4.0.0-no-a11y.patch new file mode 100644 index 00000000000..d22f538ba4c --- /dev/null +++ b/gnu/packages/patches/mathjax-4.0.0-no-a11y.patch @@ -0,0 +1,489 @@ +diff -ur a/components/mjs/a11y/explorer/config.json b/components/mjs/a11y/explorer/config.json +--- a/components/mjs/a11y/explorer/config.json 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/a11y/explorer/config.json 2026-01-26 09:55:11.623580625 +0100 +@@ -7,8 +7,6 @@ + "name": "a11y/explorer", + "libs": [ + "components/src/a11y/semantic-enrich/lib", +- "components/src/a11y/speech/lib", +- "components/src/a11y/sre/lib", + "components/src/input/mml/lib", + "components/src/core/lib" + ] +diff -ur a/components/mjs/a11y/semantic-enrich/config.json b/components/mjs/a11y/semantic-enrich/config.json +--- a/components/mjs/a11y/semantic-enrich/config.json 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/a11y/semantic-enrich/config.json 2026-01-26 09:54:51.467512431 +0100 +@@ -10,7 +10,6 @@ + "libs": [ + "components/src/input/mml/lib", + "components/src/core/lib", +- "components/src/a11y/sre/lib", + "components/src/loader/lib" + ] + } +diff -ur a/components/mjs/a11y/util.js b/components/mjs/a11y/util.js +--- a/components/mjs/a11y/util.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/a11y/util.js 2026-01-26 11:27:00.259216414 +0100 +@@ -1,13 +1,7 @@ + import {Loader} from '#js/components/loader.js'; + import '../input/mml/init.js'; +-import './sre/sre.js'; + import './semantic-enrich/semantic-enrich.js'; +-import './speech/speech.js'; +-import './explorer/explorer.js'; + + Loader.preLoaded( +- 'a11y/sre', + 'a11y/semantic-enrich', +- 'a11y/speech', +- 'a11y/explorer' + ); +diff -ur a/components/mjs/dependencies.js b/components/mjs/dependencies.js +--- a/components/mjs/dependencies.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/dependencies.js 2026-01-26 11:27:31.211335738 +0100 +@@ -16,10 +16,8 @@ + */ + + export const dependencies = { +- 'a11y/semantic-enrich': ['input/mml', 'a11y/sre'], +- 'a11y/speech': ['a11y/semantic-enrich'], ++ 'a11y/semantic-enrich': ['input/mml'], + 'a11y/complexity': ['a11y/semantic-enrich'], +- 'a11y/explorer': ['a11y/speech'], + '[mml]/mml3': ['input/mml'], + '[tex]/action': ['input/tex-base'], + '[tex]/ams': ['input/tex-base', '[tex]/newcommand'], +@@ -61,7 +59,6 @@ + '[tex]/units': ['input/tex-base'], + '[tex]/upgreek': ['input/tex-base'], + '[tex]/verb': ['input/tex-base'], +- 'ui/menu': ['a11y/sre'], + }; + + export const paths = { +diff -ur a/components/mjs/mml-chtml/mml-chtml.js b/components/mjs/mml-chtml/mml-chtml.js +--- a/components/mjs/mml-chtml/mml-chtml.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/mml-chtml/mml-chtml.js 2026-01-26 09:51:40.893614207 +0100 +@@ -4,7 +4,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/chtml/chtml.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/mml-chtml-nofont/mml-chtml-nofont.js b/components/mjs/mml-chtml-nofont/mml-chtml-nofont.js +--- a/components/mjs/mml-chtml-nofont/mml-chtml-nofont.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/mml-chtml-nofont/mml-chtml-nofont.js 2026-01-26 09:53:38.319264663 +0100 +@@ -4,7 +4,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/chtml/chtml.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/mml-svg/mml-svg.js b/components/mjs/mml-svg/mml-svg.js +--- a/components/mjs/mml-svg/mml-svg.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/mml-svg/mml-svg.js 2026-01-26 09:55:49.927710134 +0100 +@@ -4,7 +4,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/svg/svg.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/mml-svg-nofont/mml-svg-nofont.js b/components/mjs/mml-svg-nofont/mml-svg-nofont.js +--- a/components/mjs/mml-svg-nofont/mml-svg-nofont.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/mml-svg-nofont/mml-svg-nofont.js 2026-01-26 09:53:45.819290087 +0100 +@@ -4,7 +4,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/svg/svg.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/source.js b/components/mjs/source.js +--- a/components/mjs/source.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/source.js 2026-01-26 11:28:05.171466461 +0100 +@@ -73,11 +73,7 @@ + 'output/svg': `${src}/output/svg/svg.js`, + 'a11y/assistive-mml': `${src}/a11y/assistive-mml/assistive-mml.js`, + 'a11y/semantic-enrich': `${src}/a11y/semantic-enrich/semantic-enrich.js`, +- 'a11y/speech': `${src}/a11y/speech/speech.js`, + 'a11y/complexity': `${src}/a11y/complexity/complexity.js`, +- 'a11y/explorer': `${src}/a11y/explorer/explorer.js`, +- 'a11y/sre': `${src}/a11y/sre/sre.js`, +- '[mathmaps]': `${src}/../../bundle/sre/mathmaps`, + 'ui/lazy': `${src}/ui/lazy/lazy.js`, + 'ui/menu': `${src}/ui/menu/menu.js`, + 'ui/safe': `${src}/ui/safe/safe.js`, +diff -ur a/components/mjs/tex-chtml/tex-chtml.js b/components/mjs/tex-chtml/tex-chtml.js +--- a/components/mjs/tex-chtml/tex-chtml.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-chtml/tex-chtml.js 2026-01-26 09:53:41.947276962 +0100 +@@ -4,7 +4,6 @@ + import '../input/tex/tex.js'; + import {loadFont} from '../output/chtml/chtml.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/tex-chtml-nofont/tex-chtml-nofont.js b/components/mjs/tex-chtml-nofont/tex-chtml-nofont.js +--- a/components/mjs/tex-chtml-nofont/tex-chtml-nofont.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-chtml-nofont/tex-chtml-nofont.js 2026-01-26 09:51:32.803991787 +0100 +@@ -4,7 +4,6 @@ + import '../input/tex/tex.js'; + import {loadFont} from '../output/chtml/chtml.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'core', +diff -ur a/components/mjs/tex-mml-chtml/tex-mml-chtml.js b/components/mjs/tex-mml-chtml/tex-mml-chtml.js +--- a/components/mjs/tex-mml-chtml/tex-mml-chtml.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-mml-chtml/tex-mml-chtml.js 2026-01-26 09:53:30.887239463 +0100 +@@ -5,7 +5,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/chtml/chtml.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/tex-mml-chtml-nofont/tex-mml-chtml-nofont.js b/components/mjs/tex-mml-chtml-nofont/tex-mml-chtml-nofont.js +--- a/components/mjs/tex-mml-chtml-nofont/tex-mml-chtml-nofont.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-mml-chtml-nofont/tex-mml-chtml-nofont.js 2026-01-26 09:51:22.243799809 +0100 +@@ -5,7 +5,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/chtml/chtml.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/tex-mml-svg/tex-mml-svg.js b/components/mjs/tex-mml-svg/tex-mml-svg.js +--- a/components/mjs/tex-mml-svg/tex-mml-svg.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-mml-svg/tex-mml-svg.js 2026-01-26 09:51:14.670501005 +0100 +@@ -5,7 +5,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/svg/svg.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/tex-mml-svg-nofont/tex-mml-svg-nofont.js b/components/mjs/tex-mml-svg-nofont/tex-mml-svg-nofont.js +--- a/components/mjs/tex-mml-svg-nofont/tex-mml-svg-nofont.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-mml-svg-nofont/tex-mml-svg-nofont.js 2026-01-26 09:53:34.387251331 +0100 +@@ -5,7 +5,6 @@ + import '../input/mml/mml.js'; + import {loadFont} from '../output/svg/svg.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/tex-svg/tex-svg.js b/components/mjs/tex-svg/tex-svg.js +--- a/components/mjs/tex-svg/tex-svg.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-svg/tex-svg.js 2026-01-26 09:53:26.683225207 +0100 +@@ -4,7 +4,6 @@ + import '../input/tex/tex.js'; + import {loadFont} from '../output/svg/svg.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'loader', 'startup', +diff -ur a/components/mjs/tex-svg-nofont/tex-svg-nofont.js b/components/mjs/tex-svg-nofont/tex-svg-nofont.js +--- a/components/mjs/tex-svg-nofont/tex-svg-nofont.js 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/tex-svg-nofont/tex-svg-nofont.js 2026-01-26 09:55:54.519725652 +0100 +@@ -4,7 +4,6 @@ + import '../input/tex/tex.js'; + import {loadFont} from '../output/svg/svg.js'; + import '../ui/menu/menu.js'; +-import '../a11y/util.js'; + + Loader.preLoaded( + 'core', +diff -ur a/components/mjs/ui/menu/config.json b/components/mjs/ui/menu/config.json +--- a/components/mjs/ui/menu/config.json 1970-01-01 01:00:01.000000000 +0100 ++++ b/components/mjs/ui/menu/config.json 2026-01-26 09:52:50.136135319 +0100 +@@ -1,14 +1,13 @@ + { + "build": { + "component": "ui/menu", +- "targets": ["ui/menu", "a11y/speech/SpeechMenu.ts"], ++ "targets": ["ui/menu"], + "excludeSubdirs": true + }, + "webpack": { + "name": "ui/menu", + "libs": [ + "components/src/core/lib", +- "components/src/a11y/sre/lib", + "node_modules/mj-context-menu/js" + ] + } +diff -ur a/ts/a11y/explorer.ts b/ts/a11y/explorer.ts +--- a/ts/a11y/explorer.ts 1970-01-01 01:00:01.000000000 +0100 ++++ b/ts/a11y/explorer.ts 2026-01-26 11:23:15.894346209 +0100 +@@ -25,7 +25,6 @@ + import { MmlNode } from '../core/MmlTree/MmlNode.js'; + import { MathML } from '../input/mathml.js'; + import { STATE, newState } from '../core/MathItem.js'; +-import { SpeechMathItem, SpeechMathDocument, SpeechHandler } from './speech.js'; + import { MathDocumentConstructor } from '../core/MathDocument.js'; + import { OptionList, expandable } from '../util/Options.js'; + import { SerializedMmlVisitor } from '../core/MmlTree/SerializedMmlVisitor.js'; +@@ -35,8 +34,6 @@ + + import { ExplorerPool, RegionPool } from './explorer/ExplorerPool.js'; + +-import * as Sre from './sre.js'; +- + const isUnix = context.os === 'Unix'; + + /** +@@ -167,26 +164,16 @@ + * @override + */ + public attachSpeech(document: ExplorerMathDocument) { +- super.attachSpeech(document); +- this.outputData.speechPromise +- ?.then(() => this.explorers.speech.attachSpeech()) +- ?.then(() => { +- if (this.explorers?.speech) { +- this.explorers.speech.restarted = this.refocus; +- } +- this.refocus = null; +- if (this.explorers) { +- this.explorers.restart(); +- } +- }); ++ console.log("ignoring attachSpeech: speech is disabled"); ++ return; + } + + /** + * @override + */ + public detachSpeech(document: ExplorerMathDocument) { +- super.detachSpeech(document); +- this.explorers.speech.detachSpeech(); ++ console.log("ignoring detachSpeech: speech is disabled"); ++ return; + } + + /** +@@ -243,7 +230,7 @@ + public setTemporaryFocus(document: ExplorerMathDocument): HTMLElement { + let focus = null; + if (this.explorers) { +- const speech = this.explorers.speech; ++ const speech = null; + focus = speech?.attached ? document.tmpFocus : null; + if (focus) { + this.refocus = speech.semanticFocus() ?? null; +@@ -325,10 +312,6 @@ + ...BaseDocument.OPTIONS.renderActions, + explorable: [STATE.EXPLORER] + }), +- sre: expandable({ +- ...BaseDocument.OPTIONS.sre, +- speech: 'none', // None as speech is explicitly computed +- }), + a11y: { + ...BaseDocument.OPTIONS.a11y, + align: 'top', // placement of magnified expression +@@ -527,9 +510,6 @@ + const visitor = new SerializedMmlVisitor(this.mmlFactory); + const toMathML = (node: MmlNode) => visitor.visitTree(node); + const options = this.options; +- if (!options.a11y.speechRules) { +- options.a11y.speechRules = `${options.sre.domain}-${options.sre.style}`; +- } + const mathItem = (options.MathItem = ExplorerMathItemMixin( + options.MathItem, + toMathML +@@ -653,12 +633,9 @@ + ) { + // TODO (volker): This needs to be replace by the engine feature vector. + // Minus rule sets etc. Breaking change in SRE. +- const sreOptions = Sre.engineSetup() as { [name: string]: string }; + for (const key in options) { + if (document.options.a11y[key] !== undefined) { + setA11yOption(document, key, options[key]); +- } else if (sreOptions[key] !== undefined) { +- document.options.sre[key] = options[key]; + } + } + if (options.roleDescription) { +@@ -684,9 +661,6 @@ + ) { + switch (option) { + case 'speechRules': { +- const [domain, style] = (value as string).split('-'); +- document.options.sre.domain = domain; +- document.options.sre.style = style; + break; + } + case 'magnification': +@@ -728,7 +702,6 @@ + } + break; + case 'locale': +- document.options.sre.locale = value; + break; + default: + document.options.a11y[option] = value; +diff -ur a/ts/ui/menu/MenuHandler.ts b/ts/ui/menu/MenuHandler.ts +--- a/ts/ui/menu/MenuHandler.ts 1970-01-01 01:00:01.000000000 +0100 ++++ b/ts/ui/menu/MenuHandler.ts 2026-01-26 11:40:15.606237915 +0100 +@@ -24,21 +24,11 @@ + import { mathjax } from '../../mathjax.js'; + + import { STATE, newState } from '../../core/MathItem.js'; +-import { MathDocumentConstructor } from '../../core/MathDocument.js'; ++import { MathDocument, MathDocumentConstructor } from '../../core/MathDocument.js'; + import { Handler } from '../../core/Handler.js'; +-import { +- ComplexityMathDocument, +- ComplexityMathItem, +-} from '../../a11y/complexity.js'; +-import { +- AssistiveMmlMathDocument, +- AssistiveMmlMathItem, +-} from '../../a11y/assistive-mml.js'; +-import { SpeechMathDocument } from '../../a11y/speech.js'; + import { expandable } from '../../util/Options.js'; + + import { Menu } from './Menu.js'; +-import '../../a11y/speech/SpeechMenu.js'; + + /*==========================================================================*/ + +@@ -50,8 +40,7 @@ + /** + * Generic A11Y MathItem type + */ +-export type A11yMathItem = ComplexityMathItem<HTMLElement, Text, Document> & +- AssistiveMmlMathItem<HTMLElement, Text, Document>; ++export type A11yMathItem = MathItem<HTMLElement, Text, Document>; + + /** + * Constructor for base MathItem for MenuMathItem +@@ -63,13 +52,11 @@ + /** + * Generic A11Y MathDocument type + */ +-export type A11yMathDocument = ComplexityMathDocument< ++export type A11yMathDocument = MathDocument< + HTMLElement, + Text, + Document +-> & +- SpeechMathDocument<HTMLElement, Text, Document> & +- AssistiveMmlMathDocument<HTMLElement, Text, Document>; ++>; + + /** + * Constructor for base document for MenuMathDocument +@@ -87,7 +74,7 @@ + * The new function for MathItem that adds the context menu + */ + export interface MenuMathItem +- extends ComplexityMathItem<HTMLElement, Text, Document> { ++ extends MathItem<HTMLElement, Text, Document> { + /** + * @param {MenuMathDocument} document The document where the menu is being added + * @param {boolean} force True if menu should be added even if enableMenu is false +@@ -151,8 +138,7 @@ + * The properties needed in the MathDocument for context menus + */ + export interface MenuMathDocument +- extends ComplexityMathDocument<HTMLElement, Text, Document>, +- SpeechMathDocument<HTMLElement, Text, Document> { ++ extends MathDocument<HTMLElement, Text, Document> { + /** + * The menu associated with this document + */ +@@ -208,7 +194,7 @@ + MenuClass: Menu, + menuOptions: Menu.OPTIONS, + enableMenu: true, +- sre: BaseDocument.OPTIONS.sre || expandable({}), ++ sre: false, + a11y: BaseDocument.OPTIONS.a11y || expandable({}), + renderActions: expandable({ + ...BaseDocument.OPTIONS.renderActions, +@@ -249,10 +235,10 @@ + const settings = this.menu.settings; + const options = this.options; + const enrich = (options.enableEnrichment = settings.enrich); +- options.enableSpeech = settings.speech && enrich; ++ options.enableSpeech = false; + options.enableBraille = settings.braille && enrich; +- options.enableComplexity = settings.collapsible && enrich; +- options.enableExplorer = enrich; ++ options.enableComplexity = false; ++ options.enableExplorer = false; + } + + /** +@@ -304,12 +290,6 @@ + this.menu.loadingPromise.catch((err) => console.log(err)) + ); + } +- if (this.options.enableComplexity) { +- this.menu.checkComponent('a11y/complexity'); +- } +- if (this.options.enableExplorer) { +- this.menu.checkComponent('a11y/explorer'); +- } + return this; + } + +diff -ur a/ts/ui/menu/Menu.ts b/ts/ui/menu/Menu.ts +--- a/ts/ui/menu/Menu.ts 1970-01-01 01:00:01.000000000 +0100 ++++ b/ts/ui/menu/Menu.ts 2026-01-26 11:29:48.979864791 +0100 +@@ -149,10 +149,10 @@ + breakInline: true, + autocollapse: false, + collapsible: false, +- enrich: true, ++ enrich: false, + inTabOrder: true, + assistiveMml: false, +- speech: true, ++ speech: false, + braille: true, + brailleCode: 'nemeth', + speechRules: 'clearspeak-default', +@@ -1190,7 +1190,7 @@ + * Enable/disable assistive menus based on enrichment setting + */ + protected setAccessibilityMenus() { +- const enable = this.settings.enrich; ++ const enable = false; + const method = enable ? 'enable' : 'disable'; + ['Speech', 'Braille', 'Explorer'].forEach((id) => + this.menu.findID(id)[method]() +@@ -1210,6 +1210,7 @@ + * @param {boolean} speech True to enable speech, false to not + */ + protected setSpeech(speech: boolean) { ++ speech = false; + this.enableAccessibilityItems('Speech', speech); + this.document.options.enableSpeech = speech; + if (!speech || MathJax._?.a11y?.explorer) { +@@ -1223,6 +1224,7 @@ + * @param {boolean} braille True to enable braille, false to not + */ + protected setBraille(braille: boolean) { ++ braille = false; + this.enableAccessibilityItems('Braille', braille); + this.document.options.enableBraille = braille; + if (!braille || MathJax._?.a11y?.explorer) { |
