@pie-element/explicit-constructed-response 7.0.1-next.3 → 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.6",
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.6",
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.4/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.3/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.4/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.3/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) {
@@ -26244,6 +26267,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26244
26267
  };
26245
26268
  var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
26246
26269
  executeOn = executeOn || document.body;
26270
+ if (!(executeOn instanceof HTMLElement)) return;
26247
26271
  fixMathElements(executeOn);
26248
26272
  adjustMathMLStyle(executeOn);
26249
26273
  var mathJaxInstance = getGlobal().instance;
@@ -26252,6 +26276,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26252
26276
  mathJaxInstance.typesetClear();
26253
26277
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
26254
26278
  try {
26279
+ removePlaceholdersAndRestoreDisplay();
26255
26280
  removeExcessMjxContainers(executeOn);
26256
26281
  var updatedDocument = mathJaxInstance.startup.document;
26257
26282
  var list = updatedDocument.math.list;
@@ -26338,6 +26363,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26338
26363
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
26339
26364
  script.async = true;
26340
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
+ });
26341
26373
  });
26342
26374
  };
26343
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.4"
7
+ "version": "2.0.6"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.0.3"
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.4/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.3/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) {
@@ -26207,6 +26230,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26207
26230
  };
26208
26231
  var renderContentWithMathJax = function renderContentWithMathJax(executeOn) {
26209
26232
  executeOn = executeOn || document.body;
26233
+ if (!(executeOn instanceof HTMLElement)) return;
26210
26234
  fixMathElements(executeOn);
26211
26235
  adjustMathMLStyle(executeOn);
26212
26236
  var mathJaxInstance = getGlobal().instance;
@@ -26215,6 +26239,7 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26215
26239
  mathJaxInstance.typesetClear();
26216
26240
  mathJaxInstance.typesetPromise([executeOn]).then(function () {
26217
26241
  try {
26242
+ removePlaceholdersAndRestoreDisplay();
26218
26243
  removeExcessMjxContainers(executeOn);
26219
26244
  var updatedDocument = mathJaxInstance.startup.document;
26220
26245
  var list = updatedDocument.math.list;
@@ -26301,6 +26326,13 @@ getDefaultExportFromCjs(SerializedMmlVisitor);
26301
26326
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
26302
26327
  script.async = true;
26303
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
+ });
26304
26336
  });
26305
26337
  };
26306
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.3+321147b40",
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.6",
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": "321147b4072f2a6200d155f7f09c712960fe078c",
24
+ "gitHead": "c363be48f9428024d4acc1eed05cd598840ffe3a",
25
25
  "main": "lib/index.js",
26
26
  "module": "src/index.js",
27
27
  "exports": {