add initial marp implementation with sample content and build configuration
This commit is contained in:
19
node_modules/mathjax-full/js/a11y/assistive-mml.d.ts
generated
vendored
Normal file
19
node_modules/mathjax-full/js/a11y/assistive-mml.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Handler } from '../core/Handler.js';
|
||||
import { MathDocument, AbstractMathDocument, MathDocumentConstructor } from '../core/MathDocument.js';
|
||||
import { MathItem, AbstractMathItem } from '../core/MathItem.js';
|
||||
import { MmlNode } from '../core/MmlTree/MmlNode.js';
|
||||
import { SerializedMmlVisitor } from '../core/MmlTree/SerializedMmlVisitor.js';
|
||||
export declare class LimitedMmlVisitor extends SerializedMmlVisitor {
|
||||
protected getAttributes(node: MmlNode): string;
|
||||
}
|
||||
export declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export interface AssistiveMmlMathItem<N, T, D> extends MathItem<N, T, D> {
|
||||
assistiveMml(document: MathDocument<N, T, D>, force?: boolean): void;
|
||||
}
|
||||
export declare function AssistiveMmlMathItemMixin<N, T, D, B extends Constructor<AbstractMathItem<N, T, D>>>(BaseMathItem: B): Constructor<AssistiveMmlMathItem<N, T, D>> & B;
|
||||
export interface AssistiveMmlMathDocument<N, T, D> extends AbstractMathDocument<N, T, D> {
|
||||
toMML: (node: MmlNode) => string;
|
||||
assistiveMml(): AssistiveMmlMathDocument<N, T, D>;
|
||||
}
|
||||
export declare function AssistiveMmlMathDocumentMixin<N, T, D, B extends MathDocumentConstructor<AbstractMathDocument<N, T, D>>>(BaseDocument: B): MathDocumentConstructor<AssistiveMmlMathDocument<N, T, D>> & B;
|
||||
export declare function AssistiveMmlHandler<N, T, D>(handler: Handler<N, T, D>): Handler<N, T, D>;
|
||||
195
node_modules/mathjax-full/js/a11y/assistive-mml.js
generated
vendored
Normal file
195
node_modules/mathjax-full/js/a11y/assistive-mml.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AssistiveMmlHandler = exports.AssistiveMmlMathDocumentMixin = exports.AssistiveMmlMathItemMixin = exports.LimitedMmlVisitor = void 0;
|
||||
var MathItem_js_1 = require("../core/MathItem.js");
|
||||
var SerializedMmlVisitor_js_1 = require("../core/MmlTree/SerializedMmlVisitor.js");
|
||||
var Options_js_1 = require("../util/Options.js");
|
||||
var LimitedMmlVisitor = (function (_super) {
|
||||
__extends(LimitedMmlVisitor, _super);
|
||||
function LimitedMmlVisitor() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
LimitedMmlVisitor.prototype.getAttributes = function (node) {
|
||||
return _super.prototype.getAttributes.call(this, node).replace(/ ?id=".*?"/, '');
|
||||
};
|
||||
return LimitedMmlVisitor;
|
||||
}(SerializedMmlVisitor_js_1.SerializedMmlVisitor));
|
||||
exports.LimitedMmlVisitor = LimitedMmlVisitor;
|
||||
(0, MathItem_js_1.newState)('ASSISTIVEMML', 153);
|
||||
function AssistiveMmlMathItemMixin(BaseMathItem) {
|
||||
return (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
class_1.prototype.assistiveMml = function (document, force) {
|
||||
if (force === void 0) { force = false; }
|
||||
if (this.state() >= MathItem_js_1.STATE.ASSISTIVEMML)
|
||||
return;
|
||||
if (!this.isEscaped && (document.options.enableAssistiveMml || force)) {
|
||||
var adaptor = document.adaptor;
|
||||
var mml = document.toMML(this.root).replace(/\n */g, '').replace(/<!--.*?-->/g, '');
|
||||
var mmlNodes = adaptor.firstChild(adaptor.body(adaptor.parse(mml, 'text/html')));
|
||||
var node = adaptor.node('mjx-assistive-mml', {
|
||||
unselectable: 'on', display: (this.display ? 'block' : 'inline')
|
||||
}, [mmlNodes]);
|
||||
adaptor.setAttribute(adaptor.firstChild(this.typesetRoot), 'aria-hidden', 'true');
|
||||
adaptor.setStyle(this.typesetRoot, 'position', 'relative');
|
||||
adaptor.append(this.typesetRoot, node);
|
||||
}
|
||||
this.state(MathItem_js_1.STATE.ASSISTIVEMML);
|
||||
};
|
||||
return class_1;
|
||||
}(BaseMathItem));
|
||||
}
|
||||
exports.AssistiveMmlMathItemMixin = AssistiveMmlMathItemMixin;
|
||||
function AssistiveMmlMathDocumentMixin(BaseDocument) {
|
||||
var _a;
|
||||
return _a = (function (_super) {
|
||||
__extends(BaseClass, _super);
|
||||
function BaseClass() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var _this = _super.apply(this, __spreadArray([], __read(args), false)) || this;
|
||||
var CLASS = _this.constructor;
|
||||
var ProcessBits = CLASS.ProcessBits;
|
||||
if (!ProcessBits.has('assistive-mml')) {
|
||||
ProcessBits.allocate('assistive-mml');
|
||||
}
|
||||
_this.visitor = new LimitedMmlVisitor(_this.mmlFactory);
|
||||
_this.options.MathItem =
|
||||
AssistiveMmlMathItemMixin(_this.options.MathItem);
|
||||
if ('addStyles' in _this) {
|
||||
_this.addStyles(CLASS.assistiveStyles);
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
BaseClass.prototype.toMML = function (node) {
|
||||
return this.visitor.visitTree(node);
|
||||
};
|
||||
BaseClass.prototype.assistiveMml = function () {
|
||||
var e_1, _a;
|
||||
if (!this.processed.isSet('assistive-mml')) {
|
||||
try {
|
||||
for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var math = _c.value;
|
||||
math.assistiveMml(this);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
this.processed.set('assistive-mml');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
BaseClass.prototype.state = function (state, restore) {
|
||||
if (restore === void 0) { restore = false; }
|
||||
_super.prototype.state.call(this, state, restore);
|
||||
if (state < MathItem_js_1.STATE.ASSISTIVEMML) {
|
||||
this.processed.clear('assistive-mml');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
return BaseClass;
|
||||
}(BaseDocument)),
|
||||
_a.OPTIONS = __assign(__assign({}, BaseDocument.OPTIONS), { enableAssistiveMml: true, renderActions: (0, Options_js_1.expandable)(__assign(__assign({}, BaseDocument.OPTIONS.renderActions), { assistiveMml: [MathItem_js_1.STATE.ASSISTIVEMML] })) }),
|
||||
_a.assistiveStyles = {
|
||||
'mjx-assistive-mml': {
|
||||
position: 'absolute !important',
|
||||
top: '0px', left: '0px',
|
||||
clip: 'rect(1px, 1px, 1px, 1px)',
|
||||
padding: '1px 0px 0px 0px !important',
|
||||
border: '0px !important',
|
||||
display: 'block !important',
|
||||
width: 'auto !important',
|
||||
overflow: 'hidden !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'
|
||||
}
|
||||
},
|
||||
_a;
|
||||
}
|
||||
exports.AssistiveMmlMathDocumentMixin = AssistiveMmlMathDocumentMixin;
|
||||
function AssistiveMmlHandler(handler) {
|
||||
handler.documentClass =
|
||||
AssistiveMmlMathDocumentMixin(handler.documentClass);
|
||||
return handler;
|
||||
}
|
||||
exports.AssistiveMmlHandler = AssistiveMmlHandler;
|
||||
//# sourceMappingURL=assistive-mml.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/assistive-mml.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/assistive-mml.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assistive-mml.js","sourceRoot":"","sources":["../../ts/a11y/assistive-mml.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,mDAAgF;AAEhF,mFAA6E;AAC7E,iDAA0D;AAK1D;IAAuC,qCAAoB;IAA3D;;IAYA,CAAC;IAPW,yCAAa,GAAvB,UAAwB,IAAa;QAInC,OAAO,iBAAM,aAAa,YAAC,IAAI,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IAEH,wBAAC;AAAD,CAAC,AAZD,CAAuC,8CAAoB,GAY1D;AAZY,8CAAiB;AAwB9B,IAAA,sBAAQ,EAAC,cAAc,EAAE,GAAG,CAAC,CAAC;AA4B9B,SAAgB,yBAAyB,CACvC,YAAe;IAGf;QAAqB,2BAAY;QAA1B;;QAmCP,CAAC;QA7BQ,8BAAY,GAAnB,UAAoB,QAA2C,EAAE,KAAsB;YAAtB,sBAAA,EAAA,aAAsB;YACrF,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,mBAAK,CAAC,YAAY;gBAAE,OAAO;YAC/C,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,kBAAkB,IAAI,KAAK,CAAC,EAAE;gBACrE,IAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;gBAIjC,IAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAItF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,YAAY,CAAC,IAClC,GACF;QAKY,kBAAe,GAAc;YACzC,mBAAmB,EAAE;gBACnB,QAAQ,EAAE,qBAAqB;gBAC/B,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK;gBACvB,IAAI,EAAE,0BAA0B;gBAChC,OAAO,EAAE,4BAA4B;gBACrC,MAAM,EAAE,gBAAgB;gBACxB,OAAO,EAAE,kBAAkB;gBAC3B,KAAK,EAAE,iBAAiB;gBACxB,QAAQ,EAAE,mBAAmB;gBAI7B,uBAAuB,EAAE,MAAM;gBAC/B,qBAAqB,EAAE,MAAM;gBAC7B,oBAAoB,EAAE,MAAM;gBAC5B,kBAAkB,EAAE,MAAM;gBAC1B,iBAAiB,EAAE,MAAM;gBACzB,aAAa,EAAE,MAAM;aACtB;YACD,oCAAoC,EAAE;gBACpC,KAAK,EAAE,iBAAiB;aACzB;SACD;WA8DF;AAEJ,CAAC;AA7GD,sEA6GC;AAcD,SAAgB,mBAAmB,CAAU,OAAyB;IACpE,OAAO,CAAC,aAAa;QACnB,6BAA6B,CAC3B,OAAO,CAAC,aAAa,CACtB,CAAC;IACJ,OAAO,OAAO,CAAC;AACjB,CAAC;AAND,kDAMC"}
|
||||
19
node_modules/mathjax-full/js/a11y/complexity.d.ts
generated
vendored
Normal file
19
node_modules/mathjax-full/js/a11y/complexity.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Handler } from '../core/Handler.js';
|
||||
import { MathDocumentConstructor } from '../core/MathDocument.js';
|
||||
import { MathML } from '../input/mathml.js';
|
||||
import { MmlNode } from '../core/MmlTree/MmlNode.js';
|
||||
import { EnrichedMathItem, EnrichedMathDocument } from './semantic-enrich.js';
|
||||
export declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export declare type EMItemC<N, T, D> = Constructor<EnrichedMathItem<N, T, D>>;
|
||||
export declare type CMItemC<N, T, D> = Constructor<ComplexityMathItem<N, T, D>>;
|
||||
export declare type EMDocC<N, T, D> = MathDocumentConstructor<EnrichedMathDocument<N, T, D>>;
|
||||
export declare type CMDocC<N, T, D> = Constructor<ComplexityMathDocument<N, T, D>>;
|
||||
export interface ComplexityMathItem<N, T, D> extends EnrichedMathItem<N, T, D> {
|
||||
complexity(document: ComplexityMathDocument<N, T, D>, force?: boolean): void;
|
||||
}
|
||||
export declare function ComplexityMathItemMixin<N, T, D, B extends EMItemC<N, T, D>>(BaseMathItem: B, computeComplexity: (node: MmlNode) => void): CMItemC<N, T, D> & B;
|
||||
export interface ComplexityMathDocument<N, T, D> extends EnrichedMathDocument<N, T, D> {
|
||||
complexity(): ComplexityMathDocument<N, T, D>;
|
||||
}
|
||||
export declare function ComplexityMathDocumentMixin<N, T, D, B extends EMDocC<N, T, D>>(BaseDocument: B): CMDocC<N, T, D> & B;
|
||||
export declare function ComplexityHandler<N, T, D>(handler: Handler<N, T, D>, MmlJax?: MathML<N, T, D>): Handler<N, T, D>;
|
||||
157
node_modules/mathjax-full/js/a11y/complexity.js
generated
vendored
Normal file
157
node_modules/mathjax-full/js/a11y/complexity.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ComplexityHandler = exports.ComplexityMathDocumentMixin = exports.ComplexityMathItemMixin = void 0;
|
||||
var MathItem_js_1 = require("../core/MathItem.js");
|
||||
var semantic_enrich_js_1 = require("./semantic-enrich.js");
|
||||
var visitor_js_1 = require("./complexity/visitor.js");
|
||||
var Options_js_1 = require("../util/Options.js");
|
||||
(0, MathItem_js_1.newState)('COMPLEXITY', 40);
|
||||
function ComplexityMathItemMixin(BaseMathItem, computeComplexity) {
|
||||
return (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
class_1.prototype.complexity = function (document, force) {
|
||||
if (force === void 0) { force = false; }
|
||||
if (this.state() >= MathItem_js_1.STATE.COMPLEXITY)
|
||||
return;
|
||||
if (!this.isEscaped && (document.options.enableComplexity || force)) {
|
||||
this.enrich(document, true);
|
||||
computeComplexity(this.root);
|
||||
}
|
||||
this.state(MathItem_js_1.STATE.COMPLEXITY);
|
||||
};
|
||||
return class_1;
|
||||
}(BaseMathItem));
|
||||
}
|
||||
exports.ComplexityMathItemMixin = ComplexityMathItemMixin;
|
||||
function ComplexityMathDocumentMixin(BaseDocument) {
|
||||
var _a;
|
||||
return _a = (function (_super) {
|
||||
__extends(class_2, _super);
|
||||
function class_2() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var _this = _super.apply(this, __spreadArray([], __read(args), false)) || this;
|
||||
var ProcessBits = _this.constructor.ProcessBits;
|
||||
if (!ProcessBits.has('complexity')) {
|
||||
ProcessBits.allocate('complexity');
|
||||
}
|
||||
var visitorOptions = (0, Options_js_1.selectOptionsFromKeys)(_this.options, _this.options.ComplexityVisitor.OPTIONS);
|
||||
_this.complexityVisitor = new _this.options.ComplexityVisitor(_this.mmlFactory, visitorOptions);
|
||||
var computeComplexity = (function (node) { return _this.complexityVisitor.visitTree(node); });
|
||||
_this.options.MathItem =
|
||||
ComplexityMathItemMixin(_this.options.MathItem, computeComplexity);
|
||||
return _this;
|
||||
}
|
||||
class_2.prototype.complexity = function () {
|
||||
var e_1, _a;
|
||||
if (!this.processed.isSet('complexity')) {
|
||||
if (this.options.enableComplexity) {
|
||||
try {
|
||||
for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var math = _c.value;
|
||||
math.complexity(this);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
}
|
||||
this.processed.set('complexity');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
class_2.prototype.state = function (state, restore) {
|
||||
if (restore === void 0) { restore = false; }
|
||||
_super.prototype.state.call(this, state, restore);
|
||||
if (state < MathItem_js_1.STATE.COMPLEXITY) {
|
||||
this.processed.clear('complexity');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
return class_2;
|
||||
}(BaseDocument)),
|
||||
_a.OPTIONS = __assign(__assign(__assign({}, BaseDocument.OPTIONS), visitor_js_1.ComplexityVisitor.OPTIONS), { enableComplexity: true, ComplexityVisitor: visitor_js_1.ComplexityVisitor, renderActions: (0, Options_js_1.expandable)(__assign(__assign({}, BaseDocument.OPTIONS.renderActions), { complexity: [MathItem_js_1.STATE.COMPLEXITY] })) }),
|
||||
_a;
|
||||
}
|
||||
exports.ComplexityMathDocumentMixin = ComplexityMathDocumentMixin;
|
||||
function ComplexityHandler(handler, MmlJax) {
|
||||
if (MmlJax === void 0) { MmlJax = null; }
|
||||
if (!handler.documentClass.prototype.enrich && MmlJax) {
|
||||
handler = (0, semantic_enrich_js_1.EnrichHandler)(handler, MmlJax);
|
||||
}
|
||||
handler.documentClass = ComplexityMathDocumentMixin(handler.documentClass);
|
||||
return handler;
|
||||
}
|
||||
exports.ComplexityHandler = ComplexityHandler;
|
||||
//# sourceMappingURL=complexity.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/complexity.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/complexity.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"complexity.js","sourceRoot":"","sources":["../../ts/a11y/complexity.ts"],"names":[],"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C,OAAO,GACpB,8BAAiB,CAAC,OAAO,KAC5B,gBAAgB,EAAE,IAAI,EACtB,iBAAiB,EAAE,8BAAiB,EACpC,aAAa,EAAE,IAAA,uBAAU,wBACpB,YAAY,CAAC,OAAO,CAAC,aAAa,KACrC,UAAU,EAAE,CAAC,mBAAK,CAAC,UAAU,CAAC,IAC9B,GACF;WAsDF;AAEJ,CAAC;AAzED,kEAyEC;AAeD,SAAgB,iBAAiB,CAC/B,OAAyB,EACzB,MAA8B;IAA9B,uBAAA,EAAA,aAA8B;IAE9B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,IAAI,MAAM,EAAE;QACrD,OAAO,GAAG,IAAA,kCAAa,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAC1C;IACD,OAAO,CAAC,aAAa,GAAG,2BAA2B,CAA2B,OAAO,CAAC,aAAoB,CAAC,CAAC;IAC5G,OAAO,OAAO,CAAC;AACjB,CAAC;AATD,8CASC"}
|
||||
33
node_modules/mathjax-full/js/a11y/complexity/collapse.d.ts
generated
vendored
Normal file
33
node_modules/mathjax-full/js/a11y/complexity/collapse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
|
||||
import { ComplexityVisitor } from './visitor.js';
|
||||
export declare type CollapseFunction = (node: MmlNode, complexity: number) => number;
|
||||
export declare type CollapseFunctionMap = Map<string, CollapseFunction>;
|
||||
export declare type TypeRole<T> = {
|
||||
[type: string]: T | {
|
||||
[role: string]: T;
|
||||
};
|
||||
};
|
||||
export declare class Collapse {
|
||||
static NOCOLLAPSE: number;
|
||||
complexity: ComplexityVisitor;
|
||||
cutoff: TypeRole<number>;
|
||||
marker: TypeRole<string>;
|
||||
collapse: CollapseFunctionMap;
|
||||
private idCount;
|
||||
constructor(visitor: ComplexityVisitor);
|
||||
check(node: MmlNode, complexity: number): number;
|
||||
protected defaultCheck(node: MmlNode, complexity: number, type: string): number;
|
||||
protected recordCollapse(node: MmlNode, complexity: number, text: string): number;
|
||||
protected unrecordCollapse(node: MmlNode): void;
|
||||
protected canUncollapse(node: MmlNode, n: number, m?: number): MmlNode | null;
|
||||
protected uncollapseChild(complexity: number, node: MmlNode, n: number, m?: number): number;
|
||||
protected splitAttribute(node: MmlNode, id: string): string[];
|
||||
protected getText(node: MmlNode): string;
|
||||
protected findChildText(node: MmlNode, id: string): string;
|
||||
protected findChild(node: MmlNode, id: string): MmlNode | null;
|
||||
makeCollapse(node: MmlNode): void;
|
||||
makeActions(nodes: MmlNode[]): void;
|
||||
private makeId;
|
||||
makeAction(node: MmlNode): void;
|
||||
addMrow(node: MmlNode): MmlNode;
|
||||
}
|
||||
363
node_modules/mathjax-full/js/a11y/complexity/collapse.js
generated
vendored
Normal file
363
node_modules/mathjax-full/js/a11y/complexity/collapse.js
generated
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
"use strict";
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Collapse = void 0;
|
||||
var Collapse = (function () {
|
||||
function Collapse(visitor) {
|
||||
var _this = this;
|
||||
this.cutoff = {
|
||||
identifier: 3,
|
||||
number: 3,
|
||||
text: 10,
|
||||
infixop: 15,
|
||||
relseq: 15,
|
||||
multirel: 15,
|
||||
fenced: 18,
|
||||
bigop: 20,
|
||||
integral: 20,
|
||||
fraction: 12,
|
||||
sqrt: 9,
|
||||
root: 12,
|
||||
vector: 15,
|
||||
matrix: 15,
|
||||
cases: 15,
|
||||
superscript: 9,
|
||||
subscript: 9,
|
||||
subsup: 9,
|
||||
punctuated: {
|
||||
endpunct: Collapse.NOCOLLAPSE,
|
||||
startpunct: Collapse.NOCOLLAPSE,
|
||||
value: 12
|
||||
}
|
||||
};
|
||||
this.marker = {
|
||||
identifier: 'x',
|
||||
number: '#',
|
||||
text: '...',
|
||||
appl: {
|
||||
'limit function': 'lim',
|
||||
value: 'f()'
|
||||
},
|
||||
fraction: '/',
|
||||
sqrt: '\u221A',
|
||||
root: '\u221A',
|
||||
superscript: '\u25FD\u02D9',
|
||||
subscript: '\u25FD.',
|
||||
subsup: '\u25FD:',
|
||||
vector: {
|
||||
binomial: '(:)',
|
||||
determinant: '|:|',
|
||||
value: '\u27E8:\u27E9'
|
||||
},
|
||||
matrix: {
|
||||
squarematrix: '[::]',
|
||||
rowvector: '\u27E8\u22EF\u27E9',
|
||||
columnvector: '\u27E8\u22EE\u27E9',
|
||||
determinant: '|::|',
|
||||
value: '(::)'
|
||||
},
|
||||
cases: '{:',
|
||||
infixop: {
|
||||
addition: '+',
|
||||
subtraction: '\u2212',
|
||||
multiplication: '\u22C5',
|
||||
implicit: '\u22C5',
|
||||
value: '+'
|
||||
},
|
||||
punctuated: {
|
||||
text: '...',
|
||||
value: ','
|
||||
}
|
||||
};
|
||||
this.collapse = new Map([
|
||||
['fenced', function (node, complexity) {
|
||||
complexity = _this.uncollapseChild(complexity, node, 1);
|
||||
if (complexity > _this.cutoff.fenced && node.attributes.get('data-semantic-role') === 'leftright') {
|
||||
complexity = _this.recordCollapse(node, complexity, _this.getText(node.childNodes[0]) +
|
||||
_this.getText(node.childNodes[node.childNodes.length - 1]));
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['appl', function (node, complexity) {
|
||||
if (_this.canUncollapse(node, 2, 2)) {
|
||||
complexity = _this.complexity.visitNode(node, false);
|
||||
var marker = _this.marker.appl;
|
||||
var text = marker[node.attributes.get('data-semantic-role')] || marker.value;
|
||||
complexity = _this.recordCollapse(node, complexity, text);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['sqrt', function (node, complexity) {
|
||||
complexity = _this.uncollapseChild(complexity, node, 0);
|
||||
if (complexity > _this.cutoff.sqrt) {
|
||||
complexity = _this.recordCollapse(node, complexity, _this.marker.sqrt);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['root', function (node, complexity) {
|
||||
complexity = _this.uncollapseChild(complexity, node, 0, 2);
|
||||
if (complexity > _this.cutoff.sqrt) {
|
||||
complexity = _this.recordCollapse(node, complexity, _this.marker.sqrt);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['enclose', function (node, complexity) {
|
||||
if (_this.splitAttribute(node, 'children').length === 1) {
|
||||
var child = _this.canUncollapse(node, 1);
|
||||
if (child) {
|
||||
var marker = child.getProperty('collapse-marker');
|
||||
_this.unrecordCollapse(child);
|
||||
complexity = _this.recordCollapse(node, _this.complexity.visitNode(node, false), marker);
|
||||
}
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['bigop', function (node, complexity) {
|
||||
if (complexity > _this.cutoff.bigop || !node.isKind('mo')) {
|
||||
var id = _this.splitAttribute(node, 'content').pop();
|
||||
var op = _this.findChildText(node, id);
|
||||
complexity = _this.recordCollapse(node, complexity, op);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['integral', function (node, complexity) {
|
||||
if (complexity > _this.cutoff.integral || !node.isKind('mo')) {
|
||||
var id = _this.splitAttribute(node, 'content').pop();
|
||||
var op = _this.findChildText(node, id);
|
||||
complexity = _this.recordCollapse(node, complexity, op);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['relseq', function (node, complexity) {
|
||||
if (complexity > _this.cutoff.relseq) {
|
||||
var id = _this.splitAttribute(node, 'content')[0];
|
||||
var text = _this.findChildText(node, id);
|
||||
complexity = _this.recordCollapse(node, complexity, text);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['multirel', function (node, complexity) {
|
||||
if (complexity > _this.cutoff.relseq) {
|
||||
var id = _this.splitAttribute(node, 'content')[0];
|
||||
var text = _this.findChildText(node, id) + '\u22EF';
|
||||
complexity = _this.recordCollapse(node, complexity, text);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['superscript', function (node, complexity) {
|
||||
complexity = _this.uncollapseChild(complexity, node, 0, 2);
|
||||
if (complexity > _this.cutoff.superscript) {
|
||||
complexity = _this.recordCollapse(node, complexity, _this.marker.superscript);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['subscript', function (node, complexity) {
|
||||
complexity = _this.uncollapseChild(complexity, node, 0, 2);
|
||||
if (complexity > _this.cutoff.subscript) {
|
||||
complexity = _this.recordCollapse(node, complexity, _this.marker.subscript);
|
||||
}
|
||||
return complexity;
|
||||
}],
|
||||
['subsup', function (node, complexity) {
|
||||
complexity = _this.uncollapseChild(complexity, node, 0, 3);
|
||||
if (complexity > _this.cutoff.subsup) {
|
||||
complexity = _this.recordCollapse(node, complexity, _this.marker.subsup);
|
||||
}
|
||||
return complexity;
|
||||
}]
|
||||
]);
|
||||
this.idCount = 0;
|
||||
this.complexity = visitor;
|
||||
}
|
||||
Collapse.prototype.check = function (node, complexity) {
|
||||
var type = node.attributes.get('data-semantic-type');
|
||||
if (this.collapse.has(type)) {
|
||||
return this.collapse.get(type).call(this, node, complexity);
|
||||
}
|
||||
if (this.cutoff.hasOwnProperty(type)) {
|
||||
return this.defaultCheck(node, complexity, type);
|
||||
}
|
||||
return complexity;
|
||||
};
|
||||
Collapse.prototype.defaultCheck = function (node, complexity, type) {
|
||||
var role = node.attributes.get('data-semantic-role');
|
||||
var check = this.cutoff[type];
|
||||
var cutoff = (typeof check === 'number' ? check : check[role] || check.value);
|
||||
if (complexity > cutoff) {
|
||||
var marker = this.marker[type] || '??';
|
||||
var text = (typeof marker === 'string' ? marker : marker[role] || marker.value);
|
||||
complexity = this.recordCollapse(node, complexity, text);
|
||||
}
|
||||
return complexity;
|
||||
};
|
||||
Collapse.prototype.recordCollapse = function (node, complexity, text) {
|
||||
text = '\u25C2' + text + '\u25B8';
|
||||
node.setProperty('collapse-marker', text);
|
||||
node.setProperty('collapse-complexity', complexity);
|
||||
return text.length * this.complexity.complexity.text;
|
||||
};
|
||||
Collapse.prototype.unrecordCollapse = function (node) {
|
||||
var complexity = node.getProperty('collapse-complexity');
|
||||
if (complexity != null) {
|
||||
node.attributes.set('data-semantic-complexity', complexity);
|
||||
node.removeProperty('collapse-complexity');
|
||||
node.removeProperty('collapse-marker');
|
||||
}
|
||||
};
|
||||
Collapse.prototype.canUncollapse = function (node, n, m) {
|
||||
if (m === void 0) { m = 1; }
|
||||
if (this.splitAttribute(node, 'children').length === m) {
|
||||
var mml = (node.childNodes.length === 1 &&
|
||||
node.childNodes[0].isInferred ? node.childNodes[0] : node);
|
||||
if (mml && mml.childNodes[n]) {
|
||||
var child = mml.childNodes[n];
|
||||
if (child.getProperty('collapse-marker')) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Collapse.prototype.uncollapseChild = function (complexity, node, n, m) {
|
||||
if (m === void 0) { m = 1; }
|
||||
var child = this.canUncollapse(node, n, m);
|
||||
if (child) {
|
||||
this.unrecordCollapse(child);
|
||||
if (child.parent !== node) {
|
||||
child.parent.attributes.set('data-semantic-complexity', undefined);
|
||||
}
|
||||
complexity = this.complexity.visitNode(node, false);
|
||||
}
|
||||
return complexity;
|
||||
};
|
||||
Collapse.prototype.splitAttribute = function (node, id) {
|
||||
return (node.attributes.get('data-semantic-' + id) || '').split(/,/);
|
||||
};
|
||||
Collapse.prototype.getText = function (node) {
|
||||
var _this = this;
|
||||
if (node.isToken)
|
||||
return node.getText();
|
||||
return node.childNodes.map(function (n) { return _this.getText(n); }).join('');
|
||||
};
|
||||
Collapse.prototype.findChildText = function (node, id) {
|
||||
var child = this.findChild(node, id);
|
||||
return this.getText(child.coreMO() || child);
|
||||
};
|
||||
Collapse.prototype.findChild = function (node, id) {
|
||||
var e_1, _a;
|
||||
if (!node || node.attributes.get('data-semantic-id') === id)
|
||||
return node;
|
||||
if (!node.isToken) {
|
||||
try {
|
||||
for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var mml = _c.value;
|
||||
var child = this.findChild(mml, id);
|
||||
if (child)
|
||||
return child;
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Collapse.prototype.makeCollapse = function (node) {
|
||||
var nodes = [];
|
||||
node.walkTree(function (child) {
|
||||
if (child.getProperty('collapse-marker')) {
|
||||
nodes.push(child);
|
||||
}
|
||||
});
|
||||
this.makeActions(nodes);
|
||||
};
|
||||
Collapse.prototype.makeActions = function (nodes) {
|
||||
var e_2, _a;
|
||||
try {
|
||||
for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
|
||||
var node = nodes_1_1.value;
|
||||
this.makeAction(node);
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
};
|
||||
Collapse.prototype.makeId = function () {
|
||||
return 'mjx-collapse-' + this.idCount++;
|
||||
};
|
||||
Collapse.prototype.makeAction = function (node) {
|
||||
if (node.isKind('math')) {
|
||||
node = this.addMrow(node);
|
||||
}
|
||||
var factory = this.complexity.factory;
|
||||
var marker = node.getProperty('collapse-marker');
|
||||
var parent = node.parent;
|
||||
var maction = factory.create('maction', {
|
||||
actiontype: 'toggle',
|
||||
selection: 2,
|
||||
'data-collapsible': true,
|
||||
id: this.makeId(),
|
||||
'data-semantic-complexity': node.attributes.get('data-semantic-complexity')
|
||||
}, [
|
||||
factory.create('mtext', { mathcolor: 'blue' }, [
|
||||
factory.create('text').setText(marker)
|
||||
])
|
||||
]);
|
||||
maction.inheritAttributesFrom(node);
|
||||
node.attributes.set('data-semantic-complexity', node.getProperty('collapse-complexity'));
|
||||
node.removeProperty('collapse-marker');
|
||||
node.removeProperty('collapse-complexity');
|
||||
parent.replaceChild(maction, node);
|
||||
maction.appendChild(node);
|
||||
};
|
||||
Collapse.prototype.addMrow = function (node) {
|
||||
var e_3, _a;
|
||||
var mrow = this.complexity.factory.create('mrow', null, node.childNodes[0].childNodes);
|
||||
node.childNodes[0].setChildren([mrow]);
|
||||
var attributes = node.attributes.getAllAttributes();
|
||||
try {
|
||||
for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var name_1 = _c.value;
|
||||
if (name_1.substr(0, 14) === 'data-semantic-') {
|
||||
mrow.attributes.set(name_1, attributes[name_1]);
|
||||
delete attributes[name_1];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
}
|
||||
mrow.setProperty('collapse-marker', node.getProperty('collapse-marker'));
|
||||
mrow.setProperty('collapse-complexity', node.getProperty('collapse-complexity'));
|
||||
node.removeProperty('collapse-marker');
|
||||
node.removeProperty('collapse-complexity');
|
||||
return mrow;
|
||||
};
|
||||
Collapse.NOCOLLAPSE = 10000000;
|
||||
return Collapse;
|
||||
}());
|
||||
exports.Collapse = Collapse;
|
||||
//# sourceMappingURL=collapse.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/complexity/collapse.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/complexity/collapse.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
42
node_modules/mathjax-full/js/a11y/complexity/visitor.d.ts
generated
vendored
Normal file
42
node_modules/mathjax-full/js/a11y/complexity/visitor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
|
||||
import { MmlMroot } from '../../core/MmlTree/MmlNodes/mroot.js';
|
||||
import { MmlMaction } from '../../core/MmlTree/MmlNodes/maction.js';
|
||||
import { MmlMsubsup, MmlMsub, MmlMsup } from '../../core/MmlTree/MmlNodes/msubsup.js';
|
||||
import { MmlMunderover, MmlMunder, MmlMover } from '../../core/MmlTree/MmlNodes/munderover.js';
|
||||
import { MmlVisitor } from '../../core/MmlTree/MmlVisitor.js';
|
||||
import { MmlFactory } from '../../core/MmlTree/MmlFactory.js';
|
||||
import { Collapse } from './collapse.js';
|
||||
import { OptionList } from '../../util/Options.js';
|
||||
export declare class ComplexityVisitor extends MmlVisitor {
|
||||
static OPTIONS: OptionList;
|
||||
complexity: {
|
||||
[name: string]: number;
|
||||
};
|
||||
collapse: Collapse;
|
||||
factory: MmlFactory;
|
||||
options: OptionList;
|
||||
constructor(factory: MmlFactory, options: OptionList);
|
||||
visitTree(node: MmlNode): void;
|
||||
visitNode(node: MmlNode, save: boolean): any;
|
||||
visitDefault(node: MmlNode, save: boolean): number;
|
||||
protected visitMfracNode(node: MmlNode, save: boolean): number;
|
||||
protected visitMsqrtNode(node: MmlNode, save: boolean): number;
|
||||
protected visitMrootNode(node: MmlMroot, save: boolean): number;
|
||||
protected visitMphantomNode(node: MmlNode, save: boolean): number;
|
||||
protected visitMsNode(node: MmlNode, save: boolean): number;
|
||||
protected visitMsubsupNode(node: MmlMsubsup, save: boolean): number;
|
||||
protected visitMsubNode(node: MmlMsub, save: boolean): number;
|
||||
protected visitMsupNode(node: MmlMsup, save: boolean): number;
|
||||
protected visitMunderoverNode(node: MmlMunderover, save: boolean): number;
|
||||
protected visitMunderNode(node: MmlMunder, save: boolean): number;
|
||||
protected visitMoverNode(node: MmlMover, save: boolean): number;
|
||||
protected visitMencloseNode(node: MmlNode, save: boolean): number;
|
||||
protected visitMactionNode(node: MmlMaction, save: boolean): number;
|
||||
protected visitMsemanticsNode(node: MmlNode, save: boolean): number;
|
||||
protected visitAnnotationNode(node: MmlNode, save: boolean): number;
|
||||
protected visitAnnotation_xmlNode(node: MmlNode, save: boolean): number;
|
||||
protected visitMglyphNode(node: MmlNode, save: boolean): number;
|
||||
getComplexity(node: MmlNode): number;
|
||||
protected setComplexity(node: MmlNode, complexity: number, save: boolean): number;
|
||||
protected childrenComplexity(node: MmlNode): number;
|
||||
}
|
||||
209
node_modules/mathjax-full/js/a11y/complexity/visitor.js
generated
vendored
Normal file
209
node_modules/mathjax-full/js/a11y/complexity/visitor.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ComplexityVisitor = void 0;
|
||||
var MmlVisitor_js_1 = require("../../core/MmlTree/MmlVisitor.js");
|
||||
var collapse_js_1 = require("./collapse.js");
|
||||
var Options_js_1 = require("../../util/Options.js");
|
||||
var ComplexityVisitor = (function (_super) {
|
||||
__extends(ComplexityVisitor, _super);
|
||||
function ComplexityVisitor(factory, options) {
|
||||
var _this = _super.call(this, factory) || this;
|
||||
_this.complexity = {
|
||||
text: .5,
|
||||
token: .5,
|
||||
child: 1,
|
||||
script: .8,
|
||||
sqrt: 2,
|
||||
subsup: 2,
|
||||
underover: 2,
|
||||
fraction: 2,
|
||||
enclose: 2,
|
||||
action: 2,
|
||||
phantom: 0,
|
||||
xml: 2,
|
||||
glyph: 2
|
||||
};
|
||||
var CLASS = _this.constructor;
|
||||
_this.options = (0, Options_js_1.userOptions)((0, Options_js_1.defaultOptions)({}, CLASS.OPTIONS), options);
|
||||
_this.collapse = new _this.options.Collapse(_this);
|
||||
_this.factory = factory;
|
||||
return _this;
|
||||
}
|
||||
ComplexityVisitor.prototype.visitTree = function (node) {
|
||||
_super.prototype.visitTree.call(this, node, true);
|
||||
if (this.options.makeCollapsible) {
|
||||
this.collapse.makeCollapse(node);
|
||||
}
|
||||
};
|
||||
ComplexityVisitor.prototype.visitNode = function (node, save) {
|
||||
if (node.attributes.get('data-semantic-complexity'))
|
||||
return;
|
||||
return _super.prototype.visitNode.call(this, node, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitDefault = function (node, save) {
|
||||
var complexity;
|
||||
if (node.isToken) {
|
||||
var text = node.getText();
|
||||
complexity = this.complexity.text * text.length + this.complexity.token;
|
||||
}
|
||||
else {
|
||||
complexity = this.childrenComplexity(node);
|
||||
}
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMfracNode = function (node, save) {
|
||||
var complexity = this.childrenComplexity(node) * this.complexity.script + this.complexity.fraction;
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMsqrtNode = function (node, save) {
|
||||
var complexity = this.childrenComplexity(node) + this.complexity.sqrt;
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMrootNode = function (node, save) {
|
||||
var complexity = this.childrenComplexity(node) + this.complexity.sqrt
|
||||
- (1 - this.complexity.script) * this.getComplexity(node.childNodes[1]);
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMphantomNode = function (node, save) {
|
||||
return this.setComplexity(node, this.complexity.phantom, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMsNode = function (node, save) {
|
||||
var text = node.attributes.get('lquote')
|
||||
+ node.getText()
|
||||
+ node.attributes.get('rquote');
|
||||
var complexity = text.length * this.complexity.text;
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMsubsupNode = function (node, save) {
|
||||
_super.prototype.visitDefault.call(this, node, true);
|
||||
var sub = node.childNodes[node.sub];
|
||||
var sup = node.childNodes[node.sup];
|
||||
var base = node.childNodes[node.base];
|
||||
var complexity = Math.max(sub ? this.getComplexity(sub) : 0, sup ? this.getComplexity(sup) : 0) * this.complexity.script;
|
||||
complexity += this.complexity.child * ((sub ? 1 : 0) + (sup ? 1 : 0));
|
||||
complexity += (base ? this.getComplexity(base) + this.complexity.child : 0);
|
||||
complexity += this.complexity.subsup;
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMsubNode = function (node, save) {
|
||||
return this.visitMsubsupNode(node, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMsupNode = function (node, save) {
|
||||
return this.visitMsubsupNode(node, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMunderoverNode = function (node, save) {
|
||||
_super.prototype.visitDefault.call(this, node, true);
|
||||
var under = node.childNodes[node.under];
|
||||
var over = node.childNodes[node.over];
|
||||
var base = node.childNodes[node.base];
|
||||
var complexity = Math.max(under ? this.getComplexity(under) : 0, over ? this.getComplexity(over) : 0) * this.complexity.script;
|
||||
if (base) {
|
||||
complexity = Math.max(this.getComplexity(base), complexity);
|
||||
}
|
||||
complexity += this.complexity.child * ((under ? 1 : 0) + (over ? 1 : 0) + (base ? 1 : 0));
|
||||
complexity += this.complexity.underover;
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMunderNode = function (node, save) {
|
||||
return this.visitMunderoverNode(node, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMoverNode = function (node, save) {
|
||||
return this.visitMunderoverNode(node, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMencloseNode = function (node, save) {
|
||||
var complexity = this.childrenComplexity(node) + this.complexity.enclose;
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMactionNode = function (node, save) {
|
||||
this.childrenComplexity(node);
|
||||
var complexity = this.getComplexity(node.selected);
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMsemanticsNode = function (node, save) {
|
||||
var child = node.childNodes[0];
|
||||
var complexity = 0;
|
||||
if (child) {
|
||||
this.visitNode(child, true);
|
||||
complexity = this.getComplexity(child);
|
||||
}
|
||||
return this.setComplexity(node, complexity, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitAnnotationNode = function (node, save) {
|
||||
return this.setComplexity(node, this.complexity.xml, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitAnnotation_xmlNode = function (node, save) {
|
||||
return this.setComplexity(node, this.complexity.xml, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.visitMglyphNode = function (node, save) {
|
||||
return this.setComplexity(node, this.complexity.glyph, save);
|
||||
};
|
||||
ComplexityVisitor.prototype.getComplexity = function (node) {
|
||||
var collapsed = node.getProperty('collapsedComplexity');
|
||||
return (collapsed != null ? collapsed : node.attributes.get('data-semantic-complexity'));
|
||||
};
|
||||
ComplexityVisitor.prototype.setComplexity = function (node, complexity, save) {
|
||||
if (save) {
|
||||
if (this.options.identifyCollapsible) {
|
||||
complexity = this.collapse.check(node, complexity);
|
||||
}
|
||||
node.attributes.set('data-semantic-complexity', complexity);
|
||||
}
|
||||
return complexity;
|
||||
};
|
||||
ComplexityVisitor.prototype.childrenComplexity = function (node) {
|
||||
var e_1, _a;
|
||||
_super.prototype.visitDefault.call(this, node, true);
|
||||
var complexity = 0;
|
||||
try {
|
||||
for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
complexity += this.getComplexity(child);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
if (node.childNodes.length > 1) {
|
||||
complexity += node.childNodes.length * this.complexity.child;
|
||||
}
|
||||
return complexity;
|
||||
};
|
||||
ComplexityVisitor.OPTIONS = {
|
||||
identifyCollapsible: true,
|
||||
makeCollapsible: true,
|
||||
Collapse: collapse_js_1.Collapse
|
||||
};
|
||||
return ComplexityVisitor;
|
||||
}(MmlVisitor_js_1.MmlVisitor));
|
||||
exports.ComplexityVisitor = ComplexityVisitor;
|
||||
//# sourceMappingURL=visitor.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/complexity/visitor.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/complexity/visitor.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
34
node_modules/mathjax-full/js/a11y/explorer.d.ts
generated
vendored
Normal file
34
node_modules/mathjax-full/js/a11y/explorer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Handler } from '../core/Handler.js';
|
||||
import { MmlNode } from '../core/MmlTree/MmlNode.js';
|
||||
import { MathML } from '../input/mathml.js';
|
||||
import { EnrichedMathItem, EnrichedMathDocument } from './semantic-enrich.js';
|
||||
import { MathDocumentConstructor } from '../core/MathDocument.js';
|
||||
import { LiveRegion, ToolTip, HoverRegion } from './explorer/Region.js';
|
||||
export declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export declare type HANDLER = Handler<HTMLElement, Text, Document>;
|
||||
export declare type HTMLDOCUMENT = EnrichedMathDocument<HTMLElement, Text, Document>;
|
||||
export declare type HTMLMATHITEM = EnrichedMathItem<HTMLElement, Text, Document>;
|
||||
export declare type MATHML = MathML<HTMLElement, Text, Document>;
|
||||
export interface ExplorerMathItem extends HTMLMATHITEM {
|
||||
explorable(document: HTMLDOCUMENT, force?: boolean): void;
|
||||
attachExplorers(document: HTMLDOCUMENT): void;
|
||||
}
|
||||
export declare function ExplorerMathItemMixin<B extends Constructor<HTMLMATHITEM>>(BaseMathItem: B, toMathML: (node: MmlNode) => string): Constructor<ExplorerMathItem> & B;
|
||||
export interface ExplorerMathDocument extends HTMLDOCUMENT {
|
||||
explorerRegions: ExplorerRegions;
|
||||
explorable(): HTMLDOCUMENT;
|
||||
}
|
||||
export declare function ExplorerMathDocumentMixin<B extends MathDocumentConstructor<HTMLDOCUMENT>>(BaseDocument: B): MathDocumentConstructor<ExplorerMathDocument> & B;
|
||||
export declare function ExplorerHandler(handler: HANDLER, MmlJax?: MATHML): HANDLER;
|
||||
export declare type ExplorerRegions = {
|
||||
speechRegion?: LiveRegion;
|
||||
brailleRegion?: LiveRegion;
|
||||
magnifier?: HoverRegion;
|
||||
tooltip1?: ToolTip;
|
||||
tooltip2?: ToolTip;
|
||||
tooltip3?: ToolTip;
|
||||
};
|
||||
export declare function setA11yOptions(document: HTMLDOCUMENT, options: {
|
||||
[key: string]: any;
|
||||
}): void;
|
||||
export declare function setA11yOption(document: HTMLDOCUMENT, option: string, value: string | boolean): void;
|
||||
612
node_modules/mathjax-full/js/a11y/explorer.js
generated
vendored
Normal file
612
node_modules/mathjax-full/js/a11y/explorer.js
generated
vendored
Normal file
@@ -0,0 +1,612 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setA11yOption = exports.setA11yOptions = exports.ExplorerHandler = exports.ExplorerMathDocumentMixin = exports.ExplorerMathItemMixin = void 0;
|
||||
var MathItem_js_1 = require("../core/MathItem.js");
|
||||
var semantic_enrich_js_1 = require("./semantic-enrich.js");
|
||||
var Options_js_1 = require("../util/Options.js");
|
||||
var SerializedMmlVisitor_js_1 = require("../core/MmlTree/SerializedMmlVisitor.js");
|
||||
var MJContextMenu_js_1 = require("../ui/menu/MJContextMenu.js");
|
||||
var ke = __importStar(require("./explorer/KeyExplorer.js"));
|
||||
var me = __importStar(require("./explorer/MouseExplorer.js"));
|
||||
var TreeExplorer_js_1 = require("./explorer/TreeExplorer.js");
|
||||
var Region_js_1 = require("./explorer/Region.js");
|
||||
var sre_js_1 = __importDefault(require("./sre.js"));
|
||||
(0, MathItem_js_1.newState)('EXPLORER', 160);
|
||||
function ExplorerMathItemMixin(BaseMathItem, toMathML) {
|
||||
return (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.explorers = {};
|
||||
_this.attached = [];
|
||||
_this.restart = [];
|
||||
_this.refocus = false;
|
||||
_this.savedId = null;
|
||||
return _this;
|
||||
}
|
||||
class_1.prototype.explorable = function (document, force) {
|
||||
if (force === void 0) { force = false; }
|
||||
if (this.state() >= MathItem_js_1.STATE.EXPLORER)
|
||||
return;
|
||||
if (!this.isEscaped && (document.options.enableExplorer || force)) {
|
||||
var node = this.typesetRoot;
|
||||
var mml = toMathML(this.root);
|
||||
if (this.savedId) {
|
||||
this.typesetRoot.setAttribute('sre-explorer-id', this.savedId);
|
||||
this.savedId = null;
|
||||
}
|
||||
this.explorers = initExplorers(document, node, mml);
|
||||
this.attachExplorers(document);
|
||||
}
|
||||
this.state(MathItem_js_1.STATE.EXPLORER);
|
||||
};
|
||||
class_1.prototype.attachExplorers = function (document) {
|
||||
var e_1, _a, e_2, _b;
|
||||
this.attached = [];
|
||||
var keyExplorers = [];
|
||||
try {
|
||||
for (var _c = __values(Object.keys(this.explorers)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
||||
var key = _d.value;
|
||||
var explorer = this.explorers[key];
|
||||
if (explorer instanceof ke.AbstractKeyExplorer) {
|
||||
explorer.AddEvents();
|
||||
explorer.stoppable = false;
|
||||
keyExplorers.unshift(explorer);
|
||||
}
|
||||
if (document.options.a11y[key]) {
|
||||
explorer.Attach();
|
||||
this.attached.push(key);
|
||||
}
|
||||
else {
|
||||
explorer.Detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
try {
|
||||
for (var keyExplorers_1 = __values(keyExplorers), keyExplorers_1_1 = keyExplorers_1.next(); !keyExplorers_1_1.done; keyExplorers_1_1 = keyExplorers_1.next()) {
|
||||
var explorer = keyExplorers_1_1.value;
|
||||
if (explorer.attached) {
|
||||
explorer.stoppable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (keyExplorers_1_1 && !keyExplorers_1_1.done && (_b = keyExplorers_1.return)) _b.call(keyExplorers_1);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
};
|
||||
class_1.prototype.rerender = function (document, start) {
|
||||
var e_3, _a;
|
||||
if (start === void 0) { start = MathItem_js_1.STATE.RERENDER; }
|
||||
this.savedId = this.typesetRoot.getAttribute('sre-explorer-id');
|
||||
this.refocus = (window.document.activeElement === this.typesetRoot);
|
||||
try {
|
||||
for (var _b = __values(this.attached), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var key = _c.value;
|
||||
var explorer = this.explorers[key];
|
||||
if (explorer.active) {
|
||||
this.restart.push(key);
|
||||
explorer.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
}
|
||||
_super.prototype.rerender.call(this, document, start);
|
||||
};
|
||||
class_1.prototype.updateDocument = function (document) {
|
||||
var _this = this;
|
||||
_super.prototype.updateDocument.call(this, document);
|
||||
this.refocus && this.typesetRoot.focus();
|
||||
this.restart.forEach(function (x) { return _this.explorers[x].Start(); });
|
||||
this.restart = [];
|
||||
this.refocus = false;
|
||||
};
|
||||
return class_1;
|
||||
}(BaseMathItem));
|
||||
}
|
||||
exports.ExplorerMathItemMixin = ExplorerMathItemMixin;
|
||||
function ExplorerMathDocumentMixin(BaseDocument) {
|
||||
var _a;
|
||||
return _a = (function (_super) {
|
||||
__extends(class_2, _super);
|
||||
function class_2() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var _this = _super.apply(this, __spreadArray([], __read(args), false)) || this;
|
||||
var ProcessBits = _this.constructor.ProcessBits;
|
||||
if (!ProcessBits.has('explorer')) {
|
||||
ProcessBits.allocate('explorer');
|
||||
}
|
||||
var visitor = new SerializedMmlVisitor_js_1.SerializedMmlVisitor(_this.mmlFactory);
|
||||
var toMathML = (function (node) { return visitor.visitTree(node); });
|
||||
_this.options.MathItem = ExplorerMathItemMixin(_this.options.MathItem, toMathML);
|
||||
_this.explorerRegions = initExplorerRegions(_this);
|
||||
return _this;
|
||||
}
|
||||
class_2.prototype.explorable = function () {
|
||||
var e_4, _a;
|
||||
if (!this.processed.isSet('explorer')) {
|
||||
if (this.options.enableExplorer) {
|
||||
try {
|
||||
for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var math = _c.value;
|
||||
math.explorable(this);
|
||||
}
|
||||
}
|
||||
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_4) throw e_4.error; }
|
||||
}
|
||||
}
|
||||
this.processed.set('explorer');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
class_2.prototype.state = function (state, restore) {
|
||||
if (restore === void 0) { restore = false; }
|
||||
_super.prototype.state.call(this, state, restore);
|
||||
if (state < MathItem_js_1.STATE.EXPLORER) {
|
||||
this.processed.clear('explorer');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
return class_2;
|
||||
}(BaseDocument)),
|
||||
_a.OPTIONS = __assign(__assign({}, BaseDocument.OPTIONS), { enableExplorer: true, renderActions: (0, Options_js_1.expandable)(__assign(__assign({}, BaseDocument.OPTIONS.renderActions), { explorable: [MathItem_js_1.STATE.EXPLORER] })), sre: (0, Options_js_1.expandable)(__assign(__assign({}, BaseDocument.OPTIONS.sre), { speech: 'shallow' })), a11y: {
|
||||
align: 'top',
|
||||
backgroundColor: 'Blue',
|
||||
backgroundOpacity: 20,
|
||||
braille: false,
|
||||
flame: false,
|
||||
foregroundColor: 'Black',
|
||||
foregroundOpacity: 100,
|
||||
highlight: 'None',
|
||||
hover: false,
|
||||
infoPrefix: false,
|
||||
infoRole: false,
|
||||
infoType: false,
|
||||
keyMagnifier: false,
|
||||
magnification: 'None',
|
||||
magnify: '400%',
|
||||
mouseMagnifier: false,
|
||||
speech: true,
|
||||
subtitles: true,
|
||||
treeColoring: false,
|
||||
viewBraille: false
|
||||
} }),
|
||||
_a;
|
||||
}
|
||||
exports.ExplorerMathDocumentMixin = ExplorerMathDocumentMixin;
|
||||
function ExplorerHandler(handler, MmlJax) {
|
||||
if (MmlJax === void 0) { MmlJax = null; }
|
||||
if (!handler.documentClass.prototype.enrich && MmlJax) {
|
||||
handler = (0, semantic_enrich_js_1.EnrichHandler)(handler, MmlJax);
|
||||
}
|
||||
handler.documentClass = ExplorerMathDocumentMixin(handler.documentClass);
|
||||
return handler;
|
||||
}
|
||||
exports.ExplorerHandler = ExplorerHandler;
|
||||
function initExplorerRegions(document) {
|
||||
return {
|
||||
speechRegion: new Region_js_1.LiveRegion(document),
|
||||
brailleRegion: new Region_js_1.LiveRegion(document),
|
||||
magnifier: new Region_js_1.HoverRegion(document),
|
||||
tooltip1: new Region_js_1.ToolTip(document),
|
||||
tooltip2: new Region_js_1.ToolTip(document),
|
||||
tooltip3: new Region_js_1.ToolTip(document)
|
||||
};
|
||||
}
|
||||
var allExplorers = {
|
||||
speech: function (doc, node) {
|
||||
var _a;
|
||||
var rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
var explorer = (_a = ke.SpeechExplorer).create.apply(_a, __spreadArray([doc, doc.explorerRegions.speechRegion, node], __read(rest), false));
|
||||
explorer.speechGenerator.setOptions({
|
||||
locale: doc.options.sre.locale, domain: doc.options.sre.domain,
|
||||
style: doc.options.sre.style, modality: 'speech'
|
||||
});
|
||||
var locale = explorer.speechGenerator.getOptions().locale;
|
||||
if (locale !== sre_js_1.default.engineSetup().locale) {
|
||||
doc.options.sre.locale = sre_js_1.default.engineSetup().locale;
|
||||
explorer.speechGenerator.setOptions({ locale: doc.options.sre.locale });
|
||||
}
|
||||
explorer.showRegion = 'subtitles';
|
||||
return explorer;
|
||||
},
|
||||
braille: function (doc, node) {
|
||||
var _a;
|
||||
var rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
var explorer = (_a = ke.SpeechExplorer).create.apply(_a, __spreadArray([doc, doc.explorerRegions.brailleRegion, node], __read(rest), false));
|
||||
explorer.speechGenerator.setOptions({ locale: 'nemeth', domain: 'default',
|
||||
style: 'default', modality: 'braille' });
|
||||
explorer.showRegion = 'viewBraille';
|
||||
return explorer;
|
||||
},
|
||||
keyMagnifier: function (doc, node) {
|
||||
var _a;
|
||||
var rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return (_a = ke.Magnifier).create.apply(_a, __spreadArray([doc, doc.explorerRegions.magnifier, node], __read(rest), false));
|
||||
},
|
||||
mouseMagnifier: function (doc, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
_rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return me.ContentHoverer.create(doc, doc.explorerRegions.magnifier, node, function (x) { return x.hasAttribute('data-semantic-type'); }, function (x) { return x; });
|
||||
},
|
||||
hover: function (doc, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
_rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return me.FlameHoverer.create(doc, null, node);
|
||||
},
|
||||
infoType: function (doc, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
_rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return me.ValueHoverer.create(doc, doc.explorerRegions.tooltip1, node, function (x) { return x.hasAttribute('data-semantic-type'); }, function (x) { return x.getAttribute('data-semantic-type'); });
|
||||
},
|
||||
infoRole: function (doc, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
_rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return me.ValueHoverer.create(doc, doc.explorerRegions.tooltip2, node, function (x) { return x.hasAttribute('data-semantic-role'); }, function (x) { return x.getAttribute('data-semantic-role'); });
|
||||
},
|
||||
infoPrefix: function (doc, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
_rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return me.ValueHoverer.create(doc, doc.explorerRegions.tooltip3, node, function (x) { return x.hasAttribute('data-semantic-prefix'); }, function (x) { return x.getAttribute('data-semantic-prefix'); });
|
||||
},
|
||||
flame: function (doc, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
_rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return TreeExplorer_js_1.FlameColorer.create(doc, null, node);
|
||||
},
|
||||
treeColoring: function (doc, node) {
|
||||
var rest = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
rest[_i - 2] = arguments[_i];
|
||||
}
|
||||
return TreeExplorer_js_1.TreeColorer.create.apply(TreeExplorer_js_1.TreeColorer, __spreadArray([doc, null, node], __read(rest), false));
|
||||
}
|
||||
};
|
||||
function initExplorers(document, node, mml) {
|
||||
var e_5, _a;
|
||||
var explorers = {};
|
||||
try {
|
||||
for (var _b = __values(Object.keys(allExplorers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var key = _c.value;
|
||||
explorers[key] = allExplorers[key](document, node, mml);
|
||||
}
|
||||
}
|
||||
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_5) throw e_5.error; }
|
||||
}
|
||||
return explorers;
|
||||
}
|
||||
function setA11yOptions(document, options) {
|
||||
var e_6, _a;
|
||||
var sreOptions = sre_js_1.default.engineSetup();
|
||||
for (var key in options) {
|
||||
if (document.options.a11y[key] !== undefined) {
|
||||
setA11yOption(document, key, options[key]);
|
||||
if (key === 'locale') {
|
||||
document.options.sre[key] = options[key];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (sreOptions[key] !== undefined) {
|
||||
document.options.sre[key] = options[key];
|
||||
}
|
||||
}
|
||||
try {
|
||||
for (var _b = __values(document.math), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var item = _c.value;
|
||||
item.attachExplorers(document);
|
||||
}
|
||||
}
|
||||
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_6) throw e_6.error; }
|
||||
}
|
||||
}
|
||||
exports.setA11yOptions = setA11yOptions;
|
||||
function setA11yOption(document, option, value) {
|
||||
switch (option) {
|
||||
case 'magnification':
|
||||
switch (value) {
|
||||
case 'None':
|
||||
document.options.a11y.magnification = value;
|
||||
document.options.a11y.keyMagnifier = false;
|
||||
document.options.a11y.mouseMagnifier = false;
|
||||
break;
|
||||
case 'Keyboard':
|
||||
document.options.a11y.magnification = value;
|
||||
document.options.a11y.keyMagnifier = true;
|
||||
document.options.a11y.mouseMagnifier = false;
|
||||
break;
|
||||
case 'Mouse':
|
||||
document.options.a11y.magnification = value;
|
||||
document.options.a11y.keyMagnifier = false;
|
||||
document.options.a11y.mouseMagnifier = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'highlight':
|
||||
switch (value) {
|
||||
case 'None':
|
||||
document.options.a11y.highlight = value;
|
||||
document.options.a11y.hover = false;
|
||||
document.options.a11y.flame = false;
|
||||
break;
|
||||
case 'Hover':
|
||||
document.options.a11y.highlight = value;
|
||||
document.options.a11y.hover = true;
|
||||
document.options.a11y.flame = false;
|
||||
break;
|
||||
case 'Flame':
|
||||
document.options.a11y.highlight = value;
|
||||
document.options.a11y.hover = false;
|
||||
document.options.a11y.flame = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
document.options.a11y[option] = value;
|
||||
}
|
||||
}
|
||||
exports.setA11yOption = setA11yOption;
|
||||
var csPrefsSetting = {};
|
||||
var csPrefsVariables = function (menu, prefs) {
|
||||
var e_7, _a;
|
||||
var srVariable = menu.pool.lookup('speechRules');
|
||||
var _loop_1 = function (pref) {
|
||||
if (csPrefsSetting[pref])
|
||||
return "continue";
|
||||
menu.factory.get('variable')(menu.factory, {
|
||||
name: 'csprf_' + pref,
|
||||
setter: function (value) {
|
||||
csPrefsSetting[pref] = value;
|
||||
srVariable.setValue('clearspeak-' +
|
||||
sre_js_1.default.clearspeakPreferences.addPreference(sre_js_1.default.clearspeakStyle(), pref, value));
|
||||
},
|
||||
getter: function () { return csPrefsSetting[pref] || 'Auto'; }
|
||||
}, menu.pool);
|
||||
};
|
||||
try {
|
||||
for (var prefs_1 = __values(prefs), prefs_1_1 = prefs_1.next(); !prefs_1_1.done; prefs_1_1 = prefs_1.next()) {
|
||||
var pref = prefs_1_1.value;
|
||||
_loop_1(pref);
|
||||
}
|
||||
}
|
||||
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (prefs_1_1 && !prefs_1_1.done && (_a = prefs_1.return)) _a.call(prefs_1);
|
||||
}
|
||||
finally { if (e_7) throw e_7.error; }
|
||||
}
|
||||
};
|
||||
var csSelectionBox = function (menu, locale) {
|
||||
var e_8, _a;
|
||||
var prefs = sre_js_1.default.clearspeakPreferences.getLocalePreferences();
|
||||
var props = prefs[locale];
|
||||
if (!props) {
|
||||
var csEntry = menu.findID('Accessibility', 'Speech', 'Clearspeak');
|
||||
if (csEntry) {
|
||||
csEntry.disable();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
csPrefsVariables(menu, Object.keys(props));
|
||||
var items = [];
|
||||
var _loop_2 = function (prop) {
|
||||
items.push({
|
||||
'title': prop,
|
||||
'values': props[prop].map(function (x) { return x.replace(RegExp('^' + prop + '_'), ''); }),
|
||||
'variable': 'csprf_' + prop
|
||||
});
|
||||
};
|
||||
try {
|
||||
for (var _b = __values(Object.getOwnPropertyNames(props)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var prop = _c.value;
|
||||
_loop_2(prop);
|
||||
}
|
||||
}
|
||||
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_8) throw e_8.error; }
|
||||
}
|
||||
var sb = menu.factory.get('selectionBox')(menu.factory, {
|
||||
'title': 'Clearspeak Preferences',
|
||||
'signature': '',
|
||||
'order': 'alphabetic',
|
||||
'grid': 'square',
|
||||
'selections': items
|
||||
}, menu);
|
||||
return { 'type': 'command',
|
||||
'id': 'ClearspeakPreferences',
|
||||
'content': 'Select Preferences',
|
||||
'action': function () { return sb.post(0, 0); } };
|
||||
};
|
||||
var csMenu = function (menu, sub) {
|
||||
var locale = menu.pool.lookup('locale').getValue();
|
||||
var box = csSelectionBox(menu, locale);
|
||||
var items = [];
|
||||
try {
|
||||
items = sre_js_1.default.clearspeakPreferences.smartPreferences(menu.mathItem, locale);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
if (box) {
|
||||
items.splice(2, 0, box);
|
||||
}
|
||||
return menu.factory.get('subMenu')(menu.factory, {
|
||||
items: items,
|
||||
id: 'Clearspeak'
|
||||
}, sub);
|
||||
};
|
||||
MJContextMenu_js_1.MJContextMenu.DynamicSubmenus.set('Clearspeak', csMenu);
|
||||
var language = function (menu, sub) {
|
||||
var e_9, _a;
|
||||
var radios = [];
|
||||
try {
|
||||
for (var _b = __values(sre_js_1.default.locales.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var lang = _c.value;
|
||||
if (lang === 'nemeth')
|
||||
continue;
|
||||
radios.push({ type: 'radio', id: lang,
|
||||
content: sre_js_1.default.locales.get(lang) || lang, variable: 'locale' });
|
||||
}
|
||||
}
|
||||
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_9) throw e_9.error; }
|
||||
}
|
||||
radios.sort(function (x, y) { return x.content.localeCompare(y.content, 'en'); });
|
||||
return menu.factory.get('subMenu')(menu.factory, {
|
||||
items: radios, id: 'Language'
|
||||
}, sub);
|
||||
};
|
||||
MJContextMenu_js_1.MJContextMenu.DynamicSubmenus.set('A11yLanguage', language);
|
||||
//# sourceMappingURL=explorer.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/explorer.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/explorer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
node_modules/mathjax-full/js/a11y/explorer/Explorer.d.ts
generated
vendored
Normal file
37
node_modules/mathjax-full/js/a11y/explorer/Explorer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { A11yDocument, Region } from './Region.js';
|
||||
import Sre from '../sre.js';
|
||||
export interface Explorer {
|
||||
active: boolean;
|
||||
stoppable: boolean;
|
||||
Attach(): void;
|
||||
Detach(): void;
|
||||
Start(): void;
|
||||
Stop(): void;
|
||||
AddEvents(): void;
|
||||
RemoveEvents(): void;
|
||||
Update(force?: boolean): void;
|
||||
}
|
||||
export declare class AbstractExplorer<T> implements Explorer {
|
||||
document: A11yDocument;
|
||||
protected region: Region<T>;
|
||||
protected node: HTMLElement;
|
||||
stoppable: boolean;
|
||||
protected events: [string, (x: Event) => void][];
|
||||
protected highlighter: Sre.highlighter;
|
||||
private _active;
|
||||
protected static stopEvent(event: Event): void;
|
||||
static create<T>(document: A11yDocument, region: Region<T>, node: HTMLElement, ...rest: any[]): Explorer;
|
||||
protected constructor(document: A11yDocument, region: Region<T>, node: HTMLElement, ..._rest: any[]);
|
||||
protected Events(): [string, (x: Event) => void][];
|
||||
get active(): boolean;
|
||||
set active(flag: boolean);
|
||||
Attach(): void;
|
||||
Detach(): void;
|
||||
Start(): void;
|
||||
Stop(): void;
|
||||
AddEvents(): void;
|
||||
RemoveEvents(): void;
|
||||
Update(force?: boolean): void;
|
||||
protected getHighlighter(): Sre.highlighter;
|
||||
protected stopEvent(event: Event): void;
|
||||
}
|
||||
162
node_modules/mathjax-full/js/a11y/explorer/Explorer.js
generated
vendored
Normal file
162
node_modules/mathjax-full/js/a11y/explorer/Explorer.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AbstractExplorer = void 0;
|
||||
var sre_js_1 = __importDefault(require("../sre.js"));
|
||||
var AbstractExplorer = (function () {
|
||||
function AbstractExplorer(document, region, node) {
|
||||
var _rest = [];
|
||||
for (var _i = 3; _i < arguments.length; _i++) {
|
||||
_rest[_i - 3] = arguments[_i];
|
||||
}
|
||||
this.document = document;
|
||||
this.region = region;
|
||||
this.node = node;
|
||||
this.stoppable = true;
|
||||
this.events = [];
|
||||
this.highlighter = this.getHighlighter();
|
||||
this._active = false;
|
||||
}
|
||||
AbstractExplorer.stopEvent = function (event) {
|
||||
if (event.preventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
else {
|
||||
event.returnValue = false;
|
||||
}
|
||||
if (event.stopImmediatePropagation) {
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
else if (event.stopPropagation) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
event.cancelBubble = true;
|
||||
};
|
||||
AbstractExplorer.create = function (document, region, node) {
|
||||
var rest = [];
|
||||
for (var _i = 3; _i < arguments.length; _i++) {
|
||||
rest[_i - 3] = arguments[_i];
|
||||
}
|
||||
var explorer = new (this.bind.apply(this, __spreadArray([void 0, document, region, node], __read(rest), false)))();
|
||||
return explorer;
|
||||
};
|
||||
AbstractExplorer.prototype.Events = function () {
|
||||
return this.events;
|
||||
};
|
||||
Object.defineProperty(AbstractExplorer.prototype, "active", {
|
||||
get: function () {
|
||||
return this._active;
|
||||
},
|
||||
set: function (flag) {
|
||||
this._active = flag;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
AbstractExplorer.prototype.Attach = function () {
|
||||
this.AddEvents();
|
||||
};
|
||||
AbstractExplorer.prototype.Detach = function () {
|
||||
this.RemoveEvents();
|
||||
};
|
||||
AbstractExplorer.prototype.Start = function () {
|
||||
this.highlighter = this.getHighlighter();
|
||||
this.active = true;
|
||||
};
|
||||
AbstractExplorer.prototype.Stop = function () {
|
||||
if (this.active) {
|
||||
this.region.Clear();
|
||||
this.region.Hide();
|
||||
this.active = false;
|
||||
}
|
||||
};
|
||||
AbstractExplorer.prototype.AddEvents = function () {
|
||||
var e_1, _a;
|
||||
try {
|
||||
for (var _b = __values(this.events), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var _d = __read(_c.value, 2), eventkind = _d[0], eventfunc = _d[1];
|
||||
this.node.addEventListener(eventkind, eventfunc);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
};
|
||||
AbstractExplorer.prototype.RemoveEvents = function () {
|
||||
var e_2, _a;
|
||||
try {
|
||||
for (var _b = __values(this.events), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var _d = __read(_c.value, 2), eventkind = _d[0], eventfunc = _d[1];
|
||||
this.node.removeEventListener(eventkind, eventfunc);
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
};
|
||||
AbstractExplorer.prototype.Update = function (force) {
|
||||
if (force === void 0) { force = false; }
|
||||
};
|
||||
AbstractExplorer.prototype.getHighlighter = function () {
|
||||
var opts = this.document.options.a11y;
|
||||
var foreground = { color: opts.foregroundColor.toLowerCase(),
|
||||
alpha: opts.foregroundOpacity / 100 };
|
||||
var background = { color: opts.backgroundColor.toLowerCase(),
|
||||
alpha: opts.backgroundOpacity / 100 };
|
||||
return sre_js_1.default.getHighlighter(background, foreground, { renderer: this.document.outputJax.name, browser: 'v3' });
|
||||
};
|
||||
AbstractExplorer.prototype.stopEvent = function (event) {
|
||||
if (this.stoppable) {
|
||||
AbstractExplorer.stopEvent(event);
|
||||
}
|
||||
};
|
||||
return AbstractExplorer;
|
||||
}());
|
||||
exports.AbstractExplorer = AbstractExplorer;
|
||||
//# sourceMappingURL=Explorer.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/explorer/Explorer.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/explorer/Explorer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../../../ts/a11y/explorer/Explorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,qDAA4B;AAyE5B;IAqEE,0BACS,QAAsB,EACnB,MAAiB,EACjB,IAAiB;QAAE,eAAe;aAAf,UAAe,EAAf,qBAAe,EAAf,IAAe;YAAf,8B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EAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;YACzC,KAAK,EAAE,IAAI,CAAC,iBAAiB,GAAG,GAAG,EAAC,CAAC;QACvD,OAAO,gBAAG,CAAC,cAAc,CACvB,UAAU,EAAE,UAAU,EACtB,EAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IAC7D,CAAC;IAMS,oCAAS,GAAnB,UAAoB,KAAY;QAC9B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACnC;IACH,CAAC;IAEH,uBAAC;AAAD,CAAC,AAtLD,IAsLC;AAtLY,4CAAgB"}
|
||||
55
node_modules/mathjax-full/js/a11y/explorer/KeyExplorer.d.ts
generated
vendored
Normal file
55
node_modules/mathjax-full/js/a11y/explorer/KeyExplorer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import { A11yDocument, Region } from './Region.js';
|
||||
import { Explorer, AbstractExplorer } from './Explorer.js';
|
||||
import Sre from '../sre.js';
|
||||
export interface KeyExplorer extends Explorer {
|
||||
KeyDown(event: KeyboardEvent): void;
|
||||
FocusIn(event: FocusEvent): void;
|
||||
FocusOut(event: FocusEvent): void;
|
||||
}
|
||||
export declare abstract class AbstractKeyExplorer<T> extends AbstractExplorer<T> implements KeyExplorer {
|
||||
attached: boolean;
|
||||
protected walker: Sre.walker;
|
||||
private eventsAttached;
|
||||
protected events: [string, (x: Event) => void][];
|
||||
private oldIndex;
|
||||
abstract KeyDown(event: KeyboardEvent): void;
|
||||
FocusIn(_event: FocusEvent): void;
|
||||
FocusOut(_event: FocusEvent): void;
|
||||
Update(force?: boolean): void;
|
||||
Attach(): void;
|
||||
AddEvents(): void;
|
||||
Detach(): void;
|
||||
Stop(): void;
|
||||
}
|
||||
export declare class SpeechExplorer extends AbstractKeyExplorer<string> {
|
||||
document: A11yDocument;
|
||||
protected region: Region<string>;
|
||||
protected node: HTMLElement;
|
||||
private mml;
|
||||
private static updatePromise;
|
||||
speechGenerator: Sre.speechGenerator;
|
||||
showRegion: string;
|
||||
private init;
|
||||
private restarted;
|
||||
constructor(document: A11yDocument, region: Region<string>, node: HTMLElement, mml: string);
|
||||
Start(): void;
|
||||
Update(force?: boolean): void;
|
||||
Speech(walker: Sre.walker): void;
|
||||
KeyDown(event: KeyboardEvent): void;
|
||||
protected triggerLink(code: number): boolean;
|
||||
Move(key: number): void;
|
||||
private initWalker;
|
||||
private getOptions;
|
||||
}
|
||||
export declare class Magnifier extends AbstractKeyExplorer<HTMLElement> {
|
||||
document: A11yDocument;
|
||||
protected region: Region<HTMLElement>;
|
||||
protected node: HTMLElement;
|
||||
private mml;
|
||||
constructor(document: A11yDocument, region: Region<HTMLElement>, node: HTMLElement, mml: string);
|
||||
Update(force?: boolean): void;
|
||||
Start(): void;
|
||||
private showFocus;
|
||||
Move(key: number): void;
|
||||
KeyDown(event: KeyboardEvent): void;
|
||||
}
|
||||
313
node_modules/mathjax-full/js/a11y/explorer/KeyExplorer.js
generated
vendored
Normal file
313
node_modules/mathjax-full/js/a11y/explorer/KeyExplorer.js
generated
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Magnifier = exports.SpeechExplorer = exports.AbstractKeyExplorer = void 0;
|
||||
var Explorer_js_1 = require("./Explorer.js");
|
||||
var sre_js_1 = __importDefault(require("../sre.js"));
|
||||
var AbstractKeyExplorer = (function (_super) {
|
||||
__extends(AbstractKeyExplorer, _super);
|
||||
function AbstractKeyExplorer() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.attached = false;
|
||||
_this.eventsAttached = false;
|
||||
_this.events = _super.prototype.Events.call(_this).concat([['keydown', _this.KeyDown.bind(_this)],
|
||||
['focusin', _this.FocusIn.bind(_this)],
|
||||
['focusout', _this.FocusOut.bind(_this)]]);
|
||||
_this.oldIndex = null;
|
||||
return _this;
|
||||
}
|
||||
AbstractKeyExplorer.prototype.FocusIn = function (_event) {
|
||||
};
|
||||
AbstractKeyExplorer.prototype.FocusOut = function (_event) {
|
||||
this.Stop();
|
||||
};
|
||||
AbstractKeyExplorer.prototype.Update = function (force) {
|
||||
if (force === void 0) { force = false; }
|
||||
if (!this.active && !force)
|
||||
return;
|
||||
this.highlighter.unhighlight();
|
||||
var nodes = this.walker.getFocus(true).getNodes();
|
||||
if (!nodes.length) {
|
||||
this.walker.refocus();
|
||||
nodes = this.walker.getFocus().getNodes();
|
||||
}
|
||||
this.highlighter.highlight(nodes);
|
||||
};
|
||||
AbstractKeyExplorer.prototype.Attach = function () {
|
||||
_super.prototype.Attach.call(this);
|
||||
this.attached = true;
|
||||
this.oldIndex = this.node.tabIndex;
|
||||
this.node.tabIndex = 1;
|
||||
this.node.setAttribute('role', 'application');
|
||||
};
|
||||
AbstractKeyExplorer.prototype.AddEvents = function () {
|
||||
if (!this.eventsAttached) {
|
||||
_super.prototype.AddEvents.call(this);
|
||||
this.eventsAttached = true;
|
||||
}
|
||||
};
|
||||
AbstractKeyExplorer.prototype.Detach = function () {
|
||||
if (this.active) {
|
||||
this.node.tabIndex = this.oldIndex;
|
||||
this.oldIndex = null;
|
||||
this.node.removeAttribute('role');
|
||||
}
|
||||
this.attached = false;
|
||||
};
|
||||
AbstractKeyExplorer.prototype.Stop = function () {
|
||||
if (this.active) {
|
||||
this.highlighter.unhighlight();
|
||||
this.walker.deactivate();
|
||||
}
|
||||
_super.prototype.Stop.call(this);
|
||||
};
|
||||
return AbstractKeyExplorer;
|
||||
}(Explorer_js_1.AbstractExplorer));
|
||||
exports.AbstractKeyExplorer = AbstractKeyExplorer;
|
||||
var SpeechExplorer = (function (_super) {
|
||||
__extends(SpeechExplorer, _super);
|
||||
function SpeechExplorer(document, region, node, mml) {
|
||||
var _this = _super.call(this, document, region, node) || this;
|
||||
_this.document = document;
|
||||
_this.region = region;
|
||||
_this.node = node;
|
||||
_this.mml = mml;
|
||||
_this.showRegion = 'subtitles';
|
||||
_this.init = false;
|
||||
_this.restarted = false;
|
||||
_this.initWalker();
|
||||
return _this;
|
||||
}
|
||||
SpeechExplorer.prototype.Start = function () {
|
||||
var _this = this;
|
||||
if (!this.attached)
|
||||
return;
|
||||
var options = this.getOptions();
|
||||
if (!this.init) {
|
||||
this.init = true;
|
||||
SpeechExplorer.updatePromise = SpeechExplorer.updatePromise.then(function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
return [2, sre_js_1.default.sreReady()
|
||||
.then(function () { return sre_js_1.default.setupEngine({ locale: options.locale }); })
|
||||
.then(function () {
|
||||
_this.Speech(_this.walker);
|
||||
_this.Start();
|
||||
})];
|
||||
});
|
||||
}); })
|
||||
.catch(function (error) { return console.log(error.message); });
|
||||
return;
|
||||
}
|
||||
_super.prototype.Start.call(this);
|
||||
this.speechGenerator = sre_js_1.default.getSpeechGenerator('Direct');
|
||||
this.speechGenerator.setOptions(options);
|
||||
this.walker = sre_js_1.default.getWalker('table', this.node, this.speechGenerator, this.highlighter, this.mml);
|
||||
this.walker.activate();
|
||||
this.Update();
|
||||
if (this.document.options.a11y[this.showRegion]) {
|
||||
SpeechExplorer.updatePromise.then(function () { return _this.region.Show(_this.node, _this.highlighter); });
|
||||
}
|
||||
this.restarted = true;
|
||||
};
|
||||
SpeechExplorer.prototype.Update = function (force) {
|
||||
var _this = this;
|
||||
if (force === void 0) { force = false; }
|
||||
_super.prototype.Update.call(this, force);
|
||||
var options = this.speechGenerator.getOptions();
|
||||
if (options.modality === 'speech') {
|
||||
this.document.options.sre.domain = options.domain;
|
||||
this.document.options.sre.style = options.style;
|
||||
this.document.options.a11y.speechRules =
|
||||
options.domain + '-' + options.style;
|
||||
}
|
||||
SpeechExplorer.updatePromise = SpeechExplorer.updatePromise.then(function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
return [2, sre_js_1.default.sreReady()
|
||||
.then(function () { return sre_js_1.default.setupEngine({ modality: options.modality,
|
||||
locale: options.locale }); })
|
||||
.then(function () { return _this.region.Update(_this.walker.speech()); })];
|
||||
});
|
||||
}); });
|
||||
};
|
||||
SpeechExplorer.prototype.Speech = function (walker) {
|
||||
var _this = this;
|
||||
SpeechExplorer.updatePromise.then(function () {
|
||||
walker.speech();
|
||||
_this.node.setAttribute('hasspeech', 'true');
|
||||
_this.Update();
|
||||
if (_this.restarted && _this.document.options.a11y[_this.showRegion]) {
|
||||
_this.region.Show(_this.node, _this.highlighter);
|
||||
}
|
||||
});
|
||||
};
|
||||
SpeechExplorer.prototype.KeyDown = function (event) {
|
||||
var code = event.keyCode;
|
||||
this.walker.modifier = event.shiftKey;
|
||||
if (code === 27) {
|
||||
this.Stop();
|
||||
this.stopEvent(event);
|
||||
return;
|
||||
}
|
||||
if (this.active) {
|
||||
this.Move(code);
|
||||
if (this.triggerLink(code))
|
||||
return;
|
||||
this.stopEvent(event);
|
||||
return;
|
||||
}
|
||||
if (code === 32 && event.shiftKey || code === 13) {
|
||||
this.Start();
|
||||
this.stopEvent(event);
|
||||
}
|
||||
};
|
||||
SpeechExplorer.prototype.triggerLink = function (code) {
|
||||
var _a, _b;
|
||||
if (code !== 13) {
|
||||
return false;
|
||||
}
|
||||
var node = (_a = this.walker.getFocus().getNodes()) === null || _a === void 0 ? void 0 : _a[0];
|
||||
var focus = (_b = node === null || node === void 0 ? void 0 : node.getAttribute('data-semantic-postfix')) === null || _b === void 0 ? void 0 : _b.match(/(^| )link($| )/);
|
||||
if (focus) {
|
||||
node.parentNode.dispatchEvent(new MouseEvent('click'));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
SpeechExplorer.prototype.Move = function (key) {
|
||||
this.walker.move(key);
|
||||
this.Update();
|
||||
};
|
||||
SpeechExplorer.prototype.initWalker = function () {
|
||||
this.speechGenerator = sre_js_1.default.getSpeechGenerator('Tree');
|
||||
var dummy = sre_js_1.default.getWalker('dummy', this.node, this.speechGenerator, this.highlighter, this.mml);
|
||||
this.walker = dummy;
|
||||
};
|
||||
SpeechExplorer.prototype.getOptions = function () {
|
||||
var options = this.speechGenerator.getOptions();
|
||||
var sreOptions = this.document.options.sre;
|
||||
if (options.modality === 'speech' &&
|
||||
(options.locale !== sreOptions.locale ||
|
||||
options.domain !== sreOptions.domain ||
|
||||
options.style !== sreOptions.style)) {
|
||||
options.domain = sreOptions.domain;
|
||||
options.style = sreOptions.style;
|
||||
options.locale = sreOptions.locale;
|
||||
this.walker.update(options);
|
||||
}
|
||||
return options;
|
||||
};
|
||||
SpeechExplorer.updatePromise = Promise.resolve();
|
||||
return SpeechExplorer;
|
||||
}(AbstractKeyExplorer));
|
||||
exports.SpeechExplorer = SpeechExplorer;
|
||||
var Magnifier = (function (_super) {
|
||||
__extends(Magnifier, _super);
|
||||
function Magnifier(document, region, node, mml) {
|
||||
var _this = _super.call(this, document, region, node) || this;
|
||||
_this.document = document;
|
||||
_this.region = region;
|
||||
_this.node = node;
|
||||
_this.mml = mml;
|
||||
_this.walker = sre_js_1.default.getWalker('table', _this.node, sre_js_1.default.getSpeechGenerator('Dummy'), _this.highlighter, _this.mml);
|
||||
return _this;
|
||||
}
|
||||
Magnifier.prototype.Update = function (force) {
|
||||
if (force === void 0) { force = false; }
|
||||
_super.prototype.Update.call(this, force);
|
||||
this.showFocus();
|
||||
};
|
||||
Magnifier.prototype.Start = function () {
|
||||
_super.prototype.Start.call(this);
|
||||
if (!this.attached)
|
||||
return;
|
||||
this.region.Show(this.node, this.highlighter);
|
||||
this.walker.activate();
|
||||
this.Update();
|
||||
};
|
||||
Magnifier.prototype.showFocus = function () {
|
||||
var node = this.walker.getFocus().getNodes()[0];
|
||||
this.region.Show(node, this.highlighter);
|
||||
};
|
||||
Magnifier.prototype.Move = function (key) {
|
||||
var result = this.walker.move(key);
|
||||
if (result) {
|
||||
this.Update();
|
||||
}
|
||||
};
|
||||
Magnifier.prototype.KeyDown = function (event) {
|
||||
var code = event.keyCode;
|
||||
this.walker.modifier = event.shiftKey;
|
||||
if (code === 27) {
|
||||
this.Stop();
|
||||
this.stopEvent(event);
|
||||
return;
|
||||
}
|
||||
if (this.active && code !== 13) {
|
||||
this.Move(code);
|
||||
this.stopEvent(event);
|
||||
return;
|
||||
}
|
||||
if (code === 32 && event.shiftKey || code === 13) {
|
||||
this.Start();
|
||||
this.stopEvent(event);
|
||||
}
|
||||
};
|
||||
return Magnifier;
|
||||
}(AbstractKeyExplorer));
|
||||
exports.Magnifier = Magnifier;
|
||||
//# sourceMappingURL=KeyExplorer.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/explorer/KeyExplorer.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/explorer/KeyExplorer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
node_modules/mathjax-full/js/a11y/explorer/MouseExplorer.d.ts
generated
vendored
Normal file
33
node_modules/mathjax-full/js/a11y/explorer/MouseExplorer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { A11yDocument, Region } from './Region.js';
|
||||
import { Explorer, AbstractExplorer } from './Explorer.js';
|
||||
import '../sre.js';
|
||||
export interface MouseExplorer extends Explorer {
|
||||
MouseOver(event: MouseEvent): void;
|
||||
MouseOut(event: MouseEvent): void;
|
||||
}
|
||||
export declare abstract class AbstractMouseExplorer<T> extends AbstractExplorer<T> implements MouseExplorer {
|
||||
protected events: [string, (x: Event) => void][];
|
||||
MouseOver(_event: MouseEvent): void;
|
||||
MouseOut(_event: MouseEvent): void;
|
||||
}
|
||||
export declare abstract class Hoverer<T> extends AbstractMouseExplorer<T> {
|
||||
document: A11yDocument;
|
||||
protected region: Region<T>;
|
||||
protected node: HTMLElement;
|
||||
protected nodeQuery: (node: HTMLElement) => boolean;
|
||||
protected nodeAccess: (node: HTMLElement) => T;
|
||||
protected coord: [number, number];
|
||||
protected constructor(document: A11yDocument, region: Region<T>, node: HTMLElement, nodeQuery: (node: HTMLElement) => boolean, nodeAccess: (node: HTMLElement) => T);
|
||||
MouseOut(event: MouseEvent): void;
|
||||
MouseOver(event: MouseEvent): void;
|
||||
getNode(node: HTMLElement): [HTMLElement, T];
|
||||
}
|
||||
export declare class ValueHoverer extends Hoverer<string> {
|
||||
}
|
||||
export declare class ContentHoverer extends Hoverer<HTMLElement> {
|
||||
}
|
||||
export declare class FlameHoverer extends Hoverer<void> {
|
||||
document: A11yDocument;
|
||||
protected node: HTMLElement;
|
||||
protected constructor(document: A11yDocument, _ignore: any, node: HTMLElement);
|
||||
}
|
||||
139
node_modules/mathjax-full/js/a11y/explorer/MouseExplorer.js
generated
vendored
Normal file
139
node_modules/mathjax-full/js/a11y/explorer/MouseExplorer.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FlameHoverer = exports.ContentHoverer = exports.ValueHoverer = exports.Hoverer = exports.AbstractMouseExplorer = void 0;
|
||||
var Region_js_1 = require("./Region.js");
|
||||
var Explorer_js_1 = require("./Explorer.js");
|
||||
require("../sre.js");
|
||||
var AbstractMouseExplorer = (function (_super) {
|
||||
__extends(AbstractMouseExplorer, _super);
|
||||
function AbstractMouseExplorer() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.events = _super.prototype.Events.call(_this).concat([
|
||||
['mouseover', _this.MouseOver.bind(_this)],
|
||||
['mouseout', _this.MouseOut.bind(_this)]
|
||||
]);
|
||||
return _this;
|
||||
}
|
||||
AbstractMouseExplorer.prototype.MouseOver = function (_event) {
|
||||
this.Start();
|
||||
};
|
||||
AbstractMouseExplorer.prototype.MouseOut = function (_event) {
|
||||
this.Stop();
|
||||
};
|
||||
return AbstractMouseExplorer;
|
||||
}(Explorer_js_1.AbstractExplorer));
|
||||
exports.AbstractMouseExplorer = AbstractMouseExplorer;
|
||||
var Hoverer = (function (_super) {
|
||||
__extends(Hoverer, _super);
|
||||
function Hoverer(document, region, node, nodeQuery, nodeAccess) {
|
||||
var _this = _super.call(this, document, region, node) || this;
|
||||
_this.document = document;
|
||||
_this.region = region;
|
||||
_this.node = node;
|
||||
_this.nodeQuery = nodeQuery;
|
||||
_this.nodeAccess = nodeAccess;
|
||||
return _this;
|
||||
}
|
||||
Hoverer.prototype.MouseOut = function (event) {
|
||||
if (event.clientX === this.coord[0] &&
|
||||
event.clientY === this.coord[1]) {
|
||||
return;
|
||||
}
|
||||
this.highlighter.unhighlight();
|
||||
this.region.Hide();
|
||||
_super.prototype.MouseOut.call(this, event);
|
||||
};
|
||||
Hoverer.prototype.MouseOver = function (event) {
|
||||
_super.prototype.MouseOver.call(this, event);
|
||||
var target = event.target;
|
||||
this.coord = [event.clientX, event.clientY];
|
||||
var _a = __read(this.getNode(target), 2), node = _a[0], kind = _a[1];
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
this.highlighter.unhighlight();
|
||||
this.highlighter.highlight([node]);
|
||||
this.region.Update(kind);
|
||||
this.region.Show(node, this.highlighter);
|
||||
};
|
||||
Hoverer.prototype.getNode = function (node) {
|
||||
var original = node;
|
||||
while (node && node !== this.node) {
|
||||
if (this.nodeQuery(node)) {
|
||||
return [node, this.nodeAccess(node)];
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
node = original;
|
||||
while (node) {
|
||||
if (this.nodeQuery(node)) {
|
||||
return [node, this.nodeAccess(node)];
|
||||
}
|
||||
var child = node.childNodes[0];
|
||||
node = (child && child.tagName === 'defs') ?
|
||||
node.childNodes[1] : child;
|
||||
}
|
||||
return [null, null];
|
||||
};
|
||||
return Hoverer;
|
||||
}(AbstractMouseExplorer));
|
||||
exports.Hoverer = Hoverer;
|
||||
var ValueHoverer = (function (_super) {
|
||||
__extends(ValueHoverer, _super);
|
||||
function ValueHoverer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return ValueHoverer;
|
||||
}(Hoverer));
|
||||
exports.ValueHoverer = ValueHoverer;
|
||||
var ContentHoverer = (function (_super) {
|
||||
__extends(ContentHoverer, _super);
|
||||
function ContentHoverer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return ContentHoverer;
|
||||
}(Hoverer));
|
||||
exports.ContentHoverer = ContentHoverer;
|
||||
var FlameHoverer = (function (_super) {
|
||||
__extends(FlameHoverer, _super);
|
||||
function FlameHoverer(document, _ignore, node) {
|
||||
var _this = _super.call(this, document, new Region_js_1.DummyRegion(document), node, function (x) { return _this.highlighter.isMactionNode(x); }, function () { }) || this;
|
||||
_this.document = document;
|
||||
_this.node = node;
|
||||
return _this;
|
||||
}
|
||||
return FlameHoverer;
|
||||
}(Hoverer));
|
||||
exports.FlameHoverer = FlameHoverer;
|
||||
//# sourceMappingURL=MouseExplorer.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/explorer/MouseExplorer.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/explorer/MouseExplorer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"MouseExplorer.js","sourceRoot":"","sources":["../../../ts/a11y/explorer/MouseExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,yCAA8D;AAC9D,6CAAyD;AACzD,qBAAmB;AA+BnB;IAAuD,yCAAmB;IAA1E;QAAA,qEA0BC;QArBW,YAAM,GACd,iBAAM,MAAM,YAAE,CAAC,MAAM,CAAC;YACpB,CAAC,WAAW,EAAE,KAAI,CAAC,SAAS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AAC;SAC3C;QACD,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtB,CAAC;IAEH,cAAC;AAAD,CAAC,AA7FD,CAAyC,qBAAqB,GA6F7D;AA7FqB,0BAAO;AAqG7B;IAAkC,gCAAe;IAAjD;;IAAoD,CAAC;IAAD,mBAAC;AAAD,CAAC,AAArD,CAAkC,OAAO,GAAY;AAAxC,oCAAY;AAQzB;IAAoC,kCAAoB;IAAxD;;IAA2D,CAAC;IAAD,qBAAC;AAAD,CAAC,AAA5D,CAAoC,OAAO,GAAiB;AAA/C,wCAAc;AAQ3B;IAAkC,gCAAa;IAK7C,sBACS,QAAsB,EAC7B,OAAY,EACF,IAAiB;QAH7B,YAIE,kBAAM,QAAQ,EAAE,IAAI,uBAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,EACzC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,EAAjC,CAAiC,EACtC,cAAO,CAAC,CAAC,SAChB;QANQ,cAAQ,GAAR,QAAQ,CAAc;QAEnB,UAAI,GAAJ,IAAI,CAAa;;IAI7B,CAAC;IAEH,mBAAC;AAAD,CAAC,AAdD,CAAkC,OAAO,GAcxC;AAdY,oCAAY"}
|
||||
69
node_modules/mathjax-full/js/a11y/explorer/Region.d.ts
generated
vendored
Normal file
69
node_modules/mathjax-full/js/a11y/explorer/Region.d.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import { MathDocument } from '../../core/MathDocument.js';
|
||||
import { CssStyles } from '../../util/StyleList.js';
|
||||
import Sre from '../sre.js';
|
||||
export declare type A11yDocument = MathDocument<HTMLElement, Text, Document>;
|
||||
export interface Region<T> {
|
||||
AddStyles(): void;
|
||||
AddElement(): void;
|
||||
Show(node: HTMLElement, highlighter: Sre.highlighter): void;
|
||||
Hide(): void;
|
||||
Clear(): void;
|
||||
Update(content: T): void;
|
||||
}
|
||||
export declare abstract class AbstractRegion<T> implements Region<T> {
|
||||
document: A11yDocument;
|
||||
protected static className: string;
|
||||
protected static styleAdded: boolean;
|
||||
protected static style: CssStyles;
|
||||
protected div: HTMLElement;
|
||||
protected inner: HTMLElement;
|
||||
protected CLASS: typeof AbstractRegion;
|
||||
constructor(document: A11yDocument);
|
||||
AddStyles(): void;
|
||||
AddElement(): void;
|
||||
Show(node: HTMLElement, highlighter: Sre.highlighter): void;
|
||||
protected abstract position(node: HTMLElement): void;
|
||||
protected abstract highlight(highlighter: Sre.highlighter): void;
|
||||
Hide(): void;
|
||||
abstract Clear(): void;
|
||||
abstract Update(content: T): void;
|
||||
protected stackRegions(node: HTMLElement): void;
|
||||
}
|
||||
export declare class DummyRegion extends AbstractRegion<void> {
|
||||
Clear(): void;
|
||||
Update(): void;
|
||||
Hide(): void;
|
||||
Show(): void;
|
||||
AddElement(): void;
|
||||
AddStyles(): void;
|
||||
position(): void;
|
||||
highlight(_highlighter: Sre.highlighter): void;
|
||||
}
|
||||
export declare class StringRegion extends AbstractRegion<string> {
|
||||
Clear(): void;
|
||||
Update(speech: string): void;
|
||||
protected position(node: HTMLElement): void;
|
||||
protected highlight(highlighter: Sre.highlighter): void;
|
||||
}
|
||||
export declare class ToolTip extends StringRegion {
|
||||
protected static className: string;
|
||||
protected static style: CssStyles;
|
||||
}
|
||||
export declare class LiveRegion extends StringRegion {
|
||||
document: A11yDocument;
|
||||
protected static className: string;
|
||||
protected static style: CssStyles;
|
||||
constructor(document: A11yDocument);
|
||||
}
|
||||
export declare class HoverRegion extends AbstractRegion<HTMLElement> {
|
||||
document: A11yDocument;
|
||||
protected static className: string;
|
||||
protected static style: CssStyles;
|
||||
constructor(document: A11yDocument);
|
||||
protected position(node: HTMLElement): void;
|
||||
protected highlight(highlighter: Sre.highlighter): void;
|
||||
Show(node: HTMLElement, highlighter: Sre.highlighter): void;
|
||||
Clear(): void;
|
||||
Update(node: HTMLElement): void;
|
||||
private cloneNode;
|
||||
}
|
||||
267
node_modules/mathjax-full/js/a11y/explorer/Region.js
generated
vendored
Normal file
267
node_modules/mathjax-full/js/a11y/explorer/Region.js
generated
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var _a, _b, _c;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HoverRegion = exports.LiveRegion = exports.ToolTip = exports.StringRegion = exports.DummyRegion = exports.AbstractRegion = void 0;
|
||||
var StyleList_js_1 = require("../../util/StyleList.js");
|
||||
var AbstractRegion = (function () {
|
||||
function AbstractRegion(document) {
|
||||
this.document = document;
|
||||
this.CLASS = this.constructor;
|
||||
this.AddStyles();
|
||||
this.AddElement();
|
||||
}
|
||||
AbstractRegion.prototype.AddStyles = function () {
|
||||
if (this.CLASS.styleAdded) {
|
||||
return;
|
||||
}
|
||||
var node = this.document.adaptor.node('style');
|
||||
node.innerHTML = this.CLASS.style.cssText;
|
||||
this.document.adaptor.head(this.document.adaptor.document).
|
||||
appendChild(node);
|
||||
this.CLASS.styleAdded = true;
|
||||
};
|
||||
AbstractRegion.prototype.AddElement = function () {
|
||||
var element = this.document.adaptor.node('div');
|
||||
element.classList.add(this.CLASS.className);
|
||||
element.style.backgroundColor = 'white';
|
||||
this.div = element;
|
||||
this.inner = this.document.adaptor.node('div');
|
||||
this.div.appendChild(this.inner);
|
||||
this.document.adaptor.
|
||||
body(this.document.adaptor.document).
|
||||
appendChild(this.div);
|
||||
};
|
||||
AbstractRegion.prototype.Show = function (node, highlighter) {
|
||||
this.position(node);
|
||||
this.highlight(highlighter);
|
||||
this.div.classList.add(this.CLASS.className + '_Show');
|
||||
};
|
||||
AbstractRegion.prototype.Hide = function () {
|
||||
this.div.classList.remove(this.CLASS.className + '_Show');
|
||||
};
|
||||
AbstractRegion.prototype.stackRegions = function (node) {
|
||||
var rect = node.getBoundingClientRect();
|
||||
var baseBottom = 0;
|
||||
var baseLeft = Number.POSITIVE_INFINITY;
|
||||
var regions = this.document.adaptor.document.getElementsByClassName(this.CLASS.className + '_Show');
|
||||
for (var i = 0, region = void 0; region = regions[i]; i++) {
|
||||
if (region !== this.div) {
|
||||
baseBottom = Math.max(region.getBoundingClientRect().bottom, baseBottom);
|
||||
baseLeft = Math.min(region.getBoundingClientRect().left, baseLeft);
|
||||
}
|
||||
}
|
||||
var bot = (baseBottom ? baseBottom : rect.bottom + 10) + window.pageYOffset;
|
||||
var left = (baseLeft < Number.POSITIVE_INFINITY ? baseLeft : rect.left) + window.pageXOffset;
|
||||
this.div.style.top = bot + 'px';
|
||||
this.div.style.left = left + 'px';
|
||||
};
|
||||
AbstractRegion.styleAdded = false;
|
||||
return AbstractRegion;
|
||||
}());
|
||||
exports.AbstractRegion = AbstractRegion;
|
||||
var DummyRegion = (function (_super) {
|
||||
__extends(DummyRegion, _super);
|
||||
function DummyRegion() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
DummyRegion.prototype.Clear = function () { };
|
||||
DummyRegion.prototype.Update = function () { };
|
||||
DummyRegion.prototype.Hide = function () { };
|
||||
DummyRegion.prototype.Show = function () { };
|
||||
DummyRegion.prototype.AddElement = function () { };
|
||||
DummyRegion.prototype.AddStyles = function () { };
|
||||
DummyRegion.prototype.position = function () { };
|
||||
DummyRegion.prototype.highlight = function (_highlighter) { };
|
||||
return DummyRegion;
|
||||
}(AbstractRegion));
|
||||
exports.DummyRegion = DummyRegion;
|
||||
var StringRegion = (function (_super) {
|
||||
__extends(StringRegion, _super);
|
||||
function StringRegion() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
StringRegion.prototype.Clear = function () {
|
||||
this.Update('');
|
||||
this.inner.style.top = '';
|
||||
this.inner.style.backgroundColor = '';
|
||||
};
|
||||
StringRegion.prototype.Update = function (speech) {
|
||||
this.inner.textContent = '';
|
||||
this.inner.textContent = speech;
|
||||
};
|
||||
StringRegion.prototype.position = function (node) {
|
||||
this.stackRegions(node);
|
||||
};
|
||||
StringRegion.prototype.highlight = function (highlighter) {
|
||||
var color = highlighter.colorString();
|
||||
this.inner.style.backgroundColor = color.background;
|
||||
this.inner.style.color = color.foreground;
|
||||
};
|
||||
return StringRegion;
|
||||
}(AbstractRegion));
|
||||
exports.StringRegion = StringRegion;
|
||||
var ToolTip = (function (_super) {
|
||||
__extends(ToolTip, _super);
|
||||
function ToolTip() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ToolTip.className = 'MJX_ToolTip';
|
||||
ToolTip.style = new StyleList_js_1.CssStyles((_a = {},
|
||||
_a['.' + ToolTip.className] = {
|
||||
position: 'absolute', display: 'inline-block',
|
||||
height: '1px', width: '1px'
|
||||
},
|
||||
_a['.' + ToolTip.className + '_Show'] = {
|
||||
width: 'auto', height: 'auto', opacity: 1, 'text-align': 'center',
|
||||
'border-radius': '6px', padding: '0px 0px',
|
||||
'border-bottom': '1px dotted black', position: 'absolute',
|
||||
'z-index': 202
|
||||
},
|
||||
_a));
|
||||
return ToolTip;
|
||||
}(StringRegion));
|
||||
exports.ToolTip = ToolTip;
|
||||
var LiveRegion = (function (_super) {
|
||||
__extends(LiveRegion, _super);
|
||||
function LiveRegion(document) {
|
||||
var _this = _super.call(this, document) || this;
|
||||
_this.document = document;
|
||||
_this.div.setAttribute('aria-live', 'assertive');
|
||||
return _this;
|
||||
}
|
||||
LiveRegion.className = 'MJX_LiveRegion';
|
||||
LiveRegion.style = new StyleList_js_1.CssStyles((_b = {},
|
||||
_b['.' + LiveRegion.className] = {
|
||||
position: 'absolute', top: '0', height: '1px', width: '1px',
|
||||
padding: '1px', overflow: 'hidden'
|
||||
},
|
||||
_b['.' + LiveRegion.className + '_Show'] = {
|
||||
top: '0', position: 'absolute', width: 'auto', height: 'auto',
|
||||
padding: '0px 0px', opacity: 1, 'z-index': '202',
|
||||
left: 0, right: 0, 'margin': '0 auto',
|
||||
'background-color': 'rgba(0, 0, 255, 0.2)', 'box-shadow': '0px 10px 20px #888',
|
||||
border: '2px solid #CCCCCC'
|
||||
},
|
||||
_b));
|
||||
return LiveRegion;
|
||||
}(StringRegion));
|
||||
exports.LiveRegion = LiveRegion;
|
||||
var HoverRegion = (function (_super) {
|
||||
__extends(HoverRegion, _super);
|
||||
function HoverRegion(document) {
|
||||
var _this = _super.call(this, document) || this;
|
||||
_this.document = document;
|
||||
_this.inner.style.lineHeight = '0';
|
||||
return _this;
|
||||
}
|
||||
HoverRegion.prototype.position = function (node) {
|
||||
var nodeRect = node.getBoundingClientRect();
|
||||
var divRect = this.div.getBoundingClientRect();
|
||||
var xCenter = nodeRect.left + (nodeRect.width / 2);
|
||||
var left = xCenter - (divRect.width / 2);
|
||||
left = (left < 0) ? 0 : left;
|
||||
left = left + window.pageXOffset;
|
||||
var top;
|
||||
switch (this.document.options.a11y.align) {
|
||||
case 'top':
|
||||
top = nodeRect.top - divRect.height - 10;
|
||||
break;
|
||||
case 'bottom':
|
||||
top = nodeRect.bottom + 10;
|
||||
break;
|
||||
case 'center':
|
||||
default:
|
||||
var yCenter = nodeRect.top + (nodeRect.height / 2);
|
||||
top = yCenter - (divRect.height / 2);
|
||||
}
|
||||
top = top + window.pageYOffset;
|
||||
top = (top < 0) ? 0 : top;
|
||||
this.div.style.top = top + 'px';
|
||||
this.div.style.left = left + 'px';
|
||||
};
|
||||
HoverRegion.prototype.highlight = function (highlighter) {
|
||||
if (this.inner.firstChild &&
|
||||
!this.inner.firstChild.hasAttribute('sre-highlight')) {
|
||||
return;
|
||||
}
|
||||
var color = highlighter.colorString();
|
||||
this.inner.style.backgroundColor = color.background;
|
||||
this.inner.style.color = color.foreground;
|
||||
};
|
||||
HoverRegion.prototype.Show = function (node, highlighter) {
|
||||
this.div.style.fontSize = this.document.options.a11y.magnify;
|
||||
this.Update(node);
|
||||
_super.prototype.Show.call(this, node, highlighter);
|
||||
};
|
||||
HoverRegion.prototype.Clear = function () {
|
||||
this.inner.textContent = '';
|
||||
this.inner.style.top = '';
|
||||
this.inner.style.backgroundColor = '';
|
||||
};
|
||||
HoverRegion.prototype.Update = function (node) {
|
||||
this.Clear();
|
||||
var mjx = this.cloneNode(node);
|
||||
this.inner.appendChild(mjx);
|
||||
};
|
||||
HoverRegion.prototype.cloneNode = function (node) {
|
||||
var mjx = node.cloneNode(true);
|
||||
if (mjx.nodeName !== 'MJX-CONTAINER') {
|
||||
if (mjx.nodeName !== 'g') {
|
||||
mjx.style.marginLeft = mjx.style.marginRight = '0';
|
||||
}
|
||||
var container = node;
|
||||
while (container && container.nodeName !== 'MJX-CONTAINER') {
|
||||
container = container.parentNode;
|
||||
}
|
||||
if (mjx.nodeName !== 'MJX-MATH' && mjx.nodeName !== 'svg') {
|
||||
var child = container.firstChild;
|
||||
mjx = child.cloneNode(false).appendChild(mjx).parentNode;
|
||||
if (mjx.nodeName === 'svg') {
|
||||
mjx.firstChild.setAttribute('transform', 'matrix(1 0 0 -1 0 0)');
|
||||
var W = parseFloat(mjx.getAttribute('viewBox').split(/ /)[2]);
|
||||
var w = parseFloat(mjx.getAttribute('width'));
|
||||
var _a = node.getBBox(), x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
||||
mjx.setAttribute('viewBox', [x, -(y + height), width, height].join(' '));
|
||||
mjx.removeAttribute('style');
|
||||
mjx.setAttribute('width', (w / W * width) + 'ex');
|
||||
mjx.setAttribute('height', (w / W * height) + 'ex');
|
||||
container.setAttribute('sre-highlight', 'false');
|
||||
}
|
||||
}
|
||||
mjx = container.cloneNode(false).appendChild(mjx).parentNode;
|
||||
mjx.style.margin = '0';
|
||||
}
|
||||
return mjx;
|
||||
};
|
||||
HoverRegion.className = 'MJX_HoverRegion';
|
||||
HoverRegion.style = new StyleList_js_1.CssStyles((_c = {},
|
||||
_c['.' + HoverRegion.className] = {
|
||||
position: 'absolute', height: '1px', width: '1px',
|
||||
padding: '1px', overflow: 'hidden'
|
||||
},
|
||||
_c['.' + HoverRegion.className + '_Show'] = {
|
||||
position: 'absolute', width: 'max-content', height: 'auto',
|
||||
padding: '0px 0px', opacity: 1, 'z-index': '202', 'margin': '0 auto',
|
||||
'background-color': 'rgba(0, 0, 255, 0.2)',
|
||||
'box-shadow': '0px 10px 20px #888', border: '2px solid #CCCCCC'
|
||||
},
|
||||
_c));
|
||||
return HoverRegion;
|
||||
}(AbstractRegion));
|
||||
exports.HoverRegion = HoverRegion;
|
||||
//# sourceMappingURL=Region.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/explorer/Region.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/explorer/Region.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/mathjax-full/js/a11y/explorer/TreeExplorer.d.ts
generated
vendored
Normal file
22
node_modules/mathjax-full/js/a11y/explorer/TreeExplorer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { A11yDocument, Region } from './Region.js';
|
||||
import { Explorer, AbstractExplorer } from './Explorer.js';
|
||||
export interface TreeExplorer extends Explorer {
|
||||
}
|
||||
export declare class AbstractTreeExplorer extends AbstractExplorer<void> {
|
||||
document: A11yDocument;
|
||||
protected region: Region<void>;
|
||||
protected node: HTMLElement;
|
||||
protected mml: HTMLElement;
|
||||
protected constructor(document: A11yDocument, region: Region<void>, node: HTMLElement, mml: HTMLElement);
|
||||
readonly stoppable = false;
|
||||
Attach(): void;
|
||||
Detach(): void;
|
||||
}
|
||||
export declare class FlameColorer extends AbstractTreeExplorer {
|
||||
Start(): void;
|
||||
Stop(): void;
|
||||
}
|
||||
export declare class TreeColorer extends AbstractTreeExplorer {
|
||||
Start(): void;
|
||||
Stop(): void;
|
||||
}
|
||||
91
node_modules/mathjax-full/js/a11y/explorer/TreeExplorer.js
generated
vendored
Normal file
91
node_modules/mathjax-full/js/a11y/explorer/TreeExplorer.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TreeColorer = exports.FlameColorer = exports.AbstractTreeExplorer = void 0;
|
||||
var Explorer_js_1 = require("./Explorer.js");
|
||||
var sre_js_1 = __importDefault(require("../sre.js"));
|
||||
var AbstractTreeExplorer = (function (_super) {
|
||||
__extends(AbstractTreeExplorer, _super);
|
||||
function AbstractTreeExplorer(document, region, node, mml) {
|
||||
var _this = _super.call(this, document, null, node) || this;
|
||||
_this.document = document;
|
||||
_this.region = region;
|
||||
_this.node = node;
|
||||
_this.mml = mml;
|
||||
_this.stoppable = false;
|
||||
return _this;
|
||||
}
|
||||
AbstractTreeExplorer.prototype.Attach = function () {
|
||||
_super.prototype.Attach.call(this);
|
||||
this.Start();
|
||||
};
|
||||
AbstractTreeExplorer.prototype.Detach = function () {
|
||||
this.Stop();
|
||||
_super.prototype.Detach.call(this);
|
||||
};
|
||||
return AbstractTreeExplorer;
|
||||
}(Explorer_js_1.AbstractExplorer));
|
||||
exports.AbstractTreeExplorer = AbstractTreeExplorer;
|
||||
var FlameColorer = (function (_super) {
|
||||
__extends(FlameColorer, _super);
|
||||
function FlameColorer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
FlameColorer.prototype.Start = function () {
|
||||
if (this.active)
|
||||
return;
|
||||
this.active = true;
|
||||
this.highlighter.highlightAll(this.node);
|
||||
};
|
||||
FlameColorer.prototype.Stop = function () {
|
||||
if (this.active) {
|
||||
this.highlighter.unhighlightAll();
|
||||
}
|
||||
this.active = false;
|
||||
};
|
||||
return FlameColorer;
|
||||
}(AbstractTreeExplorer));
|
||||
exports.FlameColorer = FlameColorer;
|
||||
var TreeColorer = (function (_super) {
|
||||
__extends(TreeColorer, _super);
|
||||
function TreeColorer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
TreeColorer.prototype.Start = function () {
|
||||
if (this.active)
|
||||
return;
|
||||
this.active = true;
|
||||
var generator = sre_js_1.default.getSpeechGenerator('Color');
|
||||
if (!this.node.hasAttribute('hasforegroundcolor')) {
|
||||
generator.generateSpeech(this.node, this.mml);
|
||||
this.node.setAttribute('hasforegroundcolor', 'true');
|
||||
}
|
||||
this.highlighter.colorizeAll(this.node);
|
||||
};
|
||||
TreeColorer.prototype.Stop = function () {
|
||||
if (this.active) {
|
||||
this.highlighter.uncolorizeAll(this.node);
|
||||
}
|
||||
this.active = false;
|
||||
};
|
||||
return TreeColorer;
|
||||
}(AbstractTreeExplorer));
|
||||
exports.TreeColorer = TreeColorer;
|
||||
//# sourceMappingURL=TreeExplorer.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/explorer/TreeExplorer.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/explorer/TreeExplorer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TreeExplorer.js","sourceRoot":"","sources":["../../../ts/a11y/explorer/TreeExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,6CAAyD;AACzD,qDAA4B;AAO5B;IAA0C,wCAAsB;IAK9D,8BAA6B,QAAsB,EACnB,MAAoB,EACpB,IAAiB,EACjB,GAAgB;QAHhD,YAIE,kBAAM,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,SAC5B;QAL4B,cAAQ,GAAR,QAAQ,CAAc;QACnB,YAAM,GAAN,MAAM,CAAc;QACpB,UAAI,GAAJ,IAAI,CAAa;QACjB,SAAG,GAAH,GAAG,CAAa;QAOhC,eAAS,GAAG,KAAK,CAAC;;IALlC,CAAC;IAWM,qCAAM,GAAb;QACE,iBAAM,MAAM,WAAE,CAAC;QACf,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAKM,qCAAM,GAAb;QACE,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,iBAAM,MAAM,WAAE,CAAC;IACjB,CAAC;IAEH,2BAAC;AAAD,CAAC,AAlCD,CAA0C,8BAAgB,GAkCzD;AAlCY,oDAAoB;AAqCjC;IAAkC,gCAAoB;IAAtD;;IAqBA,CAAC;IAhBQ,4BAAK,GAAZ;QACE,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAKM,2BAAI,GAAX;QACE,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC;SACnC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEH,mBAAC;AAAD,CAAC,AArBD,CAAkC,oBAAoB,GAqBrD;AArBY,oCAAY;AAwBzB;IAAiC,+BAAoB;IAArD;;IA2BA,CAAC;IAtBQ,2BAAK,GAAZ;QACE,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,SAAS,GAAG,gBAAG,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE;YACjD,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;SACtD;QAEA,IAAI,CAAC,WAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAKM,0BAAI,GAAX;QACE,IAAI,IAAI,CAAC,MAAM,EAAE;YACd,IAAI,CAAC,WAAmB,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpD;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEH,kBAAC;AAAD,CAAC,AA3BD,CAAiC,oBAAoB,GA2BpD;AA3BY,kCAAW"}
|
||||
4
node_modules/mathjax-full/js/a11y/mathmaps.d.ts
generated
vendored
Normal file
4
node_modules/mathjax-full/js/a11y/mathmaps.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const MathMaps: Map<string, {
|
||||
[path: string]: any;
|
||||
}>;
|
||||
export default MathMaps;
|
||||
5
node_modules/mathjax-full/js/a11y/mathmaps.js
generated
vendored
Normal file
5
node_modules/mathjax-full/js/a11y/mathmaps.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var MathMaps = new Map();
|
||||
exports.default = MathMaps;
|
||||
//# sourceMappingURL=mathmaps.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/mathmaps.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/mathmaps.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mathmaps.js","sourceRoot":"","sources":["../../ts/a11y/mathmaps.ts"],"names":[],"mappings":";;AAwBA,IAAM,QAAQ,GAAuC,IAAI,GAAG,EAAE,CAAC;AAE/D,kBAAe,QAAQ,CAAC"}
|
||||
18
node_modules/mathjax-full/js/a11y/semantic-enrich.d.ts
generated
vendored
Normal file
18
node_modules/mathjax-full/js/a11y/semantic-enrich.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Handler } from '../core/Handler.js';
|
||||
import { MathDocument, AbstractMathDocument, MathDocumentConstructor } from '../core/MathDocument.js';
|
||||
import { MathItem, AbstractMathItem } from '../core/MathItem.js';
|
||||
import { MmlNode } from '../core/MmlTree/MmlNode.js';
|
||||
import { MathML } from '../input/mathml.js';
|
||||
export declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export interface EnrichedMathItem<N, T, D> extends MathItem<N, T, D> {
|
||||
enrich(document: MathDocument<N, T, D>, force?: boolean): void;
|
||||
attachSpeech(document: MathDocument<N, T, D>): void;
|
||||
}
|
||||
export declare function EnrichedMathItemMixin<N, T, D, B extends Constructor<AbstractMathItem<N, T, D>>>(BaseMathItem: B, MmlJax: MathML<N, T, D>, toMathML: (node: MmlNode) => string): Constructor<EnrichedMathItem<N, T, D>> & B;
|
||||
export interface EnrichedMathDocument<N, T, D> extends AbstractMathDocument<N, T, D> {
|
||||
enrich(): EnrichedMathDocument<N, T, D>;
|
||||
attachSpeech(): EnrichedMathDocument<N, T, D>;
|
||||
enrichError(doc: EnrichedMathDocument<N, T, D>, math: EnrichedMathItem<N, T, D>, err: Error): void;
|
||||
}
|
||||
export declare function EnrichedMathDocumentMixin<N, T, D, B extends MathDocumentConstructor<AbstractMathDocument<N, T, D>>>(BaseDocument: B, MmlJax: MathML<N, T, D>): MathDocumentConstructor<EnrichedMathDocument<N, T, D>> & B;
|
||||
export declare function EnrichHandler<N, T, D>(handler: Handler<N, T, D>, MmlJax: MathML<N, T, D>): Handler<N, T, D>;
|
||||
269
node_modules/mathjax-full/js/a11y/semantic-enrich.js
generated
vendored
Normal file
269
node_modules/mathjax-full/js/a11y/semantic-enrich.js
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EnrichHandler = exports.EnrichedMathDocumentMixin = exports.EnrichedMathItemMixin = void 0;
|
||||
var mathjax_js_1 = require("../mathjax.js");
|
||||
var MathItem_js_1 = require("../core/MathItem.js");
|
||||
var SerializedMmlVisitor_js_1 = require("../core/MmlTree/SerializedMmlVisitor.js");
|
||||
var Options_js_1 = require("../util/Options.js");
|
||||
var sre_js_1 = __importDefault(require("./sre.js"));
|
||||
var currentSpeech = 'none';
|
||||
(0, MathItem_js_1.newState)('ENRICHED', 30);
|
||||
(0, MathItem_js_1.newState)('ATTACHSPEECH', 155);
|
||||
function EnrichedMathItemMixin(BaseMathItem, MmlJax, toMathML) {
|
||||
return (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
class_1.prototype.serializeMml = function (node) {
|
||||
if ('outerHTML' in node) {
|
||||
return node.outerHTML;
|
||||
}
|
||||
if (typeof Element !== 'undefined' && typeof window !== 'undefined' && node instanceof Element) {
|
||||
var div = window.document.createElement('div');
|
||||
div.appendChild(node);
|
||||
return div.innerHTML;
|
||||
}
|
||||
return node.toString();
|
||||
};
|
||||
class_1.prototype.enrich = function (document, force) {
|
||||
if (force === void 0) { force = false; }
|
||||
if (this.state() >= MathItem_js_1.STATE.ENRICHED)
|
||||
return;
|
||||
if (!this.isEscaped && (document.options.enableEnrichment || force)) {
|
||||
if (document.options.sre.speech !== currentSpeech) {
|
||||
currentSpeech = document.options.sre.speech;
|
||||
mathjax_js_1.mathjax.retryAfter(sre_js_1.default.setupEngine(document.options.sre).then(function () { return sre_js_1.default.sreReady(); }));
|
||||
}
|
||||
var math = new document.options.MathItem('', MmlJax);
|
||||
try {
|
||||
var mml = this.inputData.originalMml = toMathML(this.root);
|
||||
math.math = this.serializeMml(sre_js_1.default.toEnriched(mml));
|
||||
math.display = this.display;
|
||||
math.compile(document);
|
||||
this.root = math.root;
|
||||
this.inputData.enrichedMml = math.math;
|
||||
}
|
||||
catch (err) {
|
||||
document.options.enrichError(document, this, err);
|
||||
}
|
||||
}
|
||||
this.state(MathItem_js_1.STATE.ENRICHED);
|
||||
};
|
||||
class_1.prototype.attachSpeech = function (document) {
|
||||
var e_1, _a;
|
||||
if (this.state() >= MathItem_js_1.STATE.ATTACHSPEECH)
|
||||
return;
|
||||
var attributes = this.root.attributes;
|
||||
var speech = (attributes.get('aria-label') ||
|
||||
this.getSpeech(this.root));
|
||||
if (speech) {
|
||||
var adaptor = document.adaptor;
|
||||
var node = this.typesetRoot;
|
||||
adaptor.setAttribute(node, 'aria-label', speech);
|
||||
try {
|
||||
for (var _b = __values(adaptor.childNodes(node)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
adaptor.setAttribute(child, 'aria-hidden', 'true');
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
}
|
||||
this.state(MathItem_js_1.STATE.ATTACHSPEECH);
|
||||
};
|
||||
class_1.prototype.getSpeech = function (node) {
|
||||
var e_2, _a;
|
||||
var attributes = node.attributes;
|
||||
if (!attributes)
|
||||
return '';
|
||||
var speech = attributes.getExplicit('data-semantic-speech');
|
||||
if (!attributes.getExplicit('data-semantic-parent') && speech) {
|
||||
return speech;
|
||||
}
|
||||
try {
|
||||
for (var _b = __values(node.childNodes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var child = _c.value;
|
||||
var value = this.getSpeech(child);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
return '';
|
||||
};
|
||||
return class_1;
|
||||
}(BaseMathItem));
|
||||
}
|
||||
exports.EnrichedMathItemMixin = EnrichedMathItemMixin;
|
||||
function EnrichedMathDocumentMixin(BaseDocument, MmlJax) {
|
||||
var _a;
|
||||
return _a = (function (_super) {
|
||||
__extends(class_2, _super);
|
||||
function class_2() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var _this = _super.apply(this, __spreadArray([], __read(args), false)) || this;
|
||||
MmlJax.setMmlFactory(_this.mmlFactory);
|
||||
var ProcessBits = _this.constructor.ProcessBits;
|
||||
if (!ProcessBits.has('enriched')) {
|
||||
ProcessBits.allocate('enriched');
|
||||
ProcessBits.allocate('attach-speech');
|
||||
}
|
||||
var visitor = new SerializedMmlVisitor_js_1.SerializedMmlVisitor(_this.mmlFactory);
|
||||
var toMathML = (function (node) { return visitor.visitTree(node); });
|
||||
_this.options.MathItem =
|
||||
EnrichedMathItemMixin(_this.options.MathItem, MmlJax, toMathML);
|
||||
return _this;
|
||||
}
|
||||
class_2.prototype.attachSpeech = function () {
|
||||
var e_3, _a;
|
||||
if (!this.processed.isSet('attach-speech')) {
|
||||
try {
|
||||
for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var math = _c.value;
|
||||
math.attachSpeech(this);
|
||||
}
|
||||
}
|
||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_3) throw e_3.error; }
|
||||
}
|
||||
this.processed.set('attach-speech');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
class_2.prototype.enrich = function () {
|
||||
var e_4, _a;
|
||||
if (!this.processed.isSet('enriched')) {
|
||||
if (this.options.enableEnrichment) {
|
||||
try {
|
||||
for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var math = _c.value;
|
||||
math.enrich(this);
|
||||
}
|
||||
}
|
||||
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_4) throw e_4.error; }
|
||||
}
|
||||
}
|
||||
this.processed.set('enriched');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
class_2.prototype.enrichError = function (_doc, _math, err) {
|
||||
console.warn('Enrichment error:', err);
|
||||
};
|
||||
class_2.prototype.state = function (state, restore) {
|
||||
if (restore === void 0) { restore = false; }
|
||||
_super.prototype.state.call(this, state, restore);
|
||||
if (state < MathItem_js_1.STATE.ENRICHED) {
|
||||
this.processed.clear('enriched');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
return class_2;
|
||||
}(BaseDocument)),
|
||||
_a.OPTIONS = __assign(__assign({}, BaseDocument.OPTIONS), { enableEnrichment: true, enrichError: function (doc, math, err) { return doc.enrichError(doc, math, err); }, renderActions: (0, Options_js_1.expandable)(__assign(__assign({}, BaseDocument.OPTIONS.renderActions), { enrich: [MathItem_js_1.STATE.ENRICHED], attachSpeech: [MathItem_js_1.STATE.ATTACHSPEECH] })), sre: (0, Options_js_1.expandable)({
|
||||
speech: 'none',
|
||||
domain: 'mathspeak',
|
||||
style: 'default',
|
||||
locale: 'en'
|
||||
}) }),
|
||||
_a;
|
||||
}
|
||||
exports.EnrichedMathDocumentMixin = EnrichedMathDocumentMixin;
|
||||
function EnrichHandler(handler, MmlJax) {
|
||||
MmlJax.setAdaptor(handler.adaptor);
|
||||
handler.documentClass =
|
||||
EnrichedMathDocumentMixin(handler.documentClass, MmlJax);
|
||||
return handler;
|
||||
}
|
||||
exports.EnrichHandler = EnrichHandler;
|
||||
//# sourceMappingURL=semantic-enrich.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/semantic-enrich.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/semantic-enrich.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
27
node_modules/mathjax-full/js/a11y/sre.d.ts
generated
vendored
Normal file
27
node_modules/mathjax-full/js/a11y/sre.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as Api from 'speech-rule-engine/js/common/system.js';
|
||||
import { Walker } from 'speech-rule-engine/js/walker/walker.js';
|
||||
import * as WalkerFactory from 'speech-rule-engine/js/walker/walker_factory.js';
|
||||
import * as SpeechGeneratorFactory from 'speech-rule-engine/js/speech_generator/speech_generator_factory.js';
|
||||
import { ClearspeakPreferences } from 'speech-rule-engine/js/speech_rules/clearspeak_preferences.js';
|
||||
import { Highlighter } from 'speech-rule-engine/js/highlighter/highlighter.js';
|
||||
import * as HighlighterFactory from 'speech-rule-engine/js/highlighter/highlighter_factory.js';
|
||||
import { SpeechGenerator } from 'speech-rule-engine/js/speech_generator/speech_generator.js';
|
||||
export declare namespace Sre {
|
||||
type highlighter = Highlighter;
|
||||
type speechGenerator = SpeechGenerator;
|
||||
type walker = Walker;
|
||||
const locales: Map<string, string>;
|
||||
const sreReady: typeof Api.engineReady;
|
||||
const setupEngine: typeof Api.setupEngine;
|
||||
const engineSetup: typeof Api.engineSetup;
|
||||
const toEnriched: typeof Api.toEnriched;
|
||||
const toSpeech: typeof Api.toSpeech;
|
||||
const clearspeakPreferences: typeof ClearspeakPreferences;
|
||||
const getHighlighter: typeof HighlighterFactory.highlighter;
|
||||
const getSpeechGenerator: typeof SpeechGeneratorFactory.generator;
|
||||
const getWalker: typeof WalkerFactory.walker;
|
||||
const clearspeakStyle: () => string;
|
||||
const preloadLocales: (locale: string) => Promise<unknown>;
|
||||
}
|
||||
export declare const sreReady: typeof Api.engineReady;
|
||||
export default Sre;
|
||||
104
node_modules/mathjax-full/js/a11y/sre.js
generated
vendored
Normal file
104
node_modules/mathjax-full/js/a11y/sre.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sreReady = exports.Sre = void 0;
|
||||
var Api = __importStar(require("speech-rule-engine/js/common/system.js"));
|
||||
var WalkerFactory = __importStar(require("speech-rule-engine/js/walker/walker_factory.js"));
|
||||
var SpeechGeneratorFactory = __importStar(require("speech-rule-engine/js/speech_generator/speech_generator_factory.js"));
|
||||
var EngineConst = __importStar(require("speech-rule-engine/js/common/engine_const.js"));
|
||||
var engine_js_1 = __importDefault(require("speech-rule-engine/js/common/engine.js"));
|
||||
var clearspeak_preferences_js_1 = require("speech-rule-engine/js/speech_rules/clearspeak_preferences.js");
|
||||
var HighlighterFactory = __importStar(require("speech-rule-engine/js/highlighter/highlighter_factory.js"));
|
||||
var variables_js_1 = require("speech-rule-engine/js/common/variables.js");
|
||||
var mathmaps_js_1 = __importDefault(require("./mathmaps.js"));
|
||||
var Sre;
|
||||
(function (Sre) {
|
||||
Sre.locales = variables_js_1.Variables.LOCALES;
|
||||
Sre.sreReady = Api.engineReady;
|
||||
Sre.setupEngine = Api.setupEngine;
|
||||
Sre.engineSetup = Api.engineSetup;
|
||||
Sre.toEnriched = Api.toEnriched;
|
||||
Sre.toSpeech = Api.toSpeech;
|
||||
Sre.clearspeakPreferences = clearspeak_preferences_js_1.ClearspeakPreferences;
|
||||
Sre.getHighlighter = HighlighterFactory.highlighter;
|
||||
Sre.getSpeechGenerator = SpeechGeneratorFactory.generator;
|
||||
Sre.getWalker = WalkerFactory.walker;
|
||||
Sre.clearspeakStyle = function () {
|
||||
return EngineConst.DOMAIN_TO_STYLES['clearspeak'];
|
||||
};
|
||||
Sre.preloadLocales = function (locale) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var json;
|
||||
return __generator(this, function (_a) {
|
||||
json = mathmaps_js_1.default.get(locale);
|
||||
return [2, json ? new Promise(function (res, _rej) { return res(JSON.stringify(json)); }) :
|
||||
Api.localeLoader()(locale)];
|
||||
});
|
||||
});
|
||||
};
|
||||
})(Sre = exports.Sre || (exports.Sre = {}));
|
||||
exports.sreReady = Sre.sreReady;
|
||||
engine_js_1.default.getInstance().delay = true;
|
||||
exports.default = Sre;
|
||||
//# sourceMappingURL=sre.js.map
|
||||
1
node_modules/mathjax-full/js/a11y/sre.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/a11y/sre.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sre.js","sourceRoot":"","sources":["../../ts/a11y/sre.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,0EAA8D;AAE9D,4FAAgF;AAChF,yHAA6G;AAC7G,wFAA4E;AAC5E,qFAA4D;AAC5D,0GAAmG;AAEnG,2GAA+F;AAE/F,0EAAoE;AACpE,8DAAqC;AAErC,IAAiB,GAAG,CA2CnB;AA3CD,WAAiB,GAAG;IASL,WAAO,GAAG,wBAAS,CAAC,OAAO,CAAC;IAE5B,YAAQ,GAAG,GAAG,CAAC,WAAW,CAAC;IAE3B,eAAW,GAAG,GAAG,CAAC,WAAW,CAAC;IAE9B,eAAW,GAAG,GAAG,CAAC,WAAW,CAAC;IAE9B,cAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IAE5B,YAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAExB,yBAAqB,GAAG,i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