@pie-element/math-templated 3.0.1-next.4 → 3.0.1-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "2.0.7",
11
+ "@pie-lib/pie-toolbox": "2.0.8",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "prop-types": "^15.6.2",
@@ -7,7 +7,7 @@
7
7
  "module": "src/index.js",
8
8
  "dependencies": {
9
9
  "@pie-framework/math-validation": "^1.2.2",
10
- "@pie-lib/pie-toolbox": "2.0.7",
10
+ "@pie-lib/pie-toolbox": "2.0.8",
11
11
  "debug": "^3.1.0",
12
12
  "lodash": "^4.17.15"
13
13
  },
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.5/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@5.0.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash} from "../../../@pie-lib/pie-toolbox-math-rendering-module@2.0.6/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_editable_html} from "../../../@pie-lib/pie-toolbox-module@5.0.5/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;
@@ -50037,6 +50037,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
50037
50037
  return node.setAttribute("displaystyle", "true");
50038
50038
  });
50039
50039
  };
50040
+ var createPlaceholder = function createPlaceholder(element) {
50041
+ var _element$previousSibl;
50042
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
50043
+ var _element$parentNode;
50044
+ element.dataset.originalDisplay = element.style.display || "";
50045
+ element.style.display = "none";
50046
+ var placeholder = document.createElement("span");
50047
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
50048
+ placeholder.classList.add("math-placeholder");
50049
+ (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
50050
+ }
50051
+ };
50052
+ var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
50053
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
50054
+ var _targetElement$datase;
50055
+ var targetElement = placeholder.nextElementSibling;
50056
+ if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
50057
+ targetElement.style.display = targetElement.dataset.originalDisplay;
50058
+ delete targetElement.dataset.originalDisplay;
50059
+ }
50060
+ placeholder.remove();
50061
+ });
50062
+ };
50040
50063
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
50041
50064
  var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
50042
50065
  elements.forEach(function (element) {
@@ -50059,6 +50082,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
50059
50082
  mathJaxInstance.typesetClear();
50060
50083
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
50061
50084
  try {
50085
+ removePlaceholdersAndRestoreDisplay();
50062
50086
  removeExcessMjxContainers(executeOn);
50063
50087
  var updatedDocument = mathJaxInstance.startup.document;
50064
50088
  var list = updatedDocument.math.list;
@@ -50145,6 +50169,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
50145
50169
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
50146
50170
  script.async = true;
50147
50171
  document.head.appendChild(script);
50172
+ setTimeout(function () {
50173
+ if (!window.mathjaxLoadedComplete) {
50174
+ var _document, _document$body;
50175
+ var mathElements = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.querySelectorAll("[data-latex]");
50176
+ (mathElements || []).forEach(createPlaceholder);
50177
+ }
50178
+ });
50148
50179
  });
50149
50180
  };
50150
50181
  exports.initializeMathJax = initializeMathJax;
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
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@2.0.5/module/index.js";
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@5.0.4/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@2.0.6/module/index.js";
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@5.0.5/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;
@@ -28927,6 +28927,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
28927
28927
  return node.setAttribute("displaystyle", "true");
28928
28928
  });
28929
28929
  };
28930
+ var createPlaceholder = function createPlaceholder(element) {
28931
+ var _element$previousSibl;
28932
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
28933
+ var _element$parentNode;
28934
+ element.dataset.originalDisplay = element.style.display || "";
28935
+ element.style.display = "none";
28936
+ var placeholder = document.createElement("span");
28937
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
28938
+ placeholder.classList.add("math-placeholder");
28939
+ (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
28940
+ }
28941
+ };
28942
+ var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
28943
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
28944
+ var _targetElement$datase;
28945
+ var targetElement = placeholder.nextElementSibling;
28946
+ if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
28947
+ targetElement.style.display = targetElement.dataset.originalDisplay;
28948
+ delete targetElement.dataset.originalDisplay;
28949
+ }
28950
+ placeholder.remove();
28951
+ });
28952
+ };
28930
28953
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
28931
28954
  var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
28932
28955
  elements.forEach(function (element) {
@@ -28949,6 +28972,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
28949
28972
  mathJaxInstance.typesetClear();
28950
28973
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
28951
28974
  try {
28975
+ removePlaceholdersAndRestoreDisplay();
28952
28976
  removeExcessMjxContainers(executeOn);
28953
28977
  var updatedDocument = mathJaxInstance.startup.document;
28954
28978
  var list = updatedDocument.math.list;
@@ -29035,6 +29059,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
29035
29059
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
29036
29060
  script.async = true;
29037
29061
  document.head.appendChild(script);
29062
+ setTimeout(function () {
29063
+ if (!window.mathjaxLoadedComplete) {
29064
+ var _document, _document$body;
29065
+ var mathElements = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.querySelectorAll("[data-latex]");
29066
+ (mathElements || []).forEach(createPlaceholder);
29067
+ }
29068
+ });
29038
29069
  });
29039
29070
  };
29040
29071
  exports.initializeMathJax = initializeMathJax;
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "2.0.5"
7
+ "version": "2.0.6"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.0.4"
11
+ "version": "5.0.5"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
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@2.0.5/module/index.js";
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@5.0.4/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@2.0.6/module/index.js";
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@5.0.5/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;
@@ -28890,6 +28890,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
28890
28890
  return node.setAttribute("displaystyle", "true");
28891
28891
  });
28892
28892
  };
28893
+ var createPlaceholder = function createPlaceholder(element) {
28894
+ var _element$previousSibl;
28895
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
28896
+ var _element$parentNode;
28897
+ element.dataset.originalDisplay = element.style.display || "";
28898
+ element.style.display = "none";
28899
+ var placeholder = document.createElement("span");
28900
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
28901
+ placeholder.classList.add("math-placeholder");
28902
+ (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
28903
+ }
28904
+ };
28905
+ var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
28906
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
28907
+ var _targetElement$datase;
28908
+ var targetElement = placeholder.nextElementSibling;
28909
+ if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
28910
+ targetElement.style.display = targetElement.dataset.originalDisplay;
28911
+ delete targetElement.dataset.originalDisplay;
28912
+ }
28913
+ placeholder.remove();
28914
+ });
28915
+ };
28893
28916
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
28894
28917
  var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
28895
28918
  elements.forEach(function (element) {
@@ -28912,6 +28935,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
28912
28935
  mathJaxInstance.typesetClear();
28913
28936
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
28914
28937
  try {
28938
+ removePlaceholdersAndRestoreDisplay();
28915
28939
  removeExcessMjxContainers(executeOn);
28916
28940
  var updatedDocument = mathJaxInstance.startup.document;
28917
28941
  var list = updatedDocument.math.list;
@@ -28998,6 +29022,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
28998
29022
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
28999
29023
  script.async = true;
29000
29024
  document.head.appendChild(script);
29025
+ setTimeout(function () {
29026
+ if (!window.mathjaxLoadedComplete) {
29027
+ var _document, _document$body;
29028
+ var mathElements = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.querySelectorAll("[data-latex]");
29029
+ (mathElements || []).forEach(createPlaceholder);
29030
+ }
29031
+ });
29001
29032
  });
29002
29033
  };
29003
29034
  exports.initializeMathJax = initializeMathJax;
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "3.0.1-next.4+fe8329644",
7
+ "version": "3.0.1-next.5+c363be48f",
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": "2.0.7",
12
+ "@pie-lib/pie-toolbox": "2.0.8",
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": "fe83296445f9785e67c9643642221b28b4485921",
19
+ "gitHead": "c363be48f9428024d4acc1eed05cd598840ffe3a",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },