@pie-element/math-templated 2.20.1-next.13 → 2.20.1-next.14

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": "1.28.0",
11
+ "@pie-lib/pie-toolbox": "1.29.0",
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": "1.28.0",
10
+ "@pie-lib/pie-toolbox": "1.29.0",
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@1.21.0/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@4.12.0/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@1.21.1/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@4.23.1/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;
@@ -43053,8 +43053,10 @@ var mathjaxScript = {};
43053
43053
  Object.defineProperty(mathjaxScript, "__esModule", {
43054
43054
  value: true
43055
43055
  });
43056
- mathjaxScript.initializeMathJax = void 0;
43056
+ mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
43057
43057
  var _renderMath = renderMath$1;
43058
+ var MathJaxVersion = '3.2.2';
43059
+ mathjaxScript.MathJaxVersion = MathJaxVersion;
43058
43060
  var initializeMathJax = function initializeMathJax(renderOpts) {
43059
43061
  if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
43060
43062
  console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
@@ -43125,7 +43127,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
43125
43127
  };
43126
43128
  var script = document.createElement('script');
43127
43129
  script.type = 'text/javascript';
43128
- script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml-full.js';
43130
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
43129
43131
  script.async = true;
43130
43132
  document.body.appendChild(script);
43131
43133
  });
@@ -102814,7 +102816,7 @@ getDefaultExportFromCjs(mathRendering);
102814
102816
  fixMathElements(executeOn);
102815
102817
  adjustMathMLStyle(executeOn);
102816
102818
  var mathJaxCustomKey = getMathJaxCustomKey();
102817
- if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
102819
+ if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
102818
102820
  renderOpts = renderOpts || defaultOpts();
102819
102821
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
102820
102822
  }
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@1.21.0/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@4.12.0/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.21.1/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@4.23.1/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;
@@ -21848,8 +21848,10 @@ var mathjaxScript = {};
21848
21848
  Object.defineProperty(mathjaxScript, "__esModule", {
21849
21849
  value: true
21850
21850
  });
21851
- mathjaxScript.initializeMathJax = void 0;
21851
+ mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21852
21852
  var _renderMath = renderMath$2;
21853
+ var MathJaxVersion = '3.2.2';
21854
+ mathjaxScript.MathJaxVersion = MathJaxVersion;
21853
21855
  var initializeMathJax = function initializeMathJax(renderOpts) {
21854
21856
  if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
21855
21857
  console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
@@ -21920,7 +21922,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
21920
21922
  };
21921
21923
  var script = document.createElement('script');
21922
21924
  script.type = 'text/javascript';
21923
- script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml-full.js';
21925
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
21924
21926
  script.async = true;
21925
21927
  document.body.appendChild(script);
21926
21928
  });
@@ -81749,7 +81751,7 @@ getDefaultExportFromCjs(mathRendering);
81749
81751
  fixMathElements(executeOn);
81750
81752
  adjustMathMLStyle(executeOn);
81751
81753
  var mathJaxCustomKey = getMathJaxCustomKey();
81752
- if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
81754
+ if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
81753
81755
  renderOpts = renderOpts || defaultOpts();
81754
81756
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
81755
81757
  }
@@ -123951,6 +123953,27 @@ const {findKey: require$$10$5} = _dll_lodash;
123951
123953
  var _findKey = _interopRequireDefault(require$$10$5);
123952
123954
  var _choice = _interopRequireDefault(choice$1);
123953
123955
  var _dragInTheBlankDp = _interopRequireDefault(dragInTheBlankDp);
123956
+ function ownKeys(object, enumerableOnly) {
123957
+ var keys = Object.keys(object);
123958
+ if (Object.getOwnPropertySymbols) {
123959
+ var symbols = Object.getOwnPropertySymbols(object);
123960
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
123961
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
123962
+ })), keys.push.apply(keys, symbols));
123963
+ }
123964
+ return keys;
123965
+ }
123966
+ function _objectSpread(target) {
123967
+ for (var i = 1; i < arguments.length; i++) {
123968
+ var source = null != arguments[i] ? arguments[i] : {};
123969
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
123970
+ (0, _defineProperty2["default"])(target, key, source[key]);
123971
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
123972
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
123973
+ });
123974
+ }
123975
+ return target;
123976
+ }
123954
123977
  function _createSuper(Derived) {
123955
123978
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
123956
123979
  return function _createSuperInternal() {
@@ -124021,7 +124044,9 @@ const {findKey: require$$10$5} = _dll_lodash;
124021
124044
  });
124022
124045
  return foundChoice === undefined;
124023
124046
  });
124024
- var elementStyle = this.getStyleForWrapper();
124047
+ var elementStyle = _objectSpread(_objectSpread({}, this.getStyleForWrapper()), {}, {
124048
+ minWidth: '100px'
124049
+ });
124025
124050
  return _react["default"].createElement("div", {
124026
124051
  style: elementStyle
124027
124052
  }, _react["default"].createElement(_dragInTheBlankDp["default"], {
@@ -124063,12 +124088,12 @@ const require$$16 = _dll_classnames;
124063
124088
  });
124064
124089
  exports["default"] = exports.DRAG_TYPE = exports.BlankContent = void 0;
124065
124090
  var _objectWithoutProperties2 = _interopRequireDefault(objectWithoutProperties.exports);
124091
+ var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
124066
124092
  var _classCallCheck2 = _interopRequireDefault(classCallCheck$3.exports);
124067
124093
  var _createClass2 = _interopRequireDefault(createClass$2.exports);
124068
124094
  var _inherits2 = _interopRequireDefault(inherits$1.exports);
124069
124095
  var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn$1.exports);
124070
124096
  var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf$1.exports);
124071
- var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
124072
124097
  var _react = _interopRequireDefault(require$$8$5);
124073
124098
  var _reactDom = _interopRequireDefault(require$$9$6);
124074
124099
  var _propTypes = _interopRequireDefault(require$$10$4);
@@ -124141,10 +124166,7 @@ const require$$16 = _dll_classnames;
124141
124166
  backgroundColor: _renderUi.color.background(),
124142
124167
  border: ("2px dashed ").concat(_renderUi.color.text()),
124143
124168
  color: _renderUi.color.text(),
124144
- minWidth: '90px',
124145
124169
  fontSize: 'inherit',
124146
- minHeight: '32px',
124147
- height: 'auto',
124148
124170
  maxWidth: '374px',
124149
124171
  position: 'relative',
124150
124172
  borderRadius: '3px'
@@ -124186,7 +124208,8 @@ const require$$16 = _dll_classnames;
124186
124208
  (0, _classCallCheck2["default"])(this, BlankContent);
124187
124209
  _this = _super.call(this);
124188
124210
  _this.state = {
124189
- height: 0
124211
+ height: 0,
124212
+ width: 0
124190
124213
  };
124191
124214
  return _this;
124192
124215
  }
@@ -124200,17 +124223,33 @@ const require$$16 = _dll_classnames;
124200
124223
  if (JSON.stringify(currentChoice) !== JSON.stringify(prevChoice)) {
124201
124224
  if (!currentChoice) {
124202
124225
  this.setState({
124203
- height: 0
124226
+ height: 0,
124227
+ width: 0
124204
124228
  });
124205
124229
  return;
124206
124230
  }
124207
124231
  setTimeout(function () {
124208
- _this2.setState({
124209
- height: _this2.spanRef.offsetHeight
124210
- });
124232
+ _this2.updateDimensions();
124211
124233
  }, 300);
124212
124234
  }
124213
124235
  }
124236
+ }, {
124237
+ key: "updateDimensions",
124238
+ value: function updateDimensions() {
124239
+ var _this$spanRef, _this$spanRef2;
124240
+ var height = ((_this$spanRef = this.spanRef) === null || _this$spanRef === void 0 ? void 0 : _this$spanRef.offsetHeight) || 0;
124241
+ var width = ((_this$spanRef2 = this.spanRef) === null || _this$spanRef2 === void 0 ? void 0 : _this$spanRef2.offsetWidth) || 0;
124242
+ var responseAreaHeight = parseFloat(this.props.emptyResponseAreaHeight) || 0;
124243
+ var responseAreaWidth = parseFloat(this.props.emptyResponseAreaWidth) || 0;
124244
+ if (height > responseAreaHeight || width > responseAreaWidth) {
124245
+ this.setState(function (prevState) {
124246
+ return {
124247
+ width: width > responseAreaWidth ? width : prevState.width,
124248
+ height: height > responseAreaHeight ? height : prevState.height
124249
+ };
124250
+ });
124251
+ }
124252
+ }
124214
124253
  }, {
124215
124254
  key: "addDraggableFalseAttributes",
124216
124255
  value: function addDraggableFalseAttributes(parent) {
@@ -124220,6 +124259,19 @@ const require$$16 = _dll_classnames;
124220
124259
  }
124221
124260
  });
124222
124261
  }
124262
+ }, {
124263
+ key: "getRootDimensions",
124264
+ value: function getRootDimensions() {
124265
+ var rootStyle = {
124266
+ height: this.state.height || this.props.emptyResponseAreaHeight,
124267
+ width: this.state.width || this.props.emptyResponseAreaWidth
124268
+ };
124269
+ return _objectSpread(_objectSpread(_objectSpread({}, rootStyle), this.props.emptyResponseAreaWidth ? {} : {
124270
+ minWidth: 90
124271
+ }), this.props.emptyResponseAreaHeight ? {} : {
124272
+ minHeight: 32
124273
+ });
124274
+ }
124223
124275
  }, {
124224
124276
  key: "render",
124225
124277
  value: function render() {
@@ -124255,9 +124307,7 @@ const require$$16 = _dll_classnames;
124255
124307
  }, ' ')),
124256
124308
  className: (0, _classnames3["default"])(classes.chip, isOver && classes.over, (_classnames2 = {}, (0, _defineProperty2["default"])(_classnames2, classes.correct, correct !== undefined && correct), (0, _defineProperty2["default"])(_classnames2, classes.incorrect, correct !== undefined && !correct), _classnames2)),
124257
124309
  variant: disabled ? 'outlined' : undefined,
124258
- style: _objectSpread({}, this.state.height ? {
124259
- height: this.state.height
124260
- } : {}),
124310
+ style: _objectSpread({}, this.getRootDimensions()),
124261
124311
  classes: {
124262
124312
  label: isOver && classes.over
124263
124313
  }
@@ -124267,7 +124317,11 @@ const require$$16 = _dll_classnames;
124267
124317
  return BlankContent;
124268
124318
  })(_react["default"].Component);
124269
124319
  exports.BlankContent = BlankContent;
124270
- (0, _defineProperty2["default"])(BlankContent, "propTypes", {
124320
+ BlankContent.defaultProps = {
124321
+ emptyResponseAreaWidth: 0,
124322
+ emptyResponseAreaHeight: 0
124323
+ };
124324
+ BlankContent.propTypes = {
124271
124325
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
124272
124326
  disabled: _propTypes["default"].bool,
124273
124327
  duplicates: _propTypes["default"].bool,
@@ -124276,8 +124330,10 @@ const require$$16 = _dll_classnames;
124276
124330
  isOver: _propTypes["default"].bool,
124277
124331
  dragItem: _propTypes["default"].object,
124278
124332
  correct: _propTypes["default"].bool,
124279
- onChange: _propTypes["default"].func
124280
- });
124333
+ onChange: _propTypes["default"].func,
124334
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
124335
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
124336
+ };
124281
124337
  var StyledBlankContent = useStyles(BlankContent);
124282
124338
  var connectedBlankContent = useStyles(function (_ref4) {
124283
124339
  var connectDragSource = _ref4.connectDragSource, connectDropTarget = _ref4.connectDropTarget, props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
@@ -124362,6 +124418,27 @@ const require$$9$5 = _dll_prop_types;
124362
124418
  var _choices = _interopRequireDefault(choices);
124363
124419
  var _blank = _interopRequireDefault(blank);
124364
124420
  var _withMask = withMask$1;
124421
+ function ownKeys(object, enumerableOnly) {
124422
+ var keys = Object.keys(object);
124423
+ if (Object.getOwnPropertySymbols) {
124424
+ var symbols = Object.getOwnPropertySymbols(object);
124425
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
124426
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
124427
+ })), keys.push.apply(keys, symbols));
124428
+ }
124429
+ return keys;
124430
+ }
124431
+ function _objectSpread(target) {
124432
+ for (var i = 1; i < arguments.length; i++) {
124433
+ var source = null != arguments[i] ? arguments[i] : {};
124434
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
124435
+ (0, _defineProperty2["default"])(target, key, source[key]);
124436
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
124437
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
124438
+ });
124439
+ }
124440
+ return target;
124441
+ }
124365
124442
  function _createSuper(Derived) {
124366
124443
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
124367
124444
  return function _createSuperInternal() {
@@ -124390,7 +124467,7 @@ const require$$9$5 = _dll_prop_types;
124390
124467
  return function (node, data, onChange) {
124391
124468
  var dataset = node.data ? node.data.dataset || ({}) : {};
124392
124469
  if (dataset.component === 'blank') {
124393
- var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer;
124470
+ var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer, emptyResponseAreaWidth = props.emptyResponseAreaWidth, emptyResponseAreaHeight = props.emptyResponseAreaHeight;
124394
124471
  var choiceId = showCorrectAnswer ? correctResponse[dataset.id] : data[dataset.id];
124395
124472
  var choice = choiceId && props.choices.find(function (c) {
124396
124473
  return c.id === choiceId;
@@ -124402,6 +124479,8 @@ const require$$9$5 = _dll_prop_types;
124402
124479
  duplicates: duplicates,
124403
124480
  choice: choice,
124404
124481
  id: dataset.id,
124482
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
124483
+ emptyResponseAreaHeight: emptyResponseAreaHeight,
124405
124484
  onChange: onChange
124406
124485
  });
124407
124486
  }
@@ -124419,12 +124498,17 @@ const require$$9$5 = _dll_prop_types;
124419
124498
  _this = _super.call.apply(_super, [this].concat(args));
124420
124499
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPositionDirection", function (choicePosition) {
124421
124500
  var flexDirection;
124501
+ var justifyContent;
124502
+ var alignItems;
124422
124503
  switch (choicePosition) {
124423
124504
  case 'left':
124424
124505
  flexDirection = 'row';
124506
+ alignItems = 'center';
124425
124507
  break;
124426
124508
  case 'right':
124427
124509
  flexDirection = 'row-reverse';
124510
+ justifyContent = 'flex-end';
124511
+ alignItems = 'center';
124428
124512
  break;
124429
124513
  case 'below':
124430
124514
  flexDirection = 'column-reverse';
@@ -124433,7 +124517,11 @@ const require$$9$5 = _dll_prop_types;
124433
124517
  flexDirection = 'column';
124434
124518
  break;
124435
124519
  }
124436
- return flexDirection;
124520
+ return {
124521
+ flexDirection: flexDirection,
124522
+ justifyContent: justifyContent,
124523
+ alignItems: alignItems
124524
+ };
124437
124525
  });
124438
124526
  return _this;
124439
124527
  }
@@ -124453,12 +124541,12 @@ const require$$9$5 = _dll_prop_types;
124453
124541
  key: "render",
124454
124542
  value: function render() {
124455
124543
  var _this2 = this;
124456
- var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer;
124544
+ var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer, emptyResponseAreaWidth = _this$props.emptyResponseAreaWidth, emptyResponseAreaHeight = _this$props.emptyResponseAreaHeight;
124457
124545
  var choicePosition = choicesPosition || 'below';
124458
- var style = {
124546
+ var style = _objectSpread({
124459
124547
  display: 'flex',
124460
- flexDirection: this.getPositionDirection(choicePosition)
124461
- };
124548
+ minWidth: '100px'
124549
+ }, this.getPositionDirection(choicePosition));
124462
124550
  return _react["default"].createElement("div", {
124463
124551
  ref: function ref(_ref) {
124464
124552
  return _ref && (_this2.rootRef = _ref);
@@ -124480,7 +124568,9 @@ const require$$9$5 = _dll_prop_types;
124480
124568
  duplicates: duplicates,
124481
124569
  feedback: feedback,
124482
124570
  correctResponse: correctResponse,
124483
- showCorrectAnswer: showCorrectAnswer
124571
+ showCorrectAnswer: showCorrectAnswer,
124572
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
124573
+ emptyResponseAreaHeight: emptyResponseAreaHeight
124484
124574
  }));
124485
124575
  }
124486
124576
  }]);
@@ -124501,7 +124591,9 @@ const require$$9$5 = _dll_prop_types;
124501
124591
  disabled: _propTypes["default"].bool,
124502
124592
  feedback: _propTypes["default"].object,
124503
124593
  correctResponse: _propTypes["default"].object,
124504
- showCorrectAnswer: _propTypes["default"].bool
124594
+ showCorrectAnswer: _propTypes["default"].bool,
124595
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
124596
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
124505
124597
  });
124506
124598
  })(dragInTheBlank);
124507
124599
  getDefaultExportFromCjs(dragInTheBlank);
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.21.0"
7
+ "version": "1.21.1"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "4.12.0"
11
+ "version": "4.23.1"
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@1.21.0/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@4.12.0/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.21.1/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@4.23.1/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;
@@ -21811,8 +21811,10 @@ var mathjaxScript = {};
21811
21811
  Object.defineProperty(mathjaxScript, "__esModule", {
21812
21812
  value: true
21813
21813
  });
21814
- mathjaxScript.initializeMathJax = void 0;
21814
+ mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
21815
21815
  var _renderMath = renderMath$3;
21816
+ var MathJaxVersion = '3.2.2';
21817
+ mathjaxScript.MathJaxVersion = MathJaxVersion;
21816
21818
  var initializeMathJax = function initializeMathJax(renderOpts) {
21817
21819
  if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
21818
21820
  console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
@@ -21883,7 +21885,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
21883
21885
  };
21884
21886
  var script = document.createElement('script');
21885
21887
  script.type = 'text/javascript';
21886
- script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml-full.js';
21888
+ script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
21887
21889
  script.async = true;
21888
21890
  document.body.appendChild(script);
21889
21891
  });
@@ -81712,7 +81714,7 @@ getDefaultExportFromCjs(mathRendering);
81712
81714
  fixMathElements(executeOn);
81713
81715
  adjustMathMLStyle(executeOn);
81714
81716
  var mathJaxCustomKey = getMathJaxCustomKey();
81715
- if (!window.MathJax && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
81717
+ if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
81716
81718
  renderOpts = renderOpts || defaultOpts();
81717
81719
  (0, _mathjaxScript.initializeMathJax)(renderOpts);
81718
81720
  }
@@ -123914,6 +123916,27 @@ const {findKey: require$$10$5} = _dll_lodash;
123914
123916
  var _findKey = _interopRequireDefault(require$$10$5);
123915
123917
  var _choice = _interopRequireDefault(choice$1);
123916
123918
  var _dragInTheBlankDp = _interopRequireDefault(dragInTheBlankDp);
123919
+ function ownKeys(object, enumerableOnly) {
123920
+ var keys = Object.keys(object);
123921
+ if (Object.getOwnPropertySymbols) {
123922
+ var symbols = Object.getOwnPropertySymbols(object);
123923
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
123924
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
123925
+ })), keys.push.apply(keys, symbols));
123926
+ }
123927
+ return keys;
123928
+ }
123929
+ function _objectSpread(target) {
123930
+ for (var i = 1; i < arguments.length; i++) {
123931
+ var source = null != arguments[i] ? arguments[i] : {};
123932
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
123933
+ (0, _defineProperty2["default"])(target, key, source[key]);
123934
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
123935
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
123936
+ });
123937
+ }
123938
+ return target;
123939
+ }
123917
123940
  function _createSuper(Derived) {
123918
123941
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
123919
123942
  return function _createSuperInternal() {
@@ -123984,7 +124007,9 @@ const {findKey: require$$10$5} = _dll_lodash;
123984
124007
  });
123985
124008
  return foundChoice === undefined;
123986
124009
  });
123987
- var elementStyle = this.getStyleForWrapper();
124010
+ var elementStyle = _objectSpread(_objectSpread({}, this.getStyleForWrapper()), {}, {
124011
+ minWidth: '100px'
124012
+ });
123988
124013
  return _react["default"].createElement("div", {
123989
124014
  style: elementStyle
123990
124015
  }, _react["default"].createElement(_dragInTheBlankDp["default"], {
@@ -124026,12 +124051,12 @@ const require$$16 = _dll_classnames;
124026
124051
  });
124027
124052
  exports["default"] = exports.DRAG_TYPE = exports.BlankContent = void 0;
124028
124053
  var _objectWithoutProperties2 = _interopRequireDefault(objectWithoutProperties.exports);
124054
+ var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
124029
124055
  var _classCallCheck2 = _interopRequireDefault(classCallCheck$3.exports);
124030
124056
  var _createClass2 = _interopRequireDefault(createClass$2.exports);
124031
124057
  var _inherits2 = _interopRequireDefault(inherits$1.exports);
124032
124058
  var _possibleConstructorReturn2 = _interopRequireDefault(possibleConstructorReturn$1.exports);
124033
124059
  var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf$1.exports);
124034
- var _defineProperty2 = _interopRequireDefault(defineProperty$4.exports);
124035
124060
  var _react = _interopRequireDefault(require$$8$5);
124036
124061
  var _reactDom = _interopRequireDefault(require$$9$6);
124037
124062
  var _propTypes = _interopRequireDefault(require$$10$4);
@@ -124104,10 +124129,7 @@ const require$$16 = _dll_classnames;
124104
124129
  backgroundColor: _renderUi.color.background(),
124105
124130
  border: ("2px dashed ").concat(_renderUi.color.text()),
124106
124131
  color: _renderUi.color.text(),
124107
- minWidth: '90px',
124108
124132
  fontSize: 'inherit',
124109
- minHeight: '32px',
124110
- height: 'auto',
124111
124133
  maxWidth: '374px',
124112
124134
  position: 'relative',
124113
124135
  borderRadius: '3px'
@@ -124149,7 +124171,8 @@ const require$$16 = _dll_classnames;
124149
124171
  (0, _classCallCheck2["default"])(this, BlankContent);
124150
124172
  _this = _super.call(this);
124151
124173
  _this.state = {
124152
- height: 0
124174
+ height: 0,
124175
+ width: 0
124153
124176
  };
124154
124177
  return _this;
124155
124178
  }
@@ -124163,17 +124186,33 @@ const require$$16 = _dll_classnames;
124163
124186
  if (JSON.stringify(currentChoice) !== JSON.stringify(prevChoice)) {
124164
124187
  if (!currentChoice) {
124165
124188
  this.setState({
124166
- height: 0
124189
+ height: 0,
124190
+ width: 0
124167
124191
  });
124168
124192
  return;
124169
124193
  }
124170
124194
  setTimeout(function () {
124171
- _this2.setState({
124172
- height: _this2.spanRef.offsetHeight
124173
- });
124195
+ _this2.updateDimensions();
124174
124196
  }, 300);
124175
124197
  }
124176
124198
  }
124199
+ }, {
124200
+ key: "updateDimensions",
124201
+ value: function updateDimensions() {
124202
+ var _this$spanRef, _this$spanRef2;
124203
+ var height = ((_this$spanRef = this.spanRef) === null || _this$spanRef === void 0 ? void 0 : _this$spanRef.offsetHeight) || 0;
124204
+ var width = ((_this$spanRef2 = this.spanRef) === null || _this$spanRef2 === void 0 ? void 0 : _this$spanRef2.offsetWidth) || 0;
124205
+ var responseAreaHeight = parseFloat(this.props.emptyResponseAreaHeight) || 0;
124206
+ var responseAreaWidth = parseFloat(this.props.emptyResponseAreaWidth) || 0;
124207
+ if (height > responseAreaHeight || width > responseAreaWidth) {
124208
+ this.setState(function (prevState) {
124209
+ return {
124210
+ width: width > responseAreaWidth ? width : prevState.width,
124211
+ height: height > responseAreaHeight ? height : prevState.height
124212
+ };
124213
+ });
124214
+ }
124215
+ }
124177
124216
  }, {
124178
124217
  key: "addDraggableFalseAttributes",
124179
124218
  value: function addDraggableFalseAttributes(parent) {
@@ -124183,6 +124222,19 @@ const require$$16 = _dll_classnames;
124183
124222
  }
124184
124223
  });
124185
124224
  }
124225
+ }, {
124226
+ key: "getRootDimensions",
124227
+ value: function getRootDimensions() {
124228
+ var rootStyle = {
124229
+ height: this.state.height || this.props.emptyResponseAreaHeight,
124230
+ width: this.state.width || this.props.emptyResponseAreaWidth
124231
+ };
124232
+ return _objectSpread(_objectSpread(_objectSpread({}, rootStyle), this.props.emptyResponseAreaWidth ? {} : {
124233
+ minWidth: 90
124234
+ }), this.props.emptyResponseAreaHeight ? {} : {
124235
+ minHeight: 32
124236
+ });
124237
+ }
124186
124238
  }, {
124187
124239
  key: "render",
124188
124240
  value: function render() {
@@ -124218,9 +124270,7 @@ const require$$16 = _dll_classnames;
124218
124270
  }, ' ')),
124219
124271
  className: (0, _classnames3["default"])(classes.chip, isOver && classes.over, (_classnames2 = {}, (0, _defineProperty2["default"])(_classnames2, classes.correct, correct !== undefined && correct), (0, _defineProperty2["default"])(_classnames2, classes.incorrect, correct !== undefined && !correct), _classnames2)),
124220
124272
  variant: disabled ? 'outlined' : undefined,
124221
- style: _objectSpread({}, this.state.height ? {
124222
- height: this.state.height
124223
- } : {}),
124273
+ style: _objectSpread({}, this.getRootDimensions()),
124224
124274
  classes: {
124225
124275
  label: isOver && classes.over
124226
124276
  }
@@ -124230,7 +124280,11 @@ const require$$16 = _dll_classnames;
124230
124280
  return BlankContent;
124231
124281
  })(_react["default"].Component);
124232
124282
  exports.BlankContent = BlankContent;
124233
- (0, _defineProperty2["default"])(BlankContent, "propTypes", {
124283
+ BlankContent.defaultProps = {
124284
+ emptyResponseAreaWidth: 0,
124285
+ emptyResponseAreaHeight: 0
124286
+ };
124287
+ BlankContent.propTypes = {
124234
124288
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
124235
124289
  disabled: _propTypes["default"].bool,
124236
124290
  duplicates: _propTypes["default"].bool,
@@ -124239,8 +124293,10 @@ const require$$16 = _dll_classnames;
124239
124293
  isOver: _propTypes["default"].bool,
124240
124294
  dragItem: _propTypes["default"].object,
124241
124295
  correct: _propTypes["default"].bool,
124242
- onChange: _propTypes["default"].func
124243
- });
124296
+ onChange: _propTypes["default"].func,
124297
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
124298
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
124299
+ };
124244
124300
  var StyledBlankContent = useStyles(BlankContent);
124245
124301
  var connectedBlankContent = useStyles(function (_ref4) {
124246
124302
  var connectDragSource = _ref4.connectDragSource, connectDropTarget = _ref4.connectDropTarget, props = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
@@ -124325,6 +124381,27 @@ const require$$9$5 = _dll_prop_types;
124325
124381
  var _choices = _interopRequireDefault(choices);
124326
124382
  var _blank = _interopRequireDefault(blank);
124327
124383
  var _withMask = withMask$1;
124384
+ function ownKeys(object, enumerableOnly) {
124385
+ var keys = Object.keys(object);
124386
+ if (Object.getOwnPropertySymbols) {
124387
+ var symbols = Object.getOwnPropertySymbols(object);
124388
+ (enumerableOnly && (symbols = symbols.filter(function (sym) {
124389
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
124390
+ })), keys.push.apply(keys, symbols));
124391
+ }
124392
+ return keys;
124393
+ }
124394
+ function _objectSpread(target) {
124395
+ for (var i = 1; i < arguments.length; i++) {
124396
+ var source = null != arguments[i] ? arguments[i] : {};
124397
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
124398
+ (0, _defineProperty2["default"])(target, key, source[key]);
124399
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
124400
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
124401
+ });
124402
+ }
124403
+ return target;
124404
+ }
124328
124405
  function _createSuper(Derived) {
124329
124406
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
124330
124407
  return function _createSuperInternal() {
@@ -124353,7 +124430,7 @@ const require$$9$5 = _dll_prop_types;
124353
124430
  return function (node, data, onChange) {
124354
124431
  var dataset = node.data ? node.data.dataset || ({}) : {};
124355
124432
  if (dataset.component === 'blank') {
124356
- var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer;
124433
+ var disabled = props.disabled, duplicates = props.duplicates, correctResponse = props.correctResponse, feedback = props.feedback, showCorrectAnswer = props.showCorrectAnswer, emptyResponseAreaWidth = props.emptyResponseAreaWidth, emptyResponseAreaHeight = props.emptyResponseAreaHeight;
124357
124434
  var choiceId = showCorrectAnswer ? correctResponse[dataset.id] : data[dataset.id];
124358
124435
  var choice = choiceId && props.choices.find(function (c) {
124359
124436
  return c.id === choiceId;
@@ -124365,6 +124442,8 @@ const require$$9$5 = _dll_prop_types;
124365
124442
  duplicates: duplicates,
124366
124443
  choice: choice,
124367
124444
  id: dataset.id,
124445
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
124446
+ emptyResponseAreaHeight: emptyResponseAreaHeight,
124368
124447
  onChange: onChange
124369
124448
  });
124370
124449
  }
@@ -124382,12 +124461,17 @@ const require$$9$5 = _dll_prop_types;
124382
124461
  _this = _super.call.apply(_super, [this].concat(args));
124383
124462
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPositionDirection", function (choicePosition) {
124384
124463
  var flexDirection;
124464
+ var justifyContent;
124465
+ var alignItems;
124385
124466
  switch (choicePosition) {
124386
124467
  case 'left':
124387
124468
  flexDirection = 'row';
124469
+ alignItems = 'center';
124388
124470
  break;
124389
124471
  case 'right':
124390
124472
  flexDirection = 'row-reverse';
124473
+ justifyContent = 'flex-end';
124474
+ alignItems = 'center';
124391
124475
  break;
124392
124476
  case 'below':
124393
124477
  flexDirection = 'column-reverse';
@@ -124396,7 +124480,11 @@ const require$$9$5 = _dll_prop_types;
124396
124480
  flexDirection = 'column';
124397
124481
  break;
124398
124482
  }
124399
- return flexDirection;
124483
+ return {
124484
+ flexDirection: flexDirection,
124485
+ justifyContent: justifyContent,
124486
+ alignItems: alignItems
124487
+ };
124400
124488
  });
124401
124489
  return _this;
124402
124490
  }
@@ -124416,12 +124504,12 @@ const require$$9$5 = _dll_prop_types;
124416
124504
  key: "render",
124417
124505
  value: function render() {
124418
124506
  var _this2 = this;
124419
- var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer;
124507
+ var _this$props = this.props, markup = _this$props.markup, duplicates = _this$props.duplicates, layout = _this$props.layout, value = _this$props.value, onChange = _this$props.onChange, choicesPosition = _this$props.choicesPosition, choices = _this$props.choices, correctResponse = _this$props.correctResponse, disabled = _this$props.disabled, feedback = _this$props.feedback, showCorrectAnswer = _this$props.showCorrectAnswer, emptyResponseAreaWidth = _this$props.emptyResponseAreaWidth, emptyResponseAreaHeight = _this$props.emptyResponseAreaHeight;
124420
124508
  var choicePosition = choicesPosition || 'below';
124421
- var style = {
124509
+ var style = _objectSpread({
124422
124510
  display: 'flex',
124423
- flexDirection: this.getPositionDirection(choicePosition)
124424
- };
124511
+ minWidth: '100px'
124512
+ }, this.getPositionDirection(choicePosition));
124425
124513
  return _react["default"].createElement("div", {
124426
124514
  ref: function ref(_ref) {
124427
124515
  return _ref && (_this2.rootRef = _ref);
@@ -124443,7 +124531,9 @@ const require$$9$5 = _dll_prop_types;
124443
124531
  duplicates: duplicates,
124444
124532
  feedback: feedback,
124445
124533
  correctResponse: correctResponse,
124446
- showCorrectAnswer: showCorrectAnswer
124534
+ showCorrectAnswer: showCorrectAnswer,
124535
+ emptyResponseAreaWidth: emptyResponseAreaWidth,
124536
+ emptyResponseAreaHeight: emptyResponseAreaHeight
124447
124537
  }));
124448
124538
  }
124449
124539
  }]);
@@ -124464,7 +124554,9 @@ const require$$9$5 = _dll_prop_types;
124464
124554
  disabled: _propTypes["default"].bool,
124465
124555
  feedback: _propTypes["default"].object,
124466
124556
  correctResponse: _propTypes["default"].object,
124467
- showCorrectAnswer: _propTypes["default"].bool
124557
+ showCorrectAnswer: _propTypes["default"].bool,
124558
+ emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
124559
+ emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
124468
124560
  });
124469
124561
  })(dragInTheBlank);
124470
124562
  getDefaultExportFromCjs(dragInTheBlank);
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "2.20.1-next.13+e2f0ba2c8",
7
+ "version": "2.20.1-next.14+6343d1b00",
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.28.0",
12
+ "@pie-lib/pie-toolbox": "1.29.0",
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": "e2f0ba2c8d984648c56a1b9114b8875a8e0adc9f",
19
+ "gitHead": "6343d1b00c5a4a3d88de70ed13a8aa5c1a43002d",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },