@pie-element/rubric 6.0.1 → 6.1.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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +1 -1
- package/package.json +6 -24
- package/esm/configure.js +0 -32172
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -69
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -11258
- package/esm/element.js.map +0 -1
- package/esm/print.js +0 -11278
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -113
- package/module/demo.js +0 -33
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -10
- package/module/print-demo.js +0 -71
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/esm/controller.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return obj;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var defaults = {
|
|
17
|
-
points: ['', '', '', ''],
|
|
18
|
-
sampleAnswers: [null, null, null, null],
|
|
19
|
-
maxPoints: 3,
|
|
20
|
-
maxPointsEnabled: true,
|
|
21
|
-
excludeZero: false,
|
|
22
|
-
excludeZeroEnabled: true
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
-
|
|
27
|
-
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) { _defineProperty(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; }
|
|
28
|
-
|
|
29
|
-
var normalize = model => _objectSpread(_objectSpread({}, defaults), model);
|
|
30
|
-
|
|
31
|
-
function model(model, session, env) {
|
|
32
|
-
return new Promise(resolve => {
|
|
33
|
-
var modelResult = normalize(model || {});
|
|
34
|
-
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function markupToText(s) {
|
|
39
|
-
return (s || '').replace(/(<([^>]+)>)/gi, '');
|
|
40
|
-
} // IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function validate(model) {
|
|
44
|
-
var {
|
|
45
|
-
points
|
|
46
|
-
} = model;
|
|
47
|
-
var errors = {};
|
|
48
|
-
var pointsDescriptorsErrors = {};
|
|
49
|
-
(points || []).forEach((point, index) => {
|
|
50
|
-
if (!point || point === '<div></div>') {
|
|
51
|
-
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
52
|
-
} else {
|
|
53
|
-
var identicalPointDescr = points.slice(index + 1).some(p => markupToText(p) === markupToText(point));
|
|
54
|
-
|
|
55
|
-
if (identicalPointDescr) {
|
|
56
|
-
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
62
|
-
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return errors;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { model, validate };
|
|
69
|
-
//# sourceMappingURL=controller.js.map
|
package/esm/controller.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sources":["../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../controller/src/defaults.js","../controller/src/index.js"],"sourcesContent":["export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","export default {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n maxPointsEnabled: true,\n excludeZero: false,\n excludeZeroEnabled: true,\n};\n","import defaults from './defaults';\n\nconst normalize = (model) => ({ ...defaults, ...model });\n\nexport function model(model, session, env) {\n return new Promise((resolve) => {\n const modelResult = normalize(model || {});\n\n resolve(env && env.role && env.role === 'instructor' ? modelResult : {});\n });\n}\n\nfunction markupToText(s) {\n return (s || '').replace(/(<([^>]+)>)/gi, '');\n}\n\n// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.\nexport function validate(model) {\n const { points } = model;\n const errors = {};\n const pointsDescriptorsErrors = {};\n\n (points || []).forEach((point, index) => {\n\n if (!point || point === '<div></div>') {\n pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';\n } else {\n const identicalPointDescr = points.slice(index + 1).some((p) => markupToText(p) === markupToText(point));\n\n if (identicalPointDescr) {\n pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';\n }\n }\n });\n\n if (Object.keys(pointsDescriptorsErrors).length > 0) {\n errors.pointsDescriptorsErrors = pointsDescriptorsErrors;\n }\n\n return errors;\n}\n"],"names":["points","sampleAnswers","maxPoints","maxPointsEnabled","excludeZero","excludeZeroEnabled","normalize","model","defaults","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"mappings":"AAAe,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE;AACzD,EAAE,IAAI,GAAG,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;AACpC,MAAM,KAAK,EAAE,KAAK;AAClB,MAAM,UAAU,EAAE,IAAI;AACtB,MAAM,YAAY,EAAE,IAAI;AACxB,MAAM,QAAQ,EAAE,IAAI;AACpB,KAAK,CAAC,CAAC;AACP,GAAG,MAAM;AACT,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrB,GAAG;AACH;AACA,EAAE,OAAO,GAAG,CAAC;AACb;;ACbA,eAAe;AACbA,EAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADK;AAEbC,EAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFF;AAGbC,EAAAA,SAAS,EAAE,CAHE;AAIbC,EAAAA,gBAAgB,EAAE,IAJL;AAKbC,EAAAA,WAAW,EAAE,KALA;AAMbC,EAAAA,kBAAkB,EAAE,IAAA;AANP,CAAf;;;;;;ACEA,IAAMC,SAAS,GAAIC,KAAD,oCAAiBC,QAAjB,CAAA,EAA8BD,KAA9B,CAAlB,CAAA;;AAEO,SAASA,KAAT,CAAeA,KAAf,EAAsBE,OAAtB,EAA+BC,GAA/B,EAAoC;AACzC,EAAA,OAAO,IAAIC,OAAJ,CAAaC,OAAD,IAAa;AAC9B,IAAA,IAAMC,WAAW,GAAGP,SAAS,CAACC,KAAK,IAAI,EAAV,CAA7B,CAAA;AAEAK,IAAAA,OAAO,CAACF,GAA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