MathDocument.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. var __values = (this && this.__values) || function(o) {
  18. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  19. if (m) return m.call(o);
  20. if (o && typeof o.length === "number") return {
  21. next: function () {
  22. if (o && i >= o.length) o = void 0;
  23. return { value: o && o[i++], done: !o };
  24. }
  25. };
  26. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  27. };
  28. var __read = (this && this.__read) || function (o, n) {
  29. var m = typeof Symbol === "function" && o[Symbol.iterator];
  30. if (!m) return o;
  31. var i = m.call(o), r, ar = [], e;
  32. try {
  33. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  34. }
  35. catch (error) { e = { error: error }; }
  36. finally {
  37. try {
  38. if (r && !r.done && (m = i["return"])) m.call(i);
  39. }
  40. finally { if (e) throw e.error; }
  41. }
  42. return ar;
  43. };
  44. var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
  45. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  46. if (ar || !(i in from)) {
  47. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  48. ar[i] = from[i];
  49. }
  50. }
  51. return to.concat(ar || Array.prototype.slice.call(from));
  52. };
  53. Object.defineProperty(exports, "__esModule", { value: true });
  54. exports.AbstractMathDocument = exports.resetAllOptions = exports.resetOptions = exports.RenderList = void 0;
  55. var Options_js_1 = require("../util/Options.js");
  56. var InputJax_js_1 = require("./InputJax.js");
  57. var OutputJax_js_1 = require("./OutputJax.js");
  58. var MathList_js_1 = require("./MathList.js");
  59. var MathItem_js_1 = require("./MathItem.js");
  60. var MmlFactory_js_1 = require("../core/MmlTree/MmlFactory.js");
  61. var BitField_js_1 = require("../util/BitField.js");
  62. var PrioritizedList_js_1 = require("../util/PrioritizedList.js");
  63. var RenderList = (function (_super) {
  64. __extends(RenderList, _super);
  65. function RenderList() {
  66. return _super !== null && _super.apply(this, arguments) || this;
  67. }
  68. RenderList.create = function (actions) {
  69. var e_1, _a;
  70. var list = new this();
  71. try {
  72. for (var _b = __values(Object.keys(actions)), _c = _b.next(); !_c.done; _c = _b.next()) {
  73. var id = _c.value;
  74. var _d = __read(this.action(id, actions[id]), 2), action = _d[0], priority = _d[1];
  75. if (priority) {
  76. list.add(action, priority);
  77. }
  78. }
  79. }
  80. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  81. finally {
  82. try {
  83. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  84. }
  85. finally { if (e_1) throw e_1.error; }
  86. }
  87. return list;
  88. };
  89. RenderList.action = function (id, action) {
  90. var _a, _b, _c, _d;
  91. var renderDoc, renderMath;
  92. var convert = true;
  93. var priority = action[0];
  94. if (action.length === 1 || typeof action[1] === 'boolean') {
  95. action.length === 2 && (convert = action[1]);
  96. _a = __read(this.methodActions(id), 2), renderDoc = _a[0], renderMath = _a[1];
  97. }
  98. else if (typeof action[1] === 'string') {
  99. if (typeof action[2] === 'string') {
  100. action.length === 4 && (convert = action[3]);
  101. var _e = __read(action.slice(1), 2), method1 = _e[0], method2 = _e[1];
  102. _b = __read(this.methodActions(method1, method2), 2), renderDoc = _b[0], renderMath = _b[1];
  103. }
  104. else {
  105. action.length === 3 && (convert = action[2]);
  106. _c = __read(this.methodActions(action[1]), 2), renderDoc = _c[0], renderMath = _c[1];
  107. }
  108. }
  109. else {
  110. action.length === 4 && (convert = action[3]);
  111. _d = __read(action.slice(1), 2), renderDoc = _d[0], renderMath = _d[1];
  112. }
  113. return [{ id: id, renderDoc: renderDoc, renderMath: renderMath, convert: convert }, priority];
  114. };
  115. RenderList.methodActions = function (method1, method2) {
  116. if (method2 === void 0) { method2 = method1; }
  117. return [
  118. function (document) { method1 && document[method1](); return false; },
  119. function (math, document) { method2 && math[method2](document); return false; }
  120. ];
  121. };
  122. RenderList.prototype.renderDoc = function (document, start) {
  123. var e_2, _a;
  124. if (start === void 0) { start = MathItem_js_1.STATE.UNPROCESSED; }
  125. try {
  126. for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
  127. var item = _c.value;
  128. if (item.priority >= start) {
  129. if (item.item.renderDoc(document))
  130. return;
  131. }
  132. }
  133. }
  134. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  135. finally {
  136. try {
  137. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  138. }
  139. finally { if (e_2) throw e_2.error; }
  140. }
  141. };
  142. RenderList.prototype.renderMath = function (math, document, start) {
  143. var e_3, _a;
  144. if (start === void 0) { start = MathItem_js_1.STATE.UNPROCESSED; }
  145. try {
  146. for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
  147. var item = _c.value;
  148. if (item.priority >= start) {
  149. if (item.item.renderMath(math, document))
  150. return;
  151. }
  152. }
  153. }
  154. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  155. finally {
  156. try {
  157. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  158. }
  159. finally { if (e_3) throw e_3.error; }
  160. }
  161. };
  162. RenderList.prototype.renderConvert = function (math, document, end) {
  163. var e_4, _a;
  164. if (end === void 0) { end = MathItem_js_1.STATE.LAST; }
  165. try {
  166. for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
  167. var item = _c.value;
  168. if (item.priority > end)
  169. return;
  170. if (item.item.convert) {
  171. if (item.item.renderMath(math, document))
  172. return;
  173. }
  174. }
  175. }
  176. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  177. finally {
  178. try {
  179. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  180. }
  181. finally { if (e_4) throw e_4.error; }
  182. }
  183. };
  184. RenderList.prototype.findID = function (id) {
  185. var e_5, _a;
  186. try {
  187. for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
  188. var item = _c.value;
  189. if (item.item.id === id) {
  190. return item.item;
  191. }
  192. }
  193. }
  194. catch (e_5_1) { e_5 = { error: e_5_1 }; }
  195. finally {
  196. try {
  197. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  198. }
  199. finally { if (e_5) throw e_5.error; }
  200. }
  201. return null;
  202. };
  203. return RenderList;
  204. }(PrioritizedList_js_1.PrioritizedList));
  205. exports.RenderList = RenderList;
  206. exports.resetOptions = {
  207. all: false,
  208. processed: false,
  209. inputJax: null,
  210. outputJax: null
  211. };
  212. exports.resetAllOptions = {
  213. all: true,
  214. processed: true,
  215. inputJax: [],
  216. outputJax: []
  217. };
  218. var DefaultInputJax = (function (_super) {
  219. __extends(DefaultInputJax, _super);
  220. function DefaultInputJax() {
  221. return _super !== null && _super.apply(this, arguments) || this;
  222. }
  223. DefaultInputJax.prototype.compile = function (_math) {
  224. return null;
  225. };
  226. return DefaultInputJax;
  227. }(InputJax_js_1.AbstractInputJax));
  228. var DefaultOutputJax = (function (_super) {
  229. __extends(DefaultOutputJax, _super);
  230. function DefaultOutputJax() {
  231. return _super !== null && _super.apply(this, arguments) || this;
  232. }
  233. DefaultOutputJax.prototype.typeset = function (_math, _document) {
  234. if (_document === void 0) { _document = null; }
  235. return null;
  236. };
  237. DefaultOutputJax.prototype.escaped = function (_math, _document) {
  238. return null;
  239. };
  240. return DefaultOutputJax;
  241. }(OutputJax_js_1.AbstractOutputJax));
  242. var DefaultMathList = (function (_super) {
  243. __extends(DefaultMathList, _super);
  244. function DefaultMathList() {
  245. return _super !== null && _super.apply(this, arguments) || this;
  246. }
  247. return DefaultMathList;
  248. }(MathList_js_1.AbstractMathList));
  249. var DefaultMathItem = (function (_super) {
  250. __extends(DefaultMathItem, _super);
  251. function DefaultMathItem() {
  252. return _super !== null && _super.apply(this, arguments) || this;
  253. }
  254. return DefaultMathItem;
  255. }(MathItem_js_1.AbstractMathItem));
  256. var AbstractMathDocument = (function () {
  257. function AbstractMathDocument(document, adaptor, options) {
  258. var _this = this;
  259. var CLASS = this.constructor;
  260. this.document = document;
  261. this.options = (0, Options_js_1.userOptions)((0, Options_js_1.defaultOptions)({}, CLASS.OPTIONS), options);
  262. this.math = new (this.options['MathList'] || DefaultMathList)();
  263. this.renderActions = RenderList.create(this.options['renderActions']);
  264. this.processed = new AbstractMathDocument.ProcessBits();
  265. this.outputJax = this.options['OutputJax'] || new DefaultOutputJax();
  266. var inputJax = this.options['InputJax'] || [new DefaultInputJax()];
  267. if (!Array.isArray(inputJax)) {
  268. inputJax = [inputJax];
  269. }
  270. this.inputJax = inputJax;
  271. this.adaptor = adaptor;
  272. this.outputJax.setAdaptor(adaptor);
  273. this.inputJax.map(function (jax) { return jax.setAdaptor(adaptor); });
  274. this.mmlFactory = this.options['MmlFactory'] || new MmlFactory_js_1.MmlFactory();
  275. this.inputJax.map(function (jax) { return jax.setMmlFactory(_this.mmlFactory); });
  276. this.outputJax.initialize();
  277. this.inputJax.map(function (jax) { return jax.initialize(); });
  278. }
  279. Object.defineProperty(AbstractMathDocument.prototype, "kind", {
  280. get: function () {
  281. return this.constructor.KIND;
  282. },
  283. enumerable: false,
  284. configurable: true
  285. });
  286. AbstractMathDocument.prototype.addRenderAction = function (id) {
  287. var action = [];
  288. for (var _i = 1; _i < arguments.length; _i++) {
  289. action[_i - 1] = arguments[_i];
  290. }
  291. var _a = __read(RenderList.action(id, action), 2), fn = _a[0], p = _a[1];
  292. this.renderActions.add(fn, p);
  293. };
  294. AbstractMathDocument.prototype.removeRenderAction = function (id) {
  295. var action = this.renderActions.findID(id);
  296. if (action) {
  297. this.renderActions.remove(action);
  298. }
  299. };
  300. AbstractMathDocument.prototype.render = function () {
  301. this.renderActions.renderDoc(this);
  302. return this;
  303. };
  304. AbstractMathDocument.prototype.rerender = function (start) {
  305. if (start === void 0) { start = MathItem_js_1.STATE.RERENDER; }
  306. this.state(start - 1);
  307. this.render();
  308. return this;
  309. };
  310. AbstractMathDocument.prototype.convert = function (math, options) {
  311. if (options === void 0) { options = {}; }
  312. var _a = (0, Options_js_1.userOptions)({
  313. format: this.inputJax[0].name, display: true, end: MathItem_js_1.STATE.LAST,
  314. em: 16, ex: 8, containerWidth: null, lineWidth: 1000000, scale: 1, family: ''
  315. }, options), format = _a.format, display = _a.display, end = _a.end, ex = _a.ex, em = _a.em, containerWidth = _a.containerWidth, lineWidth = _a.lineWidth, scale = _a.scale, family = _a.family;
  316. if (containerWidth === null) {
  317. containerWidth = 80 * ex;
  318. }
  319. var jax = this.inputJax.reduce(function (jax, ijax) { return (ijax.name === format ? ijax : jax); }, null);
  320. var mitem = new this.options.MathItem(math, jax, display);
  321. mitem.start.node = this.adaptor.body(this.document);
  322. mitem.setMetrics(em, ex, containerWidth, lineWidth, scale);
  323. if (this.outputJax.options.mtextInheritFont) {
  324. mitem.outputData.mtextFamily = family;
  325. }
  326. if (this.outputJax.options.merrorInheritFont) {
  327. mitem.outputData.merrorFamily = family;
  328. }
  329. mitem.convert(this, end);
  330. return (mitem.typesetRoot || mitem.root);
  331. };
  332. AbstractMathDocument.prototype.findMath = function (_options) {
  333. if (_options === void 0) { _options = null; }
  334. this.processed.set('findMath');
  335. return this;
  336. };
  337. AbstractMathDocument.prototype.compile = function () {
  338. var e_6, _a, e_7, _b;
  339. if (!this.processed.isSet('compile')) {
  340. var recompile = [];
  341. try {
  342. for (var _c = __values(this.math), _d = _c.next(); !_d.done; _d = _c.next()) {
  343. var math = _d.value;
  344. this.compileMath(math);
  345. if (math.inputData.recompile !== undefined) {
  346. recompile.push(math);
  347. }
  348. }
  349. }
  350. catch (e_6_1) { e_6 = { error: e_6_1 }; }
  351. finally {
  352. try {
  353. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  354. }
  355. finally { if (e_6) throw e_6.error; }
  356. }
  357. try {
  358. for (var recompile_1 = __values(recompile), recompile_1_1 = recompile_1.next(); !recompile_1_1.done; recompile_1_1 = recompile_1.next()) {
  359. var math = recompile_1_1.value;
  360. var data = math.inputData.recompile;
  361. math.state(data.state);
  362. math.inputData.recompile = data;
  363. this.compileMath(math);
  364. }
  365. }
  366. catch (e_7_1) { e_7 = { error: e_7_1 }; }
  367. finally {
  368. try {
  369. if (recompile_1_1 && !recompile_1_1.done && (_b = recompile_1.return)) _b.call(recompile_1);
  370. }
  371. finally { if (e_7) throw e_7.error; }
  372. }
  373. this.processed.set('compile');
  374. }
  375. return this;
  376. };
  377. AbstractMathDocument.prototype.compileMath = function (math) {
  378. try {
  379. math.compile(this);
  380. }
  381. catch (err) {
  382. if (err.retry || err.restart) {
  383. throw err;
  384. }
  385. this.options['compileError'](this, math, err);
  386. math.inputData['error'] = err;
  387. }
  388. };
  389. AbstractMathDocument.prototype.compileError = function (math, err) {
  390. math.root = this.mmlFactory.create('math', null, [
  391. this.mmlFactory.create('merror', { 'data-mjx-error': err.message, title: err.message }, [
  392. this.mmlFactory.create('mtext', null, [
  393. this.mmlFactory.create('text').setText('Math input error')
  394. ])
  395. ])
  396. ]);
  397. if (math.display) {
  398. math.root.attributes.set('display', 'block');
  399. }
  400. math.inputData.error = err.message;
  401. };
  402. AbstractMathDocument.prototype.typeset = function () {
  403. var e_8, _a;
  404. if (!this.processed.isSet('typeset')) {
  405. try {
  406. for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
  407. var math = _c.value;
  408. try {
  409. math.typeset(this);
  410. }
  411. catch (err) {
  412. if (err.retry || err.restart) {
  413. throw err;
  414. }
  415. this.options['typesetError'](this, math, err);
  416. math.outputData['error'] = err;
  417. }
  418. }
  419. }
  420. catch (e_8_1) { e_8 = { error: e_8_1 }; }
  421. finally {
  422. try {
  423. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  424. }
  425. finally { if (e_8) throw e_8.error; }
  426. }
  427. this.processed.set('typeset');
  428. }
  429. return this;
  430. };
  431. AbstractMathDocument.prototype.typesetError = function (math, err) {
  432. math.typesetRoot = this.adaptor.node('mjx-container', {
  433. class: 'MathJax mjx-output-error',
  434. jax: this.outputJax.name,
  435. }, [
  436. this.adaptor.node('span', {
  437. 'data-mjx-error': err.message,
  438. title: err.message,
  439. style: {
  440. color: 'red',
  441. 'background-color': 'yellow',
  442. 'line-height': 'normal'
  443. }
  444. }, [
  445. this.adaptor.text('Math output error')
  446. ])
  447. ]);
  448. if (math.display) {
  449. this.adaptor.setAttributes(math.typesetRoot, {
  450. style: {
  451. display: 'block',
  452. margin: '1em 0',
  453. 'text-align': 'center'
  454. }
  455. });
  456. }
  457. math.outputData.error = err.message;
  458. };
  459. AbstractMathDocument.prototype.getMetrics = function () {
  460. if (!this.processed.isSet('getMetrics')) {
  461. this.outputJax.getMetrics(this);
  462. this.processed.set('getMetrics');
  463. }
  464. return this;
  465. };
  466. AbstractMathDocument.prototype.updateDocument = function () {
  467. var e_9, _a;
  468. if (!this.processed.isSet('updateDocument')) {
  469. try {
  470. for (var _b = __values(this.math.reversed()), _c = _b.next(); !_c.done; _c = _b.next()) {
  471. var math = _c.value;
  472. math.updateDocument(this);
  473. }
  474. }
  475. catch (e_9_1) { e_9 = { error: e_9_1 }; }
  476. finally {
  477. try {
  478. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  479. }
  480. finally { if (e_9) throw e_9.error; }
  481. }
  482. this.processed.set('updateDocument');
  483. }
  484. return this;
  485. };
  486. AbstractMathDocument.prototype.removeFromDocument = function (_restore) {
  487. if (_restore === void 0) { _restore = false; }
  488. return this;
  489. };
  490. AbstractMathDocument.prototype.state = function (state, restore) {
  491. var e_10, _a;
  492. if (restore === void 0) { restore = false; }
  493. try {
  494. for (var _b = __values(this.math), _c = _b.next(); !_c.done; _c = _b.next()) {
  495. var math = _c.value;
  496. math.state(state, restore);
  497. }
  498. }
  499. catch (e_10_1) { e_10 = { error: e_10_1 }; }
  500. finally {
  501. try {
  502. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  503. }
  504. finally { if (e_10) throw e_10.error; }
  505. }
  506. if (state < MathItem_js_1.STATE.INSERTED) {
  507. this.processed.clear('updateDocument');
  508. }
  509. if (state < MathItem_js_1.STATE.TYPESET) {
  510. this.processed.clear('typeset');
  511. this.processed.clear('getMetrics');
  512. }
  513. if (state < MathItem_js_1.STATE.COMPILED) {
  514. this.processed.clear('compile');
  515. }
  516. return this;
  517. };
  518. AbstractMathDocument.prototype.reset = function (options) {
  519. var _a;
  520. if (options === void 0) { options = { processed: true }; }
  521. options = (0, Options_js_1.userOptions)(Object.assign({}, exports.resetOptions), options);
  522. options.all && Object.assign(options, exports.resetAllOptions);
  523. options.processed && this.processed.reset();
  524. options.inputJax && this.inputJax.forEach(function (jax) { return jax.reset.apply(jax, __spreadArray([], __read(options.inputJax), false)); });
  525. options.outputJax && (_a = this.outputJax).reset.apply(_a, __spreadArray([], __read(options.outputJax), false));
  526. return this;
  527. };
  528. AbstractMathDocument.prototype.clear = function () {
  529. this.reset();
  530. this.math.clear();
  531. return this;
  532. };
  533. AbstractMathDocument.prototype.concat = function (list) {
  534. this.math.merge(list);
  535. return this;
  536. };
  537. AbstractMathDocument.prototype.clearMathItemsWithin = function (containers) {
  538. var _a;
  539. var items = this.getMathItemsWithin(containers);
  540. (_a = this.math).remove.apply(_a, __spreadArray([], __read(items), false));
  541. return items;
  542. };
  543. AbstractMathDocument.prototype.getMathItemsWithin = function (elements) {
  544. var e_11, _a, e_12, _b;
  545. if (!Array.isArray(elements)) {
  546. elements = [elements];
  547. }
  548. var adaptor = this.adaptor;
  549. var items = [];
  550. var containers = adaptor.getElements(elements, this.document);
  551. try {
  552. ITEMS: for (var _c = __values(this.math), _d = _c.next(); !_d.done; _d = _c.next()) {
  553. var item = _d.value;
  554. try {
  555. for (var containers_1 = (e_12 = void 0, __values(containers)), containers_1_1 = containers_1.next(); !containers_1_1.done; containers_1_1 = containers_1.next()) {
  556. var container = containers_1_1.value;
  557. if (item.start.node && adaptor.contains(container, item.start.node)) {
  558. items.push(item);
  559. continue ITEMS;
  560. }
  561. }
  562. }
  563. catch (e_12_1) { e_12 = { error: e_12_1 }; }
  564. finally {
  565. try {
  566. if (containers_1_1 && !containers_1_1.done && (_b = containers_1.return)) _b.call(containers_1);
  567. }
  568. finally { if (e_12) throw e_12.error; }
  569. }
  570. }
  571. }
  572. catch (e_11_1) { e_11 = { error: e_11_1 }; }
  573. finally {
  574. try {
  575. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  576. }
  577. finally { if (e_11) throw e_11.error; }
  578. }
  579. return items;
  580. };
  581. AbstractMathDocument.KIND = 'MathDocument';
  582. AbstractMathDocument.OPTIONS = {
  583. OutputJax: null,
  584. InputJax: null,
  585. MmlFactory: null,
  586. MathList: DefaultMathList,
  587. MathItem: DefaultMathItem,
  588. compileError: function (doc, math, err) {
  589. doc.compileError(math, err);
  590. },
  591. typesetError: function (doc, math, err) {
  592. doc.typesetError(math, err);
  593. },
  594. renderActions: (0, Options_js_1.expandable)({
  595. find: [MathItem_js_1.STATE.FINDMATH, 'findMath', '', false],
  596. compile: [MathItem_js_1.STATE.COMPILED],
  597. metrics: [MathItem_js_1.STATE.METRICS, 'getMetrics', '', false],
  598. typeset: [MathItem_js_1.STATE.TYPESET],
  599. update: [MathItem_js_1.STATE.INSERTED, 'updateDocument', false]
  600. })
  601. };
  602. AbstractMathDocument.ProcessBits = (0, BitField_js_1.BitFieldClass)('findMath', 'compile', 'getMetrics', 'typeset', 'updateDocument');
  603. return AbstractMathDocument;
  604. }());
  605. exports.AbstractMathDocument = AbstractMathDocument;
  606. //# sourceMappingURL=MathDocument.js.map