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

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.
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.2/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.24.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,49 +21848,34 @@ var mathjaxScript = {};
21848
21848
  Object.defineProperty(mathjaxScript, "__esModule", {
21849
21849
  value: true
21850
21850
  });
21851
- mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21851
+ 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 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
- };
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) {
21894
21879
  window.MathJax = {
21895
21880
  startup: {
21896
21881
  typeset: false,
@@ -21909,10 +21894,7 @@ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFul
21909
21894
  MathJax.startup.defaultReady();
21910
21895
  var globalObj = (0, _renderMath.getGlobal)();
21911
21896
  globalObj.instance = MathJax;
21912
- if (processMathJaxFullPage) {
21913
- processMathJaxFullPage();
21914
- }
21915
- window.MathJaxLoaded = true;
21897
+ resolve();
21916
21898
  }
21917
21899
  },
21918
21900
  loader: {
@@ -21943,7 +21925,7 @@ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFul
21943
21925
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
21944
21926
  script.async = true;
21945
21927
  document.body.appendChild(script);
21946
- }
21928
+ });
21947
21929
  };
21948
21930
  mathjaxScript.initializeMathJax = initializeMathJax;
21949
21931
  var normalization$1 = {};
@@ -81621,7 +81603,7 @@ getDefaultExportFromCjs(mathRendering);
81621
81603
  Object.defineProperty(exports, "__esModule", {
81622
81604
  value: true
81623
81605
  });
81624
- exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81606
+ exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81625
81607
  var _typeof2 = _interopRequireDefault(_typeof$b.exports);
81626
81608
  var _mathjaxScript = mathjaxScript;
81627
81609
  var _normalization = normalization$1;
@@ -81672,17 +81654,22 @@ getDefaultExportFromCjs(mathRendering);
81672
81654
  };
81673
81655
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
81674
81656
  var NEWLINE_LATEX = '\\newline ';
81657
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
81658
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
81675
81659
  var getGlobal = function getGlobal() {
81676
81660
  if (typeof window !== 'undefined') {
81677
- if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
81678
- window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
81661
+ if (!window[mathRenderingAccessibleKEY]) {
81662
+ window[mathRenderingAccessibleKEY] = {};
81679
81663
  }
81680
- return window[_mathjaxScript.mathRenderingAccessibleKEY];
81664
+ return window[mathRenderingAccessibleKEY];
81681
81665
  } else {
81682
81666
  return {};
81683
81667
  }
81684
81668
  };
81685
81669
  exports.getGlobal = getGlobal;
81670
+ var defaultOpts = function defaultOpts() {
81671
+ return getGlobal().opts || ({});
81672
+ };
81686
81673
  var fixMathElement = function fixMathElement(element) {
81687
81674
  if (element.dataset.mathHandled) {
81688
81675
  return;
@@ -81747,84 +81734,80 @@ getDefaultExportFromCjs(mathRendering);
81747
81734
  }
81748
81735
  });
81749
81736
  };
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
- }
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);
81780
81740
  };
81781
- exports.initializeMathJaxScript = initializeMathJaxScript;
81782
81741
  var renderMath = function renderMath(el, renderOpts) {
81783
81742
  var isString = typeof el === 'string';
81784
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81785
81743
  var executeOn = document.body;
81786
81744
  if (isString) {
81787
81745
  var div = document.createElement('div');
81788
81746
  div.innerHTML = el;
81789
81747
  executeOn = div;
81790
81748
  }
81749
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81791
81750
  var renderMathAccessible = function renderMathAccessible() {
81792
81751
  fixMathElements(executeOn);
81793
81752
  adjustMathMLStyle(executeOn);
81794
- if (!window.MathJaxInitialised) {
81795
- (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
81796
- return processMathJaxFullPage(executeOn);
81797
- });
81798
- return;
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);
81799
81757
  }
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 '';
81815
- }
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);
81816
81771
  }
81817
- processMathJaxFullPage(executeOn);
81772
+ }
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
+ });
81797
+ }
81798
+ })["catch"](function (error) {
81799
+ console.error('Error in initializing MathJax:', error);
81800
+ });
81818
81801
  }
81819
81802
  };
81820
81803
  if (skipWaitForMathRenderingLib) {
81821
81804
  return renderMathAccessible();
81822
81805
  } else {
81823
- if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
81806
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
81824
81807
  removePlaceholdersAndRestoreDisplay();
81825
81808
  return mr.renderMath(executeOn, renderOpts);
81826
81809
  }
81827
- if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
81810
+ if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
81828
81811
  return renderMathAccessible();
81829
81812
  }
81830
81813
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -81834,7 +81817,7 @@ getDefaultExportFromCjs(mathRendering);
81834
81817
  var maxWaitTime = 500;
81835
81818
  var startTime = Date.now();
81836
81819
  var checkForLib = function checkForLib() {
81837
- var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
81820
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
81838
81821
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
81839
81822
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
81840
81823
  clearInterval(checkIntervalId);
@@ -81869,16 +81852,9 @@ var mmlToLatex = {};
81869
81852
  getDefaultExportFromCjs(mmlToLatex);
81870
81853
  (function (exports) {
81871
81854
  var _interopRequireDefault = interopRequireDefault.exports;
81872
- var _typeof = _typeof$b.exports;
81873
81855
  Object.defineProperty(exports, "__esModule", {
81874
81856
  value: true
81875
81857
  });
81876
- Object.defineProperty(exports, "initializeMathJaxScript", {
81877
- enumerable: true,
81878
- get: function get() {
81879
- return _renderMath.initializeMathJaxScript;
81880
- }
81881
- });
81882
81858
  Object.defineProperty(exports, "mmlToLatex", {
81883
81859
  enumerable: true,
81884
81860
  get: function get() {
@@ -81903,48 +81879,9 @@ getDefaultExportFromCjs(mmlToLatex);
81903
81879
  return _normalization.wrapMath;
81904
81880
  }
81905
81881
  });
81906
- var _renderMath = _interopRequireWildcard(renderMath$2);
81882
+ var _renderMath = _interopRequireDefault(renderMath$2);
81907
81883
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
81908
81884
  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
- }
81948
81885
  })(mathRenderingAccessible);
81949
81886
  getDefaultExportFromCjs(mathRenderingAccessible);
81950
81887
  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.2"
7
+ "version": "1.24.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",