@pie-lib/feedback 0.24.1 → 0.25.0-mui-update.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/CHANGELOG.md +4 -12
- package/lib/index.js +16 -36
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [0.25.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.24.0-mui-update.0...@pie-lib/feedback@0.25.0-mui-update.0) (2025-11-05)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/feedback
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# [0.24.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.23.0...@pie-lib/feedback@0.24.0) (2025-
|
|
14
|
+
# [0.24.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.23.0-mui-update.0...@pie-lib/feedback@0.24.0-mui-update.0) (2025-11-03)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @pie-lib/feedback
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
# [0.23.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.
|
|
22
|
+
# [0.23.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.21.0-mui-update.0...@pie-lib/feedback@0.23.0-mui-update.0) (2025-11-03)
|
|
23
23
|
|
|
24
24
|
**Note:** Version bump only for package @pie-lib/feedback
|
|
25
25
|
|
|
@@ -27,15 +27,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
# [0.
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @pie-lib/feedback
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [0.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.20.0...@pie-lib/feedback@0.21.0) (2025-10-16)
|
|
30
|
+
# [0.21.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/feedback@0.20.0...@pie-lib/feedback@0.21.0-mui-update.0) (2025-10-31)
|
|
39
31
|
|
|
40
32
|
**Note:** Version bump only for package @pie-lib/feedback
|
|
41
33
|
|
package/lib/index.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.getFeedbackForCorrectness = exports.getFeedback = exports.getActualFeedbackForCorrectness = exports.getActualFeedback = exports.defaults = void 0;
|
|
9
|
-
|
|
10
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
|
|
16
|
-
var defaults = {
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
var defaults = exports.defaults = {
|
|
17
12
|
correct: {
|
|
18
13
|
type: 'default',
|
|
19
14
|
"default": 'Correct',
|
|
@@ -35,6 +30,7 @@ var defaults = {
|
|
|
35
30
|
custom: 'You have not entered a response'
|
|
36
31
|
}
|
|
37
32
|
};
|
|
33
|
+
|
|
38
34
|
/**
|
|
39
35
|
* @typedef {Object} FeedbackConfig
|
|
40
36
|
* @property {'default'|'none'|'custom'} type
|
|
@@ -47,24 +43,20 @@ var defaults = {
|
|
|
47
43
|
* @property {FeedbackConfig} partial
|
|
48
44
|
*/
|
|
49
45
|
|
|
50
|
-
exports.defaults = defaults;
|
|
51
|
-
|
|
52
46
|
var normalizeCorrectness = function normalizeCorrectness(c) {
|
|
53
47
|
if (c === 'partially-correct') {
|
|
54
48
|
return 'partial';
|
|
55
49
|
}
|
|
56
|
-
|
|
57
50
|
return c;
|
|
58
51
|
};
|
|
52
|
+
|
|
59
53
|
/**
|
|
60
54
|
* Get the feedback for the correctness
|
|
61
55
|
*
|
|
62
56
|
* @param {'correct'|'incorrect'|'partial'} correctness
|
|
63
57
|
* @param {Feedback} feedback
|
|
64
58
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var getFeedbackForCorrectness = function getFeedbackForCorrectness(correctness, feedback) {
|
|
59
|
+
var getFeedbackForCorrectness = exports.getFeedbackForCorrectness = function getFeedbackForCorrectness(correctness, feedback) {
|
|
68
60
|
return new Promise(function (resolve) {
|
|
69
61
|
feedback = _objectSpread(_objectSpread({}, defaults), feedback);
|
|
70
62
|
correctness = normalizeCorrectness(correctness);
|
|
@@ -75,63 +67,51 @@ var getFeedbackForCorrectness = function getFeedbackForCorrectness(correctness,
|
|
|
75
67
|
});
|
|
76
68
|
});
|
|
77
69
|
};
|
|
70
|
+
|
|
78
71
|
/**
|
|
79
72
|
* Get the feedback from a {FeedbackConfig}
|
|
80
73
|
*
|
|
81
74
|
* @param {FeedbackConfig} feedback
|
|
82
75
|
* @param {string} fallback
|
|
83
76
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
exports.getFeedbackForCorrectness = getFeedbackForCorrectness;
|
|
87
|
-
|
|
88
|
-
var getFeedback = function getFeedback(feedback, fallback) {
|
|
77
|
+
var getFeedback = exports.getFeedback = function getFeedback(feedback, fallback) {
|
|
89
78
|
return new Promise(function (resolve) {
|
|
90
79
|
if (!feedback || feedback.type === 'none') {
|
|
91
80
|
resolve(undefined);
|
|
92
81
|
return;
|
|
93
82
|
}
|
|
94
|
-
|
|
95
83
|
feedback = feedback || {};
|
|
96
84
|
var out = feedback[feedback.type] || fallback;
|
|
97
85
|
resolve(out);
|
|
98
86
|
});
|
|
99
|
-
};
|
|
87
|
+
};
|
|
100
88
|
|
|
89
|
+
// TODO: should replace getFeedbackForCorrectness
|
|
101
90
|
/**
|
|
102
91
|
* Get feedback for correctness
|
|
103
92
|
* @param {'correct'|'incorrect'|'partial'} correctness
|
|
104
93
|
* @param {Feedback} feedback
|
|
105
94
|
*/
|
|
95
|
+
var getActualFeedbackForCorrectness = exports.getActualFeedbackForCorrectness = function getActualFeedbackForCorrectness(correctness, feedback) {
|
|
96
|
+
feedback = _objectSpread(_objectSpread({}, defaults), feedback);
|
|
106
97
|
|
|
107
|
-
|
|
108
|
-
exports.getFeedback = getFeedback;
|
|
109
|
-
|
|
110
|
-
var getActualFeedbackForCorrectness = function getActualFeedbackForCorrectness(correctness, feedback) {
|
|
111
|
-
feedback = _objectSpread(_objectSpread({}, defaults), feedback); // normalize correctness
|
|
112
|
-
|
|
98
|
+
// normalize correctness
|
|
113
99
|
correctness = correctness === 'partially-correct' ? 'partial' : correctness;
|
|
114
100
|
var defaultFeedback = defaults[correctness] || {};
|
|
115
101
|
var fb = feedback[correctness] || defaultFeedback;
|
|
116
102
|
return getActualFeedback(fb, defaultFeedback[fb.type || 'default']);
|
|
117
|
-
};
|
|
103
|
+
};
|
|
118
104
|
|
|
105
|
+
// TODO: should replace getFeedback
|
|
119
106
|
/**
|
|
120
107
|
* Get the feedback from a {FeedbackConfig}
|
|
121
108
|
* @param {FeedbackConfig} feedback
|
|
122
109
|
* @param {string} fallback
|
|
123
110
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
exports.getActualFeedbackForCorrectness = getActualFeedbackForCorrectness;
|
|
127
|
-
|
|
128
|
-
var getActualFeedback = function getActualFeedback(feedback, fallback) {
|
|
111
|
+
var getActualFeedback = exports.getActualFeedback = function getActualFeedback(feedback, fallback) {
|
|
129
112
|
if (!feedback || feedback.type === 'none') {
|
|
130
113
|
return undefined;
|
|
131
114
|
}
|
|
132
|
-
|
|
133
115
|
return feedback[feedback.type] || fallback;
|
|
134
116
|
};
|
|
135
|
-
|
|
136
|
-
exports.getActualFeedback = getActualFeedback;
|
|
137
117
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["defaults","exports","correct","type","custom","incorrect","partial","unanswered","normalizeCorrectness","c","getFeedbackForCorrectness","correctness","feedback","Promise","resolve","_objectSpread","fb","d","getFeedback","then","result","fallback","undefined","out","getActualFeedbackForCorrectness","defaultFeedback","getActualFeedback"],"sources":["../src/index.js"],"sourcesContent":["export const defaults = {\n correct: { type: 'default', default: 'Correct', custom: 'Correct' },\n incorrect: { type: 'default', default: 'Incorrect', custom: 'Incorrect' },\n partial: { type: 'default', default: 'Nearly', custom: 'Nearly' },\n unanswered: {\n type: 'default',\n default: 'You have not entered a response',\n custom: 'You have not entered a response',\n },\n};\n\n/**\n * @typedef {Object} FeedbackConfig\n * @property {'default'|'none'|'custom'} type\n * @property {string} default\n * @property {string} custom\n *\n * @typedef {Object} Feedback\n * @property {FeedbackConfig} correct\n * @property {FeedbackConfig} incorrect\n * @property {FeedbackConfig} partial\n */\n\nconst normalizeCorrectness = (c) => {\n if (c === 'partially-correct') {\n return 'partial';\n }\n return c;\n};\n\n/**\n * Get the feedback for the correctness\n *\n * @param {'correct'|'incorrect'|'partial'} correctness\n * @param {Feedback} feedback\n */\nexport const getFeedbackForCorrectness = (correctness, feedback) =>\n new Promise((resolve) => {\n feedback = { ...defaults, ...feedback };\n correctness = normalizeCorrectness(correctness);\n const fb = feedback[correctness] || defaults[correctness] || {};\n const d = defaults[correctness] || {};\n getFeedback(fb, d[fb.type || 'default']).then((result) => resolve(result));\n });\n\n/**\n * Get the feedback from a {FeedbackConfig}\n *\n * @param {FeedbackConfig} feedback\n * @param {string} fallback\n */\nexport const getFeedback = (feedback, fallback) =>\n new Promise((resolve) => {\n if (!feedback || feedback.type === 'none') {\n resolve(undefined);\n return;\n }\n feedback = feedback || {};\n const out = feedback[feedback.type] || fallback;\n resolve(out);\n });\n\n// TODO: should replace getFeedbackForCorrectness\n/**\n * Get feedback for correctness\n * @param {'correct'|'incorrect'|'partial'} correctness\n * @param {Feedback} feedback\n */\nexport const getActualFeedbackForCorrectness = (correctness, feedback) => {\n feedback = { ...defaults, ...feedback };\n\n // normalize correctness\n correctness = correctness === 'partially-correct' ? 'partial' : correctness;\n\n const defaultFeedback = defaults[correctness] || {};\n const fb = feedback[correctness] || defaultFeedback;\n\n return getActualFeedback(fb, defaultFeedback[fb.type || 'default']);\n};\n\n// TODO: should replace getFeedback\n/**\n * Get the feedback from a {FeedbackConfig}\n * @param {FeedbackConfig} feedback\n * @param {string} fallback\n */\nexport const getActualFeedback = (feedback, fallback) => {\n if (!feedback || feedback.type === 'none') {\n return undefined;\n }\n\n return feedback[feedback.type] || fallback;\n};\n"],"mappings":";;;;;;;;;;AAAO,IAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtBE,OAAO,EAAE;IAAEC,IAAI,EAAE,SAAS;IAAE,WAAS,SAAS;IAAEC,MAAM,EAAE;EAAU,CAAC;EACnEC,SAAS,EAAE;IAAEF,IAAI,EAAE,SAAS;IAAE,WAAS,WAAW;IAAEC,MAAM,EAAE;EAAY,CAAC;EACzEE,OAAO,EAAE;IAAEH,IAAI,EAAE,SAAS;IAAE,WAAS,QAAQ;IAAEC,MAAM,EAAE;EAAS,CAAC;EACjEG,UAAU,EAAE;IACVJ,IAAI,EAAE,SAAS;IACf,WAAS,iCAAiC;IAC1CC,MAAM,EAAE;EACV;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMI,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,CAAC,EAAK;EAClC,IAAIA,CAAC,KAAK,mBAAmB,EAAE;IAC7B,OAAO,SAAS;EAClB;EACA,OAAOA,CAAC;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,yBAAyB,GAAAT,OAAA,CAAAS,yBAAA,GAAG,SAA5BA,yBAAyBA,CAAIC,WAAW,EAAEC,QAAQ;EAAA,OAC7D,IAAIC,OAAO,CAAC,UAACC,OAAO,EAAK;IACvBF,QAAQ,GAAAG,aAAA,CAAAA,aAAA,KAAQf,QAAQ,GAAKY,QAAQ,CAAE;IACvCD,WAAW,GAAGH,oBAAoB,CAACG,WAAW,CAAC;IAC/C,IAAMK,EAAE,GAAGJ,QAAQ,CAACD,WAAW,CAAC,IAAI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B,CAACV,EAAE,EAAES,eAAe,CAACT,EAAE,CAACb,IAAI,IAAI,SAAS,CAAC,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACO,IAAMuB,iBAAiB,GAAAzB,OAAA,CAAAyB,iBAAA,GAAG,SAApBA,iBAAiBA,CAAId,QAAQ,EAAES,QAAQ,EAAK;EACvD,IAAI,CAACT,QAAQ,IAAIA,QAAQ,CAACT,IAAI,KAAK,MAAM,EAAE;IACzC,OAAOmB,SAAS;EAClB;EAEA,OAAOV,QAAQ,CAACA,QAAQ,CAACT,IAAI,CAAC,IAAIkB,QAAQ;AAC5C,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/feedback",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0-mui-update.0",
|
|
4
4
|
"description": "Feedback utilities",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
"scripts": {},
|
|
11
11
|
"author": "",
|
|
12
12
|
"license": "ISC",
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "2e0222bda045f46b504640a972d43787e68288c4"
|
|
14
14
|
}
|