@pie-element/explicit-constructed-response 7.0.1-next.4 → 7.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
  "@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": "2.0.7",
11
+ "@pie-lib/pie-toolbox": "2.0.8",
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": "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
  "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@2.0.5/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.4/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.6/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.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;
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@2.0.5/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.4/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.6/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.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;
@@ -26231,6 +26231,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26231
26231
  return node.setAttribute("displaystyle", "true");
26232
26232
  });
26233
26233
  };
26234
+ var createPlaceholder = function createPlaceholder(element) {
26235
+ var _element$previousSibl;
26236
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
26237
+ var _element$parentNode;
26238
+ element.dataset.originalDisplay = element.style.display || "";
26239
+ element.style.display = "none";
26240
+ var placeholder = document.createElement("span");
26241
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
26242
+ placeholder.classList.add("math-placeholder");
26243
+ (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
26244
+ }
26245
+ };
26246
+ var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
26247
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
26248
+ var _targetElement$datase;
26249
+ var targetElement = placeholder.nextElementSibling;
26250
+ if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
26251
+ targetElement.style.display = targetElement.dataset.originalDisplay;
26252
+ delete targetElement.dataset.originalDisplay;
26253
+ }
26254
+ placeholder.remove();
26255
+ });
26256
+ };
26234
26257
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
26235
26258
  var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
26236
26259
  elements.forEach(function (element) {
@@ -26253,6 +26276,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26253
26276
  mathJaxInstance.typesetClear();
26254
26277
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
26255
26278
  try {
26279
+ removePlaceholdersAndRestoreDisplay();
26256
26280
  removeExcessMjxContainers(executeOn);
26257
26281
  var updatedDocument = mathJaxInstance.startup.document;
26258
26282
  var list = updatedDocument.math.list;
@@ -26339,6 +26363,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26339
26363
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
26340
26364
  script.async = true;
26341
26365
  document.head.appendChild(script);
26366
+ setTimeout(function () {
26367
+ if (!window.mathjaxLoadedComplete) {
26368
+ var _document, _document$body;
26369
+ 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]");
26370
+ (mathElements || []).forEach(createPlaceholder);
26371
+ }
26372
+ });
26342
26373
  });
26343
26374
  };
26344
26375
  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_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.5/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.4/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.6/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.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;
@@ -26194,6 +26194,29 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26194
26194
  return node.setAttribute("displaystyle", "true");
26195
26195
  });
26196
26196
  };
26197
+ var createPlaceholder = function createPlaceholder(element) {
26198
+ var _element$previousSibl;
26199
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) !== null && _element$previousSibl !== void 0 && _element$previousSibl.contains("math-placeholder"))) {
26200
+ var _element$parentNode;
26201
+ element.dataset.originalDisplay = element.style.display || "";
26202
+ element.style.display = "none";
26203
+ var placeholder = document.createElement("span");
26204
+ placeholder.style.cssText = "height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;";
26205
+ placeholder.classList.add("math-placeholder");
26206
+ (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.insertBefore(placeholder, element);
26207
+ }
26208
+ };
26209
+ var removePlaceholdersAndRestoreDisplay = function removePlaceholdersAndRestoreDisplay() {
26210
+ document.querySelectorAll(".math-placeholder").forEach(function (placeholder) {
26211
+ var _targetElement$datase;
26212
+ var targetElement = placeholder.nextElementSibling;
26213
+ if (targetElement && ((_targetElement$datase = targetElement.dataset) === null || _targetElement$datase === void 0 ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
26214
+ targetElement.style.display = targetElement.dataset.originalDisplay;
26215
+ delete targetElement.dataset.originalDisplay;
26216
+ }
26217
+ placeholder.remove();
26218
+ });
26219
+ };
26197
26220
  var removeExcessMjxContainers = function removeExcessMjxContainers(content) {
26198
26221
  var elements = content.querySelectorAll("[data-latex][data-math-handled=\"true\"]");
26199
26222
  elements.forEach(function (element) {
@@ -26216,6 +26239,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26216
26239
  mathJaxInstance.typesetClear();
26217
26240
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
26218
26241
  try {
26242
+ removePlaceholdersAndRestoreDisplay();
26219
26243
  removeExcessMjxContainers(executeOn);
26220
26244
  var updatedDocument = mathJaxInstance.startup.document;
26221
26245
  var list = updatedDocument.math.list;
@@ -26302,6 +26326,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26302
26326
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
26303
26327
  script.async = true;
26304
26328
  document.head.appendChild(script);
26329
+ setTimeout(function () {
26330
+ if (!window.mathjaxLoadedComplete) {
26331
+ var _document, _document$body;
26332
+ 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]");
26333
+ (mathElements || []).forEach(createPlaceholder);
26334
+ }
26335
+ });
26305
26336
  });
26306
26337
  };
26307
26338
  exports.initializeMathJax = initializeMathJax;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "7.0.1-next.4+fe8329644",
7
+ "version": "7.0.1-next.5+c363be48f",
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": "2.0.7",
15
+ "@pie-lib/pie-toolbox": "2.0.8",
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": "fe83296445f9785e67c9643642221b28b4485921",
24
+ "gitHead": "c363be48f9428024d4acc1eed05cd598840ffe3a",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {