@pie-element/explicit-constructed-response 6.22.7-next.1 → 6.22.7-next.2

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
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "next",
11
+ "@pie-lib/pie-toolbox": "2.0.2",
12
12
  "classnames": "^2.2.6",
13
13
  "debug": "^3.1.0",
14
14
  "lodash": "^4.17.15",
@@ -8,7 +8,7 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/pie-toolbox": "next",
11
+ "@pie-lib/pie-toolbox": "2.0.2",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "type-of": "^2.0.1"
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.26.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.28.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.0/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.0.0/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) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.26.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.28.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.0/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.0.0/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) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -19148,90 +19148,6 @@ withMask$1.withMask = withMask;
19148
19148
  var dragInTheBlank = {};
19149
19149
  var mathRenderingAccessible = {};
19150
19150
  var renderMath$2 = {};
19151
- var mathjaxScript = {};
19152
- Object.defineProperty(mathjaxScript, "__esModule", {
19153
- value: true
19154
- });
19155
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
19156
- var _renderMath = renderMath$2;
19157
- var MathJaxVersion = '3.2.2';
19158
- mathjaxScript.MathJaxVersion = MathJaxVersion;
19159
- var initializeMathJax = function initializeMathJax(renderOpts) {
19160
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
19161
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
19162
- }
19163
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
19164
- macros: {
19165
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
19166
- overarc: '\\overparen',
19167
- napprox: '\\not\\approx',
19168
- longdiv: '\\enclose{longdiv}'
19169
- },
19170
- inlineMath: [['$', '$'], ['\\(', '\\)']],
19171
- processEscapes: true,
19172
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
19173
- } : {
19174
- macros: {
19175
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
19176
- overarc: '\\overparen',
19177
- napprox: '\\not\\approx',
19178
- longdiv: '\\enclose{longdiv}'
19179
- },
19180
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
19181
- };
19182
- window.mathjaxLoadedP = new Promise(function (resolve) {
19183
- window.MathJax = {
19184
- startup: {
19185
- typeset: false,
19186
- ready: function ready() {
19187
- var mathjax = MathJax._.mathjax.mathjax;
19188
- var STATE = MathJax._.core.MathItem.STATE;
19189
- var Menu = MathJax._.ui.menu.Menu.Menu;
19190
- var rerender = Menu.prototype.rerender;
19191
- Menu.prototype.rerender = function () {
19192
- var _this = this;
19193
- var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
19194
- mathjax.handleRetriesFor(function () {
19195
- return rerender.call(_this, start);
19196
- });
19197
- };
19198
- MathJax.startup.defaultReady();
19199
- var globalObj = (0, _renderMath.getGlobal)();
19200
- globalObj.instance = MathJax;
19201
- resolve();
19202
- }
19203
- },
19204
- loader: {
19205
- load: ['input/mml']
19206
- },
19207
- tex: texConfig,
19208
- chtml: {
19209
- fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',
19210
- displayAlign: 'center'
19211
- },
19212
- customKey: '@pie-lib/math-rendering-accessible@1',
19213
- options: {
19214
- enableEnrichment: true,
19215
- sre: {
19216
- speech: 'deep'
19217
- },
19218
- menuOptions: {
19219
- settings: {
19220
- assistiveMml: true,
19221
- collapsible: false,
19222
- explorer: false
19223
- }
19224
- }
19225
- }
19226
- };
19227
- var script = document.createElement('script');
19228
- script.type = 'text/javascript';
19229
- script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
19230
- script.async = true;
19231
- document.body.appendChild(script);
19232
- });
19233
- };
19234
- mathjaxScript.initializeMathJax = initializeMathJax;
19235
19151
  var normalization$1 = {};
19236
19152
  var slicedToArray = {
19237
19153
  exports: {}
@@ -78907,9 +78823,8 @@ getDefaultExportFromCjs(mathRendering);
78907
78823
  Object.defineProperty(exports, "__esModule", {
78908
78824
  value: true
78909
78825
  });
78910
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
78826
+ exports.initializeMathJax = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = exports.MathJaxVersion = void 0;
78911
78827
  var _typeof2 = _interopRequireDefault(_typeof$d.exports);
78912
- var _mathjaxScript = mathjaxScript;
78913
78828
  var _normalization = normalization$1;
78914
78829
  var mr = _interopRequireWildcard(mathRendering);
78915
78830
  var _SerializedMmlVisitor = SerializedMmlVisitor;
@@ -78957,11 +78872,13 @@ getDefaultExportFromCjs(mathRendering);
78957
78872
  return visitor.visitTree(node);
78958
78873
  };
