@pie-element/math-templated 2.22.3-next.4 → 2.22.3-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "1.30.2",
11
+ "@pie-lib/pie-toolbox": "1.31.0",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "prop-types": "^15.6.2",
@@ -7,7 +7,7 @@
7
7
  "module": "src/index.js",
8
8
  "dependencies": {
9
9
  "@pie-framework/math-validation": "^1.2.2",
10
- "@pie-lib/pie-toolbox": "1.30.2",
10
+ "@pie-lib/pie-toolbox": "1.31.0",
11
11
  "debug": "^3.1.0",
12
12
  "lodash": "^4.17.15"
13
13
  },
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -43053,34 +43053,49 @@ var mathjaxScript = {};
43053
43053
  Object.defineProperty(mathjaxScript, "__esModule", {
43054
43054
  value: true
43055
43055
  });
43056
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
43056
+ mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
43057
43057
  var _renderMath = renderMath$1;
43058
43058
  var MathJaxVersion = '3.2.2';
43059
43059
  mathjaxScript.MathJaxVersion = MathJaxVersion;
43060
- var initializeMathJax = function initializeMathJax(renderOpts) {
43061
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
43062
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
43063
- }
43064
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
43065
- macros: {
43066
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
43067
- overarc: '\\overparen',
43068
- napprox: '\\not\\approx',
43069
- longdiv: '\\enclose{longdiv}'
43070
- },
43071
- inlineMath: [['$', '$'], ['\\(', '\\)']],
43072
- processEscapes: true,
43073
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
43074
- } : {
43075
- macros: {
43076
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
43077
- overarc: '\\overparen',
43078
- napprox: '\\not\\approx',
43079
- longdiv: '\\enclose{longdiv}'
43080
- },
43081
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
43082
- };
43083
- window.mathjaxLoadedP = new Promise(function (resolve) {
43060
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
43061
+ mathjaxScript.mathRenderingKEY = mathRenderingKEY;
43062
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
43063
+ mathjaxScript.mathRenderingAccessibleKEY = mathRenderingAccessibleKEY;
43064
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
43065
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
43066
+ return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
43067
+ };
43068
+ var mathJaxCustomKey = getMathJaxCustomKey();
43069
+ var defaultOpts = function defaultOpts() {
43070
+ return (0, _renderMath.getGlobal)().opts || ({});
43071
+ };
43072
+ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFullPage) {
43073
+ window.MathJaxInitialised = true;
43074
+ renderOpts = renderOpts || defaultOpts();
43075
+ if ((!window.MathJax || window.MathJax.version !== MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
43076
+ var _renderOpts, _renderOpts2;
43077
+ if ((_renderOpts = renderOpts) !== null && _renderOpts !== void 0 && _renderOpts.useSingleDollar) {
43078
+ console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
43079
+ }
43080
+ var texConfig = (_renderOpts2 = renderOpts) !== null && _renderOpts2 !== void 0 && _renderOpts2.useSingleDollar ? {
43081
+ macros: {
43082
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
43083
+ overarc: '\\overparen',
43084
+ napprox: '\\not\\approx',
43085
+ longdiv: '\\enclose{longdiv}'
43086
+ },
43087
+ inlineMath: [['$', '$'], ['\\(', '\\)']],
43088
+ processEscapes: true,
43089
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
43090
+ } : {
43091
+ macros: {
43092
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
43093
+ overarc: '\\overparen',
43094
+ napprox: '\\not\\approx',
43095
+ longdiv: '\\enclose{longdiv}'
43096
+ },
43097
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
43098
+ };
43084
43099
  window.MathJax = {
43085
43100
  startup: {
43086
43101
  typeset: false,
@@ -43099,7 +43114,10 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
43099
43114
  MathJax.startup.defaultReady();
43100
43115
  var globalObj = (0, _renderMath.getGlobal)();
43101
43116
  globalObj.instance = MathJax;
43102
- resolve();
43117
+ if (processMathJaxFullPage) {
43118
+ processMathJaxFullPage();
43119
+ }
43120
+ window.MathJaxLoaded = true;
43103
43121
  }
43104
43122
  },
43105
43123
  loader: {
@@ -43130,7 +43148,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
43130
43148
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
43131
43149
  script.async = true;
43132
43150
  document.body.appendChild(script);
43133
- });
43151
+ }
43134
43152
  };
43135
43153
  mathjaxScript.initializeMathJax = initializeMathJax;
43136
43154
  var normalization$1 = {};
@@ -102668,7 +102686,7 @@ getDefaultExportFromCjs(mathRendering);
102668
102686
  Object.defineProperty(exports, "__esModule", {
102669
102687
  value: true
102670
102688
  });
102671
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
102689
+ exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
102672
102690
  var _typeof2 = _interopRequireDefault(_typeof$3.exports);
102673
102691
  var _mathjaxScript = mathjaxScript;
102674
102692
  var _normalization = normalization$1;
@@ -102719,22 +102737,17 @@ getDefaultExportFromCjs(mathRendering);
102719
102737
  };
102720
102738
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
102721
102739
  var NEWLINE_LATEX = '\\newline ';
102722
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
102723
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
102724
102740
  var getGlobal = function getGlobal() {
102725
102741
  if (typeof window !== 'undefined') {
102726
- if (!window[mathRenderingAccessibleKEY]) {
102727
- window[mathRenderingAccessibleKEY] = {};
102742
+ if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
102743
+ window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
102728
102744
  }
102729
- return window[mathRenderingAccessibleKEY];
102745
+ return window[_mathjaxScript.mathRenderingAccessibleKEY];
102730
102746
  } else {
102731
102747
  return {};
102732
102748
  }
102733
102749
  };
