@pie-element/select-text 8.11.1-next.9 → 8.11.2-next.6

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.11.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text@8.11.0...@pie-element/select-text@8.11.1) (2024-04-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-3683, PD-3644 ([73734c5](https://github.com/pie-framework/pie-elements/commit/73734c50a1e4fcda6be4f67c725816d75aea222f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [8.11.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text@8.10.1...@pie-element/select-text@8.11.0) (2024-04-22)
7
18
 
8
19
 
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.10.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text-configure@7.10.0...@pie-element/select-text-configure@7.10.1) (2024-04-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-3683, PD-3644 ([73734c5](https://github.com/pie-framework/pie-elements/commit/73734c50a1e4fcda6be4f67c725816d75aea222f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [7.10.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text-configure@7.9.1...@pie-element/select-text-configure@7.10.0) (2024-04-22)
7
18
 
8
19
 
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/select-text-configure",
3
3
  "private": true,
4
- "version": "7.10.0",
4
+ "version": "7.10.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
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.16.0",
11
+ "@pie-lib/pie-toolbox": "1.16.4",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "prop-types": "^15.6.2",
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.9.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text-controller@5.9.0...@pie-element/select-text-controller@5.9.1) (2024-04-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-3683, PD-3644 ([73734c5](https://github.com/pie-framework/pie-elements/commit/73734c50a1e4fcda6be4f67c725816d75aea222f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.9.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/select-text-controller@5.8.1...@pie-element/select-text-controller@5.9.0) (2024-04-22)
7
18
 
8
19
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pie-element/select-text-controller",
3
3
  "private": true,
4
- "version": "5.9.0",
4
+ "version": "5.9.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
8
8
  "dependencies": {
9
- "@pie-lib/pie-toolbox": "1.16.0",
9
+ "@pie-lib/pie-toolbox": "1.16.4",
10
10
  "debug": "^3.1.0",
11
11
  "lodash": "^4.17.15"
12
12
  },
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_react_dom_server} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.9.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_react_dom_server} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.9.3/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@4.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) {
@@ -103606,13 +103606,14 @@ getDefaultExportFromCjs(mathRendering);
103606
103606
  };
103607
103607
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
103608
103608
  var NEWLINE_LATEX = '\\newline ';
103609
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
103610
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
103609
103611
  var getGlobal = function getGlobal() {
103610
- var key = '@pie-lib/math-rendering-accessible@1';
103611
103612
  if (typeof window !== 'undefined') {
103612
- if (!window[key]) {
103613
- window[key] = {};
103613
+ if (!window[mathRenderingAccessibleKEY]) {
103614
+ window[mathRenderingAccessibleKEY] = {};
103614
103615
  }
103615
- return window[key];
103616
+ return window[mathRenderingAccessibleKEY];
103616
103617
  } else {
103617
103618
  return {};
103618
103619
  }
@@ -103674,22 +103675,6 @@ getDefaultExportFromCjs(mathRendering);
103674
103675
  placeholder.remove();
103675
103676
  });
103676
103677
  };
103677
- var waitForMathRenderingLib = function waitForMathRenderingLib(callback) {
103678
- if (window.hasOwnProperty('@pie-lib/math-rendering@2')) {
103679
- callback();
103680
- return;
103681
- }
103682
- var checkIntervalId;
103683
- var maxWaitTime = 500;
103684
- var startTime = Date.now();
103685
- var checkForLib = function checkForLib() {
103686
- if (window.hasOwnProperty('@pie-lib/math-rendering@2') || Date.now() - startTime > maxWaitTime) {
103687
- clearInterval(checkIntervalId);
103688
- callback();
103689
- }
103690
- };
103691
- checkIntervalId = setInterval(checkForLib, 100);
103692
- };
103693
103678
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
103694
103679
  var elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
103695
103680
  elements.forEach(function (element) {
@@ -103701,9 +103686,11 @@ getDefaultExportFromCjs(mathRendering);
103701
103686
  }
103702
103687
  });
103703
103688
  };
103689
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
103690
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
103691
+ 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);
103692
+ };
103704
103693
  var renderMath = function renderMath(el, renderOpts) {
103705
- renderOpts = renderOpts || defaultOpts();
103706
- var _renderOpts = renderOpts, skipWaitForMathRenderingLib = _renderOpts.skipWaitForMathRenderingLib;
103707
103694
  var isString = typeof el === 'string';
103708
103695
  var executeOn = document.body;
103709
103696
  if (isString) {
@@ -103711,16 +103698,13 @@ getDefaultExportFromCjs(mathRendering);
103711
103698
  div.innerHTML = el;
103712
103699
  executeOn = div;
103713
103700
  }
103714
- var unprocessedMathElements = executeOn.querySelectorAll('[data-latex]:not([data-math-handled="true"])');
103715
- unprocessedMathElements.forEach(createPlaceholder);
103716
- var mathRenderingCallback = function mathRenderingCallback() {
103701
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
103702
+ var renderMathAccessible = function renderMathAccessible() {
103717
103703
  fixMathElements(executeOn);
103718
103704
  adjustMathMLStyle(executeOn);
103719
- if (window.hasOwnProperty('@pie-lib/math-rendering@2')) {
103720
- removePlaceholdersAndRestoreDisplay();
103721
- return mr.renderMath(el);
103722
- }
103723
- if (!window.MathJax && !window.mathjaxLoadedP || window.MathJax && !window.hasOwnProperty('@pie-lib/math-rendering-accessible@1')) {
103705
+ var mathJaxCustomKey = getMathJaxCustomKey();
103706
+ if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
103707
+ renderOpts = renderOpts || defaultOpts();
103724
103708
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
103725
103709
  }
103726
103710
  if (isString && window.MathJax && window.mathjaxLoadedP) {
@@ -103769,9 +103753,36 @@ getDefaultExportFromCjs(mathRendering);
103769
103753
  }
103770
103754
  };
103771
103755
  if (skipWaitForMathRenderingLib) {
103772
- return mathRenderingCallback();
103756
+ return renderMathAccessible();
103773
103757
  } else {
103774
- waitForMathRenderingLib(mathRenderingCallback);
103758
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
103759
+ removePlaceholdersAndRestoreDisplay();
103760
+ return mr.renderMath();
103761
+ }
103762
+ if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
103763
+ return renderMathAccessible();
103764
+ }
103765
+ var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
103766
+ var mathElements = executeOn.querySelectorAll('[data-latex]');
103767
+ mathElements.forEach(createPlaceholder);
103768
+ var checkIntervalId;
103769
+ var maxWaitTime = 500;
103770
+ var startTime = Date.now();
103771
+ var checkForLib = function checkForLib() {
103772
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
103773
+ var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
103774
+ if (mathRenderingHasLoaded || hasExceededMaxWait) {
103775
+ clearInterval(checkIntervalId);
103776
+ if (mathRenderingHasLoaded) {
103777
+ removePlaceholdersAndRestoreDisplay();
103778
+ return mr.renderMath();
103779
+ }
103780
+ renderMathAccessibleCallback();
103781
+ }
103782
+ };
103783
+ checkIntervalId = setInterval(checkForLib, 100);
103784
+ };
103785
+ waitForMathRenderingLib(renderMathAccessible);
103775
103786
  }