78959
78874
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
78960
- var NEWLINE_LATEX = '\\newline ';
78961
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
78962
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
78875
+ var NEWLINE_LATEX = "\\newline ";
78876
+ var mathRenderingKEY = "@pie-lib/math-rendering@2";
78877
+ var mathRenderingAccessibleKEY = "@pie-lib/math-rendering-accessible@1";
78878
+ var MathJaxVersion = "3.2.2";
78879
+ exports.MathJaxVersion = MathJaxVersion;
78963
78880
  var getGlobal = function getGlobal() {
78964
- if (typeof window !== 'undefined') {
78881
+ if (typeof window !== "undefined") {
78965
78882
  if (!window[mathRenderingAccessibleKEY]) {
78966
78883
  window[mathRenderingAccessibleKEY] = {};
78967
78884
  }
@@ -78971,16 +78888,13 @@ getDefaultExportFromCjs(mathRendering);
78971
78888
  }
78972
78889
  };
78973
78890
  exports.getGlobal = getGlobal;
78974
- var defaultOpts = function defaultOpts() {
78975
- return getGlobal().opts || ({});
78976
- };
78977
78891
  var fixMathElement = function fixMathElement(element) {
78978
78892
  if (element.dataset.mathHandled) {
78979
78893
  return;
78980
78894
  }
78981
- var property = 'innerText';
78895
+ var property = "innerText";
78982
78896
  if (element.textContent) {
78983
- property = 'textContent';
78897
+ property = "textContent";
78984
78898
  }
78985
78899
  if (element[property]) {
78986
78900
  element[property] = (0, _normalization.wrapMath)((0, _normalization.unWrapMath)(element[property]).unwrapped);
@@ -78991,7 +78905,7 @@ getDefaultExportFromCjs(mathRendering);
78991
78905
  exports.fixMathElement = fixMathElement;
78992
78906
  var fixMathElements = function fixMathElements() {
78993
78907
  var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
78994
- var mathElements = el.querySelectorAll('[data-latex]');
78908
+ var mathElements = el.querySelectorAll("[data-latex]");
78995
78909
  mathElements.forEach(function (item) {
78996
78910
  return fixMathElement(item);
78997
78911
  });
@@ -78999,25 +78913,25 @@ getDefaultExportFromCjs(mathRendering);
78999
78913
  exports.fixMathElements = fixMathElements;
79000
78914
  var adjustMathMLStyle = function adjustMathMLStyle() {
79001
78915
  var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
79002
- var nodes = el.querySelectorAll('math');
78916
+ var nodes = el.querySelectorAll("math");
79003
78917
  nodes.forEach(function (node) {
79004
- return node.setAttribute('displaystyle', 'true');
78918
+ return node.setAttribute("displaystyle", "true");
79005
78919
  });
79006
78920
  };
79007
78921
  var createPlaceholder = function createPlaceholder(element) {
79008
78922
  var _element$previousSibl;
79009
- if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains('math-placeholder'))) {
78923
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
79010
78924
  var _element$parentNode;
79011
- element.dataset.originalDisplay = element.style.display || '';
79012
- element.style.display = 'none';
79013
- var placeholder = document.createElement('span');
79014
- placeholder.style.cssText = 'height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;';
79015
- placeholder.classList.add('math-placeholder');
78925
+ element.dataset.originalDisplay = element.style.display || "";
78926
+ element.style.display = "none";
78927
+ var placeholder = document.createElement("span");
78928
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
78929
+ placeholder.classList.add("math-placeholder");
79016
78930
  (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
79017
78931
  }
79018
78932
  };
79019
78933
  var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
79020
- document.querySelectorAll('.math-placeholder').forEach(function (placeholder) {
78934
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
79021
78935
  var _targetElement$datase;
79022
78936
  var targetElement = placeholder.nextElementSibling;
79023
78937
  if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
@@ -79028,9 +78942,9 @@ getDefaultExportFromCjs(mathRendering);
79028
78942
  });
79029
78943
  };
79030
78944
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
79031
- var elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
78945
+ var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
79032
78946
  elements.forEach(function (element) {
79033
- var mjxContainers = element.querySelectorAll('mjx-container');
78947
+ var mjxContainers = element.querySelectorAll("mjx-container");
79034
78948
  if (mjxContainers.length > 1) {
79035
78949
  for (var i = 1; i < mjxContainers.length; i++) {
79036
78950
  mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
@@ -79038,28 +78952,124 @@ getDefaultExportFromCjs(mathRendering);
79038
78952
  }
79039
78953
  });
79040
78954
  };
79041
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
79042
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
79043
- 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);
78955
+ var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
78956
+ executeOn = executeOn || document.body;
78957
+ fixMathElements(executeOn);
78958
+ adjustMathMLStyle(executeOn);
78959
+ var mathJaxInstance = getGlobal().instance;
78960
+ if (mathJaxInstance) {
78961
+ mathJaxInstance.texReset();
78962
+ mathJaxInstance.typesetClear();
78963
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
78964
+ try {
78965
+ removeExcessMjxContainers(executeOn);
78966
+ var updatedDocument = mathJaxInstance.startup.document;
78967
+ var list = updatedDocument.math.list;
78968
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
78969
+ var mathMl = toMMl(item.data.root);
78970
+ var parsedMathMl = mathMl.replaceAll("\n", "");
78971
+ item.data.typesetRoot.setAttribute("data-mathml", parsedMathMl);
78972
+ }
78973
+ } catch (e) {
78974
+ console.error("Error post-processing MathJax typesetting:", e.toString());
78975
+ }
78976
+ mathJaxInstance.startup.document.clear();
78977
+ })["catch"](function (error) {
78978
+ console.error("Error in typesetting with MathJax:", error);
78979
+ });
78980
+ }
79044
78981
  };
78982
+ var initializeMathJax = function initializeMathJax(callback) {
78983
+ var texConfig = {
78984
+ macros: {
78985
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
78986
+ overarc: "\\overparen",
78987
+ napprox: "\\not\\approx",
78988
+ longdiv: "\\enclose{longdiv}"
78989
+ },
78990
+ displayMath: [["$$", "$$"], ["\\[", "\\]"]]
78991
+ };
78992
+ window.mathjaxLoadedP = new Promise(function (resolve) {
78993
+ window.MathJax = {
78994
+ startup: {
78995
+ typeset: false,
78996
+ ready: function ready() {
78997
+ var mathjax = MathJax._.mathjax.mathjax;
78998
+ var STATE = MathJax._.core.MathItem.STATE;
78999
+ var Menu = MathJax._.ui.menu.Menu.Menu;
79000
+ var rerender = Menu.prototype.rerender;
79001
+ Menu.prototype.rerender = function () {
79002
+ var _this = this;
79003
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
79004
+ mathjax.handleRetriesFor(function () {
79005
+ return rerender.call(_this, start);
79006
+ });
79007
+ };
79008
+ MathJax.startup.defaultReady();
79009
+ var globalObj = getGlobal();
79010
+ globalObj.instance = MathJax;
79011
+ window.mathjaxLoadedComplete = true;
79012
+ console.log("MathJax has initialised!", new Date().toString());
79013
+ if (callback) {
79014
+ callback();
79015
+ }
79016
+ resolve();
79017
+ }
79018
+ },
79019
+ loader: {
79020
+ load: ["input/mml"],
79021
+ preLoad: function preLoad() {}
79022
+ },
79023
+ tex: texConfig,
79024
+ chtml: {
79025
+ fontURL: "https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2",
79026
+ displayAlign: "center"
79027
+ },
79028
+ customKey: "@pie-lib/math-rendering-accessible@1",
79029
+ options: {
79030
+ enableEnrichment: true,
79031
+ sre: {
79032
+ speech: "deep"
79033
+ },
79034
+ menuOptions: {
79035
+ settings: {
79036
+ assistiveMml: true,
79037
+ collapsible: false,
79038
+ explorer: false
79039
+ }
79040
+ }
79041
+ }
79042
+ };
79043
+ var script = document.createElement("script");
79044
+ script.type = "text/javascript";
79045
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
79046
+ script.async = true;
79047
+ document.body.appendChild(script);
79048
+ });
79049
+ };
79050
+ exports.initializeMathJax = initializeMathJax;
79045
79051
  var renderMath = function renderMath(el, renderOpts) {
79046
- var isString = typeof el === 'string';
79052
+ var usedForMmlOutput = typeof el === "string";
79047
79053
  var executeOn = document.body;
79048
- if (isString) {
79049
- var div = document.createElement('div');
79050
- div.innerHTML = el;
79051
- executeOn = div;
79054
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
79055
+ return mr.renderMath(el, renderOpts);
79052
79056
  }
79053
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
79054
- var renderMathAccessible = function renderMathAccessible() {
79055
- fixMathElements(executeOn);
79056
- adjustMathMLStyle(executeOn);
79057
- var mathJaxCustomKey = getMathJaxCustomKey();
79058
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
79059
- renderOpts = renderOpts || defaultOpts();
79060
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
79057
+ if (!usedForMmlOutput) {
79058
+ if (window.mathjaxLoadedComplete) {
79059
+ renderContentWithMathJax(el);
79060
+ } else if (window.mathjaxLoadedP) {
79061
+ window.mathjaxLoadedP.then(function () {
79062
+ window.mathjaxLoadedComplete = true;
79063
+ renderContentWithMathJax(el);
79064
+ })["catch"](function (error) {
79065
+ return console.error("Error in initializing MathJax:", error);
79066
+ });
79061
79067
  }
79062
- if (isString && window.MathJax && window.mathjaxLoadedP) {
79068
+ } else {
79069
+ if (window.MathJax && window.mathjaxLoadedP) {
79070
+ var div = document.createElement("div");
79071
+ div.innerHTML = el;
79072
+ executeOn = div;
79063
79073
  try {
79064
79074
  MathJax.texReset();
79065
79075
  MathJax.typesetClear();
@@ -79068,76 +79078,38 @@ getDefaultExportFromCjs(mathRendering);
79068
79078
  var list = updatedDocument.math.list;
79069
79079
  var item = list.next;
79070
79080
  var mathMl = toMMl(item.data.root);
79071
- var parsedMathMl = mathMl.replaceAll('\n', '');
79081
+ var parsedMathMl = mathMl.replaceAll("\n", "");
79072
79082
  return parsedMathMl;
79073
79083
  } catch (error) {
79074
- console.error('Error rendering math:', error.message);
79084
+ console.error("Error rendering math:", error.message);
79075
79085
  }
79076
79086
  return el;
79077
79087
  }
79078
- if (window.mathjaxLoadedP) {
79079
- window.mathjaxLoadedP.then(function () {
79080
- var mathJaxInstance = getGlobal().instance;
79081
- if (mathJaxInstance) {
79082
- mathJaxInstance.texReset();
79083
- mathJaxInstance.typesetClear();
79084
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
79085
- try {
79086
- removeExcessMjxContainers(executeOn);
79087
- removePlaceholdersAndRestoreDisplay();
79088
- var _updatedDocument = mathJaxInstance.startup.document;
79089
- var _list = _updatedDocument.math.list;
79090
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
79091
- var _mathMl = toMMl(_item.data.root);
79092
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
79093
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
79094
- }
79095
- } catch (e) {
79096
- console.error('Error post-processing MathJax typesetting:', e.toString());
79097
- }
79098
- mathJaxInstance.startup.document.clear();
79099
- })["catch"](function (error) {
79100
- console.error('Error in typesetting with MathJax:', error);
79101
- });
79102
- }
79103
- })["catch"](function (error) {
79104
- console.error('Error in initializing MathJax:', error);
79105
- });
79106
- }
79107
- };
79108
- if (skipWaitForMathRenderingLib) {
79109
- return renderMathAccessible();
79110
- } else {
79111
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
79112
- removePlaceholdersAndRestoreDisplay();
79113
- return mr.renderMath(executeOn, renderOpts);
79114
- }
79115
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
79116
- return renderMathAccessible();
79117
- }
79118
- var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
79119
- var mathElements = executeOn.querySelectorAll('[data-latex]');
79120
- mathElements.forEach(createPlaceholder);
79121
- var checkIntervalId;
79122
- var maxWaitTime = 500;
79123
- var startTime = Date.now();
79124
- var checkForLib = function checkForLib() {
79125
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
79126
- var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
79127
- if (mathRenderingHasLoaded || hasExceededMaxWait) {
79128
- clearInterval(checkIntervalId);
79129
- if (mathRenderingHasLoaded) {
79130
- removePlaceholdersAndRestoreDisplay();
79131
- return mr.renderMath(executeOn, renderOpts);
79132
- }
79133
- renderMathAccessibleCallback();
79134
- }
79135
- };
79136
- checkIntervalId = setInterval(checkForLib, 100);
79137
- };
79138
- waitForMathRenderingLib(renderMathAccessible);
79088
+ return el;
79139
79089
  }