102734
102750
  exports.getGlobal = getGlobal;
102735
- var defaultOpts = function defaultOpts() {
102736
- return getGlobal().opts || ({});
102737
- };
102738
102751
  var fixMathElement = function fixMathElement(element) {
102739
102752
  if (element.dataset.mathHandled) {
102740
102753
  return;
@@ -102799,80 +102812,84 @@ getDefaultExportFromCjs(mathRendering);
102799
102812
  }
102800
102813
  });
102801
102814
  };
102802
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
102803
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
102804
- return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
102815
+ var processMathJaxFullPage = function processMathJaxFullPage(executeOn) {
102816
+ executeOn = executeOn || document.body;
102817
+ var mathJaxInstance = getGlobal().instance;
102818
+ if (mathJaxInstance) {
102819
+ mathJaxInstance.texReset();
102820
+ mathJaxInstance.typesetClear();
102821
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
102822
+ try {
102823
+ removeExcessMjxContainers(executeOn);
102824
+ removePlaceholdersAndRestoreDisplay();
102825
+ var updatedDocument = mathJaxInstance.startup.document;
102826
+ var list = updatedDocument.math.list;
102827
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
102828
+ var mathMl = toMMl(item.data.root);
102829
+ var parsedMathMl = mathMl.replaceAll('\n', '');
102830
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
102831
+ }
102832
+ } catch (e) {
102833
+ console.error('Error post-processing MathJax typesetting:', e.toString());
102834
+ }
102835
+ mathJaxInstance.startup.document.clear();
102836
+ })["catch"](function (error) {
102837
+ console.error('Error in typesetting with MathJax:', error);
102838
+ });
102839
+ }
102840
+ };
102841
+ var initializeMathJaxScript = function initializeMathJaxScript(renderOpts) {
102842
+ if (!window.MathJaxInitialised) {
102843
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, processMathJaxFullPage);
102844
+ }
102805
102845
  };
102846
+ exports.initializeMathJaxScript = initializeMathJaxScript;
102806
102847
  var renderMath = function renderMath(el, renderOpts) {
102807
102848
  var isString = typeof el === 'string';
102849
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
102808
102850
  var executeOn = document.body;
102809
102851
  if (isString) {
102810
102852
  var div = document.createElement('div');
102811
102853
  div.innerHTML = el;
102812
102854
  executeOn = div;
102813
102855
  }
102814
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
102815
102856
  var renderMathAccessible = function renderMathAccessible() {
102816
102857
  fixMathElements(executeOn);
102817
102858
  adjustMathMLStyle(executeOn);
102818
- var mathJaxCustomKey = getMathJaxCustomKey();
102819
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
102820
- renderOpts = renderOpts || defaultOpts();
102821
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
102822
- }
102823
- if (isString && window.MathJax && window.mathjaxLoadedP) {
102824
- try {
102825
- MathJax.texReset();
102826
- MathJax.typesetClear();
102827
- window.MathJax.typeset([executeOn]);
102828
- var updatedDocument = window.MathJax.startup.document;
102829
- var list = updatedDocument.math.list;
102830
- var item = list.next;
102831
- var mathMl = toMMl(item.data.root);
102832
- var parsedMathMl = mathMl.replaceAll('\n', '');
102833
- return parsedMathMl;
102834
- } catch (error) {
102835
- console.error('Error rendering math:', error.message);
102836
- }
102859
+ if (!window.MathJaxInitialised) {
102860
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
102861
+ return processMathJaxFullPage(executeOn);
102862
+ });
102863
+ return;
102837
102864
  }
102838
- if (window.mathjaxLoadedP) {
102839
- window.mathjaxLoadedP.then(function () {
102840
- var mathJaxInstance = getGlobal().instance;
102841
- if (mathJaxInstance) {
102842
- mathJaxInstance.texReset();
102843
- mathJaxInstance.typesetClear();
102844
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
102845
- try {
102846
- removeExcessMjxContainers(executeOn);
102847
- removePlaceholdersAndRestoreDisplay();
102848
- var _updatedDocument = mathJaxInstance.startup.document;
102849
- var _list = _updatedDocument.math.list;
102850
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
102851
- var _mathMl = toMMl(_item.data.root);
102852
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
102853
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
102854
- }
102855
- } catch (e) {
102856
- console.error('Error post-processing MathJax typesetting:', e.toString());
102857
- }
102858
- mathJaxInstance.startup.document.clear();
102859
- })["catch"](function (error) {
102860
- console.error('Error in typesetting with MathJax:', error);
102861
- });
102865
+ if (window.MathJaxLoaded) {
102866
+ if (isString) {
102867
+ try {
102868
+ MathJax.texReset();
102869
+ MathJax.typesetClear();
102870
+ window.MathJax.typeset([executeOn]);
102871
+ var updatedDocument = window.MathJax.startup.document;
102872
+ var list = updatedDocument.math.list;
102873
+ var item = list.next;
102874
+ var mathMl = toMMl(item.data.root);
102875
+ var parsedMathMl = mathMl.replaceAll('\n', '');
102876
+ return parsedMathMl;
102877
+ } catch (error) {
102878
+ console.error('Error rendering math:', error.message);
102879
+ return '';
102862
102880
  }
102863
- })["catch"](function (error) {
102864
- console.error('Error in initializing MathJax:', error);
102865
- });
102881
+ }
102882
+ processMathJaxFullPage(executeOn);
102866
102883
  }
