msubsup.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 __read = (this && this.__read) || function (o, n) {
  18. var m = typeof Symbol === "function" && o[Symbol.iterator];
  19. if (!m) return o;
  20. var i = m.call(o), r, ar = [], e;
  21. try {
  22. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  23. }
  24. catch (error) { e = { error: error }; }
  25. finally {
  26. try {
  27. if (r && !r.done && (m = i["return"])) m.call(i);
  28. }
  29. finally { if (e) throw e.error; }
  30. }
  31. return ar;
  32. };
  33. Object.defineProperty(exports, "__esModule", { value: true });
  34. exports.CHTMLmsubsup = exports.CHTMLmsup = exports.CHTMLmsub = void 0;
  35. var scriptbase_js_1 = require("./scriptbase.js");
  36. var msubsup_js_1 = require("../../common/Wrappers/msubsup.js");
  37. var msubsup_js_2 = require("../../common/Wrappers/msubsup.js");
  38. var msubsup_js_3 = require("../../common/Wrappers/msubsup.js");
  39. var msubsup_js_4 = require("../../../core/MmlTree/MmlNodes/msubsup.js");
  40. var CHTMLmsub = (function (_super) {
  41. __extends(CHTMLmsub, _super);
  42. function CHTMLmsub() {
  43. return _super !== null && _super.apply(this, arguments) || this;
  44. }
  45. CHTMLmsub.kind = msubsup_js_4.MmlMsub.prototype.kind;
  46. return CHTMLmsub;
  47. }((0, msubsup_js_1.CommonMsubMixin)(scriptbase_js_1.CHTMLscriptbase)));
  48. exports.CHTMLmsub = CHTMLmsub;
  49. var CHTMLmsup = (function (_super) {
  50. __extends(CHTMLmsup, _super);
  51. function CHTMLmsup() {
  52. return _super !== null && _super.apply(this, arguments) || this;
  53. }
  54. CHTMLmsup.kind = msubsup_js_4.MmlMsup.prototype.kind;
  55. return CHTMLmsup;
  56. }((0, msubsup_js_2.CommonMsupMixin)(scriptbase_js_1.CHTMLscriptbase)));
  57. exports.CHTMLmsup = CHTMLmsup;
  58. var CHTMLmsubsup = (function (_super) {
  59. __extends(CHTMLmsubsup, _super);
  60. function CHTMLmsubsup() {
  61. return _super !== null && _super.apply(this, arguments) || this;
  62. }
  63. CHTMLmsubsup.prototype.toCHTML = function (parent) {
  64. var adaptor = this.adaptor;
  65. var chtml = this.standardCHTMLnode(parent);
  66. var _a = __read([this.baseChild, this.supChild, this.subChild], 3), base = _a[0], sup = _a[1], sub = _a[2];
  67. var _b = __read(this.getUVQ(), 3), v = _b[1], q = _b[2];
  68. var style = { 'vertical-align': this.em(v) };
  69. base.toCHTML(chtml);
  70. var stack = adaptor.append(chtml, this.html('mjx-script', { style: style }));
  71. sup.toCHTML(stack);
  72. adaptor.append(stack, this.html('mjx-spacer', { style: { 'margin-top': this.em(q) } }));
  73. sub.toCHTML(stack);
  74. var ic = this.getAdjustedIc();
  75. if (ic) {
  76. adaptor.setStyle(sup.chtml, 'marginLeft', this.em(ic / sup.bbox.rscale));
  77. }
  78. if (this.baseRemoveIc) {
  79. adaptor.setStyle(stack, 'marginLeft', this.em(-this.baseIc));
  80. }
  81. };
  82. CHTMLmsubsup.kind = msubsup_js_4.MmlMsubsup.prototype.kind;
  83. CHTMLmsubsup.styles = {
  84. 'mjx-script': {
  85. display: 'inline-block',
  86. 'padding-right': '.05em',
  87. 'padding-left': '.033em'
  88. },
  89. 'mjx-script > mjx-spacer': {
  90. display: 'block'
  91. }
  92. };
  93. return CHTMLmsubsup;
  94. }((0, msubsup_js_3.CommonMsubsupMixin)(scriptbase_js_1.CHTMLscriptbase)));
  95. exports.CHTMLmsubsup = CHTMLmsubsup;
  96. //# sourceMappingURL=msubsup.js.map