103776
103787
  };
103777
103788
  var _default = renderMath;
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_debug, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.9.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_debug, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.9.3/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.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) {
@@ -100434,13 +100434,14 @@ getDefaultExportFromCjs(mathRendering);
100434
100434
  };
100435
100435
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
100436
100436
  var NEWLINE_LATEX = '\\newline ';
100437
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
100438
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
100437
100439
  var getGlobal = function getGlobal() {
100438
- var key = '@pie-lib/math-rendering-accessible@1';
100439
100440
  if (typeof window !== 'undefined') {
100440
- if (!window[key]) {
100441
- window[key] = {};
100441
+ if (!window[mathRenderingAccessibleKEY]) {
100442
+ window[mathRenderingAccessibleKEY] = {};
100442
100443
  }
100443
- return window[key];
100444
+ return window[mathRenderingAccessibleKEY];
100444
100445
  } else {
100445
100446
  return {};
100446
100447
  }
@@ -100502,22 +100503,6 @@ getDefaultExportFromCjs(mathRendering);
100502
100503
  placeholder.remove();
100503
100504
  });
100504
100505
  };
100505
- var waitForMathRenderingLib = function waitForMathRenderingLib(callback) {
100506
- if (window.hasOwnProperty('@pie-lib/math-rendering@2')) {
100507
- callback();
100508
- return;
100509
- }
100510
- var checkIntervalId;
100511
- var maxWaitTime = 500;
100512
- var startTime = Date.now();
100513
- var checkForLib = function checkForLib() {
100514
- if (window.hasOwnProperty('@pie-lib/math-rendering@2') || Date.now() - startTime > maxWaitTime) {
100515
- clearInterval(checkIntervalId);
100516
- callback();
100517
- }
100518
- };
100519
- checkIntervalId = setInterval(checkForLib, 100);
100520
- };
100521
100506
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
100522
100507
  var elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
100523
100508
  elements.forEach(function (element) {
@@ -100529,9 +100514,11 @@ getDefaultExportFromCjs(mathRendering);
100529
100514
  }
100530
100515
  });
100531
100516
  };
100517
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
100518
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
100519
+ 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);
100520
+ };
100532
100521
  var renderMath = function renderMath(el, renderOpts) {
100533
- renderOpts = renderOpts || defaultOpts();
100534
- var _renderOpts = renderOpts, skipWaitForMathRenderingLib = _renderOpts.skipWaitForMathRenderingLib;
100535
100522
  var isString = typeof el === 'string';
100536
100523
  var executeOn = document.body;
100537
100524
  if (isString) {
@@ -100539,16 +100526,13 @@ getDefaultExportFromCjs(mathRendering);
100539
100526
  div.innerHTML = el;
100540
100527
  executeOn = div;
100541
100528
  }
100542
- var unprocessedMathElements = executeOn.querySelectorAll('[data-latex]:not([data-math-handled="true"])');
100543
- unprocessedMathElements.forEach(createPlaceholder);
100544
- var mathRenderingCallback = function mathRenderingCallback() {
100529
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
100530
+ var renderMathAccessible = function renderMathAccessible() {
100545
100531
  fixMathElements(executeOn);
100546
100532
  adjustMathMLStyle(executeOn);
100547
- if (window.hasOwnProperty('@pie-lib/math-rendering@2')) {
100548
- removePlaceholdersAndRestoreDisplay();
100549
- return mr.renderMath(el);
100550
- }
100551
- if (!window.MathJax && !window.mathjaxLoadedP || window.MathJax && !window.hasOwnProperty('@pie-lib/math-rendering-accessible@1')) {
100533
+ var mathJaxCustomKey = getMathJaxCustomKey();
100534
+ if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
100535
+ renderOpts = renderOpts || defaultOpts();
100552
100536
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
100553
100537
  }
100554
100538
  if (isString && window.MathJax && window.mathjaxLoadedP) {
@@ -100597,9 +100581,36 @@ getDefaultExportFromCjs(mathRendering);
100597
100581
  }
100598
100582
  };
100599
100583
  if (skipWaitForMathRenderingLib) {
100600
- return mathRenderingCallback();
100584
+ return renderMathAccessible();
100601
100585
  } else {
100602
- waitForMathRenderingLib(mathRenderingCallback);
100586
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
100587
+ removePlaceholdersAndRestoreDisplay();
100588
+ return mr.renderMath();
100589
+ }
100590
+ if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
100591
+ return renderMathAccessible();
100592
+ }
100593
+ var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
100594
+ var mathElements = executeOn.querySelectorAll('[data-latex]');
100595
+ mathElements.forEach(createPlaceholder);
100596
+ var checkIntervalId;
100597
+ var maxWaitTime = 500;
100598
+ var startTime = Date.now();
100599
+ var checkForLib = function checkForLib() {
100600
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
100601
+ var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
100602
+ if (mathRenderingHasLoaded || hasExceededMaxWait) {
100603
+ clearInterval(checkIntervalId);
100604
+ if (mathRenderingHasLoaded) {
100605
+ removePlaceholdersAndRestoreDisplay();
100606
+ return mr.renderMath();
100607
+ }
100608
+ renderMathAccessibleCallback();
100609
+ }
100610
+ };
100611
+ checkIntervalId = setInterval(checkForLib, 100);
100612
+ };
100613
+ waitForMathRenderingLib(renderMathAccessible);
100603
100614
  }
100604
100615
  };
100605
100616
  var _default = renderMath;
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/select-text@8.11.0</title>
5
+ <title>@pie-element/select-text@8.11.1</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@pie-element/select-text",
3
- "version": "8.11.0",
3
+ "version": "8.11.1",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.9.1"
7
+ "version": "1.9.3"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/select-text@8.11.0</title>
5
+ <title>@pie-element/select-text@8.11.1</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_debug, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.9.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_debug, _dll_react_dom_server, _dll_pie_lib__pie_toolbox_math_rendering_accessible} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.9.3/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.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) {
@@ -100397,13 +100397,14 @@ getDefaultExportFromCjs(mathRendering);
100397
100397
  };
100398
100398
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
100399
100399
  var NEWLINE_LATEX = '\\newline ';
100400
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
100401
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
100400
100402
  var getGlobal = function getGlobal() {
100401
- var key = '@pie-lib/math-rendering-accessible@1';
100402
100403
  if (typeof window !== 'undefined') {
100403
- if (!window[key]) {
100404
- window[key] = {};
100404
+ if (!window[mathRenderingAccessibleKEY]) {
100405
+ window[mathRenderingAccessibleKEY] = {};
100405
100406
  }
100406
- return window[key];
100407
+ return window[mathRenderingAccessibleKEY];
100407
100408
  } else {
100408
100409
  return {};
100409
100410
  }
@@ -100465,22 +100466,6 @@ getDefaultExportFromCjs(mathRendering);
100465
100466
  placeholder.remove();
100466
100467
  });
100467
100468
  };
100468
- var waitForMathRenderingLib = function waitForMathRenderingLib(callback) {
100469
- if (window.hasOwnProperty('@pie-lib/math-rendering@2')) {
100470
- callback();
100471
- return;
100472
- }
100473
- var checkIntervalId;
100474
- var maxWaitTime = 500;
100475
- var startTime = Date.now();
100476
- var checkForLib = function checkForLib() {
100477
- if (window.hasOwnProperty('@pie-lib/math-rendering@2') || Date.now() - startTime > maxWaitTime) {
100478
- clearInterval(checkIntervalId);
100479
- callback();
100480
- }
100481
- };
100482
- checkIntervalId = setInterval(checkForLib, 100);
100483
- };
100484
100469
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
100485
100470
  var elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
100486
100471
  elements.forEach(function (element) {
@@ -100492,9 +100477,11 @@ getDefaultExportFromCjs(mathRendering);
100492
100477
  }
100493
100478
  });
100494
100479
  };
100480
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
100481
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
100482
+ 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);
100483
+ };
100495
100484
  var renderMath = function renderMath(el, renderOpts) {
100496
- renderOpts = renderOpts || defaultOpts();
100497
- var _renderOpts = renderOpts, skipWaitForMathRenderingLib = _renderOpts.skipWaitForMathRenderingLib;
100498
100485
  var isString = typeof el === 'string';
100499
100486
  var executeOn = document.body;
100500
100487
  if (isString) {
@@ -100502,16 +100489,13 @@ getDefaultExportFromCjs(mathRendering);
100502
100489
  div.innerHTML = el;
100503
100490
  executeOn = div;
100504
100491
  }
100505
- var unprocessedMathElements = executeOn.querySelectorAll('[data-latex]:not([data-math-handled="true"])');
100506
- unprocessedMathElements.forEach(createPlaceholder);
100507
- var mathRenderingCallback = function mathRenderingCallback() {
100492
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
100493
+ var renderMathAccessible = function renderMathAccessible() {
100508
100494
  fixMathElements(executeOn);
100509
100495
  adjustMathMLStyle(executeOn);
100510
- if (window.hasOwnProperty('@pie-lib/math-rendering@2')) {
100511
- removePlaceholdersAndRestoreDisplay();
100512
- return mr.renderMath(el);
100513
- }
100514
- if (!window.MathJax && !window.mathjaxLoadedP || window.MathJax && !window.hasOwnProperty('@pie-lib/math-rendering-accessible@1')) {
100496
+ var mathJaxCustomKey = getMathJaxCustomKey();
100497
+ if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
100498
+ renderOpts = renderOpts || defaultOpts();
100515
100499
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
100516
100500
  }
100517
100501
  if (isString && window.MathJax && window.mathjaxLoadedP) {
@@ -100560,9 +100544,36 @@ getDefaultExportFromCjs(mathRendering);
100560
100544
  }
100561
100545
  };
100562
100546
  if (skipWaitForMathRenderingLib) {
100563
- return mathRenderingCallback();
100547
+ return renderMathAccessible();
100564
100548
  } else {
100565
- waitForMathRenderingLib(mathRenderingCallback);
100549
+ if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
100550
+ removePlaceholdersAndRestoreDisplay();
100551
+ return mr.renderMath();
100552
+ }
100553
+ if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
100554
+ return renderMathAccessible();
100555
+ }
100556
+ var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
100557
+ var mathElements = executeOn.querySelectorAll('[data-latex]');
100558
+ mathElements.forEach(createPlaceholder);
100559
+ var checkIntervalId;
100560
+ var maxWaitTime = 500;
100561
+ var startTime = Date.now();
100562
+ var checkForLib = function checkForLib() {
100563
+ var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
100564
+ var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
100565
+ if (mathRenderingHasLoaded || hasExceededMaxWait) {
100566
+ clearInterval(checkIntervalId);
100567
+ if (mathRenderingHasLoaded) {
100568
+ removePlaceholdersAndRestoreDisplay();
100569
+ return mr.renderMath();
100570
+ }
100571
+ renderMathAccessibleCallback();
100572
+ }
100573
+ };
100574
+ checkIntervalId = setInterval(checkForLib, 100);
100575
+ };
100576
+ waitForMathRenderingLib(renderMathAccessible);
100566
100577
  }
100567
100578
  };
100568
100579
  var _default = renderMath;
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "8.11.1-next.9+e026ec0fb",
7
+ "version": "8.11.2-next.6+a8bb09f90",
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.16.0",
12
+ "@pie-lib/pie-toolbox": "1.16.4",
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": "e026ec0fbd2c31d68252919a02d2f90c3d5c031c",
19
+ "gitHead": "a8bb09f9065b56fcfc103c732db52b4f82c8dbe9",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },