@pie-element/math-inline 7.22.1-next.25 → 7.22.1-next.28

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.
@@ -11,7 +11,7 @@
11
11
  "@material-ui/icons": "^3.0.1",
12
12
  "@pie-framework/mathquill": "^1.1.3",
13
13
  "@pie-framework/pie-configure-events": "^1.3.0",
14
- "@pie-lib/pie-toolbox": "1.24.2",
14
+ "@pie-lib/pie-toolbox": "1.25.0",
15
15
  "classnames": "^2.2.5",
16
16
  "debug": "^3.1.0",
17
17
  "prop-types": "^15.6.2",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@pie-framework/math-validation": "^1.2.2",
13
- "@pie-lib/pie-toolbox": "1.24.2",
13
+ "@pie-lib/pie-toolbox": "1.25.0",
14
14
  "debug": "^3.1.0",
15
15
  "lodash": "^4.17.15"
16
16
  },
package/lib/index.js CHANGED
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "Component", {
13
13
  });
14
14
  exports["default"] = void 0;
15
15
 
16
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
17
+
16
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
19
 
18
20
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -29,8 +31,6 @@ var _react = _interopRequireDefault(require("react"));
29
31
 
30
32
  var _reactDom = _interopRequireDefault(require("react-dom"));
31
33
 
32
- var _main = _interopRequireDefault(require("./main"));
33
-
34
34
  var _debug = _interopRequireDefault(require("debug"));
35
35
 
36
36
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -39,6 +39,8 @@ var _piePlayerEvents = require("@pie-framework/pie-player-events");
39
39
 
40
40
  var _defaults = _interopRequireDefault(require("../configure/lib/defaults"));
41
41
 
42
+ var _main = _interopRequireDefault(require("./main"));
43
+
42
44
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
43
45
 
44
46
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -63,10 +65,24 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
63
65
  }
64
66
 
65
67
  (0, _createClass2["default"])(MathInline, [{
68
+ key: "setLangAttribute",
69
+ value: function setLangAttribute() {
70
+ var language = this._model && (0, _typeof2["default"])(this._model.language) ? this._model.language : '';
71
+ var lang = language ? language.slice(0, 2) : 'en';
72
+ this.setAttribute('lang', lang); // set the lang attribute for the nearest parent div with class 'player-container' for MPI items as per PD-2483
73
+
74
+ var playerContainer = this.closest('.player-container');
75
+
76
+ if (playerContainer) {
77
+ playerContainer.setAttribute('lang', lang);
78
+ }
79
+ }
80
+ }, {
66
81
  key: "model",
67
82
  set: function set(m) {
68
83
  this._model = m;
69
84
  this.dispatchEvent(new _piePlayerEvents.ModelSetEvent(this._model, true, !!this._model));
85
+ this.setLangAttribute();
70
86
 
71
87
  this._render();
72
88
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","MathInline","_configuration","defaults","configuration","sessionChangedEventCaller","_","debounce","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","m","_model","ModelSetEvent","_render","_session","s","c","Object","keys","map","key","setAttribute","el","React","createElement","Main","model","session","onSessionChange","sessionChanged","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA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,UAAI,CAAC,KAAKF,MAAN,IAAgB,CAAC,KAAKG,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMQ,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKf,MADuB;AAEnCgB,QAAAA,OAAO,EAAE,KAAKb,QAFqB;AAGnCZ,QAAAA,aAAa,EAAE,KAAKF,cAHe;AAInC4B,QAAAA,eAAe,EAAE,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB;AAJkB,OAA1B,CAAX;;AAOAC,2BAASC,MAAT,CAAgBV,EAAhB,EAAoB,IAApB;AACD;;;kDA1DqCW,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport debug from 'debug';\nimport _ from 'lodash';\n\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport defaults from '../configure/lib/defaults';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._configuration = defaults.configuration;\n this.sessionChangedEventCaller = _.debounce(() => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n }, 1000);\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map((key) => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller();\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Math Response Question'); \n this.setAttribute('role', 'region');\n\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n ReactDOM.render(el, this);\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","MathInline","_configuration","defaults","configuration","sessionChangedEventCaller","_","debounce","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","language","_model","lang","slice","setAttribute","playerContainer","closest","m","ModelSetEvent","setLangAttribute","_render","_session","s","c","Object","keys","map","key","el","React","createElement","Main","model","session","onSessionChange","sessionChanged","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,oBAAN,CAAZ;;IAIqBC,U;;;;;AACnB,wBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,cAAL,GAAsBC,qBAASC,aAA/B;AACA,UAAKC,yBAAL,GAAiCC,mBAAEC,QAAF,CAAW,YAAM;AAChD,YAAKC,aAAL,CAAmB,IAAIC,oCAAJ,CAAwB,MAAKC,OAAL,CAAaC,WAAb,EAAxB,EAAoD,IAApD,CAAnB;AACD,KAFgC,EAE9B,IAF8B,CAAjC;AAHY;AAMb;;;;WAED,4BAAmB;AACjB,UAAMC,QAAQ,GAAG,KAAKC,MAAL,6BAAsB,KAAKA,MAAL,CAAYD,QAAlC,IAA6C,KAAKC,MAAL,CAAYD,QAAzD,GAAoE,EAArF;AACA,UAAME,IAAI,GAAGF,QAAQ,GAAGA,QAAQ,CAACG,KAAT,CAAe,CAAf,EAAkB,CAAlB,CAAH,GAA0B,IAA/C;AACA,WAAKC,YAAL,CAAkB,MAAlB,EAA0BF,IAA1B,EAHiB,CAKjB;;AACA,UAAMG,eAAe,GAAG,KAAKC,OAAL,CAAa,mBAAb,CAAxB;;AACA,UAAID,eAAJ,EAAqB;AACnBA,QAAAA,eAAe,CAACD,YAAhB,CAA6B,MAA7B,EAAqCF,IAArC;AACD;AACF;;;SAED,aAAUK,CAAV,EAAa;AACX,WAAKN,MAAL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AgBV,EAAhB,EAAoB,IAApB;AACD;;;kDAvEqCW,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\nimport _ from 'lodash';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\n\nimport defaults from '../configure/lib/defaults';\nimport Main from './main';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._configuration = defaults.configuration;\n this.sessionChangedEventCaller = _.debounce(() => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n }, 1000);\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n\n // set the lang attribute for the nearest parent div with class 'player-container' for MPI items as per PD-2483\n const playerContainer = this.closest('.player-container');\n if (playerContainer) {\n playerContainer.setAttribute('lang', lang);\n }\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this.setLangAttribute();\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map((key) => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller();\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Math Response Question');\n this.setAttribute('role', 'region');\n\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n ReactDOM.render(el, this);\n }\n}\n"],"file":"index.js"}
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_pie_framework__mathquill, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.17.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_pie_framework__mathquill, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.17.2/module/index.js";
2
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";
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) {
@@ -4037,7 +4037,8 @@ var _default = {
4037
4037
  commonCorrectAnswerWithAlternates: 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
4038
4038
  warning: 'Warning',
4039
4039
  showNote: 'Show Note',
4040
- hideNote: 'Hide Note'
4040
+ hideNote: 'Hide Note',
4041
+ cancel: 'Cancel'
4041
4042
  }
4042
4043
  };
4043
4044
  exports["default"] = _default;
@@ -4055,7 +4056,7 @@ exports["default"] = void 0;
4055
4056
  var _default = {
4056
4057
  translation: {
4057
4058
  categorize: {
4058
- limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta',
4059
+ limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
4059
4060
  maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
4060
4061
  },
4061
4062
  ebsr: {
@@ -4126,7 +4127,8 @@ var _default = {
4126
4127
  commonCorrectAnswerWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
4127
4128
  warning: 'Advertencia',
4128
4129
  showNote: 'Mostrar Nota',
4129
- hideNote: 'Ocultar Nota'
4130
+ hideNote: 'Ocultar Nota',
4131
+ cancel: 'Cancelar'
4130
4132
  }
4131
4133
  };
4132
4134
  exports["default"] = _default;