102867
102884
  };
102868
102885
  if (skipWaitForMathRenderingLib) {
102869
102886
  return renderMathAccessible();
102870
102887
  } else {
102871
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
102888
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
102872
102889
  removePlaceholdersAndRestoreDisplay();
102873
102890
  return mr.renderMath(executeOn, renderOpts);
102874
102891
  }
102875
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
102892
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
102876
102893
  return renderMathAccessible();
102877
102894
  }
102878
102895
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -102882,7 +102899,7 @@ getDefaultExportFromCjs(mathRendering);
102882
102899
  var maxWaitTime = 500;
102883
102900
  var startTime = Date.now();
102884
102901
  var checkForLib = function checkForLib() {
102885
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
102902
+ var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
102886
102903
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
102887
102904
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
102888
102905
  clearInterval(checkIntervalId);
@@ -102917,9 +102934,16 @@ var mmlToLatex = {};
102917
102934
  getDefaultExportFromCjs(mmlToLatex);
102918
102935
  (function (exports) {
102919
102936
  var _interopRequireDefault = interopRequireDefault.exports;
102937
+ var _typeof = _typeof$3.exports;
102920
102938
  Object.defineProperty(exports, "__esModule", {
102921
102939
  value: true
102922
102940
  });
102941
+ Object.defineProperty(exports, "initializeMathJaxScript", {
102942
+ enumerable: true,
102943
+ get: function get() {
102944
+ return _renderMath.initializeMathJaxScript;
102945
+ }
102946
+ });
102923
102947
  Object.defineProperty(exports, "mmlToLatex", {
102924
102948
  enumerable: true,
102925
102949
  get: function get() {
@@ -102944,9 +102968,48 @@ getDefaultExportFromCjs(mmlToLatex);
102944
102968
  return _normalization.wrapMath;
102945
102969
  }
102946
102970
  });
102947
- var _renderMath = _interopRequireDefault(renderMath$1);
102971
+ var _renderMath = _interopRequireWildcard(renderMath$1);
102948
102972
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
102949
102973
  var _normalization = normalization$1;
102974
+ function _getRequireWildcardCache(nodeInterop) {
102975
+ if (typeof WeakMap !== "function") return null;
102976
+ var cacheBabelInterop = new WeakMap();
102977
+ var cacheNodeInterop = new WeakMap();
102978
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
102979
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
102980
+ })(nodeInterop);
102981
+ }
102982
+ function _interopRequireWildcard(obj, nodeInterop) {
102983
+ if (!nodeInterop && obj && obj.__esModule) {
102984
+ return obj;
102985
+ }
102986
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
102987
+ return {
102988
+ "default": obj
102989
+ };
102990
+ }
102991
+ var cache = _getRequireWildcardCache(nodeInterop);
102992
+ if (cache && cache.has(obj)) {
102993
+ return cache.get(obj);
102994
+ }
102995
+ var newObj = {};
102996
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
102997
+ for (var key in obj) {
102998
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
102999
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
103000
+ if (desc && (desc.get || desc.set)) {
103001
+ Object.defineProperty(newObj, key, desc);
103002
+ } else {
103003
+ newObj[key] = obj[key];
103004
+ }
103005
+ }
103006
+ }
103007
+ newObj["default"] = obj;
103008
+ if (cache) {
103009
+ cache.set(obj, newObj);
103010
+ }
103011
+ return newObj;
103012
+ }
102950
103013
  })(mathRenderingAccessible);
102951
103014
  getDefaultExportFromCjs(mathRenderingAccessible);
102952
103015
  const require$$8$3 = _dll_react;
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -21848,34 +21848,49 @@ var mathjaxScript = {};
21848
21848
  Object.defineProperty(mathjaxScript, "__esModule", {
21849
21849
  value: true
21850
21850
  });
21851
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21851
+ mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21852
21852
  var _renderMath = renderMath$2;
21853
21853
  var MathJaxVersion = '3.2.2';
21854
21854
  mathjaxScript.MathJaxVersion = MathJaxVersion;
21855
- var initializeMathJax = function initializeMathJax(renderOpts) {
21856
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
21857
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
21858
- }
21859
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
21860
- macros: {
21861
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21862
- overarc: '\\overparen',
21863
- napprox: '\\not\\approx',
21864
- longdiv: '\\enclose{longdiv}'
21865
- },
21866
- inlineMath: [['$', '$'], ['\\(', '\\)']],
21867
- processEscapes: true,
21868
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
21869
- } : {
21870
- macros: {
21871
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21872
- overarc: '\\overparen',
21873
- napprox: '\\not\\approx',
21874
- longdiv: '\\enclose{longdiv}'
21875
- },
21876
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
21877
- };
21878
- window.mathjaxLoadedP = new Promise(function (resolve) {
21855
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
21856
+ mathjaxScript.mathRenderingKEY = mathRenderingKEY;
21857
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
21858
+ mathjaxScript.mathRenderingAccessibleKEY = mathRenderingAccessibleKEY;
21859
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
21860
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
21861
+ return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
21862
+ };
21863
+ var mathJaxCustomKey = getMathJaxCustomKey();
21864
+ var defaultOpts = function defaultOpts() {
21865
+ return (0, _renderMath.getGlobal)().opts || ({});
21866
+ };
21867
+ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFullPage) {
21868
+ window.MathJaxInitialised = true;
21869
+ renderOpts = renderOpts || defaultOpts();
21870
+ if ((!window.MathJax || window.MathJax.version !== MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
21871
+ var _renderOpts, _renderOpts2;
21872
+ if ((_renderOpts = renderOpts) !== null && _renderOpts !== void 0 && _renderOpts.useSingleDollar) {
21873
+ console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
21874
+ }
21875
+ var texConfig = (_renderOpts2 = renderOpts) !== null && _renderOpts2 !== void 0 && _renderOpts2.useSingleDollar ? {
21876
+ macros: {
21877
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21878
+ overarc: '\\overparen',
21879
+ napprox: '\\not\\approx',
21880
+ longdiv: '\\enclose{longdiv}'
21881
+ },
21882
+ inlineMath: [['$', '$'], ['\\(', '\\)']],
21883
+ processEscapes: true,
21884
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
21885
+ } : {
21886
+ macros: {
21887
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21888
+ overarc: '\\overparen',
21889
+ napprox: '\\not\\approx',
21890
+ longdiv: '\\enclose{longdiv}'
21891
+ },
21892
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
21893
+ };
21879
21894
  window.MathJax = {
21880
21895
  startup: {
21881
21896
  typeset: false,
@@ -21894,7 +21909,10 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
21894
21909
  MathJax.startup.defaultReady();
21895
21910
  var globalObj = (0, _renderMath.getGlobal)();
21896
21911
  globalObj.instance = MathJax;
21897
- resolve();
21912
+ if (processMathJaxFullPage) {
21913
+ processMathJaxFullPage();
21914
+ }
21915
+ window.MathJaxLoaded = true;
21898
21916
  }
21899
21917
  },
21900
21918
  loader: {
@@ -21925,7 +21943,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
21925
21943
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
21926
21944
  script.async = true;
21927
21945
  document.body.appendChild(script);
21928
- });
21946
+ }
21929
21947
  };
21930
21948
  mathjaxScript.initializeMathJax = initializeMathJax;
21931
21949
  var normalization$1 = {};
@@ -81603,7 +81621,7 @@ getDefaultExportFromCjs(mathRendering);
81603
81621
  Object.defineProperty(exports, "__esModule", {
81604
81622
  value: true
81605
81623
  });
81606
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81624
+ exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81607
81625
  var _typeof2 = _interopRequireDefault(_typeof$b.exports);
81608
81626
  var _mathjaxScript = mathjaxScript;
81609
81627
  var _normalization = normalization$1;
@@ -81654,22 +81672,17 @@ getDefaultExportFromCjs(mathRendering);
81654
81672
  };
81655
81673
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
81656
81674
  var NEWLINE_LATEX = '\\newline ';
81657
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
81658
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
81659
81675
  var getGlobal = function getGlobal() {
81660
81676
  if (typeof window !== 'undefined') {
81661
- if (!window[mathRenderingAccessibleKEY]) {
81662
- window[mathRenderingAccessibleKEY] = {};
81677
+ if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
81678
+ window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
81663
81679
  }
81664
- return window[mathRenderingAccessibleKEY];
81680
+ return window[_mathjaxScript.mathRenderingAccessibleKEY];
81665
81681
  } else {
81666
81682
  return {};
81667
81683
  }
81668
81684
  };
81669
81685
  exports.getGlobal = getGlobal;
81670
- var defaultOpts = function defaultOpts() {
81671
- return getGlobal().opts || ({});
81672
- };
81673
81686
  var fixMathElement = function fixMathElement(element) {
81674
81687
  if (element.dataset.mathHandled) {
81675
81688
  return;
@@ -81734,80 +81747,84 @@ getDefaultExportFromCjs(mathRendering);
81734
81747
  }
81735
81748
  });
81736
81749
  };
81737
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
81738
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
81739
- return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
81750
+ var processMathJaxFullPage = function processMathJaxFullPage(executeOn) {
81751
+ executeOn = executeOn || document.body;
81752
+ var mathJaxInstance = getGlobal().instance;
81753
+ if (mathJaxInstance) {
81754
+ mathJaxInstance.texReset();
81755
+ mathJaxInstance.typesetClear();
81756
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
81757
+ try {
81758
+ removeExcessMjxContainers(executeOn);
81759
+ removePlaceholdersAndRestoreDisplay();
81760
+ var updatedDocument = mathJaxInstance.startup.document;
81761
+ var list = updatedDocument.math.list;
81762
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
81763
+ var mathMl = toMMl(item.data.root);
81764
+ var parsedMathMl = mathMl.replaceAll('\n', '');
81765
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
81766
+ }
81767
+ } catch (e) {
81768
+ console.error('Error post-processing MathJax typesetting:', e.toString());
81769
+ }
81770
+ mathJaxInstance.startup.document.clear();
81771
+ })["catch"](function (error) {
81772
+ console.error('Error in typesetting with MathJax:', error);
81773
+ });
81774
+ }
81775
+ };
81776
+ var initializeMathJaxScript = function initializeMathJaxScript(renderOpts) {
81777
+ if (!window.MathJaxInitialised) {
81778
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, processMathJaxFullPage);
81779
+ }
81740
81780
  };
81781
+ exports.initializeMathJaxScript = initializeMathJaxScript;
81741
81782
  var renderMath = function renderMath(el, renderOpts) {
81742
81783
  var isString = typeof el === 'string';
81784
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81743
81785
  var executeOn = document.body;
81744
81786
  if (isString) {
81745
81787
  var div = document.createElement('div');
81746
81788
  div.innerHTML = el;
81747
81789
  executeOn = div;
81748
81790
  }
81749
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81750
81791
  var renderMathAccessible = function renderMathAccessible() {
81751
81792
  fixMathElements(executeOn);
81752
81793
  adjustMathMLStyle(executeOn);
81753
- var mathJaxCustomKey = getMathJaxCustomKey();
81754
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
81755
- renderOpts = renderOpts || defaultOpts();
81756
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
81757
- }
81758
- if (isString && window.MathJax && window.mathjaxLoadedP) {
81759
- try {
81760
- MathJax.texReset();
81761
- MathJax.typesetClear();
81762
- window.MathJax.typeset([executeOn]);
81763
- var updatedDocument = window.MathJax.startup.document;
81764
- var list = updatedDocument.math.list;
81765
- var item = list.next;
81766
- var mathMl = toMMl(item.data.root);
81767
- var parsedMathMl = mathMl.replaceAll('\n', '');
81768
- return parsedMathMl;
81769
- } catch (error) {
81770
- console.error('Error rendering math:', error.message);
81771
- }
81794
+ if (!window.MathJaxInitialised) {
81795
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
81796
+ return processMathJaxFullPage(executeOn);
81797
+ });
81798
+ return;
81772
81799
  }
81773
- if (window.mathjaxLoadedP) {
81774
- window.mathjaxLoadedP.then(function () {
81775
- var mathJaxInstance = getGlobal().instance;
81776
- if (mathJaxInstance) {
81777
- mathJaxInstance.texReset();
81778
- mathJaxInstance.typesetClear();
81779
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
81780
- try {
81781
- removeExcessMjxContainers(executeOn);
81782
- removePlaceholdersAndRestoreDisplay();
81783
- var _updatedDocument = mathJaxInstance.startup.document;
81784
- var _list = _updatedDocument.math.list;
81785
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
81786
- var _mathMl = toMMl(_item.data.root);
81787
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
81788
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
81789
- }
81790
- } catch (e) {
81791
- console.error('Error post-processing MathJax typesetting:', e.toString());
81792
- }
81793
- mathJaxInstance.startup.document.clear();
81794
- })["catch"](function (error) {
81795
- console.error('Error in typesetting with MathJax:', error);
81796
- });
81800
+ if (window.MathJaxLoaded) {
81801
+ if (isString) {
81802
+ try {
81803
+ MathJax.texReset();
81804
+ MathJax.typesetClear();
81805
+ window.MathJax.typeset([executeOn]);
81806
+ var updatedDocument = window.MathJax.startup.document;
81807
+ var list = updatedDocument.math.list;
81808
+ var item = list.next;
81809
+ var mathMl = toMMl(item.data.root);
81810
+ var parsedMathMl = mathMl.replaceAll('\n', '');
81811
+ return parsedMathMl;
81812
+ } catch (error) {
81813
+ console.error('Error rendering math:', error.message);
81814
+ return '';
81797
81815
  }
81798
- })["catch"](function (error) {
81799
- console.error('Error in initializing MathJax:', error);
81800
- });
81816
+ }
81817
+ processMathJaxFullPage(executeOn);
81801
81818
  }
81802
81819
  };
81803
81820
  if (skipWaitForMathRenderingLib) {
81804
81821
  return renderMathAccessible();
81805
81822
  } else {
81806
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
81823
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
81807
81824
  removePlaceholdersAndRestoreDisplay();
81808
81825
  return mr.renderMath(executeOn, renderOpts);
81809
81826
  }
81810
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
81827
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
81811
81828
  return renderMathAccessible();
81812
81829
  }
81813
81830
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -81817,7 +81834,7 @@ getDefaultExportFromCjs(mathRendering);
81817
81834
  var maxWaitTime = 500;
81818
81835
  var startTime = Date.now();
81819
81836
  var checkForLib = function checkForLib() {
81820
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
81837
+ var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
81821
81838
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
81822
81839
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
81823
81840
  clearInterval(checkIntervalId);
@@ -81852,9 +81869,16 @@ var mmlToLatex = {};
81852
81869
  getDefaultExportFromCjs(mmlToLatex);
81853
81870
  (function (exports) {
81854
81871
  var _interopRequireDefault = interopRequireDefault.exports;
81872
+ var _typeof = _typeof$b.exports;
81855
81873
  Object.defineProperty(exports, "__esModule", {
81856
81874
  value: true
81857
81875
  });
81876
+ Object.defineProperty(exports, "initializeMathJaxScript", {
81877
+ enumerable: true,
81878
+ get: function get() {
81879
+ return _renderMath.initializeMathJaxScript;
81880
+ }
81881
+ });
81858
81882
  Object.defineProperty(exports, "mmlToLatex", {
81859
81883
  enumerable: true,
81860
81884
  get: function get() {
@@ -81879,9 +81903,48 @@ getDefaultExportFromCjs(mmlToLatex);
81879
81903
  return _normalization.wrapMath;
81880
81904
  }
81881
81905
  });
81882
- var _renderMath = _interopRequireDefault(renderMath$2);
81906
+ var _renderMath = _interopRequireWildcard(renderMath$2);
81883
81907
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
81884
81908
  var _normalization = normalization$1;
81909
+ function _getRequireWildcardCache(nodeInterop) {
81910
+ if (typeof WeakMap !== "function") return null;
81911
+ var cacheBabelInterop = new WeakMap();
81912
+ var cacheNodeInterop = new WeakMap();
81913
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
81914
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
81915
+ })(nodeInterop);
81916
+ }
81917
+ function _interopRequireWildcard(obj, nodeInterop) {
81918
+ if (!nodeInterop && obj && obj.__esModule) {
81919
+ return obj;
81920
+ }
81921
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
81922
+ return {
81923
+ "default": obj
81924
+ };
81925
+ }
81926
+ var cache = _getRequireWildcardCache(nodeInterop);
81927
+ if (cache && cache.has(obj)) {
81928
+ return cache.get(obj);
81929
+ }
81930
+ var newObj = {};
81931
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
81932
+ for (var key in obj) {
81933
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
81934
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
81935
+ if (desc && (desc.get || desc.set)) {
81936
+ Object.defineProperty(newObj, key, desc);
81937
+ } else {
81938
+ newObj[key] = obj[key];
81939
+ }
81940
+ }
81941
+ }
81942
+ newObj["default"] = obj;
81943
+ if (cache) {
81944
+ cache.set(obj, newObj);
81945
+ }
81946
+ return newObj;
81947
+ }
81885
81948
  })(mathRenderingAccessible);
