@pie-element/select-text 11.0.1 → 11.0.3-esm.0
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 +4 -4
- package/controller/package.json +3 -3
- package/esm/configure.css +847 -0
- package/esm/configure.js +339 -21724
- package/esm/configure.js.map +1 -1
- package/esm/controller.css +847 -0
- package/esm/controller.js +63 -98
- package/esm/controller.js.map +1 -1
- package/esm/element.css +847 -0
- package/esm/element.js +61 -7476
- package/esm/element.js.map +1 -1
- package/esm/print.css +847 -0
- package/esm/print.js +54 -7466
- package/esm/print.js.map +1 -1
- package/module/configure.js +1 -1
- package/module/controller.js +82 -47
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +6 -6
package/module/controller.js
CHANGED
|
@@ -972,17 +972,46 @@ 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
|
+
|
|
975
993
|
const defaults$1 = {
|
|
976
|
-
correct: {
|
|
977
|
-
|
|
978
|
-
|
|
994
|
+
correct: {
|
|
995
|
+
type: 'default',
|
|
996
|
+
default: 'Correct',
|
|
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
|
+
},
|
|
979
1009
|
unanswered: {
|
|
980
1010
|
type: 'default',
|
|
981
1011
|
default: 'You have not entered a response',
|
|
982
|
-
custom: 'You have not entered a response'
|
|
983
|
-
}
|
|
1012
|
+
custom: 'You have not entered a response'
|
|
1013
|
+
}
|
|
984
1014
|
};
|
|
985
|
-
|
|
986
1015
|
/**
|
|
987
1016
|
* @typedef {Object} FeedbackConfig
|
|
988
1017
|
* @property {'default'|'none'|'custom'} type
|
|
@@ -995,64 +1024,45 @@ const defaults$1 = {
|
|
|
995
1024
|
* @property {FeedbackConfig} partial
|
|
996
1025
|
*/
|
|
997
1026
|
|
|
998
|
-
const normalizeCorrectness =
|
|
1027
|
+
const normalizeCorrectness = c => {
|
|
999
1028
|
if (c === 'partially-correct') {
|
|
1000
1029
|
return 'partial';
|
|
1001
1030
|
}
|
|
1031
|
+
|
|
1002
1032
|
return c;
|
|
1003
1033
|
};
|
|
1004
|
-
|
|
1005
1034
|
/**
|
|
1006
1035
|
* Get the feedback for the correctness
|
|
1007
1036
|
*
|
|
1008
1037
|
* @param {'correct'|'incorrect'|'partial'} correctness
|
|
1009
1038
|
* @param {Feedback} feedback
|
|
1010
1039
|
*/
|
|
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
|
-
});
|
|
1019
1040
|
|
|
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
|
+
});
|
|
1020
1049
|
/**
|
|
1021
1050
|
* Get the feedback from a {FeedbackConfig}
|
|
1022
1051
|
*
|
|
1023
1052
|
* @param {FeedbackConfig} feedback
|
|
1024
1053
|
* @param {string} fallback
|
|
1025
1054
|
*/
|
|
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
|
-
});
|
|
1036
1055
|
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
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;
|
|
1056
|
+
const getFeedback = (feedback, fallback) => new Promise(resolve => {
|
|
1057
|
+
if (!feedback || feedback.type === 'none') {
|
|
1058
|
+
resolve(undefined);
|
|
1059
|
+
return;
|
|
1052
1060
|
}
|
|
1053
1061
|
|
|
1054
|
-
|
|
1055
|
-
|
|
1062
|
+
feedback = feedback || {};
|
|
1063
|
+
const out = feedback[feedback.type] || fallback;
|
|
1064
|
+
resolve(out);
|
|
1065
|
+
}); // TODO: should replace getFeedbackForCorrectness
|
|
1056
1066
|
|
|
1057
1067
|
var getNative = _getNative;
|
|
1058
1068
|
|
|
@@ -1717,8 +1727,33 @@ var Symbol = _Symbol;
|
|
|
1717
1727
|
var symbolProto = Symbol ? Symbol.prototype : undefined;
|
|
1718
1728
|
symbolProto ? symbolProto.toString : undefined;
|
|
1719
1729
|
|
|
1720
|
-
|
|
1721
|
-
|
|
1730
|
+
const enabled = (config, env, defaultValue) => {
|
|
1731
|
+
// if model.partialScoring = false
|
|
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
|
+
|
|
1722
1757
|
lg('debug');
|
|
1723
1758
|
lg('log');
|
|
1724
1759
|
lg('warn');
|
|
@@ -1814,11 +1849,11 @@ const outcome = (question, session, env) =>
|
|
|
1814
1849
|
if (env.mode !== 'evaluate') {
|
|
1815
1850
|
resolve({ score: undefined, completed: undefined });
|
|
1816
1851
|
} else {
|
|
1817
|
-
const enabled
|
|
1852
|
+
const enabled = partialScoring.enabled(question, env, true);
|
|
1818
1853
|
const totalCorrect = question.tokens.filter((t) => t.correct);
|
|
1819
1854
|
const score = getPartialScore(question, session, totalCorrect);
|
|
1820
1855
|
resolve({
|
|
1821
|
-
score: enabled
|
|
1856
|
+
score: enabled ? score : score === 1 ? 1 : 0,
|
|
1822
1857
|
});
|
|
1823
1858
|
}
|
|
1824
1859
|
});
|