79140
79090
  };
79091
+ (function () {
79092
+ if (window.checkIntervalId) {
79093
+ return;
79094
+ }
79095
+ window.checkIntervalId = undefined;
79096
+ var maxWaitTime = 5000;
79097
+ var startTime = Date.now();
79098
+ var checkForLib = function checkForLib() {
79099
+ var mathElements = document.body.querySelectorAll("[data-latex]");
79100
+ mathElements.forEach(createPlaceholder);
79101
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
79102
+ var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
79103
+ if (mathRenderingHasLoaded || hasExceededMaxWait) {
79104
+ clearInterval(window.checkIntervalId);
79105
+ removePlaceholdersAndRestoreDisplay();
79106
+ }
79107
+ if (hasExceededMaxWait) {
79108
+ initializeMathJax(renderContentWithMathJax);
79109
+ }
79110
+ };
79111
+ window.checkIntervalId = setInterval(checkForLib, 50);
79112
+ })();
79141
79113
  var _default = renderMath;
79142
79114
  exports["default"] = _default;
79143
79115
  })(renderMath$2);
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.26.1"
7
+ "version": "2.0.0"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "4.28.1"
11
+ "version": "5.0.0"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.26.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.28.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_react_dom, _dll_classnames, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.0/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@5.0.0/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) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -19111,90 +19111,6 @@ withMask$1.withMask = withMask;
19111
19111
  var dragInTheBlank = {};
19112
19112
  var mathRenderingAccessible = {};
19113
19113
  var renderMath$2 = {};
19114
- var mathjaxScript = {};
19115
- Object.defineProperty(mathjaxScript, "__esModule", {
19116
- value: true
19117
- });
19118
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
19119
- var _renderMath = renderMath$2;
19120
- var MathJaxVersion = '3.2.2';
19121
- mathjaxScript.MathJaxVersion = MathJaxVersion;
19122
- var initializeMathJax = function initializeMathJax(renderOpts) {
19123
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
19124
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
19125
- }
19126
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
19127
- macros: {
19128
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
19129
- overarc: '\\overparen',
19130
- napprox: '\\not\\approx',
19131
- longdiv: '\\enclose{longdiv}'
19132
- },
19133
- inlineMath: [['$', '$'], ['\\(', '\\)']],
19134
- processEscapes: true,
19135
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
19136
- } : {
19137
- macros: {
19138
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
19139
- overarc: '\\overparen',
19140
- napprox: '\\not\\approx',
19141
- longdiv: '\\enclose{longdiv}'
19142
- },
19143
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
19144
- };
19145
- window.mathjaxLoadedP = new Promise(function (resolve) {
19146
- window.MathJax = {
19147
- startup: {
19148
- typeset: false,
19149
- ready: function ready() {
19150
- var mathjax = MathJax._.mathjax.mathjax;
19151
- var STATE = MathJax._.core.MathItem.STATE;
19152
- var Menu = MathJax._.ui.menu.Menu.Menu;
19153
- var rerender = Menu.prototype.rerender;
19154
- Menu.prototype.rerender = function () {
19155
- var _this = this;
19156
- var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
19157
- mathjax.handleRetriesFor(function () {
19158
- return rerender.call(_this, start);
19159
- });
19160
- };
19161
- MathJax.startup.defaultReady();
19162
- var globalObj = (0, _renderMath.getGlobal)();
19163
- globalObj.instance = MathJax;
19164
- resolve();
19165
- }
19166
- },
19167
- loader: {
19168
- load: ['input/mml']
19169
- },
19170
- tex: texConfig,
19171
- chtml: {
19172
- fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',
19173
- displayAlign: 'center'
19174
- },
19175
- customKey: '@pie-lib/math-rendering-accessible@1',
19176
- options: {
19177
- enableEnrichment: true,
19178
- sre: {
19179
- speech: 'deep'
19180
- },
19181
- menuOptions: {
19182
- settings: {
19183
- assistiveMml: true,
19184
- collapsible: false,
19185
- explorer: false
19186
- }
19187
- }
19188
- }
19189
- };
19190
- var script = document.createElement('script');
19191
- script.type = 'text/javascript';
19192
- script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
19193
- script.async = true;
19194
- document.body.appendChild(script);
19195
- });
19196
- };
19197
- mathjaxScript.initializeMathJax = initializeMathJax;
19198
19114
  var normalization$1 = {};
19199
19115
  var slicedToArray = {
19200
19116
  exports: {}
@@ -78870,9 +78786,8 @@ getDefaultExportFromCjs(mathRendering);
78870
78786
  Object.defineProperty(exports, "__esModule", {
78871
78787
  value: true
78872
78788
  });
78873
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
78789
+ exports.initializeMathJax = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = exports.MathJaxVersion = void 0;
78874
78790
  var _typeof2 = _interopRequireDefault(_typeof$d.exports);
78875
- var _mathjaxScript = mathjaxScript;
78876
78791
  var _normalization = normalization$1;
78877
78792
  var mr = _interopRequireWildcard(mathRendering);
78878
78793
  var _SerializedMmlVisitor = SerializedMmlVisitor;
@@ -78920,11 +78835,13 @@ getDefaultExportFromCjs(mathRendering);
78920
78835
  return visitor.visitTree(node);
78921
78836
  };
78922
78837
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
78923
- var NEWLINE_LATEX = '\\newline ';
78924
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
78925
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
78838
+ var NEWLINE_LATEX = "\\newline ";
78839
+ var mathRenderingKEY = "@pie-lib/math-rendering@2";
78840
+ var mathRenderingAccessibleKEY = "@pie-lib/math-rendering-accessible@1";
78841
+ var MathJaxVersion = "3.2.2";
78842
+ exports.MathJaxVersion = MathJaxVersion;
78926
78843
  var getGlobal = function getGlobal() {
78927
- if (typeof window !== 'undefined') {
78844
+ if (typeof window !== "undefined") {
78928
78845
  if (!window[mathRenderingAccessibleKEY]) {
78929
78846
  window[mathRenderingAccessibleKEY] = {};
78930
78847
  }
@@ -78934,16 +78851,13 @@ getDefaultExportFromCjs(mathRendering);
78934
78851
  }
78935
78852
  };
78936
78853
  exports.getGlobal = getGlobal;
78937
- var defaultOpts = function defaultOpts() {
78938
- return getGlobal().opts || ({});
78939
- };
78940
78854
  var fixMathElement = function fixMathElement(element) {
78941
78855
  if (element.dataset.mathHandled) {
78942
78856
  return;
78943
78857
  }
78944
- var property = 'innerText';
78858
+ var property = "innerText";
78945
78859
  if (element.textContent) {
78946
- property = 'textContent';
78860
+ property = "textContent";
78947
78861
  }
78948
78862
  if (element[property]) {
78949
78863
  element[property] = (0, _normalization.wrapMath)((0, _normalization.unWrapMath)(element[property]).unwrapped);
@@ -78954,7 +78868,7 @@ getDefaultExportFromCjs(mathRendering);
78954
78868
  exports.fixMathElement = fixMathElement;
78955
78869
  var fixMathElements = function fixMathElements() {
78956
78870
  var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
78957
- var mathElements = el.querySelectorAll('[data-latex]');
78871
+ var mathElements = el.querySelectorAll("[data-latex]");
78958
78872
  mathElements.forEach(function (item) {
78959
78873
  return fixMathElement(item);
78960
78874
  });
@@ -78962,25 +78876,25 @@ getDefaultExportFromCjs(mathRendering);
78962
78876
  exports.fixMathElements = fixMathElements;
78963
78877
  var adjustMathMLStyle = function adjustMathMLStyle() {
78964
78878
  var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
78965
- var nodes = el.querySelectorAll('math');
78879
+ var nodes = el.querySelectorAll("math");
78966
78880
  nodes.forEach(function (node) {
78967
- return node.setAttribute('displaystyle', 'true');
78881
+ return node.setAttribute("displaystyle", "true");
78968
78882
  });
78969
78883
  };
78970
78884
  var createPlaceholder = function createPlaceholder(element) {
78971
78885
  var _element$previousSibl;
78972
- if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains('math-placeholder'))) {
78886
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
78973
78887
  var _element$parentNode;
78974
- element.dataset.originalDisplay = element.style.display || '';
78975
- element.style.display = 'none';
78976
- var placeholder = document.createElement('span');
78977
- placeholder.style.cssText = 'height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;';
78978
- placeholder.classList.add('math-placeholder');
78888
+ element.dataset.originalDisplay = element.style.display || "";
78889
+ element.style.display = "none";
78890
+ var placeholder = document.createElement("span");
78891
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
78892
+ placeholder.classList.add("math-placeholder");
78979
78893
  (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
78980
78894
  }
78981
78895
  };
78982
78896
  var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
78983
- document.querySelectorAll('.math-placeholder').forEach(function (placeholder) {
78897
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
78984
78898
  var _targetElement$datase;
78985
78899
  var targetElement = placeholder.nextElementSibling;
78986
78900
  if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
@@ -78991,9 +78905,9 @@ getDefaultExportFromCjs(mathRendering);
78991
78905
  });
78992
78906
  };
78993
78907
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
78994
- var elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
78908
+ var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
78995
78909
  elements.forEach(function (element) {
78996
- var mjxContainers = element.querySelectorAll('mjx-container');
78910
+ var mjxContainers = element.querySelectorAll("mjx-container");
78997
78911
  if (mjxContainers.length > 1) {
78998
78912
  for (var i = 1; i < mjxContainers.length; i++) {
78999
78913
  mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
@@ -79001,28 +78915,124 @@ getDefaultExportFromCjs(mathRendering);
79001
78915
  }
79002
78916
  });
79003
78917
  };
79004
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
79005
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
79006
- 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);
78918
+ var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
78919
+ executeOn = executeOn || document.body;
78920
+ fixMathElements(executeOn);
78921
+ adjustMathMLStyle(executeOn);
78922
+ var mathJaxInstance = getGlobal().instance;
78923
+ if (mathJaxInstance) {
78924
+ mathJaxInstance.texReset();
78925
+ mathJaxInstance.typesetClear();
78926
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
78927
+ try {
78928
+ removeExcessMjxContainers(executeOn);
78929
+ var updatedDocument = mathJaxInstance.startup.document;
78930
+ var list = updatedDocument.math.list;
78931
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
78932
+ var mathMl = toMMl(item.data.root);
78933
+ var parsedMathMl = mathMl.replaceAll("\n", "");
78934
+ item.data.typesetRoot.setAttribute("data-mathml", parsedMathMl);
78935
+ }
78936
+ } catch (e) {
78937
+ console.error("Error post-processing MathJax typesetting:", e.toString());
78938
+ }
78939
+ mathJaxInstance.startup.document.clear();
78940
+ })["catch"](function (error) {
78941
+ console.error("Error in typesetting with MathJax:", error);
78942
+ });
78943
+ }
79007
78944
  };
