@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/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.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) {
@@ -21811,49 +21811,34 @@ var mathjaxScript = {};
21811
21811
  Object.defineProperty(mathjaxScript, "__esModule", {
21812
21812
  value: true
21813
21813
  });
21814
- mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21814
+ 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 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
- };
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) {
21857
21842
  window.MathJax = {
21858
21843
  startup: {
21859
21844
  typeset: false,
@@ -21872,10 +21857,7 @@ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFul
21872
21857
  MathJax.startup.defaultReady();
21873
21858
  var globalObj = (0, _renderMath.getGlobal)();
21874
21859
  globalObj.instance = MathJax;
21875
- if (processMathJaxFullPage) {
21876
- processMathJaxFullPage();
21877
- }
21878
- window.MathJaxLoaded = true;
21860
+ resolve();
21879
21861
  }
21880
21862
  },
21881
21863
  loader: {
@@ -21906,7 +21888,7 @@ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFul
21906
21888
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
21907
21889
  script.async = true;
21908
21890
  document.body.appendChild(script);
21909
- }
21891
+ });
21910
21892
  };
21911
21893
  mathjaxScript.initializeMathJax = initializeMathJax;
21912
21894
  var normalization$1 = {};
@@ -81584,7 +81566,7 @@ getDefaultExportFromCjs(mathRendering);
81584
81566
  Object.defineProperty(exports, "__esModule", {
81585
81567
  value: true
81586
81568
  });
81587
- exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81569
+ exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
81588
81570
  var _typeof2 = _interopRequireDefault(_typeof$b.exports);
81589
81571
  var _mathjaxScript = mathjaxScript;
81590
81572
  var _normalization = normalization$1;
@@ -81635,17 +81617,22 @@ getDefaultExportFromCjs(mathRendering);
81635
81617
  };
81636
81618
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
81637
81619
  var NEWLINE_LATEX = '\\newline ';
81620
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
81621
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
81638
81622
  var getGlobal = function getGlobal() {
81639
81623
  if (typeof window !== 'undefined') {
81640
- if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
81641
- window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
81624
+ if (!window[mathRenderingAccessibleKEY]) {
81625
+ window[mathRenderingAccessibleKEY] = {};
81642
81626
  }
81643
- return window[_mathjaxScript.mathRenderingAccessibleKEY];
81627
+ return window[mathRenderingAccessibleKEY];
81644
81628
  } else {
81645
81629
  return {};
81646
81630
  }
81647
81631
  };
81648
81632
  exports.getGlobal = getGlobal;
81633
+ var defaultOpts = function defaultOpts() {
81634
+ return getGlobal().opts || ({});
81635
+ };
81649
81636
  var fixMathElement = function fixMathElement(element) {
81650
81637
  if (element.dataset.mathHandled) {
81651
81638
  return;
@@ -81710,84 +81697,80 @@ getDefaultExportFromCjs(mathRendering);
81710
81697
  }
81711
81698
  });
81712
81699
  };
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
- }
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);
81743
81703
  };
81744
- exports.initializeMathJaxScript = initializeMathJaxScript;
81745
81704
  var renderMath = function renderMath(el, renderOpts) {
81746
81705
  var isString = typeof el === 'string';
81747
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81748
81706
  var executeOn = document.body;
81749
81707
  if (isString) {
81750
81708
  var div = document.createElement('div');
81751
81709
  div.innerHTML = el;
81752
81710
  executeOn = div;
81753
81711
  }
81712
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
81754
81713
  var renderMathAccessible = function renderMathAccessible() {
81755
81714
  fixMathElements(executeOn);
81756
81715
  adjustMathMLStyle(executeOn);
81757
- if (!window.MathJaxInitialised) {
81758
- (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
81759
- return processMathJaxFullPage(executeOn);
81760
- });
81761
- return;
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);
81762
81720
  }
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 '';
81778
- }
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);
81779
81734
  }
81780
- processMathJaxFullPage(executeOn);
81735
+ }
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
+ });
81760
+ }
81761
+ })["catch"](function (error) {
81762
+ console.error('Error in initializing MathJax:', error);
81763
+ });
81781
81764
  }
81782
81765
  };
81783
81766
  if (skipWaitForMathRenderingLib) {
81784
81767
  return renderMathAccessible();
81785
81768
  } else {
81786
- if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
81769
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
81787
81770
  removePlaceholdersAndRestoreDisplay();
81788
81771
  return mr.renderMath(executeOn, renderOpts);
81789
81772
  }
81790
- if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
81773
+ if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
81791
81774
  return renderMathAccessible();
81792
81775
  }
81793
81776
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -81797,7 +81780,7 @@ getDefaultExportFromCjs(mathRendering);
81797
81780
  var maxWaitTime = 500;
81798
81781
  var startTime = Date.now();
81799
81782
  var checkForLib = function checkForLib() {
81800
- var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
81783
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
81801
81784
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
81802
81785
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
81803
81786
  clearInterval(checkIntervalId);
@@ -81832,16 +81815,9 @@ var mmlToLatex = {};
81832
81815
  getDefaultExportFromCjs(mmlToLatex);
81833
81816
  (function (exports) {
81834
81817
  var _interopRequireDefault = interopRequireDefault.exports;
81835
- var _typeof = _typeof$b.exports;
81836
81818
  Object.defineProperty(exports, "__esModule", {
81837
81819
  value: true
81838
81820
  });
81839
- Object.defineProperty(exports, "initializeMathJaxScript", {
81840
- enumerable: true,
81841
- get: function get() {
81842
- return _renderMath.initializeMathJaxScript;
81843
- }
81844
- });
81845
81821
  Object.defineProperty(exports, "mmlToLatex", {
81846
81822
  enumerable: true,
81847
81823
  get: function get() {
@@ -81866,48 +81842,9 @@ getDefaultExportFromCjs(mmlToLatex);
81866
81842
  return _normalization.wrapMath;
81867
81843
  }
81868
81844
  });
81869
- var _renderMath = _interopRequireWildcard(renderMath$3);
81845
+ var _renderMath = _interopRequireDefault(renderMath$3);
81870
81846
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
81871
81847
  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
- }
81911
81848
  })(mathRenderingAccessible);
81912
81849
  getDefaultExportFromCjs(mathRenderingAccessible);
81913
81850
  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.8+1dd6cd9ce",
7
+ "version": "2.22.3",
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.31.0",
12
+ "@pie-lib/pie-toolbox": "1.31.3",
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": "1dd6cd9ce2b68e511748963f567e94c1af5cb32c",
19
+ "gitHead": "8c0b9d9d91490c958440ece9a2c018acecbf7c5c",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },