first commit
This commit is contained in:
1
mathjax/a11y/assistive-mml.js
Normal file
1
mathjax/a11y/assistive-mml.js
Normal file
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AssistiveMmlHandler:()=>M,AssistiveMmlMathDocumentMixin:()=>h,AssistiveMmlMathItemMixin:()=>d,LimitedMmlVisitor:()=>c});const s=("undefined"!=typeof window?window:global).MathJax._.components.global,i=(s.GLOBAL,s.isObject,s.combineConfig,s.combineDefaults),o=s.combineWithMathJax,a=(s.MathJax,MathJax._.core.MathItem),n=(a.protoItem,a.AbstractMathItem,a.STATE),r=a.newState,l=MathJax._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor,p=MathJax._.util.Options,m=(p.isObject,p.APPEND,p.REMOVE,p.OPTIONS,p.Expandable,p.expandable);p.makeArray,p.keys,p.copy,p.insert,p.defaultOptions,p.userOptions,p.selectOptions,p.selectOptionsFromKeys,p.separateOptions,p.lookup;class c extends l{getAttributes(t){return super.getAttributes(t).replace(/ ?id=".*?"/,"")}}function d(t){return class extends t{assistiveMml(t,e=!1){if(!(this.state()>=n.ASSISTIVEMML)){if(!this.isEscaped&&(t.options.enableAssistiveMml||e)){const e=t.adaptor,s=t.toMML(this.root).replace(/\n */g,"").replace(/<!--.*?-->/g,""),i=e.firstChild(e.body(e.parse(s,"text/html"))),o=e.node("mjx-assistive-mml",{unselectable:"on",display:this.display?"block":"inline"},[i]);e.setAttribute(e.firstChild(this.typesetRoot),"aria-hidden","true"),e.setStyle(this.typesetRoot,"position","relative"),e.append(this.typesetRoot,o)}this.state(n.ASSISTIVEMML)}}}}function h(t){var e;return(e=class extends t{constructor(...t){super(...t);const e=this.constructor,s=e.ProcessBits;s.has("assistive-mml")||s.allocate("assistive-mml"),this.visitor=new c(this.mmlFactory),this.options.MathItem=d(this.options.MathItem),"addStyles"in this&&this.addStyles(e.assistiveStyles)}toMML(t){return this.visitor.visitTree(t)}assistiveMml(){if(!this.processed.isSet("assistive-mml")){for(const t of this.math)t.assistiveMml(this);this.processed.set("assistive-mml")}return this}state(t,e=!1){return super.state(t,e),t<n.ASSISTIVEMML&&this.processed.clear("assistive-mml"),this}}).OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableAssistiveMml:!0,renderActions:m(Object.assign(Object.assign({},t.OPTIONS.renderActions),{assistiveMml:[n.ASSISTIVEMML]}))}),e.assistiveStyles={"mjx-assistive-mml":{position:"absolute !important",top:"0px",left:"0px",bottom:"0px",right:"0px",clip:"rect(1px, 1px, 1px, 1px)","clip-path":"polygon(0 0, 0 1px, 1px 1px, 1px 0)",padding:"1px 0px 0px 0px !important",border:"0px !important",display:"block !important",width:"auto !important",overflow:"hidden !important","text-indent":"0px ! important","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},'mjx-assistive-mml[display="block"]':{width:"100% !important"}},e}function M(t){return t.documentClass=h(t.documentClass),t}r("ASSISTIVEMML",153),MathJax.loader&&MathJax.loader.checkVersion("a11y/assistive-mml","4.0.0","a11y"),o({_:{a11y:{"assistive-mml":e}}}),MathJax.startup&&(MathJax.config.options&&!1!==MathJax.config.options.enableAssistiveMml&&i(MathJax.config,"options",{menuOptions:{settings:{assistiveMml:!0}}}),MathJax.startup.extendHandler((t=>M(t))))})();
|
||||
1
mathjax/a11y/complexity.js
Normal file
1
mathjax/a11y/complexity.js
Normal file
File diff suppressed because one or more lines are too long
1
mathjax/a11y/explorer.js
Normal file
1
mathjax/a11y/explorer.js
Normal file
File diff suppressed because one or more lines are too long
1
mathjax/a11y/semantic-enrich.js
Normal file
1
mathjax/a11y/semantic-enrich.js
Normal file
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{EnrichHandler:()=>f,EnrichedMathDocumentMixin:()=>M,EnrichedMathItemMixin:()=>u,enrichVisitor:()=>p});const i=("undefined"!=typeof window?window:global).MathJax._.components.global,n=(i.GLOBAL,i.isObject,i.combineConfig,i.combineDefaults,i.combineWithMathJax),s=(i.MathJax,MathJax._.core.MathItem),r=(s.protoItem,s.AbstractMathItem,s.STATE),a=s.newState,o=MathJax._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor,c=MathJax._.util.Options,h=(c.isObject,c.APPEND,c.REMOVE,c.OPTIONS,c.Expandable,c.expandable),l=(c.makeArray,c.keys,c.copy,c.insert,c.defaultOptions,c.userOptions,c.selectOptions,c.selectOptionsFromKeys,c.separateOptions,c.lookup,MathJax._.a11y.sre_ts),d=(l.locales,l.setupEngine),m=(l.engineSetup,l.toEnriched);l.parseDOM,l.addPreference,l.fromPreference,l.toPreference;a("ENRICHED",r.COMPILED+10);class p extends o{visitTree(t,e){this.mactionId=0;const i=super.visitTree(t);return this.mactionId&&(e.inputData.hasMaction=!0),i}visitHtmlNode(t,e){return t.getSerializedXML()}visitMactionNode(t,e){const[i,n]=0===t.childNodes.length?["",""]:["\n",e],s=this.childNodeMml(t,e+" ",i);let r=this.getAttributes(t);if("toggle"===t.attributes.get("actiontype")){const e=++this.mactionId;t.setProperty("mactionId",e),r=` data-maction-id="${e}" selection="${t.attributes.get("selection")}"`+r.replace(/ selection="\d+"/,"").replace(/ data-maction-id="\d+"/,"")}return`${e}<maction${r}>`+(s.match(/\S/)?i+s+n:"")+"</maction>"}}function u(t,e,i){return class extends t{constructor(){super(...arguments),this.toMathML=i}serializeMml(t){if("outerHTML"in t)return t.outerHTML;if("undefined"!=typeof Element&&"undefined"!=typeof window&&t instanceof Element){const e=window.document.createElement("div");return e.appendChild(t),e.innerHTML}return t.toString()}enrich(t,i=!1){if(!(this.state()>=r.ENRICHED)){if(!this.isEscaped&&(t.options.enableEnrichment||i)){const i=new t.options.MathItem("",e);try{let e;e=this.inputData.originalMml?this.adjustSelections():this.inputData.originalMml=this.toMathML(this.root,this);const n=m(e);this.inputData.enrichedMml=i.math=this.serializeMml(n),i.math=i.math.replace(/ role="treeitem"/g,' data-speech-node="true"').replace(/ aria-(?:posinset|owns|setsize)=".*?"/g,""),i.display=this.display,i.compile(t),this.root=i.root}catch(e){t.options.enrichError(t,this,e)}}this.state(r.ENRICHED)}}toEnriched(t){return this.serializeMml(m(t))}unEnrich(t){const i=this.inputData.originalMml;if(!i)return;const n=new t.options.MathItem("",e);n.math=i,n.display=this.display,n.compile(t),this.root=n.root}adjustSelections(){const t=this.inputData.originalMml;if(!this.inputData.hasMaction)return t;const e=[];return this.root.walkTree((t=>{t.isKind("maction")&&(e[t.attributes.get("data-maction-id")]=t)})),t.replace(/(data-maction-id="(\d+)" selection=)"\d+"/g,((t,i,n)=>`${i}"${e[n].attributes.get("selection")}"`))}}}function M(t,e){var i;return(i=class extends t{constructor(...t){super(...t),e.setMmlFactory(this.mmlFactory);const i=this.constructor.ProcessBits;i.has("enriched")||i.allocate("enriched");const n=new p(this.mmlFactory);this.options.MathItem=u(this.options.MathItem,e,((t,e)=>n.visitTree(t,e)))}enrich(){if(!this.processed.isSet("enriched")){if(this.options.enableEnrichment){d(this.options.sre);for(const t of this.math)t.enrich(this)}this.processed.set("enriched")}return this}enrichError(t,e,i){console.warn("Enrichment error:",i)}state(t,e=!1){if(super.state(t,e),t<r.ENRICHED&&(this.processed.clear("enriched"),t>=r.COMPILED))for(const t of this.math)t.unEnrich(this);return this}}).OPTIONS=Object.assign(Object.assign({},t.OPTIONS),{enableEnrichment:!0,enrichError:(t,e,i)=>t.enrichError(t,e,i),renderActions:h(Object.assign(Object.assign({},t.OPTIONS.renderActions),{enrich:[r.ENRICHED]})),sre:h({speech:"none",locale:"en",domain:"clearspeak",style:"default",braille:"nemeth",structure:!0,aria:!0})}),i}function f(t,e){return e.setAdaptor(t.adaptor),t.documentClass=M(t.documentClass,e),t}MathJax.loader&&MathJax.loader.checkVersion("a11y/semantic-enrich","4.0.0","a11y"),n({_:{a11y:{"semantic-enrich":e}}});const E=MathJax._.input.mathml_ts.MathML;MathJax.startup&&MathJax.startup.extendHandler((t=>f(t,new E({allowHtmlInTokenNodes:!0}))))})();
|
||||
1
mathjax/a11y/speech.js
Normal file
1
mathjax/a11y/speech.js
Normal file
File diff suppressed because one or more lines are too long
1
mathjax/a11y/sre.js
Normal file
1
mathjax/a11y/sre.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user