78945
+ var initializeMathJax = function initializeMathJax(callback) {
78946
+ var texConfig = {
78947
+ macros: {
78948
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
78949
+ overarc: "\\overparen",
78950
+ napprox: "\\not\\approx",
78951
+ longdiv: "\\enclose{longdiv}"
78952
+ },
78953
+ displayMath: [["$$", "$$"], ["\\[", "\\]"]]
78954
+ };
78955
+ window.mathjaxLoadedP = new Promise(function (resolve) {
78956
+ window.MathJax = {
78957
+ startup: {
78958
+ typeset: false,
78959
+ ready: function ready() {
78960
+ var mathjax = MathJax._.mathjax.mathjax;
78961
+ var STATE = MathJax._.core.MathItem.STATE;
78962
+ var Menu = MathJax._.ui.menu.Menu.Menu;
78963
+ var rerender = Menu.prototype.rerender;
78964
+ Menu.prototype.rerender = function () {
78965
+ var _this = this;
78966
+ var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : STATE.TYPESET;
78967
+ mathjax.handleRetriesFor(function () {
78968
+ return rerender.call(_this, start);
78969
+ });
78970
+ };
78971
+ MathJax.startup.defaultReady();
78972
+ var globalObj = getGlobal();
78973
+ globalObj.instance = MathJax;
78974
+ window.mathjaxLoadedComplete = true;
78975
+ console.log("MathJax has initialised!", new Date().toString());
78976
+ if (callback) {
78977
+ callback();
78978
+ }
78979
+ resolve();
78980
+ }
78981
+ },
78982
+ loader: {
78983
+ load: ["input/mml"],
78984
+ preLoad: function preLoad() {}
78985
+ },
78986
+ tex: texConfig,
78987
+ chtml: {
78988
+ fontURL: "https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2",
78989
+ displayAlign: "center"
78990
+ },
78991
+ customKey: "@pie-lib/math-rendering-accessible@1",
78992
+ options: {
78993
+ enableEnrichment: true,
78994
+ sre: {
78995
+ speech: "deep"
78996
+ },
78997
+ menuOptions: {
78998
+ settings: {
78999
+ assistiveMml: true,
79000
+ collapsible: false,
79001
+ explorer: false
79002
+ }
79003
+ }
79004
+ }
79005
+ };
79006
+ var script = document.createElement("script");
79007
+ script.type = "text/javascript";
79008
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
79009
+ script.async = true;
79010
+ document.body.appendChild(script);
79011
+ });
79012
+ };
79013
+ exports.initializeMathJax = initializeMathJax;
79008
79014
  var renderMath = function renderMath(el, renderOpts) {
79009
- var isString = typeof el === 'string';
79015
+ var usedForMmlOutput = typeof el === "string";
79010
79016
  var executeOn = document.body;
79011
- if (isString) {
79012
- var div = document.createElement('div');
79013
- div.innerHTML = el;
79014
- executeOn = div;
79017
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
79018
+ return mr.renderMath(el, renderOpts);
79015
79019
  }
79016
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
79017
- var renderMathAccessible = function renderMathAccessible() {
79018
- fixMathElements(executeOn);
79019
- adjustMathMLStyle(executeOn);
79020
- var mathJaxCustomKey = getMathJaxCustomKey();
79021
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
79022
- renderOpts = renderOpts || defaultOpts();
79023
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
79020
+ if (!usedForMmlOutput) {
79021
+ if (window.mathjaxLoadedComplete) {
79022
+ renderContentWithMathJax(el);
79023
+ } else if (window.mathjaxLoadedP) {
79024
+ window.mathjaxLoadedP.then(function () {
79025
+ window.mathjaxLoadedComplete = true;
79026
+ renderContentWithMathJax(el);
79027
+ })["catch"](function (error) {
79028
+ return console.error("Error in initializing MathJax:", error);
79029
+ });
79024
79030
  }
79025
- if (isString && window.MathJax && window.mathjaxLoadedP) {
79031
+ } else {
79032
+ if (window.MathJax && window.mathjaxLoadedP) {
79033
+ var div = document.createElement("div");
79034
+ div.innerHTML = el;
79035
+ executeOn = div;
79026
79036
  try {
79027
79037
  MathJax.texReset();
79028
79038
  MathJax.typesetClear();
@@ -79031,76 +79041,38 @@ getDefaultExportFromCjs(mathRendering);
79031
79041
  var list = updatedDocument.math.list;
79032
79042
  var item = list.next;
79033
79043
  var mathMl = toMMl(item.data.root);
79034
- var parsedMathMl = mathMl.replaceAll('\n', '');
79044
+ var parsedMathMl = mathMl.replaceAll("\n", "");
79035
79045
  return parsedMathMl;
79036
79046
  } catch (error) {
79037
- console.error('Error rendering math:', error.message);
79047
+ console.error("Error rendering math:", error.message);
79038
79048
  }
79039
79049
  return el;
79040
79050
  }
79041
- if (window.mathjaxLoadedP) {
79042
- window.mathjaxLoadedP.then(function () {
79043
- var mathJaxInstance = getGlobal().instance;
79044
- if (mathJaxInstance) {
79045
- mathJaxInstance.texReset();
79046
- mathJaxInstance.typesetClear();
79047
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
79048
- try {
79049
- removeExcessMjxContainers(executeOn);
79050
- removePlaceholdersAndRestoreDisplay();
79051
- var _updatedDocument = mathJaxInstance.startup.document;
79052
- var _list = _updatedDocument.math.list;
79053
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
79054
- var _mathMl = toMMl(_item.data.root);
79055
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
79056
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
79057
- }
79058
- } catch (e) {
79059
- console.error('Error post-processing MathJax typesetting:', e.toString());
79060
- }
79061
- mathJaxInstance.startup.document.clear();
79062
- })["catch"](function (error) {
79063
- console.error('Error in typesetting with MathJax:', error);
79064
- });
79065
- }
79066
- })["catch"](function (error) {
79067
- console.error('Error in initializing MathJax:', error);
79068
- });
79069
- }
79070
- };
79071
- if (skipWaitForMathRenderingLib) {
79072
- return renderMathAccessible();
79073
- } else {
79074
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
79075
- removePlaceholdersAndRestoreDisplay();
79076
- return mr.renderMath(executeOn, renderOpts);
79077
- }
79078
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
79079
- return renderMathAccessible();
79080
- }
79081
- var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
79082
- var mathElements = executeOn.querySelectorAll('[data-latex]');
79083
- mathElements.forEach(createPlaceholder);
79084
- var checkIntervalId;
79085
- var maxWaitTime = 500;
79086
- var startTime = Date.now();
79087
- var checkForLib = function checkForLib() {
79088
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
79089
- var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
79090
- if (mathRenderingHasLoaded || hasExceededMaxWait) {
79091
- clearInterval(checkIntervalId);
79092
- if (mathRenderingHasLoaded) {
79093
- removePlaceholdersAndRestoreDisplay();
79094
- return mr.renderMath(executeOn, renderOpts);
79095
- }
79096
- renderMathAccessibleCallback();
79097
- }
79098
- };
79099
- checkIntervalId = setInterval(checkForLib, 100);
79100
- };
79101
- waitForMathRenderingLib(renderMathAccessible);
79051
+ return el;
79102
79052
  }
79103
79053
  };
79054
+ (function () {
79055
+ if (window.checkIntervalId) {
79056
+ return;
79057
+ }
79058
+ window.checkIntervalId = undefined;
79059
+ var maxWaitTime = 5000;
79060
+ var startTime = Date.now();
79061
+ var checkForLib = function checkForLib() {
79062
+ var mathElements = document.body.querySelectorAll("[data-latex]");
79063
+ mathElements.forEach(createPlaceholder);
79064
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
79065
+ var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
79066
+ if (mathRenderingHasLoaded || hasExceededMaxWait) {
79067
+ clearInterval(window.checkIntervalId);
79068
+ removePlaceholdersAndRestoreDisplay();
79069
+ }
79070
+ if (hasExceededMaxWait) {
79071
+ initializeMathJax(renderContentWithMathJax);
79072
+ }
79073
+ };
79074
+ window.checkIntervalId = setInterval(checkForLib, 50);
79075
+ })();
79104
79076
  var _default = renderMath;
79105
79077
  exports["default"] = _default;
79106
79078
  })(renderMath$2);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "6.22.7-next.1+01590fe0f",
7
+ "version": "6.22.7-next.2+a5588cfdc",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@material-ui/core": "^3.9.2",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/pie-toolbox": "next",
15
+ "@pie-lib/pie-toolbox": "2.0.2",
16
16
  "classnames": "^2.2.5",
17
17
  "lodash": "^4.17.10",
18
18
  "prop-types": "^15.6.1",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "author": "",
23
23
  "license": "ISC",
24
- "gitHead": "01590fe0f6ac36d14983cc144ef03f9cff397dfc",
24
+ "gitHead": "a5588cfdccb40e970e93736dea60de4b01f1a85d",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {