@pie-element/select-text 11.2.2-next.5 → 11.2.2-next.9
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.
- package/configure/package.json +3 -3
- package/controller/package.json +2 -2
- package/module/configure.js +1 -1
- package/module/controller.js +47 -82
- package/module/element.js +1 -1
- package/module/manifest.json +2 -2
- package/module/print.js +1 -1
- package/package.json +6 -6
package/module/controller.js
CHANGED
|
@@ -972,46 +972,17 @@ function isEmpty(value) {
|
|
|
972
972
|
|
|
973
973
|
var isEmpty_1 = isEmpty;
|
|
974
974
|
|
|
975
|
-
function _extends() {
|
|
976
|
-
_extends = Object.assign || function (target) {
|
|
977
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
978
|
-
var source = arguments[i];
|
|
979
|
-
|
|
980
|
-
for (var key in source) {
|
|
981
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
982
|
-
target[key] = source[key];
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
return target;
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
return _extends.apply(this, arguments);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
975
|
const defaults$1 = {
|
|
994
|
-
correct: {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
custom: 'Correct'
|
|
998
|
-
},
|
|
999
|
-
incorrect: {
|
|
1000
|
-
type: 'default',
|
|
1001
|
-
default: 'Incorrect',
|
|
1002
|
-
custom: 'Incorrect'
|
|
1003
|
-
},
|
|
1004
|
-
partial: {
|
|
1005
|
-
type: 'default',
|
|
1006
|
-
default: 'Nearly',
|
|
1007
|
-
custom: 'Nearly'
|
|
1008
|
-
},
|
|
976
|
+
correct: { type: 'default', default: 'Correct', custom: 'Correct' },
|
|
977
|
+
incorrect: { type: 'default', default: 'Incorrect', custom: 'Incorrect' },
|
|
978
|
+
partial: { type: 'default', default: 'Nearly', custom: 'Nearly' },
|
|
1009
979
|
unanswered: {
|
|
1010
980
|
type: 'default',
|
|
1011
981
|
default: 'You have not entered a response',
|
|
1012
|
-
custom: 'You have not entered a response'
|
|
1013
|
-
}
|
|
982
|
+
custom: 'You have not entered a response',
|
|
983
|
+
},
|
|
1014
984
|
};
|
|
985
|
+
|
|
1015
986
|
/**
|
|
1016
987
|
* @typedef {Object} FeedbackConfig
|
|
1017
988
|
* @property {'default'|'none'|'custom'} type
|
|
@@ -1024,45 +995,64 @@ const defaults$1 = {
|
|
|
1024
995
|
* @property {FeedbackConfig} partial
|
|
1025
996
|
*/
|
|
1026
997
|
|
|
1027
|
-
const normalizeCorrectness = c => {
|
|
998
|
+
const normalizeCorrectness = (c) => {
|
|
1028
999
|
if (c === 'partially-correct') {
|
|
1029
1000
|
return 'partial';
|
|
1030
1001
|
}
|
|
1031
|
-
|
|
1032
1002
|
return c;
|
|
1033
1003
|
};
|
|
1004
|
+
|
|
1034
1005
|
/**
|
|
1035
1006
|
* Get the feedback for the correctness
|
|
1036
1007
|
*
|
|
1037
1008
|
* @param {'correct'|'incorrect'|'partial'} correctness
|
|
1038
1009
|
* @param {Feedback} feedback
|
|
1039
1010
|
*/
|
|
1011
|
+
const getFeedbackForCorrectness = (correctness, feedback) =>
|
|
1012
|
+
new Promise((resolve) => {
|
|
1013
|
+
feedback = { ...defaults$1, ...feedback };
|
|
1014
|
+
correctness = normalizeCorrectness(correctness);
|
|
1015
|
+
const fb = feedback[correctness] || defaults$1[correctness] || {};
|
|
1016
|
+
const d = defaults$1[correctness] || {};
|
|
1017
|
+
getFeedback(fb, d[fb.type || 'default']).then((result) => resolve(result));
|
|
1018
|
+
});
|
|
1040
1019
|
|
|
1041
|
-
|
|
1042
|
-
const getFeedbackForCorrectness = (correctness, feedback) => new Promise(resolve => {
|
|
1043
|
-
feedback = _extends({}, defaults$1, feedback);
|
|
1044
|
-
correctness = normalizeCorrectness(correctness);
|
|
1045
|
-
const fb = feedback[correctness] || defaults$1[correctness] || {};
|
|
1046
|
-
const d = defaults$1[correctness] || {};
|
|
1047
|
-
getFeedback(fb, d[fb.type || 'default']).then(result => resolve(result));
|
|
1048
|
-
});
|
|
1049
1020
|
/**
|
|
1050
1021
|
* Get the feedback from a {FeedbackConfig}
|
|
1051
1022
|
*
|
|
1052
1023
|
* @param {FeedbackConfig} feedback
|
|
1053
1024
|
* @param {string} fallback
|
|
1054
1025
|
*/
|
|
1026
|
+
const getFeedback = (feedback, fallback) =>
|
|
1027
|
+
new Promise((resolve) => {
|
|
1028
|
+
if (!feedback || feedback.type === 'none') {
|
|
1029
|
+
resolve(undefined);
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
feedback = feedback || {};
|
|
1033
|
+
const out = feedback[feedback.type] || fallback;
|
|
1034
|
+
resolve(out);
|
|
1035
|
+
});
|
|
1055
1036
|
|
|
1056
|
-
const
|
|
1057
|
-
if
|
|
1058
|
-
|
|
1059
|
-
|
|
1037
|
+
const enabled = (config, env, defaultValue) => {
|
|
1038
|
+
// if model.partialScoring = false
|
|
1039
|
+
// - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
|
|
1040
|
+
// else if model.partialScoring = true || undefined
|
|
1041
|
+
// - if env.partialScoring = false, use dichotomous scoring
|
|
1042
|
+
// - else if env.partialScoring = true, use partial scoring
|
|
1043
|
+
config = config || {};
|
|
1044
|
+
env = env || {};
|
|
1045
|
+
|
|
1046
|
+
if (config.partialScoring === false) {
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
if (env.partialScoring === false) {
|
|
1051
|
+
return false;
|
|
1060
1052
|
}
|
|
1061
1053
|
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
resolve(out);
|
|
1065
|
-
}); // TODO: should replace getFeedbackForCorrectness
|
|
1054
|
+
return typeof defaultValue === 'boolean' ? defaultValue : true;
|
|
1055
|
+
};
|
|
1066
1056
|
|
|
1067
1057
|
var getNative = _getNative;
|
|
1068
1058
|
|
|
@@ -1727,33 +1717,8 @@ var Symbol = _Symbol;
|
|
|
1727
1717
|
var symbolProto = Symbol ? Symbol.prototype : undefined;
|
|
1728
1718
|
symbolProto ? symbolProto.toString : undefined;
|
|
1729
1719
|
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
// - if env.partialScoring = false || env.partialScoring = true => use dichotomous scoring
|
|
1733
|
-
// else if model.partialScoring = true || undefined
|
|
1734
|
-
// - if env.partialScoring = false, use dichotomous scoring
|
|
1735
|
-
// - else if env.partialScoring = true, use partial scoring
|
|
1736
|
-
config = config || {};
|
|
1737
|
-
env = env || {};
|
|
1738
|
-
|
|
1739
|
-
if (config.partialScoring === false) {
|
|
1740
|
-
return false;
|
|
1741
|
-
}
|
|
1742
|
-
|
|
1743
|
-
if (env.partialScoring === false) {
|
|
1744
|
-
return false;
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
return typeof defaultValue === 'boolean' ? defaultValue : true;
|
|
1748
|
-
};
|
|
1749
|
-
|
|
1750
|
-
var partialScoring = /*#__PURE__*/Object.freeze({
|
|
1751
|
-
__proto__: null,
|
|
1752
|
-
enabled: enabled
|
|
1753
|
-
});
|
|
1754
|
-
|
|
1755
|
-
const lg = n => console[n].bind(console, 'controller-utils:');
|
|
1756
|
-
|
|
1720
|
+
// eslint-disable-next-line no-console
|
|
1721
|
+
const lg = (n) => console[n].bind(console, 'controller-utils:');
|
|
1757
1722
|
lg('debug');
|
|
1758
1723
|
lg('log');
|
|
1759
1724
|
lg('warn');
|
|
@@ -1849,11 +1814,11 @@ const outcome = (question, session, env) =>
|
|
|
1849
1814
|
if (env.mode !== 'evaluate') {
|
|
1850
1815
|
resolve({ score: undefined, completed: undefined });
|
|
1851
1816
|
} else {
|
|
1852
|
-
const enabled =
|
|
1817
|
+
const enabled$1 = enabled(question, env, true);
|
|
1853
1818
|
const totalCorrect = question.tokens.filter((t) => t.correct);
|
|
1854
1819
|
const score = getPartialScore(question, session, totalCorrect);
|
|
1855
1820
|
resolve({
|
|
1856
|
-
score: enabled ? score : score === 1 ? 1 : 0,
|
|
1821
|
+
score: enabled$1 ? score : score === 1 ? 1 : 0,
|
|
1857
1822
|
});
|
|
1858
1823
|
}
|
|
1859
1824
|
});
|