81886
81949
  getDefaultExportFromCjs(mathRenderingAccessible);
81887
81950
  var choices = {};
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.23.1"
7
+ "version": "1.23.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
@@ -21811,34 +21811,49 @@ var mathjaxScript = {};
21811
21811
  Object.defineProperty(mathjaxScript, "__esModule", {
21812
21812
  value: true
21813
21813
  });
21814
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21814
+ mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21815
21815
  var _renderMath = renderMath$3;
21816
21816
  var MathJaxVersion = '3.2.2';
21817
21817
  mathjaxScript.MathJaxVersion = MathJaxVersion;
21818
- var initializeMathJax = function initializeMathJax(renderOpts) {
21819
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
21820
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
21821
- }
21822
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
21823
- macros: {
21824
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21825
- overarc: '\\overparen',
21826
- napprox: '\\not\\approx',
21827
- longdiv: '\\enclose{longdiv}'
21828
- },
21829
- inlineMath: [['$', '$'], ['\\(', '\\)']],
21830
- processEscapes: true,
21831
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
21832
- } : {
21833
- macros: {
21834
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21835
- overarc: '\\overparen',
21836
- napprox: '\\not\\approx',
21837
- longdiv: '\\enclose{longdiv}'
21838
- },
21839
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
21840
- };
21841
- window.mathjaxLoadedP = new Promise(function (resolve) {
21818
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
21819
+ mathjaxScript.mathRenderingKEY = mathRenderingKEY;
21820
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
21821
+ mathjaxScript.mathRenderingAccessibleKEY = mathRenderingAccessibleKEY;
21822
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
21823
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
21824
+ return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
21825
+ };
21826
+ var mathJaxCustomKey = getMathJaxCustomKey();
21827
+ var defaultOpts = function defaultOpts() {
21828
+ return (0, _renderMath.getGlobal)().opts || ({});
21829
+ };
21830
+ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFullPage) {
21831
+ window.MathJaxInitialised = true;
21832
+ renderOpts = renderOpts || defaultOpts();
21833
+ if ((!window.MathJax || window.MathJax.version !== MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
21834
+ var _renderOpts, _renderOpts2;
21835
+ if ((_renderOpts = renderOpts) !== null && _renderOpts !== void 0 && _renderOpts.useSingleDollar) {
21836
+ console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
21837
+ }
21838
+ var texConfig = (_renderOpts2 = renderOpts) !== null && _renderOpts2 !== void 0 && _renderOpts2.useSingleDollar ? {
21839
+ macros: {
21840
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21841
+ overarc: '\\overparen',
21842
+ napprox: '\\not\\approx',
21843
+ longdiv: '\\enclose{longdiv}'
21844
+ },
21845
+ inlineMath: [['$', '$'], ['\\(', '\\)']],
21846
+ processEscapes: true,
21847
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
21848
+ } : {
21849
+ macros: {
21850
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
21851
+ overarc: '\\overparen',
21852
+ napprox: '\\not\\approx',
21853
+ longdiv: '\\enclose{longdiv}'
21854
+ },
21855
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
21856
+ };
21842
21857
  window.MathJax = {
21843
21858
  startup: {
21844
21859
  typeset: false,
@@ -21857,7 +21872,10 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
21857
21872
  MathJax.startup.defaultReady();
21858
21873
  var globalObj = (0, _renderMath.getGlobal)();
21859
21874
  globalObj.instance = MathJax;
21860
- resolve();
21875
+ if (processMathJaxFullPage) {
21876
+ processMathJaxFullPage();
21877
+ }
21878
+ window.MathJaxLoaded = true;
21861
21879
  }
21862
21880
  },
21863
21881
  loader: {
@@ -21888,7 +21906,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
21888
21906
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
21889
21907
  script.async = true;
21890
21908
  document.body.appendChild(script);
21891
- });
21909
+ }
21892
21910
  };
21893
21911
  mathjaxScript.initializeMathJax = initializeMathJax;
21894
21912
  var normalization$1 = {};
@@ -81566,7 +81584,7 @@ getDefaultExportFromCjs(mathRendering);
81566
81584
  Object.defineProperty(exports, "__esModule", {
81567
81585
  value: true
81568
81586
  });
81569
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81587
+ exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81570
81588
  var _typeof2 = _interopRequireDefault(_typeof$b.exports);
81571
81589
  var _mathjaxScript = mathjaxScript;
81572
81590
  var _normalization = normalization$1;
@@ -81617,22 +81635,17 @@ getDefaultExportFromCjs(mathRendering);
81617
81635
  };
81618
81636
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
81619
81637
  var NEWLINE_LATEX = '\\newline ';
81620
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
81621
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
81622
81638
  var getGlobal = function getGlobal() {
81623
81639
  if (typeof window !== 'undefined') {
81624
- if (!window[mathRenderingAccessibleKEY]) {
81625
- window[mathRenderingAccessibleKEY] = {};
81640
+ if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
81641
+ window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
81626
81642
  }
81627
- return window[mathRenderingAccessibleKEY];
81643
+ return window[_mathjaxScript.mathRenderingAccessibleKEY];
81628
81644
  } else {
81629
81645
  return {};
81630
81646
  }
81631
81647
  };
81632
81648
  exports.getGlobal = getGlobal;
81633
- var defaultOpts = function defaultOpts() {
81634
- return getGlobal().opts || ({});
81635
- };
81636
81649
  var fixMathElement = function fixMathElement(element) {
81637
81650
  if (element.dataset.mathHandled) {
81638
81651
  return;
@@ -81697,80 +81710,84 @@ getDefaultExportFromCjs(mathRendering);
81697
81710
  }
81698
81711
  });
81699
81712
  };
81700
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
81701
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
81702
- return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
81713
+ var processMathJaxFullPage = function processMathJaxFullPage(executeOn) {
81714
+ executeOn = executeOn || document.body;
81715
+ var mathJaxInstance = getGlobal().instance;
81716
+ if (mathJaxInstance) {
81717
+ mathJaxInstance.texReset();
81718
+ mathJaxInstance.typesetClear();
81719
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
81720
+ try {
81721
+ removeExcessMjxContainers(executeOn);
81722
+ removePlaceholdersAndRestoreDisplay();
81723
+ var updatedDocument = mathJaxInstance.startup.document;
81724
+ var list = updatedDocument.math.list;
81725
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
81726
+ var mathMl = toMMl(item.data.root);
81727
+ var parsedMathMl = mathMl.replaceAll('\n', '');
81728
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
81729
+ }
81730
+ } catch (e) {
81731
+ console.error('Error post-processing MathJax typesetting:', e.toString());
81732
+ }
81733
+ mathJaxInstance.startup.document.clear();
81734
+ })["catch"](function (error) {
81735
+ console.error('Error in typesetting with MathJax:', error);
81736
+ });
81737
+ }
81738
+ };
81739
+ var initializeMathJaxScript = function initializeMathJaxScript(renderOpts) {
81740
+ if (!window.MathJaxInitialised) {
81741
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, processMathJaxFullPage);
81742
+ }
81703
81743
  };
81744
+ exports.initializeMathJaxScript = initializeMathJaxScript;
81704
81745
  var renderMath = function renderMath(el, renderOpts) {
81705
81746
  var isString = typeof el === 'string';
81747
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81706
81748
  var executeOn = document.body;
81707
81749
  if (isString) {
81708
81750
  var div = document.createElement('div');
81709
81751
  div.innerHTML = el;
81710
81752
  executeOn = div;
81711
81753
  }
81712
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81713
81754
  var renderMathAccessible = function renderMathAccessible() {
81714
81755
  fixMathElements(executeOn);
81715
81756
  adjustMathMLStyle(executeOn);
81716
- var mathJaxCustomKey = getMathJaxCustomKey();
81717
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
81718
- renderOpts = renderOpts || defaultOpts();
81719
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
81720
- }
81721
- if (isString && window.MathJax && window.mathjaxLoadedP) {
81722
- try {
81723
- MathJax.texReset();
81724
- MathJax.typesetClear();
81725
- window.MathJax.typeset([executeOn]);
81726
- var updatedDocument = window.MathJax.startup.document;
81727
- var list = updatedDocument.math.list;
81728
- var item = list.next;
81729
- var mathMl = toMMl(item.data.root);
81730
- var parsedMathMl = mathMl.replaceAll('\n', '');
81731
- return parsedMathMl;
81732
- } catch (error) {
81733
- console.error('Error rendering math:', error.message);
81734
- }
81757
+ if (!window.MathJaxInitialised) {
81758
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
81759
+ return processMathJaxFullPage(executeOn);
81760
+ });
81761
+ return;
81735
81762
  }
81736
- if (window.mathjaxLoadedP) {
81737
- window.mathjaxLoadedP.then(function () {
81738
- var mathJaxInstance = getGlobal().instance;
81739
- if (mathJaxInstance) {
81740
- mathJaxInstance.texReset();
81741
- mathJaxInstance.typesetClear();
81742
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
81743
- try {
81744
- removeExcessMjxContainers(executeOn);
81745
- removePlaceholdersAndRestoreDisplay();
81746
- var _updatedDocument = mathJaxInstance.startup.document;
81747
- var _list = _updatedDocument.math.list;
81748
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
81749
- var _mathMl = toMMl(_item.data.root);
81750
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
81751
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
81752
- }
81753
- } catch (e) {
81754
- console.error('Error post-processing MathJax typesetting:', e.toString());
81755
- }
81756
- mathJaxInstance.startup.document.clear();
81757
- })["catch"](function (error) {
81758
- console.error('Error in typesetting with MathJax:', error);
81759
- });
81763
+ if (window.MathJaxLoaded) {
81764
+ if (isString) {
81765
+ try {
81766
+ MathJax.texReset();
81767
+ MathJax.typesetClear();
81768
+ window.MathJax.typeset([executeOn]);
81769
+ var updatedDocument = window.MathJax.startup.document;
81770
+ var list = updatedDocument.math.list;
81771
+ var item = list.next;
81772
+ var mathMl = toMMl(item.data.root);
81773
+ var parsedMathMl = mathMl.replaceAll('\n', '');
81774
+ return parsedMathMl;
81775
+ } catch (error) {
81776
+ console.error('Error rendering math:', error.message);
81777
+ return '';
81760
81778
  }
81761
- })["catch"](function (error) {
81762
- console.error('Error in initializing MathJax:', error);
81763
- });
81779
+ }
81780
+ processMathJaxFullPage(executeOn);
81764
81781
  }
81765
81782
  };
81766
81783
  if (skipWaitForMathRenderingLib) {
81767
81784
  return renderMathAccessible();
81768
81785
  } else {
81769
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
81786
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
81770
81787
  removePlaceholdersAndRestoreDisplay();
81771
81788
  return mr.renderMath(executeOn, renderOpts);
81772
81789
  }
81773
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
81790
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
81774
81791
  return renderMathAccessible();
81775
81792
  }
81776
81793
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -81780,7 +81797,7 @@ getDefaultExportFromCjs(mathRendering);
81780
81797
  var maxWaitTime = 500;
81781
81798
  var startTime = Date.now();
81782
81799
  var checkForLib = function checkForLib() {
81783
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
81800
+ var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
81784
81801
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
81785
81802
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
81786
81803
  clearInterval(checkIntervalId);
@@ -81815,9 +81832,16 @@ var mmlToLatex = {};
81815
81832
  getDefaultExportFromCjs(mmlToLatex);
81816
81833
  (function (exports) {
81817
81834
  var _interopRequireDefault = interopRequireDefault.exports;
81835
+ var _typeof = _typeof$b.exports;
81818
81836
  Object.defineProperty(exports, "__esModule", {
81819
81837
  value: true
81820
81838
  });
81839
+ Object.defineProperty(exports, "initializeMathJaxScript", {
81840
+ enumerable: true,
81841
+ get: function get() {
81842
+ return _renderMath.initializeMathJaxScript;
81843
+ }
81844
+ });
81821
81845
  Object.defineProperty(exports, "mmlToLatex", {
81822
81846
  enumerable: true,
81823
81847
  get: function get() {
@@ -81842,9 +81866,48 @@ getDefaultExportFromCjs(mmlToLatex);
81842
81866
  return _normalization.wrapMath;
81843
81867
  }
81844
81868
  });
81845
- var _renderMath = _interopRequireDefault(renderMath$3);
81869
+ var _renderMath = _interopRequireWildcard(renderMath$3);
81846
81870
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
81847
81871
  var _normalization = normalization$1;
81872
+ function _getRequireWildcardCache(nodeInterop) {
81873
+ if (typeof WeakMap !== "function") return null;
81874
+ var cacheBabelInterop = new WeakMap();
81875
+ var cacheNodeInterop = new WeakMap();
81876
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
81877
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
81878
+ })(nodeInterop);
81879
+ }
81880
+ function _interopRequireWildcard(obj, nodeInterop) {
81881
+ if (!nodeInterop && obj && obj.__esModule) {
81882
+ return obj;
81883
+ }
81884
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
81885
+ return {
81886
+ "default": obj
81887
+ };
81888
+ }
81889
+ var cache = _getRequireWildcardCache(nodeInterop);
81890
+ if (cache && cache.has(obj)) {
81891
+ return cache.get(obj);
81892
+ }
81893
+ var newObj = {};
81894
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
81895
+ for (var key in obj) {
81896
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
81897
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
81898
+ if (desc && (desc.get || desc.set)) {
81899
+ Object.defineProperty(newObj, key, desc);
81900
+ } else {
81901
+ newObj[key] = obj[key];
81902
+ }
81903
+ }
81904
+ }
81905
+ newObj["default"] = obj;
81906
+ if (cache) {
81907
+ cache.set(obj, newObj);
81908
+ }
81909
+ return newObj;
81910
+ }
81848
81911
  })(mathRenderingAccessible);
81849
81912
  getDefaultExportFromCjs(mathRenderingAccessible);
81850
81913
  var choices = {};
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "2.22.3-next.4+9d0f87467",
7
+ "version": "2.22.3-next.8+1dd6cd9ce",
8
8
  "description": "",
9
9
  "dependencies": {
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-framework/pie-player-events": "^0.1.0",
12
- "@pie-lib/pie-toolbox": "1.30.2",
12
+ "@pie-lib/pie-toolbox": "1.31.0",
13
13
  "prop-types": "^15.6.1",
14
14
  "react": "^16.8.1",
15
15
  "react-dom": "^16.8.1"
16
16
  },
17
17
  "author": "",
18
18
  "license": "ISC",
19
- "gitHead": "9d0f87467cb2a85e309a8ae0340d8092515b4cc9",
19
+ "gitHead": "1dd6cd9ce2b68e511748963f567e94c1af5cb32c",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },