@pie-element/explicit-constructed-response 9.0.1-next.27 → 9.0.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.
@@ -8,8 +8,8 @@
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/config-ui": "^11.25.0",
12
- "@pie-lib/editable-html": "^11.17.0",
11
+ "@pie-lib/config-ui": "^11.25.1",
12
+ "@pie-lib/editable-html": "^11.17.1",
13
13
  "classnames": "^2.2.6",
14
14
  "debug": "^3.1.0",
15
15
  "lodash": "^4.17.15",
@@ -8,8 +8,8 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/controller-utils": "^0.18.0",
12
- "@pie-lib/translator": "^2.19.0",
11
+ "@pie-lib/controller-utils": "^0.19.4",
12
+ "@pie-lib/translator": "^2.20.4",
13
13
  "debug": "^3.1.0",
14
14
  "he": "^1.2.0",
15
15
  "lodash": "^4.17.15",
@@ -4234,8 +4234,13 @@ const enabled = (config, env, defaultValue) => {
4234
4234
  return typeof defaultValue === 'boolean' ? defaultValue : true;
4235
4235
  };
4236
4236
 
4237
- // eslint-disable-next-line no-console
4238
- const lg = (n) => console[n].bind(console, 'controller-utils:');
4237
+ var partialScoring = /*#__PURE__*/Object.freeze({
4238
+ __proto__: null,
4239
+ enabled: enabled
4240
+ });
4241
+
4242
+ const lg = n => console[n].bind(console, 'controller-utils:');
4243
+
4239
4244
  lg('debug');
4240
4245
  lg('log');
4241
4246
  lg('warn');
@@ -4870,7 +4875,7 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
4870
4875
  function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
4871
4876
  function _isNativeReflectConstruct$2() { 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; } }
4872
4877
  var checkedLoadedFor = {};
4873
- var Translator$1 = function (_EventEmitter) {
4878
+ var Translator = function (_EventEmitter) {
4874
4879
  _inherits(Translator, _EventEmitter);
4875
4880
  var _super = _createSuper$2(Translator);
4876
4881
  function Translator(services) {
@@ -6479,7 +6484,7 @@ var I18n = function (_EventEmitter) {
6479
6484
  s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
6480
6485
  if (s.i18nFormat.init) s.i18nFormat.init(this);
6481
6486
  }
6482
- this.translator = new Translator$1(this.services, this.options);
6487
+ this.translator = new Translator(this.services, this.options);
6483
6488
  this.translator.on('*', function (event) {
6484
6489
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
6485
6490
  args[_key2 - 1] = arguments[_key2];
@@ -6839,7 +6844,7 @@ var I18n = function (_EventEmitter) {
6839
6844
  clone.services.utils = {
6840
6845
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
6841
6846
  };
6842
- clone.translator = new Translator$1(clone.services, clone.options);
6847
+ clone.translator = new Translator(clone.services, clone.options);
6843
6848
  clone.translator.on('*', function (event) {
6844
6849
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
6845
6850
  args[_key4 - 1] = arguments[_key4];
@@ -6890,26 +6895,41 @@ instance.hasLoadedNamespace;
6890
6895
  instance.loadNamespaces;
6891
6896
  instance.loadLanguages;
6892
6897
 
6898
+ function _extends() {
6899
+ _extends = Object.assign || function (target) {
6900
+ for (var i = 1; i < arguments.length; i++) {
6901
+ var source = arguments[i];
6902
+
6903
+ for (var key in source) {
6904
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
6905
+ target[key] = source[key];
6906
+ }
6907
+ }
6908
+ }
6909
+
6910
+ return target;
6911
+ };
6912
+
6913
+ return _extends.apply(this, arguments);
6914
+ }
6915
+
6893
6916
  var en = {
6894
6917
  translation: {
6895
6918
  categorize: {
6896
- limitMaxChoicesPerCategory:
6897
- "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
6898
- maxChoicesPerCategoryRestriction:
6899
- 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].',
6919
+ limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
6920
+ maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
6900
6921
  },
6901
6922
  ebsr: {
6902
- part: 'Part {{index}}',
6923
+ part: 'Part {{index}}'
6903
6924
  },
6904
6925
  numberLine: {
6905
6926
  addElementLimit_one: 'You can only add {{count}} element',
6906
6927
  addElementLimit_other: 'You can only add {{count}} elements',
6907
- clearAll: 'Clear all',
6928
+ clearAll: 'Clear all'
6908
6929
  },
6909
6930
  imageClozeAssociation: {
6910
- reachedLimit_one:
6911
- 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
6912
- reachedLimit_other: 'Full',
6931
+ reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
6932
+ reachedLimit_other: 'Full'
6913
6933
  },
6914
6934
  drawingResponse: {
6915
6935
  fillColor: 'Fill color',
@@ -6925,7 +6945,7 @@ var en = {
6925
6945
  green: 'Green',
6926
6946
  white: 'White',
6927
6947
  black: 'Black',
6928
- onDoubleClick: 'Double click to edit this text. Press Enter to submit.',
6948
+ onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
6929
6949
  },
6930
6950
  charting: {
6931
6951
  addCategory: 'Add category',
@@ -6937,8 +6957,8 @@ var en = {
6937
6957
  keyLegend: {
6938
6958
  incorrectAnswer: 'Student incorrect answer',
6939
6959
  correctAnswer: 'Student correct answer',
6940
- correctKeyAnswer: 'Answer key correct',
6941
- },
6960
+ correctKeyAnswer: 'Answer key correct'
6961
+ }
6942
6962
  },
6943
6963
  graphing: {
6944
6964
  point: 'Point',
@@ -6954,25 +6974,24 @@ var en = {
6954
6974
  vector: 'Vector',
6955
6975
  label: 'Label',
6956
6976
  redo: 'Redo',
6957
- reset: 'Reset',
6977
+ reset: 'Reset'
6958
6978
  },
6959
6979
  mathInline: {
6960
- primaryCorrectWithAlternates:
6961
- 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
6980
+ primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
6962
6981
  },
6963
6982
  multipleChoice: {
6964
6983
  minSelections: 'Select at least {{minSelections}}.',
6965
6984
  maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
6966
6985
  maxSelections_other: 'Only {{maxSelections}} answers are allowed.',
6967
6986
  minmaxSelections_equal: 'Select {{minSelections}}.',
6968
- minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.',
6987
+ minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.'
6969
6988
  },
6970
6989
  selectText: {
6971
6990
  correctAnswerSelected: 'Correct',
6972
6991
  correctAnswerNotSelected: 'Correct Answer Not Selected',
6973
6992
  incorrectSelection: 'Incorrect Selection',
6974
- key: 'Key',
6975
- },
6993
+ key: 'Key'
6994
+ }
6976
6995
  },
6977
6996
  common: {
6978
6997
  undo: 'Undo',
@@ -6981,35 +7000,31 @@ var en = {
6981
7000
  incorrect: 'Incorrect',
6982
7001
  showCorrectAnswer: 'Show correct answer',
6983
7002
  hideCorrectAnswer: 'Hide correct answer',
6984
- commonCorrectAnswerWithAlternates:
6985
- '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.',
7003
+ 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.',
6986
7004
  warning: 'Warning',
6987
7005
  showNote: 'Show Note',
6988
7006
  hideNote: 'Hide Note',
6989
- cancel: 'Cancel',
6990
- },
7007
+ cancel: 'Cancel'
7008
+ }
6991
7009
  };
6992
7010
 
6993
7011
  var es = {
6994
7012
  translation: {
6995
7013
  categorize: {
6996
- limitMaxChoicesPerCategory:
6997
- 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
6998
- maxChoicesPerCategoryRestriction:
6999
- 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta',
7014
+ limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
7015
+ maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
7000
7016
  },
7001
7017
  ebsr: {
7002
- part: 'Parte {{index}}',
7018
+ part: 'Parte {{index}}'
7003
7019
  },
7004
7020
  numberLine: {
7005
7021
  addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
7006
7022
  addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
7007
- clearAll: 'Borrar todo',
7023
+ clearAll: 'Borrar todo'
7008
7024
  },
7009
7025
  imageClozeAssociation: {
7010
- reachedLimit_one:
7011
- 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
7012
- reachedLimit_other: 'Lleno',
7026
+ reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
7027
+ reachedLimit_other: 'Lleno'
7013
7028
  },
7014
7029
  drawingResponse: {
7015
7030
  fillColor: 'Color de relleno',
@@ -7025,7 +7040,7 @@ var es = {
7025
7040
  green: 'Verde',
7026
7041
  white: 'Blanco',
7027
7042
  black: 'Negro',
7028
- onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar',
7043
+ onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
7029
7044
  },
7030
7045
  charting: {
7031
7046
  addCategory: 'Añadir categoría',
@@ -7037,8 +7052,8 @@ var es = {
7037
7052
  keyLegend: {
7038
7053
  incorrectAnswer: 'Respuesta incorrecta del estudiante',
7039
7054
  correctAnswer: 'Respuesta correcta del estudiante',
7040
- correctKeyAnswer: 'Clave de respuesta correcta',
7041
- },
7055
+ correctKeyAnswer: 'Clave de respuesta correcta'
7056
+ }
7042
7057
  },
7043
7058
  graphing: {
7044
7059
  point: 'Punto',
@@ -7054,25 +7069,24 @@ var es = {
7054
7069
  vector: 'Vector',
7055
7070
  label: 'Etiqueta',
7056
7071
  redo: 'Rehacer',
7057
- reset: 'Reiniciar',
7072
+ reset: 'Reiniciar'
7058
7073
  },
7059
7074
  mathInline: {
7060
- primaryCorrectWithAlternates:
7061
- 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.',
7075
+ primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
7062
7076
  },
7063
7077
  multipleChoice: {
7064
7078
  minSelections: 'Seleccione al menos {{minSelections}}.',
7065
7079
  maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
7066
7080
  maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.',
7067
7081
  minmaxSelections_equal: 'Seleccione {{minSelections}}.',
7068
- minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.',
7082
+ minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.'
7069
7083
  },
7070
7084
  selectText: {
7071
7085
  correctAnswerSelected: 'Respuesta Correcta',
7072
7086
  correctAnswerNotSelected: 'Respuesta Correcta No Seleccionada',
7073
7087
  incorrectSelection: 'Selección Incorrecta',
7074
- key: 'Clave',
7075
- },
7088
+ key: 'Clave'
7089
+ }
7076
7090
  },
7077
7091
  common: {
7078
7092
  undo: 'Deshacer',
@@ -7081,13 +7095,12 @@ var es = {
7081
7095
  incorrect: 'Incorrect',
7082
7096
  showCorrectAnswer: 'Mostrar respuesta correcta',
7083
7097
  hideCorrectAnswer: 'Ocultar respuesta correcta',
7084
- commonCorrectAnswerWithAlternates:
7085
- '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.',
7098
+ 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.',
7086
7099
  warning: 'Advertencia',
7087
7100
  showNote: 'Mostrar Nota',
7088
7101
  hideNote: 'Ocultar Nota',
7089
- cancel: 'Cancelar',
7090
- },
7102
+ cancel: 'Cancelar'
7103
+ }
7091
7104
  };
7092
7105
 
7093
7106
  instance.init({
@@ -7096,15 +7109,15 @@ instance.init({
7096
7109
  debug: true,
7097
7110
  resources: {
7098
7111
  en: en,
7099
- es: es,
7100
- },
7112
+ es: es
7113
+ }
7101
7114
  });
7102
-
7103
- var Translator = {
7104
- translator: {
7105
- ...instance,
7115
+ var index = {
7116
+ translator: _extends({}, instance, {
7106
7117
  t: (key, options) => {
7107
- const { lng } = options;
7118
+ const {
7119
+ lng
7120
+ } = options;
7108
7121
 
7109
7122
  switch (lng) {
7110
7123
  // these keys don't work with plurals, don't know why, so I added a workaround to convert them to the correct lng
@@ -7112,6 +7125,7 @@ var Translator = {
7112
7125
  case 'en-US':
7113
7126
  options.lng = 'en';
7114
7127
  break;
7128
+
7115
7129
  case 'es_ES':
7116
7130
  case 'es-ES':
7117
7131
  case 'es_MX':
@@ -7119,13 +7133,19 @@ var Translator = {
7119
7133
  options.lng = 'es';
7120
7134
  break;
7121
7135
  }
7122
- return instance.t(key, { lng, ...options });
7123
- },
7124
- },
7125
- languageOptions: [
7126
- { value: 'en_US', label: 'English (US)' },
7127
- { value: 'es_ES', label: 'Spanish' },
7128
- ],
7136
+
7137
+ return instance.t(key, _extends({
7138
+ lng
7139
+ }, options));
7140
+ }
7141
+ }),
7142
+ languageOptions: [{
7143
+ value: 'en_US',
7144
+ label: 'English (US)'
7145
+ }, {
7146
+ value: 'es_ES',
7147
+ label: 'Spanish'
7148
+ }]
7129
7149
  };
7130
7150
 
7131
7151
  var defaults = {
@@ -7145,7 +7165,7 @@ var defaults = {
7145
7165
  toolbarEditorPosition: 'bottom',
7146
7166
  };
7147
7167
 
7148
- const { translator } = Translator;
7168
+ const { translator } = index;
7149
7169
 
7150
7170
  const prepareChoice = (mode, defaultFeedback) => (choice) => {
7151
7171
  const out = {
@@ -7364,7 +7384,7 @@ const getScore = (config, session) => {
7364
7384
  */
7365
7385
  function outcome(model, session, env = {}) {
7366
7386
  return new Promise((resolve) => {
7367
- const partialScoringEnabled = enabled(model, env);
7387
+ const partialScoringEnabled = partialScoring.enabled(model, env);
7368
7388
  const score = getScore(model, session);
7369
7389
 
7370
7390
  resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: isEmpty_1(session) });