@pie-element/number-line 12.0.0-beta.1 → 12.0.0-next.42

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.
@@ -0,0 +1,21 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/number-line@12.0.0-beta.1</title>
6
+ <script
7
+ type="module"
8
+ src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
9
+
10
+ <link
11
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
12
+ rel="stylesheet"
13
+ />
14
+ <style>
15
+ html, body {
16
+ font-family: 'Roboto', sans-serif;
17
+ }
18
+ </style>
19
+ <script type="module" src="./demo.js"></script>
20
+ </head>
21
+ </html>
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@pie-element/number-line",
3
+ "version": "12.0.0-beta.1",
4
+ "modules": [
5
+ {
6
+ "name": "@pie-lib/shared-module",
7
+ "version": "^3.0.5"
8
+ },
9
+ {
10
+ "name": "@pie-lib/math-rendering-module",
11
+ "version": "^4.0.5"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,102 @@
1
+ import PrintElement from './print.js';
2
+
3
+ var generate = {};
4
+
5
+ generate.model = (id, element) => ({
6
+ correctResponse: [
7
+ { type: 'point', pointType: 'full', domainPosition: 0 }
8
+ ],
9
+ feedback: {
10
+ correct: { type: 'default', default: 'Correct' },
11
+ partial: { type: 'default', default: 'Nearly' },
12
+ incorrect: { type: 'default', default: 'Incorrect' }
13
+ },
14
+ prompt: '',
15
+ widthEnabled: true,
16
+ graph: {
17
+ title: '',
18
+ arrows: { left: true, right: true },
19
+ width: 500,
20
+ domain: { min: -5, max: 5 },
21
+ ticks: { minor: 1, major: 2, tickIntervalType: 'Integer' },
22
+ initialElements: [],
23
+ maxNumberOfPoints: 30,
24
+ showMinorTicks: true,
25
+ snapPerTick: 1,
26
+ tickLabelOverrides: [],
27
+ initialType: 'PF',
28
+ exhibitOnly: false,
29
+ availableTypes: {
30
+ PF: true,
31
+ LFF: true,
32
+ LEF: true,
33
+ LFE: true,
34
+ LEE: true,
35
+ RFN: true,
36
+ RFP: true,
37
+ REN: true,
38
+ REP: true
39
+ }
40
+ },
41
+ id,
42
+ element,
43
+ });
44
+
45
+ const { model } = generate;
46
+
47
+ var config = {
48
+ elements: {
49
+ 'number-line': '../..',
50
+ },
51
+ models: [model('1', 'number-line')],
52
+ };
53
+
54
+ // new init - just shows off print!
55
+
56
+ const init = async () => {
57
+ console.log('define the element...');
58
+ await Promise.all(
59
+ config.models.map(async (m) => {
60
+ try {
61
+ const printTag = `${m.element}-print`;
62
+ if (customElements.get(printTag)) {
63
+ return true;
64
+ } else {
65
+ customElements.define(printTag, PrintElement);
66
+ await customElements.whenDefined(printTag);
67
+ return true;
68
+ }
69
+ } catch (e) {
70
+ return false;
71
+ }
72
+ })
73
+ );
74
+
75
+ console.log('now apply the model...');
76
+ config.models.forEach((m) => {
77
+ const printTag = `${m.element}-print`;
78
+ const h3s = document.createElement('h3');
79
+ h3s.textContent = 'student mode';
80
+ document.body.appendChild(h3s);
81
+ const de = document.createElement(printTag);
82
+ document.body.appendChild(de);
83
+ de.options = {};
84
+ de.model = m;
85
+
86
+ const h3 = document.createElement('h3');
87
+ h3.textContent = 'instructor mode';
88
+ document.body.appendChild(h3);
89
+ const instr = document.createElement(printTag);
90
+ document.body.appendChild(instr);
91
+ instr.options = { mode: 'instructor' };
92
+ instr.model = JSON.parse(JSON.stringify(m));
93
+ });
94
+ };
95
+
96
+ init()
97
+ .then(() => {
98
+ console.log('ready');
99
+ })
100
+ .catch((e) => {
101
+ console.error(e);
102
+ });
@@ -0,0 +1,18 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/number-line@12.0.0-beta.1</title>
6
+ <link
7
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
+ rel="stylesheet"
9
+ />
10
+ <style>
11
+ html, body {
12
+ font-family: 'Roboto', sans-serif;
13
+ }
14
+ </style>
15
+ <script type="module" src="./print-demo.js"></script>
16
+ </head>
17
+ <body></body>
18
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/number-line",
3
- "version": "12.0.0-beta.1",
3
+ "version": "12.0.0-next.42+bb1f3eb4e",
4
4
  "repository": "pie-framework/pie-elements",
5
5
  "description": "",
6
6
  "publishConfig": {
@@ -12,25 +12,24 @@
12
12
  "@emotion/style": "^0.8.0",
13
13
  "@mui/icons-material": "^7.3.4",
14
14
  "@mui/material": "^7.3.4",
15
- "@pie-lib/correct-answer-toggle": "3.1.0-next.5",
16
- "@pie-lib/icons": "3.1.0-next.4",
17
- "@pie-lib/math-rendering": "4.1.0-next.4",
18
- "@pie-lib/render-ui": "5.1.0-next.5",
19
- "@pie-lib/translator": "3.1.0-next.4",
15
+ "@pie-lib/correct-answer-toggle": "3.1.1-next.0",
16
+ "@pie-lib/icons": "3.1.1-next.0",
17
+ "@pie-lib/math-rendering": "4.1.1-next.0",
18
+ "@pie-lib/render-ui": "5.1.1-next.0",
19
+ "@pie-lib/translator": "3.1.1-next.0",
20
20
  "classnames": "^2.2.5",
21
21
  "d3-scale": "^4.0.2",
22
22
  "d3-selection": "^3.0.0",
23
23
  "lodash": "^4.17.10",
24
24
  "mathjs": "^7.5.1",
25
- "prop-types": "^15.6.1",
26
25
  "react": "18.2.0",
27
26
  "react-dom": "18.2.0",
28
- "react-jss": "^8.4.0",
29
- "react-transition-group": "^2.3.1"
27
+ "react-jss": "^10.10.0",
28
+ "react-transition-group": "^4.4.5"
30
29
  },
31
30
  "author": "pie framework developers",
32
31
  "license": "ISC",
33
- "gitHead": "b67101f1d8bf37c61231a7050a3bc3b799b7d35b",
32
+ "gitHead": "bb1f3eb4e3b5b1cb15024d459ffd6e94bf419712",
34
33
  "scripts": {
35
34
  "postpublish": "../../scripts/postpublish"
36
35
  },
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = exports.default = {
8
- correctResponse: [],
9
- feedback: {
10
- correct: {
11
- default: 'Correct',
12
- type: 'none'
13
- },
14
- incorrect: {
15
- default: 'Incorrect',
16
- type: 'none'
17
- },
18
- partial: {
19
- default: 'Nearly',
20
- type: 'none'
21
- }
22
- },
23
- graph: {
24
- arrows: {
25
- left: true,
26
- right: true
27
- },
28
- availableTypes: {
29
- PF: true
30
- },
31
- domain: {
32
- min: -1,
33
- max: 1
34
- },
35
- exhibitOnly: false,
36
- initialElements: [],
37
- initialType: 'PF',
38
- maxNumberOfPoints: 1,
39
- ticks: {
40
- minor: 0.125,
41
- major: 0.5,
42
- tickIntervalType: 'Decimal'
43
- },
44
- title: '',
45
- width: 500
46
- },
47
- prompt: '',
48
- promptEnabled: true,
49
- rationale: '',
50
- rationaleEnabled: true,
51
- teacherInstructions: '',
52
- teacherInstructionsEnabled: true,
53
- toolbarEditorPosition: 'bottom',
54
- widthEnabled: true
55
- };
56
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","names":["correctResponse","feedback","correct","default","type","incorrect","partial","graph","arrows","left","right","availableTypes","PF","domain","min","max","exhibitOnly","initialElements","initialType","maxNumberOfPoints","ticks","minor","major","tickIntervalType","title","width","prompt","promptEnabled","rationale","rationaleEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","widthEnabled"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n correctResponse: [],\n feedback: {\n correct: { default: 'Correct', type: 'none' },\n incorrect: { default: 'Incorrect', type: 'none' },\n partial: { default: 'Nearly', type: 'none' },\n },\n graph: {\n arrows: { left: true, right: true },\n availableTypes: {\n PF: true,\n },\n domain: { min: -1, max: 1 },\n exhibitOnly: false,\n initialElements: [],\n initialType: 'PF',\n maxNumberOfPoints: 1,\n ticks: { minor: 0.125, major: 0.5, tickIntervalType: 'Decimal' },\n title: '',\n width: 500,\n },\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n widthEnabled: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,eAAe,EAAE,EAAE;EACnBC,QAAQ,EAAE;IACRC,OAAO,EAAE;MAAEC,OAAO,EAAE,SAAS;MAAEC,IAAI,EAAE;IAAO,CAAC;IAC7CC,SAAS,EAAE;MAAEF,OAAO,EAAE,WAAW;MAAEC,IAAI,EAAE;IAAO,CAAC;IACjDE,OAAO,EAAE;MAAEH,OAAO,EAAE,QAAQ;MAAEC,IAAI,EAAE;IAAO;EAC7C,CAAC;EACDG,KAAK,EAAE;IACLC,MAAM,EAAE;MAAEC,IAAI,EAAE,IAAI;MAAEC,KAAK,EAAE;IAAK,CAAC;IACnCC,cAAc,EAAE;MACdC,EAAE,EAAE;IACN,CAAC;IACDC,MAAM,EAAE;MAAEC,GAAG,EAAE,CAAC,CAAC;MAAEC,GAAG,EAAE;IAAE,CAAC;IAC3BC,WAAW,EAAE,KAAK;IAClBC,eAAe,EAAE,EAAE;IACnBC,WAAW,EAAE,IAAI;IACjBC,iBAAiB,EAAE,CAAC;IACpBC,KAAK,EAAE;MAAEC,KAAK,EAAE,KAAK;MAAEC,KAAK,EAAE,GAAG;MAAEC,gBAAgB,EAAE;IAAU,CAAC;IAChEC,KAAK,EAAE,EAAE;IACTC,KAAK,EAAE;EACT,CAAC;EACDC,MAAM,EAAE,EAAE;EACVC,aAAa,EAAE,IAAI;EACnBC,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,IAAI;EACtBC,mBAAmB,EAAE,EAAE;EACvBC,0BAA0B,EAAE,IAAI;EAChCC,qBAAqB,EAAE,QAAQ;EAC/BC,YAAY,EAAE;AAChB,CAAC","ignoreList":[]}
@@ -1,362 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createCorrectResponseSession = exports.closeTo = exports.CLOSE_TO_PRECISION = void 0;
8
- exports.createDefaultModel = createDefaultModel;
9
- exports.getCorrectness = exports.getCorrected = void 0;
10
- exports.getScore = getScore;
11
- exports.model = model;
12
- exports.normalize = normalize;
13
- exports.outcome = outcome;
14
- exports.validate = void 0;
15
- var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
16
- var _find = _interopRequireDefault(require("lodash/find"));
17
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
18
- var _isEqualWith = _interopRequireDefault(require("lodash/isEqualWith"));
19
- var _merge = _interopRequireDefault(require("lodash/merge"));
20
- var _omitBy = _interopRequireDefault(require("lodash/omitBy"));
21
- var _feedback = require("@pie-lib/feedback");
22
- var _controllerUtils = require("@pie-lib/controller-utils");
23
- var math = _interopRequireWildcard(require("mathjs"));
24
- var _defaults = _interopRequireDefault(require("./defaults"));
25
- var _utils = require("./utils");
26
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
27
- const score = number => {
28
- return {
29
- score: {
30
- scaled: number
31
- }
32
- };
33
- };
34
- const getPartialScore = (corrected, ps) => {
35
- const {
36
- correct
37
- } = corrected;
38
- const rule = ps.find(r => r.numberOfCorrect === correct.length);
39
- if (rule) {
40
- return 1.0 * (rule.scorePercentage / 100);
41
- } else {
42
- return 0;
43
- }
44
- };
45
- const accumulateAnswer = correctResponse => (total, answer) => {
46
- const isCorrectResponse = correctResponse.some(cr => matches(cr)(answer));
47
- return total + (isCorrectResponse ? 1 : 0);
48
- };
49
-
50
- /**
51
- */
52
- function outcome(model, session, env) {
53
- return new Promise(resolve => {
54
- if (!session || (0, _isEmpty.default)(session)) {
55
- resolve({
56
- score: 0,
57
- empty: true
58
- });
59
- } else {
60
- const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
61
- const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);
62
- let total = model.correctResponse.length;
63
- let numIncorrect = 0;
64
- if ((session.answer || []).length > total) {
65
- numIncorrect = (session.answer || []).length - total;
66
- }
67
- if (total === 0) {
68
- total = 1;
69
- }
70
- let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;
71
- if (score < 0) {
72
- score = 0;
73
- }
74
- resolve({
75
- score: partialScoringEnabled ? score : score === 1 ? 1 : 0
76
- });
77
- }
78
- });
79
- }
80
- function getScore(question, session) {
81
- return new Promise(resolve => {
82
- if (!session || (0, _isEmpty.default)(session)) {
83
- resolve({
84
- score: {
85
- scaled: 0
86
- }
87
- });
88
- } else {
89
- session.answer = session.answer || [];
90
- const corrected = getCorrected(session.answer, (0, _cloneDeep.default)(question.correctResponse));
91
- const correctness = getCorrectness(corrected);
92
- if (correctness === 'correct') {
93
- resolve(score(1.0));
94
- } else if (correctness === 'incorrect') {
95
- resolve(score(0.0));
96
- } else if (correctness === 'partial') {
97
- const {
98
- allowPartialScoring,
99
- partialScoring
100
- } = question;
101
- const ps = (partialScoring || []).filter(o => !(0, _isEmpty.default)(o));
102
- const canDoPartialScoring = allowPartialScoring && ps.length > 0;
103
- if (canDoPartialScoring) {
104
- resolve(score(getPartialScore(corrected, ps)));
105
- } else {
106
- resolve(score(0.0));
107
- }
108
- } else {
109
- resolve({
110
- score: {
111
- scaled: -1
112
- }
113
- });
114
- }
115
- }
116
- });
117
- }
118
- const CLOSE_TO_PRECISION = exports.CLOSE_TO_PRECISION = 3;
119
- const closeTo = (a, b, precision) => {
120
- precision = precision || 5;
121
- const expectedDiff = Math.pow(10, -precision) / 2;
122
- const receivedDiff = Math.abs(a - b);
123
- const close = receivedDiff <= expectedDiff;
124
- return close;
125
- };
126
- exports.closeTo = closeTo;
127
- const matches = a => v => {
128
- return (0, _isEqualWith.default)(a, v, (v, ov) => {
129
- if (typeof v === 'number' && typeof ov === 'number') {
130
- return closeTo(v, ov, CLOSE_TO_PRECISION);
131
- }
132
- });
133
- };
134
- const getCorrected = (answer, correctResponse) => {
135
- if ((0, _isEmpty.default)(correctResponse) && answer.length > 0) {
136
- return {
137
- correct: [],
138
- incorrect: [],
139
- notInAnswer: [],
140
- noCorrectResponse: true
141
- };
142
- }
143
- return answer.reduce((acc, a, index) => {
144
- const {
145
- correct,
146
- incorrect,
147
- notInAnswer
148
- } = acc;
149
- const match = (0, _find.default)(notInAnswer, matches(a));
150
- if (match) {
151
- correct.push(index);
152
- notInAnswer.splice(notInAnswer.indexOf(match), 1);
153
- } else {
154
- incorrect.push(index);
155
- }
156
- return {
157
- correct: correct,
158
- incorrect: incorrect,
159
- notInAnswer: notInAnswer
160
- };
161
- }, {
162
- correct: [],
163
- incorrect: [],
164
- notInAnswer: correctResponse
165
- });
166
- };
167
- exports.getCorrected = getCorrected;
168
- const getCorrectness = corrected => {
169
- const {
170
- incorrect,
171
- correct,
172
- notInAnswer,
173
- noCorrectResponse
174
- } = corrected;
175
- if (noCorrectResponse) {
176
- return 'unknown';
177
- }
178
- if (incorrect.length === 0 && correct.length === 0) {
179
- return 'unanswered';
180
- }
181
- if (incorrect.length === 0 && notInAnswer.length === 0) {
182
- return 'correct';
183
- }
184
- if (incorrect.length > 0 || notInAnswer.length > 0) {
185
- if (correct.length > 0) {
186
- return 'partial';
187
- } else {
188
- return 'incorrect';
189
- }
190
- }
191
- return 'unknown';
192
- };
193
-
194
- /**
195
- * A sample of a normalize function see:
196
- * https://github.com/pie-framework/pie-elements/issues/21
197
- */
198
- exports.getCorrectness = getCorrectness;
199
- function normalize(question) {
200
- const feedback = (0, _merge.default)(_defaults.default.feedback, question.feedback);
201
- return {
202
- ..._defaults.default,
203
- ...question,
204
- feedback
205
- };
206
- }
207
- function createDefaultModel(model = {}) {
208
- return new Promise(resolve => {
209
- const out = {
210
- ...model,
211
- graph: {
212
- ..._defaults.default.graph,
213
- ...model.graph
214
- },
215
- colorContrast: 'black_on_white'
216
- };
217
- resolve((0, _omitBy.default)(out, v => !v));
218
- });
219
- }
220
-
221
- // this function is duplicated in configure; at some point, use the same shared function
222
- const updateTicks = model => {
223
- const {
224
- graph: {
225
- domain,
226
- labelStep,
227
- ticks = {}
228
- } = {}
229
- } = model;
230
- const {
231
- minor,
232
- major
233
- } = ticks;
234
- if (domain) {
235
- domain.min = Number((domain.min || 0).toFixed(2));
236
- domain.max = Number((domain.max || 0).toFixed(2));
237
- }
238
- if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\/[1-9][0-9]*$/g)) {
239
- model.graph.fraction = true;
240
- ticks.tickIntervalType = 'Fraction';
241
-
242
- // update the ticks frequency and label value to match the label step if needed
243
- const step = math.evaluate(labelStep);
244
- if (step !== major) {
245
- ticks.major = step;
246
- ticks.minor = step / (major / minor);
247
- }
248
- }
249
- return model;
250
- };
251
- async function model(question, session, env) {
252
- if (!question) {
253
- throw new Error('question is null');
254
- }
255
- const normalizedQuestion = await normalize(question);
256
- const normalizedModel = updateTicks(normalizedQuestion);
257
- // this function is also called in configure, it is a duplicate to maintain consistency and correctness
258
- const graph = (0, _utils.reloadTicksData)(normalizedModel.graph);
259
- if (graph) {
260
- const evaluateMode = env.mode === 'evaluate';
261
- const correctResponse = (0, _cloneDeep.default)(normalizedQuestion.correctResponse);
262
- const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);
263
- const correctness = evaluateMode && getCorrectness(corrected);
264
- const {
265
- exhibitOnly
266
- } = graph;
267
- const disabled = env.mode !== 'gather' || exhibitOnly === true;
268
- let teacherInstructions = null;
269
- if (env.role === 'instructor' && (env.mode === 'view' || evaluateMode)) {
270
- teacherInstructions = normalizedQuestion.teacherInstructions;
271
- }
272
- const feedbackMessage = evaluateMode ? await (0, _feedback.getFeedbackForCorrectness)(correctness, normalizedQuestion.feedback) : undefined;
273
- const out = {
274
- prompt: normalizedQuestion.prompt,
275
- teacherInstructions,
276
- graph,
277
- disabled,
278
- corrected,
279
- correctResponse: evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,
280
- feedback: feedbackMessage && {
281
- type: correctness,
282
- message: feedbackMessage
283
- },
284
- colorContrast: env.accessibility && env.accessibility.colorContrast || 'black_on_white',
285
- language: normalizedQuestion.language,
286
- extraCSSRules: normalizedQuestion.extraCSSRules
287
- };
288
- return (0, _omitBy.default)(out, v => !v);
289
- } else {
290
- throw new Error('graph is undefined');
291
- }
292
- }
293
- const createCorrectResponseSession = (question, env) => {
294
- return new Promise(resolve => {
295
- if (env.mode !== 'evaluate' && env.role === 'instructor') {
296
- const {
297
- correctResponse: answer
298
- } = question;
299
- resolve({
300
- answer,
301
- id: '1'
302
- });
303
- } else {
304
- resolve(null);
305
- }
306
- });
307
- };
308
-
309
- // remove all html tags
310
- exports.createCorrectResponseSession = createCorrectResponseSession;
311
- const getInnerText = html => (html || '').replaceAll(/<[^>]*>/g, '');
312
-
313
- // remove all html tags except img, iframe and source tag for audio
314
- const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
315
- const validate = (model = {}, config = {}) => {
316
- const {
317
- graph,
318
- correctResponse
319
- } = model || {};
320
- const {
321
- maxMaxElements = 20,
322
- numberLineDimensions: {
323
- min: minWidth = 200,
324
- max: maxWidth = 800
325
- } = {}
326
- } = config || {};
327
- const {
328
- width,
329
- domain,
330
- maxNumberOfPoints
331
- } = graph || {};
332
- const {
333
- min,
334
- max
335
- } = domain || {};
336
- const errors = {};
337
- ['teacherInstructions', 'prompt'].forEach(field => {
338
- if (config[field]?.required && !getContent(model[field])) {
339
- errors[field] = 'This field is required.';
340
- }
341
- });
342
- if (width < minWidth || width > maxWidth) {
343
- errors.widthError = `Width should be a value between ${minWidth} and ${maxWidth}.`;
344
- }
345
- const MIN_DOMAIN = -100000;
346
- const MAX_DOMAIN = 100000;
347
- if (min < MIN_DOMAIN || min > MAX_DOMAIN || max < MIN_DOMAIN || max > MAX_DOMAIN) {
348
- errors.domainError = `Min and max values must both be in the range [${MIN_DOMAIN}, ${MAX_DOMAIN}].`;
349
- }
350
- if (min >= max) {
351
- errors.maxError = 'Max value must be greater than min value.';
352
- }
353
- if (maxNumberOfPoints < 1 || maxNumberOfPoints > maxMaxElements) {
354
- errors.pointsError = `Max number of elements should be between 1 and ${maxMaxElements}.`;
355
- }
356
- if (correctResponse && correctResponse.length === 0) {
357
- errors.correctResponseError = 'The correct answer should include at least one number line object.';
358
- }
359
- return errors;
360
- };
361
- exports.validate = validate;
362
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_cloneDeep","_interopRequireDefault","require","_find","_isEmpty","_isEqualWith","_merge","_omitBy","_feedback","_controllerUtils","math","_interopRequireWildcard","_defaults","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","score","number","scaled","getPartialScore","corrected","ps","correct","rule","find","numberOfCorrect","length","scorePercentage","accumulateAnswer","correctResponse","total","answer","isCorrectResponse","some","cr","matches","outcome","model","session","env","Promise","resolve","isEmpty","empty","partialScoringEnabled","partialScoring","enabled","numCorrect","reduce","numIncorrect","getScore","question","getCorrected","cloneDeep","correctness","getCorrectness","allowPartialScoring","filter","canDoPartialScoring","CLOSE_TO_PRECISION","exports","closeTo","a","b","precision","expectedDiff","Math","pow","receivedDiff","abs","close","v","isEqualWith","ov","incorrect","notInAnswer","noCorrectResponse","acc","index","match","push","splice","indexOf","normalize","feedback","merge","defaults","createDefaultModel","out","graph","colorContrast","omitBy","updateTicks","domain","labelStep","ticks","minor","major","min","Number","toFixed","max","fraction","tickIntervalType","step","evaluate","Error","normalizedQuestion","normalizedModel","reloadTicksData","evaluateMode","mode","exhibitOnly","disabled","teacherInstructions","role","feedbackMessage","getFeedbackForCorrectness","undefined","prompt","type","message","accessibility","language","extraCSSRules","createCorrectResponseSession","id","getInnerText","html","replaceAll","getContent","replace","validate","config","maxMaxElements","numberLineDimensions","minWidth","maxWidth","width","maxNumberOfPoints","errors","forEach","field","required","widthError","MIN_DOMAIN","MAX_DOMAIN","domainError","maxError","pointsError","correctResponseError"],"sources":["../src/index.js"],"sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\nimport find from 'lodash/find';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqualWith from 'lodash/isEqualWith';\nimport merge from 'lodash/merge';\nimport omitBy from 'lodash/omitBy';\nimport { getFeedbackForCorrectness } from '@pie-lib/feedback';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport * as math from 'mathjs';\n\nimport defaults from './defaults';\nimport { reloadTicksData } from './utils';\n\nconst score = (number) => {\n return {\n score: {\n scaled: number,\n },\n };\n};\n\nconst getPartialScore = (corrected, ps) => {\n const { correct } = corrected;\n const rule = ps.find((r) => r.numberOfCorrect === correct.length);\n\n if (rule) {\n return 1.0 * (rule.scorePercentage / 100);\n } else {\n return 0;\n }\n};\n\nconst accumulateAnswer = (correctResponse) => (total, answer) => {\n const isCorrectResponse = correctResponse.some((cr) => matches(cr)(answer));\n return total + (isCorrectResponse ? 1 : 0);\n};\n\n/**\n */\nexport function outcome(model, session, env) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true });\n } else {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const numCorrect = (session.answer || []).reduce(accumulateAnswer(model.correctResponse), 0);\n\n let total = model.correctResponse.length;\n let numIncorrect = 0;\n\n if ((session.answer || []).length > total) {\n numIncorrect = (session.answer || []).length - total;\n }\n\n if (total === 0) {\n total = 1;\n }\n\n let score = numCorrect < 0 ? 0 : (numCorrect - numIncorrect) / total;\n\n if (score < 0) {\n score = 0;\n }\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0 });\n }\n });\n}\n\nexport function getScore(question, session) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: { scaled: 0 } });\n } else {\n session.answer = session.answer || [];\n\n const corrected = getCorrected(session.answer, cloneDeep(question.correctResponse));\n\n const correctness = getCorrectness(corrected);\n\n if (correctness === 'correct') {\n resolve(score(1.0));\n } else if (correctness === 'incorrect') {\n resolve(score(0.0));\n } else if (correctness === 'partial') {\n const { allowPartialScoring, partialScoring } = question;\n const ps = (partialScoring || []).filter((o) => !isEmpty(o));\n const canDoPartialScoring = allowPartialScoring && ps.length > 0;\n if (canDoPartialScoring) {\n resolve(score(getPartialScore(corrected, ps)));\n } else {\n resolve(score(0.0));\n }\n } else {\n resolve({ score: { scaled: -1 } });\n }\n }\n });\n}\n\nexport const CLOSE_TO_PRECISION = 3;\n\nexport const closeTo = (a, b, precision) => {\n precision = precision || 5;\n const expectedDiff = Math.pow(10, -precision) / 2;\n const receivedDiff = Math.abs(a - b);\n const close = receivedDiff <= expectedDiff;\n return close;\n};\n\nconst matches = (a) => (v) => {\n return isEqualWith(a, v, (v, ov) => {\n if (typeof v === 'number' && typeof ov === 'number') {\n return closeTo(v, ov, CLOSE_TO_PRECISION);\n }\n });\n};\n\nexport const getCorrected = (answer, correctResponse) => {\n if (isEmpty(correctResponse) && answer.length > 0) {\n return {\n correct: [],\n incorrect: [],\n notInAnswer: [],\n noCorrectResponse: true,\n };\n }\n\n return answer.reduce(\n (acc, a, index) => {\n const { correct, incorrect, notInAnswer } = acc;\n\n const match = find(notInAnswer, matches(a));\n if (match) {\n correct.push(index);\n notInAnswer.splice(notInAnswer.indexOf(match), 1);\n } else {\n incorrect.push(index);\n }\n\n return {\n correct: correct,\n incorrect: incorrect,\n notInAnswer: notInAnswer,\n };\n },\n {\n correct: [],\n incorrect: [],\n notInAnswer: correctResponse,\n },\n );\n};\n\nexport const getCorrectness = (corrected) => {\n const { incorrect, correct, notInAnswer, noCorrectResponse } = corrected;\n\n if (noCorrectResponse) {\n return 'unknown';\n }\n\n if (incorrect.length === 0 && correct.length === 0) {\n return 'unanswered';\n }\n\n if (incorrect.length === 0 && notInAnswer.length === 0) {\n return 'correct';\n }\n\n if (incorrect.length > 0 || notInAnswer.length > 0) {\n if (correct.length > 0) {\n return 'partial';\n } else {\n return 'incorrect';\n }\n }\n\n return 'unknown';\n};\n\n/**\n * A sample of a normalize function see:\n * https://github.com/pie-framework/pie-elements/issues/21\n */\nexport function normalize(question) {\n const feedback = merge(defaults.feedback, question.feedback);\n\n return { ...defaults, ...question, feedback };\n}\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n const out = {\n ...model,\n graph: {\n ...defaults.graph,\n ...model.graph,\n },\n colorContrast: 'black_on_white',\n };\n\n resolve(omitBy(out, (v) => !v));\n });\n}\n\n// this function is duplicated in configure; at some point, use the same shared function\nconst updateTicks = (model) => {\n const { graph: { domain, labelStep, ticks = {} } = {} } = model;\n const { minor, major } = ticks;\n\n if (domain) {\n domain.min = Number((domain.min || 0).toFixed(2));\n domain.max = Number((domain.max || 0).toFixed(2));\n }\n\n if (labelStep && typeof labelStep === 'string' && labelStep.match(/^[1-9][0-9]*\\/[1-9][0-9]*$/g)) {\n model.graph.fraction = true;\n ticks.tickIntervalType = 'Fraction';\n\n // update the ticks frequency and label value to match the label step if needed\n const step = math.evaluate(labelStep);\n\n if (step !== major) {\n ticks.major = step;\n ticks.minor = step / (major / minor);\n }\n }\n\n return model;\n};\n\nexport async function model(question, session, env) {\n if (!question) {\n throw new Error('question is null');\n }\n\n const normalizedQuestion = await normalize(question);\n const normalizedModel = updateTicks(normalizedQuestion);\n // this function is also called in configure, it is a duplicate to maintain consistency and correctness\n const graph = reloadTicksData(normalizedModel.graph);\n\n if (graph) {\n const evaluateMode = env.mode === 'evaluate';\n\n const correctResponse = cloneDeep(normalizedQuestion.correctResponse);\n const corrected = evaluateMode && getCorrected(session ? session.answer || [] : [], correctResponse);\n const correctness = evaluateMode && getCorrectness(corrected);\n\n const { exhibitOnly } = graph;\n const disabled = env.mode !== 'gather' || exhibitOnly === true;\n let teacherInstructions = null;\n\n if (env.role === 'instructor' && (env.mode === 'view' || evaluateMode)) {\n teacherInstructions = normalizedQuestion.teacherInstructions;\n }\n\n const feedbackMessage = evaluateMode\n ? await getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)\n : undefined;\n\n const out = {\n prompt: normalizedQuestion.prompt,\n teacherInstructions,\n graph,\n disabled,\n corrected,\n correctResponse:\n evaluateMode && ['unanswered', 'correct'].indexOf(correctness) === -1 && normalizedQuestion.correctResponse,\n feedback: feedbackMessage && {\n type: correctness,\n message: feedbackMessage,\n },\n colorContrast: (env.accessibility && env.accessibility.colorContrast) || 'black_on_white',\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n return omitBy(out, (v) => !v);\n } else {\n throw new Error('graph is undefined');\n }\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctResponse: answer } = question;\n\n resolve({\n answer,\n id: '1',\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { graph, correctResponse } = model || {};\n const { maxMaxElements = 20, numberLineDimensions: { min: minWidth = 200, max: maxWidth = 800 } = {} } = config || {};\n const { width, domain, maxNumberOfPoints } = graph || {};\n const { min, max } = domain || {};\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n if (width < minWidth || width > maxWidth) {\n errors.widthError = `Width should be a value between ${minWidth} and ${maxWidth}.`;\n }\n\n const MIN_DOMAIN = -100000;\n const MAX_DOMAIN = 100000;\n\n if (min < MIN_DOMAIN || min > MAX_DOMAIN || max < MIN_DOMAIN || max > MAX_DOMAIN) {\n errors.domainError = `Min and max values must both be in the range [${MIN_DOMAIN}, ${MAX_DOMAIN}].`;\n }\n\n if (min >= max) {\n errors.maxError = 'Max value must be greater than min value.';\n }\n\n if (maxNumberOfPoints < 1 || maxNumberOfPoints > maxMaxElements) {\n errors.pointsError = `Max number of elements should be between 1 and ${maxMaxElements}.`;\n }\n\n if (correctResponse && correctResponse.length === 0) {\n errors.correctResponseError = 'The correct answer should include at least one number line object.';\n }\n\n return errors;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAC,uBAAA,CAAAT,OAAA;AAEA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAA0C,SAAAS,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,M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